feature(listeners) onDragStart: add ability to download directories via drag n drop

This commit is contained in:
coderaiser 2015-07-07 11:08:27 -04:00
parent 2c9b092191
commit 7e9ed37b18

View file

@ -201,16 +201,19 @@ var Util, DOM, CloudFunc, CloudCmd;
* in Chrome (HTML5)
*/
function onDragStart(event) {
var element = getLIElement(event.target),
EXT = 'json',
var apiURL = CloudFunc.apiURL,
element = getLIElement(event.target),
EXT = '.tar.gz',
isDir = Info.isDir,
link = DOM.getCurrentLink(element),
name = DOM.getCurrentName(element);
/* if it's directory - adding json extension */
if (isDir) {
name += '.' + EXT;
link += '?' + EXT;
name += EXT;
link = document.createElement('a');
link.textContent = name;
link.href = apiURL + '/pack' + Info.path + EXT;
}
event.dataTransfer.setData('DownloadURL',