webclient/js/GUI/Screen/Settings.js

26 lines
571 B
JavaScript
Raw Permalink Normal View History

import I18n;
import register from GUI.Screen;
2020-02-02 19:16:27 +01:00
import Save;
var button;
return {
init: init
};
function init() {
register('settings');
var exportRoot = document.getElementById('export');
var label = exportRoot.getElementsByTagName('span')[0];
2020-02-02 19:16:27 +01:00
button = exportRoot.getElementsByTagName('a')[0];
label.textContent = I18n.get('exportLabel');
button.textContent = I18n.get('doExport');
button.addEventListener('click', doExport);
}
function doExport() {
2020-02-02 19:16:27 +01:00
var data = encodeURIComponent(JSON.stringify(Save.get()));
button.href = 'data:application/json,' + data;
}