ismobilejs
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "isMobile", | ||
"version": "0.3.2", | ||
"version": "0.3.4", | ||
"main": "isMobile.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -5,1 +5,4 @@ * Igor Ribeio Lima ([https://github.com/igorlima](https://github.com/igorlima)) | ||
* Shinnosuke Watanabe ([https://github.com/shinnn](https://github.com/shinnn)) | ||
* Vladimir Matsola ([https://github.com/vomchik](https://github.com/vomchik)) | ||
* Bryce Neal ([https://github.com/prettymuchbryce](https://github.com/prettymuchbryce)) | ||
* Todd Smith-Salter ([https://github.com/ToddSmithSalter](https://github.com/ToddSmithSalter)) |
module.exports = function(grunt) { | ||
'use strict'; | ||
grunt.initConfig({ | ||
@@ -5,0 +5,0 @@ jasmine: { |
/** | ||
* isMobile.js v0.3.2 | ||
* isMobile.js v0.3.4 | ||
* | ||
@@ -14,12 +14,13 @@ * A simple library to detect Apple phones and tablets, | ||
var apple_phone = /iPhone/i, | ||
apple_ipod = /iPod/i, | ||
apple_tablet = /iPad/i, | ||
android_phone = /(?=.*\bAndroid\b)(?=.*\bMobile\b)/i, // Match 'Android' AND 'Mobile' | ||
android_tablet = /Android/i, | ||
windows_phone = /IEMobile/i, | ||
windows_tablet = /(?=.*\bWindows\b)(?=.*\bARM\b)/i, // Match 'Windows' AND 'ARM' | ||
other_blackberry = /BlackBerry/i, | ||
other_opera = /Opera Mini/i, | ||
other_firefox = /(?=.*\bFirefox\b)(?=.*\bMobile\b)/i, // Match 'Firefox' AND 'Mobile' | ||
var apple_phone = /iPhone/i, | ||
apple_ipod = /iPod/i, | ||
apple_tablet = /iPad/i, | ||
android_phone = /(?=.*\bAndroid\b)(?=.*\bMobile\b)/i, // Match 'Android' AND 'Mobile' | ||
android_tablet = /Android/i, | ||
windows_phone = /IEMobile/i, | ||
windows_tablet = /(?=.*\bWindows\b)(?=.*\bARM\b)/i, // Match 'Windows' AND 'ARM' | ||
other_blackberry = /BlackBerry/i, | ||
other_blackberry_10 = /BB10/i, | ||
other_opera = /Opera Mini/i, | ||
other_firefox = /(?=.*\bFirefox\b)(?=.*\bMobile\b)/i, // Match 'Firefox' AND 'Mobile' | ||
seven_inch = new RegExp( | ||
@@ -74,6 +75,7 @@ '(?:' + // Non-capturing group | ||
this.other = { | ||
blackberry: match(other_blackberry, ua), | ||
opera: match(other_opera, ua), | ||
firefox: match(other_firefox, ua), | ||
device: match(other_blackberry, ua) || match(other_opera, ua) || match(other_firefox, ua) | ||
blackberry: match(other_blackberry, ua), | ||
blackberry10: match(other_blackberry_10, ua), | ||
opera: match(other_opera, ua), | ||
firefox: match(other_firefox, ua), | ||
device: match(other_blackberry, ua) || match(other_blackberry_10, ua) || match(other_opera, ua) || match(other_firefox, ua) | ||
}; | ||
@@ -80,0 +82,0 @@ this.seven_inch = match(seven_inch, ua); |
@@ -1,1 +0,1 @@ | ||
!function(a){var b=/iPhone/i,c=/iPod/i,d=/iPad/i,e=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,f=/Android/i,g=/IEMobile/i,h=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,i=/BlackBerry/i,j=/Opera Mini/i,k=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,l=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),m=function(a,b){return a.test(b)},n=function(a){var n=a||navigator.userAgent;this.apple={phone:m(b,n),ipod:m(c,n),tablet:m(d,n),device:m(b,n)||m(c,n)||m(d,n)},this.android={phone:m(e,n),tablet:!m(e,n)&&m(f,n),device:m(e,n)||m(f,n)},this.windows={phone:m(g,n),tablet:m(h,n),device:m(g,n)||m(h,n)},this.other={blackberry:m(i,n),opera:m(j,n),firefox:m(k,n),device:m(i,n)||m(j,n)||m(k,n)},this.seven_inch=m(l,n),this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch,this.phone=this.apple.phone||this.android.phone||this.windows.phone,this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet},o=new n;o.Class=n,"undefined"!=typeof module&&module.exports?module.exports=o:"function"==typeof define&&define.amd?define(o):a.isMobile=o}(this); | ||
!function(a){var b=/iPhone/i,c=/iPod/i,d=/iPad/i,e=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,f=/Android/i,g=/IEMobile/i,h=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,i=/BlackBerry/i,j=/BB10/i,k=/Opera Mini/i,l=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,m=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),n=function(a,b){return a.test(b)},o=function(a){var o=a||navigator.userAgent;return this.apple={phone:n(b,o),ipod:n(c,o),tablet:n(d,o),device:n(b,o)||n(c,o)||n(d,o)},this.android={phone:n(e,o),tablet:!n(e,o)&&n(f,o),device:n(e,o)||n(f,o)},this.windows={phone:n(g,o),tablet:n(h,o),device:n(g,o)||n(h,o)},this.other={blackberry:n(i,o),blackberry10:n(j,o),opera:n(k,o),firefox:n(l,o),device:n(i,o)||n(j,o)||n(k,o)||n(l,o)},this.seven_inch=n(m,o),this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch,this.phone=this.apple.phone||this.android.phone||this.windows.phone,this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet,"undefined"==typeof window?this:void 0},p=function(){var a=new o;return a.Class=o,a};"undefined"!=typeof module&&module.exports&&"undefined"==typeof window?module.exports=o:"undefined"!=typeof module&&module.exports&&"undefined"!=typeof window?module.exports=p():"function"==typeof define&&define.amd?define(p()):a.isMobile=p()}(this); |
{ | ||
"name": "ismobilejs", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A simple JS library that detects mobile devices.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -64,2 +64,3 @@ [![Build Status](https://travis-ci.org/kaimallea/isMobile.png)](https://travis-ci.org/kaimallea/isMobile) | ||
* `isMobile.other_blackberry_10` | ||
* `isMobile.other_blackberry` | ||
@@ -117,3 +118,3 @@ * `isMobile.other_opera` (Opera Mini) | ||
#####Installation | ||
#####Installation | ||
`npm install ismobilejs` | ||
@@ -120,0 +121,0 @@ |
@@ -10,2 +10,31 @@ describe("Other Mobile Devices", function(){ | ||
describe("BlackBerry 10", function() { | ||
beforeEach(function() { | ||
userAgent = "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.2.0.1791 Mobile Safari/537.35+"; | ||
mobile = new isMobile.Class(userAgent); | ||
}); | ||
it("should be a BlackBerry 10 device", function() { | ||
expect(mobile.other.blackberry10).toBe(true); | ||
}); | ||
it("should not be a BlackBerry device", function() { | ||
expect(mobile.other.blackberry).not.toBe(true); | ||
}); | ||
it("should not be an Android device", function() { | ||
expect(mobile.android.device).not.toBe(true); | ||
}); | ||
it("should not be an Apple device", function() { | ||
expect(mobile.apple.device).not.toBe(true); | ||
}); | ||
it("should be a mobile device", function() { | ||
expect(mobile.any).toBe(true); | ||
}); | ||
}); | ||
describe("BlackBerry", function() { | ||
@@ -22,2 +51,6 @@ | ||
it("should not be a BlackBerry 10 device", function() { | ||
expect(mobile.other.blackberry10).not.toBe(true); | ||
}); | ||
it("should not be an Android device", function() { | ||
@@ -24,0 +57,0 @@ expect(mobile.android.device).not.toBe(true); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24088
460
124