Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

detect HP TouchPad

  • Loading branch information...
commit 6c877b6573d62fdb1f27a061cc76014c5d819315 1 parent 1586b94
Thomas Fuchs madrobby authored

Showing 3 changed files with 12 additions and 6 deletions. Show diff stats Hide diff stats

  1. +7 6 README.rdoc
  2. +2 0  src/detect.js
  3. +3 0  test/detect.html
13 README.rdoc
Source Rendered
@@ -221,12 +221,13 @@ Loading content into an element:
221 221
222 222 Zepto includes information about the environment it is running in the $.os object:
223 223
224   - $.os.ios // => true if running on Apple iOS
225   - $.os.android // => true if running on Android
226   - $.os.webos // => true if running on HP/Palm WebOS
227   - $.os.version // => string with version number, "4.0", "3.1.1", "2.1", etc.
228   - $.os.iphone // => true if running on iPhone
229   - $.os.ipad // => true if running on iPad
  224 + $.os.ios // => true if running on Apple iOS
  225 + $.os.android // => true if running on Android
  226 + $.os.webos // => true if running on HP/Palm WebOS
  227 + $.os.touchpad // => true if running on a HP TouchPad
  228 + $.os.version // => string with version number, "4.0", "3.1.1", "2.1", etc.
  229 + $.os.iphone // => true if running on iPhone
  230 + $.os.ipad // => true if running on iPad
230 231 $.os.blackberry // => true if running on BlackBerry
231 232
232 233 = Building
2  src/detect.js
@@ -5,11 +5,13 @@
5 5 ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
6 6 iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
7 7 webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
  8 + touchpad = webos && ua.match(/TouchPad/),
8 9 blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
9 10 if (android) os.android = true, os.version = android[2];
10 11 if (iphone) os.ios = true, os.version = iphone[2].replace(/_/g, '.'), os.iphone = true;
11 12 if (ipad) os.ios = true, os.version = ipad[2].replace(/_/g, '.'), os.ipad = true;
12 13 if (webos) os.webos = true, os.version = webos[2];
  14 + if (touchpad) os.touchpad = true;
13 15 if (blackberry) os.blackberry = true, os.version = blackberry[2];
14 16 return os;
15 17 }
3  test/detect.html
@@ -48,7 +48,10 @@
48 48 detect(t, "webos", "1.4.0", UA.WebOS_1_4_0_Pre);
49 49 detect(t, "webos", "1.4.0", UA.WebOS_1_4_0_Pixi);
50 50 detect(t, "webos", "1.2.9", UA.WebOS_1_2_9_Pixi);
  51 + t.assert(!$.__detect(UA.WebOS_1_4_0_Pre).touchpad);
  52 +
51 53 detect(t, "webos", "3.0.0", UA.WebOS_3_0_0_TouchPad);
  54 + t.assert($.__detect(UA.WebOS_3_0_0_TouchPad).touchpad);
52 55 },
53 56
54 57 testAndroid: function(t){

0 comments on commit 6c877b6

Please sign in to comment.
Something went wrong with that request. Please try again.