/
script.js
8 lines (8 loc) · 3.46 KB
/
script.js
1
2
3
4
5
6
7
8
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var q=0;return function(){return q<a.length?{done:!1,value:a[q++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var q="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return q?q.call(a):$jscomp.arrayIterator(a)};
window.mobileTables=function(a){a=a||{};var q=a.selector||"table",I=a.parseColumnIndex||function(e){return-1},J=a.hideHeadings||[],z=new WeakMap,A=new WeakMap,E=Symbol("index"),B=Symbol("hidden"),C=function(e,c){if(1===e.childNodes.length&&"#text"===e.lastChild.nodeName)return c.innerText=e.innerText,!1;for(;e.firstChild;)c.appendChild(e.firstChild);return!0},D=function(e){var c=document.createElement("tr");e.appendChild(c);return c},F=function(e,c,d){var b=c.cloneNode(!1);d&&(b.colSpan=2);C(c,b)&&
A.set(c,b);e.appendChild(b);return b},G=function(e){var c=document.createElement("div");e.replaceWith(c);return c};return function(e,c){if(e)a:{var d=c||document;var b=!1;d=$jscomp.makeIterator(d.querySelectorAll(q));for(var m=d.next();!m.done;m=d.next()){b=m.value;if(z.has(b)){d=void 0;break a}var l=I(b);m=G(b);var r=b,f=[],t=b.querySelector("tr"),u=0;t=$jscomp.makeIterator(t.children);for(var g=t.next();!g.done;g=t.next()){g=g.value;for(var h=g.colSpan,x=0;x<h;){if(u===l)f.push(E);else if(J.includes(g.innerText))f.push(B);
else{var n=document.createElement("td");n.innerHTML=g.innerHTML;f.push(n)}u+=1;x+=1}}g=r;l=f.indexOf(E);r=g.cloneNode(!1);u=g.querySelector("tbody").cloneNode(!1);r.appendChild(u);t=!0;g=$jscomp.makeIterator(g.querySelectorAll("tr"));for(h=g.next();!h.done;h=g.next())if(h=h.value,t)t=!1;else if(1===h.children.length)F(D(u),h.firstElementChild,!0);else{x=-1!==l?D(u):null;n=0;for(var w=1,H=$jscomp.makeIterator(f),p=H.next();!p.done;p=H.next()){p=p.value;if(void 0===h.children[n]){console.log("mobileTables: Unsupported table layout:");
console.log(h);break}if(n===l){p=x;var v=h.children[n],k=document.createElement("th");k.colSpan=2;k.className=v.className;C(v,k)&&A.set(v,k);p.appendChild(k)}else{v=D(u);if(p!==B){var K=v,y=p;1===y.childNodes.length&&"#text"===y.lastChild.nodeName?(k=document.createElement("td"),k.innerText=y.innerText):k=y.cloneNode(!0);K.appendChild(k)}k=h.children[n].colSpan;1===w&&(F(v,h.children[n],p===B).rowSpan=k);w=1===w?k:w-1;if(1<w)continue}n+=1}}f=r;z.set(f,b);m.replaceWith(f);b=!0}d=b}else{d=c||document;
m=!1;d=$jscomp.makeIterator(d.querySelectorAll(q));for(b=d.next();!b.done;b=d.next())if(f=b.value,b=z.get(f),void 0!==b){m=G(f);f=$jscomp.makeIterator(b.querySelectorAll("td, th"));for(l=f.next();!l.done;l=f.next())l=l.value,r=A.get(l),void 0!==r&&C(r,l);m.replaceWith(b);m=!0}d=m}return d}}({selector:"div.page div.mobiletable table",parseColumnIndex:function(a){a=parseInt(a.parentElement.parentElement.getAttribute("data-column"),10);return isNaN(a)||0>a?-1:a},hideHeadings:["image","Image","Bild"]});
window.checkMobileTables=function(){var a=document.querySelector("div.mobiletable");a&&(a=window.getComputedStyle(a,":before").getPropertyValue("content").replace(/"|'/g,""),window.mobileTables("mobile"===a)&&window.location.hash&&(window.location.hash=window.location.hash))};
(function(a){return["complete","interactive"].includes(document.readyState)?setTimeout(a,0):document.addEventListener("DOMContentLoaded",a)})(function(){var a;window.addEventListener("resize",function(){a&&clearTimeout(a);a=setTimeout(window.checkMobileTables,200)});window.checkMobileTables()});