As i said, it's not a real plugin, so there are no visual elements, only JavaScript functions. I made a new version, that's not quite finished:
/*:
* @plugindesc v0.01 Offers a number of functions to export saves to files and import them again.
* @author Iavra
*/
(function($, undefined) {
"use strict";
/**
* Loads a given file, parses its content as json and passes it to a given callback. Throws an exception, if the
* file can't be loaded.
*/
var _loadFile = function(url, callback) {
var request = new XMLHttpRequest();
request.overrideMimeType('application/json');
request.open('GET', url);
request.onload = function() { callback(JsonEx.parse(LZString.decompressFromBase64(request.responseText))); };
request.onerror = function() { throw new Error('Couldn\'t load the file \'' + url + '\'.'); };
request.send();
};
/**
* Creates a download with the given data under the given filename. JavaScript can't write directly to the file
* system, unless we are using Node.js, which can't be guaranteed.
*/
var _saveFile = function(filename, data) {
var element = document.createElement('a');
var encoded = encodeURIComponent(LZString.compressToBase64(JsonEx.stringify(data)));
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encoded);
element.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
element.dispatchEvent(event);
} else { element.click(); }
};
//=============================================================================
// IAVRA.SAVE
//=============================================================================
$.SAVE = {
export: function(id) {
var info = DataManager.loadSavefileInfo(id), data = StorageManager.load(id);
if(!info || !data) { throw new Error('Couldn\'t find the savefile \'' + id + '\'.'); }
_saveFile('%1.save'.format(id.padZero(3)), {info: info, data: data});
},
import: function(id, url) {
var globalInfo = DataManager.loadGlobalInfo();
_loadFile(url, function(data) {
globalInfo[id] = data.info;
DataManager.saveGlobalInfo(globalInfo);
StorageManager.save(id, data.data);
})
}
}
})(this.IAVRA || (this.IAVRA = {}));
It offers 2 functions:
IAVRA.SAVE.export(id);
IAVRA.SAVE.import(id, url);
The first one exports the given save to a file and opens a download window. The second one takes the url to such a file and imports it under the given savefile id.
That said, the export currently only really works in web mode (game opened in browser) and not in local mode (testplay in MV, for example), since i can't get the download to work.