2014-02-08 00:41:03 +00:00
|
|
|
//
|
|
|
|
// util.js
|
|
|
|
//
|
2014-04-05 09:03:01 +00:00
|
|
|
var APP = APP || {};
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-04-05 09:03:01 +00:00
|
|
|
APP.Utils = (function () {
|
2015-11-09 21:48:29 +00:00
|
|
|
return {
|
|
|
|
//check for mobile user agents
|
|
|
|
isMobile : (function(){
|
|
|
|
if( navigator.userAgent.match(/Android/i)
|
|
|
|
|| navigator.userAgent.match(/webOS/i)
|
|
|
|
|| navigator.userAgent.match(/iPhone/i)
|
|
|
|
//|| navigator.userAgent.match(/iPad/i)
|
|
|
|
|| navigator.userAgent.match(/iPod/i)
|
|
|
|
|| navigator.userAgent.match(/BlackBerry/i)
|
|
|
|
|| navigator.userAgent.match(/Windows Phone/i)
|
|
|
|
){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
})(),
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
runIfClassNamePresent: function(selector, initFunction) {
|
|
|
|
var elms = document.getElementsByClassName(selector);
|
|
|
|
if (elms.length > 0) {
|
|
|
|
initFunction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
}());
|