adding os detection class in beefjs

git-svn-id: https://beef.googlecode.com/svn/trunk@557 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
mosse.benjamin
2010-11-22 03:09:05 +00:00
parent 9e41e3d2d3
commit 155872dc3c
2 changed files with 18 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ module Modules
# set up values required to construct beefjs
beefjs = '' # init the beefjs string (to be sent as the beefjs file)
beefjs_path = "#{$root_dir}/modules/beefjs/" # location of sub files
js_sub_files = %w(beef.js browser.js browser/cookie.js dom.js net.js updater.js encode/base64.js net/local.js init.js)
js_sub_files = %w(beef.js browser.js browser/cookie.js os.js dom.js net.js updater.js encode/base64.js net/local.js init.js)
# construct the beefjs string from file(s)
js_sub_files.each {|js_sub_file_name|

17
modules/beefjs/os.js Normal file
View File

@@ -0,0 +1,17 @@
beef.os = {
ua: navigator.userAgent,
isWin311: function() {
return (this.ua.indexOf("Win16")) ? true : false;
},
isWinXP: function() {
return this.ua.match('(Windows NT 5.1)|(Windows XP)');
}
};
alert(beef.os.isWinXP());
beef.regCmp('beef.net.os');