| 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; |
| + if (name == "toolbar" || name == "status") |
| + { |
| + let window = popup.ownerDocument.defaultView; |
| + let browser = window.document.getElementById(prefix + "popup-browser"); |
| + browser.setAttribute("src", "chrome://adblockplus/content/ui/popup.html"); |
| + } |
| + else |
| + this.fillIconMenu(event, popup.ownerDocument.defaultView, match[1]); |
| + } |
| + } |
| + }, |
| + |
| + /** |
| + * 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(); |