OLD | NEW |
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 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 setLinks("dataCorruptionWarning", Utils.getDocLink("knownIssuesChrome_filt
erstorage")); | 53 setLinks("dataCorruptionWarning", Utils.getDocLink("knownIssuesChrome_filt
erstorage")); |
54 } | 54 } |
55 | 55 |
56 // Set up URL | 56 // Set up URL |
57 setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criter
ia"), openFilters); | 57 setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criter
ia"), openFilters); |
58 | 58 |
59 shade = E("shade"); | 59 shade = E("shade"); |
60 shade.addEventListener("mouseover", scrollPage, false); | 60 shade.addEventListener("mouseover", scrollPage, false); |
61 shade.addEventListener("mouseout", stopScroll, false); | 61 shade.addEventListener("mouseout", stopScroll, false); |
62 | 62 |
63 // Set up typo feature | |
64 if (require("typoBootstrap")) | |
65 { | |
66 var featureTypo = E("feature-typo"); | |
67 featureTypo.removeAttribute("hidden"); | |
68 | |
69 updateToggleButton("typo", Prefs.correctTypos); | |
70 | |
71 var listener = function(name) | |
72 { | |
73 if (name == "correctTypos") | |
74 updateToggleButton("typo", Prefs.correctTypos); | |
75 } | |
76 Prefs.addListener(listener); | |
77 window.addEventListener("unload", function(event) | |
78 { | |
79 Prefs.removeListener(listener); | |
80 }, false); | |
81 | |
82 E("toggle-typo").addEventListener("click", toggleTypoCorrectionEnabled, fa
lse); | |
83 } | |
84 | |
85 // Set up feature buttons linked to subscriptions | 63 // Set up feature buttons linked to subscriptions |
86 featureSubscriptions.forEach(setToggleSubscriptionButton); | 64 featureSubscriptions.forEach(setToggleSubscriptionButton); |
87 var filterListener = function(action) | 65 var filterListener = function(action) |
88 { | 66 { |
89 if (/^subscription\.(added|removed|disabled)$/.test(action)) | 67 if (/^subscription\.(added|removed|disabled)$/.test(action)) |
90 { | 68 { |
91 for (var i = 0; i < featureSubscriptions.length; i++) | 69 for (var i = 0; i < featureSubscriptions.length; i++) |
92 { | 70 { |
93 var featureSubscription = featureSubscriptions[i]; | 71 var featureSubscription = featureSubscriptions[i]; |
94 updateToggleButton(featureSubscription.feature, isSubscriptionEnabled(
featureSubscription)); | 72 updateToggleButton(featureSubscription.feature, isSubscriptionEnabled(
featureSubscription)); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 { | 250 { |
273 var button = E("toggle-" + feature); | 251 var button = E("toggle-" + feature); |
274 if (isEnabled && button.classList.contains("off")) | 252 if (isEnabled && button.classList.contains("off")) |
275 button.classList.remove("off"); | 253 button.classList.remove("off"); |
276 else if (!isEnabled && !button.classList.contains("off")) | 254 else if (!isEnabled && !button.classList.contains("off")) |
277 button.classList.add("off"); | 255 button.classList.add("off"); |
278 } | 256 } |
279 | 257 |
280 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 258 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
281 })(); | 259 })(); |
OLD | NEW |