diff --git a/copyparty/u2idx.py b/copyparty/u2idx.py index 59f2a1dd..aa34c839 100644 --- a/copyparty/u2idx.py +++ b/copyparty/u2idx.py @@ -70,8 +70,8 @@ class U2idx(object): def run_query(self, vols, qstr, qv): qv = tuple(qv) - self.log("qs: " + qstr) - self.log("qv: " + repr(qv)) + # self.log("qs: " + qstr) + # self.log("qv: " + repr(qv)) ret = [] lim = 100 @@ -83,7 +83,7 @@ class U2idx(object): continue self.dbs[ptop] = db - self.log("idx /{} @ {} {}".format(vtop, ptop, flags)) + # self.log("idx /{} @ {} {}".format(vtop, ptop, flags)) c = db.execute(qstr, qv) for _, ts, sz, rd, fn in c: diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index dc20c2c5..f20c19c7 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -594,6 +594,7 @@ function autoplay_blocked() { ] ]; var html = []; + var orig_html = null; for (var a = 0; a < sconf.length; a++) { html.push('
' + sconf[a][0] + ''); for (var b = 1; b < 3; b++) { @@ -658,7 +659,7 @@ function autoplay_blocked() { ebi('path').style.display = 'none'; ebi('tree').style.display = 'none'; - var html = []; + var html = ['-close search results']; var res = JSON.parse(this.responseText); for (var a = 0; a < res.length; a++) { var r = res[a], @@ -676,9 +677,23 @@ function autoplay_blocked() { '' + ext + '' + unix2iso(ts) + ''); } + if (!orig_html) + orig_html = ebi('files').tBodies[0].innerHTML; + ofiles.tBodies[0].innerHTML = html.join('\n'); ofiles.setAttribute("ts", this.ts); reload_browser(); + + ebi('unsearch').onclick = unsearch; + } + + function unsearch(e) { + ev(e); + ebi('path').style.display = 'inline-block'; + ebi('tree').style.display = 'block'; + ebi('files').tBodies[0].innerHTML = orig_html; + orig_html = null; + reload_browser(); } })(); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 090df390..86dfa1c0 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -85,6 +85,11 @@ function sortTable(table, col) { th[col].className = 'sort' + reverse; var stype = th[col].getAttribute('sort'); tr = tr.sort(function (a, b) { + if (!a.cells[col]) + return -1; + if (!b.cells[col]) + return 1; + var v1 = a.cells[col].textContent.trim(); var v2 = b.cells[col].textContent.trim(); if (stype == 'int') {