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

Side by Side Diff: chrome/content/ui/ext/popup.js

Issue 5294633391226880: issue 1435 - Port popup.html from Chrome/Safari/Opera to Firefox (Closed)
Patch Set: Created Oct. 2, 2014, 7:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 (function()
19 {
20 let {UI} = require("ui");
21
22 let iframe = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor )
23 .getInterface(Components.interfaces.nsIWebNavigation)
24 .QueryInterface(Components.interfaces.nsIDocShell)
25 .chromeEventHandler;
26 let topWindow = iframe.ownerDocument.defaultView;
27
28 // Firefox doesn't adjust the size of the popup automatically to the size
29 // of its content, like when the ad counter is expanded/collapsed.
30 let resizingScheduled = false;
31
32 function updateSize()
33 {
34 if (!resizingScheduled)
35 {
36 setTimeout(function()
37 {
38 iframe.parentNode.sizeTo(document.body.scrollWidth, document.body.scroll Height +11);
39 resizingScheduled = false;
40 }, 0);
41
42 resizingScheduled = true;
43 }
44 }
45
46 window.addEventListener("load", function()
47 {
48 updateSize();
49 new MutationObserver(updateSize).observe(document, {
50 childList: true, attributes: true,
51 characterData: true, subtree: true
52 });
53 });
54
55 ext = {
56 __proto__: ext,
57 closePopup: function()
58 {
59 iframe.parentNode.hidePopup();
60 },
61 openBlockable: function()
Thomas Greiner 2014/10/13 13:18:23 This function is no longer used to only open the d
62 {
63 if (!UI.isBottombarOpen(topWindow))
64 {
65 UI.toggleBottombar(topWindow);
66 ext.closePopup();
67 }
68 },
69 showBlockable: function()
70 {
71 return !UI.isBottombarOpen(topWindow);
72 },
73 reportIssue: function()
74 {
75 UI.openReportDialog(topWindow);
76 },
77 showReportIssue: function()
78 {
79 let location = UI.getCurrentLocation(topWindow);
80 return location && Policy.isBlockableScheme(location) && location.scheme ! = "mailto";
81 }
82 };
83 })();
OLDNEW

Powered by Google App Engine
This is Rietveld