188 lines
5.6 KiB
Plaintext
188 lines
5.6 KiB
Plaintext
<script type="text/javascript">
|
|
'use strict';
|
|
|
|
var pageLoadingInfo = {
|
|
url: window.location.href
|
|
}
|
|
|
|
pageLoadingInfo.timerInitAt = Date.now();
|
|
|
|
if (!String.prototype.includes) {
|
|
String.prototype.includes = function(search, start) {
|
|
'use strict';
|
|
if (typeof start !== 'number') {
|
|
start = 0;
|
|
}
|
|
|
|
if (start + search.length > this.length) {
|
|
return false;
|
|
} else {
|
|
return this.indexOf(search, start) !== -1;
|
|
}
|
|
};
|
|
}
|
|
|
|
if (!String.prototype.trim) {
|
|
String.prototype.trim = function () {
|
|
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
};
|
|
}
|
|
if (typeof Object.assign != 'function') {
|
|
// Must be writable: true, enumerable: false, configurable: true
|
|
Object.defineProperty(Object, "assign", {
|
|
value: function assign(target, varArgs) { // .length of function is 2
|
|
'use strict';
|
|
if (target == null) { // TypeError if undefined or null
|
|
throw new TypeError('Cannot convert undefined or null to object');
|
|
}
|
|
|
|
var to = Object(target);
|
|
|
|
for (var index = 1; index < arguments.length; index++) {
|
|
var nextSource = arguments[index];
|
|
|
|
if (nextSource != null) { // Skip over if undefined or null
|
|
for (var nextKey in nextSource) {
|
|
// Avoid bugs when hasOwnProperty is shadowed
|
|
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
to[nextKey] = nextSource[nextKey];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return to;
|
|
},
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
|
|
Array.prototype.remove = Array.prototype.remove || function(val){
|
|
var i = this.length;
|
|
while(i--){
|
|
if (this[i] === val){
|
|
this.splice(i,1);
|
|
}
|
|
}
|
|
};
|
|
|
|
if (!String.prototype.startsWith) {
|
|
String.prototype.startsWith = function(searchString, position) {
|
|
position = position || 0;
|
|
return this.indexOf(searchString, position) === position;
|
|
};
|
|
}
|
|
|
|
function doAllThingsInSafe(opType, param) {
|
|
// console.log('typeof _doAllThingsInSafe = ', typeof _doAllThingsInSafe)
|
|
if (typeof _doAllThingsInSafe === 'function') {
|
|
_doAllThingsInSafe(opType, param)
|
|
} else {
|
|
alert('page not loaded yet. try again after few seconds...')
|
|
}
|
|
}
|
|
|
|
function getDomain (url) {
|
|
url = url.replace(/(https?:\/\/)?(www.)?/i, '')
|
|
if (url.indexOf('/') !== -1) {
|
|
return url.split('/')[0].toLowerCase()
|
|
}
|
|
return url
|
|
}
|
|
|
|
var currentHost = window.location.host.toLowerCase()
|
|
|
|
var domainKey = null
|
|
|
|
var currentDomain = getDomain(window.location.href)
|
|
|
|
if (currentDomain.indexOf(':') != -1) {
|
|
var tmpAry = currentDomain.split(':')
|
|
currentDomain = tmpAry[0]
|
|
}
|
|
var apiUrl = '/api'
|
|
// console.log('currentHost = ' + currentHost)
|
|
// console.log('currentDomain = ' + currentDomain)
|
|
|
|
// console.log('apiUrl = ' + apiUrl)
|
|
// console.log('domainKey = ' + domainKey)
|
|
|
|
var eventAryPool = {}
|
|
|
|
function pushDataToLayer(data) {
|
|
window.dataLayer = window.dataLayer || [];
|
|
window.dataLayer.push(data);
|
|
// console.log('window.dataLayer=', window.dataLayer)
|
|
}
|
|
|
|
function numberWithCommas(x) {
|
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* detect IE
|
|
* returns version of IE or false, if browser is not Internet Explorer
|
|
*/
|
|
function detectIE() {
|
|
var ua = window.navigator.userAgent;
|
|
|
|
// Test values; Uncomment to check result …
|
|
|
|
// IE 10
|
|
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
|
|
|
|
// IE 11
|
|
// ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';
|
|
|
|
// Edge 12 (Spartan)
|
|
// ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';
|
|
|
|
// Edge 13
|
|
// ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586';
|
|
|
|
var msie = ua.indexOf('MSIE ');
|
|
if (msie > 0) {
|
|
// IE 10 or older => return version number
|
|
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
|
|
}
|
|
|
|
var trident = ua.indexOf('Trident/');
|
|
if (trident > 0) {
|
|
// IE 11 => return version number
|
|
var rv = ua.indexOf('rv:');
|
|
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
|
|
}
|
|
|
|
var edge = ua.indexOf('Edge/');
|
|
if (edge > 0) {
|
|
// Edge (IE 12+) => return version number
|
|
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
|
|
}
|
|
|
|
// other browser
|
|
return false;
|
|
}
|
|
|
|
|
|
// Get IE or Edge browser version
|
|
var version = detectIE();
|
|
|
|
if (version === false) {
|
|
// console.log('detectIE=IE/Edge')
|
|
|
|
} else if (version >= 12) {
|
|
// console.log('detectIE=Edge ' + version)
|
|
|
|
} else {
|
|
// console.log('detectIE=Ie ' + version)
|
|
alert('본 사이트는 이 브라우저에서 사용하실 수 없습니다. 개발자에게 문의해 주세요.')
|
|
}
|
|
|
|
// console.log('userAgent=', window.navigator.userAgent)
|
|
|
|
|
|
|
|
</script>
|