mirror of
https://github.com/zen-browser/desktop.git
synced 2026-07-26 10:11:48 +00:00
gh-14651: Change event listeners to not be inlined (gh-14700)
This commit is contained in:
@@ -138,6 +138,18 @@ export class nsZenBoostEditor {
|
||||
.getElementById("zen-boost-css-inspector")
|
||||
.addEventListener("click", this.onInspectorButtonPressed.bind(this));
|
||||
|
||||
const commandActions = {
|
||||
cmd_zenBoostEditName: () => this.editBoostName(),
|
||||
cmd_zenBoostShuffle: () => this.shuffleBoost(),
|
||||
cmd_zenBoostReset: () => this.resetBoost(),
|
||||
cmd_zenBoostLoad: () => this.onLoadBoostClick(),
|
||||
cmd_zenBoostSave: () => this.onSaveBoostClick(),
|
||||
cmd_zenBoostDelete: () => this.deleteBoost(),
|
||||
};
|
||||
for (const [id, action] of Object.entries(commandActions)) {
|
||||
this.doc.getElementById(id).addEventListener("command", action);
|
||||
}
|
||||
|
||||
this.doc.addEventListener("keydown", event => {
|
||||
if (
|
||||
event.key === "Escape" ||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
# Windows
|
||||
* content/browser/zen-components/windows/zen-boost-editor.xhtml (../../zen/boosts/zen-boost-editor.inc.xhtml)
|
||||
content/browser/zen-components/windows/zen-boost-editor.js (../../zen/boosts/zen-boost-editor.js)
|
||||
|
||||
# Images
|
||||
content/browser/zen-images/boost-indicator.svg (../../zen/images/boost-indicator.svg)
|
||||
|
||||
@@ -138,28 +138,14 @@
|
||||
</popupset>
|
||||
|
||||
<commandset id="zenBoostCommandSet">
|
||||
<command id="cmd_zenBoostEditName"
|
||||
oncommand="window.boostEditor.editBoostName();" />
|
||||
|
||||
<command id="cmd_zenBoostShuffle"
|
||||
oncommand="window.boostEditor.shuffleBoost();" />
|
||||
|
||||
<command id="cmd_zenBoostReset"
|
||||
oncommand="window.boostEditor.resetBoost();" />
|
||||
|
||||
<command id="cmd_zenBoostLoad"
|
||||
oncommand="window.boostEditor.onLoadBoostClick();" />
|
||||
|
||||
<command id="cmd_zenBoostSave"
|
||||
oncommand="window.boostEditor.onSaveBoostClick();" />
|
||||
|
||||
<command id="cmd_zenBoostDelete"
|
||||
oncommand="window.boostEditor.deleteBoost();" />
|
||||
<command id="cmd_zenBoostEditName" />
|
||||
<command id="cmd_zenBoostShuffle" />
|
||||
<command id="cmd_zenBoostReset" />
|
||||
<command id="cmd_zenBoostLoad" />
|
||||
<command id="cmd_zenBoostSave" />
|
||||
<command id="cmd_zenBoostDelete" />
|
||||
</commandset>
|
||||
|
||||
<script>
|
||||
const { nsZenBoostEditor } = ChromeUtils.importESModule( "resource:///modules/zen/boosts/ZenBoostsEditor.mjs" );
|
||||
window.boostEditor = new nsZenBoostEditor(document, window.domain, window, window.openerWindow);
|
||||
</script>
|
||||
<script src="chrome://browser/content/zen-components/windows/zen-boost-editor.js"></script>
|
||||
</html:body>
|
||||
</html>
|
||||
|
||||
14
src/zen/boosts/zen-boost-editor.js
Normal file
14
src/zen/boosts/zen-boost-editor.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { nsZenBoostEditor } = ChromeUtils.importESModule(
|
||||
"resource:///modules/zen/boosts/ZenBoostsEditor.mjs"
|
||||
);
|
||||
|
||||
window.boostEditor = new nsZenBoostEditor(
|
||||
document,
|
||||
window.domain,
|
||||
window,
|
||||
window.openerWindow
|
||||
);
|
||||
@@ -7,3 +7,4 @@
|
||||
|
||||
# Windows
|
||||
* content/browser/zen-components/windows/zen-space-routing.xhtml (../../zen/space-routing/zen-space-routing.inc.xhtml)
|
||||
content/browser/zen-components/windows/zen-space-routing.js (../../zen/space-routing/zen-space-routing.js)
|
||||
|
||||
@@ -82,15 +82,5 @@
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<script>
|
||||
const { nsZenSpaceRoutingDialog } = ChromeUtils.importESModule(
|
||||
"resource:///modules/zen/spacerouting/ZenSpaceRoutingDialog.mjs",
|
||||
);
|
||||
const args = window.arguments?.[0] || {};
|
||||
window.spaceroutingDialog = new nsZenSpaceRoutingDialog(
|
||||
document,
|
||||
window,
|
||||
args.parentWindow,
|
||||
);
|
||||
</script>
|
||||
<script src="chrome://browser/content/zen-components/windows/zen-space-routing.js"></script>
|
||||
</window>
|
||||
|
||||
14
src/zen/space-routing/zen-space-routing.js
Normal file
14
src/zen/space-routing/zen-space-routing.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { nsZenSpaceRoutingDialog } = ChromeUtils.importESModule(
|
||||
"resource:///modules/zen/spacerouting/ZenSpaceRoutingDialog.mjs"
|
||||
);
|
||||
|
||||
const args = window.arguments?.[0] || {};
|
||||
window.spaceroutingDialog = new nsZenSpaceRoutingDialog(
|
||||
document,
|
||||
window,
|
||||
args.parentWindow
|
||||
);
|
||||
Reference in New Issue
Block a user