mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1229933: create the Loop menu item in the browser Tools menu dynamically from the extension and remove it from core browser code. r=Standard8
This commit is contained in:
parent
474214ab33
commit
424efb4d66
@ -504,11 +504,6 @@
|
|||||||
accesskey="&webapps.accesskey;"
|
accesskey="&webapps.accesskey;"
|
||||||
oncommand="BrowserOpenApps();"/>
|
oncommand="BrowserOpenApps();"/>
|
||||||
|
|
||||||
<menuitem id="menu_openLoop"
|
|
||||||
label="&loopMenuItem.label;"
|
|
||||||
accesskey = "&loopMenuItem.accesskey;"
|
|
||||||
oncommand="LoopUI.togglePanel();"/>
|
|
||||||
|
|
||||||
<!-- only one of sync-setup, sync-syncnowitem or sync-reauthitem will be showing at once -->
|
<!-- only one of sync-setup, sync-syncnowitem or sync-reauthitem will be showing at once -->
|
||||||
<menuitem id="sync-setup"
|
<menuitem id="sync-setup"
|
||||||
label="&syncSignIn.label;"
|
label="&syncSignIn.label;"
|
||||||
|
49
browser/extensions/loop/bootstrap.js
vendored
49
browser/extensions/loop/bootstrap.js
vendored
@ -35,6 +35,7 @@ var WindowListener = {
|
|||||||
let gBrowser = window.gBrowser;
|
let gBrowser = window.gBrowser;
|
||||||
let xhrClass = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"];
|
let xhrClass = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"];
|
||||||
let FileReader = window.FileReader;
|
let FileReader = window.FileReader;
|
||||||
|
let menuItem = null;
|
||||||
|
|
||||||
// the "exported" symbols
|
// the "exported" symbols
|
||||||
var LoopUI = {
|
var LoopUI = {
|
||||||
@ -69,20 +70,6 @@ var WindowListener = {
|
|||||||
return browser;
|
return browser;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @var {String|null} selectedTab Getter for the name of the currently selected
|
|
||||||
* tab inside the Loop panel. Will be NULL if
|
|
||||||
* the panel hasn't loaded yet.
|
|
||||||
*/
|
|
||||||
get selectedTab() {
|
|
||||||
if (!this.browser) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let selectedTab = this.browser.contentDocument.querySelector(".tab-view > .selected");
|
|
||||||
return selectedTab && selectedTab.getAttribute("data-tab-name");
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
@ -278,6 +265,8 @@ var WindowListener = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.addMenuItem();
|
||||||
|
|
||||||
// Don't do the rest if this is for the hidden window - we don't
|
// Don't do the rest if this is for the hidden window - we don't
|
||||||
// have a toolbar there.
|
// have a toolbar there.
|
||||||
if (window == Services.appShell.hiddenDOMWindow) {
|
if (window == Services.appShell.hiddenDOMWindow) {
|
||||||
@ -294,6 +283,35 @@ var WindowListener = {
|
|||||||
this.updateToolbarState();
|
this.updateToolbarState();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a menu item to the browsers' Tools menu that open the Loop panel
|
||||||
|
* when selected.
|
||||||
|
*/
|
||||||
|
addMenuItem: function() {
|
||||||
|
let menu = document.getElementById("menu_ToolsPopup");
|
||||||
|
if (!menu || menuItem) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
menuItem = document.createElementNS(kNSXUL, "menuitem");
|
||||||
|
menuItem.setAttribute("id", "menu_openLoop");
|
||||||
|
menuItem.setAttribute("label", this._getString("loopMenuItem_label"));
|
||||||
|
menuItem.setAttribute("accesskey", this._getString("loopMenuItem_accesskey"));
|
||||||
|
|
||||||
|
menuItem.addEventListener("command", () => this.togglePanel());
|
||||||
|
|
||||||
|
menu.insertBefore(menuItem, document.getElementById("sync-setup"));
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the menu item from the browsers' Tools menu.
|
||||||
|
*/
|
||||||
|
removeMenuItem: function() {
|
||||||
|
if (menuItem) {
|
||||||
|
menuItem.parentNode.removeChild(menuItem);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Implements nsIObserver
|
// Implements nsIObserver
|
||||||
observe: function(subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (topic != "loop-status-changed") {
|
if (topic != "loop-status-changed") {
|
||||||
@ -674,7 +692,10 @@ var WindowListener = {
|
|||||||
|
|
||||||
// Take any steps to remove UI or anything from the browser window
|
// Take any steps to remove UI or anything from the browser window
|
||||||
// document.getElementById() etc. will work here
|
// document.getElementById() etc. will work here
|
||||||
|
if (window.LoopUI) {
|
||||||
|
window.LoopUI.removeMenuItem();
|
||||||
// XXX Add in tear-down of the panel.
|
// XXX Add in tear-down of the panel.
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIWindowMediatorListener functions.
|
// nsIWindowMediatorListener functions.
|
||||||
|
@ -252,8 +252,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
|||||||
<!ENTITY addons.commandkey "A">
|
<!ENTITY addons.commandkey "A">
|
||||||
<!ENTITY webapps.label "Apps">
|
<!ENTITY webapps.label "Apps">
|
||||||
<!ENTITY webapps.accesskey "p">
|
<!ENTITY webapps.accesskey "p">
|
||||||
<!ENTITY loopMenuItem.label "Start a conversation…">
|
|
||||||
<!ENTITY loopMenuItem.accesskey "t">
|
|
||||||
|
|
||||||
<!ENTITY webDeveloperMenu.label "Web Developer">
|
<!ENTITY webDeveloperMenu.label "Web Developer">
|
||||||
<!ENTITY webDeveloperMenu.accesskey "W">
|
<!ENTITY webDeveloperMenu.accesskey "W">
|
||||||
|
@ -9,6 +9,12 @@
|
|||||||
clientShortname2=Firefox Hello
|
clientShortname2=Firefox Hello
|
||||||
clientSuperShortname=Hello
|
clientSuperShortname=Hello
|
||||||
|
|
||||||
|
## LOCALIZATION_NOTE(loopMenuItem_label): Label of the menu item that is placed
|
||||||
|
## inside the browser 'Tools' menu. Use the unicode ellipsis char, \u2026, or
|
||||||
|
## use "..." if \u2026 doesn't suit traditions in your locale.
|
||||||
|
loopMenuItem_label=Start a conversation…
|
||||||
|
loopMenuItem_accesskey=t
|
||||||
|
|
||||||
## LOCALIZATION_NOTE(sign_in_again_title_line_one, sign_in_again_title_line_two2):
|
## LOCALIZATION_NOTE(sign_in_again_title_line_one, sign_in_again_title_line_two2):
|
||||||
## These are displayed together at the top of the panel when a user is needed to
|
## These are displayed together at the top of the panel when a user is needed to
|
||||||
## sign-in again. The emphesis is on the first line to get the user to sign-in again,
|
## sign-in again. The emphesis is on the first line to get the user to sign-in again,
|
||||||
|
Loading…
Reference in New Issue
Block a user