| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // Ask content script whether clickhide is active. If so, show cancel button
. | 43 // Ask content script whether clickhide is active. If so, show cancel button
. |
| 44 // If that isn't the case, ask background.html whether it has cached filters
. If so, | 44 // If that isn't the case, ask background.html whether it has cached filters
. If so, |
| 45 // ask the user whether she wants those filters. | 45 // ask the user whether she wants those filters. |
| 46 // Otherwise, we are in default state. | 46 // Otherwise, we are in default state. |
| 47 if (page) | 47 if (page) |
| 48 { | 48 { |
| 49 if (checkWhitelisted(page)) | 49 if (checkWhitelisted(page)) |
| 50 document.body.classList.add("disabled"); | 50 document.body.classList.add("disabled"); |
| 51 | 51 |
| 52 page.sendMessage({type: "blockelement-get-state"}, function(response) | 52 page.sendMessage({type: "composer.content.getState"}, function(response) |
| 53 { | 53 { |
| 54 if (response && response.active) | 54 if (response && response.active) |
| 55 document.body.classList.add("clickhide-active"); | 55 document.body.classList.add("clickhide-active"); |
| 56 }); | 56 }); |
| 57 } | 57 } |
| 58 }); | 58 }); |
| 59 | 59 |
| 60 // Attach event listeners | 60 // Attach event listeners |
| 61 port.on("composer.ready", onComposerReady); | 61 port.on("composer.ready", onComposerReady); |
| 62 document.getElementById("enabled").addEventListener("click", toggleEnabled, fa
lse); | 62 document.getElementById("enabled").addEventListener("click", toggleEnabled, fa
lse); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (filter.subscriptions.length) | 114 if (filter.subscriptions.length) |
| 115 filter.disabled = true; | 115 filter.disabled = true; |
| 116 filter = checkWhitelisted(page); | 116 filter = checkWhitelisted(page); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 function activateClickHide() | 121 function activateClickHide() |
| 122 { | 122 { |
| 123 document.body.classList.add("clickhide-active"); | 123 document.body.classList.add("clickhide-active"); |
| 124 page.sendMessage({type: "blockelement-start-picking-element"}); | 124 page.sendMessage({type: "composer.content.startPickingElement"}); |
| 125 | 125 |
| 126 // Close the popup after a few seconds, so user doesn't have to | 126 // Close the popup after a few seconds, so user doesn't have to |
| 127 activateClickHide.timeout = window.setTimeout(ext.closePopup, 5000); | 127 activateClickHide.timeout = window.setTimeout(ext.closePopup, 5000); |
| 128 } | 128 } |
| 129 | 129 |
| 130 function cancelClickHide() | 130 function cancelClickHide() |
| 131 { | 131 { |
| 132 if (activateClickHide.timeout) | 132 if (activateClickHide.timeout) |
| 133 { | 133 { |
| 134 window.clearTimeout(activateClickHide.timeout); | 134 window.clearTimeout(activateClickHide.timeout); |
| 135 activateClickHide.timeout = null; | 135 activateClickHide.timeout = null; |
| 136 } | 136 } |
| 137 document.body.classList.remove("clickhide-active"); | 137 document.body.classList.remove("clickhide-active"); |
| 138 page.sendMessage({type: "blockelement-finished"}); | 138 page.sendMessage({type: "composer.content.finished"}); |
| 139 } | 139 } |
| 140 | 140 |
| 141 function toggleCollapse(event) | 141 function toggleCollapse(event) |
| 142 { | 142 { |
| 143 var collapser = event.currentTarget; | 143 var collapser = event.currentTarget; |
| 144 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 144 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
| 145 collapser.parentNode.classList.toggle("collapsed"); | 145 collapser.parentNode.classList.toggle("collapsed"); |
| 146 } | 146 } |
| 147 | 147 |
| 148 document.addEventListener("DOMContentLoaded", onLoad, false); | 148 document.addEventListener("DOMContentLoaded", onLoad, false); |
| 149 window.addEventListener("unload", onUnload, false); | 149 window.addEventListener("unload", onUnload, false); |
| OLD | NEW |