mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
Issue #517 Part 5: Remove configuration menu
This commit is contained in:
parent
5ed9f22c99
commit
da1b8162b4
4 changed files with 1 additions and 159 deletions
|
|
@ -1,124 +0,0 @@
|
||||||
#ifdef 0
|
|
||||||
/* 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/. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
var gCustomize = {
|
|
||||||
_nodeIDSuffixes: [
|
|
||||||
"blank",
|
|
||||||
"button",
|
|
||||||
"classic",
|
|
||||||
"enhanced",
|
|
||||||
"panel",
|
|
||||||
"overlay",
|
|
||||||
"learn"
|
|
||||||
],
|
|
||||||
|
|
||||||
_nodes: {},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
for (let idSuffix of this._nodeIDSuffixes) {
|
|
||||||
this._nodes[idSuffix] = document.getElementById("newtab-customize-" + idSuffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._nodes.button.addEventListener("click", e => this.showPanel(e));
|
|
||||||
this._nodes.blank.addEventListener("click", this);
|
|
||||||
this._nodes.classic.addEventListener("click", this);
|
|
||||||
this._nodes.learn.addEventListener("click", this);
|
|
||||||
|
|
||||||
this.updateSelected();
|
|
||||||
},
|
|
||||||
|
|
||||||
hidePanel: function() {
|
|
||||||
this._nodes.overlay.addEventListener("transitionend", function onTransitionEnd() {
|
|
||||||
gCustomize._nodes.overlay.removeEventListener("transitionend", onTransitionEnd);
|
|
||||||
gCustomize._nodes.overlay.style.display = "none";
|
|
||||||
});
|
|
||||||
this._nodes.overlay.style.opacity = 0;
|
|
||||||
this._nodes.button.removeAttribute("active");
|
|
||||||
this._nodes.panel.removeAttribute("open");
|
|
||||||
document.removeEventListener("click", this);
|
|
||||||
document.removeEventListener("keydown", this);
|
|
||||||
},
|
|
||||||
|
|
||||||
showPanel: function(event) {
|
|
||||||
if (this._nodes.panel.getAttribute("open") == "true") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let {panel, button, overlay} = this._nodes;
|
|
||||||
overlay.style.display = "block";
|
|
||||||
panel.setAttribute("open", "true");
|
|
||||||
button.setAttribute("active", "true");
|
|
||||||
setTimeout(() => {
|
|
||||||
// Wait for display update to take place, then animate.
|
|
||||||
overlay.style.opacity = 0.8;
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
document.addEventListener("click", this);
|
|
||||||
document.addEventListener("keydown", this);
|
|
||||||
|
|
||||||
// Stop the event propogation to prevent panel from immediately closing
|
|
||||||
// via the document click event that we just added.
|
|
||||||
event.stopPropagation();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleEvent: function(event) {
|
|
||||||
switch (event.type) {
|
|
||||||
case "click":
|
|
||||||
this.onClick(event);
|
|
||||||
break;
|
|
||||||
case "keydown":
|
|
||||||
this.onKeyDown(event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onClick: function(event) {
|
|
||||||
if (event.currentTarget == document) {
|
|
||||||
if (!this._nodes.panel.contains(event.target)) {
|
|
||||||
this.hidePanel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (event.currentTarget.id) {
|
|
||||||
case "newtab-customize-blank":
|
|
||||||
sendAsyncMessage("NewTab:Customize", {enabled: false, enhanced: false});
|
|
||||||
break;
|
|
||||||
case "newtab-customize-classic":
|
|
||||||
sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: false});
|
|
||||||
break;
|
|
||||||
case "newtab-customize-enhanced":
|
|
||||||
sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: !gAllPages.enhanced});
|
|
||||||
break;
|
|
||||||
case "newtab-customize-learn":
|
|
||||||
this.showLearn();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onKeyDown: function(event) {
|
|
||||||
if (event.keyCode == event.DOM_VK_ESCAPE) {
|
|
||||||
this.hidePanel();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
showLearn: function() {
|
|
||||||
window.open(TILES_INTRO_LINK, 'new_window');
|
|
||||||
this.hidePanel();
|
|
||||||
},
|
|
||||||
|
|
||||||
updateSelected: function() {
|
|
||||||
let {enabled} = gAllPages;
|
|
||||||
let selected = enabled ? "classic" : "blank";
|
|
||||||
["classic", "blank"].forEach(id => {
|
|
||||||
let node = this._nodes[id];
|
|
||||||
if (id == selected) {
|
|
||||||
node.setAttribute("selected", true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
node.removeAttribute("selected");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -65,7 +65,6 @@ const TILES_PRIVACY_LINK = "https://www.mozilla.org/privacy/";
|
||||||
#include updater.js
|
#include updater.js
|
||||||
#include undo.js
|
#include undo.js
|
||||||
#include search.js
|
#include search.js
|
||||||
#include customize.js
|
|
||||||
|
|
||||||
// Everything is loaded. Initialize the New Tab Page.
|
// Everything is loaded. Initialize the New Tab Page.
|
||||||
gPage.init();
|
gPage.init();
|
||||||
|
|
|
||||||
|
|
@ -23,28 +23,6 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body dir="&locale.dir;">
|
<body dir="&locale.dir;">
|
||||||
<div id="newtab-customize-overlay"></div>
|
|
||||||
|
|
||||||
<div class="newtab-customize-panel-container">
|
|
||||||
<div id="newtab-customize-panel" orient="vertical">
|
|
||||||
<div id="newtab-customize-panel-anchor"></div>
|
|
||||||
<div id="newtab-customize-panel-inner-wrapper">
|
|
||||||
<div id="newtab-customize-title" class="newtab-customize-panel-item">
|
|
||||||
<label>&newtab.customize.cog.title2;</label>
|
|
||||||
</div>
|
|
||||||
<div id="newtab-customize-classic" class="newtab-customize-panel-item selectable">
|
|
||||||
<label>&newtab.customize.classic;</label>
|
|
||||||
</div>
|
|
||||||
<div id="newtab-customize-blank" class="newtab-customize-panel-item selectable">
|
|
||||||
<label>&newtab.customize.blank2;</label>
|
|
||||||
</div>
|
|
||||||
<div id="newtab-customize-learn" class="newtab-customize-panel-item">
|
|
||||||
<label>&newtab.customize.cog.learn;</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="newtab-vertical-margin">
|
<div id="newtab-vertical-margin">
|
||||||
<div id="newtab-margin-top"/>
|
<div id="newtab-margin-top"/>
|
||||||
|
|
||||||
|
|
@ -78,9 +56,6 @@
|
||||||
|
|
||||||
<div id="newtab-margin-bottom"/>
|
<div id="newtab-margin-bottom"/>
|
||||||
</div>
|
</div>
|
||||||
<input id="newtab-customize-button" type="button" dir="&locale.dir;"
|
|
||||||
value="⚙"
|
|
||||||
title="&newtab.customize.title;"/>
|
|
||||||
</body>
|
</body>
|
||||||
<script type="text/javascript;version=1.8" src="chrome://browser/content/newtab/newTab.js"/>
|
<script type="text/javascript;version=1.8" src="chrome://browser/content/newtab/newTab.js"/>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,7 @@
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<!-- These strings are used in the about:newtab page -->
|
<!-- These strings are used in the about:newtab page -->
|
||||||
<!ENTITY newtab.pageTitle "New Tab">
|
<!ENTITY newtab.pageTitle "Quickdial">
|
||||||
<!ENTITY newtab.customize.classic "Show your top sites">
|
|
||||||
<!ENTITY newtab.customize.cog.enhanced "Include suggested sites">
|
|
||||||
<!ENTITY newtab.customize.cog.title2 "NEW TAB CONTROLS">
|
|
||||||
<!ENTITY newtab.customize.cog.learn "Learn about New Tab">
|
|
||||||
<!ENTITY newtab.customize.title "Customize your New Tab page">
|
|
||||||
<!ENTITY newtab.customize.suggested "Show suggested and your top sites">
|
|
||||||
<!ENTITY newtab.customize.topsites "Show your top sites">
|
|
||||||
<!ENTITY newtab.customize.blank2 "Show blank page">
|
|
||||||
<!ENTITY newtab.undo.removedLabel "Thumbnail removed.">
|
<!ENTITY newtab.undo.removedLabel "Thumbnail removed.">
|
||||||
<!ENTITY newtab.undo.undoButton "Undo.">
|
<!ENTITY newtab.undo.undoButton "Undo.">
|
||||||
<!ENTITY newtab.undo.restoreButton "Restore All.">
|
<!ENTITY newtab.undo.restoreButton "Restore All.">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue