survivalkit 1.0.beta.11 → 1.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/CHANGELOG.markdown +4 -0
  2. data/lib/survivalkit.rb +2 -2
  3. data/stylesheets/survivalkit/fonts/_all.scss +2 -0
  4. data/stylesheets/survivalkit/fonts/_ss-social.scss +136 -0
  5. data/stylesheets/survivalkit/fonts/_ss-standard.scss +426 -0
  6. data/stylesheets/survivalkit/reset/_reset.scss +4 -0
  7. data/templates/clean/manifest.rb +0 -2
  8. data/templates/drupal/manifest.rb +0 -2
  9. data/templates/project/manifest.rb +44 -46
  10. data/templates/project/sources/FitVids/README.md +49 -0
  11. data/templates/project/sources/FitVids/jquery.fitvids.js +80 -0
  12. data/templates/project/sources/FitVids/tests.html +66 -0
  13. data/templates/project/sources/Geared-Scrolling/README.md +31 -0
  14. data/templates/project/sources/Geared-Scrolling/css/specific.css +88 -0
  15. data/templates/project/sources/Geared-Scrolling/images/col1.png +0 -0
  16. data/templates/project/sources/Geared-Scrolling/images/col2.png +0 -0
  17. data/templates/project/sources/Geared-Scrolling/images/col3.png +0 -0
  18. data/templates/project/sources/Geared-Scrolling/images/header.png +0 -0
  19. data/templates/project/sources/Geared-Scrolling/index.html +32 -0
  20. data/templates/project/sources/Geared-Scrolling/js/init.js +11 -0
  21. data/templates/project/sources/Geared-Scrolling/js/jquery.heyday.gearedscrolling.js +283 -0
  22. data/templates/project/sources/Lettering.js/README.md +58 -0
  23. data/templates/project/sources/Lettering.js/examples/index.html +135 -0
  24. data/templates/project/sources/Lettering.js/examples/style.css +171 -0
  25. data/templates/project/sources/Lettering.js/jquery.lettering.js +66 -0
  26. data/templates/project/sources/Respond/README.md +100 -0
  27. data/templates/project/sources/Respond/cross-domain/example.html +24 -0
  28. data/templates/project/sources/Respond/cross-domain/respond-proxy.html +96 -0
  29. data/templates/project/sources/Respond/cross-domain/respond.proxy.gif +0 -0
  30. data/templates/project/sources/Respond/cross-domain/respond.proxy.js +127 -0
  31. data/templates/project/sources/Respond/respond.min.js +6 -0
  32. data/templates/project/sources/Respond/respond.src.js +326 -0
  33. data/templates/project/sources/Respond/test/test.css +80 -0
  34. data/templates/project/sources/Respond/test/test.html +20 -0
  35. data/templates/project/sources/Respond/test/test2.css +8 -0
  36. data/templates/project/sources/Respond/test/unit/index.html +29 -0
  37. data/templates/project/sources/Respond/test/unit/qunit/qunit.css +226 -0
  38. data/templates/project/sources/Respond/test/unit/qunit/qunit.js +1598 -0
  39. data/templates/project/sources/Respond/test/unit/test.css +73 -0
  40. data/templates/project/sources/Respond/test/unit/test2.css +5 -0
  41. data/templates/project/sources/Respond/test/unit/test3.css +5 -0
  42. data/templates/project/sources/Respond/test/unit/tests.js +144 -0
  43. data/templates/project/sources/box-sizing-polyfill/README.md +24 -0
  44. data/templates/project/sources/box-sizing-polyfill/boxsizing.htc +501 -0
  45. data/templates/project/sources/formalize/README.txt +26 -0
  46. data/templates/project/sources/formalize/assets/css/_formalize.sass +326 -0
  47. data/templates/project/sources/formalize/assets/css/demo.css +654 -0
  48. data/templates/project/sources/formalize/assets/css/formalize.css +368 -0
  49. data/templates/project/sources/formalize/assets/css/reset.css +211 -0
  50. data/templates/project/sources/formalize/assets/css/text.css +81 -0
  51. data/templates/project/sources/formalize/assets/images/button.png +0 -0
  52. data/templates/project/sources/formalize/assets/images/select_arrow.gif +0 -0
  53. data/templates/project/sources/formalize/assets/js/dojo.formalize.js +202 -0
  54. data/templates/project/sources/formalize/assets/js/dojo.formalize.min.js +1 -0
  55. data/templates/project/sources/formalize/assets/js/extjs.formalize.js +192 -0
  56. data/templates/project/sources/formalize/assets/js/extjs.formalize.min.js +1 -0
  57. data/templates/project/sources/formalize/assets/js/jquery.formalize.js +181 -0
  58. data/templates/project/sources/formalize/assets/js/jquery.formalize.min.js +1 -0
  59. data/templates/project/sources/formalize/assets/js/mootools.formalize.js +193 -0
  60. data/templates/project/sources/formalize/assets/js/mootools.formalize.min.js +1 -0
  61. data/templates/project/sources/formalize/assets/js/prototype.formalize.js +192 -0
  62. data/templates/project/sources/formalize/assets/js/prototype.formalize.min.js +1 -0
  63. data/templates/project/sources/formalize/assets/js/yui.formalize.js +183 -0
  64. data/templates/project/sources/formalize/assets/js/yui.formalize.min.js +1 -0
  65. data/templates/project/sources/formalize/demo.html +130 -0
  66. data/templates/project/sources/formalize/dojo_demo.html +215 -0
  67. data/templates/project/sources/formalize/dojo_disabled.html +215 -0
  68. data/templates/project/sources/formalize/dojo_errors.html +215 -0
  69. data/templates/project/sources/formalize/extjs_demo.html +215 -0
  70. data/templates/project/sources/formalize/extjs_disabled.html +215 -0
  71. data/templates/project/sources/formalize/extjs_errors.html +215 -0
  72. data/templates/project/sources/formalize/jquery_demo.html +215 -0
  73. data/templates/project/sources/formalize/jquery_disabled.html +215 -0
  74. data/templates/project/sources/formalize/jquery_errors.html +215 -0
  75. data/templates/project/sources/formalize/mootools_demo.html +215 -0
  76. data/templates/project/sources/formalize/mootools_disabled.html +215 -0
  77. data/templates/project/sources/formalize/mootools_errors.html +215 -0
  78. data/templates/project/sources/formalize/prototype_demo.html +215 -0
  79. data/templates/project/sources/formalize/prototype_disabled.html +215 -0
  80. data/templates/project/sources/formalize/prototype_errors.html +215 -0
  81. data/templates/project/sources/formalize/unstyled.html +210 -0
  82. data/templates/project/sources/formalize/yui_demo.html +223 -0
  83. data/templates/project/sources/formalize/yui_disabled.html +223 -0
  84. data/templates/project/sources/formalize/yui_errors.html +223 -0
  85. data/templates/project/sources/iOS-Orientationchange-Fix/README.md +16 -0
  86. data/templates/project/sources/iOS-Orientationchange-Fix/demo.html +43 -0
  87. data/templates/project/sources/iOS-Orientationchange-Fix/ios-orientationchange-fix.js +56 -0
  88. data/templates/project/sources/jQuery-widowFix/index.html +159 -0
  89. data/templates/project/sources/jQuery-widowFix/js/jquery-1.4.3.min.js +166 -0
  90. data/templates/project/sources/jQuery-widowFix/js/jquery.widowFix-1.3.2.js +135 -0
  91. data/templates/project/sources/jQuery-widowFix/js/jquery.widowFix-1.3.2.min.js +10 -0
  92. data/templates/project/sources/jQuery-widowFix/sample.html +84 -0
  93. data/templates/project/sources/jquery-html5-placeholder-shim/jquery.html5-placeholder-shim.js +96 -0
  94. data/templates/project/sources/jquery-html5-placeholder-shim/readme.md +22 -0
  95. data/templates/project/sources/jquery-html5-placeholder-shim/test.html +103 -0
  96. data/templates/project/sources/ss-social/ss-social.js +78 -0
  97. data/templates/project/sources/ss-standard/ss-standard.js +78 -0
  98. data/templates/shared/partials/01-variables/_colors.scss +2 -6
  99. data/templates/shared/partials/01-variables/_fonts.scss +49 -2
  100. data/templates/shared/partials/01-variables/_settings.scss +48 -13
  101. data/templates/shared/partials/04-base/_all.scss +0 -2
  102. data/templates/shared/partials/04-base/_common.scss +0 -4
  103. data/templates/shared/partials/05-layout/_grids-susy.scss +4 -4
  104. data/templates/shared/style.scss +9 -9
  105. metadata +93 -5
  106. data/templates/shared/partials/04-base/_edits.scss +0 -8
  107. data/templates/shared/partials/04-base/_font-face.scss +0 -14
@@ -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,6 @@
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
+ window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);
4
+
5
+ /*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
6
+ (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);
@@ -0,0 +1,326 @@
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
+ window.matchMedia = window.matchMedia || (function(doc, undefined){
4
+
5
+ var bool,
6
+ docElem = doc.documentElement,
7
+ refNode = docElem.firstElementChild || docElem.firstChild,
8
+ // fakeBody required for <FF4 when executed in <head>
9
+ fakeBody = doc.createElement('body'),
10
+ div = doc.createElement('div');
11
+
12
+ div.id = 'mq-test-1';
13
+ div.style.cssText = "position:absolute;top:-100em";
14
+ fakeBody.style.background = "none";
15
+ fakeBody.appendChild(div);
16
+
17
+ return function(q){
18
+
19
+ div.innerHTML = '&shy;<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>';
20
+
21
+ docElem.insertBefore(fakeBody, refNode);
22
+ bool = div.offsetWidth == 42;
23
+ docElem.removeChild(fakeBody);
24
+
25
+ return { matches: bool, media: q };
26
+ };
27
+
28
+ })(document);
29
+
30
+
31
+
32
+
33
+ /*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
34
+ (function( win ){
35
+ //exposed namespace
36
+ win.respond = {};
37
+
38
+ //define update even in native-mq-supporting browsers, to avoid errors
39
+ respond.update = function(){};
40
+
41
+ //expose media query support flag for external use
42
+ respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches;
43
+
44
+ //if media queries are supported, exit here
45
+ if( respond.mediaQueriesSupported ){ return; }
46
+
47
+ //define vars
48
+ var doc = win.document,
49
+ docElem = doc.documentElement,
50
+ mediastyles = [],
51
+ rules = [],
52
+ appendedEls = [],
53
+ parsedSheets = {},
54
+ resizeThrottle = 30,
55
+ head = doc.getElementsByTagName( "head" )[0] || docElem,
56
+ base = doc.getElementsByTagName( "base" )[0],
57
+ links = head.getElementsByTagName( "link" ),
58
+ requestQueue = [],
59
+
60
+ //loop stylesheets, send text content to translate
61
+ ripCSS = function(){
62
+ var sheets = links,
63
+ sl = sheets.length,
64
+ i = 0,
65
+ //vars for loop:
66
+ sheet, href, media, isCSS;
67
+
68
+ for( ; i < sl; i++ ){
69
+ sheet = sheets[ i ],
70
+ href = sheet.href,
71
+ media = sheet.media,
72
+ isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
73
+
74
+ //only links plz and prevent re-parsing
75
+ if( !!href && isCSS && !parsedSheets[ href ] ){
76
+ // selectivizr exposes css through the rawCssText expando
77
+ if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
78
+ translate( sheet.styleSheet.rawCssText, href, media );
79
+ parsedSheets[ href ] = true;
80
+ } else {
81
+ if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base)
82
+ || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
83
+ requestQueue.push( {
84
+ href: href,
85
+ media: media
86
+ } );
87
+ }
88
+ }
89
+ }
90
+ }
91
+ makeRequests();
92
+ },
93
+
94
+ //recurse through request queue, get css text
95
+ makeRequests = function(){
96
+ if( requestQueue.length ){
97
+ var thisRequest = requestQueue.shift();
98
+
99
+ ajax( thisRequest.href, function( styles ){
100
+ translate( styles, thisRequest.href, thisRequest.media );
101
+ parsedSheets[ thisRequest.href ] = true;
102
+ makeRequests();
103
+ } );
104
+ }
105
+ },
106
+
107
+ //find media blocks in css text, convert to style blocks
108
+ translate = function( styles, href, media ){
109
+ var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ),
110
+ ql = qs && qs.length || 0,
111
+ //try to get CSS path
112
+ href = href.substring( 0, href.lastIndexOf( "/" )),
113
+ repUrls = function( css ){
114
+ return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" );
115
+ },
116
+ useMedia = !ql && media,
117
+ //vars used in loop
118
+ i = 0,
119
+ j, fullq, thisq, eachq, eql;
120
+
121
+ //if path exists, tack on trailing slash
122
+ if( href.length ){ href += "/"; }
123
+
124
+ //if no internal queries exist, but media attr does, use that
125
+ //note: this currently lacks support for situations where a media attr is specified on a link AND
126
+ //its associated stylesheet has internal CSS media queries.
127
+ //In those cases, the media attribute will currently be ignored.
128
+ if( useMedia ){
129
+ ql = 1;
130
+ }
131
+
132
+
133
+ for( ; i < ql; i++ ){
134
+ j = 0;
135
+
136
+ //media attr
137
+ if( useMedia ){
138
+ fullq = media;
139
+ rules.push( repUrls( styles ) );
140
+ }
141
+ //parse for styles
142
+ else{
143
+ fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1;
144
+ rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
145
+ }
146
+
147
+ eachq = fullq.split( "," );
148
+ eql = eachq.length;
149
+
150
+ for( ; j < eql; j++ ){
151
+ thisq = eachq[ j ];
152
+ mediastyles.push( {
153
+ media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
154
+ rules : rules.length - 1,
155
+ hasquery: thisq.indexOf("(") > -1,
156
+ minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
157
+ maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
158
+ } );
159
+ }
160
+ }
161
+
162
+ applyMedia();
163
+ },
164
+
165
+ lastCall,
166
+
167
+ resizeDefer,
168
+
169
+ // returns the value of 1em in pixels
170
+ getEmValue = function() {
171
+ var ret,
172
+ div = doc.createElement('div'),
173
+ body = doc.body,
174
+ fakeUsed = false;
175
+
176
+ div.style.cssText = "position:absolute;font-size:1em;width:1em";
177
+
178
+ if( !body ){
179
+ body = fakeUsed = doc.createElement( "body" );
180
+ body.style.background = "none";
181
+ }
182
+
183
+ body.appendChild( div );
184
+
185
+ docElem.insertBefore( body, docElem.firstChild );
186
+
187
+ ret = div.offsetWidth;
188
+
189
+ if( fakeUsed ){
190
+ docElem.removeChild( body );
191
+ }
192
+ else {
193
+ body.removeChild( div );
194
+ }
195
+
196
+ //also update eminpx before returning
197
+ ret = eminpx = parseFloat(ret);
198
+
199
+ return ret;
200
+ },
201
+
202
+ //cached container for 1em value, populated the first time it's needed
203
+ eminpx,
204
+
205
+ //enable/disable styles
206
+ applyMedia = function( fromResize ){
207
+ var name = "clientWidth",
208
+ docElemProp = docElem[ name ],
209
+ currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
210
+ styleBlocks = {},
211
+ lastLink = links[ links.length-1 ],
212
+ now = (new Date()).getTime();
213
+
214
+ //throttle resize calls
215
+ if( fromResize && lastCall && now - lastCall < resizeThrottle ){
216
+ clearTimeout( resizeDefer );
217
+ resizeDefer = setTimeout( applyMedia, resizeThrottle );
218
+ return;
219
+ }
220
+ else {
221
+ lastCall = now;
222
+ }
223
+
224
+ for( var i in mediastyles ){
225
+ var thisstyle = mediastyles[ i ],
226
+ min = thisstyle.minw,
227
+ max = thisstyle.maxw,
228
+ minnull = min === null,
229
+ maxnull = max === null,
230
+ em = "em";
231
+
232
+ if( !!min ){
233
+ min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
234
+ }
235
+ if( !!max ){
236
+ max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
237
+ }
238
+
239
+ // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
240
+ if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
241
+ if( !styleBlocks[ thisstyle.media ] ){
242
+ styleBlocks[ thisstyle.media ] = [];
243
+ }
244
+ styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
245
+ }
246
+ }
247
+
248
+ //remove any existing respond style element(s)
249
+ for( var i in appendedEls ){
250
+ if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){
251
+ head.removeChild( appendedEls[ i ] );
252
+ }
253
+ }
254
+
255
+ //inject active styles, grouped by media type
256
+ for( var i in styleBlocks ){
257
+ var ss = doc.createElement( "style" ),
258
+ css = styleBlocks[ i ].join( "\n" );
259
+
260
+ ss.type = "text/css";
261
+ ss.media = i;
262
+
263
+ //originally, ss was appended to a documentFragment and sheets were appended in bulk.
264
+ //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
265
+ head.insertBefore( ss, lastLink.nextSibling );
266
+
267
+ if ( ss.styleSheet ){
268
+ ss.styleSheet.cssText = css;
269
+ }
270
+ else {
271
+ ss.appendChild( doc.createTextNode( css ) );
272
+ }
273
+
274
+ //push to appendedEls to track for later removal
275
+ appendedEls.push( ss );
276
+ }
277
+ },
278
+ //tweaked Ajax functions from Quirksmode
279
+ ajax = function( url, callback ) {
280
+ var req = xmlHttp();
281
+ if (!req){
282
+ return;
283
+ }
284
+ req.open( "GET", url, true );
285
+ req.onreadystatechange = function () {
286
+ if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){
287
+ return;
288
+ }
289
+ callback( req.responseText );
290
+ }
291
+ if ( req.readyState == 4 ){
292
+ return;
293
+ }
294
+ req.send( null );
295
+ },
296
+ //define ajax obj
297
+ xmlHttp = (function() {
298
+ var xmlhttpmethod = false;
299
+ try {
300
+ xmlhttpmethod = new XMLHttpRequest();
301
+ }
302
+ catch( e ){
303
+ xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" );
304
+ }
305
+ return function(){
306
+ return xmlhttpmethod;
307
+ };
308
+ })();
309
+
310
+ //translate CSS
311
+ ripCSS();
312
+
313
+ //expose update for re-running respond later on
314
+ respond.update = ripCSS;
315
+
316
+ //adjust on resize
317
+ function callMedia(){
318
+ applyMedia( true );
319
+ }
320
+ if( win.addEventListener ){
321
+ win.addEventListener( "resize", callMedia, false );
322
+ }
323
+ else if( win.attachEvent ){
324
+ win.attachEvent( "onresize", callMedia );
325
+ }
326
+ })(this);