mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
make search rate-control less visually confusing
This commit is contained in:
parent
8b4b7fa794
commit
7e606cdd9f
|
@ -614,8 +614,6 @@ in the `scripts` folder:
|
|||
|
||||
roughly sorted by priority
|
||||
|
||||
* ctrl-click overrides onclick (tree, ...)
|
||||
* indicate dropped queries in search ui
|
||||
* readme.md as epilogue
|
||||
* reduce up2k roundtrips
|
||||
* start from a chunk index and just go
|
||||
|
|
|
@ -607,7 +607,7 @@ input.eq_gain {
|
|||
#srch_q {
|
||||
white-space: pre;
|
||||
color: #f80;
|
||||
height: 1em;
|
||||
min-height: 1em;
|
||||
margin: .2em 0 -1em 1.6em;
|
||||
}
|
||||
#tq_raw {
|
||||
|
|
|
@ -1879,6 +1879,7 @@ document.onkeydown = function (e) {
|
|||
}
|
||||
|
||||
var search_timeout,
|
||||
defer_timeout,
|
||||
search_in_progress = 0;
|
||||
|
||||
function ev_search_input() {
|
||||
|
@ -1893,9 +1894,29 @@ document.onkeydown = function (e) {
|
|||
if (id != "q_raw")
|
||||
encode_query();
|
||||
|
||||
clearTimeout(search_timeout);
|
||||
if (Date.now() - search_in_progress > 30 * 1000)
|
||||
set_vq();
|
||||
|
||||
clearTimeout(defer_timeout);
|
||||
defer_timeout = setTimeout(try_search, 2000);
|
||||
try_search();
|
||||
}
|
||||
|
||||
function try_search() {
|
||||
if (Date.now() - search_in_progress > 30 * 1000) {
|
||||
clearTimeout(defer_timeout);
|
||||
clearTimeout(search_timeout);
|
||||
search_timeout = setTimeout(do_search, 200);
|
||||
}
|
||||
}
|
||||
|
||||
function set_vq() {
|
||||
if (search_in_progress)
|
||||
return;
|
||||
|
||||
var q = ebi('q_raw').value,
|
||||
vq = ebi('files').getAttribute('q_raw');
|
||||
|
||||
srch_msg(false, (q == vq) ? '' : 'search results below are from a previous query:\n ' + (vq ? vq : '(*)'));
|
||||
}
|
||||
|
||||
function encode_query() {
|
||||
|
@ -1965,7 +1986,8 @@ document.onkeydown = function (e) {
|
|||
xhr.setRequestHeader('Content-Type', 'text/plain');
|
||||
xhr.onreadystatechange = xhr_search_results;
|
||||
xhr.ts = Date.now();
|
||||
xhr.send(JSON.stringify({ "q": ebi('q_raw').value }));
|
||||
xhr.q_raw = ebi('q_raw').value;
|
||||
xhr.send(JSON.stringify({ "q": xhr.q_raw }));
|
||||
}
|
||||
|
||||
function xhr_search_results() {
|
||||
|
@ -2036,6 +2058,8 @@ document.onkeydown = function (e) {
|
|||
|
||||
ofiles.innerHTML = html.join('\n');
|
||||
ofiles.setAttribute("ts", this.ts);
|
||||
ofiles.setAttribute("q_raw", this.q_raw);
|
||||
set_vq();
|
||||
mukey.render();
|
||||
reload_browser();
|
||||
filecols.set_style(['File Name']);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
window.onerror = vis_exh;
|
||||
|
||||
|
||||
function goto_up2k() {
|
||||
if (up2k === false)
|
||||
|
@ -32,7 +30,7 @@ catch (ex) {
|
|||
}
|
||||
catch (ex) { }
|
||||
}
|
||||
window['treectl'].onscroll(); // uhh
|
||||
treectl.onscroll();
|
||||
|
||||
|
||||
function up2k_flagbus() {
|
||||
|
|
|
@ -32,6 +32,9 @@ function esc(txt) {
|
|||
});
|
||||
}
|
||||
function vis_exh(msg, url, lineNo, columnNo, error) {
|
||||
if (!window.onerror)
|
||||
return;
|
||||
|
||||
window.onerror = undefined;
|
||||
window['vis_exh'] = null;
|
||||
var html = ['<h1>you hit a bug!</h1><p>please screenshot this error and send me a copy arigathanks gozaimuch (ed/irc.rizon.net or ed#2644)</p><p>',
|
||||
|
|
Loading…
Reference in a new issue