golf elm removal

This commit is contained in:
ed 2021-11-04 01:33:40 +01:00
parent 862ca3439d
commit ac1568cacf
6 changed files with 21 additions and 28 deletions

View file

@ -530,9 +530,7 @@ window.baguetteBox = (function () {
if (options.bodyClass && document.body.classList) if (options.bodyClass && document.body.classList)
document.body.classList.remove(options.bodyClass); document.body.classList.remove(options.bodyClass);
var h = ebi('bbox-halp'); qsr('#bbox-halp');
if (h)
h.parentNode.removeChild(h);
if (options.afterHide) if (options.afterHide)
options.afterHide(); options.afterHide();
@ -590,8 +588,7 @@ window.baguetteBox = (function () {
image.addEventListener(is_vid ? 'loadedmetadata' : 'load', function () { image.addEventListener(is_vid ? 'loadedmetadata' : 'load', function () {
// Remove loader element // Remove loader element
var spinner = QS('#baguette-img-' + index + ' .bbox-spinner'); qsr('#baguette-img-' + index + ' .bbox-spinner');
figure.removeChild(spinner);
if (!options.async && callback) if (!options.async && callback)
callback(); callback();
}); });

View file

@ -1600,7 +1600,7 @@ function eval_hash() {
i.value = uricom_dec(v.slice(3))[0]; i.value = uricom_dec(v.slice(3))[0];
return i.oninput(); return i.oninput();
} }
}; }
(function () { (function () {
@ -1649,7 +1649,7 @@ function sortfiles(nodes) {
if (v.split('?')[0].slice(-1) == '/') if (v.split('?')[0].slice(-1) == '/')
v = '\t' + v; v = '\t' + v;
v = uricom_dec(v)[0] v = uricom_dec(v)[0];
} }
nodes[b]._sv = v; nodes[b]._sv = v;
@ -4109,10 +4109,7 @@ var msel = (function () {
'<textarea name="files" id="ziptxt"></textarea>'; '<textarea name="files" id="ziptxt"></textarea>';
frm.style.display = 'none'; frm.style.display = 'none';
var oldform = QS('#widgeti>form'); qsr('#widgeti>form');
if (oldform)
oldform.parentNode.removeChild(oldform);
ebi('widgeti').appendChild(frm); ebi('widgeti').appendChild(frm);
var obj = ebi('ziptxt'); var obj = ebi('ziptxt');
obj.value = txt; obj.value = txt;

View file

@ -164,10 +164,7 @@ function copydom(src, dst, lv) {
function md_plug_err(ex, js) { function md_plug_err(ex, js) {
var errbox = ebi('md_errbox'); qsr('#md_errbox');
if (errbox)
errbox.parentNode.removeChild(errbox);
if (!ex) if (!ex)
return; return;
@ -183,7 +180,7 @@ function md_plug_err(ex, js) {
o.textContent = lns[ln - 1]; o.textContent = lns[ln - 1];
} }
} }
errbox = mknod('div'); var errbox = mknod('div');
errbox.setAttribute('id', 'md_errbox'); errbox.setAttribute('id', 'md_errbox');
errbox.style.cssText = 'position:absolute;top:0;left:0;padding:1em .5em;background:#2b2b2b;color:#fc5' errbox.style.cssText = 'position:absolute;top:0;left:0;padding:1em .5em;background:#2b2b2b;color:#fc5'
errbox.textContent = msg; errbox.textContent = msg;
@ -381,8 +378,7 @@ function convert_markdown(md_text, dest_dom) {
function init_toc() { function init_toc() {
var loader = ebi('ml'); qsr('#ml');
loader.parentNode.removeChild(loader);
var anchors = []; // list of toc entries, complex objects var anchors = []; // list of toc entries, complex objects
var anchor = null; // current toc node var anchor = null; // current toc node

View file

@ -65,8 +65,7 @@ var mde = (function () {
mde.codemirror.on("change", function () { mde.codemirror.on("change", function () {
md_changed(mde); md_changed(mde);
}); });
var loader = ebi('ml'); qsr('#ml');
loader.parentNode.removeChild(loader);
return mde; return mde;
})(); })();

View file

@ -332,8 +332,7 @@ function U2pvis(act, btns) {
r.head++; r.head++;
if (!bz_act) { if (!bz_act) {
var tr = ebi("f" + nfile); qsr("#f" + nfile);
tr.parentNode.removeChild(tr);
} }
} }
else return; else return;
@ -352,9 +351,7 @@ function U2pvis(act, btns) {
last = parseInt(last.getAttribute('id').slice(1)); last = parseInt(last.getAttribute('id').slice(1));
while (r.head - first > r.wsz) { while (r.head - first > r.wsz) {
var obj = ebi('f' + (first++)); qsr('#f' + (first++));
if (obj)
obj.parentNode.removeChild(obj);
} }
while (last - r.tail < r.wsz && last < r.tab.length - 2) { while (last - r.tail < r.wsz && last < r.tab.length - 2) {
var obj = ebi('f' + (++last)); var obj = ebi('f' + (++last));
@ -1075,11 +1072,9 @@ function up2k_init(subtle) {
for (var a = 0; a < st.files.length; a++) { for (var a = 0; a < st.files.length; a++) {
var t = st.files[a]; var t = st.files[a];
if (t.done && t.name) { if (t.done && t.name) {
var tr = ebi('f' + t.n); if (!qsr('#f' + t.n))
if (!tr)
continue; continue;
tr.parentNode.removeChild(tr);
t.name = undefined; t.name = undefined;
} }
} }

View file

@ -18,6 +18,15 @@ var ebi = document.getElementById.bind(document),
mknod = document.createElement.bind(document); mknod = document.createElement.bind(document);
function qsr(sel) {
var el = QS(sel);
if (el)
el.parentNode.removeChild(el);
return el;
}
// error handler for mobile devices // error handler for mobile devices
function esc(txt) { function esc(txt) {
return txt.replace(/[&"<>]/g, function (c) { return txt.replace(/[&"<>]/g, function (c) {