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. 17, 2014, 11:23 a.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/popup.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;
+ 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]);
Thomas Greiner 2014/10/17 15:02:21 You're still using `match[1]` here instead of `pre
saroyanm 2014/10/21 13:39:21 Oops.
+ }
+ }
+ },
+
+ /**
+ * 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/popup.js ('K') | « chrome/skin/popup.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld