Bug 948888 - Move inline scripts and styles into separate file for toolkit/mozapps/extensions/content/extensions.xul (URL=about:addons) r=Unfocused,MattN

This commit is contained in:
Projjol Banerji 2014-02-21 03:52:00 +13:00
Родитель c5cb449e45
Коммит bd5ecc9c89
3 изменённых файлов: 64 добавлений и 15 удалений

Просмотреть файл

@ -79,6 +79,42 @@ function initialize(event) {
return;
}
document.removeEventListener("load", initialize, true);
let globalCommandSet = document.getElementById("globalCommandSet");
globalCommandSet.addEventListener("command", function(event) {
gViewController.doCommand(event.target.id);
});
let viewCommandSet = document.getElementById("viewCommandSet");
viewCommandSet.addEventListener("commandupdate", function(event) {
gViewController.updateCommands();
});
viewCommandSet.addEventListener("command", function(event) {
gViewController.doCommand(event.target.id);
});
let detailScreenshot = document.getElementById("detail-screenshot");
detailScreenshot.addEventListener("load", function(event) {
this.removeAttribute("loading");
});
detailScreenshot.addEventListener("error", function(event) {
this.setAttribute("loading", "error");
});
let addonPage = document.getElementById("addons-page");
addonPage.addEventListener("dragenter", function(event) {
gDragDrop.onDragOver(event);
});
addonPage.addEventListener("dragover", function(event) {
gDragDrop.onDragOver(event);
});
addonPage.addEventListener("drop", function(event) {
gDragDrop.onDrop(event);
});
addonPage.addEventListener("keypress", function(event) {
gHeader.onKeyPress(event);
});
gViewController.initialize();
gCategories.initialize();
gHeader.initialize();
@ -679,6 +715,13 @@ var gViewController = {
}
},
cmd_focusSearch: {
isEnabled: () => true,
doCommand: function cmd_focusSearch_doCommand() {
gHeader.focusSearchBox();
}
},
cmd_restartApp: {
isEnabled: function cmd_restartApp_isEnabled() true,
doCommand: function cmd_restartApp_doCommand() {
@ -1757,6 +1800,19 @@ var gHeader = {
onKeyPress: function gHeader_onKeyPress(aEvent) {
if (String.fromCharCode(aEvent.charCode) == "/") {
this.focusSearchBox();
return;
}
// XXXunf Temporary until bug 371900 is fixed.
let key = document.getElementById("focusSearch").getAttribute("key");
#ifdef XP_MACOSX
let keyModifier = aEvent.metaKey;
#else
let keyModifier = aEvent.ctrlKey;
#endif
if (String.fromCharCode(aEvent.charCode) == key && keyModifier) {
this.focusSearchBox();
return;
}
},

Просмотреть файл

@ -18,11 +18,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml"
id="addons-page" title="&addons.windowTitle;"
role="application" windowtype="Addons:Manager"
disablefastfind="true"
ondragenter="gDragDrop.onDragOver(event)"
ondragover="gDragDrop.onDragOver(event)"
ondrop="gDragDrop.onDrop(event)"
onkeypress="gHeader.onKeyPress(event)">
disablefastfind="true">
<xhtml:link rel="shortcut icon"
href="chrome://mozapps/skin/extensions/extensionGeneric-16.png"/>
@ -76,8 +72,8 @@
<!-- global commands - these act on all addons, or affect the addons manager
in some other way -->
<commandset id="globalCommandSet"
oncommand="gViewController.doCommand(event.target.id);">
<commandset id="globalCommandSet">
<command id="cmd_focusSearch"/>
<command id="cmd_findAllUpdates"/>
<command id="cmd_restartApp"/>
<command id="cmd_goToDiscoverPane"/>
@ -95,9 +91,7 @@
<!-- view commands - these act on the selected addon -->
<commandset id="viewCommandSet"
events="richlistbox-select" commandupdater="true"
oncommandupdate="gViewController.updateCommands();"
oncommand="gViewController.doCommand(event.target.id);">
events="richlistbox-select" commandupdater="true">
<command id="cmd_showItemDetails"/>
<command id="cmd_findItemUpdates"/>
<command id="cmd_showItemPreferences"/>
@ -116,8 +110,9 @@
</commandset>
<keyset>
<!-- XXXunf Disabled until bug 371900 is fixed. -->
<key id="focusSearch" key="&search.commandkey;" modifiers="accel"
oncommand="gHeader.focusSearchBox();"/>
disabled="true"/>
</keyset>
<!-- main header -->
@ -518,9 +513,7 @@
</vbox>
<hbox id="detail-desc-container" align="start">
<vbox pack="center"> <!-- Necessary to work around bug 394738 -->
<image id="detail-screenshot" hidden="true"
onload="this.removeAttribute('loading');"
onerror="this.setAttribute('loading', 'error');"/>
<image id="detail-screenshot" hidden="true"/>
</vbox>
<vbox flex="1">
<description id="detail-desc"/>

Просмотреть файл

@ -6,7 +6,7 @@ toolkit.jar:
% content mozapps %content/mozapps/
* content/mozapps/extensions/extensions.xul (content/extensions.xul)
content/mozapps/extensions/extensions.css (content/extensions.css)
content/mozapps/extensions/extensions.js (content/extensions.js)
* content/mozapps/extensions/extensions.js (content/extensions.js)
* content/mozapps/extensions/extensions.xml (content/extensions.xml)
content/mozapps/extensions/updateinfo.xsl (content/updateinfo.xsl)
content/mozapps/extensions/extensions-content.js (content/extensions-content.js)