html5shiv-rails 0.0.1
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.
- data/MIT-LICENSE +20 -0
- data/README.md +26 -0
- data/Rakefile +13 -0
- data/lib/html5shiv-rails.rb +4 -0
- data/lib/html5shiv-rails/engine.rb +10 -0
- data/lib/html5shiv-rails/version.rb +3 -0
- data/vendor/assets/javascripts/html5shiv-printshiv.js +7 -0
- data/vendor/assets/javascripts/html5shiv.js +4 -0
- metadata +74 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2012 David Morton <mortonda@dgrmm.net>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Html5shivRails
|
|
2
|
+
|
|
3
|
+
Html5hivRails simply provides the [html5him.js and html5shim-printshim.js](https://github.com/aFarkas/html5shiv) libraries in a rails engine form.
|
|
4
|
+
|
|
5
|
+
## Rails 3.1 and up
|
|
6
|
+
|
|
7
|
+
For Rails 3.1 and greater, the files will be added to the asset pipeline and available for you to use. You have the option of `html5shiv.js` and `html5shiv-printshiv.js`, depending on if you need to support printing.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Installation
|
|
11
|
+
|
|
12
|
+
Just add this to your Gemfile:
|
|
13
|
+
|
|
14
|
+
gem 'html5shiv'
|
|
15
|
+
|
|
16
|
+
and run
|
|
17
|
+
|
|
18
|
+
bundle install
|
|
19
|
+
|
|
20
|
+
### Usage
|
|
21
|
+
|
|
22
|
+
Since you probably only want to include this when serving IE, place it in a conditional comment in the `<head>` section in your layout:
|
|
23
|
+
|
|
24
|
+
<!--[if lt IE 9]>
|
|
25
|
+
<%= javascript_include_tag 'html5shiv-printshiv' %>
|
|
26
|
+
<![endif]-->
|
data/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require "bundler/gem_tasks"
|
|
5
|
+
rescue LoadError
|
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
desc 'Convert less to scss'
|
|
11
|
+
task :convert do
|
|
12
|
+
ruby('build/convert.rb')
|
|
13
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module Html5shivRails
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
# Enabling assets precompiling under rails 3.1
|
|
4
|
+
if Rails.version >= '3.1'
|
|
5
|
+
initializer :assets do |config|
|
|
6
|
+
Rails.application.config.assets.precompile += %w( html5shiv.js html5shiv-printshiv.js )
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
(function(m,j){function q(a,c){var f=a.createElement("p"),b=a.getElementsByTagName("head")[0]||a.documentElement;f.innerHTML="x<style>"+c+"</style>";return b.insertBefore(f.lastChild,b.firstChild)}function n(){var a=k.elements;return"string"==typeof a?a.split(" "):a}function u(a){var c={},f=a.createElement,b=a.createDocumentFragment,d=b();a.createElement=function(a){if(!k.shivMethods)return f(a);var e;e=c[a]?c[a].cloneNode():v.test(a)?(c[a]=f(a)).cloneNode():f(a);return e.canHaveChildren&&!w.test(a)?
|
|
2
|
+
d.appendChild(e):e};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+n().join().replace(/\w+/g,function(a){f(a);d.createElement(a);return'c("'+a+'")'})+");return n}")(k,d)}function r(a){var c;if(a.documentShived)return a;k.shivCSS&&!s&&(c=!!q(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}"));o||(c=!u(a));if(c)a.documentShived=c;return a}function x(a){for(var c,f=a.attributes,
|
|
3
|
+
b=f.length,d=a.ownerDocument.createElement(l+":"+a.nodeName);b--;)c=f[b],c.specified&&d.setAttribute(c.nodeName,c.nodeValue);d.style.cssText=a.style.cssText;return d}function t(a){var c,f,b=a.namespaces,d=a.parentWindow;if(!y||a.printShived)return a;"undefined"==typeof b[l]&&b.add(l);d.attachEvent("onbeforeprint",function(){var g,e,i;i=a.styleSheets;for(var b=[],h=i.length,d=Array(h);h--;)d[h]=i[h];for(;i=d.pop();)if(!i.disabled&&z.test(i.media)){try{g=i.imports,e=g.length}catch(j){e=0}for(h=0;h<
|
|
4
|
+
e;h++)d.push(g[h]);try{b.push(i.cssText)}catch(k){}}g=b.reverse().join("").split("{");e=g.length;h=RegExp("(^|[\\s,>+~])("+n().join("|")+")(?=[[\\s,>+~#.:]|$)","gi");for(d="$1"+l+"\\:$2";e--;)b=g[e]=g[e].split("}"),b[b.length-1]=b[b.length-1].replace(h,d),g[e]=b.join("}");b=g.join("{");e=a.getElementsByTagName("*");h=e.length;d=RegExp("^(?:"+n().join("|")+")$","i");for(i=[];h--;)g=e[h],d.test(g.nodeName)&&i.push(g.applyElement(x(g)));f=i;c=q(a,b)});d.attachEvent("onafterprint",function(){for(var a=
|
|
5
|
+
f,b=a.length;b--;)a[b].removeNode();c.removeNode(!0)});a.printShived=!0;return a}var p=m.html5||{},w=/^<|^(?:button|form|map|select|textarea|object|iframe|option|optgroup)$/i,v=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,s,o;(function(){var a=j.createElement("a");a.innerHTML="<xyz></xyz>";s="hidden"in a;if(!(a=1==a.childNodes.length))a:{try{j.createElement("a")}catch(c){a=
|
|
6
|
+
!0;break a}a=j.createDocumentFragment();a="undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}o=a})();var k={elements:p.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==p.shivCSS,shivMethods:!1!==p.shivMethods,type:"default",shivDocument:r};m.html5=k;r(j);var z=/^$|\b(?:all|print)\b/,l="html5shiv",y=!o&&function(){var a=
|
|
7
|
+
j.documentElement;return!("undefined"==typeof j.namespaces||"undefined"==typeof j.parentWindow||"undefined"==typeof a.applyElement||"undefined"==typeof a.removeNode||"undefined"==typeof m.attachEvent)}();k.type+=" print";k.shivPrint=t;t(j)})(this,document);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(g,b){function k(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function l(a){var c={},f=a.createElement,b=a.createDocumentFragment,d=b();a.createElement=function(a){if(!e.shivMethods)return f(a);var b;b=c[a]?c[a].cloneNode():m.test(a)?(c[a]=f(a)).cloneNode():f(a);return b.canHaveChildren&&!n.test(a)?d.appendChild(b):b};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+k().join().replace(/\w+/g,function(a){f(a);
|
|
2
|
+
d.createElement(a);return'c("'+a+'")'})+");return n}")(e,d)}function h(a){var c;if(a.documentShived)return a;if(e.shivCSS&&!i){c=a.createElement("p");var b=a.getElementsByTagName("head")[0]||a.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}</style>";c=!!b.insertBefore(c.lastChild,b.firstChild)}j||(c=!l(a));if(c)a.documentShived=c;return a}var d=g.html5||{},n=/^<|^(?:button|form|map|select|textarea|object|iframe|option|optgroup)$/i,
|
|
3
|
+
m=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,i,j;(function(){var a=b.createElement("a");a.innerHTML="<xyz></xyz>";i="hidden"in a;if(!(a=1==a.childNodes.length))a:{try{b.createElement("a")}catch(c){a=!0;break a}a=b.createDocumentFragment();a="undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}j=
|
|
4
|
+
a})();var e={elements:d.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==d.shivCSS,shivMethods:!1!==d.shivMethods,type:"default",shivDocument:h};g.html5=e;h(b)})(this,document);
|
metadata
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: html5shiv-rails
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- David Morton
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-05-22 00:00:00.000000000Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: railties
|
|
16
|
+
requirement: &70206626041800 !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 3.2.0
|
|
22
|
+
- - <
|
|
23
|
+
- !ruby/object:Gem::Version
|
|
24
|
+
version: '5.0'
|
|
25
|
+
type: :runtime
|
|
26
|
+
prerelease: false
|
|
27
|
+
version_requirements: *70206626041800
|
|
28
|
+
description: While it is easy to just copy from the original github site, having it
|
|
29
|
+
in a gem file should be even easier!
|
|
30
|
+
email:
|
|
31
|
+
- mortonda@dgrmm.net
|
|
32
|
+
executables: []
|
|
33
|
+
extensions: []
|
|
34
|
+
extra_rdoc_files: []
|
|
35
|
+
files:
|
|
36
|
+
- vendor/assets/javascripts/html5shiv-printshiv.js
|
|
37
|
+
- vendor/assets/javascripts/html5shiv.js
|
|
38
|
+
- lib/html5shiv-rails/engine.rb
|
|
39
|
+
- lib/html5shiv-rails/version.rb
|
|
40
|
+
- lib/html5shiv-rails.rb
|
|
41
|
+
- MIT-LICENSE
|
|
42
|
+
- Rakefile
|
|
43
|
+
- README.md
|
|
44
|
+
homepage: https://github.com/dgm/html5shiv-rails
|
|
45
|
+
licenses: []
|
|
46
|
+
post_install_message:
|
|
47
|
+
rdoc_options: []
|
|
48
|
+
require_paths:
|
|
49
|
+
- lib
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
|
+
none: false
|
|
52
|
+
requirements:
|
|
53
|
+
- - ! '>='
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '0'
|
|
56
|
+
segments:
|
|
57
|
+
- 0
|
|
58
|
+
hash: -1169509441844951968
|
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
|
+
none: false
|
|
61
|
+
requirements:
|
|
62
|
+
- - ! '>='
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '0'
|
|
65
|
+
segments:
|
|
66
|
+
- 0
|
|
67
|
+
hash: -1169509441844951968
|
|
68
|
+
requirements: []
|
|
69
|
+
rubyforge_project:
|
|
70
|
+
rubygems_version: 1.8.10
|
|
71
|
+
signing_key:
|
|
72
|
+
specification_version: 3
|
|
73
|
+
summary: A rails gem theat bundles the html5-shiv in a gem
|
|
74
|
+
test_files: []
|