mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
add tooltip indicator
This commit is contained in:
parent
2c7ffe08d7
commit
e4ae5f74e6
|
@ -1,7 +1,5 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.onerror = vis_exh;
|
|
||||||
|
|
||||||
function dbg(msg) {
|
function dbg(msg) {
|
||||||
ebi('path').innerHTML = msg;
|
ebi('path').innerHTML = msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,18 @@ html {
|
||||||
#toast.err #toastc {
|
#toast.err #toastc {
|
||||||
background: #d06;
|
background: #d06;
|
||||||
}
|
}
|
||||||
|
#tth {
|
||||||
|
color: #fff;
|
||||||
|
background: #111;
|
||||||
|
font-size: .9em;
|
||||||
|
padding: 0 .3em;
|
||||||
|
border-radius: 1em;
|
||||||
|
position: absolute;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#tth.act {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
#tt.b {
|
#tt.b {
|
||||||
padding: 0 2em;
|
padding: 0 2em;
|
||||||
border-radius: .5em;
|
border-radius: .5em;
|
||||||
|
@ -159,6 +171,10 @@ html.light #tt code {
|
||||||
html.light #tt em {
|
html.light #tt em {
|
||||||
color: #d38;
|
color: #d38;
|
||||||
}
|
}
|
||||||
|
html.light #tth {
|
||||||
|
color: #000;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
#modal {
|
#modal {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
|
@ -180,6 +180,7 @@ function ignex(all) {
|
||||||
if (!all)
|
if (!all)
|
||||||
window.onerror = vis_exh;
|
window.onerror = vis_exh;
|
||||||
}
|
}
|
||||||
|
window.onerror = vis_exh;
|
||||||
|
|
||||||
|
|
||||||
function noop() { }
|
function noop() { }
|
||||||
|
@ -791,14 +792,18 @@ var timer = (function () {
|
||||||
var tt = (function () {
|
var tt = (function () {
|
||||||
var r = {
|
var r = {
|
||||||
"tt": mknod("div"),
|
"tt": mknod("div"),
|
||||||
|
"th": mknod("div"),
|
||||||
"en": true,
|
"en": true,
|
||||||
"el": null,
|
"el": null,
|
||||||
"skip": false,
|
"skip": false,
|
||||||
"lvis": 0
|
"lvis": 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
r.th.innerHTML = '?';
|
||||||
r.tt.setAttribute('id', 'tt');
|
r.tt.setAttribute('id', 'tt');
|
||||||
|
r.th.setAttribute('id', 'tth');
|
||||||
document.body.appendChild(r.tt);
|
document.body.appendChild(r.tt);
|
||||||
|
document.body.appendChild(r.th);
|
||||||
|
|
||||||
var prev = null;
|
var prev = null;
|
||||||
r.cshow = function () {
|
r.cshow = function () {
|
||||||
|
@ -809,12 +814,32 @@ var tt = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var tev;
|
var tev;
|
||||||
r.dshow = function () {
|
r.dshow = function (e) {
|
||||||
clearTimeout(tev);
|
clearTimeout(tev);
|
||||||
|
if (!r.getmsg(this))
|
||||||
|
return;
|
||||||
|
|
||||||
if (Date.now() - r.lvis < 400)
|
if (Date.now() - r.lvis < 400)
|
||||||
return r.show.bind(this)();
|
return r.show.bind(this)();
|
||||||
|
|
||||||
tev = setTimeout(r.show.bind(this), 700);
|
tev = setTimeout(r.show.bind(this), 800);
|
||||||
|
if (is_touch)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.addEventListener('mousemove', r.move);
|
||||||
|
clmod(r.th, 'act', 1);
|
||||||
|
r.move(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
r.getmsg = function (el) {
|
||||||
|
if (QS('body.bbox-open'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var cfg = sread('tooltips');
|
||||||
|
if (cfg !== null && cfg != '1')
|
||||||
|
return;
|
||||||
|
|
||||||
|
return el.getAttribute('tt');
|
||||||
};
|
};
|
||||||
|
|
||||||
r.show = function () {
|
r.show = function () {
|
||||||
|
@ -823,14 +848,7 @@ var tt = (function () {
|
||||||
r.skip = false;
|
r.skip = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (QS('body.bbox-open'))
|
var msg = r.getmsg(this);
|
||||||
return;
|
|
||||||
|
|
||||||
var cfg = sread('tooltips');
|
|
||||||
if (cfg !== null && cfg != '1')
|
|
||||||
return;
|
|
||||||
|
|
||||||
var msg = this.getAttribute('tt');
|
|
||||||
if (!msg)
|
if (!msg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -844,6 +862,7 @@ var tt = (function () {
|
||||||
if (dir.indexOf('u') + 1) top = false;
|
if (dir.indexOf('u') + 1) top = false;
|
||||||
if (dir.indexOf('d') + 1) top = true;
|
if (dir.indexOf('d') + 1) top = true;
|
||||||
|
|
||||||
|
clmod(r.th, 'act');
|
||||||
clmod(r.tt, 'b', big);
|
clmod(r.tt, 'b', big);
|
||||||
r.tt.style.left = '0';
|
r.tt.style.left = '0';
|
||||||
r.tt.style.top = '0';
|
r.tt.style.top = '0';
|
||||||
|
@ -873,11 +892,20 @@ var tt = (function () {
|
||||||
window.removeEventListener('scroll', r.hide);
|
window.removeEventListener('scroll', r.hide);
|
||||||
|
|
||||||
clmod(r.tt, 'b');
|
clmod(r.tt, 'b');
|
||||||
|
clmod(r.th, 'act');
|
||||||
if (clmod(r.tt, 'show'))
|
if (clmod(r.tt, 'show'))
|
||||||
r.lvis = Date.now();
|
r.lvis = Date.now();
|
||||||
|
|
||||||
if (r.el)
|
if (r.el)
|
||||||
r.el.removeEventListener('mouseleave', r.hide);
|
r.el.removeEventListener('mouseleave', r.hide);
|
||||||
|
|
||||||
|
if (e && e.target)
|
||||||
|
e.target.removeEventListener('mousemove', r.move);
|
||||||
|
};
|
||||||
|
|
||||||
|
r.move = function (e) {
|
||||||
|
r.th.style.left = (e.pageX + 12) + 'px';
|
||||||
|
r.th.style.top = (e.pageY + 12) + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
if (IPHONE) {
|
if (IPHONE) {
|
||||||
|
|
Loading…
Reference in a new issue