From 02745e7742b7c7e9701c93de2713b5bb15d7afea Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Sun, 16 Aug 2020 17:24:15 +0800
Subject: [PATCH] Update onemoe.html
---
theme/onemoe.html | 76 +++++++++++++++++++++++++++++++----------------
1 file changed, 50 insertions(+), 26 deletions(-)
diff --git a/theme/onemoe.html b/theme/onemoe.html
index 431b2cc..88f54c0 100644
--- a/theme/onemoe.html
+++ b/theme/onemoe.html
@@ -24,9 +24,9 @@
-
+
-
+
@@ -148,7 +148,7 @@
-
+ Loading PDF
@@ -548,10 +548,16 @@
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
- var loadingTask = pdfjsLib.getDocument({ url: '', });
+ var loadingTask = pdfjsLib.getDocument({
+ url: '',
+ cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
+ cMapPacked: true,
+ rangeChunkSize: 65535
+ });
loadingTask.promise.then(function(pdf) {
var pagenum = pdf.numPages;
var pdfContainer = document.getElementById('pdf-d');
+ pdfContainer.innerHTML = '';
for (var i=1;i<=pagenum;i++) {
var canvasNew = document.createElement('canvas');
canvasNew.id = 'pdf-c'+i;
@@ -775,19 +781,26 @@
var timea=new Date().getTime();
var i=0;
getuplink(i);
- function getuplink(i) {
+ function getuplink(i, r=0) {
var file=files[i];
- var tr1=document.createElement('tr');
- table1.appendChild(tr1);
- tr1.setAttribute('data-to',1);
- var td1=document.createElement('td');
- tr1.appendChild(td1);
- td1.setAttribute('style','width:30%;word-break:break-word;');
- td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
- td1.innerHTML=(file.webkitRelativePath||file.name)+'
'+size_format(file.size);
- var td2=document.createElement('td');
- tr1.appendChild(td2);
- td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
+ var td1;
+ var td2;
+ if (r==0) {
+ var tr1=document.createElement('tr');
+ table1.appendChild(tr1);
+ tr1.setAttribute('data-to',1);
+ td1=document.createElement('td');
+ tr1.appendChild(td1);
+ td1.setAttribute('style','width:30%;word-break:break-word;');
+ td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
+ td1.innerHTML=(file.webkitRelativePath||file.name)+'
'+size_format(file.size);
+ td2=document.createElement('td');
+ tr1.appendChild(td2);
+ td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
+ }
+ var tdnum = timea+'_'+i;
+ td1=document.getElementById('upfile_td1_'+tdnum);
+ td2=document.getElementById('upfile_td2_'+tdnum);
if (file.size>100*1024*1024*1024) {
td2.innerHTML='';
uploadbuttonshow();
@@ -832,35 +845,46 @@
var xhr1 = new XMLHttpRequest();
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
- xhr1.send(null);
+ xhr1.onprogress = function(e){
+ td2.innerHTML+='.';
+ }
xhr1.onload = function(e){
+ console.log(xhr1.status+xhr1.responseText);
td2.innerHTML=''+xhr1.responseText+'';
+ if (xhr1.status==409) {
+ // td2.innerHTML='nameAlreadyExists';
+ var html=JSON.parse(xhr1.responseText);
+ td2.innerHTML=html['error']['code']+': '+html['error']['message'];
+
+ td2.innerHTML='md5: '+filemd5;
+
+ td1.innerHTML='';
+ }
if (xhr1.status==200) {
- console.log(xhr1.responseText);
+ if (xhr1.responseText=='') {
+ getuplink(i,1);
+ return;
+ }
var html=JSON.parse(xhr1.responseText);
if (!html['uploadUrl']) {
td2.innerHTML=''+xhr1.responseText+'
';
- uploadbuttonshow();
} else {
td2.innerHTML=' ...';
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
}
}
- if (xhr1.status==409) {
- td2.innerHTML='md5: '+filemd5;
- tdnum = timea+'_'+i;
- document.getElementById('upfile_td1_'+tdnum).innerHTML='';
- }
if (i
}
}
}
+ uploadbuttonshow();
}
function size_format(num) {
if (num>1024) {
@@ -953,7 +977,7 @@
}
document.getElementById('upfile_td1_'+tdnum).innerHTML='';
label.innerHTML=StartStr+MiddleStr;
- uploadbuttonshow();
+ // uploadbuttonshow();
response.name=file.webkitRelativePath||response.name;
addelement(response);
@@ -976,7 +1000,7 @@
} else {
label.innerHTML=''+xhr2.responseText+'';
}
- uploadbuttonshow();
+ // uploadbuttonshow();
}
}
}