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

Side by Side Diff: options.js

Issue 29338208: Issue 3796 - Added preference to remove developer tools panel (Closed)
Patch Set: Created March 14, 2016, 1:07 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
« lib/prefs.js ('K') | « options.html ('k') | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 22 matching lines...) Expand all
33 { 33 {
34 this.parseFilter = parseFilter; 34 this.parseFilter = parseFilter;
35 this.parseFilters = parseFilters; 35 this.parseFilters = parseFilters;
36 } 36 }
37 var FilterStorage = require("filterStorage").FilterStorage; 37 var FilterStorage = require("filterStorage").FilterStorage;
38 var FilterNotifier = require("filterNotifier").FilterNotifier; 38 var FilterNotifier = require("filterNotifier").FilterNotifier;
39 var Prefs = require("prefs").Prefs; 39 var Prefs = require("prefs").Prefs;
40 var Synchronizer = require("synchronizer").Synchronizer; 40 var Synchronizer = require("synchronizer").Synchronizer;
41 var Utils = require("utils").Utils; 41 var Utils = require("utils").Utils;
42 var NotificationStorage = require("notification").Notification; 42 var NotificationStorage = require("notification").Notification;
43 var info = require("info");
43 44
44 // Loads options from localStorage and sets UI elements accordingly 45 // Loads options from localStorage and sets UI elements accordingly
45 function loadOptions() 46 function loadOptions()
46 { 47 {
47 // Set page title to i18n version of "Adblock Plus Options" 48 // Set page title to i18n version of "Adblock Plus Options"
48 document.title = i18n.getMessage("options"); 49 document.title = i18n.getMessage("options");
49 50
50 // Set links 51 // Set links
51 $("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl); 52 $("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl);
52 $("#acceptableAdsDocs").attr("href", Utils.getDocLink("acceptable_ads")); 53 $("#acceptableAdsDocs").attr("href", Utils.getDocLink("acceptable_ads"));
53 setLinks("filter-must-follow-syntax", Utils.getDocLink("filterdoc")); 54 setLinks("filter-must-follow-syntax", Utils.getDocLink("filterdoc"));
54 setLinks("found-a-bug", Utils.getDocLink(require("info").application + "_suppo rt")); 55 setLinks("found-a-bug", Utils.getDocLink(info.application + "_support"));
55 56
56 // Add event listeners 57 // Add event listeners
57 window.addEventListener("unload", unloadOptions, false); 58 window.addEventListener("unload", unloadOptions, false);
58 $("#updateFilterLists").click(updateFilterLists); 59 $("#updateFilterLists").click(updateFilterLists);
59 $("#startSubscriptionSelection").click(startSubscriptionSelection); 60 $("#startSubscriptionSelection").click(startSubscriptionSelection);
60 $("#subscriptionSelector").change(updateSubscriptionSelection); 61 $("#subscriptionSelector").change(updateSubscriptionSelection);
61 $("#addSubscription").click(addSubscription); 62 $("#addSubscription").click(addSubscription);
62 $("#acceptableAds").click(allowAcceptableAds); 63 $("#acceptableAds").click(allowAcceptableAds);
63 $("#whitelistForm").submit(addWhitelistDomain); 64 $("#whitelistForm").submit(addWhitelistDomain);
64 $("#removeWhitelist").click(removeSelectedExcludedDomain); 65 $("#removeWhitelist").click(removeSelectedExcludedDomain);
65 $("#customFilterForm").submit(addTypedFilter); 66 $("#customFilterForm").submit(addTypedFilter);
66 $("#removeCustomFilter").click(removeSelectedFilters); 67 $("#removeCustomFilter").click(removeSelectedFilters);
67 $("#rawFiltersButton").click(toggleFiltersInRawFormat); 68 $("#rawFiltersButton").click(toggleFiltersInRawFormat);
68 $("#importRawFilters").click(importRawFiltersText); 69 $("#importRawFilters").click(importRawFiltersText);
69 FilterNotifier.addListener(onFilterChange); 70 FilterNotifier.addListener(onFilterChange);
70 71
71 // Display jQuery UI elements 72 // Display jQuery UI elements
72 $("#tabs").tabs(); 73 $("#tabs").tabs();
73 $("button").button(); 74 $("button").button();
74 $(".refreshButton").button("option", "icons", {primary: "ui-icon-refresh"}); 75 $(".refreshButton").button("option", "icons", {primary: "ui-icon-refresh"});
75 $(".addButton").button("option", "icons", {primary: "ui-icon-plus"}); 76 $(".addButton").button("option", "icons", {primary: "ui-icon-plus"});
76 $(".removeButton").button("option", "icons", {primary: "ui-icon-minus"}); 77 $(".removeButton").button("option", "icons", {primary: "ui-icon-minus"});
77 78
78 // Popuplate option checkboxes 79 // Popuplate option checkboxes
79 initCheckbox("shouldShowBlockElementMenu"); 80 initCheckbox("shouldShowBlockElementMenu");
80 if (Prefs.notifications_showui) 81 initCheckbox("show_devtools_panel");
81 { 82 initCheckbox("shouldShowNotifications", {
82 initCheckbox("shouldShowNotifications", { 83 get: function()
83 get: function() 84 {
84 { 85 return Prefs.notifications_ignoredcategories.indexOf("*") == -1;
85 return Prefs.notifications_ignoredcategories.indexOf("*") == -1; 86 },
86 }, 87 toggle: function()
87 toggle: function() 88 {
88 { 89 NotificationStorage.toggleIgnoreCategory("*");
89 NotificationStorage.toggleIgnoreCategory("*"); 90 return this.get();
90 return this.get(); 91 }
91 } 92 });
92 }); 93
93 } 94 if (info.platform != "chromium")
94 else 95 document.getElementById("showDevtoolsPanelContainer").hidden = true;
96 if (!Prefs.notifications_showui)
95 document.getElementById("shouldShowNotificationsContainer").hidden = true; 97 document.getElementById("shouldShowNotificationsContainer").hidden = true;
96 98
97 ext.onMessage.addListener(onMessage); 99 ext.onMessage.addListener(onMessage);
98 ext.backgroundPage.sendMessage({ 100 ext.backgroundPage.sendMessage({
99 type: "app.listen", 101 type: "app.listen",
100 filter: ["addSubscription"] 102 filter: ["addSubscription"]
101 }); 103 });
102 104
103 // Load recommended subscriptions 105 // Load recommended subscriptions
104 loadRecommendations(); 106 loadRecommendations();
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 links[i].href = arguments[i + 1]; 701 links[i].href = arguments[i + 1];
700 links[i].setAttribute("target", "_blank"); 702 links[i].setAttribute("target", "_blank");
701 } 703 }
702 else if (typeof arguments[i + 1] == "function") 704 else if (typeof arguments[i + 1] == "function")
703 { 705 {
704 links[i].href = "javascript:void(0);"; 706 links[i].href = "javascript:void(0);";
705 links[i].addEventListener("click", arguments[i + 1], false); 707 links[i].addEventListener("click", arguments[i + 1], false);
706 } 708 }
707 } 709 }
708 } 710 }
OLDNEW
« lib/prefs.js ('K') | « options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld