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

Unified Diff: lib/ui.js

Issue 5294633391226880: issue 1435 - Port popup.html from Chrome/Safari/Opera to Firefox (Closed)
Patch Set: Created Oct. 27, 2014, 9:40 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/content/ui/utils.js ('K') | « chrome/skin/popup.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/ui.js
===================================================================
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -34,7 +34,7 @@
let CustomizableUI = null;
/**
- * Filter corresponding with "disable on site" menu item (set in fillIconMent()).
+ * Filter corresponding with "disable on site" menu item (set in fillIconMenu()).
* @type Filter
*/
let siteWhitelist = null;
@@ -387,8 +387,6 @@
this.overlay.all[0].appendChild(menuSource);
if ("abp-toolbarbutton" in this.overlay)
this.overlay["abp-toolbarbutton"].appendChild(fixId(menuSource.cloneNode(true), "abp-toolbar"));
- if ("abp-menuitem" in this.overlay)
- this.overlay["abp-menuitem"].appendChild(fixId(menuSource.cloneNode(true), "abp-menuitem"));
}
},
@@ -563,6 +561,7 @@
element.addEventListener(event, handler.bind(null, window), false);
}
window.addEventListener("popupshowing", this.onPopupShowing, false);
+ window.addEventListener("popuphiding", this.onPopupHiding, false);
window.addEventListener("keypress", this.onKeyPress, false);
addBrowserLocationListener(window, function()
@@ -626,6 +625,7 @@
}
window.removeEventListener("popupshowing", this.onPopupShowing, false);
+ window.removeEventListener("popuphiding", this.onPopupHiding, false);
window.removeEventListener("keypress", this.onKeyPress, false);
removeBrowserLocationListeners(window);
removeBrowserClickListeners(window);
@@ -1290,9 +1290,36 @@
this.fillIconTooltip(event, popup.ownerDocument.defaultView);
else
{
- let match = /^(abp-(?:toolbar|status|menuitem)-)popup$/.exec(popup.id);
+ let match = /^(abp-(toolbar|status|menuitem)-)popup$/.exec(popup.id);
if (match)
- this.fillIconMenu(event, popup.ownerDocument.defaultView, match[1]);
+ {
+ let [, prefix, name] = match;
+ let window = popup.ownerDocument.defaultView;
+ if (name == "toolbar" || name == "status")
+ {
+ let browser = window.document.getElementById(prefix + "popup-browser");
+ browser.setAttribute("src", "chrome://adblockplus/content/ui/popup.html");
+ }
+ else
+ this.fillIconMenu(event, window, prefix);
+ }
+ }
+ },
+
+ /**
+ * Called when some pop-up in the application window is being hidden
+ */
+ onPopupHiding: function(/**Event*/ event)
+ {
+ if (event.defaultPrevented)
+ return;
+
+ let popup = event.originalTarget;
+ if (popup.id == "abp-toolbar-popup")
+ {
+ let window = popup.ownerDocument.defaultView;
+ let browser = window.document.getElementById("abp-toolbar-popup-browser");
+ browser.setAttribute("src", "about:blank");
}
},
@@ -1925,6 +1952,7 @@
}
};
UI.onPopupShowing = UI.onPopupShowing.bind(UI);
+UI.onPopupHiding = UI.onPopupHiding.bind(UI);
UI.onKeyPress = UI.onKeyPress.bind(UI);
UI.onIconClick = UI.onIconClick.bind(UI);
UI.init();
« chrome/content/ui/utils.js ('K') | « chrome/skin/popup.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld