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

Side by Side Diff: new-options.js

Issue 29371585: Issue 4783 - Drop Safari support [adblockplusui] (Closed)
Patch Set: Created Jan. 12, 2017, 9:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « new-options.html ('k') | skin/new-options.css » ('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 <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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 }); 793 });
794 }); 794 });
795 ext.backgroundPage.sendMessage( 795 ext.backgroundPage.sendMessage(
796 { 796 {
797 type: "app.get", 797 type: "app.get",
798 what: "features" 798 what: "features"
799 }, 799 },
800 function(features) 800 function(features)
801 { 801 {
802 hidePref("show_devtools_panel", !features.devToolsPanel); 802 hidePref("show_devtools_panel", !features.devToolsPanel);
803
804 // Only show option to switch between Safari Content Blockers
805 // and event based blocking if both are available.
806 hidePref("safari_contentblocker", !(
807 features.safariContentBlocker &&
808 "canLoad" in safari.self.tab &&
809 "onbeforeload" in Element.prototype
810 ));
811 }); 803 });
812 804
813 var filterTextbox = document.querySelector("#custom-filters-add input"); 805 var filterTextbox = document.querySelector("#custom-filters-add input");
814 placeholderValue = getMessage("options_customFilters_textbox_placeholder"); 806 placeholderValue = getMessage("options_customFilters_textbox_placeholder");
815 filterTextbox.setAttribute("placeholder", placeholderValue); 807 filterTextbox.setAttribute("placeholder", placeholderValue);
816 function addCustomFilters() 808 function addCustomFilters()
817 { 809 {
818 var filterText = filterTextbox.value; 810 var filterText = filterTextbox.value;
819 sendMessageHandleErrors( 811 sendMessageHandleErrors(
820 { 812 {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 { 1099 {
1108 switch (key) 1100 switch (key)
1109 { 1101 {
1110 case "notifications_ignoredcategories": 1102 case "notifications_ignoredcategories":
1111 value = value.indexOf("*") == -1; 1103 value = value.indexOf("*") == -1;
1112 break; 1104 break;
1113 1105
1114 case "notifications_showui": 1106 case "notifications_showui":
1115 hidePref("notifications_ignoredcategories", !value); 1107 hidePref("notifications_ignoredcategories", !value);
1116 break; 1108 break;
1117
1118 case "safari_contentblocker":
1119 E("restart-safari").setAttribute("aria-hidden", value || initial);
1120 break;
1121 } 1109 }
1122 1110
1123 var checkbox = document.querySelector("[data-pref='" + key + "'] button[role ='checkbox']"); 1111 var checkbox = document.querySelector("[data-pref='" + key + "'] button[role ='checkbox']");
1124 if (checkbox) 1112 if (checkbox)
1125 checkbox.setAttribute("aria-checked", value); 1113 checkbox.setAttribute("aria-checked", value);
1126 } 1114 }
1127 1115
1128 function updateShareLink() 1116 function updateShareLink()
1129 { 1117 {
1130 var shareResources = [ 1118 var shareResources = [
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 }); 1253 });
1266 ext.backgroundPage.sendMessage( 1254 ext.backgroundPage.sendMessage(
1267 { 1255 {
1268 type: "filters.listen", 1256 type: "filters.listen",
1269 filter: ["added", "loaded", "removed"] 1257 filter: ["added", "loaded", "removed"]
1270 }); 1258 });
1271 ext.backgroundPage.sendMessage( 1259 ext.backgroundPage.sendMessage(
1272 { 1260 {
1273 type: "prefs.listen", 1261 type: "prefs.listen",
1274 filter: ["notifications_ignoredcategories", "notifications_showui", 1262 filter: ["notifications_ignoredcategories", "notifications_showui",
1275 "safari_contentblocker", "show_devtools_panel", 1263 "show_devtools_panel", "shouldShowBlockElementMenu"]
1276 "shouldShowBlockElementMenu"]
1277 }); 1264 });
1278 ext.backgroundPage.sendMessage( 1265 ext.backgroundPage.sendMessage(
1279 { 1266 {
1280 type: "subscriptions.listen", 1267 type: "subscriptions.listen",
1281 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1268 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1282 "title", "downloadStatus", "downloading"] 1269 "title", "downloadStatus", "downloading"]
1283 }); 1270 });
1284 1271
1285 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1272 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1286 window.addEventListener("hashchange", onHashChange, false); 1273 window.addEventListener("hashchange", onHashChange, false);
1287 })(); 1274 })();
OLDNEW
« no previous file with comments | « new-options.html ('k') | skin/new-options.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld