From 966872e20b0f499757c318fbe88509186354c6ad Mon Sep 17 00:00:00 2001
From: Jannover5000r <90698896+Jannover5000r@users.noreply.github.com>
Date: Mon, 9 Mar 2026 16:11:35 +0100
Subject: [PATCH] added save buttons
---
index.html | 5 +++++
js/io.js | 29 ++++++++++++++++++++++++++++-
locale/de.xml | 3 +++
locale/en.xml | 3 +++
4 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index d3263b2..5982357 100644
--- a/index.html
+++ b/index.html
@@ -182,6 +182,11 @@
+
+
+
+
+
diff --git a/js/io.js b/js/io.js
index 97da18f..9f6887d 100644
--- a/js/io.js
+++ b/js/io.js
@@ -24,6 +24,9 @@ SQL.IO = function (owner) {
"serverlist",
"clientcopy",
"clientpaste",
+ "clientdownloadxml",
+ "clientdownloadtxt",
+ // "clientloadfromfile",
"serverimport",
];
for (var i = 0; i < ids.length; i++) {
@@ -85,6 +88,9 @@ SQL.IO = function (owner) {
OZ.Event.add(this.dom.serverimport, "click", this.serverimport.bind(this));
OZ.Event.add(this.dom.clientcopy, "click", this.clientcopy.bind(this));
OZ.Event.add(this.dom.clientpaste, "click", this.clientpaste.bind(this));
+ OZ.Event.add(this.dom.clientdownloadxml, "click", this.clientdownloadxml.bind(this));
+ OZ.Event.add(this.dom.clientdownloadtxt, "click", this.clientdownloadtxt.bind(this));
+// OZ.Event.add(this.dom.clientloadfromfile, "click", this.clientloadfromfile.bind(this));
OZ.Event.add(document, "keydown", this.press.bind(this));
this.build();
};
@@ -184,8 +190,29 @@ SQL.IO.prototype.clientpaste = function () {
}).catch(function(err) {
alert("Failed to paste: " + err);
});
+};
-};SQL.IO.prototype.promptName = function (title, suffix) {
+SQL.IO.prototype.clientdownloadxml = function () {
+ var xml = this.owner.toXML();
+ this.downloadFile(xml, "new-database.xml", "application/xml");
+};
+
+SQL.IO.prototype.clientdownloadtxt = function () {
+ var xml = this.owner.toXML();
+ this.downloadFile(xml, "new-database.txt", "text/plain");
+};
+SQL.IO.prototype.downloadFile = function (content, filename, mimeType) {
+ var blob = new Blob([content], { type: mimeType });
+ var url = URL.createObjectURL(blob);
+ var a = document.createElement("a");
+ a.href = url;
+ a.download = filename;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+};
+SQL.IO.prototype.promptName = function (title, suffix) {
var lastUsedName =
this.owner.getOption("lastUsedName") || this.lastUsedName;
var name = prompt(_(title), lastUsedName);
diff --git a/locale/de.xml b/locale/de.xml
index 55d334e..9413d44 100644
--- a/locale/de.xml
+++ b/locale/de.xml
@@ -78,6 +78,9 @@
XML laden
Ausgabe Speichern
Kopierten Code einfügen
+ als XML speichern
+ als TXT speichern
+ Datenbank von Datei laden
In Browser speichern
Von Browser laden
Von Browser auflisten
diff --git a/locale/en.xml b/locale/en.xml
index a8ecc91..9160d94 100755
--- a/locale/en.xml
+++ b/locale/en.xml
@@ -85,6 +85,9 @@
Generate SQL
Copy Output
Paste from Clipboard
+ Download as XML
+ Download as TXT
+ Load Database from file
Server backend:
Save
Quicksave