bootpay-js
Version:
Bootpay Javasrcipt Library
65 lines (64 loc) • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
// Generated by CoffeeScript 2.5.1
exports.default = {
// 모바일인지 구분
isMobile: function isMobile() {
var a;
a = navigator.userAgent || navigator.vendor || window.opera;
return (/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/.test(a)
);
},
isSafari: function isSafari() {
var agent;
agent = window.navigator.userAgent.toLowerCase();
return agent.indexOf('safari') > -1 && agent.indexOf('chrome') === -1;
},
// 모바일 사파리인지 구분
isMobileSafari: function isMobileSafari() {
var agent;
agent = window.navigator.userAgent;
return (agent.match(/iPad/i) || agent.match(/iPhone/i)) && agent.match(/CriOS/i) == null;
},
getiOSVersion: function getiOSVersion() {
try {
return (/CPU.*OS ([0-9_]{1,6})|(CPU like).*AppleWebKit.*Mobile/i.exec(window.navigator.userAgent)[1].replace(/_/g, '.') || -1
);
} catch (error) {
return -1;
}
},
// IE인지 검사한다
isIE: function isIE() {
var ref;
return window.navigator.userAgent.indexOf('MSIE') > 0 || ((ref = window.navigator.userAgent.match(/Trident.*rv\:11\./)) != null ? ref.length : void 0);
},
// IE 버전 이하인지 검사한다
isLtBrowserVersion: function isLtBrowserVersion(version) {
var idx, sAgent;
sAgent = window.navigator.userAgent;
idx = sAgent.indexOf("MSIE");
if (!(idx > 0)) {
return false;
}
return version > parseInt(sAgent.substring(idx + 5, sAgent.indexOf(".", idx)));
},
// IE 버전 blocking
blockIEVersion: function blockIEVersion() {
return this.isLtBrowserVersion(this.ieMinVersion);
},
// Platform String Return
platformSymbol: function platformSymbol() {
if (this.isMobile()) {
if (this.isMobileSafari()) {
return 'ios';
} else {
return 'android';
}
} else {
return 'pc';
}
}
};