css_browser_selector 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.gitignore +4 -0
- data/CHANGELOG +13 -0
- data/Gemfile +6 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +169 -0
- data/Rakefile +27 -0
- data/css_browser_selector.gemspec +20 -0
- data/gem_tasks/test.rake +7 -0
- data/lib/action_controller/caching_tracker.rb +45 -0
- data/lib/action_view/helpers/css_browser_selector.rb +143 -0
- data/lib/css_browser_selector.rb +10 -0
- data/lib/css_browser_selector/javascript.rb +20 -0
- data/lib/css_browser_selector/version.rb +3 -0
- data/lib/javascripts/css_browser_selector.js +8 -0
- data/test/css_browser_selector_test.rb +319 -0
- metadata +80 -0
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/CHANGELOG
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
* updatedruby version ofdetermine_browser_and_os to match version v0.2.7 of css_browser_selector which adds firefox versions keeping additions for safari version and additions to os for iphone and ipod.
|
2
|
+
|
3
|
+
* Added class to load javascript from expected location within the plugin, offering helpers to inspect version andremove comments. css_browser_selector method relies on this file loader to get the javascript.
|
4
|
+
|
5
|
+
* Updatedtests to reflect firefox versions (2/3)
|
6
|
+
|
7
|
+
* Fixed Javascript that sets addLoadEvent to Window, IE only knows about window (lowercase 'W') [reidmix]
|
8
|
+
|
9
|
+
* The body and html methods are now aware of page caching and revert to javascript version if the action is page cached so that the css selectors will not be saved in the rendered html and be determined dynamically. Added javascript_to_add_js_to method to encapsulate page caching awareness so that the window_on_load_add_js_to_tag will be removed if page caching is turned on. Updated documentation. [reidmix]
|
10
|
+
|
11
|
+
* Added action_controller/caching_tracker to aid tracking page caching by a controller [reidmix]
|
12
|
+
|
13
|
+
* Renamed no_more_browser_hacks to css_browser_selector for consistency with the javascript. [reidmix]
|
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Los Angeles Times (http://www.latimes.com)
|
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.rdoc
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
= CssBrowserSelector
|
2
|
+
|
3
|
+
A plugin based on the css_browser_selector to add the browser type and os to either the +body+ and/or +html+
|
4
|
+
elements within a document. The full usage on how to use these css selectors can be understood at:
|
5
|
+
|
6
|
+
http://rafael.adm.br/css_browser_selector/
|
7
|
+
|
8
|
+
Major Props to Rafael Lima (from above link) who implemented this JS and has helped me with the plugin.
|
9
|
+
|
10
|
+
The initial implementation relies on javascript to place these selectors on the +html+ element. This plugin
|
11
|
+
will add these selectors to a page regardless of whether or not javascript is enabled.
|
12
|
+
|
13
|
+
CssBrowserSelector plugin provides an implementation for +body+ and +html+ content_tags, supplying the css_browser_selectors by default. The original javascript is also supplied and can be rendered inline
|
14
|
+
if this is your preference, along with some other helper javascripts.
|
15
|
+
|
16
|
+
CssBrowswerSelector is aware of Page Caching and tracks each controller's +caches_page+ actions. If the
|
17
|
+
page is cached, CssBrowserSelector will revert to the original javascript only version of css_browser_selector
|
18
|
+
the browser and platform _will not_ be cached into the rendered html. See more in Caching, below.
|
19
|
+
|
20
|
+
== Body Example
|
21
|
+
|
22
|
+
To add css_browser_selectors to your body tag in your layout (make sure you don't output the content with
|
23
|
+
+<%= %>+ or you may end up with double content). Do the following:
|
24
|
+
|
25
|
+
<% body do %>
|
26
|
+
<%= yield %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
This will render, depending on your user agent string:
|
30
|
+
|
31
|
+
<body class="gecko mac">
|
32
|
+
<div>This is a test</div>
|
33
|
+
</body>
|
34
|
+
|
35
|
+
== HTML Options
|
36
|
+
|
37
|
+
You may pass any html_options as you would expect:
|
38
|
+
|
39
|
+
<% body :onload => "alert('yo')" do %>
|
40
|
+
<%= yield %>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
Renders:
|
44
|
+
|
45
|
+
<body class="gecko mac" onload="alert('yo')">
|
46
|
+
<div>This is a test</div>
|
47
|
+
</body>
|
48
|
+
|
49
|
+
== HTML Example
|
50
|
+
|
51
|
+
Or, if you prefer, you can add the css_browser_selectors to your html tag as first realized in the original
|
52
|
+
javascript.
|
53
|
+
|
54
|
+
<% html do %>
|
55
|
+
<head>
|
56
|
+
<title>Example</title>
|
57
|
+
</head>
|
58
|
+
<body>
|
59
|
+
<%= yield %>
|
60
|
+
</body>
|
61
|
+
<% end %>
|
62
|
+
|
63
|
+
Renders, by default, with the following attributes (which may be overriden by passing options):
|
64
|
+
|
65
|
+
<html class="gecko mac" xmlns="http://www.w3.org/1999/xhtml" xml:lang=>"en" lang=>"en">
|
66
|
+
<head>
|
67
|
+
<title>Example</title>
|
68
|
+
</head>
|
69
|
+
<body>
|
70
|
+
<div>This is a test</div>
|
71
|
+
</body>
|
72
|
+
</html>
|
73
|
+
|
74
|
+
== Javascripts
|
75
|
+
|
76
|
+
You can use the plugin just to include the original css_browser_selector javascript inline:
|
77
|
+
|
78
|
+
<%= javascript_tag css_browser_selector %>
|
79
|
+
|
80
|
+
Renders, as you would expect:
|
81
|
+
|
82
|
+
<script type="text/javascript">
|
83
|
+
//<![CDATA[
|
84
|
+
var css_browser_selector = function() {
|
85
|
+
var
|
86
|
+
ua=navigator.userAgent.toLowerCase(),
|
87
|
+
is=function(t){ return ua.indexOf(t) != -1; },
|
88
|
+
h=document.getElementsByTagName('html')[0],
|
89
|
+
b=(!(/opera|webtv/i.test(ua))&&/msie (d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
|
90
|
+
os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
|
91
|
+
var c=b+os+' js';
|
92
|
+
h.className += h.className?' '+c:c;
|
93
|
+
}();
|
94
|
+
//]]>
|
95
|
+
</script>
|
96
|
+
|
97
|
+
You can pass the css_browser_selector a string or symbol of the tag in which to place the selectors ('html'
|
98
|
+
is the default):
|
99
|
+
|
100
|
+
<%= javascript_tag css_browser_selector(:body) %>
|
101
|
+
|
102
|
+
Changes this line in the script:
|
103
|
+
|
104
|
+
h=document.getElementsByTagName('body')[0],
|
105
|
+
|
106
|
+
To add the 'js' selector to your element, a Page Cache aware helper to include inline javascript is available:
|
107
|
+
|
108
|
+
<%= javascript_to_add_js_to :body %>
|
109
|
+
|
110
|
+
This will put the following javascript inline:
|
111
|
+
|
112
|
+
<script type="text/javascript">
|
113
|
+
//<![CDATA[
|
114
|
+
Window.addLoadEvent = function(f){var oldf=window.onload; window.onload=(typeof window.onload!='function')?f:function(){oldf();f();}}
|
115
|
+
Window.addLoadEvent(function(){e=document.getElementsByTagName('body')[0];e.className+=e.className?' js':'js'})
|
116
|
+
//]]>
|
117
|
+
</script>
|
118
|
+
|
119
|
+
This script is included only if the action is not page cached. If the page is cached, the javascript version
|
120
|
+
of css_browser_selector will add the 'js' selector to your element. If you want to by-pass this Page Caching
|
121
|
+
awareness you can:
|
122
|
+
|
123
|
+
<%= javascript_tag window_on_load_add_js_to_tag(:body) %>
|
124
|
+
|
125
|
+
If you enjoy the +Window.addLoadEvent+ function and wish to use it alone, as a convenience you can:
|
126
|
+
|
127
|
+
<%= javascript_tag window_add_load_event %>
|
128
|
+
|
129
|
+
== Options
|
130
|
+
|
131
|
+
For those who wish to use the +html+ and +body+ content tags but wish to turn off the css_browser_selectors you can
|
132
|
+
turn them off. For example, if you are using both helpers:
|
133
|
+
|
134
|
+
<% html :exclude_browser_and_os => true do %>
|
135
|
+
<head>
|
136
|
+
<title>Example</title>
|
137
|
+
</head>
|
138
|
+
<% body do %>
|
139
|
+
<%= yield %>
|
140
|
+
<% end %>
|
141
|
+
<% end %>
|
142
|
+
|
143
|
+
Renders:
|
144
|
+
|
145
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang=>"en" lang=>"en">
|
146
|
+
<head>
|
147
|
+
<title>Example</title>
|
148
|
+
</head>
|
149
|
+
<body class="gecko mac">
|
150
|
+
<div>This is a test</div>
|
151
|
+
</body>
|
152
|
+
</html>
|
153
|
+
|
154
|
+
== Page Caching
|
155
|
+
|
156
|
+
CssBrowserSelector keeps track of all the actions that each controller lists in +caches_page+ in a class attribute
|
157
|
+
called +page_cached_actions+. Each controller instance will have a method called page_cached? to determine if the action was listed in +caches_page+ and honors the +perform_caching+ configuration.
|
158
|
+
|
159
|
+
Currently, it does _not_ keep track of actions cached directly through +cache_page+, but could be extended in the
|
160
|
+
future to handle this need. Additionally, it does not track action_caching which could also be added at a later
|
161
|
+
time.
|
162
|
+
|
163
|
+
Both the +page_cached_action+ class variable and +page_cached?+ instance method are added by the +ActionController::CachingTracker+ module and can be accessed from anywhere you can get a reference to a controller:
|
164
|
+
|
165
|
+
CustomController.page_cached_actions #=> ["new", "show"]
|
166
|
+
controller.page_cached_actions #=> ["new", "show"]
|
167
|
+
controller.page_cached? #=> true if perform_caching is true and is action_name in page_cached_actions
|
168
|
+
|
169
|
+
Copyright (c) 2008 Los Angeles Times (http://www.latimes.com) released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Dir['gem_tasks/**/*.rake'].each { |rake| load rake }
|
2
|
+
|
3
|
+
task :default => :test
|
4
|
+
|
5
|
+
|
6
|
+
# require 'rake'
|
7
|
+
# require 'rake/testtask'
|
8
|
+
# require 'rake/rdoctask'
|
9
|
+
#
|
10
|
+
# desc 'Default: run unit tests.'
|
11
|
+
# task :default => :test
|
12
|
+
#
|
13
|
+
# desc 'Test the nomobroha plugin.'
|
14
|
+
# Rake::TestTask.new(:test) do |t|
|
15
|
+
# t.libs << 'lib'
|
16
|
+
# t.pattern = 'test/**/*_test.rb'
|
17
|
+
# t.verbose = true
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# desc 'Generate documentation for the nomobroha plugin.'
|
21
|
+
# Rake::RDocTask.new(:rdoc) do |rdoc|
|
22
|
+
# rdoc.rdoc_dir = 'rdoc'
|
23
|
+
# rdoc.title = 'Nomobroha'
|
24
|
+
# rdoc.options << '--line-numbers' << '--inline-source'
|
25
|
+
# rdoc.rdoc_files.include('README')
|
26
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
27
|
+
# end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "css_browser_selector/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "css_browser_selector"
|
7
|
+
s.version = CssBrowserSelector::VERSION
|
8
|
+
s.authors = ["Reid MacDonald", "John Dewey", "Mani Tadayon"]
|
9
|
+
s.email = ["bowsersenior@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/attinteractive/css_browser_selector"
|
11
|
+
s.summary = %q{Gives the ability to write specific CSS code for each operating system and each browser from the backend or through JS. }
|
12
|
+
s.description = %q{A plugin based on the css_browser_selector to add the browser type and os to either the body and/or html elements within a document. The full usage on how to use these css selectors can be understood at: http://rafael.adm.br/css_browser_selector/}
|
13
|
+
|
14
|
+
s.add_development_dependency "rails", "~>2.3.5"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
end
|
data/gem_tasks/test.rake
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module ActionController #:nodoc:
|
2
|
+
module CachingTracker
|
3
|
+
# Tracks what is being cached. There are three types of Caching in Rails: Page, Action, Fragment.
|
4
|
+
# Currently, only Page Caching is tracked but this could be extended to track Action and Fragment caching.
|
5
|
+
def self.included(base) #:nodoc:
|
6
|
+
base.class_eval { include TrackPages }
|
7
|
+
end
|
8
|
+
|
9
|
+
# Methods to track pages that are cached. Adds the class variable +page_cached_actions+ to each
|
10
|
+
# controller that includes +CachingTracker+. Inserts the tracking mechanism on the caches_page
|
11
|
+
# method.
|
12
|
+
module TrackPages
|
13
|
+
def self.included(base) #:nodoc:
|
14
|
+
base.extend(ClassMethods)
|
15
|
+
base.class_eval do
|
16
|
+
include InstanceMethods
|
17
|
+
|
18
|
+
@@page_cached_actions = []
|
19
|
+
cattr_accessor :page_cached_actions
|
20
|
+
class << self
|
21
|
+
alias_method_chain :caches_page, :tracking
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClassMethods
|
27
|
+
# Saves the collection of actions that are passed to +caches_page+ if +perform_caching+ is true.
|
28
|
+
def caches_page_with_tracking(*actions)
|
29
|
+
self.page_cached_actions = actions.map(&:to_s) if perform_caching
|
30
|
+
caches_page_without_tracking(*actions)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module InstanceMethods
|
35
|
+
# Helper to determine if the controller action is currently being page cached (ie. passed to
|
36
|
+
# the +caches_page+ method). This is based on the controller instance's +action_name+ but
|
37
|
+
# you can optionally pass the string name of the action:
|
38
|
+
# controller.page_cached?("new")
|
39
|
+
def page_cached?(action = action_name)
|
40
|
+
page_cached_actions.include?(action)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'action_view/helpers/tag_helper'
|
2
|
+
require 'action_view/helpers/text_helper'
|
3
|
+
require 'action_view/helpers/capture_helper'
|
4
|
+
|
5
|
+
module ActionView
|
6
|
+
module Helpers
|
7
|
+
module CssBrowserSelector
|
8
|
+
include TagHelper
|
9
|
+
include TextHelper
|
10
|
+
include CaptureHelper
|
11
|
+
|
12
|
+
# Javascript version of the CSS Browser Selector, can be put inline into the page / layout
|
13
|
+
# by <%= javascript_tag css_browser_selector %>
|
14
|
+
#
|
15
|
+
# Can pass in an tag name in which the script will place the css browser selectors:
|
16
|
+
# <%= javascript_tag css_browser_selector('body')
|
17
|
+
#
|
18
|
+
# To turn off comments for the smallest javascript possible, pass false as a second parameter:
|
19
|
+
# <%= javascript_tag css_browser_selector('body', false)
|
20
|
+
#
|
21
|
+
# This file is originally read off of disk from within the plugin's lib at javascripts/css_browser_selector.js
|
22
|
+
def css_browser_selector(tag = 'html', show_comments = true)
|
23
|
+
@javascript ||= ::CssBrowserSelector::Javascript.contents(show_comments)
|
24
|
+
@javascript.gsub('html', tag)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Inline javascript to creates an addLoadEvent method on Window to allow onload functions to
|
28
|
+
# be chained together without clobbering any prior onloads that may have been attached. This
|
29
|
+
# can be added inline, standalone like so:
|
30
|
+
# <%= javascript_tag window_add_load_event %>
|
31
|
+
def window_add_load_event
|
32
|
+
%(window.addLoadEvent = function(f){var oldf=window.onload; window.onload=(typeof window.onload!='function')?f:function(){oldf();f();}})
|
33
|
+
end
|
34
|
+
|
35
|
+
# Combines the window_add_load_event and window_add_js_to_tag methods to be run within one
|
36
|
+
# script element:
|
37
|
+
# <%= javascript_tag window_on_load_add_js_to_tag(:body) %>
|
38
|
+
def window_on_load_add_js_to_tag(tagname)
|
39
|
+
"#{window_add_load_event}\n#{window_add_js_to_tag(tagname)}"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Page cached aware helper method that is equivalent to:
|
43
|
+
# <%= javascript_tag window_on_load_add_js_to_tag(tag) unless controller.page_cached? %>
|
44
|
+
#
|
45
|
+
# Example: if you are using the body content element:
|
46
|
+
# <%= javascript_to_add_js_to :body %>
|
47
|
+
def javascript_to_add_js_to(tag)
|
48
|
+
javascript_tag window_on_load_add_js_to_tag(tag) unless controller.page_cached?
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates the html content element with css_browser_selectors added to its class attribute.
|
52
|
+
# Includes by default the following attributes (which can be overridden):
|
53
|
+
# <html xmlns="http://www.w3.org/1999/xhtml" xml:lang=>"en" lang=>"en">
|
54
|
+
def html(html_options = {}, &block)
|
55
|
+
html_options.reverse_merge!(:xmlns=>"http://www.w3.org/1999/xhtml", :"xml:lang"=>"en", :lang=>"en")
|
56
|
+
add_css_browser_selectors_to_tag(:html, html_options, &block)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Creates the body content element with css_browser_selectors added to its class attribute.
|
60
|
+
def body(html_options = {}, &block)
|
61
|
+
add_css_browser_selectors_to_tag(:body, html_options, &block)
|
62
|
+
end
|
63
|
+
|
64
|
+
# # arguments: name, content options, escape = true
|
65
|
+
# # will dry up once I get working
|
66
|
+
# def content_tag_string_with_css_browser_selector(*args)
|
67
|
+
# if args[0] == :html or args[0] == :body
|
68
|
+
# html_options = args[2]||{}
|
69
|
+
# exclude_browser_and_os = html_options.delete(:exclude_browser_and_os)
|
70
|
+
# unless exclude_browser_and_os or (bros = determine_browser_and_os).empty?
|
71
|
+
# html_options[:class] = html_options[:class] ? "#{html_options[:class]} #{bros}" : bros
|
72
|
+
# end
|
73
|
+
# args[2] = html_options if html_options
|
74
|
+
# end
|
75
|
+
# content_tag_string_without_css_browser_selector(*args)
|
76
|
+
# end
|
77
|
+
# alias_method_chain :content_tag_string, :css_browser_selector
|
78
|
+
|
79
|
+
private
|
80
|
+
# Inline javascript to add the 'js' class to the supplied tag. Adds the 'js' css_browser_selector
|
81
|
+
# class, which must rely on javascript to be enabled to run. Relies on
|
82
|
+
# +Window.addLoadEvent+ method to be added (with the window_add_load_event method)
|
83
|
+
# <%= javascript_tag window_add_js_to_tag(:body)
|
84
|
+
def window_add_js_to_tag(tagname)
|
85
|
+
%(window.addLoadEvent(function(){e=document.getElementsByTagName('#{tagname}')[0];e.className+=e.className?' js':'js'}))
|
86
|
+
end
|
87
|
+
|
88
|
+
# Underlying content builder for both the +html+ and +body+ functions
|
89
|
+
def add_css_browser_selectors_to_tag(tag, html_options = {}, &block)
|
90
|
+
html_options ||= {}
|
91
|
+
exclude_browser_and_os = html_options.delete(:exclude_browser_and_os)
|
92
|
+
unless exclude_browser_and_os or (bros = determine_browser_and_os).empty? or controller.page_cached?
|
93
|
+
html_options[:class] = html_options[:class] ? "#{html_options[:class]} #{bros}" : bros
|
94
|
+
end
|
95
|
+
|
96
|
+
open_tag, close_tag = content_tag(tag, "<>", html_options).split('<>')
|
97
|
+
|
98
|
+
concat_compat open_tag
|
99
|
+
concat_compat "\n#{javascript_tag(css_browser_selector(tag, false))}" if controller.page_cached?
|
100
|
+
block.call if block_given?
|
101
|
+
concat_compat close_tag
|
102
|
+
end
|
103
|
+
|
104
|
+
# Backwards compatible concat call
|
105
|
+
def concat_compat(content)
|
106
|
+
method(:concat).arity == 2 ? concat(content, block.binding) : concat(content)
|
107
|
+
end
|
108
|
+
|
109
|
+
# The ruby version of the CSS Browser Selector with some additions
|
110
|
+
# TODO: This should be moved to a parser.
|
111
|
+
def determine_browser_and_os(ua = request.env["HTTP_USER_AGENT"])
|
112
|
+
ua = (ua||"").downcase
|
113
|
+
br = case ua
|
114
|
+
when /opera[\/,\s+](\d+)/
|
115
|
+
o = %W(opera opera#{$1})
|
116
|
+
o << "mobile" if ua.include?('mini')
|
117
|
+
o.join(" ")
|
118
|
+
when /webtv/ ; "gecko"
|
119
|
+
when /msie (\d)/ ; "ie ie#{$1}"
|
120
|
+
when %r{firefox/2} ; "gecko ff2"
|
121
|
+
when %r{firefox/3.5} ; "gecko ff3 ff3_5"
|
122
|
+
when %r{firefox/3} ; "gecko ff3"
|
123
|
+
when /konqueror/ ; "konqueror"
|
124
|
+
when /applewebkit\/([\d.]+).? \([^)]*\) ?(?:version\/(\d+))?.*$/
|
125
|
+
o = %W(webkit)
|
126
|
+
if ua.include?('iron')
|
127
|
+
o << 'iron'
|
128
|
+
elsif ua.include?('chrome')
|
129
|
+
o << 'chrome'
|
130
|
+
else
|
131
|
+
o << "safari safari"+ ($2 || (($1.to_i >= 400) ? '2' : '1'))
|
132
|
+
end
|
133
|
+
o.join(" ")
|
134
|
+
when /gecko/, /mozilla/ ; "gecko"
|
135
|
+
end
|
136
|
+
os = ua.include?('mac') || ua.include?('darwin') ? ua.include?('iphone') ? 'iphone' : ua.include?('ipod') ? 'ipod' : 'mac' :
|
137
|
+
ua.include?('x11') || ua.include?('linux') ? 'linux' :
|
138
|
+
ua.include?('win') ? 'win' : nil
|
139
|
+
"#{br}#{" " unless br.nil? or os.nil?}#{os}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'css_browser_selector/version'
|
2
|
+
require 'css_browser_selector/javascript'
|
3
|
+
|
4
|
+
require 'action_view/helpers/css_browser_selector'
|
5
|
+
ActionView::Base.send(:include, ActionView::Helpers::CssBrowserSelector)
|
6
|
+
|
7
|
+
require 'action_controller/caching_tracker'
|
8
|
+
ActionController::Base.send(:include, ActionController::CachingTracker)
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module CssBrowserSelector
|
2
|
+
module Javascript
|
3
|
+
FILENAME = File.join(File.dirname(__FILE__), 'javascripts', 'css_browser_selector.js')
|
4
|
+
|
5
|
+
def self.version
|
6
|
+
@@version ||= raw_file.match(/CSS Browser Selector v(\d\.\d\.\d)/)[1]
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.contents(show_comments = true)
|
10
|
+
contents = raw_file.dup
|
11
|
+
contents.gsub!(/\/\*.*\*\/\n/m, '') unless show_comments
|
12
|
+
contents
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def self.raw_file
|
17
|
+
@@raw_file ||= File.new(FILENAME).read
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
CSS Browser Selector v0.3.3 (Sep 09, 2009)
|
3
|
+
Rafael Lima (http://rafael.adm.br)
|
4
|
+
http://rafael.adm.br/css_browser_selector
|
5
|
+
License: http://creativecommons.org/licenses/by/2.5/
|
6
|
+
Contributors: http://rafael.adm.br/css_browser_selector#contributors
|
7
|
+
*/
|
8
|
+
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
|
@@ -0,0 +1,319 @@
|
|
1
|
+
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
2
|
+
%w(
|
3
|
+
rubygems
|
4
|
+
test/unit
|
5
|
+
test/unit/assertions
|
6
|
+
active_support
|
7
|
+
action_view/helpers/javascript_helper
|
8
|
+
action_view/helpers/css_browser_selector
|
9
|
+
action_controller
|
10
|
+
action_controller/test_case
|
11
|
+
).each {|f| require f}
|
12
|
+
|
13
|
+
# browser strings found at : http://www.zytrax.com/tech/web/browser_ids.htm
|
14
|
+
|
15
|
+
class TestController
|
16
|
+
attr_accessor :page_cached
|
17
|
+
alias_method :page_cached?, :page_cached
|
18
|
+
end
|
19
|
+
|
20
|
+
class CssBrowswerSelectorTest < Test::Unit::TestCase
|
21
|
+
include ActionView::Helpers::CssBrowserSelector
|
22
|
+
include ActionView::Helpers::JavaScriptHelper
|
23
|
+
include ActionController::TestCase::Assertions
|
24
|
+
attr_accessor :request, :controller, :output_buffer
|
25
|
+
|
26
|
+
def setup
|
27
|
+
self.request = ActionController::TestRequest.new
|
28
|
+
self.controller = TestController.new
|
29
|
+
self.controller.page_cached = false
|
30
|
+
self.output_buffer = ''
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_html_tag_helper
|
34
|
+
request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
35
|
+
expected = %(<html class="gecko ff2 mac" xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"><body>test</body></html>)
|
36
|
+
html { concat "<body>test</body>" }
|
37
|
+
assert_dom_equal expected, output_buffer
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_body_tag_helper
|
41
|
+
request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
42
|
+
expected = %(<body class="gecko ff2 mac"><div>test</div></body>)
|
43
|
+
body { concat "<div>test</div>" }
|
44
|
+
assert_dom_equal expected, output_buffer
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_html_tag_helper_exclude_browser_and_os
|
48
|
+
request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
49
|
+
expected = %(<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"><body>test</body></html>)
|
50
|
+
html(:exclude_browser_and_os => true) { concat "<body>test</body>" }
|
51
|
+
assert_dom_equal expected, output_buffer
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_body_tag_helper_exclude_browser_and_os
|
55
|
+
request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
56
|
+
expected = %(<body><div>test</div></body>)
|
57
|
+
body(:exclude_browser_and_os => true) { concat "<div>test</div>" }
|
58
|
+
assert_dom_equal expected, output_buffer
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_body_tag_helper_does_not_add_js_to_body_onload_when_no_browser_or_os_detected
|
62
|
+
request.env["HTTP_USER_AGENT"]=""
|
63
|
+
expected = %(<body><div>test</div></body>)
|
64
|
+
body { concat "<div>test</div>" }
|
65
|
+
assert_dom_equal expected, output_buffer
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_html_tag_helper_does_not_add_js_to_body_onload_when_no_browser_or_os_detected
|
69
|
+
request.env["HTTP_USER_AGENT"]=""
|
70
|
+
expected = %(<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"><body>test</body></html>)
|
71
|
+
html { concat "<body>test</body>" }
|
72
|
+
assert_dom_equal expected, output_buffer
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_html_continues_to_pass_html_options
|
76
|
+
request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
77
|
+
expected = %(<html id="news" class="sports gecko ff2 mac" xml:lang="en" lang="fr" xmlns="http://www.w3.org/1999/xhtml"><body>test</body></html>)
|
78
|
+
html(:lang=>"fr", :id=>"news", :class=>"sports") { concat "<body>test</body>" }
|
79
|
+
assert_dom_equal expected, output_buffer
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_body_continues_to_pass_html_options
|
83
|
+
request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
84
|
+
expected = %(<body onclick="alert('yo')" class="message gecko ff2 mac"><div>test</div></body>)
|
85
|
+
body(:onclick=>"alert('yo')", :class => "message") { concat "<div>test</div>" }
|
86
|
+
assert_dom_equal expected, output_buffer
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_window_add_load_event_script
|
90
|
+
expected = %(<script type="text/javascript">\n//<![CDATA[\nwindow.addLoadEvent = function(f){var oldf=window.onload; window.onload=(typeof window.onload!='function')?f:function(){oldf();f();}}\n//]]>\n</script>)
|
91
|
+
assert_equal expected, javascript_tag(window_add_load_event)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_window_on_load_add_js_to_tag_script
|
95
|
+
expected = %(<script type="text/javascript">\n//<![CDATA[\n) +
|
96
|
+
%(window.addLoadEvent = function(f){var oldf=window.onload; window.onload=(typeof window.onload!='function')?f:function(){oldf();f();}}\n) +
|
97
|
+
%(window.addLoadEvent(function(){e=document.getElementsByTagName('body')[0];e.className+=e.className?' js':'js'})\n//]]>\n</script>)
|
98
|
+
assert_equal expected, javascript_tag(window_on_load_add_js_to_tag(:body))
|
99
|
+
end
|
100
|
+
|
101
|
+
# def test_html_content_tag_with_browser_selectors
|
102
|
+
# request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
103
|
+
# expected = %(<html class="gecko mac"><body>Hello world!</body></html>)
|
104
|
+
# assert_dom_equal expected, content_tag(:html, "<body>Hello world!</body>")
|
105
|
+
#
|
106
|
+
# expected = %(<body class="strong gecko mac"><p>Hello world!</p></body></html>)
|
107
|
+
# assert_dom_equal expected, content_tag(:body, content_tag(:p, "Hello world!"), :class => "strong")
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
#
|
111
|
+
# def test_html_content_tag_with_block_and_browser_selectors
|
112
|
+
# request.env["HTTP_USER_AGENT"]="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
|
113
|
+
# expected = %(<body class="strong gecko mac"><p>Hello world!</p></body></html>)
|
114
|
+
# content_tag(:body, :class => "strong") do
|
115
|
+
# "Hello World!"
|
116
|
+
# end
|
117
|
+
# assert_dom_equal(expected,
|
118
|
+
# end
|
119
|
+
|
120
|
+
### TODO: Automatically grab tests from rafaelp/css_browser_selector
|
121
|
+
def test_no_browser_strings
|
122
|
+
assert_browser_strings({"" => ""})
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_iron_browser_strings
|
126
|
+
assert_browser_strings({
|
127
|
+
"mozilla/5.0 (windows; u; windows nt 5.1; en-us) applewebkit/530.1 (khtml, like gecko) iron/2.0.168.0 safari/530.1" => "webkit iron win" # iron
|
128
|
+
})
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_camino_browser_strings
|
132
|
+
assert_browser_strings({
|
133
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.6) Gecko/20070809 Camino/1.5.1" => "gecko mac", # camino
|
134
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.1) Gecko/20060118 Camino/1.0b2+" => "gecko mac", # camino nightly
|
135
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030917 Camino/0.7+" => "gecko mac", # camino
|
136
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20021104 Chimera/0.6" => "gecko mac" # camino chimera
|
137
|
+
})
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_chrome_browser_strings
|
141
|
+
assert_browser_strings({
|
142
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13" => "webkit chrome win",
|
143
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13" => "webkit chrome win"
|
144
|
+
})
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_firefox_browser_strings
|
148
|
+
assert_browser_strings({
|
149
|
+
"mozilla/5.0 (macintosh; u; intel mac os x 10.5; en-gb; rv:1.9.1) gecko/20090624 firefox/3.5" => "gecko ff3 ff3_5 mac", # firefox 3.5 mac
|
150
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" => "gecko ff2 mac", # firefox 2 mac
|
151
|
+
"Mozilla/5.0 (X11; U; Darwin Power Macintosh; en-US; rv:1.8.0.12) Gecko/20070803 Firefox/1.5.0.12 Fink Community Edition" => "gecko mac", # firefox 1.5 darwin
|
152
|
+
"Mozilla/5.0 (Windows; u; Windows NT 5.1; en-us; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1" => "gecko ff3 win", # firefox 3 win
|
153
|
+
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9a7) Gecko/2007080210 GranParadiso/3.0a7" => "gecko win", # firefox dev
|
154
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007120505 Minefield/3.0b2pre" => "gecko win", # firefox dev
|
155
|
+
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11" => "gecko ff2 win", # firefox 2 vista
|
156
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.13) Gecko/20060410 Firefox/1.0.8" => "gecko win", # firefox 1 xp
|
157
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20041002 Firefox/0.10.1" => "gecko win", # firefox pre v1
|
158
|
+
"Mozilla/5.0 (X11; U; SunOS sun4m; en-US; rv:1.4b) Gecko/20030517 Mozilla Firebird/0.6" => "gecko linux", # firefox firebird
|
159
|
+
"Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5" => "gecko win", # firefox phoenix
|
160
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20020923 Phoenix/0.1" => "gecko win", # firefox phoenix xp
|
161
|
+
"Mozilla/3.0 (x86 [en] Windows NT 5.1; Sun)" => "gecko win" # hotjava
|
162
|
+
})
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_navigator_browser_strings
|
166
|
+
assert_browser_strings({
|
167
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8pre) Gecko/20071019 Firefox/2.0.0.8 Navigator/9.0.0.1" => "gecko ff2 win", # Navigator 9 with Firefox fixes
|
168
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.0" => "opera opera9 win", # Opera 9
|
169
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20050519 Netscape/8.0.1" => "gecko win", # A real Firefox based Netscape 8 with a security patch (already) on Win 2K
|
170
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" => "gecko win", # Netscape 7.2 and still we're wondering what's the (ax)?
|
171
|
+
"Mozilla/5.0 (Windows; U; WinNT4.0; en-CA; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1" => "gecko win", # NS 6.2.1 on NT4.0.
|
172
|
+
"Mozilla/4.8 [en] (X11; U; Linux 2.4.20-8 i686)" => "gecko linux", # NS 4.8 on Redhat 9
|
173
|
+
"Mozilla/3.01 (WinNT; I) [AXP]" => "gecko win", # NS 3.01 on DEC ALPHA under NT
|
174
|
+
"Mozilla/2.02 [fr] (WinNT; I)" => "gecko win", # NS 2.02 on MS NT 4.0.
|
175
|
+
"Mozilla/0.91 Beta (Windows)" => "gecko win", # The ex-new dinosaur string. Netscape 0.91, a pre-1.0 beta release from 1994.
|
176
|
+
"Mozilla/0.6 Beta (Windows)" => "gecko win" # The new dinosaur string. Netscape 0.6 on WfWG 3.11.
|
177
|
+
})
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_konqueror_browser_strings
|
181
|
+
assert_browser_strings({
|
182
|
+
"Mozilla/5.0 (compatible; Konqueror/4.0; Microsoft Windows) KHTML/4.0.80 (like Gecko)" => "konqueror win", # konqueror win
|
183
|
+
"Mozilla/5.0 (compatible; Konqueror/3.92; Microsoft Windows) KHTML/3.92.0 (like Gecko)" => "konqueror win", # konqueror win
|
184
|
+
"Mozilla/5.0 (compatible; Konqueror/3.5; Darwin) KHTML/3.5.6 (like Gecko)" => "konqueror mac", # konqueror mac
|
185
|
+
"Mozilla/5.0 (compatible; Konqueror/3.5; Darwin 8.10.0; X11; Power Macintosh; en_US)KHTML/3.5.6 (like Gecko)" => "konqueror mac", # konqueror darwin
|
186
|
+
"Mozilla/5.0 (compatible; Konqueror/3.5; Linux; X11; x86_64) KHTML/3.5.6 (like Gecko) (Kubuntu)" => "konqueror linux", # konqueror linux
|
187
|
+
"Mozilla/5.0 (compatible; Konqueror/3.4; CYGWIN_NT-5.1) KHTML/3.4.89 (like Gecko)" => "konqueror win", # konqueror cygwin
|
188
|
+
"Mozilla/5.0 (compatible; Konqueror/3.5; Linux 2.6.14-kanotix-6; X11) KHTML/3.5.3 (like Gecko) (Debian package 4:3.5.3-1)" => "konqueror linux", # konqueror linux
|
189
|
+
"Mozilla/5.0 (compatible; Konqueror/3.5; Linux; X11; i686; en_US) KHTML/3.5.3 (like Gecko)" => "konqueror linux", # konqueror suse linux
|
190
|
+
"Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.3 (like Gecko) (Kubuntu package 4:3.4.3-0ubuntu1)" => "konqueror linux", # konqueror ubuntu
|
191
|
+
"Mozilla/5.0 (compatible; Konqueror/3.4; FreeBSD) KHTML/3.4.3 (like Gecko)" => "konqueror", # konqueror freebsd
|
192
|
+
"Mozilla/5.0 (compatible; Konqueror/3.4; Linux 2.6.8; X11; i686; en_US) KHTML/3.4.0 (like Gecko)" => "konqueror linux", # konqueror mandriva
|
193
|
+
"Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.1 (like Gecko)" => "konqueror linux", # konqueror mandriva
|
194
|
+
"Mozilla/5.0 (compatible; Konqueror/3.4; Linux 2.6.8; X11; i686; en_US) KHTML/3.4.0 (like Gecko)" => "konqueror linux", # konqueror Slaware Linux 10
|
195
|
+
"Mozilla/5.0 (compatible; Konqueror/3.3; Linux 2.6.8.1-24mdk; X11; i686; en_GB, en_US) (KHTML, like Gecko)" => "konqueror linux", # Konqueror/KDE Version 3.3 on Linux Mandrake 10.1
|
196
|
+
"Mozilla/5.0 (compatible; Konqueror/3.3; Linux) (KHTML, like Gecko)" => "konqueror linux", # Konqueror/KDE Version 3.3 on Linux Mandrake 10.1
|
197
|
+
"Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.6.7-3ajp; X11; i686) (KHTML, like Gecko)" => "konqueror linux", # Konqueror/KDE Version 3.2 on Linux Mandrake 10.0
|
198
|
+
"Mozilla/5.0 (compatible; Konqueror/3.2; FreeBSD) (KHTML, like Gecko)" => "konqueror", # Konqueror/KDE Version 3.2 on FreeBSD
|
199
|
+
"Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.20)" => "konqueror linux", # Konqueror/KDE Version 3.1 on Linux
|
200
|
+
"Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686)" => "konqueror linux", # Konqueror Linux Mandrake 9.0 under X windows
|
201
|
+
"Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.19-32mdkenterprise; X11; i686; ar, en_US)" => "konqueror linux", # Konqueror on KDE 3.1 on Linux Mandrake 9.0 under X windows
|
202
|
+
"Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" => "konqueror linux" # Konqueror 2.1.1 (KDE) on Linux Mandrake 8.0 under X windows
|
203
|
+
})
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_opera_browser_strings
|
207
|
+
assert_browser_strings({
|
208
|
+
"opera/9.50 (j2me/midp; opera mini/ 4.1.11320/546; u; pt)" => "opera opera9 mobile" , # Opera Mini 10.00 on MAC with OS X
|
209
|
+
"Opera/10.00 (Macintosh; Intel Mac OS X; u; en) presto/2.2.0" => "opera opera10 mac", # Opera 10.00 on MAC with OS X
|
210
|
+
"Opera/9.20 (Macintosh; Intel Mac OS X; U; en)" => "opera opera9 mac", # Opera 9.20 on MAC with OS X
|
211
|
+
"Opera/9.02 (Windows NT 5.0; U; en)" => "opera opera9 win", # Opera 9.02 on Win 2K
|
212
|
+
"Opera/9.00 (Windows NT 4.0; U; en)" => "opera opera9 win", # Opera 9.0 on Windows NT 4.0
|
213
|
+
"Opera/9.00 (X11; Linux i686; U; en)" => "opera opera9 linux", # Opera 9.0 on linux 2.6, static Qt installation
|
214
|
+
"Opera/9.00 (Windows NT 5.1; U; en)" => "opera opera9 win", # Opera 9 on XP (spot the diff with the next one)
|
215
|
+
"Opera/9.0 (Windows NT 5.1; U; en)" => "opera opera9 win", # Opera 9
|
216
|
+
"Opera/9.0 (Macintosh; PPC Mac OS X; U; en)" => "opera opera9 mac", # Opera 9
|
217
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.0" => "opera opera9 win", # Opera 9
|
218
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 480x640) Opera 8.60 [en]" => "opera opera8 win", # Opera Mobile 8.60 on a Dell Axim X51v
|
219
|
+
"Opera/8.5 (Macintosh; PPC Mac OS X; U; en)" => "opera opera8 mac", # Opera 8.5 on the Mac
|
220
|
+
"Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.5" => "opera opera8 mac", # Opera 8.5 on the Mac
|
221
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Mac_PowerPC Mac OS X; en) Opera 8.5" => "opera opera8 mac", # Opera 8.5 on the Mac
|
222
|
+
"Opera/8.0 (Macintosh; PPC Mac OS X; U; en)" => "opera opera8 mac", # Opera 8.0 on the Mac
|
223
|
+
"Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.0" => "opera opera8 mac", # Opera 8.0 on the Mac
|
224
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Mac_PowerPC Mac OS X; en) Opera 8.0" => "opera opera8 mac", # Opera 8.0 on the Mac
|
225
|
+
"Opera/8.01 (Windows NT 5.1)" => "opera opera8 win", # Opera 8.01 preview
|
226
|
+
"Mozilla/5.0 (Windows NT 5.1; U; en) Opera 8.01" => "opera opera8 win", # Opera 8.01 preview
|
227
|
+
# "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" => "ie ie6 win", # Opera 8.01 preview
|
228
|
+
"Mozilla/5.0 (Windows NT 5.1; U; en) Opera 8.00" => "opera opera8 win", # Opera 8.00 (ex 7.60 preview) on XP Pro as Mozilla
|
229
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.00" => "opera opera8 win", # Opera 8.00 (ex 7.60 preview) on XP Pro as MSIE
|
230
|
+
"Opera/8.00 (Windows NT 5.1; U; en)" => "opera opera8 win", # Opera 8.00 (ex 7.60 preview) on XP Pro
|
231
|
+
"Mozilla/5.0 (X11; Linux i386; U) Opera 7.60 [en-GB]" => "opera opera7 linux", # Opera 7.60 (pretending to be Mozilla running on NetBSD
|
232
|
+
"Opera/7.60 (Windows NT 5.2; U) [en] (IBM EVV/3.0/EAK01AG9/LE)" => "opera opera7 win", # Opera 7.60 running on XP. # win
|
233
|
+
"Opera/7.54 (Windows NT 5.1; U) [pl]" => "opera opera7 win", # Opera 7.54 in native mode
|
234
|
+
"Opera/7.50 (X11; Linux i686; U) [en]" => "opera opera7 linux", # Opera 7.50 running on Mandrake Linux
|
235
|
+
"Mozilla/5.0 (X11; Linux i686; U) Opera 7.50 [en]" => "opera opera7 linux", # Opera 7.50 running on Mandrake Linux
|
236
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.20 [en]" => "opera opera7 linux", # Opera 7.20 running on Linux and pretending to be MSIE 6.0
|
237
|
+
"Opera/7.11 (Windows NT 5.1; U) [en]" => "opera opera7 win", # On Windows XP.
|
238
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows ME) Opera 7.11 [en]" => "opera opera7 win", # Opera 7.11 running on WME
|
239
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]" => "opera opera7 win", # The infamous MSN version of Opera 7.02 on W2K
|
240
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]" => "opera opera7 win", # Opera 7.0 on NT 4.0.
|
241
|
+
"Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]" => "opera opera6 win", # Opera 6.0 on Windows 2000.
|
242
|
+
"Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 6.01 [en]" => "opera opera6 win", # Opera 6.01 on Windows 95.
|
243
|
+
"Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]" => "opera opera5 mac" # Opera 5.0 on the Mac (OS8.6)
|
244
|
+
})
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_msie_browser_strings
|
248
|
+
assert_browser_strings({
|
249
|
+
"mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0; mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; sv1) ; .net clr 1.1.4322; .net clr 2.0.50727; .net clr 3.0.4506.2152; .net clr 3.5.30729; officeliveconnector.1.4; officelivepatch.1.3)" => "ie ie8 win",
|
250
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)" => "ie ie8 win",
|
251
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)" => "ie ie8 win",
|
252
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)" => "ie ie8 win",
|
253
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 3.0)" => "ie ie8 win",
|
254
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8)" => "ie ie8 win",
|
255
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3)" => "ie ie8 win",
|
256
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; Zune 3.0; MS-RTC LM 8)" => "ie ie8 win",
|
257
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)" => "ie ie8 win",
|
258
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 4.0.20402; MS-RTC LM 8)" => "ie ie8 win",
|
259
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; InfoPath.2)" => "ie ie8 win",
|
260
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET CLR 4.0.20506)" => "ie ie8 win",
|
261
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" => "ie ie8 win",
|
262
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)" => "ie ie8 win",
|
263
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 3.0.04506; Media Center PC 5.0; SLCC1)" => "ie ie8 win",
|
264
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)" => "ie ie8 win",
|
265
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0)" => "ie ie8 win",
|
266
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET CLR 3.0.04506; Media Center PC 5.0; SLCC1)" => "ie ie8 win",
|
267
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; Tablet PC 2.0; .NET CLR 4.0.20506; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)" => "ie ie8 win",
|
268
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 3.0.04506; Media Center PC 5.0; SLCC1; Tablet PC 2.0)" => "ie ie8 win",
|
269
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; InfoPath.2)" => "ie ie8 win",
|
270
|
+
"mozilla/4.0 (compatible; msie 8.0; windows nt 6.0; trident/4.0; slcc1; .net clr 2.0.50727; wwtclient2; infopath.2; officeliveconnector.1.3; officelivepatch.0.0; .net clr 3.0.30618; .net clr 3.5.30729)" => "ie ie8 win",
|
271
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)" => "ie ie8 win",
|
272
|
+
"Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0" => "ie ie7 win",
|
273
|
+
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET CLR 1.1.4322; Windows-Media-Player/10.00.00.3990; InfoPath.2" => "ie ie7 win", # MSIE 7 running on Windows Vista 64-bit with a ton of 'stuff'
|
274
|
+
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; Dealio Deskball 3.0)" => "ie ie7 win", # MSIE 7 on XP and every version of .NET known to mankind
|
275
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NeosBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" => "ie ie6 win", # Explanation: MSIE 6.x on XP with a skin from neos.tv who seem to specialize in the hospitality (read hotel) industry.
|
276
|
+
"Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" => "ie ie5 win", # MSIE 5.5 on Windows 98
|
277
|
+
"Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)" => "ie ie5 mac", # Latest MAC OS X version of MSIE
|
278
|
+
"Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)" => "ie ie5 win", # MSIE 5.0 on MS NT 4.0
|
279
|
+
"Mozilla/4.0 (compatible; MSIE 4.01; Windows NT 5.0)" => "ie ie4 win", # Explanation: MSIE 4.01 on Windows XP SP2
|
280
|
+
"Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; 240x320)" => "ie ie3 win", # MSIE 3.02 on a Pocket PC 2002
|
281
|
+
"Mozilla/1.22 (compatible; MSIE 2.0; Windows 95)" => "ie ie2 win" # MSIE 2.0 in windows '95
|
282
|
+
})
|
283
|
+
end
|
284
|
+
|
285
|
+
def test_safari_browser_strings
|
286
|
+
assert_browser_strings({
|
287
|
+
"mozilla/5.0 (windows; u; windows nt 6.0; pt-br) applewebkit/528.16 (khtml, like gecko) version/4.0 safari/528.16" => "webkit safari safari4 win",
|
288
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-gb) AppleWebKit/523.10.6 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6" => "webkit safari safari3 mac", # Safari 3.0.4 on Mac OS 10.5.1 Intel
|
289
|
+
"Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" => "webkit safari safari3 ipod", # Safari 3.0 for the iPod touch
|
290
|
+
"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3" => "webkit safari safari3 iphone", # Safari 3.0 for the iPhone
|
291
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/522.11.1 (KHTML, like Gecko) Version/3.0.3 Safari/522.12.1" => "webkit safari safari3 mac", # Safari 3.0.3 for Intel version of iMac
|
292
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; bg) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1" => "webkit safari safari3 win", # Safari 3.0.2 beta for Windows XP
|
293
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3" => "webkit safari safari3 win", # Safari browser V 3.0 Beta for Windows XP SP2
|
294
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419.3 (KHTML, like Gecko) Safari/419.3" => "webkit safari safari2 mac", # Safari browser V 2.o.4 with Beta for OS X
|
295
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3" => "webkit safari safari2 mac", # Safari browser 2.0.4 for MAC OS X (10.4.7)
|
296
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8" => "webkit safari safari2 mac", # Safari browser 2.0.3 for MAC OS X (10.4.4)
|
297
|
+
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/417.3 (KHTML, like Gecko) Safari/417.2" => "webkit safari safari2 mac", # Safari browser 2.0 for MAC OS X (10.4.4 build)
|
298
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like Gecko) Safari/412" => "webkit safari safari2 mac", # Safari browser 2.0 for MAC OS X (10.4.1 build 8B15)
|
299
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fr-fr) AppleWebKit/312.5.1 (KHTML, like Gecko) Safari/312.3.1" => "webkit safari safari1 mac", # Safari 1.3.1 on 1.3.9 after after Security update 2005-008
|
300
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fr-fr) AppleWebKit/312.5 (KHTML, like Gecko) Safari/312.3" => "webkit safari safari1 mac", # Safari 1.3.1 (v312.3) 10.3.9 = last update on last version of Panther
|
301
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) Safari/125.1" => "webkit safari safari1 mac", # Safari browser 1.25.1 for MAC OS
|
302
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/106.2 (KHTML, like Gecko) Safari/100.1" => "webkit safari safari1 mac", # Safari browser 1.0 for MAC OS X
|
303
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; es) AppleWebKit/85 (KHTML, like Gecko) Safari/85" => "webkit safari safari1 mac", # Safari browser 1.0 for MAC OS X with spanish language variant
|
304
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74" => "webkit safari safari1 mac", # Safari browser build 74 for MAC OS X
|
305
|
+
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51" => "webkit safari safari1 mac" # Safari browser for MAC OS X
|
306
|
+
})
|
307
|
+
end
|
308
|
+
|
309
|
+
def test_webtv_browser_strings
|
310
|
+
assert_browser_strings({
|
311
|
+
"Mozilla/4.0 WebTV/2.8 (compatible; MSIE 4.0)" => "gecko" # WebTV 2.8
|
312
|
+
})
|
313
|
+
end
|
314
|
+
|
315
|
+
private
|
316
|
+
def assert_browser_strings(user_agent_strings)
|
317
|
+
user_agent_strings.each { |s,bros| assert_equal bros, determine_browser_and_os(s), "#{s} determined to be '#{bros}'" }
|
318
|
+
end
|
319
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: css_browser_selector
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Reid MacDonald
|
9
|
+
- John Dewey
|
10
|
+
- Mani Tadayon
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2011-07-15 00:00:00.000000000 -07:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rails
|
19
|
+
requirement: &2157081220 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.3.5
|
25
|
+
type: :development
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: *2157081220
|
28
|
+
description: ! 'A plugin based on the css_browser_selector to add the browser type
|
29
|
+
and os to either the body and/or html elements within a document. The full usage
|
30
|
+
on how to use these css selectors can be understood at: http://rafael.adm.br/css_browser_selector/'
|
31
|
+
email:
|
32
|
+
- bowsersenior@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- .DS_Store
|
38
|
+
- .gitignore
|
39
|
+
- CHANGELOG
|
40
|
+
- Gemfile
|
41
|
+
- MIT-LICENSE
|
42
|
+
- README.rdoc
|
43
|
+
- Rakefile
|
44
|
+
- css_browser_selector.gemspec
|
45
|
+
- gem_tasks/test.rake
|
46
|
+
- lib/action_controller/caching_tracker.rb
|
47
|
+
- lib/action_view/helpers/css_browser_selector.rb
|
48
|
+
- lib/css_browser_selector.rb
|
49
|
+
- lib/css_browser_selector/javascript.rb
|
50
|
+
- lib/css_browser_selector/version.rb
|
51
|
+
- lib/javascripts/css_browser_selector.js
|
52
|
+
- test/css_browser_selector_test.rb
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: https://github.com/attinteractive/css_browser_selector
|
55
|
+
licenses: []
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 1.6.2
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: Gives the ability to write specific CSS code for each operating system and
|
78
|
+
each browser from the backend or through JS.
|
79
|
+
test_files:
|
80
|
+
- test/css_browser_selector_test.rb
|