| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 (function() | |
| 19 { | |
| 20 var contentHeight = 0; | |
| 21 var left; | |
| 22 var right; | |
|
Wladimir Palant
2013/05/07 15:01:12
The variables left and right seem to be unused.
| |
| 23 var shade; | |
| 24 var scrollTimer; | |
| 25 | |
| 26 function onDomReady() | |
| 27 { | |
| 28 shade = document.getElementById("shade"); | |
| 29 | |
| 30 shade.addEventListener("mouseover", scrollPage, false); | |
| 31 shade.addEventListener("mouseout", stopScroll, false); | |
| 32 | |
| 33 window.addEventListener('resize', onWindowResize, false); | |
| 34 document.addEventListener('scroll', onScroll, false); | |
| 35 | |
| 36 onWindowResize(); | |
| 37 } | |
| 38 | |
| 39 function onScroll() | |
| 40 { | |
| 41 var currentHeight = document.documentElement.scrollTop + document.body.scrol lTop + document.documentElement.clientHeight; | |
| 42 shade.style.opacity = (contentHeight == currentHeight) ? "0.0" : "0.5"; | |
| 43 } | |
| 44 | |
| 45 function onWindowResize() | |
| 46 { | |
| 47 contentHeight = document.documentElement.scrollHeight; | |
| 48 shade.style.opacity = (contentHeight > document.documentElement.clientHeight ) ? "0.5" : "0.0"; | |
|
Wladimir Palant
2013/05/07 15:01:12
Why do we have different logic here and in onScrol
| |
| 49 } | |
| 50 | |
| 51 function scrollPage() | |
| 52 { | |
| 53 window.scrollBy(0, 5); | |
| 54 scrollTimer = setTimeout(scrollPage, 20); | |
|
Wladimir Palant
2013/05/07 15:01:12
What if mouseover event fires twice for some reaso
| |
| 55 } | |
| 56 | |
| 57 function stopScroll() | |
| 58 { | |
| 59 clearTimeout(scrollTimer); | |
| 60 } | |
| 61 | |
| 62 function scrollContent(direction) | |
|
Wladimir Palant
2013/05/07 15:01:12
This function seems to be unused code.
| |
| 63 { | |
| 64 cur -= direction; | |
| 65 if (cur < 0) cur = 0; | |
| 66 if (cur > cols) cur = cols; | |
| 67 | |
| 68 left.style.visibility="hidden"; | |
| 69 right.style.visibility="hidden"; | |
| 70 | |
| 71 if (cur > 0 && cur <= cols) | |
| 72 left.style.visibility="visible"; | |
| 73 if (cur < cols && cols > 0) | |
| 74 right.style.visibility="visible"; | |
| 75 | |
| 76 innerBase.style.left = (cur * -width) + "px"; | |
| 77 } | |
| 78 | |
| 79 document.addEventListener("DOMContentLoaded", onDomReady, false); | |
| 80 })(); | |
| 81 | |
| 18 function init() | 82 function init() |
| 19 { | 83 { |
| 84 E("currentVersion").textContent = Prefs.currentVersion; | |
| 85 | |
| 20 generateLinkText(E("changeDescription")); | 86 generateLinkText(E("changeDescription")); |
| 21 | 87 |
| 22 for each (let subscription in FilterStorage.subscriptions) | 88 for each (let subscription in FilterStorage.subscriptions) |
| 23 { | 89 { |
| 24 if (subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl && !subscription.disabled) | 90 if (subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl && !subscription.disabled) |
| 25 { | 91 { |
| 26 E("listName").textContent = subscription.title; | 92 E("listName").textContent = subscription.title; |
| 27 | 93 |
| 28 let link = E("listHomepage"); | 94 let link = E("listHomepage"); |
| 29 link.setAttribute("href", subscription.homepage); | 95 link.setAttribute("href", subscription.homepage); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 Utils.runAsync(showOptions); | 146 Utils.runAsync(showOptions); |
| 81 else | 147 else |
| 82 topWnd.ExtensionsView.showOptions(Utils.addonID); | 148 topWnd.ExtensionsView.showOptions(Utils.addonID); |
| 83 } | 149 } |
| 84 showOptions(); | 150 showOptions(); |
| 85 } | 151 } |
| 86 } | 152 } |
| 87 else | 153 else |
| 88 UI.openFiltersDialog(); | 154 UI.openFiltersDialog(); |
| 89 } | 155 } |
| 156 | |
| OLD | NEW |