forked from 0x2620/oxjs
add mail svg; update form elements; change 'focusInput()' signature
This commit is contained in:
parent
8f3be96828
commit
4701245038
8 changed files with 104 additions and 18 deletions
|
|
@ -162,6 +162,67 @@ Ox.parseSRT = function(str, fps) {
|
|||
});
|
||||
};
|
||||
|
||||
Ox.parseUserAgent = function(str) {
|
||||
var names = {
|
||||
chromeframe: 'Internet Explorer (Chrome Frame)',
|
||||
'iPhone OS': 'iOS',
|
||||
Fennec: 'Mobile Firefox',
|
||||
Mobile: 'Mobile Safari',
|
||||
MSIE: 'Internet Explorer',
|
||||
},
|
||||
regexps = {
|
||||
browser: [
|
||||
/(chromeframe)\/(\d+)/,
|
||||
/(Chrome)\/(\d+)/,
|
||||
/(Fennec)\/(\d+)/,
|
||||
/(Firefox)\/(\d+)/,
|
||||
/(MSIE)\/(\d+)/,
|
||||
/(Opera)\/.+Version\/(\d+)/,
|
||||
/Version\/(\d+).+(Mobile)\/.+Safari/,
|
||||
/Version\/(\d+).+(Safari)/
|
||||
],
|
||||
system: [
|
||||
/(iPhone OS) (\d+)/,
|
||||
/ (Linux) /,
|
||||
/(Mac OS X) (10.\d)/,
|
||||
/(Windows) (NT \d\.\d)/
|
||||
]
|
||||
},
|
||||
userAgent = {
|
||||
browser: {name: '', version: ''},
|
||||
system: {name: '', version: ''}
|
||||
},
|
||||
versions = {
|
||||
'10.3': 'Panther',
|
||||
'10.4': 'Tiger',
|
||||
'10.5': 'Leopard',
|
||||
'10.6': 'Snow Leopard',
|
||||
'10.7': 'Lion',
|
||||
'NT 5.0': '2000',
|
||||
'NT 5.1': 'XP',
|
||||
'NT 5.2': '2003',
|
||||
'NT 6.0': 'Vista',
|
||||
'NT 6.1': '7'
|
||||
}
|
||||
Ox.forEach(regexps, function(regexps, key) {
|
||||
regexps.forEach(function(regexp) {
|
||||
var matches = str.match(regexp), name, swap, version;
|
||||
if (matches) {
|
||||
matches[2] = matches[2] || '';
|
||||
swap = matches[1].match(/^\d+$/);
|
||||
name = matches[swap ? 2 : 1];
|
||||
version = matches[swap ? 1 : 2].replace('_', '.');
|
||||
userAgent[key] = {
|
||||
name: names[name] || name,
|
||||
version: versions[version] || version
|
||||
};
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
return userAgent;
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.repeat <f> Repeat a value multiple times
|
||||
Works for arrays, numbers and strings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue