twbs_sass_rails 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -8
- data/CONTRIBUTING.md +4 -4
- data/Gemfile.lock +52 -65
- data/LICENSE +2 -2
- data/README.md +48 -18
- data/Rakefile +67 -32
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +23 -8
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +200 -199
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/gemfiles/Gemfile.rails-3.2.x +2 -3
- data/gemfiles/Gemfile.rails-4.0.x +2 -3
- data/lib/generators/twbs_sass_rails/install/install_generator.rb +2 -2
- data/lib/generators/twbs_sass_rails/install/templates/{twbs-variables.css.less → twbs-variables.css.scss} +4 -3
- data/lib/generators/twbs_sass_rails/install/templates/{twbs.css.less → twbs.css.scss} +12 -7
- data/lib/twbs_sass_rails/version.rb +1 -1
- data/test/dummy/app/assets/stylesheets/{default-twbs.css.less → default-twbs.css.scss} +0 -0
- data/test/dummy/app/assets/stylesheets/test.css.scss +9 -0
- data/test/dummy/app/assets/stylesheets/twbs-variables.css.scss +7 -0
- data/test/dummy/app/assets/stylesheets/{twbs.css.less → twbs.css.scss} +12 -7
- data/test/dummy/config/application.rb +4 -1
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/generators/install_generator_test.rb +4 -4
- data/test/integration/assets_precompile_integration_test.rb +11 -5
- data/test/integration/twbs_sass_rails_integration_test.rb +8 -7
- data/test/test_helper.rb +2 -4
- data/twbs_sass_rails.gemspec +6 -9
- data/vendor/assets/javascripts/respond.js +223 -212
- data/vendor/assets/javascripts/twbs/bootstrap/affix.js +36 -25
- data/vendor/assets/javascripts/twbs/bootstrap/alert.js +7 -17
- data/vendor/assets/javascripts/twbs/bootstrap/button.js +26 -28
- data/vendor/assets/javascripts/twbs/bootstrap/carousel.js +22 -34
- data/vendor/assets/javascripts/twbs/bootstrap/collapse.js +9 -18
- data/vendor/assets/javascripts/twbs/bootstrap/dropdown.js +25 -32
- data/vendor/assets/javascripts/twbs/bootstrap/modal.js +27 -30
- data/vendor/assets/javascripts/twbs/bootstrap/popover.js +16 -23
- data/vendor/assets/javascripts/twbs/bootstrap/scrollspy.js +19 -24
- data/vendor/assets/javascripts/twbs/bootstrap/tab.js +10 -20
- data/vendor/assets/javascripts/twbs/bootstrap/tooltip.js +54 -41
- data/vendor/assets/javascripts/twbs/bootstrap/transition.js +13 -21
- data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +16 -0
- data/vendor/assets/stylesheets/fontawesome/_core.scss +12 -0
- data/vendor/assets/stylesheets/fontawesome/_extras.scss +44 -0
- data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +6 -0
- data/vendor/assets/stylesheets/fontawesome/_icons.scss +412 -0
- data/vendor/assets/stylesheets/fontawesome/_larger.scss +13 -0
- data/vendor/assets/stylesheets/fontawesome/_list.scss +19 -0
- data/vendor/assets/stylesheets/fontawesome/_mixins.scss +20 -0
- data/vendor/assets/stylesheets/fontawesome/_path.scss +14 -0
- data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +9 -0
- data/vendor/assets/stylesheets/fontawesome/_spinning.scss +30 -0
- data/vendor/assets/stylesheets/fontawesome/_stacked.scss +20 -0
- data/vendor/assets/stylesheets/fontawesome/_variables.scss +381 -0
- data/vendor/assets/stylesheets/fontawesome/font-awesome.scss +17 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{alerts.less → _alerts.scss} +10 -10
- data/vendor/assets/stylesheets/twbs/bootstrap/{badges.less → _badges.scss} +19 -15
- data/vendor/assets/stylesheets/twbs/bootstrap/_breadcrumbs.scss +26 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{button-groups.less → _button-groups.scss} +38 -60
- data/vendor/assets/stylesheets/twbs/bootstrap/{buttons.less → _buttons.scss} +28 -34
- data/vendor/assets/stylesheets/twbs/bootstrap/{carousel.less → _carousel.scss} +38 -19
- data/vendor/assets/stylesheets/twbs/bootstrap/_close.scss +35 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_code.scss +63 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{component-animations.less → _component-animations.scss} +2 -2
- data/vendor/assets/stylesheets/twbs/bootstrap/{dropdowns.less → _dropdowns.scss} +53 -33
- data/vendor/assets/stylesheets/twbs/bootstrap/{forms.less → _forms.scss} +133 -79
- data/vendor/assets/stylesheets/twbs/bootstrap/{glyphicons.less → _glyphicons.scss} +16 -19
- data/vendor/assets/stylesheets/twbs/bootstrap/_grid.scss +100 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{input-groups.less → _input-groups.scss} +58 -29
- data/vendor/assets/stylesheets/twbs/bootstrap/_jumbotron.scss +44 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{labels.less → _labels.scss} +14 -8
- data/vendor/assets/stylesheets/twbs/bootstrap/_list-group.scss +110 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{media.less → _media.scss} +0 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_mixins.scss +931 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{modals.less → _modals.scss} +37 -40
- data/vendor/assets/stylesheets/twbs/bootstrap/_navbar.scss +620 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{navs.less → _navs.scss} +41 -52
- data/vendor/assets/stylesheets/twbs/bootstrap/{normalize.less → _normalize.scss} +148 -121
- data/vendor/assets/stylesheets/twbs/bootstrap/{pager.less → _pager.scss} +8 -8
- data/vendor/assets/stylesheets/twbs/bootstrap/_pagination.scss +88 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_panels.scss +230 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{popovers.less → _popovers.scss} +36 -36
- data/vendor/assets/stylesheets/twbs/bootstrap/{print.less → _print.scss} +6 -5
- data/vendor/assets/stylesheets/twbs/bootstrap/_progress-bars.scss +80 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_responsive-utilities.scss +80 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{scaffolding.less → _scaffolding.scss} +39 -24
- data/vendor/assets/stylesheets/twbs/bootstrap/{tables.less → _tables.scss} +42 -48
- data/vendor/assets/stylesheets/twbs/bootstrap/_theme.scss +247 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_thumbnails.scss +38 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_tooltip.scss +95 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/_type.scss +296 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{utilities.less → _utilities.scss} +14 -3
- data/vendor/assets/stylesheets/twbs/bootstrap/_variables.scss +831 -0
- data/vendor/assets/stylesheets/twbs/bootstrap/{wells.less → _wells.scss} +6 -6
- data/vendor/assets/stylesheets/twbs/bootstrap/bootstrap.scss +48 -0
- data/vendor/assets/stylesheets/twbs/{bootstrap.less → bootstrap.scss} +0 -0
- metadata +94 -134
- data/test/dummy/app/assets/stylesheets/test.css.less +0 -5
- data/test/dummy/app/assets/stylesheets/twbs-variables.css.less +0 -6
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/db/.keep +0 -0
- data/vendor/assets/stylesheets/fontawesome/bootstrap.less +0 -84
- data/vendor/assets/stylesheets/fontawesome/core.less +0 -129
- data/vendor/assets/stylesheets/fontawesome/extras.less +0 -93
- data/vendor/assets/stylesheets/fontawesome/font-awesome.less +0 -33
- data/vendor/assets/stylesheets/fontawesome/icons.less +0 -381
- data/vendor/assets/stylesheets/fontawesome/mixins.less +0 -48
- data/vendor/assets/stylesheets/fontawesome/path.less +0 -14
- data/vendor/assets/stylesheets/fontawesome/variables.less +0 -735
- data/vendor/assets/stylesheets/twbs/bootstrap/bootstrap.less +0 -58
- data/vendor/assets/stylesheets/twbs/bootstrap/breadcrumbs.less +0 -23
- data/vendor/assets/stylesheets/twbs/bootstrap/close.less +0 -33
- data/vendor/assets/stylesheets/twbs/bootstrap/code.less +0 -56
- data/vendor/assets/stylesheets/twbs/bootstrap/grid.less +0 -346
- data/vendor/assets/stylesheets/twbs/bootstrap/jumbotron.less +0 -40
- data/vendor/assets/stylesheets/twbs/bootstrap/list-group.less +0 -88
- data/vendor/assets/stylesheets/twbs/bootstrap/mixins.less +0 -744
- data/vendor/assets/stylesheets/twbs/bootstrap/navbar.less +0 -621
- data/vendor/assets/stylesheets/twbs/bootstrap/pagination.less +0 -85
- data/vendor/assets/stylesheets/twbs/bootstrap/panels.less +0 -143
- data/vendor/assets/stylesheets/twbs/bootstrap/progress-bars.less +0 -96
- data/vendor/assets/stylesheets/twbs/bootstrap/responsive-utilities.less +0 -220
- data/vendor/assets/stylesheets/twbs/bootstrap/theme.less +0 -244
- data/vendor/assets/stylesheets/twbs/bootstrap/thumbnails.less +0 -32
- data/vendor/assets/stylesheets/twbs/bootstrap/tooltip.less +0 -95
- data/vendor/assets/stylesheets/twbs/bootstrap/type.less +0 -271
- data/vendor/assets/stylesheets/twbs/bootstrap/variables.less +0 -635
@@ -1,65 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
5
|
-
|
6
|
-
"use strict";
|
7
|
-
|
8
|
-
var bool,
|
9
|
-
docElem = doc.documentElement,
|
10
|
-
refNode = docElem.firstElementChild || docElem.firstChild,
|
11
|
-
// fakeBody required for <FF4 when executed in <head>
|
12
|
-
fakeBody = doc.createElement( "body" ),
|
13
|
-
div = doc.createElement( "div" );
|
14
|
-
|
15
|
-
div.id = "mq-test-1";
|
16
|
-
div.style.cssText = "position:absolute;top:-100em";
|
17
|
-
fakeBody.style.background = "none";
|
18
|
-
fakeBody.appendChild(div);
|
19
|
-
|
20
|
-
return function(q){
|
21
|
-
|
22
|
-
div.innerHTML = "­<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
|
23
|
-
|
24
|
-
docElem.insertBefore( fakeBody, refNode );
|
25
|
-
bool = div.offsetWidth === 42;
|
26
|
-
docElem.removeChild( fakeBody );
|
27
|
-
|
28
|
-
return {
|
29
|
-
matches: bool,
|
30
|
-
media: q
|
31
|
-
};
|
32
|
-
|
33
|
-
};
|
34
|
-
|
35
|
-
}( document ));
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
/*! Respond.js v1.3.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
42
|
-
(function( win ){
|
1
|
+
/* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
|
2
|
+
(function( w ){
|
43
3
|
|
44
4
|
"use strict";
|
45
5
|
|
46
6
|
//exposed namespace
|
47
7
|
var respond = {};
|
48
|
-
|
49
|
-
|
8
|
+
w.respond = respond;
|
9
|
+
|
50
10
|
//define update even in native-mq-supporting browsers, to avoid errors
|
51
11
|
respond.update = function(){};
|
52
|
-
|
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
|
+
|
53
67
|
//expose media query support flag for external use
|
54
|
-
respond.mediaQueriesSupported
|
55
|
-
|
68
|
+
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches;
|
69
|
+
|
56
70
|
//if media queries are supported, exit here
|
57
71
|
if( respond.mediaQueriesSupported ){
|
58
72
|
return;
|
59
73
|
}
|
60
|
-
|
74
|
+
|
61
75
|
//define vars
|
62
|
-
var doc =
|
76
|
+
var doc = w.document,
|
63
77
|
docElem = doc.documentElement,
|
64
78
|
mediastyles = [],
|
65
79
|
rules = [],
|
@@ -69,149 +83,62 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
|
69
83
|
head = doc.getElementsByTagName( "head" )[0] || docElem,
|
70
84
|
base = doc.getElementsByTagName( "base" )[0],
|
71
85
|
links = head.getElementsByTagName( "link" ),
|
72
|
-
requestQueue = [],
|
73
|
-
|
74
|
-
//loop stylesheets, send text content to translate
|
75
|
-
ripCSS = function(){
|
76
|
-
|
77
|
-
for( var i = 0; i < links.length; i++ ){
|
78
|
-
var sheet = links[ i ],
|
79
|
-
href = sheet.href,
|
80
|
-
media = sheet.media,
|
81
|
-
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
82
|
-
|
83
|
-
//only links plz and prevent re-parsing
|
84
|
-
if( !!href && isCSS && !parsedSheets[ href ] ){
|
85
|
-
// selectivizr exposes css through the rawCssText expando
|
86
|
-
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
87
|
-
translate( sheet.styleSheet.rawCssText, href, media );
|
88
|
-
parsedSheets[ href ] = true;
|
89
|
-
} else {
|
90
|
-
if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) ||
|
91
|
-
href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
|
92
|
-
requestQueue.push( {
|
93
|
-
href: href,
|
94
|
-
media: media
|
95
|
-
} );
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
makeRequests();
|
101
|
-
},
|
102
|
-
|
103
|
-
//recurse through request queue, get css text
|
104
|
-
makeRequests = function(){
|
105
|
-
if( requestQueue.length ){
|
106
|
-
var thisRequest = requestQueue.shift();
|
107
|
-
|
108
|
-
ajax( thisRequest.href, function( styles ){
|
109
|
-
translate( styles, thisRequest.href, thisRequest.media );
|
110
|
-
parsedSheets[ thisRequest.href ] = true;
|
111
86
|
|
112
|
-
// by wrapping recursive function call in setTimeout
|
113
|
-
// we prevent "Stack overflow" error in IE7
|
114
|
-
win.setTimeout(function(){ makeRequests(); },0);
|
115
|
-
} );
|
116
|
-
}
|
117
|
-
},
|
118
|
-
|
119
|
-
//find media blocks in css text, convert to style blocks
|
120
|
-
translate = function( styles, href, media ){
|
121
|
-
var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ),
|
122
|
-
ql = qs && qs.length || 0;
|
123
|
-
|
124
|
-
//try to get CSS path
|
125
|
-
href = href.substring( 0, href.lastIndexOf( "/" ) );
|
126
|
-
|
127
|
-
var repUrls = function( css ){
|
128
|
-
return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" );
|
129
|
-
},
|
130
|
-
useMedia = !ql && media;
|
131
|
-
|
132
|
-
//if path exists, tack on trailing slash
|
133
|
-
if( href.length ){ href += "/"; }
|
134
|
-
|
135
|
-
//if no internal queries exist, but media attr does, use that
|
136
|
-
//note: this currently lacks support for situations where a media attr is specified on a link AND
|
137
|
-
//its associated stylesheet has internal CSS media queries.
|
138
|
-
//In those cases, the media attribute will currently be ignored.
|
139
|
-
if( useMedia ){
|
140
|
-
ql = 1;
|
141
|
-
}
|
142
|
-
|
143
|
-
for( var i = 0; i < ql; i++ ){
|
144
|
-
var fullq, thisq, eachq, eql;
|
145
|
-
|
146
|
-
//media attr
|
147
|
-
if( useMedia ){
|
148
|
-
fullq = media;
|
149
|
-
rules.push( repUrls( styles ) );
|
150
|
-
}
|
151
|
-
//parse for styles
|
152
|
-
else{
|
153
|
-
fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1;
|
154
|
-
rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
|
155
|
-
}
|
156
|
-
|
157
|
-
eachq = fullq.split( "," );
|
158
|
-
eql = eachq.length;
|
159
|
-
|
160
|
-
for( var j = 0; j < eql; j++ ){
|
161
|
-
thisq = eachq[ j ];
|
162
|
-
mediastyles.push( {
|
163
|
-
media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
|
164
|
-
rules : rules.length - 1,
|
165
|
-
hasquery : thisq.indexOf("(") > -1,
|
166
|
-
minw : thisq.match( /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
|
167
|
-
maxw : thisq.match( /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
|
168
|
-
} );
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
applyMedia();
|
173
|
-
},
|
174
|
-
|
175
87
|
lastCall,
|
176
|
-
|
177
88
|
resizeDefer,
|
178
|
-
|
89
|
+
|
90
|
+
//cached container for 1em value, populated the first time it's needed
|
91
|
+
eminpx,
|
92
|
+
|
179
93
|
// returns the value of 1em in pixels
|
180
94
|
getEmValue = function() {
|
181
95
|
var ret,
|
182
96
|
div = doc.createElement('div'),
|
183
97
|
body = doc.body,
|
98
|
+
originalHTMLFontSize = docElem.style.fontSize,
|
99
|
+
originalBodyFontSize = body && body.style.fontSize,
|
184
100
|
fakeUsed = false;
|
185
|
-
|
101
|
+
|
186
102
|
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
187
|
-
|
103
|
+
|
188
104
|
if( !body ){
|
189
105
|
body = fakeUsed = doc.createElement( "body" );
|
190
106
|
body.style.background = "none";
|
191
107
|
}
|
192
|
-
|
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
|
+
|
193
114
|
body.appendChild( div );
|
194
|
-
|
195
|
-
|
196
|
-
|
115
|
+
|
116
|
+
if( fakeUsed ){
|
117
|
+
docElem.insertBefore( body, docElem.firstChild );
|
118
|
+
}
|
119
|
+
|
197
120
|
ret = div.offsetWidth;
|
198
|
-
|
121
|
+
|
199
122
|
if( fakeUsed ){
|
200
123
|
docElem.removeChild( body );
|
201
124
|
}
|
202
125
|
else {
|
203
126
|
body.removeChild( div );
|
204
127
|
}
|
205
|
-
|
128
|
+
|
129
|
+
// restore the original values
|
130
|
+
docElem.style.fontSize = originalHTMLFontSize;
|
131
|
+
if( originalBodyFontSize ) {
|
132
|
+
body.style.fontSize = originalBodyFontSize;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
206
136
|
//also update eminpx before returning
|
207
137
|
ret = eminpx = parseFloat(ret);
|
208
|
-
|
138
|
+
|
209
139
|
return ret;
|
210
140
|
},
|
211
|
-
|
212
|
-
//cached container for 1em value, populated the first time it's needed
|
213
|
-
eminpx,
|
214
|
-
|
141
|
+
|
215
142
|
//enable/disable styles
|
216
143
|
applyMedia = function( fromResize ){
|
217
144
|
var name = "clientWidth",
|
@@ -221,16 +148,16 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
|
221
148
|
lastLink = links[ links.length-1 ],
|
222
149
|
now = (new Date()).getTime();
|
223
150
|
|
224
|
-
//throttle resize calls
|
151
|
+
//throttle resize calls
|
225
152
|
if( fromResize && lastCall && now - lastCall < resizeThrottle ){
|
226
|
-
|
227
|
-
resizeDefer =
|
153
|
+
w.clearTimeout( resizeDefer );
|
154
|
+
resizeDefer = w.setTimeout( applyMedia, resizeThrottle );
|
228
155
|
return;
|
229
156
|
}
|
230
157
|
else {
|
231
158
|
lastCall = now;
|
232
159
|
}
|
233
|
-
|
160
|
+
|
234
161
|
for( var i in mediastyles ){
|
235
162
|
if( mediastyles.hasOwnProperty( i ) ){
|
236
163
|
var thisstyle = mediastyles[ i ],
|
@@ -239,14 +166,14 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
|
239
166
|
minnull = min === null,
|
240
167
|
maxnull = max === null,
|
241
168
|
em = "em";
|
242
|
-
|
169
|
+
|
243
170
|
if( !!min ){
|
244
171
|
min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
245
172
|
}
|
246
173
|
if( !!max ){
|
247
174
|
max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
248
175
|
}
|
249
|
-
|
176
|
+
|
250
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
|
251
178
|
if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
|
252
179
|
if( !styleBlocks[ thisstyle.media ] ){
|
@@ -256,7 +183,7 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
|
256
183
|
}
|
257
184
|
}
|
258
185
|
}
|
259
|
-
|
186
|
+
|
260
187
|
//remove any existing respond style element(s)
|
261
188
|
for( var j in appendedEls ){
|
262
189
|
if( appendedEls.hasOwnProperty( j ) ){
|
@@ -265,21 +192,22 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
|
265
192
|
}
|
266
193
|
}
|
267
194
|
}
|
268
|
-
|
195
|
+
appendedEls.length = 0;
|
196
|
+
|
269
197
|
//inject active styles, grouped by media type
|
270
198
|
for( var k in styleBlocks ){
|
271
199
|
if( styleBlocks.hasOwnProperty( k ) ){
|
272
200
|
var ss = doc.createElement( "style" ),
|
273
201
|
css = styleBlocks[ k ].join( "\n" );
|
274
|
-
|
275
|
-
ss.type = "text/css";
|
202
|
+
|
203
|
+
ss.type = "text/css";
|
276
204
|
ss.media = k;
|
277
|
-
|
205
|
+
|
278
206
|
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
|
279
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!
|
280
208
|
head.insertBefore( ss, lastLink.nextSibling );
|
281
|
-
|
282
|
-
if ( ss.styleSheet ){
|
209
|
+
|
210
|
+
if ( ss.styleSheet ){
|
283
211
|
ss.styleSheet.cssText = css;
|
284
212
|
}
|
285
213
|
else {
|
@@ -291,52 +219,135 @@ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
|
|
291
219
|
}
|
292
220
|
}
|
293
221
|
},
|
294
|
-
//
|
295
|
-
|
296
|
-
var
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
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
|
+
} );
|
304
279
|
}
|
305
|
-
callback( req.responseText );
|
306
|
-
};
|
307
|
-
if ( req.readyState === 4 ){
|
308
|
-
return;
|
309
280
|
}
|
310
|
-
|
281
|
+
|
282
|
+
applyMedia();
|
311
283
|
},
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
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
|
+
} );
|
317
298
|
}
|
318
|
-
|
319
|
-
|
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
|
+
}
|
320
329
|
}
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
})();
|
325
|
-
|
330
|
+
makeRequests();
|
331
|
+
};
|
332
|
+
|
326
333
|
//translate CSS
|
327
334
|
ripCSS();
|
328
|
-
|
335
|
+
|
329
336
|
//expose update for re-running respond later on
|
330
337
|
respond.update = ripCSS;
|
331
|
-
|
338
|
+
|
339
|
+
//expose getEmValue
|
340
|
+
respond.getEmValue = getEmValue;
|
341
|
+
|
332
342
|
//adjust on resize
|
333
343
|
function callMedia(){
|
334
344
|
applyMedia( true );
|
335
345
|
}
|
336
|
-
|
337
|
-
|
346
|
+
|
347
|
+
if( w.addEventListener ){
|
348
|
+
w.addEventListener( "resize", callMedia, false );
|
338
349
|
}
|
339
|
-
else if(
|
340
|
-
|
350
|
+
else if( w.attachEvent ){
|
351
|
+
w.attachEvent( "onresize", callMedia );
|
341
352
|
}
|
342
353
|
})(this);
|
@@ -1,24 +1,14 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: affix.js v3.
|
3
|
-
* http://
|
2
|
+
* Bootstrap: affix.js v3.1.0
|
3
|
+
* http://getbootstrap.com/javascript/#affix
|
4
4
|
* ========================================================================
|
5
|
-
* Copyright
|
6
|
-
*
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
* you may not use this file except in compliance with the License.
|
9
|
-
* You may obtain a copy of the License at
|
10
|
-
*
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
*
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
18
7
|
* ======================================================================== */
|
19
8
|
|
20
9
|
|
21
|
-
+function ($) {
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
22
12
|
|
23
13
|
// AFFIX CLASS DEFINITION
|
24
14
|
// ======================
|
@@ -29,9 +19,10 @@
|
|
29
19
|
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
30
20
|
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
31
21
|
|
32
|
-
this.$element
|
33
|
-
this.affixed
|
34
|
-
this.unpin
|
22
|
+
this.$element = $(element)
|
23
|
+
this.affixed =
|
24
|
+
this.unpin =
|
25
|
+
this.pinnedOffset = null
|
35
26
|
|
36
27
|
this.checkPosition()
|
37
28
|
}
|
@@ -42,6 +33,14 @@
|
|
42
33
|
offset: 0
|
43
34
|
}
|
44
35
|
|
36
|
+
Affix.prototype.getPinnedOffset = function () {
|
37
|
+
if (this.pinnedOffset) return this.pinnedOffset
|
38
|
+
this.$element.removeClass(Affix.RESET).addClass('affix')
|
39
|
+
var scrollTop = this.$window.scrollTop()
|
40
|
+
var position = this.$element.offset()
|
41
|
+
return (this.pinnedOffset = position.top - scrollTop)
|
42
|
+
}
|
43
|
+
|
45
44
|
Affix.prototype.checkPositionWithEventLoop = function () {
|
46
45
|
setTimeout($.proxy(this.checkPosition, this), 1)
|
47
46
|
}
|
@@ -56,9 +55,11 @@
|
|
56
55
|
var offsetTop = offset.top
|
57
56
|
var offsetBottom = offset.bottom
|
58
57
|
|
58
|
+
if (this.affixed == 'top') position.top += scrollTop
|
59
|
+
|
59
60
|
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
60
|
-
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
61
|
-
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
61
|
+
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
|
62
|
+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
|
62
63
|
|
63
64
|
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
|
64
65
|
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
|
@@ -67,13 +68,23 @@
|
|
67
68
|
if (this.affixed === affix) return
|
68
69
|
if (this.unpin) this.$element.css('top', '')
|
69
70
|
|
71
|
+
var affixType = 'affix' + (affix ? '-' + affix : '')
|
72
|
+
var e = $.Event(affixType + '.bs.affix')
|
73
|
+
|
74
|
+
this.$element.trigger(e)
|
75
|
+
|
76
|
+
if (e.isDefaultPrevented()) return
|
77
|
+
|
70
78
|
this.affixed = affix
|
71
|
-
this.unpin
|
79
|
+
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
|
72
80
|
|
73
|
-
this.$element
|
81
|
+
this.$element
|
82
|
+
.removeClass(Affix.RESET)
|
83
|
+
.addClass(affixType)
|
84
|
+
.trigger($.Event(affixType.replace('affix', 'affixed')))
|
74
85
|
|
75
86
|
if (affix == 'bottom') {
|
76
|
-
this.$element.offset({ top:
|
87
|
+
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
|
77
88
|
}
|
78
89
|
}
|
79
90
|
|
@@ -123,4 +134,4 @@
|
|
123
134
|
})
|
124
135
|
})
|
125
136
|
|
126
|
-
}(
|
137
|
+
}(jQuery);
|
@@ -1,24 +1,14 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: alert.js v3.
|
3
|
-
* http://
|
2
|
+
* Bootstrap: alert.js v3.1.0
|
3
|
+
* http://getbootstrap.com/javascript/#alerts
|
4
4
|
* ========================================================================
|
5
|
-
* Copyright
|
6
|
-
*
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
* you may not use this file except in compliance with the License.
|
9
|
-
* You may obtain a copy of the License at
|
10
|
-
*
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
*
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
18
7
|
* ======================================================================== */
|
19
8
|
|
20
9
|
|
21
|
-
+function ($) {
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
22
12
|
|
23
13
|
// ALERT CLASS DEFINITION
|
24
14
|
// ======================
|
@@ -95,4 +85,4 @@
|
|
95
85
|
|
96
86
|
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
|
97
87
|
|
98
|
-
}(
|
88
|
+
}(jQuery);
|