kanpachi 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bowerrc +3 -0
- data/.travis.yml +3 -1
- data/bower.json +22 -0
- data/kanpachi.gemspec +6 -6
- data/lib/kanpachi/doc/template/components/html5shiv/.bower.json +26 -0
- data/lib/kanpachi/doc/template/components/html5shiv/dist/html5shiv-printshiv.js +11 -0
- data/lib/kanpachi/doc/template/{source/javascripts → components/html5shiv/dist}/html5shiv.js +4 -5
- data/lib/kanpachi/doc/template/components/html5shiv/readme.md +143 -0
- data/lib/kanpachi/doc/template/components/jquery/.bower.json +37 -0
- data/lib/kanpachi/doc/template/components/jquery/MIT-LICENSE.txt +21 -0
- data/lib/kanpachi/doc/template/components/jquery/bower.json +27 -0
- data/lib/kanpachi/doc/template/components/jquery/dist/jquery.js +10337 -0
- data/lib/kanpachi/doc/template/components/jquery/dist/jquery.min.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/dist/jquery.min.map +1 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax.js +807 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/jsonp.js +89 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/load.js +75 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/parseJSON.js +51 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/parseXML.js +31 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/script.js +93 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/var/nonce.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/var/rquery.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/ajax/xhr.js +196 -0
- data/lib/kanpachi/doc/template/components/jquery/src/attributes.js +11 -0
- data/lib/kanpachi/doc/template/components/jquery/src/attributes/attr.js +271 -0
- data/lib/kanpachi/doc/template/components/jquery/src/attributes/classes.js +157 -0
- data/lib/kanpachi/doc/template/components/jquery/src/attributes/prop.js +134 -0
- data/lib/kanpachi/doc/template/components/jquery/src/attributes/support.js +64 -0
- data/lib/kanpachi/doc/template/components/jquery/src/attributes/val.js +176 -0
- data/lib/kanpachi/doc/template/components/jquery/src/callbacks.js +205 -0
- data/lib/kanpachi/doc/template/components/jquery/src/core.js +542 -0
- data/lib/kanpachi/doc/template/components/jquery/src/core/access.js +60 -0
- data/lib/kanpachi/doc/template/components/jquery/src/core/init.js +132 -0
- data/lib/kanpachi/doc/template/components/jquery/src/core/parseHTML.js +39 -0
- data/lib/kanpachi/doc/template/components/jquery/src/core/ready.js +151 -0
- data/lib/kanpachi/doc/template/components/jquery/src/core/var/rsingleTag.js +4 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css.js +508 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/addGetHookIf.js +32 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/curCSS.js +117 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/defaultDisplay.js +68 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/hiddenVisibleSelectors.js +20 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/support.js +193 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/swap.js +28 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/var/cssExpand.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/var/isHidden.js +13 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/var/rmargin.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/data.js +332 -0
- data/lib/kanpachi/doc/template/components/jquery/src/data/accepts.js +21 -0
- data/lib/kanpachi/doc/template/components/jquery/src/data/support.js +25 -0
- data/lib/kanpachi/doc/template/components/jquery/src/deferred.js +150 -0
- data/lib/kanpachi/doc/template/components/jquery/src/deprecated.js +13 -0
- data/lib/kanpachi/doc/template/components/jquery/src/dimensions.js +50 -0
- data/lib/kanpachi/doc/template/components/jquery/src/effects.js +648 -0
- data/lib/kanpachi/doc/template/components/jquery/src/effects/Tween.js +114 -0
- data/lib/kanpachi/doc/template/components/jquery/src/effects/animatedSelector.js +13 -0
- data/lib/kanpachi/doc/template/components/jquery/src/effects/support.js +76 -0
- data/lib/kanpachi/doc/template/components/jquery/src/event.js +1029 -0
- data/lib/kanpachi/doc/template/components/jquery/src/event/alias.js +39 -0
- data/lib/kanpachi/doc/template/components/jquery/src/event/support.js +26 -0
- data/lib/kanpachi/doc/template/components/jquery/src/exports/amd.js +18 -0
- data/lib/kanpachi/doc/template/components/jquery/src/exports/global.js +32 -0
- data/lib/kanpachi/doc/template/components/jquery/src/intro.js +44 -0
- data/lib/kanpachi/doc/template/components/jquery/src/jquery.js +37 -0
- data/lib/kanpachi/doc/template/components/jquery/src/manipulation.js +744 -0
- data/lib/kanpachi/doc/template/components/jquery/src/manipulation/_evalUrl.js +18 -0
- data/lib/kanpachi/doc/template/components/jquery/src/manipulation/support.js +79 -0
- data/lib/kanpachi/doc/template/components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/offset.js +211 -0
- data/lib/kanpachi/doc/template/components/jquery/src/outro.js +1 -0
- data/lib/kanpachi/doc/template/components/jquery/src/queue.js +142 -0
- data/lib/kanpachi/doc/template/components/jquery/src/queue/delay.js +22 -0
- data/lib/kanpachi/doc/template/components/jquery/src/selector-sizzle.js +14 -0
- data/lib/kanpachi/doc/template/components/jquery/src/selector.js +1 -0
- data/lib/kanpachi/doc/template/components/jquery/src/serialize.js +110 -0
- data/lib/kanpachi/doc/template/components/jquery/src/sizzle/dist/sizzle.js +2015 -0
- data/lib/kanpachi/doc/template/components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
- data/lib/kanpachi/doc/template/components/jquery/src/support.js +62 -0
- data/lib/kanpachi/doc/template/components/jquery/src/traversing.js +200 -0
- data/lib/kanpachi/doc/template/components/jquery/src/traversing/findFilter.js +100 -0
- data/lib/kanpachi/doc/template/components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/class2type.js +4 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/concat.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/deletedIds.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/hasOwn.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/indexOf.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/pnum.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/push.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/rnotwhite.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/slice.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/strundefined.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/support.js +4 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/toString.js +5 -0
- data/lib/kanpachi/doc/template/components/jquery/src/var/trim.js +3 -0
- data/lib/kanpachi/doc/template/components/jquery/src/wrap.js +75 -0
- data/lib/kanpachi/doc/template/components/respond/.bower.json +20 -0
- data/lib/kanpachi/doc/template/components/respond/Gruntfile.js +90 -0
- data/lib/kanpachi/doc/template/components/respond/LICENSE-MIT +22 -0
- data/lib/kanpachi/doc/template/components/respond/README.md +114 -0
- data/lib/kanpachi/doc/template/components/respond/bower.json +10 -0
- data/lib/kanpachi/doc/template/components/respond/cross-domain/example.html +24 -0
- data/lib/kanpachi/doc/template/components/respond/cross-domain/respond-proxy.html +96 -0
- data/lib/kanpachi/doc/template/components/respond/cross-domain/respond.proxy.gif +0 -0
- data/lib/kanpachi/doc/template/components/respond/cross-domain/respond.proxy.js +127 -0
- data/lib/kanpachi/doc/template/components/respond/dest/respond.matchmedia.addListener.min.js +5 -0
- data/lib/kanpachi/doc/template/components/respond/dest/respond.matchmedia.addListener.src.js +273 -0
- data/lib/kanpachi/doc/template/components/respond/dest/respond.min.js +5 -0
- data/lib/kanpachi/doc/template/components/respond/dest/respond.src.js +224 -0
- data/lib/kanpachi/doc/template/components/respond/package.json +32 -0
- data/lib/kanpachi/doc/template/components/respond/src/matchmedia.addListener.js +76 -0
- data/lib/kanpachi/doc/template/components/respond/src/matchmedia.polyfill.js +36 -0
- data/lib/kanpachi/doc/template/components/respond/src/respond.js +341 -0
- data/lib/kanpachi/doc/template/config.rb +4 -0
- data/lib/kanpachi/doc/template/source/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/kanpachi/doc/template/source/fonts/glyphicons-halflings-regular.svg +201 -200
- data/lib/kanpachi/doc/template/source/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/kanpachi/doc/template/source/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/kanpachi/doc/template/source/javascripts/all.coffee +2 -0
- data/lib/kanpachi/doc/template/source/javascripts/bootstrap.js +271 -319
- data/lib/kanpachi/doc/template/source/javascripts/bootstrap.min.js +6 -6
- data/lib/kanpachi/doc/template/source/javascripts/ie.coffee +2 -0
- data/lib/kanpachi/doc/template/source/layouts/layout.slim +4 -6
- data/lib/kanpachi/doc/template/source/stylesheets/bootstrap-theme.css +192 -229
- data/lib/kanpachi/doc/template/source/stylesheets/bootstrap-theme.css.map +1 -0
- data/lib/kanpachi/doc/template/source/stylesheets/bootstrap-theme.min.css +7 -1
- data/lib/kanpachi/doc/template/source/stylesheets/bootstrap.css +2036 -3056
- data/lib/kanpachi/doc/template/source/stylesheets/bootstrap.css.map +1 -0
- data/lib/kanpachi/doc/template/source/stylesheets/bootstrap.min.css +6 -8
- data/lib/kanpachi/version.rb +1 -1
- data/wercker.yml +27 -0
- metadata +143 -31
- data/lib/kanpachi/doc/template/source/javascripts/all.js +0 -1
- data/lib/kanpachi/doc/template/source/javascripts/jquery-1.10.2.min.js +0 -6
- data/lib/kanpachi/doc/template/source/javascripts/respond.min.js +0 -7
@@ -0,0 +1,127 @@
|
|
1
|
+
/*! Respond.js: min/max-width media query polyfill. Remote proxy (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
2
|
+
(function(win, doc, undefined){
|
3
|
+
var docElem = doc.documentElement,
|
4
|
+
proxyURL = doc.getElementById("respond-proxy").href,
|
5
|
+
redirectURL = (doc.getElementById("respond-redirect") || location).href,
|
6
|
+
baseElem = doc.getElementsByTagName("base")[0],
|
7
|
+
urls = [],
|
8
|
+
refNode;
|
9
|
+
|
10
|
+
function encode(url){
|
11
|
+
return win.encodeURIComponent(url);
|
12
|
+
}
|
13
|
+
|
14
|
+
function fakejax( url, callback ){
|
15
|
+
|
16
|
+
var iframe,
|
17
|
+
AXO;
|
18
|
+
|
19
|
+
// All hail Google http://j.mp/iKMI19
|
20
|
+
// Behold, an iframe proxy without annoying clicky noises.
|
21
|
+
if ( "ActiveXObject" in win ) {
|
22
|
+
AXO = new ActiveXObject( "htmlfile" );
|
23
|
+
AXO.open();
|
24
|
+
AXO.write( '<iframe id="x"></iframe>' );
|
25
|
+
AXO.close();
|
26
|
+
iframe = AXO.getElementById( "x" );
|
27
|
+
} else {
|
28
|
+
iframe = doc.createElement( "iframe" );
|
29
|
+
iframe.style.cssText = "position:absolute;top:-99em";
|
30
|
+
docElem.insertBefore(iframe, docElem.firstElementChild || docElem.firstChild );
|
31
|
+
}
|
32
|
+
|
33
|
+
iframe.src = checkBaseURL(proxyURL) + "?url=" + encode(redirectURL) + "&css=" + encode(checkBaseURL(url));
|
34
|
+
|
35
|
+
function checkFrameName() {
|
36
|
+
var cssText;
|
37
|
+
|
38
|
+
try {
|
39
|
+
cssText = iframe.contentWindow.name;
|
40
|
+
}
|
41
|
+
catch (e) { }
|
42
|
+
|
43
|
+
if (cssText) {
|
44
|
+
// We've got what we need. Stop the iframe from loading further content.
|
45
|
+
iframe.src = "about:blank";
|
46
|
+
iframe.parentNode.removeChild(iframe);
|
47
|
+
iframe = null;
|
48
|
+
|
49
|
+
|
50
|
+
// Per http://j.mp/kn9EPh, not taking any chances. Flushing the ActiveXObject
|
51
|
+
if (AXO) {
|
52
|
+
AXO = null;
|
53
|
+
|
54
|
+
if (win.CollectGarbage) {
|
55
|
+
win.CollectGarbage();
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
callback(cssText);
|
60
|
+
}
|
61
|
+
else{
|
62
|
+
win.setTimeout(checkFrameName, 100);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
win.setTimeout(checkFrameName, 500);
|
67
|
+
}
|
68
|
+
|
69
|
+
function checkBaseURL(href) {
|
70
|
+
if (baseElem && href.indexOf(baseElem.href) === -1) {
|
71
|
+
bref = (/\/$/).test(baseElem.href) ? baseElem.href : (baseElem.href + "/");
|
72
|
+
href = bref + href;
|
73
|
+
}
|
74
|
+
|
75
|
+
return href;
|
76
|
+
}
|
77
|
+
|
78
|
+
function checkRedirectURL() {
|
79
|
+
// IE6 & IE7 don't build out absolute urls in <link /> attributes.
|
80
|
+
// So respond.proxy.gif remains relative instead of http://example.com/respond.proxy.gif.
|
81
|
+
// This trickery resolves that issue.
|
82
|
+
if (~ !redirectURL.indexOf(location.host)) {
|
83
|
+
|
84
|
+
var fakeLink = doc.createElement("div");
|
85
|
+
|
86
|
+
fakeLink.innerHTML = '<a href="' + redirectURL + '"></a>';
|
87
|
+
docElem.insertBefore(fakeLink, docElem.firstElementChild || docElem.firstChild );
|
88
|
+
|
89
|
+
// Grab the parsed URL from that dummy object
|
90
|
+
redirectURL = fakeLink.firstChild.href;
|
91
|
+
|
92
|
+
// Clean up
|
93
|
+
fakeLink.parentNode.removeChild(fakeLink);
|
94
|
+
fakeLink = null;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
function buildUrls(){
|
99
|
+
var links = doc.getElementsByTagName( "link" );
|
100
|
+
|
101
|
+
for( var i = 0, linkl = links.length; i < linkl; i++ ){
|
102
|
+
|
103
|
+
var thislink = links[i],
|
104
|
+
href = links[i].href,
|
105
|
+
extreg = (/^([a-zA-Z:]*\/\/(www\.)?)/).test( href ),
|
106
|
+
ext = (baseElem && !extreg) || extreg;
|
107
|
+
|
108
|
+
//make sure it's an external stylesheet
|
109
|
+
if( thislink.rel.indexOf( "stylesheet" ) >= 0 && ext ){
|
110
|
+
(function( link ){
|
111
|
+
fakejax( href, function( css ){
|
112
|
+
link.styleSheet.rawCssText = css;
|
113
|
+
respond.update();
|
114
|
+
} );
|
115
|
+
})( thislink );
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
}
|
121
|
+
|
122
|
+
if( !respond.mediaQueriesSupported ){
|
123
|
+
checkRedirectURL();
|
124
|
+
buildUrls();
|
125
|
+
}
|
126
|
+
|
127
|
+
})( window, document );
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
2
|
+
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
3
|
+
* */
|
4
|
+
|
5
|
+
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";if(a.matchMedia&&a.matchMedia("all").addListener)return!1;var b=a.matchMedia,c=b("only all").matches,d=!1,e=0,f=[],g=function(){a.clearTimeout(e),e=a.setTimeout(function(){for(var c=0,d=f.length;d>c;c++){var e=f[c].mql,g=f[c].listeners||[],h=b(e.media).matches;if(h!==e.matches){e.matches=h;for(var i=0,j=g.length;j>i;i++)g[i].call(a,e)}}},30)};a.matchMedia=function(e){var h=b(e),i=[],j=0;return h.addListener=function(b){c&&(d||(d=!0,a.addEventListener("resize",g,!0)),0===j&&(j=f.push({mql:h,listeners:i})),i.push(b))},h.removeListener=function(a){for(var b=0,c=i.length;c>b;b++)i[b]===a&&i.splice(b,1)},h}}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
@@ -0,0 +1,273 @@
|
|
1
|
+
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
2
|
+
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
3
|
+
(function(w) {
|
4
|
+
"use strict";
|
5
|
+
w.matchMedia = w.matchMedia || function(doc, undefined) {
|
6
|
+
var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div");
|
7
|
+
div.id = "mq-test-1";
|
8
|
+
div.style.cssText = "position:absolute;top:-100em";
|
9
|
+
fakeBody.style.background = "none";
|
10
|
+
fakeBody.appendChild(div);
|
11
|
+
return function(q) {
|
12
|
+
div.innerHTML = '­<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>';
|
13
|
+
docElem.insertBefore(fakeBody, refNode);
|
14
|
+
bool = div.offsetWidth === 42;
|
15
|
+
docElem.removeChild(fakeBody);
|
16
|
+
return {
|
17
|
+
matches: bool,
|
18
|
+
media: q
|
19
|
+
};
|
20
|
+
};
|
21
|
+
}(w.document);
|
22
|
+
})(this);
|
23
|
+
|
24
|
+
/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */
|
25
|
+
(function(w) {
|
26
|
+
"use strict";
|
27
|
+
if (w.matchMedia && w.matchMedia("all").addListener) {
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
var localMatchMedia = w.matchMedia, hasMediaQueries = localMatchMedia("only all").matches, isListening = false, timeoutID = 0, queries = [], handleChange = function(evt) {
|
31
|
+
w.clearTimeout(timeoutID);
|
32
|
+
timeoutID = w.setTimeout(function() {
|
33
|
+
for (var i = 0, il = queries.length; i < il; i++) {
|
34
|
+
var mql = queries[i].mql, listeners = queries[i].listeners || [], matches = localMatchMedia(mql.media).matches;
|
35
|
+
if (matches !== mql.matches) {
|
36
|
+
mql.matches = matches;
|
37
|
+
for (var j = 0, jl = listeners.length; j < jl; j++) {
|
38
|
+
listeners[j].call(w, mql);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}, 30);
|
43
|
+
};
|
44
|
+
w.matchMedia = function(media) {
|
45
|
+
var mql = localMatchMedia(media), listeners = [], index = 0;
|
46
|
+
mql.addListener = function(listener) {
|
47
|
+
if (!hasMediaQueries) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
if (!isListening) {
|
51
|
+
isListening = true;
|
52
|
+
w.addEventListener("resize", handleChange, true);
|
53
|
+
}
|
54
|
+
if (index === 0) {
|
55
|
+
index = queries.push({
|
56
|
+
mql: mql,
|
57
|
+
listeners: listeners
|
58
|
+
});
|
59
|
+
}
|
60
|
+
listeners.push(listener);
|
61
|
+
};
|
62
|
+
mql.removeListener = function(listener) {
|
63
|
+
for (var i = 0, il = listeners.length; i < il; i++) {
|
64
|
+
if (listeners[i] === listener) {
|
65
|
+
listeners.splice(i, 1);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
};
|
69
|
+
return mql;
|
70
|
+
};
|
71
|
+
})(this);
|
72
|
+
|
73
|
+
/*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
|
74
|
+
(function(w) {
|
75
|
+
"use strict";
|
76
|
+
var respond = {};
|
77
|
+
w.respond = respond;
|
78
|
+
respond.update = function() {};
|
79
|
+
var requestQueue = [], xmlHttp = function() {
|
80
|
+
var xmlhttpmethod = false;
|
81
|
+
try {
|
82
|
+
xmlhttpmethod = new w.XMLHttpRequest();
|
83
|
+
} catch (e) {
|
84
|
+
xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP");
|
85
|
+
}
|
86
|
+
return function() {
|
87
|
+
return xmlhttpmethod;
|
88
|
+
};
|
89
|
+
}(), ajax = function(url, callback) {
|
90
|
+
var req = xmlHttp();
|
91
|
+
if (!req) {
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
req.open("GET", url, true);
|
95
|
+
req.onreadystatechange = function() {
|
96
|
+
if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
callback(req.responseText);
|
100
|
+
};
|
101
|
+
if (req.readyState === 4) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
req.send(null);
|
105
|
+
};
|
106
|
+
respond.ajax = ajax;
|
107
|
+
respond.queue = requestQueue;
|
108
|
+
respond.regex = {
|
109
|
+
media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
|
110
|
+
keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
|
111
|
+
urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
|
112
|
+
findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
|
113
|
+
only: /(only\s+)?([a-zA-Z]+)\s?/,
|
114
|
+
minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,
|
115
|
+
maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/
|
116
|
+
};
|
117
|
+
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches;
|
118
|
+
if (respond.mediaQueriesSupported) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() {
|
122
|
+
var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false;
|
123
|
+
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
124
|
+
if (!body) {
|
125
|
+
body = fakeUsed = doc.createElement("body");
|
126
|
+
body.style.background = "none";
|
127
|
+
}
|
128
|
+
docElem.style.fontSize = "100%";
|
129
|
+
body.style.fontSize = "100%";
|
130
|
+
body.appendChild(div);
|
131
|
+
if (fakeUsed) {
|
132
|
+
docElem.insertBefore(body, docElem.firstChild);
|
133
|
+
}
|
134
|
+
ret = div.offsetWidth;
|
135
|
+
if (fakeUsed) {
|
136
|
+
docElem.removeChild(body);
|
137
|
+
} else {
|
138
|
+
body.removeChild(div);
|
139
|
+
}
|
140
|
+
docElem.style.fontSize = originalHTMLFontSize;
|
141
|
+
if (originalBodyFontSize) {
|
142
|
+
body.style.fontSize = originalBodyFontSize;
|
143
|
+
}
|
144
|
+
ret = eminpx = parseFloat(ret);
|
145
|
+
return ret;
|
146
|
+
}, applyMedia = function(fromResize) {
|
147
|
+
var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime();
|
148
|
+
if (fromResize && lastCall && now - lastCall < resizeThrottle) {
|
149
|
+
w.clearTimeout(resizeDefer);
|
150
|
+
resizeDefer = w.setTimeout(applyMedia, resizeThrottle);
|
151
|
+
return;
|
152
|
+
} else {
|
153
|
+
lastCall = now;
|
154
|
+
}
|
155
|
+
for (var i in mediastyles) {
|
156
|
+
if (mediastyles.hasOwnProperty(i)) {
|
157
|
+
var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em";
|
158
|
+
if (!!min) {
|
159
|
+
min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1);
|
160
|
+
}
|
161
|
+
if (!!max) {
|
162
|
+
max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1);
|
163
|
+
}
|
164
|
+
if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) {
|
165
|
+
if (!styleBlocks[thisstyle.media]) {
|
166
|
+
styleBlocks[thisstyle.media] = [];
|
167
|
+
}
|
168
|
+
styleBlocks[thisstyle.media].push(rules[thisstyle.rules]);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
for (var j in appendedEls) {
|
173
|
+
if (appendedEls.hasOwnProperty(j)) {
|
174
|
+
if (appendedEls[j] && appendedEls[j].parentNode === head) {
|
175
|
+
head.removeChild(appendedEls[j]);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
appendedEls.length = 0;
|
180
|
+
for (var k in styleBlocks) {
|
181
|
+
if (styleBlocks.hasOwnProperty(k)) {
|
182
|
+
var ss = doc.createElement("style"), css = styleBlocks[k].join("\n");
|
183
|
+
ss.type = "text/css";
|
184
|
+
ss.media = k;
|
185
|
+
head.insertBefore(ss, lastLink.nextSibling);
|
186
|
+
if (ss.styleSheet) {
|
187
|
+
ss.styleSheet.cssText = css;
|
188
|
+
} else {
|
189
|
+
ss.appendChild(doc.createTextNode(css));
|
190
|
+
}
|
191
|
+
appendedEls.push(ss);
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}, translate = function(styles, href, media) {
|
195
|
+
var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0;
|
196
|
+
href = href.substring(0, href.lastIndexOf("/"));
|
197
|
+
var repUrls = function(css) {
|
198
|
+
return css.replace(respond.regex.urls, "$1" + href + "$2$3");
|
199
|
+
}, useMedia = !ql && media;
|
200
|
+
if (href.length) {
|
201
|
+
href += "/";
|
202
|
+
}
|
203
|
+
if (useMedia) {
|
204
|
+
ql = 1;
|
205
|
+
}
|
206
|
+
for (var i = 0; i < ql; i++) {
|
207
|
+
var fullq, thisq, eachq, eql;
|
208
|
+
if (useMedia) {
|
209
|
+
fullq = media;
|
210
|
+
rules.push(repUrls(styles));
|
211
|
+
} else {
|
212
|
+
fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1;
|
213
|
+
rules.push(RegExp.$2 && repUrls(RegExp.$2));
|
214
|
+
}
|
215
|
+
eachq = fullq.split(",");
|
216
|
+
eql = eachq.length;
|
217
|
+
for (var j = 0; j < eql; j++) {
|
218
|
+
thisq = eachq[j];
|
219
|
+
mediastyles.push({
|
220
|
+
media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all",
|
221
|
+
rules: rules.length - 1,
|
222
|
+
hasquery: thisq.indexOf("(") > -1,
|
223
|
+
minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
|
224
|
+
maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "")
|
225
|
+
});
|
226
|
+
}
|
227
|
+
}
|
228
|
+
applyMedia();
|
229
|
+
}, makeRequests = function() {
|
230
|
+
if (requestQueue.length) {
|
231
|
+
var thisRequest = requestQueue.shift();
|
232
|
+
ajax(thisRequest.href, function(styles) {
|
233
|
+
translate(styles, thisRequest.href, thisRequest.media);
|
234
|
+
parsedSheets[thisRequest.href] = true;
|
235
|
+
w.setTimeout(function() {
|
236
|
+
makeRequests();
|
237
|
+
}, 0);
|
238
|
+
});
|
239
|
+
}
|
240
|
+
}, ripCSS = function() {
|
241
|
+
for (var i = 0; i < links.length; i++) {
|
242
|
+
var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
243
|
+
if (!!href && isCSS && !parsedSheets[href]) {
|
244
|
+
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
245
|
+
translate(sheet.styleSheet.rawCssText, href, media);
|
246
|
+
parsedSheets[href] = true;
|
247
|
+
} else {
|
248
|
+
if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) {
|
249
|
+
if (href.substring(0, 2) === "//") {
|
250
|
+
href = w.location.protocol + href;
|
251
|
+
}
|
252
|
+
requestQueue.push({
|
253
|
+
href: href,
|
254
|
+
media: media
|
255
|
+
});
|
256
|
+
}
|
257
|
+
}
|
258
|
+
}
|
259
|
+
}
|
260
|
+
makeRequests();
|
261
|
+
};
|
262
|
+
ripCSS();
|
263
|
+
respond.update = ripCSS;
|
264
|
+
respond.getEmValue = getEmValue;
|
265
|
+
function callMedia() {
|
266
|
+
applyMedia(true);
|
267
|
+
}
|
268
|
+
if (w.addEventListener) {
|
269
|
+
w.addEventListener("resize", callMedia, false);
|
270
|
+
} else if (w.attachEvent) {
|
271
|
+
w.attachEvent("onresize", callMedia);
|
272
|
+
}
|
273
|
+
})(this);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
2
|
+
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
3
|
+
* */
|
4
|
+
|
5
|
+
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
@@ -0,0 +1,224 @@
|
|
1
|
+
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
2
|
+
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
3
|
+
(function(w) {
|
4
|
+
"use strict";
|
5
|
+
w.matchMedia = w.matchMedia || function(doc, undefined) {
|
6
|
+
var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div");
|
7
|
+
div.id = "mq-test-1";
|
8
|
+
div.style.cssText = "position:absolute;top:-100em";
|
9
|
+
fakeBody.style.background = "none";
|
10
|
+
fakeBody.appendChild(div);
|
11
|
+
return function(q) {
|
12
|
+
div.innerHTML = '­<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>';
|
13
|
+
docElem.insertBefore(fakeBody, refNode);
|
14
|
+
bool = div.offsetWidth === 42;
|
15
|
+
docElem.removeChild(fakeBody);
|
16
|
+
return {
|
17
|
+
matches: bool,
|
18
|
+
media: q
|
19
|
+
};
|
20
|
+
};
|
21
|
+
}(w.document);
|
22
|
+
})(this);
|
23
|
+
|
24
|
+
/*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
|
25
|
+
(function(w) {
|
26
|
+
"use strict";
|
27
|
+
var respond = {};
|
28
|
+
w.respond = respond;
|
29
|
+
respond.update = function() {};
|
30
|
+
var requestQueue = [], xmlHttp = function() {
|
31
|
+
var xmlhttpmethod = false;
|
32
|
+
try {
|
33
|
+
xmlhttpmethod = new w.XMLHttpRequest();
|
34
|
+
} catch (e) {
|
35
|
+
xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP");
|
36
|
+
}
|
37
|
+
return function() {
|
38
|
+
return xmlhttpmethod;
|
39
|
+
};
|
40
|
+
}(), ajax = function(url, callback) {
|
41
|
+
var req = xmlHttp();
|
42
|
+
if (!req) {
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
req.open("GET", url, true);
|
46
|
+
req.onreadystatechange = function() {
|
47
|
+
if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
callback(req.responseText);
|
51
|
+
};
|
52
|
+
if (req.readyState === 4) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
req.send(null);
|
56
|
+
};
|
57
|
+
respond.ajax = ajax;
|
58
|
+
respond.queue = requestQueue;
|
59
|
+
respond.regex = {
|
60
|
+
media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
|
61
|
+
keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
|
62
|
+
urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
|
63
|
+
findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
|
64
|
+
only: /(only\s+)?([a-zA-Z]+)\s?/,
|
65
|
+
minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,
|
66
|
+
maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/
|
67
|
+
};
|
68
|
+
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches;
|
69
|
+
if (respond.mediaQueriesSupported) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() {
|
73
|
+
var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false;
|
74
|
+
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
75
|
+
if (!body) {
|
76
|
+
body = fakeUsed = doc.createElement("body");
|
77
|
+
body.style.background = "none";
|
78
|
+
}
|
79
|
+
docElem.style.fontSize = "100%";
|
80
|
+
body.style.fontSize = "100%";
|
81
|
+
body.appendChild(div);
|
82
|
+
if (fakeUsed) {
|
83
|
+
docElem.insertBefore(body, docElem.firstChild);
|
84
|
+
}
|
85
|
+
ret = div.offsetWidth;
|
86
|
+
if (fakeUsed) {
|
87
|
+
docElem.removeChild(body);
|
88
|
+
} else {
|
89
|
+
body.removeChild(div);
|
90
|
+
}
|
91
|
+
docElem.style.fontSize = originalHTMLFontSize;
|
92
|
+
if (originalBodyFontSize) {
|
93
|
+
body.style.fontSize = originalBodyFontSize;
|
94
|
+
}
|
95
|
+
ret = eminpx = parseFloat(ret);
|
96
|
+
return ret;
|
97
|
+
}, applyMedia = function(fromResize) {
|
98
|
+
var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime();
|
99
|
+
if (fromResize && lastCall && now - lastCall < resizeThrottle) {
|
100
|
+
w.clearTimeout(resizeDefer);
|
101
|
+
resizeDefer = w.setTimeout(applyMedia, resizeThrottle);
|
102
|
+
return;
|
103
|
+
} else {
|
104
|
+
lastCall = now;
|
105
|
+
}
|
106
|
+
for (var i in mediastyles) {
|
107
|
+
if (mediastyles.hasOwnProperty(i)) {
|
108
|
+
var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em";
|
109
|
+
if (!!min) {
|
110
|
+
min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1);
|
111
|
+
}
|
112
|
+
if (!!max) {
|
113
|
+
max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1);
|
114
|
+
}
|
115
|
+
if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) {
|
116
|
+
if (!styleBlocks[thisstyle.media]) {
|
117
|
+
styleBlocks[thisstyle.media] = [];
|
118
|
+
}
|
119
|
+
styleBlocks[thisstyle.media].push(rules[thisstyle.rules]);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
for (var j in appendedEls) {
|
124
|
+
if (appendedEls.hasOwnProperty(j)) {
|
125
|
+
if (appendedEls[j] && appendedEls[j].parentNode === head) {
|
126
|
+
head.removeChild(appendedEls[j]);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
appendedEls.length = 0;
|
131
|
+
for (var k in styleBlocks) {
|
132
|
+
if (styleBlocks.hasOwnProperty(k)) {
|
133
|
+
var ss = doc.createElement("style"), css = styleBlocks[k].join("\n");
|
134
|
+
ss.type = "text/css";
|
135
|
+
ss.media = k;
|
136
|
+
head.insertBefore(ss, lastLink.nextSibling);
|
137
|
+
if (ss.styleSheet) {
|
138
|
+
ss.styleSheet.cssText = css;
|
139
|
+
} else {
|
140
|
+
ss.appendChild(doc.createTextNode(css));
|
141
|
+
}
|
142
|
+
appendedEls.push(ss);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}, translate = function(styles, href, media) {
|
146
|
+
var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0;
|
147
|
+
href = href.substring(0, href.lastIndexOf("/"));
|
148
|
+
var repUrls = function(css) {
|
149
|
+
return css.replace(respond.regex.urls, "$1" + href + "$2$3");
|
150
|
+
}, useMedia = !ql && media;
|
151
|
+
if (href.length) {
|
152
|
+
href += "/";
|
153
|
+
}
|
154
|
+
if (useMedia) {
|
155
|
+
ql = 1;
|
156
|
+
}
|
157
|
+
for (var i = 0; i < ql; i++) {
|
158
|
+
var fullq, thisq, eachq, eql;
|
159
|
+
if (useMedia) {
|
160
|
+
fullq = media;
|
161
|
+
rules.push(repUrls(styles));
|
162
|
+
} else {
|
163
|
+
fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1;
|
164
|
+
rules.push(RegExp.$2 && repUrls(RegExp.$2));
|
165
|
+
}
|
166
|
+
eachq = fullq.split(",");
|
167
|
+
eql = eachq.length;
|
168
|
+
for (var j = 0; j < eql; j++) {
|
169
|
+
thisq = eachq[j];
|
170
|
+
mediastyles.push({
|
171
|
+
media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all",
|
172
|
+
rules: rules.length - 1,
|
173
|
+
hasquery: thisq.indexOf("(") > -1,
|
174
|
+
minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
|
175
|
+
maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "")
|
176
|
+
});
|
177
|
+
}
|
178
|
+
}
|
179
|
+
applyMedia();
|
180
|
+
}, makeRequests = function() {
|
181
|
+
if (requestQueue.length) {
|
182
|
+
var thisRequest = requestQueue.shift();
|
183
|
+
ajax(thisRequest.href, function(styles) {
|
184
|
+
translate(styles, thisRequest.href, thisRequest.media);
|
185
|
+
parsedSheets[thisRequest.href] = true;
|
186
|
+
w.setTimeout(function() {
|
187
|
+
makeRequests();
|
188
|
+
}, 0);
|
189
|
+
});
|
190
|
+
}
|
191
|
+
}, ripCSS = function() {
|
192
|
+
for (var i = 0; i < links.length; i++) {
|
193
|
+
var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
194
|
+
if (!!href && isCSS && !parsedSheets[href]) {
|
195
|
+
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
196
|
+
translate(sheet.styleSheet.rawCssText, href, media);
|
197
|
+
parsedSheets[href] = true;
|
198
|
+
} else {
|
199
|
+
if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) {
|
200
|
+
if (href.substring(0, 2) === "//") {
|
201
|
+
href = w.location.protocol + href;
|
202
|
+
}
|
203
|
+
requestQueue.push({
|
204
|
+
href: href,
|
205
|
+
media: media
|
206
|
+
});
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
makeRequests();
|
212
|
+
};
|
213
|
+
ripCSS();
|
214
|
+
respond.update = ripCSS;
|
215
|
+
respond.getEmValue = getEmValue;
|
216
|
+
function callMedia() {
|
217
|
+
applyMedia(true);
|
218
|
+
}
|
219
|
+
if (w.addEventListener) {
|
220
|
+
w.addEventListener("resize", callMedia, false);
|
221
|
+
} else if (w.attachEvent) {
|
222
|
+
w.attachEvent("onresize", callMedia);
|
223
|
+
}
|
224
|
+
})(this);
|