-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathcinnamon.min.js
1 lines (1 loc) · 1.32 KB
/
cinnamon.min.js
1
(function(){var e="hidden",t="999px",n;if(navigator.userAgent.indexOf("Safari")!==-1&&navigator.userAgent.indexOf("Chrome")===-1){e="visible";t="inherit";n="safari"}else if(navigator.userAgent.indexOf("Firefox")!==-1){n="firefox";t="inherit"}var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),s="[data-cinnamon] { position: relative; display: inline-block; z-index: 1; } .cinnamon { z-index: -1; position: absolute; top: 0; left: 0; display: inline-block; height: 100%; width: 100%; overflow: "+e+"; color: transparent; font-size: "+t+"; } @media all and (device-width: 768px) and (device-height: 1024px) { .cinnamon { z-index: 1; opacity: 0.25; } }";i.type="text/css";if(i.styleSheet){i.styleSheet.cssText=s}else{i.appendChild(document.createTextNode(s))}r.appendChild(i);var o=document.querySelectorAll("[data-cinnamon]");for(var u=0;u<o.length;u++){var a=o[u],f=a.getAttribute("data-cinnamon").split(","),l=a.getElementsByTagName("img")[0];if(l&&l.getAttribute("alt")){f.push(l.getAttribute("alt"))}for(var c=0;c<f.length;c++){var h=document.createElement("span");h.className="cinnamon";h.setAttribute("aria-hidden","true");if(l&&n=="firefox"){h.style.fontSize=l.height+20+"px"}if(typeof h.textContent!=="undefined"){h.textContent=f[c]+" "}else{h.innerText=f[c]+" "}a.insertBefore(h,a.firstChild)}}})()