mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 09:26:34 +00:00
Fixed browser panels, they are not tabs anymore
This commit is contained in:
43
src/browser/components/places/content/zenNewWebPanel.js
Normal file
43
src/browser/components/places/content/zenNewWebPanel.js
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
||||
handleDialogAccept: async function(aEvent) {
|
||||
document.commandDispatcher.focusedElement?.blur();
|
||||
let url = document.getElementById("zenNWP_url");
|
||||
let ua = document.getElementById("zenNWP_userAgent");
|
||||
if (!url || !ua) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
new URL(url.value);
|
||||
} catch (_) {
|
||||
return;
|
||||
}
|
||||
if (!url.value || !ua.value) {
|
||||
return;
|
||||
}
|
||||
let newSite = {
|
||||
url: url.value,
|
||||
ua: ua.value,
|
||||
};
|
||||
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();
|
44
src/browser/components/places/content/zenNewWebPanel.xhtml
Normal file
44
src/browser/components/places/content/zenNewWebPanel.xhtml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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>
|
10
src/browser/components/places/jar-mn.patch
Normal file
10
src/browser/components/places/jar-mn.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
diff --git a/browser/components/places/jar.mn b/browser/components/places/jar.mn
|
||||
index 7334914664484267ccf80eeeb2917c2001a1acaf..e0636a13798d6fbf41cbf69e51e460822b00ab1a 100644
|
||||
--- a/browser/components/places/jar.mn
|
||||
+++ b/browser/components/places/jar.mn
|
||||
@@ -25,3 +25,5 @@ browser.jar:
|
||||
content/browser/places/interactionsViewer.html (metadataViewer/interactionsViewer.html)
|
||||
content/browser/places/interactionsViewer.js (metadataViewer/interactionsViewer.js)
|
||||
#endif
|
||||
+ content/browser/places/zenNewWebPanel.xhtml (content/zenNewWebPanel.xhtml)
|
||||
+ content/browser/places/zenNewWebPanel.js (content/zenNewWebPanel.js)
|
Reference in New Issue
Block a user