blob: cb98fc700434b59f5f7a77d044e76aeb68f0f0b8 [file] [log] [blame]
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global Folder, File, bm_eventDispatcher, $ */
var bm_downloadManager = (function () {
'use strict';
var ob = {};
function getPlayer(zippedFlag) {
var extensionPath = $.fileName.split('/').slice(0, -1).join('/') + '/';
var folder = new Folder(extensionPath);
folder = folder.parent;
var fileName;
if (zippedFlag) {
fileName = 'bm.js.gz';
} else {
fileName = 'bm.js';
}
var bmFile = new File(folder.absoluteURI + '/assets/player/' + fileName);
var uri = Folder.desktop.absoluteURI + '/bodymovin.js';
var f = new File(uri);
var saveFileData = f.saveDlg();
if (saveFileData !== null) {
if (bmFile.copy(saveFileData.absoluteURI)) {
bm_eventDispatcher.sendEvent('bm:alert', {message: 'File saved', type: 'success'});
} else {
bm_eventDispatcher.sendEvent('bm:alert', {message: 'File could not be saved', type: 'fail'});
}
}
}
ob.getPlayer = getPlayer;
return ob;
}());