25 lines
571 B
JavaScript
25 lines
571 B
JavaScript
import I18n;
|
|
import register from GUI.Screen;
|
|
import Save;
|
|
|
|
var button;
|
|
|
|
return {
|
|
init: init
|
|
};
|
|
|
|
function init() {
|
|
register('settings');
|
|
var exportRoot = document.getElementById('export');
|
|
var label = exportRoot.getElementsByTagName('span')[0];
|
|
button = exportRoot.getElementsByTagName('a')[0];
|
|
|
|
label.textContent = I18n.get('exportLabel');
|
|
button.textContent = I18n.get('doExport');
|
|
button.addEventListener('click', doExport);
|
|
}
|
|
|
|
function doExport() {
|
|
var data = encodeURIComponent(JSON.stringify(Save.get()));
|
|
button.href = 'data:application/json,' + data;
|
|
}
|