Skip to content

Commit

Permalink
Merge pull request #51 from airtower-luna/one-click-export
Browse files Browse the repository at this point in the history
Download JSON blob when user clicks "export config"
  • Loading branch information
airtower-luna authored Jan 12, 2022
2 parents 73f1e07 + 618e1ba commit e7ac045
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 19 deletions.
4 changes: 0 additions & 4 deletions _locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@
"message": "Konfiguration exportieren",
"description": "Export configuration button"
},
"config export link": {
"message": "Bitte speichern Sie diese JSON-Datei:",
"description": "Message with link to JSON configuration blob. Make sure to include the id when translating!"
},
"select import file": {
"message": "Sicherungsdatei zum Import auswählen",
"description": "File selector for configration import"
Expand Down
4 changes: 0 additions & 4 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@
"message": "Export configuration",
"description": "Export configuration button"
},
"config export link": {
"message": "Please save this JSON file:",
"description": "Message with link to JSON configuration blob. Make sure to include the id when translating!"
},
"select import file": {
"message": "Choose backup file to import",
"description": "File selector for configration import"
Expand Down
4 changes: 0 additions & 4 deletions _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@
"message": "Экспорт конфигурации",
"description": "Export configuration button"
},
"config export link": {
"message": "Сохраните этот JSON-файл:",
"description": "Message with link to JSON configuration blob. Make sure to include the id when translating!"
},
"select import file": {
"message": "Выберите файл резервной копии для импорта",
"description": "File selector for configration import"
Expand Down
4 changes: 0 additions & 4 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ <h3 class="i18n-text">config backup title</h3>
<div class="control">
<button class="browser-style i18n-text" type="button" id="export">config export button</button>
</div>
<div id="export_text" hidden>
<span class="i18n-text">config export link</span>
<a id="export_blob"></a>
</div>
</p>
<p>
<div class="browser-style">
Expand Down
5 changes: 2 additions & 3 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,11 @@ function exportConfig()
let blob = new Blob([JSON.stringify(exportConf, null, 2)],
{ type: "application/json" });
let url = URL.createObjectURL(blob);
let link = document.querySelector("#export_blob");
let link = document.createElement("a");
link.href = url;
let date = new Date().toISOString().replaceAll(":", "_");
link.download = `referer_mod_config-${date}.json`;
link.innerText = `referer_mod_config-${date}.json`;
document.querySelector("#export_text").hidden = false;
link.dispatchEvent(new MouseEvent("click"));
}, null);
}

Expand Down

0 comments on commit e7ac045

Please sign in to comment.