From 93c70319410d69fb4c724fcb7ea3df8d8fa81443 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:05:57 +0800 Subject: [PATCH] in upload, not open new window, add copy button --- theme/classic.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index f1e00b8..f59ae1d 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -209,7 +209,7 @@ else $filenum = 0; ?> - + @@ -712,17 +712,18 @@ } else console.log(xhr.status+'\n'+xhr.responseText); } } - function CopyAllDownloadUrl() { + function CopyAllDownloadUrl(str) { var tmptextarea=document.createElement('textarea'); document.body.appendChild(tmptextarea); tmptextarea.setAttribute('style','position:absolute;left:-100px;width:0px;height:0px;'); - document.querySelectorAll('.download').forEach(function (e) { + document.querySelectorAll(str).forEach(function (e) { tmptextarea.innerHTML+=e.href+"\r\n"; }); tmptextarea.select(); tmptextarea.setSelectionRange(0, tmptextarea.value.length); document.execCommand("copy"); alert(tmptextarea.innerHTML); + //alert('Success'); } var sort=0; function sortby(string) { @@ -1001,8 +1002,9 @@ xhr4.onload = function(e){ console.log(xhr4.responseText+','+xhr4.status); var filename; - if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name']; - if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.')); + //if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name']; + //if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.')); + filename = JSON.parse(xhr4.responseText)['name']; if (filename=='') { alert(''); uploadbuttonshow(); @@ -1011,8 +1013,9 @@ var lasturl = location.href; if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/'; lasturl += filename + '?preview'; - //alert(lasturl); - window.open(lasturl); + //window.open(lasturl); + document.getElementById('upfile_a_'+tdnum).href = lasturl; + document.getElementById('upfile_a1_'+tdnum).href = filename; } EndTime=new Date(); @@ -1022,7 +1025,7 @@ } else { MiddleStr += ':'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s
'; } - document.getElementById('upfile_td1_'+tdnum).innerHTML=''+filemd5+'
'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
'; + document.getElementById('upfile_td1_'+tdnum).innerHTML='
'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
'; label.innerHTML=StartStr+MiddleStr; uploadbuttonshow();