Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed firefox detection code #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.mkdn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ More info: [http://rafael.adm.br/css\_browser\_selector](http://rafael.adm.br/cs
.gecko .example {
background-color: gray
}
xp.ff5 .example {
background-color: #abc
}
.win.gecko .example {
background-color: red
}
Expand Down
40 changes: 40 additions & 0 deletions css_browser_selector.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
CSS Browser Selector v0.5.0 (Jul 7, 2011)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
Ramin Gomari (http://saarblog.wordpress.com)
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u) {
var ua = u.toLowerCase(),is = function(t) {
return ua.indexOf(t) > -1
},g = 'gecko',w = 'webkit',s = 'safari',o = 'opera',m = 'mobile',h = document.documentElement,
b = [
(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + (/trident\/4\.0/i.test(ua) ? '8' : RegExp.$1)) :
/firefox\/(\d+)\.?(\d*)/i.test(ua) && parseInt(RegExp.$1) >= 2 ? g + ' ff ff' + RegExp.$1 + (parseInt(RegExp.$2) > 0 ? ' ff' + RegExp.$1 + '_' + RegExp.$2 : '') :
is('gecko/') ? g :
is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.$1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.$2 : '')) :
is('konqueror') ? 'konqueror' :
is('blackberry') ? m + ' blackberry' :
is('android') ? m + ' android' :
is('chrome') ? w + ' chrome' :
is('iron') ? w + ' iron' :
is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.$1 : '') :
is('mozilla/') ? g : '',
is('j2me') ? m + ' j2me' :
is('iphone') ? m + ' iphone' :
is('ipod') ? m + ' ipod' :
is('ipad') ? m + ' ipad' :
is('mac') ? 'mac' :
is('darwin') ? 'mac' :
is('webtv') ? 'webtv' :
is('win') ? 'win' + (is('windows nt 6.0') ? ' vista' : is('windows nt 5.1') || is('windows nt 5.2') ? ' xp' : '') : /*See http://en.wikipedia.org/wiki/Windows_NT#Releases*/
is('freebsd') ? 'freebsd' :
(is('x11') || is('linux')) ? 'linux' : '',
'js'];
c = b.join(' ');
h.className += ' ' + c;
return c;
}
css_browser_selector(navigator.userAgent);
5 changes: 3 additions & 2 deletions css_browser_selector.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading