mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
performance / cosmetic:
* js: use .call instead of .bind when possible * when running without e2d, the message on startup regarding unfinished uploads didn't show the correct filesystem path
This commit is contained in:
parent
0a48acf6be
commit
015b87ee99
|
@ -791,9 +791,9 @@ class Up2k(object):
|
|||
|
||||
reg = {}
|
||||
drp = None
|
||||
path = os.path.join(histpath, "up2k.snap")
|
||||
if bos.path.exists(path):
|
||||
with gzip.GzipFile(path, "rb") as f:
|
||||
snap = os.path.join(histpath, "up2k.snap")
|
||||
if bos.path.exists(snap):
|
||||
with gzip.GzipFile(snap, "rb") as f:
|
||||
j = f.read().decode("utf-8")
|
||||
|
||||
reg2 = json.loads(j)
|
||||
|
@ -804,20 +804,20 @@ class Up2k(object):
|
|||
pass
|
||||
|
||||
for k, job in reg2.items():
|
||||
path = djoin(job["ptop"], job["prel"], job["name"])
|
||||
if bos.path.exists(path):
|
||||
fp = djoin(job["ptop"], job["prel"], job["name"])
|
||||
if bos.path.exists(fp):
|
||||
reg[k] = job
|
||||
job["poke"] = time.time()
|
||||
job["busy"] = {}
|
||||
else:
|
||||
self.log("ign deleted file in snap: [{}]".format(path))
|
||||
self.log("ign deleted file in snap: [{}]".format(fp))
|
||||
|
||||
if drp is None:
|
||||
drp = [k for k, v in reg.items() if not v.get("need", [])]
|
||||
else:
|
||||
drp = [x for x in drp if x in reg]
|
||||
|
||||
t = "loaded snap {} |{}| ({})".format(path, len(reg.keys()), len(drp or []))
|
||||
t = "loaded snap {} |{}| ({})".format(snap, len(reg.keys()), len(drp or []))
|
||||
ta = [t] + self._vis_reg_progress(reg)
|
||||
self.log("\n".join(ta))
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ window.baguetteBox = (function () {
|
|||
options = {};
|
||||
setOptions(o);
|
||||
if (tt.en)
|
||||
tt.show.bind(this)();
|
||||
tt.show.call(this);
|
||||
}
|
||||
|
||||
function setVmode() {
|
||||
|
@ -356,7 +356,7 @@ window.baguetteBox = (function () {
|
|||
|
||||
setVmode();
|
||||
if (tt.en)
|
||||
tt.show.bind(this)();
|
||||
tt.show.call(this);
|
||||
}
|
||||
|
||||
function findfile() {
|
||||
|
|
|
@ -4310,14 +4310,14 @@ var thegrid = (function () {
|
|||
if (ctrl(e) && !treectl.csel && !r.sel)
|
||||
return true;
|
||||
|
||||
return gclick.bind(this)(e, false);
|
||||
return gclick.call(this, e, false);
|
||||
}
|
||||
|
||||
function gclick2(e) {
|
||||
if (ctrl(e) || !r.sel)
|
||||
return true;
|
||||
|
||||
return gclick.bind(this)(e, true);
|
||||
return gclick.call(this, e, true);
|
||||
}
|
||||
|
||||
function gclick(e, dbl) {
|
||||
|
@ -4332,7 +4332,7 @@ var thegrid = (function () {
|
|||
tr = td.parentNode;
|
||||
|
||||
if ((r.sel && !dbl && !ctrl(e)) || (treectl.csel && (e.shiftKey || ctrl(e)))) {
|
||||
td.onclick.bind(td)(e);
|
||||
td.onclick.call(td, e);
|
||||
if (e.shiftKey)
|
||||
return r.loadsel();
|
||||
clmod(this, 'sel', clgot(tr, 'sel'));
|
||||
|
|
|
@ -971,7 +971,7 @@ function up2k_init(subtle) {
|
|||
if (++nenters <= 0)
|
||||
nenters = 1;
|
||||
|
||||
if (onover.bind(this)(e))
|
||||
if (onover.call(this, e))
|
||||
return true;
|
||||
|
||||
var mup, up = QS('#up_zd');
|
||||
|
@ -995,7 +995,7 @@ function up2k_init(subtle) {
|
|||
function onoverb(e) {
|
||||
// zones are alive; disable cuo2duo branch
|
||||
document.body.ondragover = document.body.ondrop = null;
|
||||
return onover.bind(this)(e);
|
||||
return onover.call(this, e);
|
||||
}
|
||||
function onover(e) {
|
||||
return onovercmn(this, e, false);
|
||||
|
@ -1106,7 +1106,7 @@ function up2k_init(subtle) {
|
|||
function gotfile(e) {
|
||||
ev(e);
|
||||
nenters = 0;
|
||||
offdrag.bind(this)();
|
||||
offdrag.call(this);
|
||||
var dz = this && this.getAttribute('id');
|
||||
if (!dz && e && e.clientY)
|
||||
// cuo2duo fallback
|
||||
|
|
|
@ -1165,7 +1165,7 @@ var tt = (function () {
|
|||
var prev = null;
|
||||
r.cshow = function () {
|
||||
if (this !== prev)
|
||||
r.show.bind(this)();
|
||||
r.show.call(this);
|
||||
|
||||
prev = this;
|
||||
};
|
||||
|
@ -1177,7 +1177,7 @@ var tt = (function () {
|
|||
return;
|
||||
|
||||
if (Date.now() - r.lvis < 400)
|
||||
return r.show.bind(this)();
|
||||
return r.show.call(this);
|
||||
|
||||
tev = setTimeout(r.show.bind(this), 800);
|
||||
if (TOUCH)
|
||||
|
|
Loading…
Reference in a new issue