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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,6 +18,15 @@ var ebi = document.getElementById.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
function esc(txt) {
return txt.replace(/[&"<>]/g, function (c) {