2020-02-01 22:42:04 +01:00
|
|
|
import I18n;
|
|
|
|
import register from GUI.Screen;
|
2020-02-02 19:16:27 +01:00
|
|
|
import Save;
|
|
|
|
|
|
|
|
var button;
|
2020-02-01 22:42:04 +01:00
|
|
|
|
|
|
|
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];
|
2020-02-01 22:42:04 +01:00
|
|
|
|
|
|
|
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;
|
2020-02-01 22:42:04 +01:00
|
|
|
}
|