respond-js-rails 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 44039c9f6ec2ce231d7b9e6ab05cd8d0a7521a45
4
+ data.tar.gz: dbc8b1da51b6fe46eda78adbf2fc2d01d8f7df21
5
+ SHA512:
6
+ metadata.gz: e8c1028896ff81a28a3b98036ae8cdda07f8317de26dc753654dc81f32ab99eb7facc39c33ceb4b043f820021e991452e0e8d80ad74bdfa92b6b332e087d3214
7
+ data.tar.gz: c35a5076bd0a0f17ec8bf780822dd482419c81a42e86035640d9d0ac0e12c0efcd6543eb438cfd11e9ecd032936c6628b2997aa3cde94374473bac2e5dc6ba46
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Markus Zhang
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ html5shiv-js-rails
2
+ ==================
3
+
4
+ This gem adds Respond.js to your rails assets.
5
+
6
+ Usage
7
+ -----
8
+
9
+ Add the following to your Gemfile:
10
+
11
+ gem 'respond-js-rails'
12
+
13
+ then run:
14
+
15
+ bundle install
16
+
17
+ Now you only need to add the following to your layout:
18
+
19
+ <!--[if lt IE 9]>
20
+ <%= javascript_include_tag 'respond' %>
21
+ <![endif]-->
22
+
23
+ License
24
+ -------
25
+
26
+ Same as respond itself, this gem is licensed under the MIT license.
@@ -0,0 +1,4 @@
1
+ require "respond-js-rails/engine"
2
+
3
+ module RespondJsRails
4
+ end
@@ -0,0 +1,7 @@
1
+ module RespondJsRails
2
+ class Engine < ::Rails::Engine
3
+ initializer "respond-js-rails.assets.precompile" do |app|
4
+ app.config.assets.precompile << %w(respond.js)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module RespondJsRails
2
+ VERSION = "1.4.2"
3
+ end
@@ -0,0 +1,237 @@
1
+ /*! Respond.js v1.4.2: min/max-width media query polyfill
2
+ * Copyright 2014 Scott Jehl
3
+ * Licensed under MIT
4
+ * http://j.mp/respondjs */
5
+
6
+ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
7
+ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
8
+ (function(w) {
9
+ "use strict";
10
+ w.matchMedia = w.matchMedia || function(doc, undefined) {
11
+ var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div");
12
+ div.id = "mq-test-1";
13
+ div.style.cssText = "position:absolute;top:-100em";
14
+ fakeBody.style.background = "none";
15
+ fakeBody.appendChild(div);
16
+ return function(q) {
17
+ div.innerHTML = '&shy;<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>';
18
+ docElem.insertBefore(fakeBody, refNode);
19
+ bool = div.offsetWidth === 42;
20
+ docElem.removeChild(fakeBody);
21
+ return {
22
+ matches: bool,
23
+ media: q
24
+ };
25
+ };
26
+ }(w.document);
27
+ })(this);
28
+
29
+ (function(w) {
30
+ "use strict";
31
+ var respond = {};
32
+ w.respond = respond;
33
+ respond.update = function() {};
34
+ var requestQueue = [], xmlHttp = function() {
35
+ var xmlhttpmethod = false;
36
+ try {
37
+ xmlhttpmethod = new w.XMLHttpRequest();
38
+ } catch (e) {
39
+ xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP");
40
+ }
41
+ return function() {
42
+ return xmlhttpmethod;
43
+ };
44
+ }(), ajax = function(url, callback) {
45
+ var req = xmlHttp();
46
+ if (!req) {
47
+ return;
48
+ }
49
+ req.open("GET", url, true);
50
+ req.onreadystatechange = function() {
51
+ if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) {
52
+ return;
53
+ }
54
+ callback(req.responseText);
55
+ };
56
+ if (req.readyState === 4) {
57
+ return;
58
+ }
59
+ req.send(null);
60
+ }, isUnsupportedMediaQuery = function(query) {
61
+ return query.replace(respond.regex.minmaxwh, "").match(respond.regex.other);
62
+ };
63
+ respond.ajax = ajax;
64
+ respond.queue = requestQueue;
65
+ respond.unsupportedmq = isUnsupportedMediaQuery;
66
+ respond.regex = {
67
+ media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
68
+ keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
69
+ comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
70
+ urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
71
+ findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
72
+ only: /(only\s+)?([a-zA-Z]+)\s?/,
73
+ minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
74
+ maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
75
+ minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,
76
+ other: /\([^\)]*\)/g
77
+ };
78
+ respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches;
79
+ if (respond.mediaQueriesSupported) {
80
+ return;
81
+ }
82
+ 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() {
83
+ var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false;
84
+ div.style.cssText = "position:absolute;font-size:1em;width:1em";
85
+ if (!body) {
86
+ body = fakeUsed = doc.createElement("body");
87
+ body.style.background = "none";
88
+ }
89
+ docElem.style.fontSize = "100%";
90
+ body.style.fontSize = "100%";
91
+ body.appendChild(div);
92
+ if (fakeUsed) {
93
+ docElem.insertBefore(body, docElem.firstChild);
94
+ }
95
+ ret = div.offsetWidth;
96
+ if (fakeUsed) {
97
+ docElem.removeChild(body);
98
+ } else {
99
+ body.removeChild(div);
100
+ }
101
+ docElem.style.fontSize = originalHTMLFontSize;
102
+ if (originalBodyFontSize) {
103
+ body.style.fontSize = originalBodyFontSize;
104
+ }
105
+ ret = eminpx = parseFloat(ret);
106
+ return ret;
107
+ }, applyMedia = function(fromResize) {
108
+ 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();
109
+ if (fromResize && lastCall && now - lastCall < resizeThrottle) {
110
+ w.clearTimeout(resizeDefer);
111
+ resizeDefer = w.setTimeout(applyMedia, resizeThrottle);
112
+ return;
113
+ } else {
114
+ lastCall = now;
115
+ }
116
+ for (var i in mediastyles) {
117
+ if (mediastyles.hasOwnProperty(i)) {
118
+ var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em";
119
+ if (!!min) {
120
+ min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1);
121
+ }
122
+ if (!!max) {
123
+ max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1);
124
+ }
125
+ if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) {
126
+ if (!styleBlocks[thisstyle.media]) {
127
+ styleBlocks[thisstyle.media] = [];
128
+ }
129
+ styleBlocks[thisstyle.media].push(rules[thisstyle.rules]);
130
+ }
131
+ }
132
+ }
133
+ for (var j in appendedEls) {
134
+ if (appendedEls.hasOwnProperty(j)) {
135
+ if (appendedEls[j] && appendedEls[j].parentNode === head) {
136
+ head.removeChild(appendedEls[j]);
137
+ }
138
+ }
139
+ }
140
+ appendedEls.length = 0;
141
+ for (var k in styleBlocks) {
142
+ if (styleBlocks.hasOwnProperty(k)) {
143
+ var ss = doc.createElement("style"), css = styleBlocks[k].join("\n");
144
+ ss.type = "text/css";
145
+ ss.media = k;
146
+ head.insertBefore(ss, lastLink.nextSibling);
147
+ if (ss.styleSheet) {
148
+ ss.styleSheet.cssText = css;
149
+ } else {
150
+ ss.appendChild(doc.createTextNode(css));
151
+ }
152
+ appendedEls.push(ss);
153
+ }
154
+ }
155
+ }, translate = function(styles, href, media) {
156
+ var qs = styles.replace(respond.regex.comments, "").replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0;
157
+ href = href.substring(0, href.lastIndexOf("/"));
158
+ var repUrls = function(css) {
159
+ return css.replace(respond.regex.urls, "$1" + href + "$2$3");
160
+ }, useMedia = !ql && media;
161
+ if (href.length) {
162
+ href += "/";
163
+ }
164
+ if (useMedia) {
165
+ ql = 1;
166
+ }
167
+ for (var i = 0; i < ql; i++) {
168
+ var fullq, thisq, eachq, eql;
169
+ if (useMedia) {
170
+ fullq = media;
171
+ rules.push(repUrls(styles));
172
+ } else {
173
+ fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1;
174
+ rules.push(RegExp.$2 && repUrls(RegExp.$2));
175
+ }
176
+ eachq = fullq.split(",");
177
+ eql = eachq.length;
178
+ for (var j = 0; j < eql; j++) {
179
+ thisq = eachq[j];
180
+ if (isUnsupportedMediaQuery(thisq)) {
181
+ continue;
182
+ }
183
+ mediastyles.push({
184
+ media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all",
185
+ rules: rules.length - 1,
186
+ hasquery: thisq.indexOf("(") > -1,
187
+ minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
188
+ maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "")
189
+ });
190
+ }
191
+ }
192
+ applyMedia();
193
+ }, makeRequests = function() {
194
+ if (requestQueue.length) {
195
+ var thisRequest = requestQueue.shift();
196
+ ajax(thisRequest.href, function(styles) {
197
+ translate(styles, thisRequest.href, thisRequest.media);
198
+ parsedSheets[thisRequest.href] = true;
199
+ w.setTimeout(function() {
200
+ makeRequests();
201
+ }, 0);
202
+ });
203
+ }
204
+ }, ripCSS = function() {
205
+ for (var i = 0; i < links.length; i++) {
206
+ var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
207
+ if (!!href && isCSS && !parsedSheets[href]) {
208
+ if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
209
+ translate(sheet.styleSheet.rawCssText, href, media);
210
+ parsedSheets[href] = true;
211
+ } else {
212
+ if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) {
213
+ if (href.substring(0, 2) === "//") {
214
+ href = w.location.protocol + href;
215
+ }
216
+ requestQueue.push({
217
+ href: href,
218
+ media: media
219
+ });
220
+ }
221
+ }
222
+ }
223
+ }
224
+ makeRequests();
225
+ };
226
+ ripCSS();
227
+ respond.update = ripCSS;
228
+ respond.getEmValue = getEmValue;
229
+ function callMedia() {
230
+ applyMedia(true);
231
+ }
232
+ if (w.addEventListener) {
233
+ w.addEventListener("resize", callMedia, false);
234
+ } else if (w.attachEvent) {
235
+ w.attachEvent("onresize", callMedia);
236
+ }
237
+ })(this);
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: respond-js-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.2
5
+ platform: ruby
6
+ authors:
7
+ - Markus Zhang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '5.0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '4.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '5.0'
61
+ description: For all of you, who prefer to add JS libraries via gem
62
+ email:
63
+ - roul@codingcorner.info
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - LICENSE.txt
69
+ - README.md
70
+ - lib/respond-js-rails.rb
71
+ - lib/respond-js-rails/engine.rb
72
+ - lib/respond-js-rails/version.rb
73
+ - vendor/assets/javascripts/respond.js
74
+ homepage: https://github.com/RouL/respond-js-rails/
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.2
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Bundles the 'html5shiv' asset for rails
98
+ test_files: []