// ------------------------------------20170828 추가------------------------------------
var uanaVigatorOs = navigator.userAgent;
var AgentUserOs= uanaVigatorOs.replace(/ /g,'');
var Ostxt="";
var OSName="";
var OsVers="";
new function() {
var OsNo = navigator.userAgent.toLowerCase();
jQuery.os = {
Linux: /linux/.test(OsNo),
Unix: /x11/.test(OsNo),
Mac: /mac/.test(OsNo),
Windows: /win/.test(OsNo)
}
}
function getAndroidDevName() {
var ua = navigator.userAgent;
var regex = /Android (.*);.*;\s*(.*)\sBuild/;
var match = regex.exec(ua);
if(match) {
var ver = match[1];
var dev_name = match[2];
return "Android " + dev_name + "||" + ver;
}
return "Android||";
}
function OSInfoDev(){
if($.os.Windows) {
if(AgentUserOs.indexOf("WindowsCE") != -1) OSName="Windows||CE";
else if(AgentUserOs.indexOf("Windows95") != -1) OSName="Windows||95";
else if(AgentUserOs.indexOf("Windows98") != -1) {
if (AgentUserOs.indexOf("Win9x4.90") != -1){
OSName="Windows||ME"
}else{
OSName="Windows||98";
}
}else if(AgentUserOs.indexOf("WindowsNT4.0") != -1) OSName="Windows||NT 4.0";
else if(AgentUserOs.indexOf("WindowsNT5.0") != -1) OSName="Windows||2000";
else if(AgentUserOs.indexOf("WindowsNT5.01") != -1) OSName="Windows||2000, Service Pack 1 (SP1)";
else if(AgentUserOs.indexOf("WindowsNT5.1") != -1) OSName="Windows||XP";
else if(AgentUserOs.indexOf("WindowsNT5.2") != -1) OSName="Windows||2003";
else if(AgentUserOs.indexOf("WindowsNT6.0") != -1) OSName="Windows||Vista/Server 2008";
else if(AgentUserOs.indexOf("WindowsNT6.1") != -1) OSName="Windows||7";
else if(AgentUserOs.indexOf("WindowsNT6.2") != -1) OSName="Windows||8";
else if(AgentUserOs.indexOf("WindowsNT6.3") != -1) OSName="Windows||8.1";
else if(AgentUserOs.indexOf("WindowsNT6.4") != -1 || AgentUserOs.indexOf("WindowsNT10.0") != -1) OSName="Windows||10";
else if(appname.indexOf("nt 6.4") != -1 ) OSName="Windows||10";
else if(AgentUserOs.indexOf("WindowsPhone8.0") != -1) OSName="Windows||Phone 8.0";
else if(AgentUserOs.indexOf("WindowsPhoneOS7.5") != -1) OSName="Windows||Phone 7.5";
else if(AgentUserOs.indexOf("Xbox") != -1) OSName="Xbox||360";
else if(AgentUserOs.indexOf("XboxOne") != -1) OSName="Xbox||One";
else if(AgentUserOs.indexOf("Win16") != -1) OSName="Windows||3.x";
else if(AgentUserOs.indexOf("ARM") != -1) OSName="Windows||RT";
else OSName="Windows||";
OsVers="";
} else if ($.os.Linux) {
if(AgentUserOs.indexOf("Android") != -1) { OSName = getAndroidDevName(); }
else if(AgentUserOs.indexOf("BlackBerry9000") != -1) OSName="BlackBerry||9000";
else if(AgentUserOs.indexOf("BlackBerry9300") != -1) OSName="BlackBerry||9300";
else if(AgentUserOs.indexOf("BlackBerry9700") != -1) OSName="BlackBerry||9700";
else if(AgentUserOs.indexOf("BlackBerry9780") != -1) OSName="BlackBerry||9780";
else if(AgentUserOs.indexOf("BlackBerry9900") != -1) OSName="BlackBerry||9900";
else if(AgentUserOs.indexOf("BlackBerry;Opera Mini") != -1) OSName="Opera||9.80";
else if(AgentUserOs.indexOf("Symbian/3") != -1) OSName="Symbian||OS3";
else if(AgentUserOs.indexOf("SymbianOS/6") != -1) OSName="Symbian||OS6";
else if(AgentUserOs.indexOf("SymbianOS/9") != -1) OSName="Symbian||OS9";
else if(AgentUserOs.indexOf("Ubuntu") != -1) OSName="Ubuntu||";
else if(AgentUserOs.indexOf("PDA") != -1) OSName="PDA||";
else if(AgentUserOs.indexOf("NintendoWii") != -1) OSName="Nintendo||Wii";
else if(AgentUserOs.indexOf("PSP") != -1) OSName="PlayStation||Portable";
else if(AgentUserOs.indexOf("PS2;") != -1) OSName="PlayStation||2";
else if(AgentUserOs.indexOf("PLAYSTATION3") != -1) OSName="PlayStation||3";
else OSName="Linux||";
OsVers = "";
} else if ($.os.Unix) {
OSName="UNIX||";
} else if ($.os.Mac) {
if(AgentUserOs.indexOf("iPad") != -1 || AgentUserOs.indexOf("iPhone") != -1){
var iOS = parseFloat(
('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1])
.replace('undefined', '3_2').replace('_', '.').replace('_', '')
) || false;
if(!iOS){
OSName = "IOS||";
}else{
OSName = "IOS||"+iOS
}
}else if((AgentUserOs.indexOf("MacOSX")) != -1) OSName="Mac||";
else OSName="Mac||";
} else {
OSName="ETC||";
}
var OSDev = OSName + OsVers;
return OSDev;
}
navigator.sayswho= (function(){
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'Internet Explorer||'+(tem[1] || '');
}else if(/msie/i.test(M[1].toLowerCase())){
return 'Internet Explorer||'+(M[2] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join('||');
})();
// ------------------------------------20170828 추가------------------------------------
var chatId;
function setStat()
{
var sitenum = "1";
var sessionid = "SESSIONID_"+sitenum;
var connectid = "CONNECTID_"+sitenum;
var refid = "REFID_"+sitenum;
var appname = navigator.userAgent;
var os;
var osversion;
var browser;
var browsername;
var isfirst = false;
// 체크 해상도
var vn_screenx = screen.width; // 화면스크린 넓이
var vn_screeny = screen.height; // 화면스크린 높이
var resolution = vn_screenx + " * " + vn_screeny;
// 체크 타임존
var tz = new Date();
var tzStr = (tz.getTimezoneOffset()/60) * -1;
// 체크 사용언어별
var lang;
if (navigator.appName == "Netscape")
lang = navigator.language;
else
lang = navigator.language;
var userAgentInfoValueFromQ = navigator.userAgent.replace(/ /g,''); // 김진규 추가
// os check START
var ros = OSInfoDev();
os = ros.split("||")[0]; osversion=(ros.split("||")[1] == "" ? "-" : ros.split("||")[1]);
// os check END
// browser check START
var browserversion = navigator.sayswho;
if(browserversion != undefined){
browser=browserversion.replace("||"," ").toUpperCase()+".0"; browsername=browserversion.split("||")[0];
}else {
browser = "ETC"; browsername=navigator.platform;
}
//browser check END
var url = document.URL
var urls = url.split("?");
var urlhost = urls[0];
var urlquery = urls.length>1 ? urls[1] : "";
//alert(typeof("parent.document"));
var pref = "";//document==null ? "" : parent.document.referrer;
var ref = document.referrer;
var refs, refhost="", refquery="";
try{ pref = parent.document.referrer;}catch(_e){ try{ pref = top.document.referrer; }catch(_e){ pref = ""} }
if(pref != ref)
{
ref = pref;
}
if(ref==url)
{
ref = "";
}
else
{
refs = ref.split("?");
refhost = refs[0];
refquery = refs.length>1 ? refs[1] : "";
}
// 유입경로별 인서트 로직추가
var cururl = url;
var cururl2 = "";
if(cururl.indexOf("http://www.") > -1) {
cururl2 = cururl.substring(11, cururl.substring(11).indexOf("/") + 11);
} else if(cururl.indexOf("http://") > -1) {
cururl2 = cururl.substring(7, cururl.substring(7).indexOf("/") + 7);
}
var refurl = ref;
var refurl2 = "";
if(refurl.indexOf("http://www.") > -1) {
refurl2 = refurl.substring(11, refurl.substring(11).indexOf("/") + 11);
} else if(refurl.indexOf("http://") > -1) {
refurl2 = refurl.substring(7, refurl.substring(7).indexOf("/") + 7);
}
// 유입경로별 인서트 로직추가 끝
var expire = new Date();
var sessionid_val = getCookie(sessionid);
var connectid_val = getCookie(connectid);
var refid_val = getCookie(refid);
var curdate = new Date(2025, 4, 7, 0, 58, 34, expire.getMilliseconds() );
expire.setTime(curdate.getTime() + 1000 * 3600 * 24 * 365);
if(sessionid_val=="")
{
setCookie(sessionid, ""+curdate.getTime(), expire);
sessionid_val = ""+curdate.getTime();
}
if(connectid_val == "")
{
connectid_val = ""+curdate.getTime();
setCookie(connectid,connectid_val,null);
isfirst = true;
}
// 유입경로별 인서트 로직추가
if(refid_val == "") {
if(refurl2 == "") {
refid_val = "BOOKMARK";
} else {
refid_val = refurl2;
}
setCookie(refid,refid_val,null);
}
if( (refurl2 != "" && cururl2 != refurl2) && (refurl2 != refid_val) ) {
connectid_val = ""+curdate.getTime();
setCookie(connectid,connectid_val,null);
setCookie(refid,refurl2,null);
isfirst = true;
}
// 유입경로별 인서트 로직추가 끝
chatId = connectid_val;
// 이미지 링크할 때는 절대 경로로 합니다. HOST명까지 적어 주어야 합니다.
var img = "https://weblog.hmtech.or.kr/stat.jsp?sitenum=" + sitenum+"&isfirst="+isfirst+"&sessionid="+sessionid_val+"&connectid="+connectid_val+"&os="+escape(os)+"&osversion="+escape(osversion)+"&browser="+escape(browser)+"&browsername="+escape(browsername)+"&ref="+escape((ref))+"&url="+escape((url))+"&resolution="+resolution+"&lang="+lang+"&tzStr="+tzStr;
document.write("
");
}
// COOKIE 설정
function getCookie(name)
{
var nameOfCookie = name + "=";
var x = 0;
while (x <= document.cookie.length)
{
var y = (x+nameOfCookie.length);
if (document.cookie.substring (x, y) == nameOfCookie)
{
if ((endOfCookie = document.cookie.indexOf (";", y)) == -1)
endOfCookie = document.cookie.length;
return unescape (document.cookie.substring(y, endOfCookie));
}
x = document.cookie.indexOf (" ", x) + 1;
if (x == 0)
break;
}
return "";
}
function setCookie (name, value, expires)
{
if(expires==null) document.cookie = name + "=" + escape (value) + "; path=/";
else document.cookie = name + "=" + escape (value) + "; path=/; expires=" + expires.toGMTString();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
setStat();
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////