Update onemoe.html
parent
f8bc8f5ee8
commit
34829639f8
|
@ -25,23 +25,9 @@
|
|||
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kizx/onemoe-theme/onemoe.min.css" type="text/css" />
|
||||
<!--BackgroundStart-->
|
||||
<style>
|
||||
body {
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-attachment: fixed;
|
||||
background-position-x: center;
|
||||
background-image: url("<!--BackgroundUrl-->");
|
||||
}
|
||||
</style>
|
||||
<style>body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-position-x:center;background-image:url("<!--BackgroundUrl-->")}</style>
|
||||
<!--BackgroundEnd-->
|
||||
<script type="text/javascript">
|
||||
if (window.console && window.console.log) {
|
||||
console.log("%c Onemoe Theme %c https://github.com/kizx/onemoe-theme ",
|
||||
"color: #fff; margin: 1em 0; padding: 5px 0; background: #673ab7;",
|
||||
"margin: 1em 0; padding: 5px 0; background: #efefef;");
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">if(window.console&&window.console.log){console.log("%c Onemoe Theme %c https://github.com/kizx/onemoe-theme ","color: #fff; margin: 1em 0; padding: 5px 0; background: #673ab7;","margin: 1em 0; padding: 5px 0; background: #efefef;")}</script>
|
||||
<!--customCss-->
|
||||
</head>
|
||||
|
||||
|
@ -123,7 +109,7 @@
|
|||
<ion-icon name="arrow-back"></ion-icon>
|
||||
</a>
|
||||
<!--BackArrowEnd-->
|
||||
<h3 class="table-header"><!--Path--></h3>
|
||||
<h3 class="table-header"><!--PathArrayStart--> / <a href="<!--PathArrayLink-->"><!--PathArrayName--></a><!--PathArrayEnd--></h3>
|
||||
</div>
|
||||
<div class="list-body-container">
|
||||
<!--EncryptedStart-->
|
||||
|
@ -448,11 +434,14 @@
|
|||
function changelanguage(str)
|
||||
{
|
||||
if (str=='Language') str = '';
|
||||
document.cookie='language='+str+'; path=/';
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie='language='+str+'; path=/; '+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
<!--ListStart-->
|
||||
var root = '<!--base_disk_path-->';
|
||||
/*var root = '<!--base_disk_path-->';
|
||||
function path_format(path) {
|
||||
path = '/' + path + '/';
|
||||
while (path.indexOf('//') !== -1) {
|
||||
|
@ -472,7 +461,7 @@
|
|||
}
|
||||
e.innerHTML += paths[paths.length - 1];
|
||||
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
|
||||
});
|
||||
});*/
|
||||
<!--IsFileStart-->
|
||||
var $url = document.getElementById('url');
|
||||
if ($url) {
|
||||
|
@ -793,20 +782,55 @@
|
|||
tr1.setAttribute('data-to',1);
|
||||
var td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%');
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
var td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
strarry=str.split('.');
|
||||
ext=strarry[strarry.length-1].toLowerCase();
|
||||
var reg = new RegExp(".","g");
|
||||
var a = str.replace(reg,"");
|
||||
if (a == ext) ext = "";
|
||||
else ext = "." + ext;
|
||||
return ext;
|
||||
}
|
||||
var ext = getext(file.webkitRelativePath||file.name);
|
||||
var spark = new SparkMD5.ArrayBuffer();
|
||||
var reader = new FileReader();
|
||||
var chunksize=10*1024*1024;
|
||||
var asize = 0;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
td2.innerHTML='<!--constStr@Calculate--> md5: '+(asize*100/file.size).toFixed(2)+'%';
|
||||
var binary = this.result;
|
||||
spark.append(binary);
|
||||
asize += chunksize;
|
||||
if (asize < file.size) {
|
||||
readblob(asize);
|
||||
} else {
|
||||
var filemd5 = spark.end();
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
upbigfilename = filemd5+ext;
|
||||
<!--GuestEnd-->
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ encodeURIComponent((file.webkitRelativePath||file.name)) +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.send(null);
|
||||
xhr1.onload = function(e){
|
||||
|
@ -819,14 +843,23 @@
|
|||
uploadbuttonshow();
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i);
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
|
||||
}
|
||||
}
|
||||
if (xhr1.status==409) {
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
tdnum = timea+'_'+i;
|
||||
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}
|
||||
}
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
<!--GuestEnd-->
|
||||
}
|
||||
}
|
||||
function size_format(num) {
|
||||
|
@ -847,7 +880,7 @@
|
|||
}
|
||||
return num.toFixed(2) + ' GB';
|
||||
}
|
||||
function binupfile(file,url,tdnum){
|
||||
function binupfile(file,url,tdnum,filename){
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
var StartStr='';
|
||||
|
@ -868,9 +901,7 @@
|
|||
var a = html['nextExpectedRanges'][0];
|
||||
newstartsize = Number( a.slice(0,a.indexOf("-")) );
|
||||
StartTime = new Date();
|
||||
<!--AdminStart-->
|
||||
asize = newstartsize;
|
||||
<!--AdminEnd-->
|
||||
if (newstartsize==0) {
|
||||
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
} else {
|
||||
|
@ -884,19 +915,9 @@
|
|||
reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
readblob(asize);
|
||||
<!--GuestStart-->
|
||||
var spark = new SparkMD5.ArrayBuffer();
|
||||
<!--GuestEnd-->
|
||||
|
||||
reader.onload = function(e){
|
||||
var binary = this.result;
|
||||
<!--GuestStart-->
|
||||
spark.append(binary);
|
||||
if (asize < newstartsize) {
|
||||
asize += chunksize;
|
||||
readblob(asize);
|
||||
return;
|
||||
}
|
||||
<!--GuestEnd-->
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", url, true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
|
@ -917,38 +938,12 @@
|
|||
if (response['size']>0) {
|
||||
// contain size, upload finish. 有size说明是最终返回,上传结束
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+encodeURIComponent((file.webkitRelativePath||file.name)));
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
<!--GuestStart-->
|
||||
var filemd5 = spark.end();
|
||||
var xhr4 = new XMLHttpRequest();
|
||||
xhr4.open("GET", '?action=uploaded_rename&filename='+encodeURIComponent((file.webkitRelativePath||file.name))+'&filemd5='+filemd5);
|
||||
xhr4.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr4.send(null);
|
||||
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.webkitRelativePath||file.name).substr((file.webkitRelativePath||file.name).indexOf('.'));
|
||||
filename = JSON.parse(xhr4.responseText)['name'];
|
||||
if (filename=='') {
|
||||
alert('<!--constStr@UploadErrorUpAgain-->');
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
var lasturl = location.href;
|
||||
if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/';
|
||||
lasturl += filename + '?preview';
|
||||
//window.open(lasturl);
|
||||
document.getElementById('upfile_a_'+tdnum).href = lasturl;
|
||||
document.getElementById('upfile_a1_'+tdnum).href = filename;
|
||||
document.getElementById('upfile_cpbt_'+tdnum).style.display = "";
|
||||
}
|
||||
<!--GuestEnd-->
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
|
@ -976,7 +971,7 @@
|
|||
xhr.send(binary);
|
||||
}
|
||||
} else {
|
||||
if (window.location.pathname.indexOf('%23')>0||(file.webkitRelativePath||file.name).indexOf('%23')>0) {
|
||||
if (window.location.pathname.indexOf('%23')>0||filename.indexOf('%23')>0) {
|
||||
label.innerHTML='<font color="red"><!--constStr@UploadFail23--></font>';
|
||||
} else {
|
||||
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';
|
||||
|
|
Loading…
Reference in New Issue