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

Unified Diff: options.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
Patch Set: Rebase to rev 3c9cea80c481 Created July 18, 2014, 8:54 a.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 | « options.html ('k') | popup.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -1,6 +1,6 @@
/*
* This file is part of Adblock Plus <http://adblockplus.org/>,
- * Copyright (C) 2006-2013 Eyeo GmbH
+ * Copyright (C) 2006-2014 Eyeo GmbH
*
* Adblock Plus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -15,7 +15,8 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-var require = ext.backgroundPage.getWindow().require;
+var backgroundPage = ext.backgroundPage.getWindow();
+var require = backgroundPage.require;
with(require("filterClasses"))
{
@@ -121,7 +122,9 @@
$("#acceptableAds").prop("checked", hasAcceptable);
// User-entered filters
- showUserFilters();
+ var userFilters = backgroundPage.getUserFilters();
+ populateList("userFiltersBox", userFilters.filters);
+ populateList("excludedDomainsBox", userFilters.exceptions);
}
// Cleans up when the options window is closed
@@ -133,37 +136,13 @@
function initCheckbox(id)
{
var checkbox = document.getElementById(id);
- checkbox.checked = typeof localStorage[id] == "undefined" ? true : localStorage[id] == "true";
+ checkbox.checked = Prefs[id];
checkbox.addEventListener("click", function()
{
- localStorage[id] = checkbox.checked;
+ Prefs[id] = checkbox.checked;
}, false);
}
-function showUserFilters()
-{
- var filters = [];
- var exceptions = [];
- for (var i = 0; i < FilterStorage.subscriptions.length; i++)
- {
- var subscription = FilterStorage.subscriptions[i];
- if (!(subscription instanceof SpecialSubscription))
- continue;
-
- for (var j = 0; j < subscription.filters.length; j++)
- {
- var filter = subscription.filters[j];
- if (filter instanceof WhitelistFilter && /^@@\|\|([^\/:]+)\^\$document$/.test(filter.text))
- exceptions.push(RegExp.$1)
- else
- filters.push(filter.text);
- }
- }
-
- populateList("userFiltersBox", filters);
- populateList("excludedDomainsBox", exceptions);
-}
-
var delayedSubscriptionSelection = null;
function loadRecommendations()
« no previous file with comments | « options.html ('k') | popup.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld