mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-13 16:08:41 +00:00
Implementing browser and os support
This commit is contained in:
parent
4ca251dd9b
commit
0826ffdbaa
21
Message/Request/BrowserType.enum.js
Normal file
21
Message/Request/BrowserType.enum.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
* Request data enum.
|
||||||
|
*
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright 2013 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0 * @since 1.0.0
|
||||||
|
*/
|
||||||
|
(function (jsOMS, undefined)
|
||||||
|
{
|
||||||
|
jsOMS.EnumBrowserType = Object.freeze({
|
||||||
|
OPERA: 'opera',
|
||||||
|
FIREFOX: 'firefox',
|
||||||
|
SAFARI: 'safari',
|
||||||
|
IE: 'msie',
|
||||||
|
EDGE: 'edge',
|
||||||
|
CHROME: 'chrome',
|
||||||
|
BLINK: 'blink',
|
||||||
|
});
|
||||||
|
}(window.jsOMS = window.jsOMS || {}));
|
||||||
37
Message/Request/OSType.enum.js
Normal file
37
Message/Request/OSType.enum.js
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* Request data enum.
|
||||||
|
*
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright 2013 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0 * @since 1.0.0
|
||||||
|
*/
|
||||||
|
(function (jsOMS, undefined)
|
||||||
|
{
|
||||||
|
jsOMS.EnumOSType = Object.freeze({
|
||||||
|
WINDOWS_81: 'windows nt 6.3'; /* Windows 8.1 */
|
||||||
|
WINDOWS_8: 'windows nt 6.2'; /* Windows 8 */
|
||||||
|
WINDOWS_7: 'windows nt 6.1'; /* Windows 7 */
|
||||||
|
WINDOWS_VISTA: 'windows nt 6.0'; /* Windows Vista */
|
||||||
|
WINDOWS_SERVER: 'windows nt 5.2'; /* Windows Server 2003/XP x64 */
|
||||||
|
WINDOWS_XP: 'windows nt 5.1'; /* Windows XP */
|
||||||
|
WINDOWS_XP_2: 'windows xp'; /* Windows XP */
|
||||||
|
WINDOWS_2000: 'windows nt 5.0'; /* Windows 2000 */
|
||||||
|
WINDOWS_ME: 'windows me'; /* Windows ME */
|
||||||
|
WINDOWS_98: 'win98'; /* Windows 98 */
|
||||||
|
WINDOWS_95: 'win95'; /* Windows 95 */
|
||||||
|
WINDOWS_311: 'win16'; /* Windows 3.11 */
|
||||||
|
MAC_OS_X: 'macintosh'; /* Mac OS X */
|
||||||
|
MAC_OS_X_2: 'mac os x'; /* Mac OS X */
|
||||||
|
MAC_OS_9: 'mac_powerpc'; /* Mac OS 9 */
|
||||||
|
LINUX : 'linux'; /* Linux */
|
||||||
|
UBUNTU: 'ubuntu'; /* Ubuntu */
|
||||||
|
IPHONE: 'iphone'; /* IPhone */
|
||||||
|
IPOD: 'ipod'; /* IPod */
|
||||||
|
IPAD: 'ipad'; /* IPad */
|
||||||
|
ANDROID: 'android'; /* Android */
|
||||||
|
BLACKBERRY: 'blackberry'; /* Blackberry */
|
||||||
|
MOBILE: 'webos'; /* Mobile */
|
||||||
|
});
|
||||||
|
}(window.jsOMS = window.jsOMS || {}));
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
this.method = typeof method !== 'undefined' ? method : jsOMS.EnumRequestMethod.GET;
|
this.method = typeof method !== 'undefined' ? method : jsOMS.EnumRequestMethod.GET;
|
||||||
this.requestHeader = [];
|
this.requestHeader = [];
|
||||||
this.success = null;
|
this.success = null;
|
||||||
this.type = typeof type !== 'undefined' ? type : 'json';
|
this.type = typeof type !== 'undefined' ? type : jsOMS.EnumResponseType.JSON;
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -30,6 +30,34 @@
|
||||||
this.xhr = new XMLHttpRequest();
|
this.xhr = new XMLHttpRequest();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jsOMS.Request.getBrowser = function()
|
||||||
|
{
|
||||||
|
if((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
|
||||||
|
return jsOMS.EnumBrowser.OPERA;
|
||||||
|
} else if(typeof InstallTrigger !== 'undefined') {
|
||||||
|
return jsOMS.EnumBrowser.FIREFOX;
|
||||||
|
} else if(Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
|
||||||
|
return return jsOMS.EnumBrowser.SAFARI;
|
||||||
|
} else if(/*@cc_on!@*/false || !!document.documentMode) {
|
||||||
|
return jsOMS.EnumBrowser.IE;
|
||||||
|
} else if(!isIE && !!window.StyleMedia) {
|
||||||
|
return jsOMS.EnumBrowser.EDGE;
|
||||||
|
} else if(!!window.chrome && !!window.chrome.webstore) {
|
||||||
|
return jsOMS.EnumBrowser.CHROME;
|
||||||
|
} else if((isChrome || isOpera) && !!window.CSS) {
|
||||||
|
return jsOMS.EnumBrowser.BLINK;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jsOMS.Request.getOS = function()
|
||||||
|
{
|
||||||
|
for(let os in jsOMS.EnumOSType) {
|
||||||
|
if(navigator.appversion.indexOf(jsOMS.EnumOSType[os]) !== -1) {
|
||||||
|
return jsOMS.EnumOSType[os];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set request method.
|
* Set request method.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user