respond-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +20 -0
- data/README.md +53 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/lib/app/helpers/respond_helper.rb +15 -0
- data/lib/respond-rails.rb +11 -0
- data/lib/respond/rails/engine.rb +7 -0
- data/lib/respond/rails/version.rb +5 -0
- data/respond-rails.gemspec +63 -0
- data/test/helper.rb +18 -0
- data/test/test_respond-rails.rb +7 -0
- data/vendor/assets/images/respond.proxy.gif +0 -0
- data/vendor/assets/javascripts/respond-proxy.html +80 -0
- data/vendor/assets/javascripts/respond.js +2 -0
- data/vendor/assets/javascripts/respond.proxy.js +113 -0
- metadata +115 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.6.4"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.6.4)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.9.2.2)
|
10
|
+
rcov (0.9.11)
|
11
|
+
shoulda (2.11.3)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
bundler (~> 1.0.0)
|
18
|
+
jeweler (~> 1.6.4)
|
19
|
+
rcov
|
20
|
+
shoulda
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# respond-rails
|
2
|
+
|
3
|
+
Respond.js provides a fast and lightweight script to enable responsive web designs in browsers that don't support CSS3 media queries. You can find the original source repository at https://github.com/scottjehl/Respond.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Include the gem in your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "respond-rails", "~> 1.0"
|
11
|
+
```
|
12
|
+
|
13
|
+
Include Respond.js in your application layout like so:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
<%= respond_include_tags %>
|
17
|
+
```
|
18
|
+
|
19
|
+
And add `respond.js` to the list of precompiled assets:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# config/environments/production.rb
|
23
|
+
|
24
|
+
config.assets.precompile += %w( modernizr.js respond.js respond-proxy.html respond.proxy.js )
|
25
|
+
```
|
26
|
+
|
27
|
+
## CDN/X-Domain Setup
|
28
|
+
|
29
|
+
If you store your assets on a separate host, you'll need to edit `asset_host` like so:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# config/environments/production.rb
|
33
|
+
|
34
|
+
config.action_controller.asset_host = Proc.new { |source, request|
|
35
|
+
if source =~ /respond\.proxy-.+(js|gif)$/
|
36
|
+
"#{request.protocol}#{request.host_with_port}"
|
37
|
+
else
|
38
|
+
"//assets.example.com"
|
39
|
+
end
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
43
|
+
This will skip the asset_host for `respond.proxy.js` and `respond.proxy.gif` which need to be on the same domain. After that, you'll need to make an addition to the precompiled assets:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
config.assets.precompile += %w( respond.js respond-proxy.html respond.proxy.js )
|
47
|
+
```
|
48
|
+
|
49
|
+
## Copyright
|
50
|
+
|
51
|
+
Copyright (c) 2011 Scott Jehl, scottjehl.com
|
52
|
+
|
53
|
+
See https://github.com/scottjehl/Respond for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = 'respond-rails'
|
18
|
+
gem.homepage = 'https://github.com/scottjehl/Respond'
|
19
|
+
gem.licenses = ['MIT', 'GPL-2']
|
20
|
+
gem.summary = %Q{A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)}
|
21
|
+
gem.email = ['gabriel@codeconcoction.com', 'scott@scottjehl.com']
|
22
|
+
gem.authors = ['Gabriel Evans', 'Scott Jehl']
|
23
|
+
# dependencies defined in Gemfile
|
24
|
+
end
|
25
|
+
Jeweler::RubygemsDotOrgTasks.new
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'test'
|
30
|
+
test.pattern = 'test/**/test_*.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'rcov/rcovtask'
|
35
|
+
Rcov::RcovTask.new do |test|
|
36
|
+
test.libs << 'test'
|
37
|
+
test.pattern = 'test/**/test_*.rb'
|
38
|
+
test.verbose = true
|
39
|
+
test.rcov_opts << '--exclude "gems/*"'
|
40
|
+
end
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rdoc/task'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "respond-rails #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RespondHelper
|
2
|
+
|
3
|
+
def respond_include_tags
|
4
|
+
tags = [javascript_include_tag(:respond)]
|
5
|
+
|
6
|
+
unless ActionController::Base.asset_host.nil?
|
7
|
+
tags << tag('link', {href: asset_path('respond-proxy.html'), id: 'respond-redirect', rel: 'respond-redirect'})
|
8
|
+
tags << tag('link', {href: image_path('respond.proxy.gif'), id: 'respond-redirect', rel: 'respond-redirect'})
|
9
|
+
tags << javascript_include_tag(javascript_path('respond.proxy.js'))
|
10
|
+
end
|
11
|
+
|
12
|
+
tags.join("\n").html_safe
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
if defined?(ActionController)
|
2
|
+
require File.join(File.dirname(__FILE__), 'app', 'helpers', 'respond_helper')
|
3
|
+
ActionController::Base.helper(RespondHelper)
|
4
|
+
end
|
5
|
+
|
6
|
+
module Respond
|
7
|
+
module Rails
|
8
|
+
require 'respond/rails/engine'
|
9
|
+
require 'respond/rails/version'
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "respond-rails"
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Gabriel Evans", "Scott Jehl"]
|
12
|
+
s.date = "2011-11-23"
|
13
|
+
s.email = ["gabriel@codeconcoction.com", "scott@scottjehl.com"]
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"README.md"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
".document",
|
19
|
+
"Gemfile",
|
20
|
+
"Gemfile.lock",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/app/helpers/respond_helper.rb",
|
25
|
+
"lib/respond-rails.rb",
|
26
|
+
"lib/respond/rails/engine.rb",
|
27
|
+
"lib/respond/rails/version.rb",
|
28
|
+
"respond-rails.gemspec",
|
29
|
+
"test/helper.rb",
|
30
|
+
"test/test_respond-rails.rb",
|
31
|
+
"vendor/assets/images/respond.proxy.gif",
|
32
|
+
"vendor/assets/javascripts/respond-proxy.html",
|
33
|
+
"vendor/assets/javascripts/respond.js",
|
34
|
+
"vendor/assets/javascripts/respond.proxy.js"
|
35
|
+
]
|
36
|
+
s.homepage = "https://github.com/scottjehl/Respond"
|
37
|
+
s.licenses = ["MIT", "GPL-2"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = "1.8.10"
|
40
|
+
s.summary = "A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)"
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
49
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
52
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
54
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
60
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'respond-rails'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
Binary file
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<!-- Respond.js: min/max-width media query polyfill. Remote proxy (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs -->
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
<title>Respond JS Proxy</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script>
|
10
|
+
(function () {
|
11
|
+
var domain, css, url, match, file, ajax, xmlHttp;
|
12
|
+
|
13
|
+
ajax = function( url, callback ) {
|
14
|
+
var req = xmlHttp();
|
15
|
+
if (!req){
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
req.open( "GET", url, true );
|
19
|
+
req.onreadystatechange = function () {
|
20
|
+
if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
callback( req.responseText );
|
24
|
+
};
|
25
|
+
if ( req.readyState == 4 ){
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
req.send();
|
29
|
+
};
|
30
|
+
|
31
|
+
//define ajax obj
|
32
|
+
xmlHttp = (function() {
|
33
|
+
var xmlhttpmethod = false,
|
34
|
+
attempts = [
|
35
|
+
function(){ return new XMLHttpRequest(); },
|
36
|
+
function(){ return new ActiveXObject("Microsoft.XMLHTTP"); },
|
37
|
+
function(){ return new ActiveXObject("MSXML2.XMLHTTP.3.0"); }
|
38
|
+
],
|
39
|
+
al = attempts.length;
|
40
|
+
|
41
|
+
while( al-- ){
|
42
|
+
try {
|
43
|
+
xmlhttpmethod = attempts[ al ]();
|
44
|
+
}
|
45
|
+
catch(e) {
|
46
|
+
continue;
|
47
|
+
}
|
48
|
+
break;
|
49
|
+
}
|
50
|
+
return function(){
|
51
|
+
return xmlhttpmethod;
|
52
|
+
};
|
53
|
+
})();
|
54
|
+
|
55
|
+
url = window.location.href;
|
56
|
+
|
57
|
+
if (url) {
|
58
|
+
match = (/css\=(.*\.css)$/).exec(url.slice(url.indexOf('?') + 1));
|
59
|
+
|
60
|
+
if (match && match[1]) {
|
61
|
+
css = match[1];
|
62
|
+
}
|
63
|
+
|
64
|
+
match = (/url\=([^&]+)/).exec(url);
|
65
|
+
|
66
|
+
if (match && match[1]) {
|
67
|
+
domain = match[1];
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
if (css) {
|
72
|
+
ajax(css, function (response) {
|
73
|
+
window.name = response;
|
74
|
+
window.location.href = domain;
|
75
|
+
});
|
76
|
+
}
|
77
|
+
}());
|
78
|
+
</script>
|
79
|
+
</body>
|
80
|
+
</html>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! Respond.js v1.0.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
2
|
+
(function(e,h){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=h;if(h){return}var u=e.document,r=u.documentElement,i=[],k=[],p=[],o={},g=30,f=u.getElementsByTagName("head")[0]||r,b=f.getElementsByTagName("link"),d=[],a=function(){var B=b,w=B.length,z=0,y,x,A,v;for(;z<w;z++){y=B[z],x=y.href,A=y.media,v=y.rel&&y.rel.toLowerCase()==="stylesheet";if(!!x&&v&&!o[x]){if(y.styleSheet&&y.styleSheet.rawCssText){m(y.styleSheet.rawCssText,x,A);o[x]=true}else{if(!/^([a-zA-Z]+?:(\/\/)?)/.test(x)||x.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:x,media:A})}}}}t()},t=function(){if(d.length){var v=d.shift();n(v.href,function(w){m(w,v.href,v.media);o[v.href]=true;t()})}},m=function(G,v,x){var E=G.match(/@media[^\{]+\{([^\{\}]+\{[^\}\{]+\})+/gi),H=E&&E.length||0,v=v.substring(0,v.lastIndexOf("/")),w=function(I){return I.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+v+"$2$3")},y=!H&&x,B=0,A,C,D,z,F;if(v.length){v+="/"}if(y){H=1}for(;B<H;B++){A=0;if(y){C=x;k.push(w(G))}else{C=E[B].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&w(RegExp.$2))}z=C.split(",");F=z.length;for(;A<F;A++){D=z[A];i.push({media:D.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:k.length-1,minw:D.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:D.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)})}}j()},l,q,j=function(E){var v="clientWidth",x=r[v],D=u.compatMode==="CSS1Compat"&&x||u.body[v]||x,z={},C=u.createDocumentFragment(),B=b[b.length-1],w=(new Date()).getTime();if(E&&l&&w-l<g){clearTimeout(q);q=setTimeout(j,g);return}else{l=w}for(var y in i){var F=i[y];if(!F.minw&&!F.maxw||(!F.minw||F.minw&&D>=F.minw)&&(!F.maxw||F.maxw&&D<=F.maxw)){if(!z[F.media]){z[F.media]=[]}z[F.media].push(k[F.rules])}}for(var y in p){if(p[y]&&p[y].parentNode===f){f.removeChild(p[y])}}for(var y in z){var G=u.createElement("style"),A=z[y].join("\n");G.type="text/css";G.media=y;if(G.styleSheet){G.styleSheet.cssText=A}else{G.appendChild(u.createTextNode(A))}C.appendChild(G);p.push(G)}f.insertBefore(C,B.nextSibling)},n=function(v,x){var w=c();if(!w){return}w.open("GET",v,true);w.onreadystatechange=function(){if(w.readyState!=4||w.status!=200&&w.status!=304){return}x(w.responseText)};if(w.readyState==4){return}w.send(null)},c=(function(){var v=false;try{v=new XMLHttpRequest()}catch(w){v=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return v}})();a();respond.update=a;function s(){j(true)}if(e.addEventListener){e.addEventListener("resize",s,false)}else{if(e.attachEvent){e.attachEvent("onresize",s)}}})(this,(function(f){if(f.matchMedia){return true}var e,i=document,c=i.documentElement,g=c.firstElementChild||c.firstChild,h=!i.body,d=i.body||i.createElement("body"),b=i.createElement("div"),a="only all";b.id="mq-test-1";b.style.cssText="position:absolute;top:-99em";d.appendChild(b);b.innerHTML='_<style media="'+a+'"> #mq-test-1 { width: 9px; }</style>';if(h){c.insertBefore(d,g)}b.removeChild(b.firstChild);e=b.offsetWidth==9;if(h){c.removeChild(d)}else{d.removeChild(b)}return e})(this));
|
@@ -0,0 +1,113 @@
|
|
1
|
+
/*! Respond.js: min/max-width media query polyfill. Remote proxy (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
2
|
+
(function(win, doc, undefined){
|
3
|
+
var docElem = doc.documentElement,
|
4
|
+
proxyURL = doc.getElementById("respond-proxy").href,
|
5
|
+
redirectURL = (doc.getElementById("respond-redirect") || location).href,
|
6
|
+
urls = [],
|
7
|
+
refNode;
|
8
|
+
|
9
|
+
function fakejax( url, callback ){
|
10
|
+
|
11
|
+
var iframe,
|
12
|
+
AXO;
|
13
|
+
|
14
|
+
// All hail Google http://j.mp/iKMI19
|
15
|
+
// Behold, an iframe proxy without annoying clicky noises.
|
16
|
+
if ( "ActiveXObject" in win ) {
|
17
|
+
AXO = new ActiveXObject( "htmlfile" );
|
18
|
+
AXO.open();
|
19
|
+
AXO.write( '<iframe id="x"></iframe>' );
|
20
|
+
AXO.close();
|
21
|
+
iframe = AXO.getElementById( "x" );
|
22
|
+
} else {
|
23
|
+
iframe = doc.createElement( "iframe" );
|
24
|
+
iframe.style.cssText = "position:absolute;top:-99em";
|
25
|
+
docElem.insertBefore(iframe, docElem.firstElementChild || docElem.firstChild );
|
26
|
+
}
|
27
|
+
|
28
|
+
iframe.src = proxyURL + "?url=" + redirectURL + "&css=" + url;
|
29
|
+
|
30
|
+
function checkFrameName() {
|
31
|
+
var cssText;
|
32
|
+
|
33
|
+
try {
|
34
|
+
cssText = iframe.contentWindow.name;
|
35
|
+
}
|
36
|
+
catch (e) { }
|
37
|
+
|
38
|
+
if (cssText) {
|
39
|
+
// We've got what we need. Stop the iframe from loading further content.
|
40
|
+
iframe.src = "about:blank";
|
41
|
+
iframe.parentNode.removeChild(iframe);
|
42
|
+
iframe = null;
|
43
|
+
|
44
|
+
|
45
|
+
// Per http://j.mp/kn9EPh, not taking any chances. Flushing the ActiveXObject
|
46
|
+
if (AXO) {
|
47
|
+
AXO = null;
|
48
|
+
|
49
|
+
if (win.CollectGarbage) {
|
50
|
+
win.CollectGarbage();
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
callback(cssText);
|
55
|
+
}
|
56
|
+
else{
|
57
|
+
win.setTimeout(checkFrameName, 100);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
win.setTimeout(checkFrameName, 500);
|
62
|
+
}
|
63
|
+
|
64
|
+
function checkRedirectURL() {
|
65
|
+
// IE6 & IE7 don't build out absolute urls in <link /> attributes.
|
66
|
+
// So respond.proxy.gif remains relative instead of http://example.com/respond.proxy.gif.
|
67
|
+
// This trickery resolves that issue.
|
68
|
+
if (~ !redirectURL.indexOf(location.host)) {
|
69
|
+
|
70
|
+
// Inject an <a> attribute, with the redirectURL
|
71
|
+
var fakeLink = doc.createElement("div");
|
72
|
+
|
73
|
+
fakeLink.innerHTML = '<a href="' + redirectURL + '"></a>';
|
74
|
+
docElem.insertBefore(fakeLink, docElem.firstElementChild || docElem.firstChild );
|
75
|
+
|
76
|
+
// Grab the parsed URL from that dummy object
|
77
|
+
redirectURL = fakeLink.firstChild.href;
|
78
|
+
|
79
|
+
// Clean up
|
80
|
+
fakeLink.parentNode.removeChild(fakeLink);
|
81
|
+
fakeLink = null;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
function buildUrls(){
|
86
|
+
var links = doc.getElementsByTagName( "link" );
|
87
|
+
|
88
|
+
for( var i = 0, linkl = links.length; i < linkl; i++ ){
|
89
|
+
|
90
|
+
var thislink = links[i],
|
91
|
+
href = links[i].href,
|
92
|
+
ext = /^([a-zA-Z]+?:(\/\/)?(www\.)?)/;
|
93
|
+
|
94
|
+
//make sure it's an external stylesheet
|
95
|
+
if( thislink.rel.indexOf( "stylesheet" ) >= 0 && ext.test( href ) ){
|
96
|
+
(function( link ){
|
97
|
+
fakejax( href, function( css ){
|
98
|
+
link.styleSheet.rawCssText = css;
|
99
|
+
respond.update();
|
100
|
+
} );
|
101
|
+
})( thislink );
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
}
|
107
|
+
|
108
|
+
if( !respond.mediaQueriesSupported ){
|
109
|
+
checkRedirectURL();
|
110
|
+
buildUrls();
|
111
|
+
}
|
112
|
+
|
113
|
+
})( window, document );
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: respond-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gabriel Evans
|
9
|
+
- Scott Jehl
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-11-23 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: shoulda
|
17
|
+
requirement: &70250742470620 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70250742470620
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
requirement: &70250742467460 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70250742467460
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: jeweler
|
39
|
+
requirement: &70250742465900 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.6.4
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70250742465900
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rcov
|
50
|
+
requirement: &70250742464520 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70250742464520
|
59
|
+
description:
|
60
|
+
email:
|
61
|
+
- gabriel@codeconcoction.com
|
62
|
+
- scott@scottjehl.com
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files:
|
66
|
+
- README.md
|
67
|
+
files:
|
68
|
+
- .document
|
69
|
+
- Gemfile
|
70
|
+
- Gemfile.lock
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- VERSION
|
74
|
+
- lib/app/helpers/respond_helper.rb
|
75
|
+
- lib/respond-rails.rb
|
76
|
+
- lib/respond/rails/engine.rb
|
77
|
+
- lib/respond/rails/version.rb
|
78
|
+
- respond-rails.gemspec
|
79
|
+
- test/helper.rb
|
80
|
+
- test/test_respond-rails.rb
|
81
|
+
- vendor/assets/images/respond.proxy.gif
|
82
|
+
- vendor/assets/javascripts/respond-proxy.html
|
83
|
+
- vendor/assets/javascripts/respond.js
|
84
|
+
- vendor/assets/javascripts/respond.proxy.js
|
85
|
+
homepage: https://github.com/scottjehl/Respond
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
- GPL-2
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
hash: -2208054472743145419
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.8.10
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE
|
114
|
+
6-8, and more)
|
115
|
+
test_files: []
|