Created
January 22, 2016 15:44
-
-
Save 13twelve/9a28a8dfc3da2f27aa71 to your computer and use it in GitHub Desktop.
head.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* to be included compressed, inline, in the head of the document */ | |
var A17 = window.A17 || {}; | |
A17.svgSupport = document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"); | |
A17.browserSpec = (typeof document.querySelectorAll && 'addEventListener' in window && A17.svgSupport) ? "html5" : "html4"; | |
A17.touch = (('ontouchstart' in window) || window.documentTouch && document instanceof DocumentTouch) ? true : false; | |
A17.loadCSS = function(doc,href,before,media){ | |
"use strict"; | |
var ss = doc.createElement("link"); | |
var ref; | |
if(before){ | |
ref = before; | |
} else if( doc.querySelectorAll ){ | |
var refs = doc.querySelectorAll("style,link[rel=stylesheet],script"); | |
ref = refs[ refs.length - 1]; | |
} else { | |
ref = doc.getElementsByTagName("script")[ 0 ]; | |
} | |
var sheets = doc.styleSheets; | |
ss.rel = "stylesheet"; | |
ss.href = href; | |
ss.media = "only x"; | |
ref.parentNode.insertBefore( ss, ( before ? ref : ref.nextSibling ) ); | |
ss.onloadcssdefined = function( cb ){ | |
var defined; | |
for( var i = 0; i < sheets.length; i++ ){ | |
if( sheets[ i ].href && sheets[ i ].href === ss.href ){ | |
defined = true; | |
} | |
} | |
if( defined ){ | |
cb(); | |
} else { | |
setTimeout(function() { | |
ss.onloadcssdefined( cb ); | |
}); | |
} | |
}; | |
ss.onloadcssdefined(function() { | |
ss.media = media || "all"; | |
}); | |
return ss; | |
}; | |
(function(d) { | |
var de = d.documentElement, | |
loadBefore = d.getElementById("icons_ss"); | |
de.className = de.className.replace(/\bno-js\b/," js "+A17.browserSpec+(A17.touch ? " touch" : " no-touch")+(A17.svgSupport ? " svg" : " no-svg")+(('objectFit' in de.style) ? " objectFit" : " no-objectFit")); | |
A17.loadCSS(d,"/stylesheets/icons.css",loadBefore); | |
})(document); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var A17=window.A17||{};A17.svgSupport=document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),A17.browserSpec="addEventListener"in window&&A17.svgSupport?"html5":"html4",A17.touch="ontouchstart"in window||window.documentTouch&&document instanceof DocumentTouch?!0:!1,A17.loadCSS=function(doc,href,before,media){"use strict";var ref,ss=doc.createElement("link");if(before)ref=before;else if(doc.querySelectorAll){var refs=doc.querySelectorAll("style,link[rel=stylesheet],script");ref=refs[refs.length-1]}else ref=doc.getElementsByTagName("script")[0];var sheets=doc.styleSheets;return ss.rel="stylesheet",ss.href=href,ss.media="only x",ref.parentNode.insertBefore(ss,before?ref:ref.nextSibling),ss.onloadcssdefined=function(cb){for(var defined,i=0;i<sheets.length;i++)sheets[i].href&&sheets[i].href===ss.href&&(defined=!0);defined?cb():setTimeout(function(){ss.onloadcssdefined(cb)})},ss.onloadcssdefined(function(){ss.media=media||"all"}),ss},function(d){var de=d.documentElement,loadBefore=d.getElementById("icons_ss");de.className=de.className.replace(/\bno-js\b/," js "+A17.browserSpec+(A17.touch?" touch":" no-touch")+(A17.svgSupport?" svg":" no-svg")+("objectFit"in de.style?" objectFit":" no-objectFit")),A17.loadCSS(d,"/stylesheets/icons.css",loadBefore)}(document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment