Skip to content

Commit

Permalink
Bug 948888 - Move inline scripts and styles into separate file for to…
Browse files Browse the repository at this point in the history
…olkit/mozapps/extensions/content/extensions.xul (URL=about:addons) r=Unfocused,MattN
  • Loading branch information
Projjol committed Feb 20, 2014
1 parent c5cb449 commit bd5ecc9
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 15 deletions.
56 changes: 56 additions & 0 deletions toolkit/mozapps/extensions/content/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}
},

Expand Down
21 changes: 7 additions & 14 deletions toolkit/mozapps/extensions/content/extensions.xul
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down Expand Up @@ -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"/>
Expand All @@ -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"/>
Expand All @@ -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 -->
Expand Down Expand Up @@ -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"/>
Expand Down
2 changes: 1 addition & 1 deletion toolkit/mozapps/extensions/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bd5ecc9

Please sign in to comment.