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

Side by Side Diff: include.preload.js

Issue 5197857351008256: Issue 343 - Fix element collapsing in Chrome 35 (Closed)
Patch Set: Created April 17, 2014, 10:39 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 url: url, 91 url: url,
92 mediatype: typeMap[tag] 92 mediatype: typeMap[tag]
93 }, 93 },
94 94
95 function(response) 95 function(response)
96 { 96 {
97 if (response && target.parentNode) 97 if (response && target.parentNode)
98 { 98 {
99 // <frame> cannot be removed, doing that will mess up the frameset 99 // <frame> cannot be removed, doing that will mess up the frameset
100 if (tag == "frame") 100 if (tag == "frame")
101 target.style.setProperty("visibility", "hidden", "!important"); 101 target.style.setProperty("visibility", "hidden", "important");
102 else 102 else
103 target.style.setProperty("display", "none", "!important"); 103 target.style.setProperty("display", "none", "important");
104 } 104 }
105 } 105 }
106 ); 106 );
107 } 107 }
108 } 108 }
109 109
110 function init() 110 function init()
111 { 111 {
112 // Make sure this is really an HTML page, as Chrome runs these scripts on just about everything 112 // Make sure this is really an HTML page, as Chrome runs these scripts on just about everything
113 if (!(document.documentElement instanceof HTMLElement)) 113 if (!(document.documentElement instanceof HTMLElement))
114 return; 114 return;
115 115
116 document.addEventListener("error", checkCollapse, true); 116 document.addEventListener("error", checkCollapse, true);
117 document.addEventListener("load", checkCollapse, true); 117 document.addEventListener("load", checkCollapse, true);
118 118
119 var attr = document.documentElement.getAttribute("data-adblockkey"); 119 var attr = document.documentElement.getAttribute("data-adblockkey");
120 if (attr) 120 if (attr)
121 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr}); 121 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr});
122 122
123 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 123 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
124 } 124 }
125 125
126 // In Chrome 18 the document might not be initialized yet 126 // In Chrome 18 the document might not be initialized yet
127 if (document.documentElement) 127 if (document.documentElement)
128 init(); 128 init();
129 else 129 else
130 window.setTimeout(init, 0); 130 window.setTimeout(init, 0);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld