mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-03 13:13:10 +00:00
feature(listeners) onDragStart: add ability to download directories via drag n drop
This commit is contained in:
parent
2c9b092191
commit
7e9ed37b18
1 changed files with 7 additions and 4 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue