mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
key notation normalization (why tho)
This commit is contained in:
parent
b9a4e47ea2
commit
de32838346
|
@ -579,3 +579,16 @@ input[type="checkbox"]:checked+label {
|
|||
color: #300;
|
||||
background: #fea;
|
||||
}
|
||||
#op_cfg {
|
||||
max-width: none;
|
||||
margin-right: 1.5em;
|
||||
}
|
||||
#key_notation>span {
|
||||
display: inline-block;
|
||||
padding: .2em .4em;
|
||||
}
|
||||
#op_cfg h3 {
|
||||
margin: .8em 0 0 .6em;
|
||||
padding: 0;
|
||||
border-bottom: 1px solid #555;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<a href="#" data-perm="write" data-dest="mkdir">📂</a>
|
||||
<a href="#" data-perm="write" data-dest="new_md">📝</a>
|
||||
<a href="#" data-perm="write" data-dest="msg">📟</a>
|
||||
<a href="#" data-dest="cfg">⚙️</a>
|
||||
</div>
|
||||
|
||||
<div id="op_search" class="opview">
|
||||
|
@ -33,8 +34,14 @@
|
|||
{%- endif %}
|
||||
<div id="srch_q"></div>
|
||||
</div>
|
||||
|
||||
{%- include 'upload.html' %}
|
||||
|
||||
<div id="op_cfg" class="opview opbox">
|
||||
<h3>key notation</h3>
|
||||
<div id="key_notation"></div>
|
||||
</div>
|
||||
|
||||
<h1 id="path">
|
||||
<a href="#" id="entree">🌲</a>
|
||||
{%- for n in vpnodes %}
|
||||
|
|
|
@ -945,6 +945,7 @@ function autoplay_blocked() {
|
|||
ebi('epi').innerHTML = res.logues ? res.logues[1] || "" : "";
|
||||
|
||||
filecols.set_style();
|
||||
mukey.render();
|
||||
reload_tree();
|
||||
reload_browser();
|
||||
}
|
||||
|
@ -1193,6 +1194,108 @@ var filecols = (function () {
|
|||
})();
|
||||
|
||||
|
||||
var mukey = (function () {
|
||||
var maps = {
|
||||
"rekobo_alnum": [
|
||||
"1B ", "2B ", "3B ", "4B ", "5B ", "6B ", "7B ", "8B ", "9B ", "10B", "11B", "12B",
|
||||
"1A ", "2A ", "3A ", "4A ", "5A ", "6A ", "7A ", "8A ", "9A ", "10A", "11A", "12A"
|
||||
],
|
||||
"rekobo_classic": [
|
||||
"B ", "F# ", "Db ", "Ab ", "Eb ", "Bb ", "F ", "C ", "G ", "D ", "A ", "E ",
|
||||
"Abm", "Ebm", "Bbm", "Fm ", "Cm ", "Gm ", "Dm ", "Am ", "Em ", "Bm ", "F#m", "Dbm"
|
||||
],
|
||||
"traktor_musical": [
|
||||
"B ", "Gb ", "Db ", "Ab ", "Eb ", "Bb ", "F ", "C ", "G ", "D ", "A ", "E ",
|
||||
"Abm", "Ebm", "Bbm", "Fm ", "Cm ", "Gm ", "Dm ", "Am ", "Em ", "Bm ", "Gbm", "Dbm"
|
||||
],
|
||||
"traktor_sharps": [
|
||||
"B ", "F# ", "C# ", "G# ", "D# ", "A# ", "F ", "C ", "G ", "D ", "A ", "E ",
|
||||
"G#m", "D#m", "A#m", "Fm ", "Cm ", "Gm ", "Dm ", "Am ", "Em ", "Bm ", "F#m", "C#m"
|
||||
],
|
||||
"traktor_open": [
|
||||
"6d ", "7d ", "8d ", "9d ", "10d", "11d", "12d", "1d ", "2d ", "3d ", "4d ", "5d ",
|
||||
"6m ", "7m ", "8m ", "9m ", "10m", "11m", "12m", "1m ", "2m ", "3m ", "4m ", "5m "
|
||||
]
|
||||
};
|
||||
var map = {};
|
||||
|
||||
var html = [];
|
||||
for (var k in maps) {
|
||||
if (!maps.hasOwnProperty(k))
|
||||
continue;
|
||||
|
||||
html.push(
|
||||
'<span><input type="radio" name="keytype" value="' + k + '" id="key_' + k + '">' +
|
||||
'<label for="key_' + k + '">' + k + '</label></span>');
|
||||
|
||||
for (var a = 0; a < 24; a++)
|
||||
maps[k][a] = maps[k][a].trim();
|
||||
}
|
||||
ebi('key_notation').innerHTML = html.join('\n');
|
||||
|
||||
function set_key_notation(e) {
|
||||
ev(e);
|
||||
var notation = this.getAttribute('value');
|
||||
load_notation(notation);
|
||||
render();
|
||||
}
|
||||
|
||||
function load_notation(notation) {
|
||||
swrite("key_notation", notation);
|
||||
map = {};
|
||||
var dst = maps[notation];
|
||||
for (var k in maps)
|
||||
if (k != notation && maps.hasOwnProperty(k))
|
||||
for (var a = 0; a < 24; a++)
|
||||
if (maps[k][a] != dst[a])
|
||||
map[maps[k][a]] = dst[a];
|
||||
}
|
||||
|
||||
function render() {
|
||||
var tds = ebi('files').tHead.getElementsByTagName('th');
|
||||
var i = -1;
|
||||
var min = false;
|
||||
for (var a = 0; a < tds.length; a++) {
|
||||
var spans = tds[a].getElementsByTagName('span');
|
||||
if (spans.length && spans[0].textContent == 'Key') {
|
||||
min = tds[a].getAttribute('class').indexOf('min') !== -1;
|
||||
i = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == -1)
|
||||
return;
|
||||
|
||||
var rows = ebi('files').tBodies[0].rows;
|
||||
|
||||
if (min)
|
||||
for (var a = 0, aa = rows.length; a < aa; a++) {
|
||||
var v = rows[a].cells[i].getAttribute('html');
|
||||
rows[a].cells[i].setAttribute('html', map[v] || v);
|
||||
}
|
||||
else
|
||||
for (var a = 0, aa = rows.length; a < aa; a++) {
|
||||
var v = rows[a].cells[i].textContent;
|
||||
rows[a].cells[i].textContent = map[v] || v;
|
||||
}
|
||||
}
|
||||
|
||||
var notation = sread("key_notation") || "rekobo_alnum";
|
||||
ebi('key_' + notation).checked = true;
|
||||
load_notation(notation);
|
||||
|
||||
var o = document.querySelectorAll('#key_notation input');
|
||||
for (var a = 0; a < o.length; a++) {
|
||||
o[a].onchange = set_key_notation;
|
||||
}
|
||||
|
||||
return {
|
||||
"render": render
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
function ev_row_tgl(e) {
|
||||
ev(e);
|
||||
filecols.toggle(this.parentElement.parentElement.getElementsByTagName('span')[0].textContent);
|
||||
|
@ -1238,3 +1341,4 @@ function reload_browser(not_mp) {
|
|||
up2k.set_fsearch();
|
||||
}
|
||||
reload_browser(true);
|
||||
mukey.render();
|
||||
|
|
|
@ -23,6 +23,7 @@ function esc(txt) {
|
|||
}
|
||||
function vis_exh(msg, url, lineNo, columnNo, error) {
|
||||
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>',
|
||||
esc(String(msg)), '</p><p>', esc(url + ' @' + lineNo + ':' + columnNo), '</p>'];
|
||||
|
||||
|
|
|
@ -11,6 +11,13 @@ gzip -d < .hist/up2k.snap | jq -r '.[].tnam' | while IFS= read -r f; do rm -f --
|
|||
gzip -d < .hist/up2k.snap | jq -r '.[].name' | while IFS= read -r f; do wc -c -- "$f" | grep -qiE '^[^0-9a-z]*0' && rm -f -- "$f"; done
|
||||
|
||||
|
||||
##
|
||||
## detect partial uploads based on file contents
|
||||
## (in case of context loss or old copyparties)
|
||||
|
||||
echo; find -type f | while IFS= read -r x; do printf '\033[A\033[36m%s\033[K\033[0m\n' "$x"; tail -c$((1024*1024)) <"$x" | xxd -a | awk 'NR==1&&/^[0: ]+.{16}$/{next} NR==2&&/^\*$/{next} NR==3&&/^[0f]+: [0 ]+65 +.{16}$/{next} {e=1} END {exit e}' || continue; printf '\033[A\033[31msus:\033[33m %s \033[0m\n\n' "$x"; done
|
||||
|
||||
|
||||
##
|
||||
## create a test payload
|
||||
|
||||
|
|
Loading…
Reference in a new issue