mobileesp_converted 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +1 -1
- data/java_source/UAgentInfo.java +316 -190
- data/lib/mobileesp_converted/user_agent_info.rb +439 -318
- data/lib/mobileesp_converted/version.rb +1 -1
- data/spec/mobileesp_converted/user_agent_info_spec.rb +14 -0
- metadata +14 -28
@@ -1,29 +1,47 @@
|
|
1
1
|
# This file has been automatically converted to Ruby from Java source code.
|
2
|
-
|
3
|
-
|
2
|
+
#
|
3
|
+
#
|
4
|
+
#
|
4
5
|
=begin
|
5
|
-
*******************************************
|
6
|
-
# Copyright 2010-
|
6
|
+
*******************************************
|
7
|
+
# Copyright 2010-2015, Anthony Hand
|
7
8
|
#
|
8
|
-
# File version 2013.08.01 (August 1, 2013)
|
9
|
-
# Updates:
|
10
|
-
# - Updated DetectMobileQuick(). Moved the 'Exclude Tablets' logic to the top of the method to fix a logic bug.
|
11
9
|
#
|
12
|
-
# File version
|
13
|
-
#
|
14
|
-
# -
|
15
|
-
# -
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# - Added support for
|
19
|
-
# -
|
20
|
-
# -
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# -
|
24
|
-
#
|
25
|
-
# -
|
26
|
-
#
|
10
|
+
# File version 2015.05.13 (May 13, 2015)
|
11
|
+
# Updates:
|
12
|
+
# - Moved MobileESP to GitHub. https:
|
13
|
+
# - Opera Mobile/Mini browser has the same UA string on multiple platforms and doesn't differentiate phone vs. tablet.
|
14
|
+
# - Removed DetectOperaAndroidPhone(). This method is no longer reliable.
|
15
|
+
# - Removed DetectOperaAndroidTablet(). This method is no longer reliable.
|
16
|
+
# - Added support for Windows Phone 10: variable and DetectWindowsPhone10()
|
17
|
+
# - Updated DetectWindowsPhone() to include WP10.
|
18
|
+
# - Added support for Firefox OS.
|
19
|
+
# - A variable plus DetectFirefoxOS(), DetectFirefoxOSPhone(), DetectFirefoxOSTablet()
|
20
|
+
# - NOTE: Firefox doesn't add UA tokens to definitively identify Firefox OS vs. their browsers on other mobile platforms.
|
21
|
+
# - Added support for Sailfish OS. Not enough info to add a tablet detection method at this time.
|
22
|
+
# - A variable plus DetectSailfish(), DetectSailfishPhone()
|
23
|
+
# - Added support for Ubuntu Mobile OS.
|
24
|
+
# - DetectUbuntu(), DetectUbuntuPhone(), DetectUbuntuTablet()
|
25
|
+
# - Added support for 2 smart TV OSes. They lack browsers but do have WebViews for use by HTML apps.
|
26
|
+
# - One variable for Samsung Tizen TVs, plus DetectTizenTV()
|
27
|
+
# - One variable for LG WebOS TVs, plus DetectWebOSTV()
|
28
|
+
# - Updated DetectTizen(). Now tests for "mobile" to disambiguate from Samsung Smart TVs
|
29
|
+
# - Removed variables for obsolete devices: deviceHtcFlyer, deviceXoom.
|
30
|
+
# - Updated DetectAndroid(). No longer has a special test case for the HTC Flyer tablet.
|
31
|
+
# - Updated DetectAndroidPhone().
|
32
|
+
# - Updated internal detection code for Android.
|
33
|
+
# - No longer has a special test case for the HTC Flyer tablet.
|
34
|
+
# - Checks against DetectOperaMobile() on Android and reports here if relevant.
|
35
|
+
# - Updated DetectAndroidTablet().
|
36
|
+
# - No longer has a special test case for the HTC Flyer tablet.
|
37
|
+
# - Checks against DetectOperaMobile() on Android to exclude it from here.
|
38
|
+
# - DetectMeego(): Changed definition for this method. Now detects any Meego OS device, not just phones.
|
39
|
+
# - DetectMeegoPhone(): NEW. For Meego phones. Ought to detect Opera browsers on Meego, as well.
|
40
|
+
# - DetectTierIphone(): Added support for phones running Sailfish, Ubuntu and Firefox Mobile.
|
41
|
+
# - DetectTierTablet(): Added support for tablets running Ubuntu and Firefox Mobile.
|
42
|
+
# - DetectSmartphone(): Added support for Meego phones.
|
43
|
+
# - Refactored the detection logic in DetectMobileQuick() and DetectMobileLong().
|
44
|
+
# - Moved a few detection tests for older browsers to Long.
|
27
45
|
#
|
28
46
|
#
|
29
47
|
#
|
@@ -43,7 +61,7 @@
|
|
43
61
|
# Project Owner: Anthony Hand
|
44
62
|
# Email: anthony.hand@gmail.com
|
45
63
|
# Web Site: http:
|
46
|
-
# Source Files:
|
64
|
+
# Source Files: https:
|
47
65
|
#
|
48
66
|
# Versions of this code are available for:
|
49
67
|
# PHP, JavaScript, Java, ASP.NET (C#), and Ruby
|
@@ -55,14 +73,14 @@
|
|
55
73
|
|
56
74
|
=begin
|
57
75
|
*
|
58
|
-
* The DetectSmartPhone class encapsulates information about
|
59
|
-
* a browser's connection to your web site.
|
60
|
-
* You can use it to find out whether the browser asking for
|
61
|
-
* your site's content is probably running on a mobile device.
|
62
|
-
* The methods were written so you can be as granular as you want.
|
63
|
-
* For example, enquiring whether it's as specific as an iPod Touch or
|
64
|
-
* as general as a smartphone class device.
|
65
|
-
* The object's methods return true, or false.
|
76
|
+
* The DetectSmartPhone class encapsulates information about
|
77
|
+
* a browser's connection to your web site.
|
78
|
+
* You can use it to find out whether the browser asking for
|
79
|
+
* your site's content is probably running on a mobile device.
|
80
|
+
* The methods were written so you can be as granular as you want.
|
81
|
+
* For example, enquiring whether it's as specific as an iPod Touch or
|
82
|
+
* as general as a smartphone class device.
|
83
|
+
* The object's methods return true, or false.
|
66
84
|
|
67
85
|
=end
|
68
86
|
module MobileESPConverted
|
@@ -87,102 +105,109 @@ module MobileESPConverted
|
|
87
105
|
|
88
106
|
ENGINE_WEB_KIT = "webkit"
|
89
107
|
|
90
|
-
DEVICE_IPHONE
|
91
|
-
DEVICE_IPOD
|
92
|
-
DEVICE_IPAD
|
108
|
+
DEVICE_IPHONE = "iphone"
|
109
|
+
DEVICE_IPOD = "ipod"
|
110
|
+
DEVICE_IPAD = "ipad"
|
93
111
|
DEVICE_MAC_PPC = "macintosh"
|
94
112
|
|
95
|
-
DEVICE_ANDROID
|
113
|
+
DEVICE_ANDROID = "android"
|
96
114
|
DEVICE_GOOGLE_T_V = "googletv"
|
97
|
-
DEVICE_HTC_FLYER = "htc_flyer"
|
98
115
|
|
99
116
|
DEVICE_WIN_PHONE7 = "windows phone os 7"
|
100
117
|
DEVICE_WIN_PHONE8 = "windows phone 8"
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
118
|
+
DEVICE_WIN_PHONE10 = "windows phone 10"
|
119
|
+
DEVICE_WIN_MOB = "windows ce"
|
120
|
+
DEVICE_WINDOWS = "windows"
|
121
|
+
DEVICE_IE_MOB = "iemobile"
|
122
|
+
DEVICE_PPC = "ppc"
|
123
|
+
ENGINE_PIE = "wm5 pie"
|
124
|
+
|
125
|
+
DEVICE_B_B = "blackberry"
|
126
|
+
DEVICE_B_B10 = "bb10"
|
127
|
+
VND_R_I_M = "vnd.rim"
|
128
|
+
DEVICE_B_B_STORM = "blackberry95"
|
129
|
+
DEVICE_B_B_BOLD = "blackberry97"
|
130
|
+
DEVICE_B_B_BOLD_TOUCH = "blackberry 99"
|
131
|
+
DEVICE_B_B_TOUR = "blackberry96"
|
132
|
+
DEVICE_B_B_CURVE = "blackberry89"
|
115
133
|
DEVICE_B_B_CURVE_TOUCH = "blackberry 938"
|
116
|
-
DEVICE_B_B_TORCH
|
117
|
-
DEVICE_B_B_PLAYBOOK
|
134
|
+
DEVICE_B_B_TORCH = "blackberry 98"
|
135
|
+
DEVICE_B_B_PLAYBOOK = "playbook"
|
118
136
|
|
119
137
|
DEVICE_SYMBIAN = "symbian"
|
120
|
-
DEVICE_S60
|
121
|
-
DEVICE_S70
|
122
|
-
DEVICE_S80
|
123
|
-
DEVICE_S90
|
124
|
-
|
125
|
-
DEVICE_PALM
|
126
|
-
DEVICE_WEB_O_S
|
138
|
+
DEVICE_S60 = "series60"
|
139
|
+
DEVICE_S70 = "series70"
|
140
|
+
DEVICE_S80 = "series80"
|
141
|
+
DEVICE_S90 = "series90"
|
142
|
+
|
143
|
+
DEVICE_PALM = "palm"
|
144
|
+
DEVICE_WEB_O_S = "webos"
|
145
|
+
DEVICE_WEB_O_STV = "web0s"
|
127
146
|
DEVICE_WEB_O_SHP = "hpwos"
|
128
|
-
ENGINE_BLAZER = "blazer"
|
129
|
-
ENGINE_XIINO = "xiino"
|
130
147
|
|
131
148
|
DEVICE_NUVIFONE = "nuvifone"
|
132
|
-
DEVICE_BADA
|
133
|
-
DEVICE_TIZEN
|
134
|
-
DEVICE_MEEGO
|
149
|
+
DEVICE_BADA = "bada"
|
150
|
+
DEVICE_TIZEN = "tizen"
|
151
|
+
DEVICE_MEEGO = "meego"
|
152
|
+
DEVICE_SAILFISH = "sailfish"
|
153
|
+
DEVICE_UBUNTU = "ubuntu"
|
135
154
|
|
136
155
|
DEVICE_KINDLE = "kindle"
|
137
|
-
ENGINE_SILK
|
156
|
+
ENGINE_SILK = "silk-accelerated"
|
157
|
+
|
158
|
+
ENGINE_BLAZER = "blazer"
|
159
|
+
ENGINE_XIINO = "xiino"
|
138
160
|
|
139
161
|
|
140
162
|
VNDWAP = "vnd.wap"
|
141
|
-
WML
|
163
|
+
WML = "wml"
|
142
164
|
|
143
165
|
|
144
|
-
DEVICE_TABLET
|
145
|
-
DEVICE_BREW
|
146
|
-
DEVICE_DANGER
|
147
|
-
DEVICE_HIPTOP
|
148
|
-
DEVICE_PLAYSTATION
|
166
|
+
DEVICE_TABLET = "tablet"
|
167
|
+
DEVICE_BREW = "brew"
|
168
|
+
DEVICE_DANGER = "danger"
|
169
|
+
DEVICE_HIPTOP = "hiptop"
|
170
|
+
DEVICE_PLAYSTATION = "playstation"
|
149
171
|
DEVICE_PLAYSTATION_VITA = "vita"
|
150
|
-
DEVICE_NINTENDO_DS
|
151
|
-
DEVICE_NINTENDO
|
152
|
-
DEVICE_WII
|
153
|
-
DEVICE_XBOX
|
154
|
-
DEVICE_ARCHOS
|
155
|
-
|
156
|
-
|
157
|
-
|
172
|
+
DEVICE_NINTENDO_DS = "nitro"
|
173
|
+
DEVICE_NINTENDO = "nintendo"
|
174
|
+
DEVICE_WII = "wii"
|
175
|
+
DEVICE_XBOX = "xbox"
|
176
|
+
DEVICE_ARCHOS = "archos"
|
177
|
+
|
178
|
+
ENGINE_FIREFOX = "firefox"
|
179
|
+
ENGINE_OPERA = "opera"
|
180
|
+
ENGINE_NETFRONT = "netfront"
|
158
181
|
ENGINE_UP_BROWSER = "up.browser"
|
159
|
-
ENGINE_OPEN_WEB
|
160
|
-
DEVICE_MIDP
|
161
|
-
UPLINK
|
162
|
-
ENGINE_TELECA_Q
|
163
|
-
ENGINE_OBIGO = "obigo"
|
164
|
-
|
182
|
+
ENGINE_OPEN_WEB = "openweb"
|
183
|
+
DEVICE_MIDP = "midp"
|
184
|
+
UPLINK = "up.link"
|
185
|
+
ENGINE_TELECA_Q = "teleca q"
|
165
186
|
DEVICE_PDA = "pda"
|
166
|
-
MINI
|
167
|
-
MOBILE
|
168
|
-
MOBI
|
187
|
+
MINI = "mini"
|
188
|
+
MOBILE = "mobile"
|
189
|
+
MOBI = "mobi"
|
190
|
+
|
191
|
+
|
192
|
+
SMART_T_V1 = "smart-tv"
|
193
|
+
SMART_T_V2 = "smarttv"
|
169
194
|
|
170
195
|
|
171
|
-
MAEMO
|
172
|
-
LINUX
|
196
|
+
MAEMO = "maemo"
|
197
|
+
LINUX = "linux"
|
173
198
|
QTEMBEDDED = "qt embedded"
|
174
|
-
MYLOCOM2
|
199
|
+
MYLOCOM2 = "com2"
|
175
200
|
|
176
201
|
|
177
202
|
MANU_SONY_ERICSSON = "sonyericsson"
|
178
|
-
MANUERICSSON
|
179
|
-
MANU_SAMSUNG1
|
180
|
-
MANU_SONY
|
181
|
-
MANU_HTC
|
203
|
+
MANUERICSSON = "ericsson"
|
204
|
+
MANU_SAMSUNG1 = "sec-sgh"
|
205
|
+
MANU_SONY = "sony"
|
206
|
+
MANU_HTC = "htc"
|
182
207
|
|
183
208
|
|
184
|
-
SVC_DOCOMO
|
185
|
-
SVC_KDDI
|
209
|
+
SVC_DOCOMO = "docomo"
|
210
|
+
SVC_KDDI = "kddi"
|
186
211
|
SVC_VODAFONE = "vodafone"
|
187
212
|
|
188
213
|
|
@@ -190,7 +215,7 @@ module MobileESPConverted
|
|
190
215
|
|
191
216
|
|
192
217
|
=begin
|
193
|
-
|
218
|
+
*
|
194
219
|
* Initialize the user_agent and http_accept variables
|
195
220
|
*
|
196
221
|
* @param user_agent the User-Agent header
|
@@ -210,7 +235,7 @@ module MobileESPConverted
|
|
210
235
|
end
|
211
236
|
|
212
237
|
=begin
|
213
|
-
|
238
|
+
*
|
214
239
|
* Return the lower case HTTP_USER_AGENT
|
215
240
|
* @return user_agent
|
216
241
|
|
@@ -220,7 +245,7 @@ module MobileESPConverted
|
|
220
245
|
end
|
221
246
|
|
222
247
|
=begin
|
223
|
-
|
248
|
+
*
|
224
249
|
* Return the lower case HTTP_ACCEPT
|
225
250
|
* @return http_accept
|
226
251
|
|
@@ -230,7 +255,7 @@ module MobileESPConverted
|
|
230
255
|
end
|
231
256
|
|
232
257
|
=begin
|
233
|
-
|
258
|
+
*
|
234
259
|
* Return whether the device is an Iphone or iPod Touch
|
235
260
|
* @return is_iphone
|
236
261
|
|
@@ -240,7 +265,7 @@ module MobileESPConverted
|
|
240
265
|
end
|
241
266
|
|
242
267
|
=begin
|
243
|
-
|
268
|
+
*
|
244
269
|
* Return whether the device is in the Tablet Tier.
|
245
270
|
* @return is_tier_tablet
|
246
271
|
|
@@ -250,7 +275,7 @@ module MobileESPConverted
|
|
250
275
|
end
|
251
276
|
|
252
277
|
=begin
|
253
|
-
|
278
|
+
*
|
254
279
|
* Return whether the device is in the Iphone Tier.
|
255
280
|
* @return is_tier_iphone
|
256
281
|
|
@@ -260,7 +285,7 @@ module MobileESPConverted
|
|
260
285
|
end
|
261
286
|
|
262
287
|
=begin
|
263
|
-
|
288
|
+
*
|
264
289
|
* Return whether the device is in the 'Rich CSS' tier of mobile devices.
|
265
290
|
* @return is_tier_rich_css
|
266
291
|
|
@@ -270,7 +295,7 @@ module MobileESPConverted
|
|
270
295
|
end
|
271
296
|
|
272
297
|
=begin
|
273
|
-
|
298
|
+
*
|
274
299
|
* Return whether the device is a generic, less-capable mobile device.
|
275
300
|
* @return is_tier_generic_mobile
|
276
301
|
|
@@ -280,41 +305,36 @@ module MobileESPConverted
|
|
280
305
|
end
|
281
306
|
|
282
307
|
=begin
|
283
|
-
|
308
|
+
*
|
284
309
|
* Initialize Key Stored Values.
|
285
310
|
|
286
311
|
=end
|
287
312
|
def init_device_scan()
|
288
313
|
|
289
|
-
@is_webkit
|
290
|
-
@is_iphone
|
291
|
-
@is_android
|
314
|
+
@is_webkit = detect_webkit()
|
315
|
+
@is_iphone = detect_iphone()
|
316
|
+
@is_android = detect_android()
|
292
317
|
@is_android_phone = detect_android_phone()
|
293
318
|
|
294
319
|
|
295
320
|
@is_mobile_phone = detect_mobile_quick()
|
296
|
-
@is_tier_tablet
|
297
|
-
@is_tier_iphone
|
321
|
+
@is_tier_tablet = detect_tier_tablet()
|
322
|
+
@is_tier_iphone = detect_tier_iphone()
|
298
323
|
|
299
324
|
|
300
|
-
@is_tier_rich_css
|
325
|
+
@is_tier_rich_css = detect_tier_rich_css()
|
301
326
|
@is_tier_generic_mobile = detect_tier_other_phones()
|
302
327
|
|
303
328
|
@init_completed = true
|
304
329
|
end
|
305
330
|
|
306
331
|
=begin
|
307
|
-
|
332
|
+
*
|
308
333
|
* Detects if the current device is an iPhone.
|
309
334
|
* @return detection of an iPhone
|
310
335
|
|
311
336
|
=end
|
312
337
|
def detect_iphone()
|
313
|
-
if ((@init_completed == true) ||
|
314
|
-
(@is_iphone == true))
|
315
|
-
return @is_iphone
|
316
|
-
end
|
317
|
-
|
318
338
|
|
319
339
|
if (user_agent.include?(DEVICE_IPHONE) &&
|
320
340
|
!detect_ipad() &&
|
@@ -325,7 +345,7 @@ module MobileESPConverted
|
|
325
345
|
end
|
326
346
|
|
327
347
|
=begin
|
328
|
-
|
348
|
+
*
|
329
349
|
* Detects if the current device is an iPod Touch.
|
330
350
|
* @return detection of an iPod Touch
|
331
351
|
|
@@ -338,7 +358,7 @@ module MobileESPConverted
|
|
338
358
|
end
|
339
359
|
|
340
360
|
=begin
|
341
|
-
|
361
|
+
*
|
342
362
|
* Detects if the current device is an iPad tablet.
|
343
363
|
* @return detection of an iPad
|
344
364
|
|
@@ -351,7 +371,7 @@ module MobileESPConverted
|
|
351
371
|
end
|
352
372
|
|
353
373
|
=begin
|
354
|
-
|
374
|
+
*
|
355
375
|
* Detects if the current device is an iPhone or iPod Touch.
|
356
376
|
* @return detection of an iPhone or iPod Touch
|
357
377
|
|
@@ -365,7 +385,7 @@ module MobileESPConverted
|
|
365
385
|
end
|
366
386
|
|
367
387
|
=begin
|
368
|
-
|
388
|
+
*
|
369
389
|
* Detects *any* iOS device: iPhone, iPod Touch, iPad.
|
370
390
|
* @return detection of an Apple iOS device
|
371
391
|
|
@@ -379,31 +399,23 @@ module MobileESPConverted
|
|
379
399
|
|
380
400
|
|
381
401
|
=begin
|
382
|
-
|
402
|
+
*
|
383
403
|
* Detects *any* Android OS-based device: phone, tablet, and multi-media player.
|
384
404
|
* Also detects Google TV.
|
385
405
|
* @return detection of an Android device
|
386
406
|
|
387
407
|
=end
|
388
408
|
def detect_android()
|
389
|
-
if ((@init_completed == true) ||
|
390
|
-
(@is_android == true))
|
391
|
-
return @is_android
|
392
|
-
end
|
393
|
-
|
394
409
|
if ((user_agent.include?(DEVICE_ANDROID)) ||
|
395
410
|
detect_google_t_v())
|
396
411
|
return true
|
397
412
|
end
|
398
413
|
|
399
|
-
if (user_agent.include?(DEVICE_HTC_FLYER))
|
400
|
-
return true
|
401
|
-
end
|
402
414
|
return false
|
403
415
|
end
|
404
416
|
|
405
417
|
=begin
|
406
|
-
|
418
|
+
*
|
407
419
|
* Detects if the current device is a (small-ish) Android OS-based device
|
408
420
|
* used for calling and/or multi-media (like a Samsung Galaxy Player).
|
409
421
|
* Google says these devices will have 'Android' AND 'mobile' in user agent.
|
@@ -412,27 +424,26 @@ module MobileESPConverted
|
|
412
424
|
|
413
425
|
=end
|
414
426
|
def detect_android_phone()
|
415
|
-
if ((@init_completed == true) ||
|
416
|
-
(@is_android_phone == true))
|
417
|
-
return @is_android_phone
|
418
|
-
end
|
419
427
|
|
420
|
-
if (detect_android()
|
421
|
-
return
|
428
|
+
if (!detect_android())
|
429
|
+
return false
|
422
430
|
end
|
423
431
|
|
424
|
-
|
432
|
+
|
433
|
+
if (user_agent.include?(MOBILE))
|
425
434
|
return true
|
426
435
|
end
|
427
436
|
|
428
|
-
|
437
|
+
|
438
|
+
if (detect_opera_mobile())
|
429
439
|
return true
|
430
440
|
end
|
441
|
+
|
431
442
|
return false
|
432
443
|
end
|
433
444
|
|
434
445
|
=begin
|
435
|
-
|
446
|
+
*
|
436
447
|
* Detects if the current device is a (self-reported) Android tablet.
|
437
448
|
* Google says these devices will have 'Android' and NOT 'mobile' in their user agent.
|
438
449
|
* @return detection of an Android tablet
|
@@ -449,10 +460,6 @@ module MobileESPConverted
|
|
449
460
|
return false
|
450
461
|
end
|
451
462
|
|
452
|
-
if (user_agent.include?(DEVICE_HTC_FLYER))
|
453
|
-
return false
|
454
|
-
end
|
455
|
-
|
456
463
|
|
457
464
|
if ((user_agent.include?(MOBILE)))
|
458
465
|
return false
|
@@ -462,7 +469,7 @@ module MobileESPConverted
|
|
462
469
|
end
|
463
470
|
|
464
471
|
=begin
|
465
|
-
|
472
|
+
*
|
466
473
|
* Detects if the current device is an Android OS-based device and
|
467
474
|
* the browser is based on WebKit.
|
468
475
|
* @return detection of an Android WebKit browser
|
@@ -476,7 +483,7 @@ module MobileESPConverted
|
|
476
483
|
end
|
477
484
|
|
478
485
|
=begin
|
479
|
-
|
486
|
+
*
|
480
487
|
* Detects if the current device is a GoogleTV.
|
481
488
|
* @return detection of GoogleTV
|
482
489
|
|
@@ -489,40 +496,64 @@ module MobileESPConverted
|
|
489
496
|
end
|
490
497
|
|
491
498
|
=begin
|
492
|
-
|
499
|
+
*
|
493
500
|
* Detects if the current browser is based on WebKit.
|
494
501
|
* @return detection of a WebKit browser
|
495
502
|
|
496
503
|
=end
|
497
504
|
def detect_webkit()
|
498
|
-
if ((@init_completed == true) ||
|
499
|
-
(@is_webkit == true))
|
500
|
-
return @is_webkit
|
501
|
-
end
|
502
|
-
|
503
505
|
if (user_agent.include?(ENGINE_WEB_KIT))
|
504
506
|
return true
|
505
507
|
end
|
506
508
|
return false
|
507
509
|
end
|
508
510
|
|
511
|
+
=begin
|
512
|
+
*
|
513
|
+
* Detects if the current browser is the Symbian S60 Open Source Browser.
|
514
|
+
* @return detection of Symbian S60 Browser
|
515
|
+
|
516
|
+
=end
|
517
|
+
def detect_s60_oss_browser()
|
518
|
+
|
519
|
+
if (detect_webkit() && (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60)))
|
520
|
+
return true
|
521
|
+
end
|
522
|
+
return false
|
523
|
+
end
|
509
524
|
|
510
525
|
=begin
|
526
|
+
*
|
511
527
|
*
|
512
|
-
* Detects if the current
|
528
|
+
* Detects if the current device is any Symbian OS-based device,
|
529
|
+
* including older S60, Series 70, Series 80, Series 90, and UIQ,
|
530
|
+
* or other browsers running on these devices.
|
531
|
+
* @return detection of SymbianOS
|
532
|
+
|
533
|
+
=end
|
534
|
+
def detect_symbian_o_s()
|
535
|
+
if (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60) || user_agent.include?(DEVICE_S70) || user_agent.include?(DEVICE_S80) || user_agent.include?(DEVICE_S90))
|
536
|
+
return true
|
537
|
+
end
|
538
|
+
return false
|
539
|
+
end
|
540
|
+
|
541
|
+
=begin
|
542
|
+
*
|
543
|
+
* Detects if the current browser is a Windows Phone 7.x, 8, or 10 device
|
513
544
|
* @return detection of Windows Phone 7.x OR 8
|
514
545
|
|
515
546
|
=end
|
516
547
|
def detect_windows_phone()
|
517
|
-
if (detect_windows_phone7() || detect_windows_phone8())
|
548
|
+
if (detect_windows_phone7() || detect_windows_phone8() || detect_windows_phone10())
|
518
549
|
return true
|
519
550
|
end
|
520
551
|
return false
|
521
552
|
end
|
522
553
|
|
523
554
|
=begin
|
524
|
-
|
525
|
-
* Detects a Windows Phone 7
|
555
|
+
*
|
556
|
+
* Detects a Windows Phone 7 device (in mobile browsing mode).
|
526
557
|
* @return detection of Windows Phone 7
|
527
558
|
|
528
559
|
=end
|
@@ -534,7 +565,7 @@ module MobileESPConverted
|
|
534
565
|
end
|
535
566
|
|
536
567
|
=begin
|
537
|
-
|
568
|
+
*
|
538
569
|
* Detects a Windows Phone 8 device (in mobile browsing mode).
|
539
570
|
* @return detection of Windows Phone 8
|
540
571
|
|
@@ -547,7 +578,20 @@ module MobileESPConverted
|
|
547
578
|
end
|
548
579
|
|
549
580
|
=begin
|
550
|
-
|
581
|
+
*
|
582
|
+
* Detects a Windows Phone 10 device (in mobile browsing mode).
|
583
|
+
* @return detection of Windows Phone 10
|
584
|
+
|
585
|
+
=end
|
586
|
+
def detect_windows_phone10()
|
587
|
+
if (user_agent.include?(DEVICE_WIN_PHONE10))
|
588
|
+
return true
|
589
|
+
end
|
590
|
+
return false
|
591
|
+
end
|
592
|
+
|
593
|
+
=begin
|
594
|
+
*
|
551
595
|
* Detects if the current browser is a Windows Mobile device.
|
552
596
|
* Excludes Windows Phone 7.x and 8 devices.
|
553
597
|
* Focuses on Windows Mobile 6.xx and earlier.
|
@@ -560,6 +604,7 @@ module MobileESPConverted
|
|
560
604
|
end
|
561
605
|
|
562
606
|
|
607
|
+
|
563
608
|
if (user_agent.include?(DEVICE_WIN_MOB) || user_agent.include?(DEVICE_WIN_MOB) || user_agent.include?(DEVICE_IE_MOB) || user_agent.include?(ENGINE_PIE) || (user_agent.include?(MANU_HTC) && user_agent.include?(DEVICE_WINDOWS)) || (detect_wap_wml() && user_agent.include?(DEVICE_WINDOWS)))
|
564
609
|
return true
|
565
610
|
end
|
@@ -573,9 +618,8 @@ module MobileESPConverted
|
|
573
618
|
return false
|
574
619
|
end
|
575
620
|
|
576
|
-
|
577
621
|
=begin
|
578
|
-
|
622
|
+
*
|
579
623
|
* Detects if the current browser is any BlackBerry.
|
580
624
|
* Includes BB10 OS, but excludes the PlayBook.
|
581
625
|
* @return detection of Blackberry
|
@@ -595,7 +639,7 @@ module MobileESPConverted
|
|
595
639
|
end
|
596
640
|
|
597
641
|
=begin
|
598
|
-
|
642
|
+
*
|
599
643
|
* Detects if the current browser is a BlackBerry 10 OS phone.
|
600
644
|
* Excludes tablets.
|
601
645
|
* @return detection of a Blackberry 10 device
|
@@ -610,7 +654,7 @@ module MobileESPConverted
|
|
610
654
|
end
|
611
655
|
|
612
656
|
=begin
|
613
|
-
|
657
|
+
*
|
614
658
|
* Detects if the current browser is on a BlackBerry tablet device.
|
615
659
|
* Example: PlayBook
|
616
660
|
* @return detection of a Blackberry Tablet
|
@@ -624,7 +668,7 @@ module MobileESPConverted
|
|
624
668
|
end
|
625
669
|
|
626
670
|
=begin
|
627
|
-
|
671
|
+
*
|
628
672
|
* Detects if the current browser is a BlackBerry device AND uses a
|
629
673
|
* WebKit-based browser. These are signatures for the new BlackBerry OS 6.
|
630
674
|
* Examples: Torch. Includes the Playbook.
|
@@ -632,14 +676,15 @@ module MobileESPConverted
|
|
632
676
|
|
633
677
|
=end
|
634
678
|
def detect_black_berry_web_kit()
|
635
|
-
if (detect_black_berry() &&
|
679
|
+
if (detect_black_berry() &&
|
680
|
+
user_agent.include?(ENGINE_WEB_KIT))
|
636
681
|
return true
|
637
682
|
end
|
638
683
|
return false
|
639
684
|
end
|
640
685
|
|
641
686
|
=begin
|
642
|
-
|
687
|
+
*
|
643
688
|
* Detects if the current browser is a BlackBerry Touch
|
644
689
|
* device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
|
645
690
|
* @return detection of a Blackberry touchscreen device
|
@@ -650,14 +695,14 @@ module MobileESPConverted
|
|
650
695
|
(user_agent.include?(DEVICE_B_B_STORM) ||
|
651
696
|
user_agent.include?(DEVICE_B_B_TORCH) ||
|
652
697
|
user_agent.include?(DEVICE_B_B_BOLD_TOUCH) ||
|
653
|
-
user_agent.include?(DEVICE_B_B_CURVE_TOUCH)
|
698
|
+
user_agent.include?(DEVICE_B_B_CURVE_TOUCH) ))
|
654
699
|
return true
|
655
700
|
end
|
656
701
|
return false
|
657
702
|
end
|
658
703
|
|
659
704
|
=begin
|
660
|
-
|
705
|
+
*
|
661
706
|
* Detects if the current browser is a BlackBerry device AND
|
662
707
|
* has a more capable recent browser. Excludes the Playbook.
|
663
708
|
* Examples, Storm, Bold, Tour, Curve2
|
@@ -682,7 +727,7 @@ module MobileESPConverted
|
|
682
727
|
end
|
683
728
|
|
684
729
|
=begin
|
685
|
-
|
730
|
+
*
|
686
731
|
* Detects if the current browser is a BlackBerry device AND
|
687
732
|
* has an older, less capable browser.
|
688
733
|
* Examples: Pearl, 8800, Curve1
|
@@ -702,59 +747,27 @@ module MobileESPConverted
|
|
702
747
|
end
|
703
748
|
end
|
704
749
|
|
705
|
-
|
706
750
|
=begin
|
707
|
-
|
708
|
-
* Detects if the current browser is the Symbian S60 Open Source Browser.
|
709
|
-
* @return detection of Symbian S60 Browser
|
710
|
-
|
711
|
-
=end
|
712
|
-
def detect_s60_oss_browser()
|
713
|
-
|
714
|
-
if (detect_webkit() && (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60)))
|
715
|
-
return true
|
716
|
-
end
|
717
|
-
return false
|
718
|
-
end
|
719
|
-
|
720
|
-
=begin
|
721
|
-
*
|
722
|
-
*
|
723
|
-
* Detects if the current device is any Symbian OS-based device,
|
724
|
-
* including older S60, Series 70, Series 80, Series 90, and UIQ,
|
725
|
-
* or other browsers running on these devices.
|
726
|
-
* @return detection of SymbianOS
|
727
|
-
|
728
|
-
=end
|
729
|
-
def detect_symbian_o_s()
|
730
|
-
if (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60) || user_agent.include?(DEVICE_S70) || user_agent.include?(DEVICE_S80) || user_agent.include?(DEVICE_S90))
|
731
|
-
return true
|
732
|
-
end
|
733
|
-
return false
|
734
|
-
end
|
735
|
-
|
736
|
-
|
737
|
-
=begin
|
738
|
-
*
|
751
|
+
*
|
739
752
|
* Detects if the current browser is on a PalmOS device.
|
740
753
|
* @return detection of a PalmOS device
|
741
754
|
|
742
755
|
=end
|
743
756
|
def detect_palm_o_s()
|
744
757
|
|
745
|
-
if (detect_palm_web_o_s())
|
746
|
-
return false
|
747
|
-
end
|
748
|
-
|
749
|
-
|
750
758
|
if (user_agent.include?(DEVICE_PALM) || user_agent.include?(ENGINE_BLAZER) || user_agent.include?(ENGINE_XIINO))
|
751
|
-
|
759
|
+
|
760
|
+
if (detect_palm_web_o_s())
|
761
|
+
return false
|
762
|
+
else
|
763
|
+
return true
|
764
|
+
end
|
752
765
|
end
|
753
766
|
return false
|
754
767
|
end
|
755
768
|
|
756
769
|
=begin
|
757
|
-
|
770
|
+
*
|
758
771
|
* Detects if the current browser is on a Palm device
|
759
772
|
* running the new WebOS.
|
760
773
|
* @return detection of a Palm WebOS device
|
@@ -768,7 +781,7 @@ module MobileESPConverted
|
|
768
781
|
end
|
769
782
|
|
770
783
|
=begin
|
771
|
-
|
784
|
+
*
|
772
785
|
* Detects if the current browser is on an HP tablet running WebOS.
|
773
786
|
* @return detection of an HP WebOS tablet
|
774
787
|
|
@@ -782,46 +795,34 @@ module MobileESPConverted
|
|
782
795
|
end
|
783
796
|
|
784
797
|
=begin
|
785
|
-
|
786
|
-
* Detects
|
787
|
-
* @return detection of
|
788
|
-
|
789
|
-
=end
|
790
|
-
def detect_opera_mobile()
|
791
|
-
if (user_agent.include?(ENGINE_OPERA) && (user_agent.include?(MINI) || user_agent.include?(MOBI)))
|
792
|
-
return true
|
793
|
-
end
|
794
|
-
return false
|
795
|
-
end
|
796
|
-
|
797
|
-
=begin
|
798
|
-
*
|
799
|
-
* Detects Opera Mobile on an Android phone.
|
800
|
-
* @return detection of an Opera browser on an Android phone
|
798
|
+
*
|
799
|
+
* Detects if the current browser is on a WebOS smart TV.
|
800
|
+
* @return detection of a WebOS smart TV
|
801
801
|
|
802
802
|
=end
|
803
|
-
def
|
804
|
-
if (user_agent.include?(
|
803
|
+
def detect_web_o_s_t_v()
|
804
|
+
if (user_agent.include?(DEVICE_WEB_O_STV) &&
|
805
|
+
user_agent.include?(SMART_T_V2))
|
805
806
|
return true
|
806
807
|
end
|
807
808
|
return false
|
808
809
|
end
|
809
810
|
|
810
811
|
=begin
|
811
|
-
|
812
|
-
* Detects Opera Mobile
|
813
|
-
* @return detection of an Opera browser
|
812
|
+
*
|
813
|
+
* Detects Opera Mobile or Opera Mini.
|
814
|
+
* @return detection of an Opera browser for a mobile device
|
814
815
|
|
815
816
|
=end
|
816
|
-
def
|
817
|
-
if (user_agent.include?(ENGINE_OPERA) && (user_agent.include?(
|
817
|
+
def detect_opera_mobile()
|
818
|
+
if (user_agent.include?(ENGINE_OPERA) && (user_agent.include?(MINI) || user_agent.include?(MOBI)))
|
818
819
|
return true
|
819
820
|
end
|
820
821
|
return false
|
821
822
|
end
|
822
823
|
|
823
824
|
=begin
|
824
|
-
|
825
|
+
*
|
825
826
|
* Detects if the current device is an Amazon Kindle (eInk devices only).
|
826
827
|
* Note: For the Kindle Fire, use the normal Android methods.
|
827
828
|
* @return detection of a Kindle
|
@@ -836,7 +837,7 @@ module MobileESPConverted
|
|
836
837
|
end
|
837
838
|
|
838
839
|
=begin
|
839
|
-
|
840
|
+
*
|
840
841
|
* Detects if the current Amazon device is using the Silk Browser.
|
841
842
|
* Note: Typically used by the the Kindle Fire.
|
842
843
|
* @return detection of an Amazon Kindle Fire in Silk mode.
|
@@ -850,7 +851,7 @@ module MobileESPConverted
|
|
850
851
|
end
|
851
852
|
|
852
853
|
=begin
|
853
|
-
|
854
|
+
*
|
854
855
|
* Detects if the current browser is a
|
855
856
|
* Garmin Nuvifone.
|
856
857
|
* @return detection of a Garmin Nuvifone
|
@@ -864,8 +865,8 @@ module MobileESPConverted
|
|
864
865
|
end
|
865
866
|
|
866
867
|
=begin
|
867
|
-
|
868
|
-
* Detects a device running the Bada
|
868
|
+
*
|
869
|
+
* Detects a device running the Bada OS from Samsung.
|
869
870
|
* @return detection of a Bada device
|
870
871
|
|
871
872
|
=end
|
@@ -877,20 +878,35 @@ module MobileESPConverted
|
|
877
878
|
end
|
878
879
|
|
879
880
|
=begin
|
880
|
-
|
881
|
+
*
|
881
882
|
* Detects a device running the Tizen smartphone OS.
|
882
883
|
* @return detection of a Tizen device
|
883
884
|
|
884
885
|
=end
|
885
886
|
def detect_tizen()
|
886
|
-
if (user_agent.include?(DEVICE_TIZEN)
|
887
|
+
if (user_agent.include?(DEVICE_TIZEN) &&
|
888
|
+
user_agent.include?(MOBILE))
|
887
889
|
return true
|
888
890
|
end
|
889
891
|
return false
|
890
892
|
end
|
891
893
|
|
892
894
|
=begin
|
893
|
-
|
895
|
+
*
|
896
|
+
* Detects if the current browser is on a Tizen smart TV.
|
897
|
+
* @return detection of a Tizen smart TV
|
898
|
+
|
899
|
+
=end
|
900
|
+
def detect_tizen_t_v()
|
901
|
+
if (user_agent.include?(DEVICE_TIZEN) &&
|
902
|
+
user_agent.include?(SMART_T_V1))
|
903
|
+
return true
|
904
|
+
end
|
905
|
+
return false
|
906
|
+
end
|
907
|
+
|
908
|
+
=begin
|
909
|
+
*
|
894
910
|
* Detects a device running the Meego OS.
|
895
911
|
* @return detection of a Meego device
|
896
912
|
|
@@ -903,7 +919,143 @@ module MobileESPConverted
|
|
903
919
|
end
|
904
920
|
|
905
921
|
=begin
|
906
|
-
|
922
|
+
*
|
923
|
+
* Detects a phone running the Meego OS.
|
924
|
+
* @return detection of a Meego phone
|
925
|
+
|
926
|
+
=end
|
927
|
+
def detect_meego_phone()
|
928
|
+
if (user_agent.include?(DEVICE_MEEGO) &&
|
929
|
+
user_agent.include?(MOBI))
|
930
|
+
return true
|
931
|
+
end
|
932
|
+
return false
|
933
|
+
end
|
934
|
+
|
935
|
+
=begin
|
936
|
+
*
|
937
|
+
* Detects a mobile device (probably) running the Firefox OS.
|
938
|
+
* @return detection of a Firefox OS mobile device
|
939
|
+
|
940
|
+
=end
|
941
|
+
def detect_firefox_o_s()
|
942
|
+
if (detect_firefox_o_s_phone() || detect_firefox_o_s_tablet())
|
943
|
+
return true
|
944
|
+
end
|
945
|
+
|
946
|
+
return false
|
947
|
+
end
|
948
|
+
|
949
|
+
=begin
|
950
|
+
*
|
951
|
+
* Detects a phone (probably) running the Firefox OS.
|
952
|
+
* @return detection of a Firefox OS phone
|
953
|
+
|
954
|
+
=end
|
955
|
+
def detect_firefox_o_s_phone()
|
956
|
+
|
957
|
+
if (detect_ios() || detect_android() || detect_sailfish())
|
958
|
+
return false
|
959
|
+
end
|
960
|
+
|
961
|
+
if ((user_agent.include?(ENGINE_FIREFOX)) && (user_agent.include?(MOBILE)))
|
962
|
+
return true
|
963
|
+
end
|
964
|
+
|
965
|
+
return false
|
966
|
+
end
|
967
|
+
|
968
|
+
=begin
|
969
|
+
*
|
970
|
+
* Detects a tablet (probably) running the Firefox OS.
|
971
|
+
* @return detection of a Firefox OS tablet
|
972
|
+
|
973
|
+
=end
|
974
|
+
def detect_firefox_o_s_tablet()
|
975
|
+
|
976
|
+
if (detect_ios() || detect_android() || detect_sailfish())
|
977
|
+
return false
|
978
|
+
end
|
979
|
+
|
980
|
+
if ((user_agent.include?(ENGINE_FIREFOX)) && (user_agent.include?(DEVICE_TABLET)))
|
981
|
+
return true
|
982
|
+
end
|
983
|
+
|
984
|
+
return false
|
985
|
+
end
|
986
|
+
|
987
|
+
=begin
|
988
|
+
*
|
989
|
+
* Detects a device running the Sailfish OS.
|
990
|
+
* @return detection of a Sailfish device
|
991
|
+
|
992
|
+
=end
|
993
|
+
def detect_sailfish()
|
994
|
+
if (user_agent.include?(DEVICE_SAILFISH))
|
995
|
+
return true
|
996
|
+
end
|
997
|
+
return false
|
998
|
+
end
|
999
|
+
|
1000
|
+
=begin
|
1001
|
+
*
|
1002
|
+
* Detects a phone running the Sailfish OS.
|
1003
|
+
* @return detection of a Sailfish phone
|
1004
|
+
|
1005
|
+
=end
|
1006
|
+
def detect_sailfish_phone()
|
1007
|
+
if (detect_sailfish() && (user_agent.include?(MOBILE)))
|
1008
|
+
return true
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
return false
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
=begin
|
1015
|
+
*
|
1016
|
+
* Detects a mobile device running the Ubuntu Mobile OS.
|
1017
|
+
* @return detection of an Ubuntu Mobile OS mobile device
|
1018
|
+
|
1019
|
+
=end
|
1020
|
+
def detect_ubuntu()
|
1021
|
+
if (detect_ubuntu_phone() || detect_ubuntu_tablet())
|
1022
|
+
return true
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
return false
|
1026
|
+
end
|
1027
|
+
|
1028
|
+
=begin
|
1029
|
+
*
|
1030
|
+
* Detects a phone running the Ubuntu Mobile OS.
|
1031
|
+
* @return detection of an Ubuntu Mobile OS phone
|
1032
|
+
|
1033
|
+
=end
|
1034
|
+
def detect_ubuntu_phone()
|
1035
|
+
if ((user_agent.include?(DEVICE_UBUNTU)) && (user_agent.include?(MOBILE)))
|
1036
|
+
return true
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
return false
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
=begin
|
1043
|
+
*
|
1044
|
+
* Detects a tablet running the Ubuntu Mobile OS.
|
1045
|
+
* @return detection of an Ubuntu Mobile OS tablet
|
1046
|
+
|
1047
|
+
=end
|
1048
|
+
def detect_ubuntu_tablet()
|
1049
|
+
if ((user_agent.include?(DEVICE_UBUNTU)) && (user_agent.include?(DEVICE_TABLET)))
|
1050
|
+
return true
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
return false
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
|
1057
|
+
=begin
|
1058
|
+
*
|
907
1059
|
* Detects the Danger Hiptop device.
|
908
1060
|
* @return detection of a Danger Hiptop
|
909
1061
|
|
@@ -916,7 +1068,7 @@ module MobileESPConverted
|
|
916
1068
|
end
|
917
1069
|
|
918
1070
|
=begin
|
919
|
-
|
1071
|
+
*
|
920
1072
|
* Detects if the current browser is a Sony Mylo device.
|
921
1073
|
* @return detection of a Sony Mylo device
|
922
1074
|
|
@@ -929,7 +1081,7 @@ module MobileESPConverted
|
|
929
1081
|
end
|
930
1082
|
|
931
1083
|
=begin
|
932
|
-
|
1084
|
+
*
|
933
1085
|
* Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.
|
934
1086
|
* @return detection of a Maemo OS tablet
|
935
1087
|
|
@@ -944,7 +1096,7 @@ module MobileESPConverted
|
|
944
1096
|
end
|
945
1097
|
|
946
1098
|
=begin
|
947
|
-
|
1099
|
+
*
|
948
1100
|
* Detects if the current device is an Archos media player/Internet tablet.
|
949
1101
|
* @return detection of an Archos media player
|
950
1102
|
|
@@ -957,7 +1109,7 @@ module MobileESPConverted
|
|
957
1109
|
end
|
958
1110
|
|
959
1111
|
=begin
|
960
|
-
|
1112
|
+
*
|
961
1113
|
* Detects if the current device is an Internet-capable game console.
|
962
1114
|
* Includes many handheld consoles.
|
963
1115
|
* @return detection of any Game Console
|
@@ -971,7 +1123,7 @@ module MobileESPConverted
|
|
971
1123
|
end
|
972
1124
|
|
973
1125
|
=begin
|
974
|
-
|
1126
|
+
*
|
975
1127
|
* Detects if the current device is a Sony Playstation.
|
976
1128
|
* @return detection of Sony Playstation
|
977
1129
|
|
@@ -984,7 +1136,7 @@ module MobileESPConverted
|
|
984
1136
|
end
|
985
1137
|
|
986
1138
|
=begin
|
987
|
-
|
1139
|
+
*
|
988
1140
|
* Detects if the current device is a handheld gaming device with
|
989
1141
|
* a touchscreen and modern iPhone-class browser. Includes the Playstation Vita.
|
990
1142
|
* @return detection of a handheld gaming device
|
@@ -999,7 +1151,7 @@ module MobileESPConverted
|
|
999
1151
|
end
|
1000
1152
|
|
1001
1153
|
=begin
|
1002
|
-
|
1154
|
+
*
|
1003
1155
|
* Detects if the current device is a Nintendo game device.
|
1004
1156
|
* @return detection of Nintendo
|
1005
1157
|
|
@@ -1012,7 +1164,7 @@ module MobileESPConverted
|
|
1012
1164
|
end
|
1013
1165
|
|
1014
1166
|
=begin
|
1015
|
-
|
1167
|
+
*
|
1016
1168
|
* Detects if the current device is a Microsoft Xbox.
|
1017
1169
|
* @return detection of Xbox
|
1018
1170
|
|
@@ -1025,7 +1177,7 @@ module MobileESPConverted
|
|
1025
1177
|
end
|
1026
1178
|
|
1027
1179
|
=begin
|
1028
|
-
|
1180
|
+
*
|
1029
1181
|
* Detects whether the device is a Brew-powered device.
|
1030
1182
|
* @return detection of a Brew device
|
1031
1183
|
|
@@ -1038,7 +1190,7 @@ module MobileESPConverted
|
|
1038
1190
|
end
|
1039
1191
|
|
1040
1192
|
=begin
|
1041
|
-
|
1193
|
+
*
|
1042
1194
|
* Detects whether the device supports WAP or WML.
|
1043
1195
|
* @return detection of a WAP- or WML-capable device
|
1044
1196
|
|
@@ -1051,7 +1203,7 @@ module MobileESPConverted
|
|
1051
1203
|
end
|
1052
1204
|
|
1053
1205
|
=begin
|
1054
|
-
|
1206
|
+
*
|
1055
1207
|
* Detects if the current device supports MIDP, a mobile Java technology.
|
1056
1208
|
* @return detection of a MIDP mobile Java-capable device
|
1057
1209
|
|
@@ -1064,8 +1216,13 @@ module MobileESPConverted
|
|
1064
1216
|
end
|
1065
1217
|
|
1066
1218
|
|
1219
|
+
|
1220
|
+
|
1221
|
+
|
1222
|
+
|
1223
|
+
|
1067
1224
|
=begin
|
1068
|
-
|
1225
|
+
*
|
1069
1226
|
* Check to see whether the device is any device
|
1070
1227
|
* in the 'smartphone' category.
|
1071
1228
|
* @return detection of a general smartphone device
|
@@ -1073,11 +1230,11 @@ module MobileESPConverted
|
|
1073
1230
|
=end
|
1074
1231
|
def detect_smartphone()
|
1075
1232
|
|
1076
|
-
return (detect_tier_iphone() || detect_s60_oss_browser() || detect_symbian_o_s() || detect_windows_mobile() || detect_black_berry() || detect_palm_o_s())
|
1233
|
+
return (detect_tier_iphone() || detect_s60_oss_browser() || detect_symbian_o_s() || detect_windows_mobile() || detect_black_berry() || detect_meego_phone() || detect_palm_o_s())
|
1077
1234
|
end
|
1078
1235
|
|
1079
1236
|
=begin
|
1080
|
-
|
1237
|
+
*
|
1081
1238
|
* Detects if the current device is a mobile device.
|
1082
1239
|
* This method catches most of the popular modern devices.
|
1083
1240
|
* Excludes Apple iPads and other modern tablets.
|
@@ -1086,43 +1243,33 @@ module MobileESPConverted
|
|
1086
1243
|
=end
|
1087
1244
|
def detect_mobile_quick()
|
1088
1245
|
|
1089
|
-
if (
|
1246
|
+
if (is_tier_tablet)
|
1090
1247
|
return false
|
1091
1248
|
end
|
1092
1249
|
|
1093
|
-
if ((init_completed == true) ||
|
1094
|
-
(is_mobile_phone == true))
|
1095
|
-
return is_mobile_phone
|
1096
|
-
end
|
1097
|
-
|
1098
|
-
|
1099
1250
|
if (detect_smartphone())
|
1100
1251
|
return true
|
1101
1252
|
end
|
1102
1253
|
|
1103
|
-
if (detect_wap_wml() || detect_brew_device() || detect_opera_mobile())
|
1104
|
-
return true
|
1105
|
-
end
|
1106
1254
|
|
1107
|
-
if (
|
1255
|
+
if (user_agent.include?(MOBILE))
|
1108
1256
|
return true
|
1109
1257
|
end
|
1110
1258
|
|
1111
|
-
if (
|
1259
|
+
if (detect_opera_mobile())
|
1112
1260
|
return true
|
1113
1261
|
end
|
1114
1262
|
|
1115
|
-
|
1116
|
-
|
1263
|
+
|
1264
|
+
if (detect_kindle() || detect_amazon_silk())
|
1117
1265
|
return true
|
1118
1266
|
end
|
1119
1267
|
|
1120
|
-
if (
|
1268
|
+
if (detect_wap_wml() || detect_midp_capable() || detect_brew_device())
|
1121
1269
|
return true
|
1122
1270
|
end
|
1123
1271
|
|
1124
|
-
|
1125
|
-
if (detect_kindle() || detect_amazon_silk())
|
1272
|
+
if ((user_agent.include?(ENGINE_NETFRONT)) || (user_agent.include?(ENGINE_UP_BROWSER)))
|
1126
1273
|
return true
|
1127
1274
|
end
|
1128
1275
|
|
@@ -1130,7 +1277,7 @@ module MobileESPConverted
|
|
1130
1277
|
end
|
1131
1278
|
|
1132
1279
|
=begin
|
1133
|
-
|
1280
|
+
*
|
1134
1281
|
* The longer and more thorough way to detect for a mobile device.
|
1135
1282
|
* Will probably detect most feature phones,
|
1136
1283
|
* smartphone-class devices, Internet Tablets,
|
@@ -1141,31 +1288,21 @@ module MobileESPConverted
|
|
1141
1288
|
|
1142
1289
|
=end
|
1143
1290
|
def detect_mobile_long()
|
1144
|
-
if (detect_mobile_quick() || detect_game_console()
|
1291
|
+
if (detect_mobile_quick() || detect_game_console())
|
1145
1292
|
return true
|
1146
1293
|
end
|
1147
1294
|
|
1148
|
-
|
1149
|
-
if (user_agent.include?(UPLINK))
|
1150
|
-
return true
|
1151
|
-
end
|
1152
|
-
if (user_agent.include?(MANU_SONY_ERICSSON))
|
1153
|
-
return true
|
1154
|
-
end
|
1155
|
-
if (user_agent.include?(MANUERICSSON))
|
1156
|
-
return true
|
1157
|
-
end
|
1158
|
-
if (user_agent.include?(MANU_SAMSUNG1))
|
1295
|
+
if (detect_danger_hiptop() || detect_maemo_tablet() || detect_sony_mylo() || detect_archos())
|
1159
1296
|
return true
|
1160
1297
|
end
|
1161
1298
|
|
1162
|
-
if (user_agent.include?(
|
1163
|
-
|
1164
|
-
end
|
1165
|
-
if (user_agent.include?(SVC_KDDI))
|
1299
|
+
if ((user_agent.include?(DEVICE_PDA)) &&
|
1300
|
+
(!user_agent.include?(DIS_UPDATE)))
|
1166
1301
|
return true
|
1167
1302
|
end
|
1168
|
-
|
1303
|
+
|
1304
|
+
|
1305
|
+
if ((user_agent.include?(UPLINK)) || (user_agent.include?(ENGINE_OPEN_WEB)) || (user_agent.include?(MANU_SAMSUNG1)) || (user_agent.include?(MANU_SONY_ERICSSON)) || (user_agent.include?(MANUERICSSON)) || (user_agent.include?(SVC_DOCOMO)) || (user_agent.include?(SVC_KDDI)) || (user_agent.include?(SVC_VODAFONE)))
|
1169
1306
|
return true
|
1170
1307
|
end
|
1171
1308
|
|
@@ -1173,8 +1310,11 @@ module MobileESPConverted
|
|
1173
1310
|
end
|
1174
1311
|
|
1175
1312
|
|
1313
|
+
|
1314
|
+
|
1315
|
+
|
1176
1316
|
=begin
|
1177
|
-
|
1317
|
+
*
|
1178
1318
|
* The quick way to detect for a tier of devices.
|
1179
1319
|
* This method detects for the new generation of
|
1180
1320
|
* HTML 5 capable, larger screen tablets.
|
@@ -1183,19 +1323,14 @@ module MobileESPConverted
|
|
1183
1323
|
|
1184
1324
|
=end
|
1185
1325
|
def detect_tier_tablet()
|
1186
|
-
if ((
|
1187
|
-
(@is_tier_tablet == true))
|
1188
|
-
return @is_tier_tablet
|
1189
|
-
end
|
1190
|
-
|
1191
|
-
if (detect_ipad() || detect_android_tablet() || detect_black_berry_tablet() || detect_web_o_s_tablet())
|
1326
|
+
if (detect_ipad() || detect_android_tablet() || detect_black_berry_tablet() || detect_firefox_o_s_tablet() || detect_ubuntu_tablet() || detect_web_o_s_tablet())
|
1192
1327
|
return true
|
1193
1328
|
end
|
1194
1329
|
return false
|
1195
1330
|
end
|
1196
1331
|
|
1197
1332
|
=begin
|
1198
|
-
|
1333
|
+
*
|
1199
1334
|
* The quick way to detect for a tier of devices.
|
1200
1335
|
* This method detects for devices which can
|
1201
1336
|
* display iPhone-optimized web content.
|
@@ -1204,19 +1339,14 @@ module MobileESPConverted
|
|
1204
1339
|
|
1205
1340
|
=end
|
1206
1341
|
def detect_tier_iphone()
|
1207
|
-
if ((
|
1208
|
-
(@is_tier_iphone == true))
|
1209
|
-
return @is_tier_iphone
|
1210
|
-
end
|
1211
|
-
|
1212
|
-
if (detect_iphone_or_ipod() || detect_android_phone() || detect_windows_phone() || detect_black_berry10_phone() || (detect_black_berry_web_kit() && detect_black_berry_touch()) || detect_palm_web_o_s() || detect_bada() || detect_tizen() || detect_gaming_handheld())
|
1342
|
+
if (detect_iphone_or_ipod() || detect_android_phone() || detect_windows_phone() || detect_black_berry10_phone() || (detect_black_berry_web_kit() && detect_black_berry_touch()) || detect_palm_web_o_s() || detect_bada() || detect_tizen() || detect_firefox_o_s_phone() || detect_sailfish_phone() || detect_ubuntu_phone() || detect_gaming_handheld())
|
1213
1343
|
return true
|
1214
1344
|
end
|
1215
1345
|
return false
|
1216
1346
|
end
|
1217
1347
|
|
1218
1348
|
=begin
|
1219
|
-
|
1349
|
+
*
|
1220
1350
|
* The quick way to detect for a tier of devices.
|
1221
1351
|
* This method detects for devices which are likely to be capable
|
1222
1352
|
* of viewing CSS content optimized for the iPhone,
|
@@ -1226,11 +1356,6 @@ module MobileESPConverted
|
|
1226
1356
|
|
1227
1357
|
=end
|
1228
1358
|
def detect_tier_rich_css()
|
1229
|
-
if ((@init_completed == true) ||
|
1230
|
-
(@is_tier_rich_css == true))
|
1231
|
-
return @is_tier_rich_css
|
1232
|
-
end
|
1233
|
-
|
1234
1359
|
result = false
|
1235
1360
|
|
1236
1361
|
|
@@ -1240,6 +1365,8 @@ module MobileESPConverted
|
|
1240
1365
|
if (!detect_tier_iphone() && !detect_kindle())
|
1241
1366
|
|
1242
1367
|
|
1368
|
+
|
1369
|
+
|
1243
1370
|
if (detect_webkit() || detect_s60_oss_browser() || detect_black_berry_high() || detect_windows_mobile() || user_agent.include?(ENGINE_TELECA_Q))
|
1244
1371
|
result= true
|
1245
1372
|
end
|
@@ -1249,7 +1376,7 @@ module MobileESPConverted
|
|
1249
1376
|
end
|
1250
1377
|
|
1251
1378
|
=begin
|
1252
|
-
|
1379
|
+
*
|
1253
1380
|
* The quick way to detect for a tier of devices.
|
1254
1381
|
* This method detects for all other types of phones,
|
1255
1382
|
* but excludes the iPhone and RichCSS Tier devices.
|
@@ -1257,16 +1384,10 @@ module MobileESPConverted
|
|
1257
1384
|
|
1258
1385
|
=end
|
1259
1386
|
def detect_tier_other_phones()
|
1260
|
-
if ((@init_completed == true) ||
|
1261
|
-
(@is_tier_generic_mobile == true))
|
1262
|
-
return @is_tier_generic_mobile
|
1263
|
-
end
|
1264
|
-
|
1265
1387
|
|
1266
1388
|
if (detect_mobile_long() && !detect_tier_iphone() && !detect_tier_rich_css())
|
1267
1389
|
return true
|
1268
1390
|
end
|
1269
|
-
|
1270
1391
|
return false
|
1271
1392
|
end
|
1272
1393
|
end
|