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

Side by Side Diff: options.js

Issue 16067002: Added Safari Support (Closed)
Patch Set: Added missing copyright disclaimers and websql implementation Created Oct. 23, 2013, 2:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« chrome/common.js ('K') | « options.html ('k') | popup.html » ('j') | 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-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 = chrome.extension.getBackgroundPage();
19 var require = backgroundPage.require;
20
21 with(require("filterClasses")) 18 with(require("filterClasses"))
22 { 19 {
23 this.Filter = Filter; 20 this.Filter = Filter;
24 this.WhitelistFilter = WhitelistFilter; 21 this.WhitelistFilter = WhitelistFilter;
25 } 22 }
26 with(require("subscriptionClasses")) 23 with(require("subscriptionClasses"))
27 { 24 {
28 this.Subscription = Subscription; 25 this.Subscription = Subscription;
29 this.SpecialSubscription = SpecialSubscription; 26 this.SpecialSubscription = SpecialSubscription;
30 this.DownloadableSubscription = DownloadableSubscription; 27 this.DownloadableSubscription = DownloadableSubscription;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 $("button").button(); 64 $("button").button();
68 $(".refreshButton").button("option", "icons", {primary: "ui-icon-refresh"}); 65 $(".refreshButton").button("option", "icons", {primary: "ui-icon-refresh"});
69 $(".addButton").button("option", "icons", {primary: "ui-icon-plus"}); 66 $(".addButton").button("option", "icons", {primary: "ui-icon-plus"});
70 $(".removeButton").button("option", "icons", {primary: "ui-icon-minus"}); 67 $(".removeButton").button("option", "icons", {primary: "ui-icon-minus"});
71 68
72 // Popuplate option checkboxes 69 // Popuplate option checkboxes
73 initCheckbox("shouldShowIcon"); 70 initCheckbox("shouldShowIcon");
74 initCheckbox("shouldShowBlockElementMenu"); 71 initCheckbox("shouldShowBlockElementMenu");
75 initCheckbox("hidePlaceholders"); 72 initCheckbox("hidePlaceholders");
76 73
74 ext.onMessage.addListener(onMessage);
75
77 // Load recommended subscriptions 76 // Load recommended subscriptions
78 loadRecommendations(); 77 loadRecommendations();
79 78
80 // Show user's filters 79 // Show user's filters
81 reloadFilters(); 80 reloadFilters();
82 } 81 }
83 $(loadOptions); 82 $(loadOptions);
84 83
84 function onMessage(msg) {
85 switch (msg.type) {
86 case "add-subscription":
87 startSubscriptionSelection(msg.title, msg.url);
88 break;
89 default:
90 console.log("got unexpected message: " + msg.type);
91 }
92 };
93
85 // Reloads the displayed subscriptions and filters 94 // Reloads the displayed subscriptions and filters
86 function reloadFilters() 95 function reloadFilters()
87 { 96 {
88 // Load user filter URLs 97 // Load user filter URLs
89 var container = document.getElementById("filterLists"); 98 var container = document.getElementById("filterLists");
90 while (container.lastChild) 99 while (container.lastChild)
91 container.removeChild(container.lastChild); 100 container.removeChild(container.lastChild);
92 101
93 var hasAcceptable = false; 102 var hasAcceptable = false;
94 for (var i = 0; i < FilterStorage.subscriptions.length; i++) 103 for (var i = 0; i < FilterStorage.subscriptions.length; i++)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 231
223 function startSubscriptionSelection(title, url) 232 function startSubscriptionSelection(title, url)
224 { 233 {
225 var list = document.getElementById("subscriptionSelector"); 234 var list = document.getElementById("subscriptionSelector");
226 if (list.length == 0) 235 if (list.length == 0)
227 { 236 {
228 delayedSubscriptionSelection = [title, url]; 237 delayedSubscriptionSelection = [title, url];
229 return; 238 return;
230 } 239 }
231 240
232 $('#tabs').tabs('select', 0); 241 $("#tabs").tabs("select", 0);
233 $("#addSubscriptionContainer").show(); 242 $("#addSubscriptionContainer").show();
234 $("#addSubscriptionButton").hide(); 243 $("#addSubscriptionButton").hide();
235 $("#subscriptionSelector").focus(); 244 $("#subscriptionSelector").focus();
236 if (typeof url != "undefined") 245 if (typeof url != "undefined")
237 { 246 {
238 list.selectedIndex = list.length - 1; 247 list.selectedIndex = list.length - 1;
239 document.getElementById("customSubscriptionTitle").value = title; 248 document.getElementById("customSubscriptionTitle").value = title;
240 document.getElementById("customSubscriptionLocation").value = url; 249 document.getElementById("customSubscriptionLocation").value = url;
241 } 250 }
242 updateSubscriptionSelection(); 251 updateSubscriptionSelection();
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 links[i].href = arguments[i + 1]; 643 links[i].href = arguments[i + 1];
635 links[i].setAttribute("target", "_blank"); 644 links[i].setAttribute("target", "_blank");
636 } 645 }
637 else if (typeof arguments[i + 1] == "function") 646 else if (typeof arguments[i + 1] == "function")
638 { 647 {
639 links[i].href = "javascript:void(0);"; 648 links[i].href = "javascript:void(0);";
640 links[i].addEventListener("click", arguments[i + 1], false); 649 links[i].addEventListener("click", arguments[i + 1], false);
641 } 650 }
642 } 651 }
643 } 652 }
OLDNEW
« chrome/common.js ('K') | « options.html ('k') | popup.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld