Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.preload.js

Issue 16067002: Added Safari Support (Closed)
Patch Set: Rebased on upstream and addressed comments Created Oct. 25, 2013, 4:13 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include.postload.js ('k') | lib/stats.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -78,18 +78,26 @@
if (!url)
return;
- var type = typeMap[tag];
- chrome.extension.sendRequest({reqtype: "should-collapse", url: url, documentUrl: document.URL, type: type}, function(response)
- {
- if (response && target.parentNode)
+ ext.backgroundPage.sendMessage(
{
- // <frame> cannot be removed, doing that will mess up the frameset
- if (tag == "frame")
- target.style.setProperty("visibility", "hidden", "!important");
- else
- target.parentNode.removeChild(target);
+ type: "should-collapse",
+ url: url,
+ documentUrl: document.URL,
+ mediatype: typeMap[tag]
+ },
+
+ function(response)
+ {
+ if (response && target.parentNode)
+ {
+ // <frame> cannot be removed, doing that will mess up the frameset
+ if (tag == "frame")
+ target.style.setProperty("visibility", "hidden", "!important");
+ else
+ target.parentNode.removeChild(target);
+ }
}
- });
+ );
}
}
@@ -102,10 +110,18 @@
document.addEventListener("error", checkCollapse, true);
document.addEventListener("load", checkCollapse, true);
- chrome.extension.sendRequest({reqtype: "get-settings", selectors: true, frameUrl: window.location.href}, function(response)
- {
- setElemhideCSSRules(response.selectors);
- });
+ ext.backgroundPage.sendMessage(
+ {
+ type: "get-settings",
+ selectors: true,
+ frameUrl: window.location.href
+ },
+
+ function(response)
+ {
+ setElemhideCSSRules(response.selectors);
+ }
+ );
}
// In Chrome 18 the document might not be initialized yet
« no previous file with comments | « include.postload.js ('k') | lib/stats.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld