Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/ui.js

Issue 6525035187535872: issue #390 - Integrate parts of Element Hiding Helper functionality into Adblock Plus (Closed)
Patch Set: Created July 18, 2014, 12:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« chrome/locale/en-US/ehh-composer.dtd ('K') | « defaults/prefs.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (data != addonID) 208 if (data != addonID)
209 return; 209 return;
210 210
211 this.initOptionsDoc(subject.QueryInterface(Ci.nsIDOMDocument)); 211 this.initOptionsDoc(subject.QueryInterface(Ci.nsIDOMDocument));
212 }, 212 },
213 213
214 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakRefer ence]) 214 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakRefer ence])
215 }; 215 };
216 optionsObserver.init(); 216 optionsObserver.init();
217 217
218 let InspectorObserver =
219 {
220 init: function()
221 {
222 let gDevTools;
223 try
224 {
225 ({gDevTools}) = Cu.import("resource:///modules/devtools/gDevTools.jsm", nu ll);
226 }
227 catch(e)
228 {
229 // No developer tools or unsupported version - ignore.
230 return;
231 }
232
233 gDevTools.on("inspector-ready", this.inspectorReady);
234 onShutdown.add(function()
235 {
236 gDevTools.off("inspector-ready", this.inspectorReady);
237 }.bind(this));
238 },
239
240 get inspectorButtonTooltip()
241 {
242 // Randomize URI to work around bug 719376
243 let stringBundle = Services.strings.createBundle("chrome://adblockplus/local e/global.properties?" + Math.random());
244 let result = stringBundle.GetStringFromName("inspector.button.tooltiptext");
245
246 delete this.inspectorButtonTooltip;
247 this.__defineGetter__("inspectorButtonTooltip", function() result);
248 return this.inspectorButtonTooltip;
249 },
250
251 inspectorReady: function(eventName, toolbox, panel)
252 {
253 let panelWindow = panel.panelWin;
254 let inspectBtn = panelWindow.document.getElementById("inspector-breadcrumbs" );
255 if (!inspectBtn)
256 return;
257
258 let tooltiptext = InspectorObserver.inspectorButtonTooltip;
259 button = panelWindow.document.createElement("toolbarbutton");
260 button.setAttribute("id", "abp-inspector-toolbarbutton");
261 button.setAttribute("class", "devtools-toolbarbutton");
262 button.setAttribute("tooltiptext", tooltiptext);
263 button.setAttribute("tabindex", "0");
264 button.addEventListener("command", function()
265 {
266 panelWindow.openDialog("chrome://adblockplus/content/ui/ehh-composer.xul", "_blank",
267 "chrome,centerscreen,resizable,dialog=no", panel.se lection.node);
268 }, false);
269
270 //Override button style for light DevTools theme
271 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet ", 'href="chrome://adblockplus/skin/devToolsOverlay.css" type="text/css"');
272 panelWindow.document.insertBefore(style, panelWindow.document.firstChild);
273
274 inspectBtn.parentNode.insertBefore(button, inspectBtn);
275 }
276 };
277
278 InspectorObserver.init();
279
218 /** 280 /**
219 * Session restore observer instance, stored to prevent it from being garbage 281 * Session restore observer instance, stored to prevent it from being garbage
220 * collected. 282 * collected.
221 * @type SessionRestoreObserver 283 * @type SessionRestoreObserver
222 */ 284 */
223 let sessionRestoreObserver = null; 285 let sessionRestoreObserver = null;
224 286
225 /** 287 /**
226 * Observer waiting for the browsing session to be restored on startup. 288 * Observer waiting for the browsing session to be restored on startup.
227 */ 289 */
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 2012 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1951 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 2013 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1952 ]; 2014 ];
1953 2015
1954 onShutdown.add(function() 2016 onShutdown.add(function()
1955 { 2017 {
1956 for (let window in UI.applicationWindows) 2018 for (let window in UI.applicationWindows)
1957 if (UI.isBottombarOpen(window)) 2019 if (UI.isBottombarOpen(window))
1958 UI.toggleBottombar(window); 2020 UI.toggleBottombar(window);
1959 }); 2021 });
OLDNEW
« chrome/locale/en-US/ehh-composer.dtd ('K') | « defaults/prefs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld