mobileesp_converted 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +1,30 @@
1
1
  # This file has been automatically converted to Ruby from Java source code.
2
- #
3
- #
4
- #
2
+
3
+
5
4
  =begin
6
- *******************************************
7
- # Copyright 2010-2012, Anthony Hand
8
- #
9
- # File version date: April 23, 2012
10
- # Update:
11
- # - Updated DetectAmazonSilk(): Fixed an issue in the detection logic.
12
- #
13
- # File version date: April 22, 2012 - Second update
14
- # Update: To address additional Kindle issues...
15
- # - Updated DetectRichCSS(): Excluded e-Ink Kindle devices.
16
- # - Created DetectAmazonSilk(): Created to detect Kindle Fire devices in Silk mode.
17
- # - Updated DetectMobileQuick(): Updated to include e-Ink Kindle devices and the Kindle Fire in Silk mode.
18
- #
19
- # File version date: April 11, 2012
20
- # Update:
21
- # - Added a new variable for the new BlackBerry Curve Touch (9380): deviceBBCurveTouch.
22
- # - Updated DetectBlackBerryTouch() to support the new BlackBerry Curve Touch (9380).
5
+ *******************************************
6
+ # Copyright 2010-2013, Anthony Hand
23
7
  #
24
- # File version date: January 21, 2012
25
- # Update:
26
- # - Moved Windows Phone 7 to the iPhone Tier. WP7.5's IE 9-based browser is good enough now.
27
- # - Added a new variable for 2 versions of the new BlackBerry Bold Touch (9900 and 9930): deviceBBBoldTouch.
28
- # - Updated DetectBlackBerryTouch() to support the 2 versions of the new BlackBerry Bold Touch (9900 and 9930).
29
- # - Updated DetectKindle() to focus on eInk devices only. The Kindle Fire should be detected as a regular Android device.
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.
30
11
  #
31
- # File version date: August 22, 2011
32
- # Update:
33
- # - Updated DetectAndroidTablet() to fix a bug I introduced in the last fix!
12
+ # File version 2013.07.13 (July 13, 2013)
13
+ # Updates:
14
+ # - Added support for Tizen: variable and DetectTizen().
15
+ # - Added support for Meego: variable and DetectMeego().
16
+ # - Added support for Windows Phone 8: variable and DetectWindowsPhone8().
17
+ # - Added a generic Windows Phone method: DetectWindowsPhone().
18
+ # - Added support for BlackBerry 10 OS: variable and DetectBlackBerry10Phone().
19
+ # - Added support for PlayStation Vita handheld: variable and DetectGamingHandheld().
20
+ # - Updated DetectTierIphone(). Added Tizen; updated the Windows Phone, BB10, and PS Vita support.
21
+ # - Updated DetectWindowsMobile(). Uses generic DetectWindowsPhone() method rather than WP7.
22
+ # - Updated DetectSmartphone(). Uses the detect_tier_iphone() method.
23
+ # - Updated DetectSonyMylo() with more efficient code.
24
+ # - Removed DetectGarminNuvifone() from DetectTierIphone(). How many are left in market in 2013? It is detected as a RichCSS Tier device.
25
+ # - Removed the deviceXoom variable. It was unused.
26
+ # - Added detection support for the Obigo mobile browser to DetectMobileQuick().
34
27
  #
35
- # File version date: August 16, 2011
36
- # Update:
37
- # - Updated DetectAndroidTablet() to exclude Opera Mini, which was falsely reporting as running on a tablet device when on a phone.
38
28
  #
39
29
  #
40
30
  # LICENSE INFORMATION
@@ -65,14 +55,14 @@
65
55
 
66
56
  =begin
67
57
  *
68
- * The DetectSmartPhone class encapsulates information about
69
- * a browser's connection to your web site.
70
- * You can use it to find out whether the browser asking for
71
- * your site's content is probably running on a mobile device.
72
- * The methods were written so you can be as granular as you want.
73
- * For example, enquiring whether it's as specific as an iPod Touch or
74
- * as general as a smartphone class device.
75
- * The object's methods return true, or false.
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
66
 
77
67
  =end
78
68
  module MobileESPConverted
@@ -83,7 +73,11 @@ module MobileESPConverted
83
73
  attr_reader :http_accept
84
74
 
85
75
 
76
+ attr_reader :init_completed
77
+ attr_reader :is_webkit
78
+ attr_reader :is_mobile_phone
86
79
  attr_reader :is_iphone
80
+ attr_reader :is_android
87
81
  attr_reader :is_android_phone
88
82
  attr_reader :is_tier_tablet
89
83
  attr_reader :is_tier_iphone
@@ -93,96 +87,102 @@ module MobileESPConverted
93
87
 
94
88
  ENGINE_WEB_KIT = "webkit"
95
89
 
96
- DEVICE_IPHONE = "iphone"
97
- DEVICE_IPOD = "ipod"
98
- DEVICE_IPAD = "ipad"
90
+ DEVICE_IPHONE = "iphone"
91
+ DEVICE_IPOD = "ipod"
92
+ DEVICE_IPAD = "ipad"
99
93
  DEVICE_MAC_PPC = "macintosh"
100
94
 
101
- DEVICE_ANDROID = "android"
95
+ DEVICE_ANDROID = "android"
102
96
  DEVICE_GOOGLE_T_V = "googletv"
103
- DEVICE_XOOM = "xoom"
104
- DEVICE_HTC_FLYER = "htc_flyer"
105
-
106
- DEVICE_SYMBIAN = "symbian"
107
- DEVICE_S60 = "series60"
108
- DEVICE_S70 = "series70"
109
- DEVICE_S80 = "series80"
110
- DEVICE_S90 = "series90"
97
+ DEVICE_HTC_FLYER = "htc_flyer"
111
98
 
112
99
  DEVICE_WIN_PHONE7 = "windows phone os 7"
113
- DEVICE_WIN_MOB = "windows ce"
114
- DEVICE_WINDOWS = "windows"
115
- DEVICE_IE_MOB = "iemobile"
116
- DEVICE_PPC = "ppc"
117
- ENGINE_PIE = "wm5 pie"
118
-
119
- DEVICE_B_B = "blackberry"
120
- VND_R_I_M = "vnd.rim"
121
- DEVICE_B_B_STORM = "blackberry95"
122
- DEVICE_B_B_BOLD = "blackberry97"
123
- DEVICE_B_B_BOLD_TOUCH = "blackberry 99"
124
- DEVICE_B_B_TOUR = "blackberry96"
125
- DEVICE_B_B_CURVE = "blackberry89"
100
+ DEVICE_WIN_PHONE8 = "windows phone 8"
101
+ DEVICE_WIN_MOB = "windows ce"
102
+ DEVICE_WINDOWS = "windows"
103
+ DEVICE_IE_MOB = "iemobile"
104
+ DEVICE_PPC = "ppc"
105
+ ENGINE_PIE = "wm5 pie"
106
+
107
+ DEVICE_B_B = "blackberry"
108
+ DEVICE_B_B10 = "bb10"
109
+ VND_R_I_M = "vnd.rim"
110
+ DEVICE_B_B_STORM = "blackberry95"
111
+ DEVICE_B_B_BOLD = "blackberry97"
112
+ DEVICE_B_B_BOLD_TOUCH = "blackberry 99"
113
+ DEVICE_B_B_TOUR = "blackberry96"
114
+ DEVICE_B_B_CURVE = "blackberry89"
126
115
  DEVICE_B_B_CURVE_TOUCH = "blackberry 938"
127
- DEVICE_B_B_TORCH = "blackberry 98"
128
- DEVICE_B_B_PLAYBOOK = "playbook"
116
+ DEVICE_B_B_TORCH = "blackberry 98"
117
+ DEVICE_B_B_PLAYBOOK = "playbook"
118
+
119
+ DEVICE_SYMBIAN = "symbian"
120
+ DEVICE_S60 = "series60"
121
+ DEVICE_S70 = "series70"
122
+ DEVICE_S80 = "series80"
123
+ DEVICE_S90 = "series90"
129
124
 
130
- DEVICE_PALM = "palm"
131
- DEVICE_WEB_O_S = "webos"
125
+ DEVICE_PALM = "palm"
126
+ DEVICE_WEB_O_S = "webos"
132
127
  DEVICE_WEB_O_SHP = "hpwos"
128
+ ENGINE_BLAZER = "blazer"
129
+ ENGINE_XIINO = "xiino"
133
130
 
134
- ENGINE_BLAZER = "blazer"
135
- ENGINE_XIINO = "xiino"
131
+ DEVICE_NUVIFONE = "nuvifone"
132
+ DEVICE_BADA = "bada"
133
+ DEVICE_TIZEN = "tizen"
134
+ DEVICE_MEEGO = "meego"
136
135
 
137
136
  DEVICE_KINDLE = "kindle"
138
- ENGINE_SILK = "silk"
139
-
140
- DEVICE_NUVIFONE = "nuvifone"
137
+ ENGINE_SILK = "silk-accelerated"
141
138
 
142
139
 
143
140
  VNDWAP = "vnd.wap"
144
- WML = "wml"
145
-
146
-
147
- DEVICE_TABLET = "tablet"
148
- DEVICE_BREW = "brew"
149
- DEVICE_DANGER = "danger"
150
- DEVICE_HIPTOP = "hiptop"
151
- DEVICE_PLAYSTATION = "playstation"
152
- DEVICE_NINTENDO_DS = "nitro"
153
- DEVICE_NINTENDO = "nintendo"
154
- DEVICE_WII = "wii"
155
- DEVICE_XBOX = "xbox"
156
- DEVICE_ARCHOS = "archos"
157
-
158
- ENGINE_OPERA = "opera"
159
- ENGINE_NETFRONT = "netfront"
141
+ WML = "wml"
142
+
143
+
144
+ DEVICE_TABLET = "tablet"
145
+ DEVICE_BREW = "brew"
146
+ DEVICE_DANGER = "danger"
147
+ DEVICE_HIPTOP = "hiptop"
148
+ DEVICE_PLAYSTATION = "playstation"
149
+ DEVICE_PLAYSTATION_VITA = "vita"
150
+ DEVICE_NINTENDO_DS = "nitro"
151
+ DEVICE_NINTENDO = "nintendo"
152
+ DEVICE_WII = "wii"
153
+ DEVICE_XBOX = "xbox"
154
+ DEVICE_ARCHOS = "archos"
155
+
156
+ ENGINE_OPERA = "opera"
157
+ ENGINE_NETFRONT = "netfront"
160
158
  ENGINE_UP_BROWSER = "up.browser"
161
- ENGINE_OPEN_WEB = "openweb"
162
- DEVICE_MIDP = "midp"
163
- UPLINK = "up.link"
164
- ENGINE_TELECA_Q = "teleca q"
159
+ ENGINE_OPEN_WEB = "openweb"
160
+ DEVICE_MIDP = "midp"
161
+ UPLINK = "up.link"
162
+ ENGINE_TELECA_Q = "teleca q"
163
+ ENGINE_OBIGO = "obigo"
164
+
165
165
  DEVICE_PDA = "pda"
166
- MINI = "mini"
167
- MOBILE = "mobile"
168
- MOBI = "mobi"
166
+ MINI = "mini"
167
+ MOBILE = "mobile"
168
+ MOBI = "mobi"
169
169
 
170
170
 
171
- MAEMO = "maemo"
172
- LINUX = "linux"
171
+ MAEMO = "maemo"
172
+ LINUX = "linux"
173
173
  QTEMBEDDED = "qt embedded"
174
- MYLOCOM2 = "com2"
174
+ MYLOCOM2 = "com2"
175
175
 
176
176
 
177
177
  MANU_SONY_ERICSSON = "sonyericsson"
178
- MANUERICSSON = "ericsson"
179
- MANU_SAMSUNG1 = "sec-sgh"
180
- MANU_SONY = "sony"
181
- MANU_HTC = "htc"
178
+ MANUERICSSON = "ericsson"
179
+ MANU_SAMSUNG1 = "sec-sgh"
180
+ MANU_SONY = "sony"
181
+ MANU_HTC = "htc"
182
182
 
183
183
 
184
- SVC_DOCOMO = "docomo"
185
- SVC_KDDI = "kddi"
184
+ SVC_DOCOMO = "docomo"
185
+ SVC_KDDI = "kddi"
186
186
  SVC_VODAFONE = "vodafone"
187
187
 
188
188
 
@@ -190,7 +190,7 @@ module MobileESPConverted
190
190
 
191
191
 
192
192
  =begin
193
- *
193
+ *
194
194
  * Initialize the user_agent and http_accept variables
195
195
  *
196
196
  * @param user_agent the User-Agent header
@@ -210,7 +210,7 @@ module MobileESPConverted
210
210
  end
211
211
 
212
212
  =begin
213
- *
213
+ *
214
214
  * Return the lower case HTTP_USER_AGENT
215
215
  * @return user_agent
216
216
 
@@ -220,7 +220,7 @@ module MobileESPConverted
220
220
  end
221
221
 
222
222
  =begin
223
- *
223
+ *
224
224
  * Return the lower case HTTP_ACCEPT
225
225
  * @return http_accept
226
226
 
@@ -230,7 +230,7 @@ module MobileESPConverted
230
230
  end
231
231
 
232
232
  =begin
233
- *
233
+ *
234
234
  * Return whether the device is an Iphone or iPod Touch
235
235
  * @return is_iphone
236
236
 
@@ -240,7 +240,7 @@ module MobileESPConverted
240
240
  end
241
241
 
242
242
  =begin
243
- *
243
+ *
244
244
  * Return whether the device is in the Tablet Tier.
245
245
  * @return is_tier_tablet
246
246
 
@@ -250,7 +250,7 @@ module MobileESPConverted
250
250
  end
251
251
 
252
252
  =begin
253
- *
253
+ *
254
254
  * Return whether the device is in the Iphone Tier.
255
255
  * @return is_tier_iphone
256
256
 
@@ -260,7 +260,7 @@ module MobileESPConverted
260
260
  end
261
261
 
262
262
  =begin
263
- *
263
+ *
264
264
  * Return whether the device is in the 'Rich CSS' tier of mobile devices.
265
265
  * @return is_tier_rich_css
266
266
 
@@ -270,7 +270,7 @@ module MobileESPConverted
270
270
  end
271
271
 
272
272
  =begin
273
- *
273
+ *
274
274
  * Return whether the device is a generic, less-capable mobile device.
275
275
  * @return is_tier_generic_mobile
276
276
 
@@ -280,26 +280,41 @@ module MobileESPConverted
280
280
  end
281
281
 
282
282
  =begin
283
- *
283
+ *
284
284
  * Initialize Key Stored Values.
285
285
 
286
286
  =end
287
287
  def init_device_scan()
288
- @is_iphone = detect_iphone_or_ipod()
288
+
289
+ @is_webkit = detect_webkit()
290
+ @is_iphone = detect_iphone()
291
+ @is_android = detect_android()
289
292
  @is_android_phone = detect_android_phone()
290
- @is_tier_tablet = detect_tier_tablet()
291
- @is_tier_iphone = detect_tier_iphone()
292
- @is_tier_rich_css = detect_tier_rich_css()
293
+
294
+
295
+ @is_mobile_phone = detect_mobile_quick()
296
+ @is_tier_tablet = detect_tier_tablet()
297
+ @is_tier_iphone = detect_tier_iphone()
298
+
299
+
300
+ @is_tier_rich_css = detect_tier_rich_css()
293
301
  @is_tier_generic_mobile = detect_tier_other_phones()
302
+
303
+ @init_completed = true
294
304
  end
295
305
 
296
306
  =begin
297
- *
307
+ *
298
308
  * Detects if the current device is an iPhone.
299
309
  * @return detection of an iPhone
300
310
 
301
311
  =end
302
312
  def detect_iphone()
313
+ if ((@init_completed == true) ||
314
+ (@is_iphone == true))
315
+ return @is_iphone
316
+ end
317
+
303
318
 
304
319
  if (user_agent.include?(DEVICE_IPHONE) &&
305
320
  !detect_ipad() &&
@@ -310,7 +325,7 @@ module MobileESPConverted
310
325
  end
311
326
 
312
327
  =begin
313
- *
328
+ *
314
329
  * Detects if the current device is an iPod Touch.
315
330
  * @return detection of an iPod Touch
316
331
 
@@ -323,7 +338,7 @@ module MobileESPConverted
323
338
  end
324
339
 
325
340
  =begin
326
- *
341
+ *
327
342
  * Detects if the current device is an iPad tablet.
328
343
  * @return detection of an iPad
329
344
 
@@ -336,7 +351,7 @@ module MobileESPConverted
336
351
  end
337
352
 
338
353
  =begin
339
- *
354
+ *
340
355
  * Detects if the current device is an iPhone or iPod Touch.
341
356
  * @return detection of an iPhone or iPod Touch
342
357
 
@@ -350,7 +365,7 @@ module MobileESPConverted
350
365
  end
351
366
 
352
367
  =begin
353
- *
368
+ *
354
369
  * Detects *any* iOS device: iPhone, iPod Touch, iPad.
355
370
  * @return detection of an Apple iOS device
356
371
 
@@ -364,13 +379,18 @@ module MobileESPConverted
364
379
 
365
380
 
366
381
  =begin
367
- *
382
+ *
368
383
  * Detects *any* Android OS-based device: phone, tablet, and multi-media player.
369
384
  * Also detects Google TV.
370
385
  * @return detection of an Android device
371
386
 
372
387
  =end
373
388
  def detect_android()
389
+ if ((@init_completed == true) ||
390
+ (@is_android == true))
391
+ return @is_android
392
+ end
393
+
374
394
  if ((user_agent.include?(DEVICE_ANDROID)) ||
375
395
  detect_google_t_v())
376
396
  return true
@@ -383,7 +403,7 @@ module MobileESPConverted
383
403
  end
384
404
 
385
405
  =begin
386
- *
406
+ *
387
407
  * Detects if the current device is a (small-ish) Android OS-based device
388
408
  * used for calling and/or multi-media (like a Samsung Galaxy Player).
389
409
  * Google says these devices will have 'Android' AND 'mobile' in user agent.
@@ -392,6 +412,11 @@ module MobileESPConverted
392
412
 
393
413
  =end
394
414
  def detect_android_phone()
415
+ if ((@init_completed == true) ||
416
+ (@is_android_phone == true))
417
+ return @is_android_phone
418
+ end
419
+
395
420
  if (detect_android() && (user_agent.include?(MOBILE)))
396
421
  return true
397
422
  end
@@ -407,7 +432,7 @@ module MobileESPConverted
407
432
  end
408
433
 
409
434
  =begin
410
- *
435
+ *
411
436
  * Detects if the current device is a (self-reported) Android tablet.
412
437
  * Google says these devices will have 'Android' and NOT 'mobile' in their user agent.
413
438
  * @return detection of an Android tablet
@@ -437,7 +462,7 @@ module MobileESPConverted
437
462
  end
438
463
 
439
464
  =begin
440
- *
465
+ *
441
466
  * Detects if the current device is an Android OS-based device and
442
467
  * the browser is based on WebKit.
443
468
  * @return detection of an Android WebKit browser
@@ -451,7 +476,7 @@ module MobileESPConverted
451
476
  end
452
477
 
453
478
  =begin
454
- *
479
+ *
455
480
  * Detects if the current device is a GoogleTV.
456
481
  * @return detection of GoogleTV
457
482
 
@@ -464,78 +489,77 @@ module MobileESPConverted
464
489
  end
465
490
 
466
491
  =begin
467
- *
492
+ *
468
493
  * Detects if the current browser is based on WebKit.
469
494
  * @return detection of a WebKit browser
470
495
 
471
496
  =end
472
497
  def detect_webkit()
498
+ if ((@init_completed == true) ||
499
+ (@is_webkit == true))
500
+ return @is_webkit
501
+ end
502
+
473
503
  if (user_agent.include?(ENGINE_WEB_KIT))
474
504
  return true
475
505
  end
476
506
  return false
477
507
  end
478
508
 
509
+
479
510
  =begin
480
- *
481
- * Detects if the current browser is the Symbian S60 Open Source Browser.
482
- * @return detection of Symbian S60 Browser
511
+ *
512
+ * Detects if the current browser is EITHER a Windows Phone 7.x OR 8 device
513
+ * @return detection of Windows Phone 7.x OR 8
483
514
 
484
515
  =end
485
- def detect_s60_oss_browser()
486
-
487
- if (detect_webkit() && (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60)))
516
+ def detect_windows_phone()
517
+ if (detect_windows_phone7() || detect_windows_phone8())
488
518
  return true
489
519
  end
490
520
  return false
491
521
  end
492
522
 
493
523
  =begin
494
- *
495
524
  *
496
- * Detects if the current device is any Symbian OS-based device,
497
- * including older S60, Series 70, Series 80, Series 90, and UIQ,
498
- * or other browsers running on these devices.
499
- * @return detection of SymbianOS
525
+ * Detects a Windows Phone 7.x device (in mobile browsing mode).
526
+ * @return detection of Windows Phone 7
500
527
 
501
528
  =end
502
- def detect_symbian_o_s()
503
- 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))
529
+ def detect_windows_phone7()
530
+ if (user_agent.include?(DEVICE_WIN_PHONE7))
504
531
  return true
505
532
  end
506
533
  return false
507
534
  end
508
535
 
509
536
  =begin
510
- *
511
- * Detects if the current browser is a
512
- * Windows Phone 7 device.
513
- * @return detection of Windows Phone 7
537
+ *
538
+ * Detects a Windows Phone 8 device (in mobile browsing mode).
539
+ * @return detection of Windows Phone 8
514
540
 
515
541
  =end
516
- def detect_windows_phone7()
517
- if (user_agent.include?(DEVICE_WIN_PHONE7))
542
+ def detect_windows_phone8()
543
+ if (user_agent.include?(DEVICE_WIN_PHONE8))
518
544
  return true
519
545
  end
520
546
  return false
521
547
  end
522
548
 
523
549
  =begin
524
- *
550
+ *
525
551
  * Detects if the current browser is a Windows Mobile device.
526
- * Excludes Windows Phone 7 devices.
552
+ * Excludes Windows Phone 7.x and 8 devices.
527
553
  * Focuses on Windows Mobile 6.xx and earlier.
528
554
  * @return detection of Windows Mobile
529
555
 
530
556
  =end
531
557
  def detect_windows_mobile()
532
-
533
- if (detect_windows_phone7())
558
+ if (detect_windows_phone())
534
559
  return false
535
560
  end
536
561
 
537
562
 
538
-
539
563
  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)))
540
564
  return true
541
565
  end
@@ -549,10 +573,11 @@ module MobileESPConverted
549
573
  return false
550
574
  end
551
575
 
576
+
552
577
  =begin
553
- *
578
+ *
554
579
  * Detects if the current browser is any BlackBerry.
555
- * Includes the PlayBook.
580
+ * Includes BB10 OS, but excludes the PlayBook.
556
581
  * @return detection of Blackberry
557
582
 
558
583
  =end
@@ -561,11 +586,31 @@ module MobileESPConverted
561
586
  http_accept.include?(VND_R_I_M))
562
587
  return true
563
588
  end
589
+
590
+ if (detect_black_berry10_phone())
591
+ return true
592
+ end
593
+
564
594
  return false
565
595
  end
566
596
 
567
597
  =begin
568
- *
598
+ *
599
+ * Detects if the current browser is a BlackBerry 10 OS phone.
600
+ * Excludes tablets.
601
+ * @return detection of a Blackberry 10 device
602
+
603
+ =end
604
+ def detect_black_berry10_phone()
605
+ if (user_agent.include?(DEVICE_B_B10) &&
606
+ user_agent.include?(MOBILE))
607
+ return true
608
+ end
609
+ return false
610
+ end
611
+
612
+ =begin
613
+ *
569
614
  * Detects if the current browser is on a BlackBerry tablet device.
570
615
  * Example: PlayBook
571
616
  * @return detection of a Blackberry Tablet
@@ -579,7 +624,7 @@ module MobileESPConverted
579
624
  end
580
625
 
581
626
  =begin
582
- *
627
+ *
583
628
  * Detects if the current browser is a BlackBerry device AND uses a
584
629
  * WebKit-based browser. These are signatures for the new BlackBerry OS 6.
585
630
  * Examples: Torch. Includes the Playbook.
@@ -587,15 +632,14 @@ module MobileESPConverted
587
632
 
588
633
  =end
589
634
  def detect_black_berry_web_kit()
590
- if (detect_black_berry() &&
591
- user_agent.include?(ENGINE_WEB_KIT))
635
+ if (detect_black_berry() && detect_webkit())
592
636
  return true
593
637
  end
594
638
  return false
595
639
  end
596
640
 
597
641
  =begin
598
- *
642
+ *
599
643
  * Detects if the current browser is a BlackBerry Touch
600
644
  * device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
601
645
  * @return detection of a Blackberry touchscreen device
@@ -606,14 +650,14 @@ module MobileESPConverted
606
650
  (user_agent.include?(DEVICE_B_B_STORM) ||
607
651
  user_agent.include?(DEVICE_B_B_TORCH) ||
608
652
  user_agent.include?(DEVICE_B_B_BOLD_TOUCH) ||
609
- user_agent.include?(DEVICE_B_B_CURVE_TOUCH) ))
653
+ user_agent.include?(DEVICE_B_B_CURVE_TOUCH)) )
610
654
  return true
611
655
  end
612
656
  return false
613
657
  end
614
658
 
615
659
  =begin
616
- *
660
+ *
617
661
  * Detects if the current browser is a BlackBerry device AND
618
662
  * has a more capable recent browser. Excludes the Playbook.
619
663
  * Examples, Storm, Bold, Tour, Curve2
@@ -638,7 +682,7 @@ module MobileESPConverted
638
682
  end
639
683
 
640
684
  =begin
641
- *
685
+ *
642
686
  * Detects if the current browser is a BlackBerry device AND
643
687
  * has an older, less capable browser.
644
688
  * Examples: Pearl, 8800, Curve1
@@ -658,106 +702,87 @@ module MobileESPConverted
658
702
  end
659
703
  end
660
704
 
705
+
661
706
  =begin
662
- *
663
- * Detects if the current browser is on a PalmOS device.
664
- * @return detection of a PalmOS device
707
+ *
708
+ * Detects if the current browser is the Symbian S60 Open Source Browser.
709
+ * @return detection of Symbian S60 Browser
665
710
 
666
711
  =end
667
- def detect_palm_o_s()
668
-
669
- if (user_agent.include?(DEVICE_PALM) || user_agent.include?(ENGINE_BLAZER) || user_agent.include?(ENGINE_XIINO))
712
+ def detect_s60_oss_browser()
670
713
 
671
- if (detect_palm_web_o_s())
672
- return false
673
- else
674
- return true
675
- end
714
+ if (detect_webkit() && (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60)))
715
+ return true
676
716
  end
677
717
  return false
678
718
  end
679
719
 
680
720
  =begin
681
- *
682
- * Detects if the current browser is on a Palm device
683
- * running the new WebOS.
684
- * @return detection of a Palm WebOS device
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
685
727
 
686
728
  =end
687
- def detect_palm_web_o_s()
688
- if (user_agent.include?(DEVICE_WEB_O_S))
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))
689
731
  return true
690
732
  end
691
733
  return false
692
734
  end
693
735
 
736
+
694
737
  =begin
695
- *
696
- * Detects if the current browser is on an HP tablet running WebOS.
697
- * @return detection of an HP WebOS tablet
738
+ *
739
+ * Detects if the current browser is on a PalmOS device.
740
+ * @return detection of a PalmOS device
698
741
 
699
742
  =end
700
- def detect_web_o_s_tablet()
701
- if (user_agent.include?(DEVICE_WEB_O_SHP) &&
702
- user_agent.include?(DEVICE_TABLET))
703
- return true
743
+ def detect_palm_o_s()
744
+
745
+ if (detect_palm_web_o_s())
746
+ return false
704
747
  end
705
- return false
706
- end
707
748
 
708
- =begin
709
- *
710
- * Detects if the current browser is a
711
- * Garmin Nuvifone.
712
- * @return detection of a Garmin Nuvifone
713
749
 
714
- =end
715
- def detect_garmin_nuvifone()
716
- if (user_agent.include?(DEVICE_NUVIFONE))
750
+ if (user_agent.include?(DEVICE_PALM) || user_agent.include?(ENGINE_BLAZER) || user_agent.include?(ENGINE_XIINO))
717
751
  return true
718
752
  end
719
753
  return false
720
754
  end
721
755
 
722
756
  =begin
723
- *
724
- * Check to see whether the device is any device
725
- * in the 'smartphone' category.
726
- * @return detection of a general smartphone device
727
-
728
- =end
729
- def detect_smartphone()
730
- return (is_iphone || is_android_phone || is_tier_iphone || detect_s60_oss_browser() || detect_symbian_o_s() || detect_windows_mobile() || detect_windows_phone7() || detect_black_berry() || detect_palm_web_o_s() || detect_palm_o_s() || detect_garmin_nuvifone())
731
- end
732
-
733
- =begin
734
- *
735
- * Detects whether the device is a Brew-powered device.
736
- * @return detection of a Brew device
757
+ *
758
+ * Detects if the current browser is on a Palm device
759
+ * running the new WebOS.
760
+ * @return detection of a Palm WebOS device
737
761
 
738
762
  =end
739
- def detect_brew_device()
740
- if (user_agent.include?(DEVICE_BREW))
763
+ def detect_palm_web_o_s()
764
+ if (user_agent.include?(DEVICE_WEB_O_S))
741
765
  return true
742
766
  end
743
767
  return false
744
768
  end
745
769
 
746
770
  =begin
747
- *
748
- * Detects the Danger Hiptop device.
749
- * @return detection of a Danger Hiptop
771
+ *
772
+ * Detects if the current browser is on an HP tablet running WebOS.
773
+ * @return detection of an HP WebOS tablet
750
774
 
751
775
  =end
752
- def detect_danger_hiptop()
753
- if (user_agent.include?(DEVICE_DANGER) || user_agent.include?(DEVICE_HIPTOP))
776
+ def detect_web_o_s_tablet()
777
+ if (user_agent.include?(DEVICE_WEB_O_SHP) &&
778
+ user_agent.include?(DEVICE_TABLET))
754
779
  return true
755
780
  end
756
781
  return false
757
782
  end
758
783
 
759
784
  =begin
760
- *
785
+ *
761
786
  * Detects Opera Mobile or Opera Mini.
762
787
  * @return detection of an Opera browser for a mobile device
763
788
 
@@ -770,7 +795,7 @@ module MobileESPConverted
770
795
  end
771
796
 
772
797
  =begin
773
- *
798
+ *
774
799
  * Detects Opera Mobile on an Android phone.
775
800
  * @return detection of an Opera browser on an Android phone
776
801
 
@@ -783,7 +808,7 @@ module MobileESPConverted
783
808
  end
784
809
 
785
810
  =begin
786
- *
811
+ *
787
812
  * Detects Opera Mobile on an Android tablet.
788
813
  * @return detection of an Opera browser on an Android tablet
789
814
 
@@ -796,20 +821,7 @@ module MobileESPConverted
796
821
  end
797
822
 
798
823
  =begin
799
- *
800
- * Detects whether the device supports WAP or WML.
801
- * @return detection of a WAP- or WML-capable device
802
-
803
- =end
804
- def detect_wap_wml()
805
- if (http_accept.include?(VNDWAP) || http_accept.include?(WML))
806
- return true
807
- end
808
- return false
809
- end
810
-
811
- =begin
812
- *
824
+ *
813
825
  * Detects if the current device is an Amazon Kindle (eInk devices only).
814
826
  * Note: For the Kindle Fire, use the normal Android methods.
815
827
  * @return detection of a Kindle
@@ -824,7 +836,7 @@ module MobileESPConverted
824
836
  end
825
837
 
826
838
  =begin
827
- *
839
+ *
828
840
  * Detects if the current Amazon device is using the Silk Browser.
829
841
  * Note: Typically used by the the Kindle Fire.
830
842
  * @return detection of an Amazon Kindle Fire in Silk mode.
@@ -838,53 +850,128 @@ module MobileESPConverted
838
850
  end
839
851
 
840
852
  =begin
841
- *
842
- * Detects if the current device is a mobile device.
843
- * This method catches most of the popular modern devices.
844
- * Excludes Apple iPads and other modern tablets.
845
- * @return detection of any mobile device using the quicker method
853
+ *
854
+ * Detects if the current browser is a
855
+ * Garmin Nuvifone.
856
+ * @return detection of a Garmin Nuvifone
846
857
 
847
858
  =end
848
- def detect_mobile_quick()
849
-
850
- if (is_tier_tablet)
851
- return false
859
+ def detect_garmin_nuvifone()
860
+ if (user_agent.include?(DEVICE_NUVIFONE))
861
+ return true
852
862
  end
863
+ return false
864
+ end
853
865
 
854
- if (detect_smartphone())
866
+ =begin
867
+ *
868
+ * Detects a device running the Bada smartphone OS from Samsung.
869
+ * @return detection of a Bada device
870
+
871
+ =end
872
+ def detect_bada()
873
+ if (user_agent.include?(DEVICE_BADA))
855
874
  return true
856
875
  end
876
+ return false
877
+ end
857
878
 
858
- if (detect_wap_wml() || detect_brew_device() || detect_opera_mobile())
879
+ =begin
880
+ *
881
+ * Detects a device running the Tizen smartphone OS.
882
+ * @return detection of a Tizen device
883
+
884
+ =end
885
+ def detect_tizen()
886
+ if (user_agent.include?(DEVICE_TIZEN))
859
887
  return true
860
888
  end
889
+ return false
890
+ end
861
891
 
862
- if ((user_agent.include?(ENGINE_NETFRONT)) || (user_agent.include?(ENGINE_UP_BROWSER)) || (user_agent.include?(ENGINE_OPEN_WEB)))
892
+ =begin
893
+ *
894
+ * Detects a device running the Meego OS.
895
+ * @return detection of a Meego device
896
+
897
+ =end
898
+ def detect_meego()
899
+ if (user_agent.include?(DEVICE_MEEGO))
863
900
  return true
864
901
  end
902
+ return false
903
+ end
865
904
 
866
- if (detect_danger_hiptop() || detect_midp_capable() || detect_maemo_tablet() || detect_archos())
905
+ =begin
906
+ *
907
+ * Detects the Danger Hiptop device.
908
+ * @return detection of a Danger Hiptop
909
+
910
+ =end
911
+ def detect_danger_hiptop()
912
+ if (user_agent.include?(DEVICE_DANGER) || user_agent.include?(DEVICE_HIPTOP))
867
913
  return true
868
914
  end
915
+ return false
916
+ end
869
917
 
870
- if ((user_agent.include?(DEVICE_PDA)) &&
871
- (!user_agent.include?(DIS_UPDATE)))
918
+ =begin
919
+ *
920
+ * Detects if the current browser is a Sony Mylo device.
921
+ * @return detection of a Sony Mylo device
922
+
923
+ =end
924
+ def detect_sony_mylo()
925
+ if (user_agent.include?(MANU_SONY) && (user_agent.include?(QTEMBEDDED) || user_agent.include?(MYLOCOM2)))
872
926
  return true
873
927
  end
874
- if (user_agent.include?(MOBILE))
928
+ return false
929
+ end
930
+
931
+ =begin
932
+ *
933
+ * Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.
934
+ * @return detection of a Maemo OS tablet
935
+
936
+ =end
937
+ def detect_maemo_tablet()
938
+ if (user_agent.include?(MAEMO))
939
+ return true
940
+ elsif (user_agent.include?(LINUX) && user_agent.include?(DEVICE_TABLET) && !detect_web_o_s_tablet() && !detect_android())
875
941
  return true
876
942
  end
943
+ return false
944
+ end
877
945
 
946
+ =begin
947
+ *
948
+ * Detects if the current device is an Archos media player/Internet tablet.
949
+ * @return detection of an Archos media player
878
950
 
879
- if (detect_kindle() || detect_amazon_silk())
951
+ =end
952
+ def detect_archos()
953
+ if (user_agent.include?(DEVICE_ARCHOS))
880
954
  return true
881
955
  end
956
+ return false
957
+ end
958
+
959
+ =begin
960
+ *
961
+ * Detects if the current device is an Internet-capable game console.
962
+ * Includes many handheld consoles.
963
+ * @return detection of any Game Console
882
964
 
965
+ =end
966
+ def detect_game_console()
967
+ if (detect_sony_playstation() || detect_nintendo() || detect_xbox())
968
+ return true
969
+ end
883
970
  return false
884
971
  end
885
972
 
886
973
  =begin
887
- *
974
+ *
888
975
  * Detects if the current device is a Sony Playstation.
889
976
  * @return detection of Sony Playstation
890
977
 
@@ -897,7 +984,22 @@ module MobileESPConverted
897
984
  end
898
985
 
899
986
  =begin
900
- *
987
+ *
988
+ * Detects if the current device is a handheld gaming device with
989
+ * a touchscreen and modern iPhone-class browser. Includes the Playstation Vita.
990
+ * @return detection of a handheld gaming device
991
+
992
+ =end
993
+ def detect_gaming_handheld()
994
+ if ((user_agent.include?(DEVICE_PLAYSTATION)) &&
995
+ (user_agent.include?(DEVICE_PLAYSTATION_VITA)))
996
+ return true
997
+ end
998
+ return false
999
+ end
1000
+
1001
+ =begin
1002
+ *
901
1003
  * Detects if the current device is a Nintendo game device.
902
1004
  * @return detection of Nintendo
903
1005
 
@@ -910,7 +1012,7 @@ module MobileESPConverted
910
1012
  end
911
1013
 
912
1014
  =begin
913
- *
1015
+ *
914
1016
  * Detects if the current device is a Microsoft Xbox.
915
1017
  * @return detection of Xbox
916
1018
 
@@ -923,74 +1025,112 @@ module MobileESPConverted
923
1025
  end
924
1026
 
925
1027
  =begin
926
- *
927
- * Detects if the current device is an Internet-capable game console.
928
- * @return detection of any Game Console
1028
+ *
1029
+ * Detects whether the device is a Brew-powered device.
1030
+ * @return detection of a Brew device
929
1031
 
930
1032
  =end
931
- def detect_game_console()
932
- if (detect_sony_playstation() || detect_nintendo() || detect_xbox())
1033
+ def detect_brew_device()
1034
+ if (user_agent.include?(DEVICE_BREW))
933
1035
  return true
934
1036
  end
935
1037
  return false
936
1038
  end
937
1039
 
938
1040
  =begin
939
- *
940
- * Detects if the current device supports MIDP, a mobile Java technology.
941
- * @return detection of a MIDP mobile Java-capable device
1041
+ *
1042
+ * Detects whether the device supports WAP or WML.
1043
+ * @return detection of a WAP- or WML-capable device
942
1044
 
943
1045
  =end
944
- def detect_midp_capable()
945
- if (user_agent.include?(DEVICE_MIDP) || http_accept.include?(DEVICE_MIDP))
1046
+ def detect_wap_wml()
1047
+ if (http_accept.include?(VNDWAP) || http_accept.include?(WML))
946
1048
  return true
947
1049
  end
948
1050
  return false
949
1051
  end
950
1052
 
951
1053
  =begin
952
- *
953
- * Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.
954
- * @return detection of a Maemo OS tablet
1054
+ *
1055
+ * Detects if the current device supports MIDP, a mobile Java technology.
1056
+ * @return detection of a MIDP mobile Java-capable device
955
1057
 
956
1058
  =end
957
- def detect_maemo_tablet()
958
- if (user_agent.include?(MAEMO))
959
- return true
960
- elsif (user_agent.include?(LINUX) && user_agent.include?(DEVICE_TABLET) && !detect_web_o_s_tablet() && !detect_android())
1059
+ def detect_midp_capable()
1060
+ if (user_agent.include?(DEVICE_MIDP) || http_accept.include?(DEVICE_MIDP))
961
1061
  return true
962
1062
  end
963
1063
  return false
964
1064
  end
965
1065
 
1066
+
966
1067
  =begin
967
- *
968
- * Detects if the current device is an Archos media player/Internet tablet.
969
- * @return detection of an Archos media player
1068
+ *
1069
+ * Check to see whether the device is any device
1070
+ * in the 'smartphone' category.
1071
+ * @return detection of a general smartphone device
970
1072
 
971
1073
  =end
972
- def detect_archos()
973
- if (user_agent.include?(DEVICE_ARCHOS))
974
- return true
975
- end
976
- return false
1074
+ def detect_smartphone()
1075
+
1076
+ return (detect_tier_iphone() || detect_s60_oss_browser() || detect_symbian_o_s() || detect_windows_mobile() || detect_black_berry() || detect_palm_o_s())
977
1077
  end
978
1078
 
979
1079
  =begin
980
- *
981
- * Detects if the current browser is a Sony Mylo device.
982
- * @return detection of a Sony Mylo device
1080
+ *
1081
+ * Detects if the current device is a mobile device.
1082
+ * This method catches most of the popular modern devices.
1083
+ * Excludes Apple iPads and other modern tablets.
1084
+ * @return detection of any mobile device using the quicker method
983
1085
 
984
1086
  =end
985
- def detect_sony_mylo()
986
- if (user_agent.include?(MANU_SONY) && (user_agent.include?(QTEMBEDDED) || user_agent.include?(MYLOCOM2)))
1087
+ def detect_mobile_quick()
1088
+
1089
+ if (detect_tier_tablet())
1090
+ return false
1091
+ end
1092
+
1093
+ if ((init_completed == true) ||
1094
+ (is_mobile_phone == true))
1095
+ return is_mobile_phone
1096
+ end
1097
+
1098
+
1099
+ if (detect_smartphone())
987
1100
  return true
988
1101
  end
1102
+
1103
+ if (detect_wap_wml() || detect_brew_device() || detect_opera_mobile())
1104
+ return true
1105
+ end
1106
+
1107
+ if ((user_agent.include?(ENGINE_OBIGO)) || (user_agent.include?(ENGINE_NETFRONT)) || (user_agent.include?(ENGINE_UP_BROWSER)) || (user_agent.include?(ENGINE_OPEN_WEB)))
1108
+ return true
1109
+ end
1110
+
1111
+ if (detect_danger_hiptop() || detect_midp_capable() || detect_maemo_tablet() || detect_archos())
1112
+ return true
1113
+ end
1114
+
1115
+ if ((user_agent.include?(DEVICE_PDA)) &&
1116
+ (!user_agent.include?(DIS_UPDATE)))
1117
+ return true
1118
+ end
1119
+
1120
+ if (user_agent.include?(MOBILE))
1121
+ return true
1122
+ end
1123
+
1124
+
1125
+ if (detect_kindle() || detect_amazon_silk())
1126
+ return true
1127
+ end
1128
+
989
1129
  return false
990
1130
  end
991
1131
 
992
1132
  =begin
993
- *
1133
+ *
994
1134
  * The longer and more thorough way to detect for a mobile device.
995
1135
  * Will probably detect most feature phones,
996
1136
  * smartphone-class devices, Internet Tablets,
@@ -1033,11 +1173,8 @@ module MobileESPConverted
1033
1173
  end
1034
1174
 
1035
1175
 
1036
-
1037
-
1038
-
1039
1176
  =begin
1040
- *
1177
+ *
1041
1178
  * The quick way to detect for a tier of devices.
1042
1179
  * This method detects for the new generation of
1043
1180
  * HTML 5 capable, larger screen tablets.
@@ -1046,6 +1183,11 @@ module MobileESPConverted
1046
1183
 
1047
1184
  =end
1048
1185
  def detect_tier_tablet()
1186
+ if ((@init_completed == true) ||
1187
+ (@is_tier_tablet == true))
1188
+ return @is_tier_tablet
1189
+ end
1190
+
1049
1191
  if (detect_ipad() || detect_android_tablet() || detect_black_berry_tablet() || detect_web_o_s_tablet())
1050
1192
  return true
1051
1193
  end
@@ -1053,23 +1195,28 @@ module MobileESPConverted
1053
1195
  end
1054
1196
 
1055
1197
  =begin
1056
- *
1198
+ *
1057
1199
  * The quick way to detect for a tier of devices.
1058
1200
  * This method detects for devices which can
1059
1201
  * display iPhone-optimized web content.
1060
- * Includes iPhone, iPod Touch, Android, Windows Phone 7, Palm WebOS, etc.
1061
- * @return detection of any device in the iPhone/Android/WP7/WebOS Tier
1202
+ * Includes iPhone, iPod Touch, Android, Windows Phone 7 and 8, BB10, WebOS, Playstation Vita, etc.
1203
+ * @return detection of any device in the iPhone/Android/Windows Phone/BlackBerry/WebOS Tier
1062
1204
 
1063
1205
  =end
1064
1206
  def detect_tier_iphone()
1065
- if (is_iphone || is_android_phone || (detect_black_berry_web_kit() && detect_black_berry_touch()) || detect_windows_phone7() || detect_palm_web_o_s() || detect_garmin_nuvifone())
1207
+ if ((@init_completed == true) ||
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())
1066
1213
  return true
1067
1214
  end
1068
1215
  return false
1069
1216
  end
1070
1217
 
1071
1218
  =begin
1072
- *
1219
+ *
1073
1220
  * The quick way to detect for a tier of devices.
1074
1221
  * This method detects for devices which are likely to be capable
1075
1222
  * of viewing CSS content optimized for the iPhone,
@@ -1079,6 +1226,11 @@ module MobileESPConverted
1079
1226
 
1080
1227
  =end
1081
1228
  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
+
1082
1234
  result = false
1083
1235
 
1084
1236
 
@@ -1088,8 +1240,6 @@ module MobileESPConverted
1088
1240
  if (!detect_tier_iphone() && !detect_kindle())
1089
1241
 
1090
1242
 
1091
-
1092
-
1093
1243
  if (detect_webkit() || detect_s60_oss_browser() || detect_black_berry_high() || detect_windows_mobile() || user_agent.include?(ENGINE_TELECA_Q))
1094
1244
  result= true
1095
1245
  end
@@ -1099,7 +1249,7 @@ module MobileESPConverted
1099
1249
  end
1100
1250
 
1101
1251
  =begin
1102
- *
1252
+ *
1103
1253
  * The quick way to detect for a tier of devices.
1104
1254
  * This method detects for all other types of phones,
1105
1255
  * but excludes the iPhone and RichCSS Tier devices.
@@ -1107,10 +1257,16 @@ module MobileESPConverted
1107
1257
 
1108
1258
  =end
1109
1259
  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
+
1110
1265
 
1111
1266
  if (detect_mobile_long() && !detect_tier_iphone() && !detect_tier_rich_css())
1112
1267
  return true
1113
1268
  end
1269
+
1114
1270
  return false
1115
1271
  end
1116
1272
  end