-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaltclass.min.js
1 lines (1 loc) · 1016 Bytes
/
altclass.min.js
1
(function(e,t,n){function r(){[].forEach.call(document.querySelectorAll("["+t+e+"]"),function(n){n[e]=n.getAttribute(t+e);n.removeAttribute(t+e)});setTimeout(r,200)}function i(t,r){function l(e){e=u.innerWidth;s=i.map(function(t,n){n=[];t.forEach(function(t,r){if(r<=e){n=t}});return n.join(" ")}).join(" ");if(s!==t.className){t.className=s}}function c(e,t){i=[[]];t=i[0];a=0;for(;f=e.match(n);){if(f[1]){a=parseFloat(f[1])}if(f[2]){t[a]=t[a]||[];t[a].push(f[2])}if(f[3]){t=i[i.push([])-1]}e=e.slice(f[0].length)}l()}var i,s,o,u,a,f;o=t.appendChild(document.createElement("iframe"));u=o.contentWindow;o.style.cssText="border:0;clip:rect(0 0 0 0);height:0;left:0;position:absolute;top:0;width:100%;z-index:-1";u.addEventListener("resize",l);Object.defineProperty(t,e,{get:function(){return r},set:function(e){c(e)}});c(r)}Object.defineProperty(Element.prototype,e,{set:function(e){i(this,e)}});document.addEventListener("DOMContentLoaded",r)})("altclass","data-",/^\s*(\d+)|^\s*(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)|^\s*(,)/)