From 0271dc5b9fe230f61f5808ecb73768e2cc167f58 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 17 Feb 2022 18:08:37 +0800 Subject: [PATCH] load sha1.js from program when login --- theme/classic.html | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/theme/classic.html b/theme/classic.html index d22dd42..01efeff 100644 --- a/theme/classic.html +++ b/theme/classic.html @@ -519,11 +519,39 @@ f.password1.value = sha1(timestamp + "" + f.password1.value); return true; } catch { - alert("sha1.js not loaded."); + //alert("sha1.js not loaded."); + if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js"); return false; } } + function loadjs(url) { + var xhr = new XMLHttpRequest; + xhr.open("GET", url); + xhr.onload = function(e) { + if (xhr.status==200) { + var script = document.createElement("script"); + script.type = "text/javascript"; + script.text = xhr.responseText; + document.body.appendChild(script); + } else { + console.log(xhr.response); + } + } + xhr.send(null); + } + + var nowtime= new Date(); + var timezone = 0-nowtime.getTimezoneOffset()/60; + var expd = new Date(); + expd.setTime(expd.getTime()+(2*60*60*1000)); + var expires = "expires="+expd.toGMTString(); + document.cookie="timezone="+timezone+"; path=/; "+expires; + if (timezone!=) { + //alert('Your timezone is '+timezone+', reload local timezone.'); + location.href=location.href; + } + var $head = document.getElementById('head'); if ($head) { @@ -792,19 +820,6 @@ return num; } - - - var nowtime= new Date(); - var timezone = 0-nowtime.getTimezoneOffset()/60; - var expd = new Date(); - expd.setTime(expd.getTime()+(2*60*60*1000)); - var expires = "expires="+expd.toGMTString(); - document.cookie="timezone="+timezone+"; path=/; "+expires; - if (timezone!=) { - alert('Your timezone is '+timezone+', reload local timezone.'); - location.href=location.href; - } - function CopyAllDownloadUrl(str) { var tmptextarea=document.createElement('textarea'); document.body.appendChild(tmptextarea); @@ -817,6 +832,7 @@ document.execCommand("copy"); alert(tmptextarea.innerHTML+""); } + function size_format(num) { if (num>1024) {