d/missing-sources: update
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
Youhei SASAKI
6 years ago
0 | /*! normalize.css v3.0.1 | MIT License | git.io/normalize */ | |
1 | ||
2 | /** | |
3 | * 1. Set default font family to sans-serif. | |
4 | * 2. Prevent iOS text size adjust after orientation change, without disabling | |
5 | * user zoom. | |
6 | */ | |
7 | ||
8 | html { | |
9 | font-family: sans-serif; /* 1 */ | |
10 | -ms-text-size-adjust: 100%; /* 2 */ | |
11 | -webkit-text-size-adjust: 100%; /* 2 */ | |
12 | } | |
13 | ||
14 | /** | |
15 | * Remove default margin. | |
16 | */ | |
17 | ||
18 | body { | |
19 | margin: 0; | |
20 | } | |
21 | ||
22 | /* HTML5 display definitions | |
23 | ========================================================================== */ | |
24 | ||
25 | /** | |
26 | * Correct `block` display not defined for any HTML5 element in IE 8/9. | |
27 | * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. | |
28 | * Correct `block` display not defined for `main` in IE 11. | |
29 | */ | |
30 | ||
31 | article, | |
32 | aside, | |
33 | details, | |
34 | figcaption, | |
35 | figure, | |
36 | footer, | |
37 | header, | |
38 | hgroup, | |
39 | main, | |
40 | nav, | |
41 | section, | |
42 | summary { | |
43 | display: block; | |
44 | } | |
45 | ||
46 | /** | |
47 | * 1. Correct `inline-block` display not defined in IE 8/9. | |
48 | * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. | |
49 | */ | |
50 | ||
51 | audio, | |
52 | canvas, | |
53 | progress, | |
54 | video { | |
55 | display: inline-block; /* 1 */ | |
56 | vertical-align: baseline; /* 2 */ | |
57 | } | |
58 | ||
59 | /** | |
60 | * Prevent modern browsers from displaying `audio` without controls. | |
61 | * Remove excess height in iOS 5 devices. | |
62 | */ | |
63 | ||
64 | audio:not([controls]) { | |
65 | display: none; | |
66 | height: 0; | |
67 | } | |
68 | ||
69 | /** | |
70 | * Address `[hidden]` styling not present in IE 8/9/10. | |
71 | * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. | |
72 | */ | |
73 | ||
74 | [hidden], | |
75 | template { | |
76 | display: none; | |
77 | } | |
78 | ||
79 | /* Links | |
80 | ========================================================================== */ | |
81 | ||
82 | /** | |
83 | * Remove the gray background color from active links in IE 10. | |
84 | */ | |
85 | ||
86 | a { | |
87 | background: transparent; | |
88 | } | |
89 | ||
90 | /** | |
91 | * Improve readability when focused and also mouse hovered in all browsers. | |
92 | */ | |
93 | ||
94 | a:active, | |
95 | a:hover { | |
96 | outline: 0; | |
97 | } | |
98 | ||
99 | /* Text-level semantics | |
100 | ========================================================================== */ | |
101 | ||
102 | /** | |
103 | * Address styling not present in IE 8/9/10/11, Safari, and Chrome. | |
104 | */ | |
105 | ||
106 | abbr[title] { | |
107 | border-bottom: 1px dotted; | |
108 | } | |
109 | ||
110 | /** | |
111 | * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. | |
112 | */ | |
113 | ||
114 | b, | |
115 | strong { | |
116 | font-weight: bold; | |
117 | } | |
118 | ||
119 | /** | |
120 | * Address styling not present in Safari and Chrome. | |
121 | */ | |
122 | ||
123 | dfn { | |
124 | font-style: italic; | |
125 | } | |
126 | ||
127 | /** | |
128 | * Address variable `h1` font-size and margin within `section` and `article` | |
129 | * contexts in Firefox 4+, Safari, and Chrome. | |
130 | */ | |
131 | ||
132 | h1 { | |
133 | font-size: 2em; | |
134 | margin: 0.67em 0; | |
135 | } | |
136 | ||
137 | /** | |
138 | * Address styling not present in IE 8/9. | |
139 | */ | |
140 | ||
141 | mark { | |
142 | background: #ff0; | |
143 | color: #000; | |
144 | } | |
145 | ||
146 | /** | |
147 | * Address inconsistent and variable font size in all browsers. | |
148 | */ | |
149 | ||
150 | small { | |
151 | font-size: 80%; | |
152 | } | |
153 | ||
154 | /** | |
155 | * Prevent `sub` and `sup` affecting `line-height` in all browsers. | |
156 | */ | |
157 | ||
158 | sub, | |
159 | sup { | |
160 | font-size: 75%; | |
161 | line-height: 0; | |
162 | position: relative; | |
163 | vertical-align: baseline; | |
164 | } | |
165 | ||
166 | sup { | |
167 | top: -0.5em; | |
168 | } | |
169 | ||
170 | sub { | |
171 | bottom: -0.25em; | |
172 | } | |
173 | ||
174 | /* Embedded content | |
175 | ========================================================================== */ | |
176 | ||
177 | /** | |
178 | * Remove border when inside `a` element in IE 8/9/10. | |
179 | */ | |
180 | ||
181 | img { | |
182 | border: 0; | |
183 | } | |
184 | ||
185 | /** | |
186 | * Correct overflow not hidden in IE 9/10/11. | |
187 | */ | |
188 | ||
189 | svg:not(:root) { | |
190 | overflow: hidden; | |
191 | } | |
192 | ||
193 | /* Grouping content | |
194 | ========================================================================== */ | |
195 | ||
196 | /** | |
197 | * Address margin not present in IE 8/9 and Safari. | |
198 | */ | |
199 | ||
200 | figure { | |
201 | margin: 1em 40px; | |
202 | } | |
203 | ||
204 | /** | |
205 | * Address differences between Firefox and other browsers. | |
206 | */ | |
207 | ||
208 | hr { | |
209 | -moz-box-sizing: content-box; | |
210 | box-sizing: content-box; | |
211 | height: 0; | |
212 | } | |
213 | ||
214 | /** | |
215 | * Contain overflow in all browsers. | |
216 | */ | |
217 | ||
218 | pre { | |
219 | overflow: auto; | |
220 | } | |
221 | ||
222 | /** | |
223 | * Address odd `em`-unit font size rendering in all browsers. | |
224 | */ | |
225 | ||
226 | code, | |
227 | kbd, | |
228 | pre, | |
229 | samp { | |
230 | font-family: monospace, monospace; | |
231 | font-size: 1em; | |
232 | } | |
233 | ||
234 | /* Forms | |
235 | ========================================================================== */ | |
236 | ||
237 | /** | |
238 | * Known limitation: by default, Chrome and Safari on OS X allow very limited | |
239 | * styling of `select`, unless a `border` property is set. | |
240 | */ | |
241 | ||
242 | /** | |
243 | * 1. Correct color not being inherited. | |
244 | * Known issue: affects color of disabled elements. | |
245 | * 2. Correct font properties not being inherited. | |
246 | * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. | |
247 | */ | |
248 | ||
249 | button, | |
250 | input, | |
251 | optgroup, | |
252 | select, | |
253 | textarea { | |
254 | color: inherit; /* 1 */ | |
255 | font: inherit; /* 2 */ | |
256 | margin: 0; /* 3 */ | |
257 | } | |
258 | ||
259 | /** | |
260 | * Address `overflow` set to `hidden` in IE 8/9/10/11. | |
261 | */ | |
262 | ||
263 | button { | |
264 | overflow: visible; | |
265 | } | |
266 | ||
267 | /** | |
268 | * Address inconsistent `text-transform` inheritance for `button` and `select`. | |
269 | * All other form control elements do not inherit `text-transform` values. | |
270 | * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. | |
271 | * Correct `select` style inheritance in Firefox. | |
272 | */ | |
273 | ||
274 | button, | |
275 | select { | |
276 | text-transform: none; | |
277 | } | |
278 | ||
279 | /** | |
280 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` | |
281 | * and `video` controls. | |
282 | * 2. Correct inability to style clickable `input` types in iOS. | |
283 | * 3. Improve usability and consistency of cursor style between image-type | |
284 | * `input` and others. | |
285 | */ | |
286 | ||
287 | button, | |
288 | html input[type="button"], /* 1 */ | |
289 | input[type="reset"], | |
290 | input[type="submit"] { | |
291 | -webkit-appearance: button; /* 2 */ | |
292 | cursor: pointer; /* 3 */ | |
293 | } | |
294 | ||
295 | /** | |
296 | * Re-set default cursor for disabled elements. | |
297 | */ | |
298 | ||
299 | button[disabled], | |
300 | html input[disabled] { | |
301 | cursor: default; | |
302 | } | |
303 | ||
304 | /** | |
305 | * Remove inner padding and border in Firefox 4+. | |
306 | */ | |
307 | ||
308 | button::-moz-focus-inner, | |
309 | input::-moz-focus-inner { | |
310 | border: 0; | |
311 | padding: 0; | |
312 | } | |
313 | ||
314 | /** | |
315 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in | |
316 | * the UA stylesheet. | |
317 | */ | |
318 | ||
319 | input { | |
320 | line-height: normal; | |
321 | } | |
322 | ||
323 | /** | |
324 | * It's recommended that you don't attempt to style these elements. | |
325 | * Firefox's implementation doesn't respect box-sizing, padding, or width. | |
326 | * | |
327 | * 1. Address box sizing set to `content-box` in IE 8/9/10. | |
328 | * 2. Remove excess padding in IE 8/9/10. | |
329 | */ | |
330 | ||
331 | input[type="checkbox"], | |
332 | input[type="radio"] { | |
333 | box-sizing: border-box; /* 1 */ | |
334 | padding: 0; /* 2 */ | |
335 | } | |
336 | ||
337 | /** | |
338 | * Fix the cursor style for Chrome's increment/decrement buttons. For certain | |
339 | * `font-size` values of the `input`, it causes the cursor style of the | |
340 | * decrement button to change from `default` to `text`. | |
341 | */ | |
342 | ||
343 | input[type="number"]::-webkit-inner-spin-button, | |
344 | input[type="number"]::-webkit-outer-spin-button { | |
345 | height: auto; | |
346 | } | |
347 | ||
348 | /** | |
349 | * 1. Address `appearance` set to `searchfield` in Safari and Chrome. | |
350 | * 2. Address `box-sizing` set to `border-box` in Safari and Chrome | |
351 | * (include `-moz` to future-proof). | |
352 | */ | |
353 | ||
354 | input[type="search"] { | |
355 | -webkit-appearance: textfield; /* 1 */ | |
356 | -moz-box-sizing: content-box; | |
357 | -webkit-box-sizing: content-box; /* 2 */ | |
358 | box-sizing: content-box; | |
359 | } | |
360 | ||
361 | /** | |
362 | * Remove inner padding and search cancel button in Safari and Chrome on OS X. | |
363 | * Safari (but not Chrome) clips the cancel button when the search input has | |
364 | * padding (and `textfield` appearance). | |
365 | */ | |
366 | ||
367 | input[type="search"]::-webkit-search-cancel-button, | |
368 | input[type="search"]::-webkit-search-decoration { | |
369 | -webkit-appearance: none; | |
370 | } | |
371 | ||
372 | /** | |
373 | * Define consistent border, margin, and padding. | |
374 | */ | |
375 | ||
376 | fieldset { | |
377 | border: 1px solid #c0c0c0; | |
378 | margin: 0 2px; | |
379 | padding: 0.35em 0.625em 0.75em; | |
380 | } | |
381 | ||
382 | /** | |
383 | * 1. Correct `color` not being inherited in IE 8/9/10/11. | |
384 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. | |
385 | */ | |
386 | ||
387 | legend { | |
388 | border: 0; /* 1 */ | |
389 | padding: 0; /* 2 */ | |
390 | } | |
391 | ||
392 | /** | |
393 | * Remove default vertical scrollbar in IE 8/9/10/11. | |
394 | */ | |
395 | ||
396 | textarea { | |
397 | overflow: auto; | |
398 | } | |
399 | ||
400 | /** | |
401 | * Don't inherit the `font-weight` (applied by a rule above). | |
402 | * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. | |
403 | */ | |
404 | ||
405 | optgroup { | |
406 | font-weight: bold; | |
407 | } | |
408 | ||
409 | /* Tables | |
410 | ========================================================================== */ | |
411 | ||
412 | /** | |
413 | * Remove most spacing between table cells. | |
414 | */ | |
415 | ||
416 | table { | |
417 | border-collapse: collapse; | |
418 | border-spacing: 0; | |
419 | } | |
420 | ||
421 | td, | |
422 | th { | |
423 | padding: 0; | |
424 | } |
0 | /* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ | |
1 | (function( w ){ | |
2 | ||
3 | "use strict"; | |
4 | ||
5 | //exposed namespace | |
6 | var respond = {}; | |
7 | w.respond = respond; | |
8 | ||
9 | //define update even in native-mq-supporting browsers, to avoid errors | |
10 | respond.update = function(){}; | |
11 | ||
12 | //define ajax obj | |
13 | var requestQueue = [], | |
14 | xmlHttp = (function() { | |
15 | var xmlhttpmethod = false; | |
16 | try { | |
17 | xmlhttpmethod = new w.XMLHttpRequest(); | |
18 | } | |
19 | catch( e ){ | |
20 | xmlhttpmethod = new w.ActiveXObject( "Microsoft.XMLHTTP" ); | |
21 | } | |
22 | return function(){ | |
23 | return xmlhttpmethod; | |
24 | }; | |
25 | })(), | |
26 | ||
27 | //tweaked Ajax functions from Quirksmode | |
28 | ajax = function( url, callback ) { | |
29 | var req = xmlHttp(); | |
30 | if (!req){ | |
31 | return; | |
32 | } | |
33 | req.open( "GET", url, true ); | |
34 | req.onreadystatechange = function () { | |
35 | if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){ | |
36 | return; | |
37 | } | |
38 | callback( req.responseText ); | |
39 | }; | |
40 | if ( req.readyState === 4 ){ | |
41 | return; | |
42 | } | |
43 | req.send( null ); | |
44 | }, | |
45 | isUnsupportedMediaQuery = function( query ) { | |
46 | return query.replace( respond.regex.minmaxwh, '' ).match( respond.regex.other ); | |
47 | }; | |
48 | ||
49 | //expose for testing | |
50 | respond.ajax = ajax; | |
51 | respond.queue = requestQueue; | |
52 | respond.unsupportedmq = isUnsupportedMediaQuery; | |
53 | respond.regex = { | |
54 | media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, | |
55 | keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, | |
56 | comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi, | |
57 | urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, | |
58 | findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, | |
59 | only: /(only\s+)?([a-zA-Z]+)\s?/, | |
60 | minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/, | |
61 | maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/, | |
62 | minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi, | |
63 | other: /\([^\)]*\)/g | |
64 | }; | |
65 | ||
66 | //expose media query support flag for external use | |
67 | respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches; | |
68 | ||
69 | //if media queries are supported, exit here | |
70 | if( respond.mediaQueriesSupported ){ | |
71 | return; | |
72 | } | |
73 | ||
74 | //define vars | |
75 | var doc = w.document, | |
76 | docElem = doc.documentElement, | |
77 | mediastyles = [], | |
78 | rules = [], | |
79 | appendedEls = [], | |
80 | parsedSheets = {}, | |
81 | resizeThrottle = 30, | |
82 | head = doc.getElementsByTagName( "head" )[0] || docElem, | |
83 | base = doc.getElementsByTagName( "base" )[0], | |
84 | links = head.getElementsByTagName( "link" ), | |
85 | ||
86 | lastCall, | |
87 | resizeDefer, | |
88 | ||
89 | //cached container for 1em value, populated the first time it's needed | |
90 | eminpx, | |
91 | ||
92 | // returns the value of 1em in pixels | |
93 | getEmValue = function() { | |
94 | var ret, | |
95 | div = doc.createElement('div'), | |
96 | body = doc.body, | |
97 | originalHTMLFontSize = docElem.style.fontSize, | |
98 | originalBodyFontSize = body && body.style.fontSize, | |
99 | fakeUsed = false; | |
100 | ||
101 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; | |
102 | ||
103 | if( !body ){ | |
104 | body = fakeUsed = doc.createElement( "body" ); | |
105 | body.style.background = "none"; | |
106 | } | |
107 | ||
108 | // 1em in a media query is the value of the default font size of the browser | |
109 | // reset docElem and body to ensure the correct value is returned | |
110 | docElem.style.fontSize = "100%"; | |
111 | body.style.fontSize = "100%"; | |
112 | ||
113 | body.appendChild( div ); | |
114 | ||
115 | if( fakeUsed ){ | |
116 | docElem.insertBefore( body, docElem.firstChild ); | |
117 | } | |
118 | ||
119 | ret = div.offsetWidth; | |
120 | ||
121 | if( fakeUsed ){ | |
122 | docElem.removeChild( body ); | |
123 | } | |
124 | else { | |
125 | body.removeChild( div ); | |
126 | } | |
127 | ||
128 | // restore the original values | |
129 | docElem.style.fontSize = originalHTMLFontSize; | |
130 | if( originalBodyFontSize ) { | |
131 | body.style.fontSize = originalBodyFontSize; | |
132 | } | |
133 | ||
134 | ||
135 | //also update eminpx before returning | |
136 | ret = eminpx = parseFloat(ret); | |
137 | ||
138 | return ret; | |
139 | }, | |
140 | ||
141 | //enable/disable styles | |
142 | applyMedia = function( fromResize ){ | |
143 | var name = "clientWidth", | |
144 | docElemProp = docElem[ name ], | |
145 | currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, | |
146 | styleBlocks = {}, | |
147 | lastLink = links[ links.length-1 ], | |
148 | now = (new Date()).getTime(); | |
149 | ||
150 | //throttle resize calls | |
151 | if( fromResize && lastCall && now - lastCall < resizeThrottle ){ | |
152 | w.clearTimeout( resizeDefer ); | |
153 | resizeDefer = w.setTimeout( applyMedia, resizeThrottle ); | |
154 | return; | |
155 | } | |
156 | else { | |
157 | lastCall = now; | |
158 | } | |
159 | ||
160 | for( var i in mediastyles ){ | |
161 | if( mediastyles.hasOwnProperty( i ) ){ | |
162 | var thisstyle = mediastyles[ i ], | |
163 | min = thisstyle.minw, | |
164 | max = thisstyle.maxw, | |
165 | minnull = min === null, | |
166 | maxnull = max === null, | |
167 | em = "em"; | |
168 | ||
169 | if( !!min ){ | |
170 | min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); | |
171 | } | |
172 | if( !!max ){ | |
173 | max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); | |
174 | } | |
175 | ||
176 | // 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 | |
177 | if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ | |
178 | if( !styleBlocks[ thisstyle.media ] ){ | |
179 | styleBlocks[ thisstyle.media ] = []; | |
180 | } | |
181 | styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); | |
182 | } | |
183 | } | |
184 | } | |
185 | ||
186 | //remove any existing respond style element(s) | |
187 | for( var j in appendedEls ){ | |
188 | if( appendedEls.hasOwnProperty( j ) ){ | |
189 | if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){ | |
190 | head.removeChild( appendedEls[ j ] ); | |
191 | } | |
192 | } | |
193 | } | |
194 | appendedEls.length = 0; | |
195 | ||
196 | //inject active styles, grouped by media type | |
197 | for( var k in styleBlocks ){ | |
198 | if( styleBlocks.hasOwnProperty( k ) ){ | |
199 | var ss = doc.createElement( "style" ), | |
200 | css = styleBlocks[ k ].join( "\n" ); | |
201 | ||
202 | ss.type = "text/css"; | |
203 | ss.media = k; | |
204 | ||
205 | //originally, ss was appended to a documentFragment and sheets were appended in bulk. | |
206 | //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! | |
207 | head.insertBefore( ss, lastLink.nextSibling ); | |
208 | ||
209 | if ( ss.styleSheet ){ | |
210 | ss.styleSheet.cssText = css; | |
211 | } | |
212 | else { | |
213 | ss.appendChild( doc.createTextNode( css ) ); | |
214 | } | |
215 | ||
216 | //push to appendedEls to track for later removal | |
217 | appendedEls.push( ss ); | |
218 | } | |
219 | } | |
220 | }, | |
221 | //find media blocks in css text, convert to style blocks | |
222 | translate = function( styles, href, media ){ | |
223 | var qs = styles.replace( respond.regex.comments, '' ) | |
224 | .replace( respond.regex.keyframes, '' ) | |
225 | .match( respond.regex.media ), | |
226 | ql = qs && qs.length || 0; | |
227 | ||
228 | //try to get CSS path | |
229 | href = href.substring( 0, href.lastIndexOf( "/" ) ); | |
230 | ||
231 | var repUrls = function( css ){ | |
232 | return css.replace( respond.regex.urls, "$1" + href + "$2$3" ); | |
233 | }, | |
234 | useMedia = !ql && media; | |
235 | ||
236 | //if path exists, tack on trailing slash | |
237 | if( href.length ){ href += "/"; } | |
238 | ||
239 | //if no internal queries exist, but media attr does, use that | |
240 | //note: this currently lacks support for situations where a media attr is specified on a link AND | |
241 | //its associated stylesheet has internal CSS media queries. | |
242 | //In those cases, the media attribute will currently be ignored. | |
243 | if( useMedia ){ | |
244 | ql = 1; | |
245 | } | |
246 | ||
247 | for( var i = 0; i < ql; i++ ){ | |
248 | var fullq, thisq, eachq, eql; | |
249 | ||
250 | //media attr | |
251 | if( useMedia ){ | |
252 | fullq = media; | |
253 | rules.push( repUrls( styles ) ); | |
254 | } | |
255 | //parse for styles | |
256 | else{ | |
257 | fullq = qs[ i ].match( respond.regex.findStyles ) && RegExp.$1; | |
258 | rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); | |
259 | } | |
260 | ||
261 | eachq = fullq.split( "," ); | |
262 | eql = eachq.length; | |
263 | ||
264 | for( var j = 0; j < eql; j++ ){ | |
265 | thisq = eachq[ j ]; | |
266 | ||
267 | if( isUnsupportedMediaQuery( thisq ) ) { | |
268 | continue; | |
269 | } | |
270 | ||
271 | mediastyles.push( { | |
272 | media : thisq.split( "(" )[ 0 ].match( respond.regex.only ) && RegExp.$2 || "all", | |
273 | rules : rules.length - 1, | |
274 | hasquery : thisq.indexOf("(") > -1, | |
275 | minw : thisq.match( respond.regex.minw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), | |
276 | maxw : thisq.match( respond.regex.maxw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) | |
277 | } ); | |
278 | } | |
279 | } | |
280 | ||
281 | applyMedia(); | |
282 | }, | |
283 | ||
284 | //recurse through request queue, get css text | |
285 | makeRequests = function(){ | |
286 | if( requestQueue.length ){ | |
287 | var thisRequest = requestQueue.shift(); | |
288 | ||
289 | ajax( thisRequest.href, function( styles ){ | |
290 | translate( styles, thisRequest.href, thisRequest.media ); | |
291 | parsedSheets[ thisRequest.href ] = true; | |
292 | ||
293 | // by wrapping recursive function call in setTimeout | |
294 | // we prevent "Stack overflow" error in IE7 | |
295 | w.setTimeout(function(){ makeRequests(); },0); | |
296 | } ); | |
297 | } | |
298 | }, | |
299 | ||
300 | //loop stylesheets, send text content to translate | |
301 | ripCSS = function(){ | |
302 | ||
303 | for( var i = 0; i < links.length; i++ ){ | |
304 | var sheet = links[ i ], | |
305 | href = sheet.href, | |
306 | media = sheet.media, | |
307 | isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; | |
308 | ||
309 | //only links plz and prevent re-parsing | |
310 | if( !!href && isCSS && !parsedSheets[ href ] ){ | |
311 | // selectivizr exposes css through the rawCssText expando | |
312 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { | |
313 | translate( sheet.styleSheet.rawCssText, href, media ); | |
314 | parsedSheets[ href ] = true; | |
315 | } else { | |
316 | if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) || | |
317 | href.replace( RegExp.$1, "" ).split( "/" )[0] === w.location.host ){ | |
318 | // IE7 doesn't handle urls that start with '//' for ajax request | |
319 | // manually add in the protocol | |
320 | if ( href.substring(0,2) === "//" ) { href = w.location.protocol + href; } | |
321 | requestQueue.push( { | |
322 | href: href, | |
323 | media: media | |
324 | } ); | |
325 | } | |
326 | } | |
327 | } | |
328 | } | |
329 | makeRequests(); | |
330 | }; | |
331 | ||
332 | //translate CSS | |
333 | ripCSS(); | |
334 | ||
335 | //expose update for re-running respond later on | |
336 | respond.update = ripCSS; | |
337 | ||
338 | //expose getEmValue | |
339 | respond.getEmValue = getEmValue; | |
340 | ||
341 | //adjust on resize | |
342 | function callMedia(){ | |
343 | applyMedia( true ); | |
344 | } | |
345 | ||
346 | if( w.addEventListener ){ | |
347 | w.addEventListener( "resize", callMedia, false ); | |
348 | } | |
349 | else if( w.attachEvent ){ | |
350 | w.attachEvent( "onresize", callMedia ); | |
351 | } | |
352 | })(this); |
0 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ | |
1 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ | |
2 | (function(w) { | |
3 | "use strict"; | |
4 | w.matchMedia = w.matchMedia || function(doc, undefined) { | |
5 | var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"); | |
6 | div.id = "mq-test-1"; | |
7 | div.style.cssText = "position:absolute;top:-100em"; | |
8 | fakeBody.style.background = "none"; | |
9 | fakeBody.appendChild(div); | |
10 | return function(q) { | |
11 | div.innerHTML = '­<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>'; | |
12 | docElem.insertBefore(fakeBody, refNode); | |
13 | bool = div.offsetWidth === 42; | |
14 | docElem.removeChild(fakeBody); | |
15 | return { | |
16 | matches: bool, | |
17 | media: q | |
18 | }; | |
19 | }; | |
20 | }(w.document); | |
21 | })(this); | |
22 | ||
23 | /*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ | |
24 | (function(w) { | |
25 | "use strict"; | |
26 | var respond = {}; | |
27 | w.respond = respond; | |
28 | respond.update = function() {}; | |
29 | var requestQueue = [], xmlHttp = function() { | |
30 | var xmlhttpmethod = false; | |
31 | try { | |
32 | xmlhttpmethod = new w.XMLHttpRequest(); | |
33 | } catch (e) { | |
34 | xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); | |
35 | } | |
36 | return function() { | |
37 | return xmlhttpmethod; | |
38 | }; | |
39 | }(), ajax = function(url, callback) { | |
40 | var req = xmlHttp(); | |
41 | if (!req) { | |
42 | return; | |
43 | } | |
44 | req.open("GET", url, true); | |
45 | req.onreadystatechange = function() { | |
46 | if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { | |
47 | return; | |
48 | } | |
49 | callback(req.responseText); | |
50 | }; | |
51 | if (req.readyState === 4) { | |
52 | return; | |
53 | } | |
54 | req.send(null); | |
55 | }; | |
56 | respond.ajax = ajax; | |
57 | respond.queue = requestQueue; | |
58 | respond.regex = { | |
59 | media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, | |
60 | keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, | |
61 | urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, | |
62 | findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, | |
63 | only: /(only\s+)?([a-zA-Z]+)\s?/, | |
64 | minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/, | |
65 | maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ | |
66 | }; | |
67 | respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; | |
68 | if (respond.mediaQueriesSupported) { | |
69 | return; | |
70 | } | |
71 | 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() { | |
72 | var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false; | |
73 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; | |
74 | if (!body) { | |
75 | body = fakeUsed = doc.createElement("body"); | |
76 | body.style.background = "none"; | |
77 | } | |
78 | docElem.style.fontSize = "100%"; | |
79 | body.style.fontSize = "100%"; | |
80 | body.appendChild(div); | |
81 | if (fakeUsed) { | |
82 | docElem.insertBefore(body, docElem.firstChild); | |
83 | } | |
84 | ret = div.offsetWidth; | |
85 | if (fakeUsed) { | |
86 | docElem.removeChild(body); | |
87 | } else { | |
88 | body.removeChild(div); | |
89 | } | |
90 | docElem.style.fontSize = originalHTMLFontSize; | |
91 | if (originalBodyFontSize) { | |
92 | body.style.fontSize = originalBodyFontSize; | |
93 | } | |
94 | ret = eminpx = parseFloat(ret); | |
95 | return ret; | |
96 | }, applyMedia = function(fromResize) { | |
97 | 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(); | |
98 | if (fromResize && lastCall && now - lastCall < resizeThrottle) { | |
99 | w.clearTimeout(resizeDefer); | |
100 | resizeDefer = w.setTimeout(applyMedia, resizeThrottle); | |
101 | return; | |
102 | } else { | |
103 | lastCall = now; | |
104 | } | |
105 | for (var i in mediastyles) { | |
106 | if (mediastyles.hasOwnProperty(i)) { | |
107 | var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; | |
108 | if (!!min) { | |
109 | min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1); | |
110 | } | |
111 | if (!!max) { | |
112 | max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1); | |
113 | } | |
114 | if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { | |
115 | if (!styleBlocks[thisstyle.media]) { | |
116 | styleBlocks[thisstyle.media] = []; | |
117 | } | |
118 | styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); | |
119 | } | |
120 | } | |
121 | } | |
122 | for (var j in appendedEls) { | |
123 | if (appendedEls.hasOwnProperty(j)) { | |
124 | if (appendedEls[j] && appendedEls[j].parentNode === head) { | |
125 | head.removeChild(appendedEls[j]); | |
126 | } | |
127 | } | |
128 | } | |
129 | appendedEls.length = 0; | |
130 | for (var k in styleBlocks) { | |
131 | if (styleBlocks.hasOwnProperty(k)) { | |
132 | var ss = doc.createElement("style"), css = styleBlocks[k].join("\n"); | |
133 | ss.type = "text/css"; | |
134 | ss.media = k; | |
135 | head.insertBefore(ss, lastLink.nextSibling); | |
136 | if (ss.styleSheet) { | |
137 | ss.styleSheet.cssText = css; | |
138 | } else { | |
139 | ss.appendChild(doc.createTextNode(css)); | |
140 | } | |
141 | appendedEls.push(ss); | |
142 | } | |
143 | } | |
144 | }, translate = function(styles, href, media) { | |
145 | var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0; | |
146 | href = href.substring(0, href.lastIndexOf("/")); | |
147 | var repUrls = function(css) { | |
148 | return css.replace(respond.regex.urls, "$1" + href + "$2$3"); | |
149 | }, useMedia = !ql && media; | |
150 | if (href.length) { | |
151 | href += "/"; | |
152 | } | |
153 | if (useMedia) { | |
154 | ql = 1; | |
155 | } | |
156 | for (var i = 0; i < ql; i++) { | |
157 | var fullq, thisq, eachq, eql; | |
158 | if (useMedia) { | |
159 | fullq = media; | |
160 | rules.push(repUrls(styles)); | |
161 | } else { | |
162 | fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; | |
163 | rules.push(RegExp.$2 && repUrls(RegExp.$2)); | |
164 | } | |
165 | eachq = fullq.split(","); | |
166 | eql = eachq.length; | |
167 | for (var j = 0; j < eql; j++) { | |
168 | thisq = eachq[j]; | |
169 | mediastyles.push({ | |
170 | media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", | |
171 | rules: rules.length - 1, | |
172 | hasquery: thisq.indexOf("(") > -1, | |
173 | minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), | |
174 | maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") | |
175 | }); | |
176 | } | |
177 | } | |
178 | applyMedia(); | |
179 | }, makeRequests = function() { | |
180 | if (requestQueue.length) { | |
181 | var thisRequest = requestQueue.shift(); | |
182 | ajax(thisRequest.href, function(styles) { | |
183 | translate(styles, thisRequest.href, thisRequest.media); | |
184 | parsedSheets[thisRequest.href] = true; | |
185 | w.setTimeout(function() { | |
186 | makeRequests(); | |
187 | }, 0); | |
188 | }); | |
189 | } | |
190 | }, ripCSS = function() { | |
191 | for (var i = 0; i < links.length; i++) { | |
192 | var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; | |
193 | if (!!href && isCSS && !parsedSheets[href]) { | |
194 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { | |
195 | translate(sheet.styleSheet.rawCssText, href, media); | |
196 | parsedSheets[href] = true; | |
197 | } else { | |
198 | if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { | |
199 | if (href.substring(0, 2) === "//") { | |
200 | href = w.location.protocol + href; | |
201 | } | |
202 | requestQueue.push({ | |
203 | href: href, | |
204 | media: media | |
205 | }); | |
206 | } | |
207 | } | |
208 | } | |
209 | } | |
210 | makeRequests(); | |
211 | }; | |
212 | ripCSS(); | |
213 | respond.update = ripCSS; | |
214 | respond.getEmValue = getEmValue; | |
215 | function callMedia() { | |
216 | applyMedia(true); | |
217 | } | |
218 | if (w.addEventListener) { | |
219 | w.addEventListener("resize", callMedia, false); | |
220 | } else if (w.attachEvent) { | |
221 | w.attachEvent("onresize", callMedia); | |
222 | } | |
223 | })(this);⏎ |