 Issue 5294633391226880:
  issue 1435 - Port popup.html from Chrome/Safari/Opera to Firefox  (Closed)
    
  
    Issue 5294633391226880:
  issue 1435 - Port popup.html from Chrome/Safari/Opera to Firefox  (Closed) 
  | 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,35 @@ | 
| 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]); | 
| + { | 
| 
Thomas Greiner
2014/09/29 16:19:49
What about adding the following line to avoid acce
 
saroyanm
2014/10/02 07:53:56
I like it.
Done.
 | 
| + if (match[2] == "toolbar" || match[2] == "status") | 
| + { | 
| + let window = popup.ownerDocument.defaultView; | 
| + let browser = window.document.getElementById(match[1] + "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 +1951,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(); |