refactor: remove sidebar-related code and update localization references

This commit is contained in:
mr. M
2025-04-02 10:16:07 +02:00
parent ce8013124b
commit 031926efb7
33 changed files with 226 additions and 1358 deletions

View File

@@ -1,62 +0,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/.
var gZenNewWebPanel = {
init: function () {
document.addEventListener('dialogaccept', this.handleDialogAccept.bind(this));
},
handleURLChange: async function (aURL) {
try {
let url = new URL(aURL.value);
} catch (_) {
// TODO: Show error message
return;
}
},
addHttpIfMissing(url) {
// List of schemes to avoid
const avoidSchemes = ['about:', 'chrome:', 'moz-extension:', 'view-source:'];
// Check if the URL starts with any of the avoid schemes
for (let scheme of avoidSchemes) {
if (url.startsWith(scheme)) {
return url;
}
}
if (!url.startsWith('http://') && !url.startsWith('https://')) {
return 'https://' + url;
}
return url;
},
handleDialogAccept: async function (aEvent) {
document.commandDispatcher.focusedElement?.blur();
let url = document.getElementById('zenNWP_url');
let ua = document.getElementById('zenNWP_userAgent'); // checbkox
if (!url || !ua) {
return;
}
let urlValue = url.value;
try {
new URL(urlValue);
} catch (_) {
urlValue = this.addHttpIfMissing(url.value);
}
if (!url.value) {
return;
}
let newSite = {
url: urlValue,
ua: ua.checked,
};
let currentData = JSON.parse(Services.prefs.getStringPref('zen.sidebar.data'));
let newName = 'p' + new Date().getTime();
currentData.index.push(newName);
currentData.data[newName] = newSite;
Services.prefs.setStringPref('zen.sidebar.data', JSON.stringify(currentData));
},
};
gZenNewWebPanel.init();

View File

@@ -1,44 +0,0 @@
<?xml version="1.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/. -->
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
id="zenNewWebPanel"
headerparent="zenNewWebPanelDialog"
style="min-width: 40em;">
<dialog id="zenNewWebPanelDialog"
buttons="accept, cancel">
<linkset>
<html:link rel="stylesheet" href="chrome://global/skin/global.css" />
<html:link
rel="stylesheet"
href="chrome://global/content/commonDialog.css"
/>
<html:link rel="stylesheet" href="chrome://global/skin/commonDialog.css" />
<html:link rel="localization" href="browser/zenNewWebPanel.ftl"/>
<script src="chrome://browser/content/zenThemeModifier.js"></script>
</linkset>
<script src="chrome://browser/content/places/zenNewWebPanel.js"/>
<label data-l10n-id="zen-new-web-panel-url"
control="zenNWP_url"/>
<html:input id="zenNWP_url"
type="url" onchange="gZenNewWebPanel.handleURLChange(this);"/>
<hbox flex="1" style="margin: 10px 5px;">
<html:input id="zenNWP_userAgent"
type="checkbox"/>
<label data-l10n-id="zen-new-web-panel-user-agent"
control="zenNWP_userAgent" for="zenNWP_userAgent"/>
</hbox>
</dialog>
</window>

View File

@@ -1,10 +0,0 @@
diff --git a/browser/components/places/jar.mn b/browser/components/places/jar.mn
index e12c6bbf449f062fd22ef260909b539857f52c6a..2dcc143109de015e4c9d486b83119ae1122d2e71 100644
--- a/browser/components/places/jar.mn
+++ b/browser/components/places/jar.mn
@@ -25,3 +25,5 @@ browser.jar:
content/browser/places/interactionsViewer.css (metadataViewer/interactionsViewer.css)
content/browser/places/interactionsViewer.html (metadataViewer/interactionsViewer.html)
content/browser/places/interactionsViewer.js (metadataViewer/interactionsViewer.js)
+ content/browser/places/zenNewWebPanel.xhtml (content/zenNewWebPanel.xhtml)
+ content/browser/places/zenNewWebPanel.js (content/zenNewWebPanel.js)

View File

@@ -919,16 +919,6 @@ var gZenCKSSettings = {
};
Preferences.addAll([
{
id: 'zen.sidebar.enabled',
type: 'bool',
default: true,
},
{
id: 'zen.sidebar.close-on-blur',
type: 'bool',
default: true,
},
{
id: 'zen.view.compact.hide-toolbar',
type: 'bool',

View File

@@ -134,27 +134,6 @@
</vbox>
</groupbox>
<hbox id="zenSidePanelsCategory"
class="subcategory"
hidden="true"
data-category="paneZenLooks">
<html:h1 data-l10n-id="pane-zen-side-panels-title"/>
</hbox>
<groupbox id="zenSidePanelsGroup" data-category="paneZenLooks" hidden="true" class="highlighting-group">
<label><html:h2 data-l10n-id="zen-side-panels-header"/></label>
<description class="description-deemphasized" data-l10n-id="zen-side-panels-description" />
<checkbox id="zenLooksAndFeelUseThemedToolbar"
data-l10n-id="zen-side-panels-enabled"
preference="zen.sidebar.enabled"/>
<hbox class="indent">
<checkbox id="zenLooksAndFeelSidebarCloseOnBlur"
data-l10n-id="zen-side-panels-close-on-blur"
preference="zen.sidebar.close-on-blur"/>
</hbox>
</groupbox>
<hbox id="zenGlanceCategory"
class="subcategory"
hidden="true"

View File

@@ -6,7 +6,7 @@
<html:h1 data-l10n-id="pane-workspaces-title"/>
</hbox>
<hbox id="zenSidePanelsCategory"
<hbox id="zenTabManagementCategory"
class="subcategory"
hidden="true"
data-category="paneZenTabManagement">