| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 25 matching lines...) Expand all Loading... | |
| 36 { | 36 { |
| 37 feature: "tracking", | 37 feature: "tracking", |
| 38 homepage: "https://easylist.adblockplus.org/", | 38 homepage: "https://easylist.adblockplus.org/", |
| 39 title: "EasyPrivacy", | 39 title: "EasyPrivacy", |
| 40 url: "https://easylist-downloads.adblockplus.org/easyprivacy.txt" | 40 url: "https://easylist-downloads.adblockplus.org/easyprivacy.txt" |
| 41 } | 41 } |
| 42 ]; | 42 ]; |
| 43 | 43 |
| 44 function onDOMLoaded() | 44 function onDOMLoaded() |
| 45 { | 45 { |
| 46 // Set up URL | 46 var locale = require("utils").Utils.appLocale; |
|
Wladimir Palant
2013/10/02 13:21:39
URL => URLs
| |
| 47 document.documentElement.setAttribute("lang", locale); | |
| 48 | |
| 49 // Set up URLs | |
| 47 var donateLink = E("donate"); | 50 var donateLink = E("donate"); |
| 48 donateLink.href = Utils.getDocLink("donate"); | 51 donateLink.href = Utils.getDocLink("donate"); |
| 49 | 52 |
| 50 var contributors = E("contributors"); | 53 var contributors = E("contributors"); |
| 51 contributors.href = Utils.getDocLink("contributors"); | 54 contributors.href = Utils.getDocLink("contributors"); |
| 52 | 55 |
| 53 setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criter ia"), openFilters); | 56 setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criter ia"), openFilters); |
| 54 setLinks("share-headline", Utils.getDocLink("contribute")); | 57 setLinks("share-headline", Utils.getDocLink("contribute")); |
| 55 | 58 |
| 56 // Show warning if data corruption was detected | 59 // Show warning if data corruption was detected |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 73 } | 76 } |
| 74 } | 77 } |
| 75 } | 78 } |
| 76 FilterNotifier.addListener(filterListener); | 79 FilterNotifier.addListener(filterListener); |
| 77 window.addEventListener("unload", function(event) | 80 window.addEventListener("unload", function(event) |
| 78 { | 81 { |
| 79 FilterNotifier.removeListener(filterListener); | 82 FilterNotifier.removeListener(filterListener); |
| 80 }, false); | 83 }, false); |
| 81 | 84 |
| 82 // You can click activate-feature or one of the icons to toggle the features area | 85 // You can click activate-feature or one of the icons to toggle the features area |
| 83 E("activate-features").addEventListener("click", showFeature, false); | 86 E("activate-features").addEventListener("click", toggleFeature, false); |
| 84 E("can-do-more-overview").addEventListener("click", showFeature, false); | 87 E("can-do-more-overview").addEventListener("click", toggleFeature, false); |
| 85 | 88 |
| 86 initSocialLinks(); | 89 initSocialLinks(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 function showFeature() | 92 function toggleFeature() |
|
Wladimir Palant
2013/10/02 13:21:39
I think the proper name for this function would be
| |
| 90 { | 93 { |
| 91 var canDoMore = E("can-do-more"); | 94 var canDoMore = E("can-do-more"); |
| 92 var canDoMoreOverview = E("can-do-more-overview"); | |
| 93 var canDoMoreExpanded = E("can-do-more-expanded"); | |
| 94 | |
| 95 if (!canDoMore.classList.contains("expanded")) | 95 if (!canDoMore.classList.contains("expanded")) |
| 96 { | 96 { |
| 97 canDoMore.classList.add("expanded"); | 97 canDoMore.classList.add("expanded"); |
| 98 canDoMoreOverview.classList.add("fade"); | |
| 99 | |
| 100 setTimeout(function() | |
| 101 { | |
| 102 canDoMoreOverview.classList.add("hide"); | |
| 103 canDoMoreExpanded.classList.remove("hide"); | |
| 104 },500); | |
| 105 | |
| 106 /* Next timeout has to be done because of an js bug. | |
| 107 * If you set "display: block" and "opacity: 1" | |
| 108 * at the same time the content would be shown | |
| 109 * directly without any transition. | |
| 110 * With the following timeout the opacity | |
| 111 * transition works correctly | |
| 112 */ | |
| 113 setTimeout(function() | |
| 114 { | |
| 115 canDoMoreExpanded.classList.remove("fade"); | |
| 116 },520); | |
|
Wladimir Palant
2013/10/02 13:21:39
JavaScript doesn't guarantee any particular order
| |
| 117 } | 98 } |
| 118 else if (canDoMore.classList.contains("expanded")) | 99 else if (canDoMore.classList.contains("expanded")) |
| 119 { | 100 { |
| 120 canDoMore.classList.remove("expanded"); | 101 canDoMore.classList.remove("expanded"); |
| 121 canDoMoreExpanded.classList.add("fade"); | |
| 122 | |
| 123 setTimeout(function() | |
| 124 { | |
| 125 canDoMoreExpanded.classList.add("hide"); | |
| 126 canDoMoreOverview.classList.remove("hide"); | |
| 127 },500); | |
| 128 | |
| 129 setTimeout(function() | |
| 130 { | |
| 131 canDoMoreOverview.classList.remove("fade"); | |
| 132 },520); | |
| 133 } | 102 } |
|
Wladimir Palant
2013/10/02 13:21:39
We are using CSS transitions - why does this have
|
Wladimir Palant
2013/10/05 09:15:59
Nit: One line of code is enough for the entire fun
|
| 134 } | 103 } |
| 135 | 104 |
| 136 function isSubscriptionEnabled(featureSubscription) | 105 function isSubscriptionEnabled(featureSubscription) |
| 137 { | 106 { |
| 138 return featureSubscription.url in FilterStorage.knownSubscriptions | 107 return featureSubscription.url in FilterStorage.knownSubscriptions |
| 139 && !Subscription.fromURL(featureSubscription.url).disabled; | 108 && !Subscription.fromURL(featureSubscription.url).disabled; |
| 140 } | 109 } |
| 141 | 110 |
| 142 function setToggleSubscriptionButton(featureSubscription) | 111 function setToggleSubscriptionButton(featureSubscription) |
| 143 { | 112 { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 { | 242 { |
| 274 var button = E("toggle-" + feature); | 243 var button = E("toggle-" + feature); |
| 275 if (isEnabled) | 244 if (isEnabled) |
| 276 button.classList.remove("off"); | 245 button.classList.remove("off"); |
| 277 else | 246 else |
| 278 button.classList.add("off"); | 247 button.classList.add("off"); |
| 279 } | 248 } |
| 280 | 249 |
| 281 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 250 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 282 })(); | 251 })(); |
| LEFT | RIGHT |