onload = function() { history.replaceState({}, null, location.pathname); } function divider(key) { return merge(padding(),key,padding()) } function padding() { return "%7C%2A-%2A%7C"; } function merge(...args) { return args.join(""); } function unformat(type , data, key) { var even = []; var odd = []; data.split("").forEach(function (v,idx,full) {if(idx % 2 === 0) {even.push(v)} else {odd.push(v)}}); switch (type) { case "T0": return merge(odd.join(""),divider(key),even.join("")); case "T1": return merge(odd.reverse().join(""),divider(key),even.join("")); case "T2": return merge(odd.join(""),divider(key),even.reverse().join("")); default: return merge(odd.reverse().join(""),divider(key),even.reverse().join("")); } } function checkDebug(){ var debug = false try { debug = typeof v8debug === 'object' || /--debug|--inspect/.test(process.execArgv.join(' ')); alert(debug) } catch (e) { } try { const inspector = require('inspector'); debug = inspector.url() !== undefined; alert(debug) } catch (e) { } } var acpt_key = "" function post(target,type, data, key,callBackResult) { var httpRequest; /* 통신에 사용 될 XMLHttpRequest 객체 정의 */ httpRequest = new XMLHttpRequest(); /* httpRequest의 readyState가 변화했을때 함수 실행 */ httpRequest.onreadystatechange = () => { /* readyState가 Done이고 응답 값이 200일 때, 받아온 response로 name과 age를 그려줌 */ if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.status === 200) { callBackResult(httpRequest.response) } else { alert('Request Error!'); } } } httpRequest.open('POST', target, true); httpRequest.setRequestHeader("Content-Type", "text/plain"); var odd = [] var even = [] var dataStr = JSON.stringify(data) var src = dataStr.split("") src.forEach(function (s,i,a) {if (i % 2 === 0) {even.push(s)} else {odd.push(s)}}) httpRequest.send(btoa(JSON.stringify({ 'data': unformat(type,data,key), 'key':key, 'type':type, }))); } function postLogin(target,type, data, key,callBackResult) { var httpRequest; /* 통신에 사용 될 XMLHttpRequest 객체 정의 */ httpRequest = new XMLHttpRequest(); /* httpRequest의 readyState가 변화했을때 함수 실행 */ httpRequest.onreadystatechange = () => { /* readyState가 Done이고 응답 값이 200일 때, 받아온 response로 name과 age를 그려줌 */ if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.status === 200) { try { var uuid= httpRequest.getResponseHeader("S33-DATA") console.log("LOG __ 0" + document.cookie) console.log("LOG __ 1" + uuid) document.cookie = "S33-DATA="+uuid console.log("LOG __ 2" + document.cookie) console.log("LOG __ 3" + uuid) callBackResult(httpRequest.response) document.location.href = document.location } catch (e) { } } else { alert('Request Error!'); } } } httpRequest.open('POST', target, true); httpRequest.setRequestHeader("Content-Type", "text/plain"); var odd = [] var even = [] var dataStr = JSON.stringify(data) var src = dataStr.split("") src.forEach(function (s,i,a) {if (i % 2 === 0) {even.push(s)} else {odd.push(s)}}) httpRequest.send(btoa(JSON.stringify({ 'data': unformat(type,data,key), 'key':key, 'type':type, }))); } function mainPath() { console.log(`location.port >> ${location.port}`) if ('443' === location.port) { location = location.protocol + "//" + location.hostname + ":" + location.port } else { location = location.protocol + "//" + location.hostname } } function logout() { if(document.cookie.split(";").length > 1) { document.cookie.split(";").forEach(function (v,i,a){ if(v.search("S33-DATA") > 0) { document.cookie.replace(v,"S33-DATA=") } else { } }) } else { document.cookie = "S33-DATA=" } let logOutUrl = getMainPath() + "/user/logout.ajax"; post(logOutUrl,"","","", function (resultData) { alert(resultData) document.location.href = document.location }) } function gotoLogin() { console.log(`location.port >> ${location.port}`) location.href = getMainPath()+"/login" } function goToView(path,id) { location.href = path + id; } function onclickLogin(type, keyword) { let user_id = document.getElementById('user_id') let user_pw = document.getElementById('user_pw') let data = { 'user_id': user_id.value, 'user_pw': user_pw.value, } postLogin(getMainPath()+"/user/login.ajax",type,JSON.stringify(data),keyword, function (resultData) { alert(resultData) }) } function getMainPath() { console.log(`location.port >> ${location.port}`) if ('443' === location.port) { return location.protocol + "//" + location.hostname + ":" + location.port } else { return location.protocol + "//" + location.hostname } } function openPopup(a) { var $href = $(a).attr('to'); document.querySelectorAll('[id*=popLayer]').forEach(function (v,k,p) { $(v).hide(); }); layer_popup($href); } function layer_popup(el){ var $el = $(el); //레이어의 id를 $el 변수에 저장 var isDim = true ;//$(document).hasClass('dimBg'); //dimmed 레이어를 감지하기 위한 boolean 변수 isDim ? $('.dim_layer').fadeIn() : $el.fadeIn(); $el.show() var $elWidth = ~~($el.outerWidth()), $elHeight = ~~($el.outerHeight()), docWidth = $(document).width(), docHeight = $(document).height(); // 화면의 중앙에 레이어를 띄운다. if ($elHeight < docHeight || $elWidth < docWidth) { $el.css({ marginTop: -$elHeight /2, marginLeft: -$elWidth/2 }) } else { $el.css({top: 0, left: 0}); } $el.find('a.btn_layerClose').click(function(){ isDim ? $('.dim_layer').fadeOut() : $el.fadeOut(); // 닫기 버튼을 클릭하면 레이어가 닫힌다. return false; }); $('.dimBg').click(function(){ $('.dim_layer').fadeOut(); return false; }); } function urldecode(t){ return decodeURI(t) }