Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
999 bytes
|
Line | |
---|
1 | define([ |
---|
2 | "dojo/_base/window", |
---|
3 | "dojo/_base/sniff" |
---|
4 | ], function(win, has){ |
---|
5 | |
---|
6 | var ua = navigator.userAgent; |
---|
7 | |
---|
8 | // BlackBerry (OS 6 or later only) |
---|
9 | has.add('bb', ua.indexOf("BlackBerry") >= 0 && parseFloat(ua.split("Version/")[1]) || undefined, undefined, true); |
---|
10 | |
---|
11 | // Android |
---|
12 | has.add('android', parseFloat(ua.split("Android ")[1]) || undefined, undefined, true); |
---|
13 | |
---|
14 | // iPhone, iPod, or iPad |
---|
15 | // If iPod or iPad is detected, in addition to has('ipod') or has('ipad'), |
---|
16 | // has('iphone') will also have iOS version number. |
---|
17 | if(ua.match(/(iPhone|iPod|iPad)/)){ |
---|
18 | var p = RegExp.$1.replace(/P/, 'p'); |
---|
19 | var v = ua.match(/OS ([\d_]+)/) ? RegExp.$1 : "1"; |
---|
20 | var os = parseFloat(v.replace(/_/, '.').replace(/_/g, '')); |
---|
21 | has.add(p, os, undefined, true); |
---|
22 | has.add('iphone', os, undefined, true); |
---|
23 | } |
---|
24 | |
---|
25 | if(has("webkit")){ |
---|
26 | has.add('touch', (typeof win.doc.documentElement.ontouchstart != "undefined" && |
---|
27 | navigator.appVersion.indexOf("Mobile") != -1) || !!has('android'), undefined, true); |
---|
28 | } |
---|
29 | |
---|
30 | return has; |
---|
31 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.