mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
minmax the initial page load time by loading bbox and up2k via browser.js
This commit is contained in:
parent
ce1f15d293
commit
2d2bd1a499
|
|
@ -304,8 +304,8 @@
|
|||
<script src="{{ r }}/.cpr/w/tl/{{ lang }}.js?_={{ ts }}"></script>
|
||||
{%- endif %}
|
||||
<script src="{{ r }}/.cpr/w/browser.js?_={{ ts }}"></script>
|
||||
<script src="{{ r }}/.cpr/w/baguettebox.js?_={{ ts }}"></script>
|
||||
<script src="{{ r }}/.cpr/w/up2k.js?_={{ ts }}"></script>
|
||||
<!-- <script src="{{ r }}/.cpr/w/baguettebox.js?_={{ ts }}"></script>
|
||||
<script src="{{ r }}/.cpr/w/up2k.js?_={{ ts }}"></script> -->
|
||||
{%- if js %}
|
||||
<script src="{{ js }}_={{ ts }}"></script>
|
||||
{%- endif %}
|
||||
|
|
@ -313,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");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,34 @@
|
|||
|
||||
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);
|
||||
}
|
||||
loadScript('baguettebox', "J_BBX");
|
||||
loadScript('up2k', "J_U2K");
|
||||
|
||||
|
||||
// disables emojis
|
||||
var fun_tgl = sread('fun_tgl');
|
||||
if( fun_tgl == null)
|
||||
|
|
@ -9089,7 +9117,7 @@ function apply_perms(res) {
|
|||
ebi('u2rand').parentNode.style.display = 'none';
|
||||
|
||||
u2ts = res.u2ts;
|
||||
if (up2k)
|
||||
if (up2k && up2k.set_fsearch)
|
||||
up2k.set_fsearch();
|
||||
|
||||
if (res.cfg)
|
||||
|
|
@ -11070,7 +11098,7 @@ function reload_browser() {
|
|||
for (var a = 0; a < ns.length; a++)
|
||||
clmod(ebi(ns[a]), 'hidden', ebi('unsearch'));
|
||||
|
||||
if (up2k)
|
||||
if (up2k && up2k.set_fsearch)
|
||||
up2k.set_fsearch();
|
||||
|
||||
thegrid.setdirty();
|
||||
|
|
|
|||
Loading…
Reference in a new issue