From f74ac1f18bdb1ac0e26729dfdf1f3985ffb0b571 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 30 Jan 2023 22:36:05 +0000 Subject: [PATCH] fix sandbox lag by helping the iframe cache js --- copyparty/web/browser.html | 1 + copyparty/web/browser.js | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 90cd60e8..c4a4b73c 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -135,6 +135,7 @@ '; + + return function () { + if (ret || busy) + return ret || tag; + + var xhr = new XHR(); + xhr.open('GET', url, true); + xhr.onload = function () { + if (this.status == 200) + ret = ''; + }; + xhr.send(); + busy = true; + return tag; + }; +})(); + function show_md(md, name, div, url, depth) { var errmsg = L.md_eshow + name + ':\n\n', @@ -6696,8 +6718,7 @@ function sandbox(tgt, rules, cls, html) { html = '' + html + - '' + - '' + + '' + sandboxjs() + '