diff --git a/copyparty/__init__.py b/copyparty/__init__.py index 8bffed86..f4e8f877 100644 --- a/copyparty/__init__.py +++ b/copyparty/__init__.py @@ -80,6 +80,7 @@ web/deps/marked.js web/deps/fuse.py web/deps/mini-fa.css web/deps/mini-fa.woff +web/deps/orbitron.woff2 web/deps/prism.css web/deps/prism.js web/deps/prismd.css diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index b1f12792..570338d9 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -303,7 +303,7 @@ window.baguetteBox = (function () { if (!overlay) { var ctr = mknod('div'); ctr.innerHTML = ( - ' + @@ -199,7 +201,7 @@
- ⚙️ + ⚙️ @@ -302,8 +304,8 @@ {%- endif %} - - + {%- if js %} {%- endif %} @@ -311,8 +313,8 @@ Date.now(); function jsldp(a, b) { 2 != window[a] && alert("FATAL ERROR: cannot load " + b + ".js due to unreliable network or broken reverse-proxy; try CTRL-SHIFT-R") } jsldp("J_UTL", "util"); jsldp("J_BRW", "browser"); - jsldp("J_BBX", "baguettebox"); - jsldp("J_U2K", "up2k"); + // jsldp("J_BBX", "baguettebox"); + // jsldp("J_U2K", "up2k"); diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 0f95584e..18d6809c 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2,6 +2,38 @@ var J_BRW = 1; + +// start DL of secondary JS +// based on https://stackoverflow.com/questions/4845762/onload-handler-for-script-tag-in-internet-explorer +function loadScript(name, id) { + var head = (document.getElementsByTagName("head")[0] || document.head) + var s = document.createElement('script'); + s.src = window.SR + '/.cpr/w/' + name + '.js?_=' + window.TS; + var done = false; + s.onload = s.onreadystatechange = function() { + if (!done && (!this.readyState || + this.readyState === "loaded" || this.readyState === "complete") ) { + done = true; + + jsldp(id, name); + + // Handle memory leak in IE + s.onload = s.onreadystatechange = null; + if ( head && s.parentNode ) { + head.removeChild(s); + } + } + }; + head.appendChild(s); +} +// re-define this function to ensure it's available when needed +function jsldp(a, b) { + 2 != window[a] && alert("FATAL ERROR: cannot load " + b + ".js due to unreliable network or broken reverse-proxy; try CTRL-SHIFT-R") +} +loadScript('baguettebox', "J_BBX"); +loadScript('up2k', "J_U2K"); + + // disables emojis var fun_tgl = sread('fun_tgl'); if( fun_tgl == null) @@ -1105,6 +1137,16 @@ ebi('up_outside').onclick = modaltoggle('up2k', false); } +var up2k_lgcy = false; +ebi('reloc_up').onclick = function(){ + up2k_lgcy = !up2k_lgcy; + this.innerHTML = up2k_lgcy ? '' : ''; + clmod(ebi('up2k'), 'unmodal', up2k_lgcy); + swrite('up2k_lgcy', up2k_lgcy); +} +if(sread('up2k_lgcy') == 'true') + ebi('reloc_up').click(); + ebi('wrap').insertBefore(mknod('div', 'lazy'), ebi('epi')); var x = ebi('bbsw'); @@ -1144,7 +1186,7 @@ ebi('h_bup').onclick = function() { var musicSettings = ( '

🎵 ' + L.ot_mp + '

' + - '

✅ ' + L.cl_opts + '

' + + '

🎧 ' + L.cl_opts + '

' + '🔂' + '' + (isdir || ext == 'unk' || ext.startsWith('/') ? '' : - '' + ext + '') + - '' + ext + '') + + '
' + ao.innerHTML + ''); } ggrid.innerHTML = html.join('\n'); @@ -8714,6 +8768,10 @@ var treectl = (function () { vbar.onresize(); showfile.addlinks(); drag.initfiles(); + + var media = scan_hash(location.hash); + if(media && media[0] == 'g') + clmod(ebi('ggrid'), 'waiting', true); setTimeout(eval_hash, 1); }; @@ -9069,8 +9127,9 @@ function apply_perms(res) { ebi('u2rand').parentNode.style.display = 'none'; u2ts = res.u2ts; - if (up2k) - up2k.set_fsearch(); + + if(up2k) + wait_set_fsearch(); if (res.cfg) rw_edit = res.rw_edit; @@ -9085,10 +9144,24 @@ function apply_perms(res) { goto('up2k'); clmod(document.documentElement, 'noscroll', false); } - clmod(ebi('up2k'), 'unmodal', up_only); + if(up_only && !up2k_lgcy){ + up2k_lgcy = !up2k_lgcy; + ebi('reloc_up').innerHTML = up2k_lgcy ? '' : ''; + clmod(ebi('up2k'), 'unmodal', up2k_lgcy); + } clmod(ebi('opa_mkd'), 'vis', up_only); } +function wait_set_fsearch(){ + var t = setInterval(function () { + if (!up2k || !up2k.set_fsearch) + return; + + clearInterval(t); + up2k.set_fsearch(); + }, 50); +} + function tr2id(tr) { try { @@ -11046,8 +11119,8 @@ function reload_browser() { for (var a = 0; a < ns.length; a++) clmod(ebi(ns[a]), 'hidden', ebi('unsearch')); - if (up2k) - up2k.set_fsearch(); + if(up2k) + wait_set_fsearch(); thegrid.setdirty(); msel.render(); @@ -11111,7 +11184,7 @@ function reload_browser() { try{ if (e.button !== 0 && e.type !== 'touchstart') return; if (!thegrid.en || !treectl.dsel) return; - if (e.target.closest('#widget,#ops,.opview,.doc,#ggrid>a,.modal,.normalrcm')) return; + if (e.target.closest('#widget,#ops,.opview,.doc,#ggrid>a,.modal,.normalrcm,#tree')) return; } catch(ex){ console.log(ex); diff --git a/copyparty/web/md.css b/copyparty/web/md.css index ade08a5c..d18cebd0 100644 --- a/copyparty/web/md.css +++ b/copyparty/web/md.css @@ -140,17 +140,18 @@ blink { margin-bottom: 6em; } #mn { - padding: 1.3em 0 .7em 1em; + padding: .8em 0 .2em 1em; border-bottom: 1px solid #ccc; background: #eee; z-index: 10; width: calc(100% - 1em); } #mn a { + display: inline-block; color: #444; background: none; margin: 0 0 0 -.2em; - padding: .3em 0 .3em .4em; + padding: .5em .4em .5em 0; text-decoration: none; border: none; /* ie: */ diff --git a/copyparty/web/mde.css b/copyparty/web/mde.css index 0a8d8ec5..084027cf 100644 --- a/copyparty/web/mde.css +++ b/copyparty/web/mde.css @@ -9,6 +9,9 @@ html .editor-toolbar.disabled-for-preview>button:not(.no-disable) { opacity: .35 +:root { + background: none; +} html { line-height: 1.5em; } @@ -39,12 +42,13 @@ html, body { #mn { font-weight: normal; - margin: 1.3em 0 .7em 1em; + margin: .8em 0 .2em 1em; } #mn a { + display: inline-block; color: #444; margin: 0 0 0 -.2em; - padding: 0 0 0 .4em; + padding: .5em .4em .5em 0; text-decoration: none; /* ie: */ border-bottom: .1em solid #777\9; diff --git a/copyparty/web/ui.css b/copyparty/web/ui.css index 7e92f01c..685e1bb6 100644 --- a/copyparty/web/ui.css +++ b/copyparty/web/ui.css @@ -114,6 +114,11 @@ html.y { font-display: swap; src: local('Source Code Pro Regular'), local('SourceCodePro-Regular'), url(deps/scp.woff2) format('woff2'); } +@font-face { + font-family: 'orbitron'; + font-display: swap; + src: url(deps/orbitron.woff2) format('woff2'); +} html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; diff --git a/scripts/sfx.ls b/scripts/sfx.ls index 66ad6133..c16f588b 100644 --- a/scripts/sfx.ls +++ b/scripts/sfx.ls @@ -84,6 +84,7 @@ copyparty/web/deps/fuse.py, copyparty/web/deps/marked.js, copyparty/web/deps/mini-fa.css, copyparty/web/deps/mini-fa.woff, +copyparty/web/deps/orbitron.woff2, copyparty/web/deps/prism.css, copyparty/web/deps/prism.js, copyparty/web/deps/prismd.css,