-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
22 lines (18 loc) · 795 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(function() {
var dataHolder = document.getElementById('save-data-interface');
var editor = ace.edit('save-json-interface');
editor.setTheme('ace/theme/monokai');
editor.getSession().setMode('ace/mode/json');
var importButton = document.getElementById('parse-save-data');
var exportButton = document.getElementById('export-save-json');
importButton.addEventListener('click', function() {
var result = LZString.decompressFromBase64(dataHolder.value);
result = JSON.stringify(JSON.parse(result), null, 4);
editor.setValue(result);
dataHolder.value = '';
});
exportButton.addEventListener('click', function() {
var result = LZString.compressToBase64(editor.getValue());
dataHolder.value = result;
});
})();