| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 | 24 |
| 25 /** | |
| 26 * Random element class, to be used for object tabs displayed on top of the | |
| 27 * plugin content. | |
| 28 * @type string | |
| 29 */ | |
| 25 let classVisibleTop = null; | 30 let classVisibleTop = null; |
| 31 | |
| 32 /** | |
| 33 * Random element class, to be used for object tabs displayed at the bottom of | |
| 34 * the plugin content. | |
| 35 * @type string | |
| 36 */ | |
| 26 let classVisibleBottom = null; | 37 let classVisibleBottom = null; |
|
tschuster
2015/11/25 18:50:13
Please add a description to those.
Wladimir Palant
2015/11/25 22:50:32
Done.
| |
| 38 | |
| 39 /** | |
| 40 * Random element class, to be used for object tabs that are hidden. | |
| 41 * @type string | |
| 42 */ | |
| 27 let classHidden = null; | 43 let classHidden = null; |
| 28 | 44 |
| 29 Utils.addChildMessageListener("AdblockPlus:GetObjectTabsStatus", function() | 45 Utils.addChildMessageListener("AdblockPlus:GetObjectTabsStatus", function() |
| 30 { | 46 { |
| 31 let {UI} = require("ui"); | 47 let {UI} = require("ui"); |
| 32 | 48 |
| 33 return !!(Prefs.enabled && Prefs.frameobjects && UI.overlay && classHidden); | 49 return !!(Prefs.enabled && Prefs.frameobjects && UI.overlay && classHidden); |
| 34 }); | 50 }); |
| 35 | 51 |
| 36 Utils.addChildMessageListener("AdblockPlus:GetObjectTabsTexts", function() | 52 Utils.addChildMessageListener("AdblockPlus:GetObjectTabsTexts", function() |
| 37 { | 53 { |
| 38 let {UI} = require("ui"); | 54 let {UI} = require("ui"); |
| 39 | 55 |
| 40 return { | 56 return { |
| 41 label: UI.overlay.attributes.objtabtext, | 57 label: UI.overlay.attributes.objtabtext, |
| 42 tooltip: UI.overlay.attributes.objtabtooltip, | 58 tooltip: UI.overlay.attributes.objtabtooltip, |
| 43 classVisibleTop, classVisibleBottom, classHidden | 59 classVisibleTop, classVisibleBottom, classHidden |
| 44 }; | 60 }; |
| 45 }); | 61 }); |
| 46 | 62 |
| 47 Utils.addChildMessageListener("AdblockPlus:BlockItem", function(item) | 63 Utils.addChildMessageListener("AdblockPlus:BlockItem", function(item) |
| 48 { | 64 { |
| 49 let {UI} = require("ui"); | 65 let {UI} = require("ui"); |
| 50 UI.blockItem(UI.currentWindow, null, item); | 66 UI.blockItem(UI.currentWindow, null, item); |
| 51 }); | 67 }); |
| 52 | 68 |
| 53 function init() | 69 function init() |
|
Wladimir Palant
2015/11/06 19:52:43
This is based on the _initCSS() function, but with
tschuster
2015/11/25 18:50:13
Thanks, that was helpful.
| |
| 54 { | 70 { |
| 55 function processCSSData(event) | 71 function processCSSData(event) |
| 56 { | 72 { |
| 57 if (onShutdown.done) | 73 if (onShutdown.done) |
| 58 return; | 74 return; |
| 59 | 75 |
| 60 let data = event.target.responseText; | 76 let data = event.target.responseText; |
| 61 | 77 |
| 62 let rnd = []; | 78 let rnd = []; |
| 63 let offset = "a".charCodeAt(0); | 79 let offset = "a".charCodeAt(0); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 87 request.overrideMimeType("text/plain"); | 103 request.overrideMimeType("text/plain"); |
| 88 request.addEventListener("load", processCSSData, false); | 104 request.addEventListener("load", processCSSData, false); |
| 89 request.send(null); | 105 request.send(null); |
| 90 } | 106 } |
| 91 catch (e) | 107 catch (e) |
| 92 { | 108 { |
| 93 Cu.reportError(e); | 109 Cu.reportError(e); |
| 94 } | 110 } |
| 95 } | 111 } |
| 96 init(); | 112 init(); |
| LEFT | RIGHT |