| 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 |
| 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 /** | 18 /** |
| 19 * @fileOverview Code responsible for showing and hiding object tabs. | 19 * @fileOverview Code responsible for showing and hiding object tabs. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 let {Prefs} = require("prefs"); | 22 let {Prefs} = require("prefs"); |
| 23 let {Utils} = require("utils"); | 23 let {Utils} = require("utils"); |
| 24 let {port} = require("messaging"); |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * Random element class, to be used for object tabs displayed on top of the | 27 * Random element class, to be used for object tabs displayed on top of the |
| 27 * plugin content. | 28 * plugin content. |
| 28 * @type string | 29 * @type string |
| 29 */ | 30 */ |
| 30 let classVisibleTop = null; | 31 let classVisibleTop = null; |
| 31 | 32 |
| 32 /** | 33 /** |
| 33 * Random element class, to be used for object tabs displayed at the bottom of | 34 * Random element class, to be used for object tabs displayed at the bottom of |
| 34 * the plugin content. | 35 * the plugin content. |
| 35 * @type string | 36 * @type string |
| 36 */ | 37 */ |
| 37 let classVisibleBottom = null; | 38 let classVisibleBottom = null; |
| 38 | 39 |
| 39 /** | 40 /** |
| 40 * Random element class, to be used for object tabs that are hidden. | 41 * Random element class, to be used for object tabs that are hidden. |
| 41 * @type string | 42 * @type string |
| 42 */ | 43 */ |
| 43 let classHidden = null; | 44 let classHidden = null; |
| 44 | 45 |
| 45 Utils.addChildMessageListener("AdblockPlus:GetObjectTabsStatus", function() | 46 port.on("getObjectTabsStatus", function(message, sender) |
| 46 { | 47 { |
| 47 let {UI} = require("ui"); | 48 let {UI} = require("ui"); |
| 48 | 49 |
| 49 return !!(Prefs.enabled && Prefs.frameobjects && UI.overlay && classHidden); | 50 return !!(Prefs.enabled && Prefs.frameobjects && UI.overlay && classHidden); |
| 50 }); | 51 }); |
| 51 | 52 |
| 52 Utils.addChildMessageListener("AdblockPlus:GetObjectTabsTexts", function() | 53 port.on("getObjectTabsTexts", function(message, sender) |
| 53 { | 54 { |
| 54 let {UI} = require("ui"); | 55 let {UI} = require("ui"); |
| 55 | 56 |
| 56 return { | 57 return { |
| 57 label: UI.overlay.attributes.objtabtext, | 58 label: UI.overlay.attributes.objtabtext, |
| 58 tooltip: UI.overlay.attributes.objtabtooltip, | 59 tooltip: UI.overlay.attributes.objtabtooltip, |
| 59 classVisibleTop, classVisibleBottom, classHidden | 60 classVisibleTop, classVisibleBottom, classHidden |
| 60 }; | 61 }; |
| 61 }); | 62 }); |
| 62 | 63 |
| 63 Utils.addChildMessageListener("AdblockPlus:BlockItem", function({request, nodesI
D}) | 64 port.on("blockItem", function({request, nodesID}, sender) |
| 64 { | 65 { |
| 65 let {UI} = require("ui"); | 66 let {UI} = require("ui"); |
| 66 UI.blockItem(UI.currentWindow, nodesID, request); | 67 UI.blockItem(UI.currentWindow, nodesID, request); |
| 67 }); | 68 }); |
| 68 | 69 |
| 69 function init() | 70 function init() |
| 70 { | 71 { |
| 71 function processCSSData(event) | 72 function processCSSData(event) |
| 72 { | 73 { |
| 73 if (onShutdown.done) | 74 if (onShutdown.done) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 103 request.overrideMimeType("text/plain"); | 104 request.overrideMimeType("text/plain"); |
| 104 request.addEventListener("load", processCSSData, false); | 105 request.addEventListener("load", processCSSData, false); |
| 105 request.send(null); | 106 request.send(null); |
| 106 } | 107 } |
| 107 catch (e) | 108 catch (e) |
| 108 { | 109 { |
| 109 Cu.reportError(e); | 110 Cu.reportError(e); |
| 110 } | 111 } |
| 111 } | 112 } |
| 112 init(); | 113 init(); |
| OLD | NEW |