middleman-hashicorp 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +12 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +21 -0
  6. data/Makefile +21 -0
  7. data/README.md +183 -0
  8. data/Rakefile +11 -0
  9. data/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  10. data/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  11. data/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  12. data/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  13. data/assets/images/fastly_logo.png +0 -0
  14. data/assets/images/icons/icon_centos.png +0 -0
  15. data/assets/images/icons/icon_darwin.png +0 -0
  16. data/assets/images/icons/icon_debian.png +0 -0
  17. data/assets/images/icons/icon_freebsd.png +0 -0
  18. data/assets/images/icons/icon_hashios.png +0 -0
  19. data/assets/images/icons/icon_linux.png +0 -0
  20. data/assets/images/icons/icon_macosx.png +0 -0
  21. data/assets/images/icons/icon_netbsd.png +0 -0
  22. data/assets/images/icons/icon_openbsd.png +0 -0
  23. data/assets/images/icons/icon_rpm.png +0 -0
  24. data/assets/images/icons/icon_solaris.png +0 -0
  25. data/assets/images/icons/icon_windows.png +0 -0
  26. data/assets/javascripts/bootstrap.js +2114 -0
  27. data/assets/javascripts/ie-compat.js +1 -0
  28. data/assets/javascripts/ie-compat/html5shiv-printshiv.js +520 -0
  29. data/assets/javascripts/ie-compat/html5shiv.js +322 -0
  30. data/assets/javascripts/ie-compat/respond.js +353 -0
  31. data/assets/javascripts/jquery.js +9190 -0
  32. data/docker/Dockerfile +22 -0
  33. data/lib/middleman-hashicorp.rb +6 -0
  34. data/lib/middleman-hashicorp/bintray.rb +98 -0
  35. data/lib/middleman-hashicorp/extension.rb +237 -0
  36. data/lib/middleman-hashicorp/redcarpet.rb +134 -0
  37. data/lib/middleman-hashicorp/releases.rb +32 -0
  38. data/lib/middleman-hashicorp/rouge.rb +16 -0
  39. data/lib/middleman-hashicorp/version.rb +5 -0
  40. data/lib/middleman_extension.rb +1 -0
  41. data/middleman-hashicorp.gemspec +48 -0
  42. data/spec/spec_helper.rb +34 -0
  43. data/spec/unit/helper_spec.rb +71 -0
  44. data/spec/unit/markdown_spec.rb +206 -0
  45. data/spec/unit/releases_spec.rb +34 -0
  46. metadata +330 -0
@@ -0,0 +1,322 @@
1
+ /**
2
+ * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3
+ */
4
+ ;(function(window, document) {
5
+ /*jshint evil:true */
6
+ /** version */
7
+ var version = '3.7.2';
8
+
9
+ /** Preset options */
10
+ var options = window.html5 || {};
11
+
12
+ /** Used to skip problem elements */
13
+ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
14
+
15
+ /** Not all elements can be cloned in IE **/
16
+ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
17
+
18
+ /** Detect whether the browser supports default html5 styles */
19
+ var supportsHtml5Styles;
20
+
21
+ /** Name of the expando, to work with multiple documents or to re-shiv one document */
22
+ var expando = '_html5shiv';
23
+
24
+ /** The id for the the documents expando */
25
+ var expanID = 0;
26
+
27
+ /** Cached data for each document */
28
+ var expandoData = {};
29
+
30
+ /** Detect whether the browser supports unknown elements */
31
+ var supportsUnknownElements;
32
+
33
+ (function() {
34
+ try {
35
+ var a = document.createElement('a');
36
+ a.innerHTML = '<xyz></xyz>';
37
+ //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
38
+ supportsHtml5Styles = ('hidden' in a);
39
+
40
+ supportsUnknownElements = a.childNodes.length == 1 || (function() {
41
+ // assign a false positive if unable to shiv
42
+ (document.createElement)('a');
43
+ var frag = document.createDocumentFragment();
44
+ return (
45
+ typeof frag.cloneNode == 'undefined' ||
46
+ typeof frag.createDocumentFragment == 'undefined' ||
47
+ typeof frag.createElement == 'undefined'
48
+ );
49
+ }());
50
+ } catch(e) {
51
+ // assign a false positive if detection fails => unable to shiv
52
+ supportsHtml5Styles = true;
53
+ supportsUnknownElements = true;
54
+ }
55
+
56
+ }());
57
+
58
+ /*--------------------------------------------------------------------------*/
59
+
60
+ /**
61
+ * Creates a style sheet with the given CSS text and adds it to the document.
62
+ * @private
63
+ * @param {Document} ownerDocument The document.
64
+ * @param {String} cssText The CSS text.
65
+ * @returns {StyleSheet} The style element.
66
+ */
67
+ function addStyleSheet(ownerDocument, cssText) {
68
+ var p = ownerDocument.createElement('p'),
69
+ parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
70
+
71
+ p.innerHTML = 'x<style>' + cssText + '</style>';
72
+ return parent.insertBefore(p.lastChild, parent.firstChild);
73
+ }
74
+
75
+ /**
76
+ * Returns the value of `html5.elements` as an array.
77
+ * @private
78
+ * @returns {Array} An array of shived element node names.
79
+ */
80
+ function getElements() {
81
+ var elements = html5.elements;
82
+ return typeof elements == 'string' ? elements.split(' ') : elements;
83
+ }
84
+
85
+ /**
86
+ * Extends the built-in list of html5 elements
87
+ * @memberOf html5
88
+ * @param {String|Array} newElements whitespace separated list or array of new element names to shiv
89
+ * @param {Document} ownerDocument The context document.
90
+ */
91
+ function addElements(newElements, ownerDocument) {
92
+ var elements = html5.elements;
93
+ if(typeof elements != 'string'){
94
+ elements = elements.join(' ');
95
+ }
96
+ if(typeof newElements != 'string'){
97
+ newElements = newElements.join(' ');
98
+ }
99
+ html5.elements = elements +' '+ newElements;
100
+ shivDocument(ownerDocument);
101
+ }
102
+
103
+ /**
104
+ * Returns the data associated to the given document
105
+ * @private
106
+ * @param {Document} ownerDocument The document.
107
+ * @returns {Object} An object of data.
108
+ */
109
+ function getExpandoData(ownerDocument) {
110
+ var data = expandoData[ownerDocument[expando]];
111
+ if (!data) {
112
+ data = {};
113
+ expanID++;
114
+ ownerDocument[expando] = expanID;
115
+ expandoData[expanID] = data;
116
+ }
117
+ return data;
118
+ }
119
+
120
+ /**
121
+ * returns a shived element for the given nodeName and document
122
+ * @memberOf html5
123
+ * @param {String} nodeName name of the element
124
+ * @param {Document} ownerDocument The context document.
125
+ * @returns {Object} The shived element.
126
+ */
127
+ function createElement(nodeName, ownerDocument, data){
128
+ if (!ownerDocument) {
129
+ ownerDocument = document;
130
+ }
131
+ if(supportsUnknownElements){
132
+ return ownerDocument.createElement(nodeName);
133
+ }
134
+ if (!data) {
135
+ data = getExpandoData(ownerDocument);
136
+ }
137
+ var node;
138
+
139
+ if (data.cache[nodeName]) {
140
+ node = data.cache[nodeName].cloneNode();
141
+ } else if (saveClones.test(nodeName)) {
142
+ node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
143
+ } else {
144
+ node = data.createElem(nodeName);
145
+ }
146
+
147
+ // Avoid adding some elements to fragments in IE < 9 because
148
+ // * Attributes like `name` or `type` cannot be set/changed once an element
149
+ // is inserted into a document/fragment
150
+ // * Link elements with `src` attributes that are inaccessible, as with
151
+ // a 403 response, will cause the tab/window to crash
152
+ // * Script elements appended to fragments will execute when their `src`
153
+ // or `text` property is set
154
+ return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
155
+ }
156
+
157
+ /**
158
+ * returns a shived DocumentFragment for the given document
159
+ * @memberOf html5
160
+ * @param {Document} ownerDocument The context document.
161
+ * @returns {Object} The shived DocumentFragment.
162
+ */
163
+ function createDocumentFragment(ownerDocument, data){
164
+ if (!ownerDocument) {
165
+ ownerDocument = document;
166
+ }
167
+ if(supportsUnknownElements){
168
+ return ownerDocument.createDocumentFragment();
169
+ }
170
+ data = data || getExpandoData(ownerDocument);
171
+ var clone = data.frag.cloneNode(),
172
+ i = 0,
173
+ elems = getElements(),
174
+ l = elems.length;
175
+ for(;i<l;i++){
176
+ clone.createElement(elems[i]);
177
+ }
178
+ return clone;
179
+ }
180
+
181
+ /**
182
+ * Shivs the `createElement` and `createDocumentFragment` methods of the document.
183
+ * @private
184
+ * @param {Document|DocumentFragment} ownerDocument The document.
185
+ * @param {Object} data of the document.
186
+ */
187
+ function shivMethods(ownerDocument, data) {
188
+ if (!data.cache) {
189
+ data.cache = {};
190
+ data.createElem = ownerDocument.createElement;
191
+ data.createFrag = ownerDocument.createDocumentFragment;
192
+ data.frag = data.createFrag();
193
+ }
194
+
195
+
196
+ ownerDocument.createElement = function(nodeName) {
197
+ //abort shiv
198
+ if (!html5.shivMethods) {
199
+ return data.createElem(nodeName);
200
+ }
201
+ return createElement(nodeName, ownerDocument, data);
202
+ };
203
+
204
+ ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
205
+ 'var n=f.cloneNode(),c=n.createElement;' +
206
+ 'h.shivMethods&&(' +
207
+ // unroll the `createElement` calls
208
+ getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
209
+ data.createElem(nodeName);
210
+ data.frag.createElement(nodeName);
211
+ return 'c("' + nodeName + '")';
212
+ }) +
213
+ ');return n}'
214
+ )(html5, data.frag);
215
+ }
216
+
217
+ /*--------------------------------------------------------------------------*/
218
+
219
+ /**
220
+ * Shivs the given document.
221
+ * @memberOf html5
222
+ * @param {Document} ownerDocument The document to shiv.
223
+ * @returns {Document} The shived document.
224
+ */
225
+ function shivDocument(ownerDocument) {
226
+ if (!ownerDocument) {
227
+ ownerDocument = document;
228
+ }
229
+ var data = getExpandoData(ownerDocument);
230
+
231
+ if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
232
+ data.hasCSS = !!addStyleSheet(ownerDocument,
233
+ // corrects block display not defined in IE6/7/8/9
234
+ 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
235
+ // adds styling not present in IE6/7/8/9
236
+ 'mark{background:#FF0;color:#000}' +
237
+ // hides non-rendered elements
238
+ 'template{display:none}'
239
+ );
240
+ }
241
+ if (!supportsUnknownElements) {
242
+ shivMethods(ownerDocument, data);
243
+ }
244
+ return ownerDocument;
245
+ }
246
+
247
+ /*--------------------------------------------------------------------------*/
248
+
249
+ /**
250
+ * The `html5` object is exposed so that more elements can be shived and
251
+ * existing shiving can be detected on iframes.
252
+ * @type Object
253
+ * @example
254
+ *
255
+ * // options can be changed before the script is included
256
+ * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
257
+ */
258
+ var html5 = {
259
+
260
+ /**
261
+ * An array or space separated string of node names of the elements to shiv.
262
+ * @memberOf html5
263
+ * @type Array|String
264
+ */
265
+ 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
266
+
267
+ /**
268
+ * current version of html5shiv
269
+ */
270
+ 'version': version,
271
+
272
+ /**
273
+ * A flag to indicate that the HTML5 style sheet should be inserted.
274
+ * @memberOf html5
275
+ * @type Boolean
276
+ */
277
+ 'shivCSS': (options.shivCSS !== false),
278
+
279
+ /**
280
+ * Is equal to true if a browser supports creating unknown/HTML5 elements
281
+ * @memberOf html5
282
+ * @type boolean
283
+ */
284
+ 'supportsUnknownElements': supportsUnknownElements,
285
+
286
+ /**
287
+ * A flag to indicate that the document's `createElement` and `createDocumentFragment`
288
+ * methods should be overwritten.
289
+ * @memberOf html5
290
+ * @type Boolean
291
+ */
292
+ 'shivMethods': (options.shivMethods !== false),
293
+
294
+ /**
295
+ * A string to describe the type of `html5` object ("default" or "default print").
296
+ * @memberOf html5
297
+ * @type String
298
+ */
299
+ 'type': 'default',
300
+
301
+ // shivs the document according to the specified `html5` object options
302
+ 'shivDocument': shivDocument,
303
+
304
+ //creates a shived element
305
+ createElement: createElement,
306
+
307
+ //creates a shived documentFragment
308
+ createDocumentFragment: createDocumentFragment,
309
+
310
+ //extends list of elements
311
+ addElements: addElements
312
+ };
313
+
314
+ /*--------------------------------------------------------------------------*/
315
+
316
+ // expose html5
317
+ window.html5 = html5;
318
+
319
+ // shiv the document
320
+ shivDocument(document);
321
+
322
+ }(this, document));
@@ -0,0 +1,353 @@
1
+ /* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
2
+ (function( w ){
3
+
4
+ "use strict";
5
+
6
+ //exposed namespace
7
+ var respond = {};
8
+ w.respond = respond;
9
+
10
+ //define update even in native-mq-supporting browsers, to avoid errors
11
+ respond.update = function(){};
12
+
13
+ //define ajax obj
14
+ var requestQueue = [],
15
+ xmlHttp = (function() {
16
+ var xmlhttpmethod = false;
17
+ try {
18
+ xmlhttpmethod = new w.XMLHttpRequest();
19
+ }
20
+ catch( e ){
21
+ xmlhttpmethod = new w.ActiveXObject( "Microsoft.XMLHTTP" );
22
+ }
23
+ return function(){
24
+ return xmlhttpmethod;
25
+ };
26
+ })(),
27
+
28
+ //tweaked Ajax functions from Quirksmode
29
+ ajax = function( url, callback ) {
30
+ var req = xmlHttp();
31
+ if (!req){
32
+ return;
33
+ }
34
+ req.open( "GET", url, true );
35
+ req.onreadystatechange = function () {
36
+ if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){
37
+ return;
38
+ }
39
+ callback( req.responseText );
40
+ };
41
+ if ( req.readyState === 4 ){
42
+ return;
43
+ }
44
+ req.send( null );
45
+ },
46
+ isUnsupportedMediaQuery = function( query ) {
47
+ return query.replace( respond.regex.minmaxwh, '' ).match( respond.regex.other );
48
+ };
49
+
50
+ //expose for testing
51
+ respond.ajax = ajax;
52
+ respond.queue = requestQueue;
53
+ respond.unsupportedmq = isUnsupportedMediaQuery;
54
+ respond.regex = {
55
+ media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
56
+ keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
57
+ comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
58
+ urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
59
+ findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
60
+ only: /(only\s+)?([a-zA-Z]+)\s?/,
61
+ minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
62
+ maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
63
+ minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,
64
+ other: /\([^\)]*\)/g
65
+ };
66
+
67
+ //expose media query support flag for external use
68
+ respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches;
69
+
70
+ //if media queries are supported, exit here
71
+ if( respond.mediaQueriesSupported ){
72
+ return;
73
+ }
74
+
75
+ //define vars
76
+ var doc = w.document,
77
+ docElem = doc.documentElement,
78
+ mediastyles = [],
79
+ rules = [],
80
+ appendedEls = [],
81
+ parsedSheets = {},
82
+ resizeThrottle = 30,
83
+ head = doc.getElementsByTagName( "head" )[0] || docElem,
84
+ base = doc.getElementsByTagName( "base" )[0],
85
+ links = head.getElementsByTagName( "link" ),
86
+
87
+ lastCall,
88
+ resizeDefer,
89
+
90
+ //cached container for 1em value, populated the first time it's needed
91
+ eminpx,
92
+
93
+ // returns the value of 1em in pixels
94
+ getEmValue = function() {
95
+ var ret,
96
+ div = doc.createElement('div'),
97
+ body = doc.body,
98
+ originalHTMLFontSize = docElem.style.fontSize,
99
+ originalBodyFontSize = body && body.style.fontSize,
100
+ fakeUsed = false;
101
+
102
+ div.style.cssText = "position:absolute;font-size:1em;width:1em";
103
+
104
+ if( !body ){
105
+ body = fakeUsed = doc.createElement( "body" );
106
+ body.style.background = "none";
107
+ }
108
+
109
+ // 1em in a media query is the value of the default font size of the browser
110
+ // reset docElem and body to ensure the correct value is returned
111
+ docElem.style.fontSize = "100%";
112
+ body.style.fontSize = "100%";
113
+
114
+ body.appendChild( div );
115
+
116
+ if( fakeUsed ){
117
+ docElem.insertBefore( body, docElem.firstChild );
118
+ }
119
+
120
+ ret = div.offsetWidth;
121
+
122
+ if( fakeUsed ){
123
+ docElem.removeChild( body );
124
+ }
125
+ else {
126
+ body.removeChild( div );
127
+ }
128
+
129
+ // restore the original values
130
+ docElem.style.fontSize = originalHTMLFontSize;
131
+ if( originalBodyFontSize ) {
132
+ body.style.fontSize = originalBodyFontSize;
133
+ }
134
+
135
+
136
+ //also update eminpx before returning
137
+ ret = eminpx = parseFloat(ret);
138
+
139
+ return ret;
140
+ },
141
+
142
+ //enable/disable styles
143
+ applyMedia = function( fromResize ){
144
+ var name = "clientWidth",
145
+ docElemProp = docElem[ name ],
146
+ currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
147
+ styleBlocks = {},
148
+ lastLink = links[ links.length-1 ],
149
+ now = (new Date()).getTime();
150
+
151
+ //throttle resize calls
152
+ if( fromResize && lastCall && now - lastCall < resizeThrottle ){
153
+ w.clearTimeout( resizeDefer );
154
+ resizeDefer = w.setTimeout( applyMedia, resizeThrottle );
155
+ return;
156
+ }
157
+ else {
158
+ lastCall = now;
159
+ }
160
+
161
+ for( var i in mediastyles ){
162
+ if( mediastyles.hasOwnProperty( i ) ){
163
+ var thisstyle = mediastyles[ i ],
164
+ min = thisstyle.minw,
165
+ max = thisstyle.maxw,
166
+ minnull = min === null,
167
+ maxnull = max === null,
168
+ em = "em";
169
+
170
+ if( !!min ){
171
+ min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
172
+ }
173
+ if( !!max ){
174
+ max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
175
+ }
176
+
177
+ // 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
178
+ if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
179
+ if( !styleBlocks[ thisstyle.media ] ){
180
+ styleBlocks[ thisstyle.media ] = [];
181
+ }
182
+ styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
183
+ }
184
+ }
185
+ }
186
+
187
+ //remove any existing respond style element(s)
188
+ for( var j in appendedEls ){
189
+ if( appendedEls.hasOwnProperty( j ) ){
190
+ if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){
191
+ head.removeChild( appendedEls[ j ] );
192
+ }
193
+ }
194
+ }
195
+ appendedEls.length = 0;
196
+
197
+ //inject active styles, grouped by media type
198
+ for( var k in styleBlocks ){
199
+ if( styleBlocks.hasOwnProperty( k ) ){
200
+ var ss = doc.createElement( "style" ),
201
+ css = styleBlocks[ k ].join( "\n" );
202
+
203
+ ss.type = "text/css";
204
+ ss.media = k;
205
+
206
+ //originally, ss was appended to a documentFragment and sheets were appended in bulk.
207
+ //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!
208
+ head.insertBefore( ss, lastLink.nextSibling );
209
+
210
+ if ( ss.styleSheet ){
211
+ ss.styleSheet.cssText = css;
212
+ }
213
+ else {
214
+ ss.appendChild( doc.createTextNode( css ) );
215
+ }
216
+
217
+ //push to appendedEls to track for later removal
218
+ appendedEls.push( ss );
219
+ }
220
+ }
221
+ },
222
+ //find media blocks in css text, convert to style blocks
223
+ translate = function( styles, href, media ){
224
+ var qs = styles.replace( respond.regex.comments, '' )
225
+ .replace( respond.regex.keyframes, '' )
226
+ .match( respond.regex.media ),
227
+ ql = qs && qs.length || 0;
228
+
229
+ //try to get CSS path
230
+ href = href.substring( 0, href.lastIndexOf( "/" ) );
231
+
232
+ var repUrls = function( css ){
233
+ return css.replace( respond.regex.urls, "$1" + href + "$2$3" );
234
+ },
235
+ useMedia = !ql && media;
236
+
237
+ //if path exists, tack on trailing slash
238
+ if( href.length ){ href += "/"; }
239
+
240
+ //if no internal queries exist, but media attr does, use that
241
+ //note: this currently lacks support for situations where a media attr is specified on a link AND
242
+ //its associated stylesheet has internal CSS media queries.
243
+ //In those cases, the media attribute will currently be ignored.
244
+ if( useMedia ){
245
+ ql = 1;
246
+ }
247
+
248
+ for( var i = 0; i < ql; i++ ){
249
+ var fullq, thisq, eachq, eql;
250
+
251
+ //media attr
252
+ if( useMedia ){
253
+ fullq = media;
254
+ rules.push( repUrls( styles ) );
255
+ }
256
+ //parse for styles
257
+ else{
258
+ fullq = qs[ i ].match( respond.regex.findStyles ) && RegExp.$1;
259
+ rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
260
+ }
261
+
262
+ eachq = fullq.split( "," );
263
+ eql = eachq.length;
264
+
265
+ for( var j = 0; j < eql; j++ ){
266
+ thisq = eachq[ j ];
267
+
268
+ if( isUnsupportedMediaQuery( thisq ) ) {
269
+ continue;
270
+ }
271
+
272
+ mediastyles.push( {
273
+ media : thisq.split( "(" )[ 0 ].match( respond.regex.only ) && RegExp.$2 || "all",
274
+ rules : rules.length - 1,
275
+ hasquery : thisq.indexOf("(") > -1,
276
+ minw : thisq.match( respond.regex.minw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
277
+ maxw : thisq.match( respond.regex.maxw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
278
+ } );
279
+ }
280
+ }
281
+
282
+ applyMedia();
283
+ },
284
+
285
+ //recurse through request queue, get css text
286
+ makeRequests = function(){
287
+ if( requestQueue.length ){
288
+ var thisRequest = requestQueue.shift();
289
+
290
+ ajax( thisRequest.href, function( styles ){
291
+ translate( styles, thisRequest.href, thisRequest.media );
292
+ parsedSheets[ thisRequest.href ] = true;
293
+
294
+ // by wrapping recursive function call in setTimeout
295
+ // we prevent "Stack overflow" error in IE7
296
+ w.setTimeout(function(){ makeRequests(); },0);
297
+ } );
298
+ }
299
+ },
300
+
301
+ //loop stylesheets, send text content to translate
302
+ ripCSS = function(){
303
+
304
+ for( var i = 0; i < links.length; i++ ){
305
+ var sheet = links[ i ],
306
+ href = sheet.href,
307
+ media = sheet.media,
308
+ isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
309
+
310
+ //only links plz and prevent re-parsing
311
+ if( !!href && isCSS && !parsedSheets[ href ] ){
312
+ // selectivizr exposes css through the rawCssText expando
313
+ if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
314
+ translate( sheet.styleSheet.rawCssText, href, media );
315
+ parsedSheets[ href ] = true;
316
+ } else {
317
+ if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) ||
318
+ href.replace( RegExp.$1, "" ).split( "/" )[0] === w.location.host ){
319
+ // IE7 doesn't handle urls that start with '//' for ajax request
320
+ // manually add in the protocol
321
+ if ( href.substring(0,2) === "//" ) { href = w.location.protocol + href; }
322
+ requestQueue.push( {
323
+ href: href,
324
+ media: media
325
+ } );
326
+ }
327
+ }
328
+ }
329
+ }
330
+ makeRequests();
331
+ };
332
+
333
+ //translate CSS
334
+ ripCSS();
335
+
336
+ //expose update for re-running respond later on
337
+ respond.update = ripCSS;
338
+
339
+ //expose getEmValue
340
+ respond.getEmValue = getEmValue;
341
+
342
+ //adjust on resize
343
+ function callMedia(){
344
+ applyMedia( true );
345
+ }
346
+
347
+ if( w.addEventListener ){
348
+ w.addEventListener( "resize", callMedia, false );
349
+ }
350
+ else if( w.attachEvent ){
351
+ w.attachEvent( "onresize", callMedia );
352
+ }
353
+ })(this);