| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Ask content script whether clickhide is active. If so, show cancel button. | 60 // Ask content script whether clickhide is active. If so, show cancel button. |
| 61 // If that isn't the case, ask background.html whether it has cached filters.
If so, | 61 // If that isn't the case, ask background.html whether it has cached filters.
If so, |
| 62 // ask the user whether she wants those filters. | 62 // ask the user whether she wants those filters. |
| 63 // Otherwise, we are in default state. | 63 // Otherwise, we are in default state. |
| 64 ext.windows.getLastFocused(function(win) | 64 ext.windows.getLastFocused(function(win) |
| 65 { | 65 { |
| 66 win.getActiveTab(function(t) | 66 win.getActiveTab(function(t) |
| 67 { | 67 { |
| 68 tab = t; | 68 tab = t; |
| 69 document.getElementById("enabled").classList.toggle("off", isWhitelisted(t
ab.url)); | 69 if (isWhitelisted(tab.url)) |
| 70 document.getElementById("enabled").classList.add("off"); |
| 70 | 71 |
| 71 tab.sendMessage({type: "get-clickhide-state"}, function(response) | 72 tab.sendMessage({type: "get-clickhide-state"}, function(response) |
| 72 { | 73 { |
| 73 document.body.classList.toggle("clickhide-active", response && response.
active); | 74 if (response && response.active) |
| 75 document.body.classList.add("clickhide-active"); |
| 74 }); | 76 }); |
| 75 }); | 77 }); |
| 76 }); | 78 }); |
| 77 } | 79 } |
| 78 window.addEventListener("DOMContentLoaded", init, false); | 80 window.addEventListener("DOMContentLoaded", init, false); |
| 79 | 81 |
| 80 function toggleEnabled() | 82 function toggleEnabled() |
| 81 { | 83 { |
| 82 var enabledButton = document.getElementById("enabled") | 84 var enabledButton = document.getElementById("enabled") |
| 83 var disabled = enabledButton.classList.toggle("off"); | 85 var disabled = enabledButton.classList.toggle("off"); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 document.body.classList.remove("clickhide-active"); | 130 document.body.classList.remove("clickhide-active"); |
| 129 tab.sendMessage({type: "clickhide-deactivate"}); | 131 tab.sendMessage({type: "clickhide-deactivate"}); |
| 130 } | 132 } |
| 131 | 133 |
| 132 function toggleCollapse(event) | 134 function toggleCollapse(event) |
| 133 { | 135 { |
| 134 var collapser = event.currentTarget; | 136 var collapser = event.currentTarget; |
| 135 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 137 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
| 136 collapser.parentNode.classList.toggle("collapsed"); | 138 collapser.parentNode.classList.toggle("collapsed"); |
| 137 } | 139 } |
| OLD | NEW |