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

Delta Between Two Patch Sets: popup.js

Issue 5464830253203456: Refactored the abstraction layer to address prerendered pages on Safari caused by leaky abstraction (Closed)
Left Patch Set: Created Feb. 22, 2014, 10:45 a.m.
Right Patch Set: Addressed comments Created April 11, 2014, 2:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « notification.js ('k') | popupBlocker.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2013 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 var backgroundPage = ext.backgroundPage.getWindow(); 18 var backgroundPage = ext.backgroundPage.getWindow();
19 var imports = ["require", "extractHostFromURL", "refreshIconAndContextMenu", "op enOptions"]; 19 var imports = ["require", "extractHostFromURL", "openOptions"];
20 for (var i = 0; i < imports.length; i++) 20 for (var i = 0; i < imports.length; i++)
21 window[imports[i]] = backgroundPage[imports[i]]; 21 window[imports[i]] = backgroundPage[imports[i]];
22 22
23 var Filter = require("filterClasses").Filter; 23 var Filter = require("filterClasses").Filter;
24 var FilterStorage = require("filterStorage").FilterStorage; 24 var FilterStorage = require("filterStorage").FilterStorage;
25 var Prefs = require("prefs").Prefs; 25 var Prefs = require("prefs").Prefs;
26 var isWhitelisted = require("whitelisting").isWhitelisted; 26 var isWhitelisted = require("whitelisting").isWhitelisted;
27 27
28 var page = null; 28 var page = null;
29 29
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Remove any exception rules applying to this URL 96 // Remove any exception rules applying to this URL
97 var filter = isWhitelisted(page.url); 97 var filter = isWhitelisted(page.url);
98 while (filter) 98 while (filter)
99 { 99 {
100 FilterStorage.removeFilter(filter); 100 FilterStorage.removeFilter(filter);
101 if (filter.subscriptions.length) 101 if (filter.subscriptions.length)
102 filter.disabled = true; 102 filter.disabled = true;
103 filter = isWhitelisted(page.url); 103 filter = isWhitelisted(page.url);
104 } 104 }
105 } 105 }
106
107 refreshIconAndContextMenu(page);
108 } 106 }
109 107
110 function activateClickHide() 108 function activateClickHide()
111 { 109 {
112 document.body.classList.add("clickhide-active"); 110 document.body.classList.add("clickhide-active");
113 page.sendMessage({type: "clickhide-activate"}); 111 page.sendMessage({type: "clickhide-activate"});
114 112
115 // Close the popup after a few seconds, so user doesn't have to 113 // Close the popup after a few seconds, so user doesn't have to
116 activateClickHide.timeout = window.setTimeout(ext.closePopup, 5000); 114 activateClickHide.timeout = window.setTimeout(ext.closePopup, 5000);
117 } 115 }
118 116
119 function cancelClickHide() 117 function cancelClickHide()
120 { 118 {
121 if (activateClickHide.timeout) 119 if (activateClickHide.timeout)
122 { 120 {
123 window.clearTimeout(activateClickHide.timeout); 121 window.clearTimeout(activateClickHide.timeout);
124 activateClickHide.timeout = null; 122 activateClickHide.timeout = null;
125 } 123 }
126 document.body.classList.remove("clickhide-active"); 124 document.body.classList.remove("clickhide-active");
127 page.sendMessage({type: "clickhide-deactivate"}); 125 page.sendMessage({type: "clickhide-deactivate"});
128 } 126 }
129 127
130 function toggleCollapse(event) 128 function toggleCollapse(event)
131 { 129 {
132 var collapser = event.currentTarget; 130 var collapser = event.currentTarget;
133 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; 131 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option];
134 collapser.parentNode.classList.toggle("collapsed"); 132 collapser.parentNode.classList.toggle("collapsed");
135 } 133 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld