MOBILE constant

This commit is contained in:
斟酌 鵬兄 2016-10-26 18:05:12 +08:00
parent 8e27ee8533
commit 03574cf6d0
2 changed files with 15 additions and 0 deletions

View File

@ -12,8 +12,20 @@
var SECURE_HTTP = window.location.href.match( /^https:\/\// ); var SECURE_HTTP = window.location.href.match( /^https:\/\// );
var ua = navigator.userAgent;
var MOBILE = Boolean(
~ua.indexOf( "Android" )
|| ~ua.indexOf( "webOS" )
|| ~ua.indexOf( "iPhone" )
|| ~ua.indexOf( "iPad" )
|| ~ua.indexOf( "iPod" )
|| ~ua.indexOf( "BlackBerry" )
|| ~ua.indexOf( "Windows Phone" )
);
ns[ NS_EXPORT ]( EX_READONLY_GETTER, "debug", debug ); ns[ NS_EXPORT ]( EX_READONLY_GETTER, "debug", debug );
ns[ NS_EXPORT ]( EX_CONST, "IE", IE ); ns[ NS_EXPORT ]( EX_CONST, "IE", IE );
ns[ NS_EXPORT ]( EX_CONST, "ALLOWED_ORIGINS", ALLOWED_ORIGINS ); ns[ NS_EXPORT ]( EX_CONST, "ALLOWED_ORIGINS", ALLOWED_ORIGINS );
ns[ NS_EXPORT ]( EX_CONST, "SECURE_HTTP", SECURE_HTTP ); ns[ NS_EXPORT ]( EX_CONST, "SECURE_HTTP", SECURE_HTTP );
ns[ NS_EXPORT ]( EX_CONST, "MOBILE", MOBILE );
})(); })();

View File

@ -9,3 +9,6 @@ System.Global.IE;
/** @type {Boolean} */ /** @type {Boolean} */
System.Global.SECURE_HTTP; System.Global.SECURE_HTTP;
/** @type {Boolean} */
System.Global.MOBILE;