var userAgent = navigator.userAgent.toLowerCase(); jQuery.browser = { version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1], chrome: /chrome/.test( userAgent ), safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) }; //alert(jQuery.browser.mozilla); if(jQuery.browser.mozilla){ (function(){ var events = ["mousedown", "mouseover", "mouseout", "mousemove", "mousedrag", "click", "dblclick"]; for (var i = 0; i < events.length; i++){ window.addEventListener(events[i], function(e){ window.event = e; }, true); } }()); }; function showCenterWindow(url, targetname, wi, hi, opt) { var lf = eval( (screen.availWidth/2) -(wi/2)); // get center position var tp = eval( (screen.availHeight/2)-(hi/2)); // get center position window.open(url, targetname, "height="+hi+", width="+wi+", top="+tp+", left="+lf+", "+opt); } function numberFormat(num) { var num2 = num.toString(); var pattern = /(-?[0-9]+)([0-9]{3})/; while(pattern.test(num2)) { num2 = num2.replace(pattern,"$1,$2"); } return num2; } function show_consulting_info(mb_idx) { showCenterWindow('/member/member_consulting_list.html?mb_idx='+mb_idx,'_blank',900,670); } function show_consulting_info_modify(mb_idx,idx) { showCenterWindow('/member/member_consulting_list.html?mb_idx='+mb_idx+'&idx='+idx,'_blank',900,670); } function show_happycall_reg(mb_idx) { showCenterWindow('/member/member_consulting_list.html?mb_idx='+mb_idx+'&s_gubun=1','_blank',900,670); } function show_contract_info(ccode) { showCenterWindow('/contract/register_info.html?ccode='+ccode,'_blank',900,620); } function show_member_info(idx) { showCenterWindow('/member/register_info.html?idx='+idx,'_blank',900,620); // location.href=; } function logout(curl) { $.ajaxSetup({ timeout:1000, async:true, error:function(err) { //console.log(err); logout(document.location); return false; } }); $("#loading_login").show(); $.ajaxSetup({async: true}); $.post('/admin/logout.php', "mode=logout", function (data) { var rtn_value = data; var rtn_array = rtn_value.split("|"); if(rtn_value == "OK") { $("#loading_login").hide(); location.href=curl; } else{ $("#loading_login").hide(); alert(rtn_value); } }); } function auto_login(uid) { $("#myidc_form")[0].userid.value=uid; $("#myidc_form")[0].type.value="admin"; $("#myidc_form").submit(); } function set_hw_info(scode) { $.ajax({ url: "/admin/server/act.php", data: "mode=get_hw_info&scode="+scode, type:'post', async: true, success: function(rtn_value){ var rtn_array = rtn_value.split("|"); if(rtn_array[0] == "OK") { $("#hw_info_title").html(rtn_array[1]) $("#part_cpu").html(rtn_array[2]); $("#part_memory").html(rtn_array[3]); $("#part_mainboard").html(rtn_array[4]); $("#part_storage").html(rtn_array[5]); $("#part_nic").html(rtn_array[6]); $("#part_power").html(rtn_array[7]); $("#part_chasis").html(rtn_array[8]); } else alert(rtn_value); } }); } function round_ex(v) { return (Math.round(v/.01) * .01)*100/100; } var hw_info_show = false; var alarm_info_show = false; $(document).on("click",".data_element",function () { var url = $(this).attr("data-url"); if(url == undefined) return; location.href=url; }); $(document).ready( function() { $.xhrPool = []; // array of uncompleted requests $.xhrPool.abortAll = function() { // our abort function $(this).each(function(idx, jqXHR) { jqXHR.abort(); }); $.xhrPool.length = 0 }; $.ajaxSetup({ async: true, beforeSend: function(jqXHR) { $.xhrPool.push(jqXHR); }, complete: function(jqXHR) { // when some of the requests completed it will splice from the array var index = $.xhrPool.indexOf(jqXHR); if (index > -1) { $.xhrPool.splice(index, 1); } } }); $(document.body).click(function () { var event = window.event; if(event) var target = (event.target) ? event.target : event.srcElement; if(hw_info_show) { $("#hw_info").hide(); hw_info_show = false; } //var target_class = target.className; return true; }); $("#logout").click( function () { if(!confirm("로그아웃 하시겠습니까 ?")) return false; logout(document.location); }); $(".hw_info").click( function () { var $box = $("#hw_info"); if($box.data("open_scode") == this.id) { $box.hide(); $box.data("open_scode",""); return; } $(".pop_server").hide(); set_hw_info(this.id); hw_info_show = true; event.stopPropagation(); /* var off = $(this).offset(); var left = off.left-$box.width(); if(left<0) { left += 300; } var top = off.top; $box.css({left:left,top:top}).show(); */ var off = $(this).offset(); xx = off.left; xx = $(window).width() < (xx+$box.width()) ? xx-$box.width() : xx; yy = off.top; yy = $(window).height() < (yy+$box.height()) ? off.top-$box.height() : yy; $box.css({left:xx,top:yy-200}).show(); }); $("#btn_hw_info_close").click( function () { $("#hw_info").hide(); $("#hw_info").data("open_scode",""); }); $(".user_photo").click( function () { if(this.id == "-1") return; if( $(this).data("is_show") == "show") { $(this).data("is_show",""); $(".photo_view").hide(); } else { $(".photo_view").show(); $(this).data("is_show","show"); } }); $("#btn_user_photo_close").click( function () { $(".user_photo").data("is_show",""); $(".photo_view").hide(); }); $(".photo_view").click( function () { $("#btn_hw_info_close").click(); }); $("#btn_win_min").click( function () { var h = $(window).height() var w = 1165; var win = window.open(location.href,'','scrollbars=no'); win.window.resizeTo(w,h); }); }); function now() { var options = { timeZone: "Asia/Seoul", year: "numeric", month: "2-digit", day: "2-digit", hour:"2-digit", minute:"2-digit", second:"2-digit" }; return '[' + new Date().toLocaleString('ko-KR', options) + ']'; } var is_dev = true; console.logCopy = console.log.bind(console); console.log = function() { if(!is_dev) return; // Timestamp to prepend var timestamp = now(); if (arguments.length) { // True array copy so we can call .splice() var args = Array.prototype.slice.call(arguments, 0); // If there is a format string then... it must // be a string if (typeof arguments[0] === "string") { // Prepend timestamp to the (possibly format) string args[0] = "%o: " + arguments[0]; // Insert the timestamp where it has to be args.splice(1, 0, timestamp); // Log the whole array this.logCopy.apply(this, args); } else { // "Normal" log this.logCopy(timestamp, args); } } };