From 1cac554fe5e2f774c205393a9656ee228822b4be Mon Sep 17 00:00:00 2001
From: Gergely Tamas Kurucz <temaruk@gmail.com>
Date: Thu, 19 Sep 2013 00:12:03 +0200
Subject: [PATCH] Issue #2092545 by temaruk: Fixed isMobile() javascript
 function.

---
 browserclass.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/browserclass.js b/browserclass.js
index 2a8a2b8..95ce7a8 100644
--- a/browserclass.js
+++ b/browserclass.js
@@ -186,14 +186,18 @@
 
     isMobile: function(classes) {
       var mobile_devices = ['ipad', 'ipod', 'iphone', 'android', 'blackberry', 'operamini'];
+      var mobile_devices_test = false;
 
       $.each(mobile_devices, function(index, value) {
         if ($.inArray(value, classes) != -1) {
-          return true;
+          mobile_devices_test = true;
+
+          // Terminate the $.each() loop, since a match has been found.
+          return false;
         }
       });
 
-      if (this.agent.match(/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|pda|psp|treo)/)) {
+      if (mobile_devices_test || this.agent.match(/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|pda|psp|treo)/)) {
         return true;
       }
     },
-- 
1.8.4

