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

Delta Between Two Patch Sets: include.preload.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
Left Patch Set: Created Jan. 10, 2014, 10:27 a.m.
Right Patch Set: Created July 18, 2014, 9:13 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« include.postload.js ('K') | « include.postload.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return document.location.protocol + "//" + document.location.host + url; 105 return document.location.protocol + "//" + document.location.host + url;
106 } 106 }
107 107
108 // Remove filename and add relative URL to it 108 // Remove filename and add relative URL to it
109 var base = document.baseURI.match(/.+\//); 109 var base = document.baseURI.match(/.+\//);
110 if (!base) 110 if (!base)
111 return document.baseURI + "/" + url; 111 return document.baseURI + "/" + url;
112 return base[0] + url; 112 return base[0] + url;
113 } 113 }
114 114
115 var setElemhideCSSRules = null;
116
115 function init(document) 117 function init(document)
116 { 118 {
117 var canUseShadow = "webkitCreateShadowRoot" in document.documentElement; 119 var canUseShadow = "webkitCreateShadowRoot" in document.documentElement;
118 var fixInlineFrames = false; 120 var fixInlineFrames = false;
119 121
120 var match = navigator.userAgent.match(/\bChrome\/(\d+)/); 122 var match = navigator.userAgent.match(/\bChrome\/(\d+)/);
121 if (match) 123 if (match)
122 { 124 {
123 var chromeVersion = parseInt(match[1]); 125 var chromeVersion = parseInt(match[1]);
124 126
(...skipping 14 matching lines...) Expand all
139 // rely on the order of their own <style> tags (#309). However we 141 // rely on the order of their own <style> tags (#309). However we
140 // must not create the shadow root in the response callback passed 142 // must not create the shadow root in the response callback passed
141 // to sendMessage(), otherwise Chrome breaks some websites (#450). 143 // to sendMessage(), otherwise Chrome breaks some websites (#450).
142 if (canUseShadow) 144 if (canUseShadow)
143 { 145 {
144 var shadow = document.documentElement.webkitCreateShadowRoot(); 146 var shadow = document.documentElement.webkitCreateShadowRoot();
145 shadow.appendChild(document.createElement("shadow")); 147 shadow.appendChild(document.createElement("shadow"));
146 } 148 }
147 149
148 // Sets the currently used CSS rules for elemhide filters 150 // Sets the currently used CSS rules for elemhide filters
149 var setElemhideCSSRules = function(selectors) 151 setElemhideCSSRules = function(selectors)
150 { 152 {
151 if (selectors.length == 0) 153 if (selectors.length == 0)
152 return; 154 return;
153 155
154 var style = document.createElement("style"); 156 var style = document.createElement("style");
155 style.setAttribute("type", "text/css"); 157 style.setAttribute("type", "text/css");
156 158
157 if (canUseShadow) 159 if (canUseShadow)
158 { 160 {
159 shadow.appendChild(style); 161 shadow.appendChild(style);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 }, true); 225 }, true);
224 226
225 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 227 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
226 } 228 }
227 229
228 if (document instanceof HTMLDocument) 230 if (document instanceof HTMLDocument)
229 { 231 {
230 checkExceptionKey(); 232 checkExceptionKey();
231 init(document); 233 init(document);
232 } 234 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld