var Link = window.location.pathname + window.location.search; var LogOnUrl = "https://auth.hiliving.co.kr/M/LogOn?link=" + encodeURIComponent(Link) + "&site_url=http://m.hiliving.co.kr"; function goLogon(){ window.location.href = LogOnUrl; } function IsLogin(){ var result = true; $.ajax({ type: "POST", url: '/Common/IsLogin', cache:false, async: false, success: function (data) { result = data; } }); return result; } function mainload() { window.location.href ="http://m.hiliving.co.kr"; } function IsMyRoomLogin(){ var result = false; $.ajax({ type: "POST", url: '/Common/IsMyRoomLogin', cache:false, async: false, success: function (data) { result = data; } }); return result; } // toast 메세지 기본값을 셋팅합니다. var toast = function (text, icon) { iconOption = ""; switch (icon) { case "info": case "warning": case "success": case "error": icon = icon; break; default: icon = ""; break; } $.toast({ text: text, icon: icon, showHideTransition: 'fade', hideAfter: 1500, position: 'mid-center', loader: false }); } var cookieList = function (cookieName) { var cookie = $.cookie(cookieName); var items = cookie ? cookie.split(/,/) : new Array(); return { "add": function (val) { indx = items.indexOf(val); if (indx == -1) items.push(val); $.cookie(cookieName, items.join(','), { expires: 30 }); }, "remove": function (val) { indx = items.indexOf(val); if (indx != -1) items.splice(indx, 1); $.cookie(cookieName, items.join(','), { expires: 30 }); }, "clear": function () { items = new Array(); $.cookie(cookieName, ""); }, "items": function () { return items; } } } // 기획전/이벤트에서 사용되는 함수 값입니다. function show(elementId) { var element = document.getElementById(elementId); if (element) { element.style.visibility = "visible"; } } // 기획전/이벤트에서 사용되는 함수 값입니다. function hide(elementId) { var element = document.getElementById(elementId); if (element) { element.style.visibility = "hidden"; } } function post(path, params, method) { method = method || "post"; // Set method to post by default if not specified. // The rest of this code assumes you are not using a library. // It can be made less wordy if you use one. var form = document.createElement("form"); form.setAttribute("method", method); form.setAttribute("action", path); for (var key in params) { if (params.hasOwnProperty(key)) { var hiddenField = document.createElement("input"); hiddenField.setAttribute("type", "hidden"); hiddenField.setAttribute("name", key); hiddenField.setAttribute("value", params[key]); form.appendChild(hiddenField); } } document.body.appendChild(form); form.submit(); document.body.removeChild(form); return false; } String.format = function () { // The string containing the format items (e.g. "{0}") // will and always has to be the first argument. var theString = arguments[0]; // start with the second argument (i = 1) for (var i = 1; i < arguments.length; i++) { // "gm" = RegEx options for Global search (more than one instance) // and for Multiline search var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm"); theString = theString.replace(regEx, arguments[i]); } return theString; } //찜하기 레이어 팝업 이벤트 function wrapWindowByMask3(top) { // 레이어 팝업을 가운데로 띄우기 위해 화면의 높이와 너비의 가운데 값과 스크롤 값을 더하여 변수로 만듭니다. var left = ($(window).scrollLeft() + ($(window).width() - $('.window2').width()) / 2); // css 스타일을 변경합니다. $('.window3').css({ 'left': 0, 'top': 0, 'bottom': 0, 'position': 'fixed','z-index':'1050' }); // 레이어 팝업을 띄웁니다. $('.window3').show("slide", { direction: "left" }, 300); } function goWish(goodCode, idx) { if (IsLogin()) { //레이어 작동 시 스크롤 방지 $('html, body').css({ 'overflow': 'hidden', 'height': '100%' }); // 모달팝업 중 html,body의 scroll을 hidden시킴 $('body').on('scroll touchmove mousewheel', function (event) { // 터치무브와 마우스휠 스크롤 방지 event.preventDefault(); event.stopPropagation(); return false; }); //레이어 동작 wrapWindowByMask3(0); var data = { "goodcode": goodCode }; $.ajaxSettings.traditional = true; $.ajax({ type: "GET" , url: "/Common/ChoiceGoods" , data: data //, dataType: "json" , success: function (data) { $(".window3").empty(); $(".window3").append(data); zIndex = 1050; if (idx != null && idx > 0) { zIndex = idx; } zIndex = 1050; $(".window3").css({"height": "100%","z-index": zIndex }); $(".window3").off('scroll touchmove mousewheel'); // 터치무브 및 마우스휠 스크롤 가능 }, error: function (error, status, request) { errorBox(request.responseText); } }); } else { goLogon(); } } function goDetail(good_code) { window.location.href = "/Goods/Details?goodcode="+good_code; } //최근 구매내역 결제하기 $("#RecentBuyList_BUY").click(function(){ var check_list = $("input[name*='buy_list_']:checked"); if(check_list.length==""){ infoBox('선택한 상품이 없습니다') return false; } var goodcode =''; var good_count=''; check_list.each(function(){ goodcode+=$(this).val()+','; good_count+='1'+',' }); goodcode = goodcode.substr(0,goodcode.length-1); good_count = good_count.substr(0,good_count.length-1); goOrder(goodcode,'',good_count); }); var medicalMessage = "" medicalMessage = medicalMessage + "본 상품코드는 자가소비용 상품코드입니다.
"; medicalMessage = medicalMessage + "의료기관에 판매 할 경우 반드시 ‘의료기기 보고용’으로 주문 해 주시기 바랍니다.
"; medicalMessage = medicalMessage + "본 상품 코드로 구매 후 의료기관에 판매 할 경우 법적 문제가 발생 할 수 있으며, 그 책임은 구입 한 회원에게 있습니다.
"; medicalMessage = medicalMessage + "동의하시겠습니까 ?
"; // 상품코드만 입력시 장바구니 등록 // 쿠폰 상품의 경우 쿠폰 코드 입력 // 수량은 1이 아닌 경우만 입력 function goCart(good_code, coupon_code, good_count, goOption,isOption) { if (IsLogin()) { $.ajax({ type: "GET", url: '/Goods/IsMedicalGoods', data: { goodCode : good_code }, success: function (data) { //console.log(" data = [" + data + "]"); confirmValue = "1"; if (data == "1") { //console.log(medicalMessage); confirmBox(medicalMessage, function(){ goCartAction(good_code, coupon_code, good_count, goOption,isOption); }, function(){}, "") } else { goCartAction(good_code, coupon_code, good_count, goOption,isOption); } }, error: function (a, b, c) { console.log("오류발생"); } }); } else { goLogon(); } //console.log("goCart"); //console.log("True"); //console.log("2021/08/01 00:00:00"); //console.log("True"); } function goCartAction(good_code, coupon_code, good_count, goOption,isOption) { var cartId = ""; if (IsLogin()) { if (isOption == "Y") { confirmBox("해당상품은 옵션을 선택하셔야 합니다.
상세보기로 이동하시겠습니까?", callbackMethodTrue, function(){}, good_code) function callbackMethodTrue(good_code) { goDetail(good_code); } return false; } if (coupon_code == null) { coupon_code == ""; } if (good_count == null || good_count == "") { good_count == 1; } if (goOption == null) { goOption == ""; } var data = { 'good_code': good_code, 'coupon_code': coupon_code, 'good_count': good_count }; $.ajax({ type: "GET", url: '/Cart/AddCart', async:false, data: data, success: function (data) { if (data.Code == "200") { if (goOption == "Y") { post('/Order/OrderWrite', { goods_dels1: data.Data }, "post"); } else if (goOption == "N") { cartId = data.Data; } else { confirmBox("장바구니에 저장되었습니다.\n장바구니로 이동하시겠습니까?", callbackMethodTrue, function(){}, "") function callbackMethodTrue(good_code) { location.href = "/Cart"; } SetCartCount(); } } else { errorBox(data.Message); } }, error: function (a, b, c) { errorBox('장바구니 추가에 실패하였습니다.'); return false; } }); } else { goLogon(); } if (goOption == "N") { return cartId; } } function SetCartCount() { $.ajax({ type: "POST", url: '/Cart/Count', cache:false }) .done(function(data){ $("#cartCount").html(data); }); } SetCartCount(); // 상품코드만 입력시 장바구니 등록 // 쿠폰 상품의 경우 쿠폰 코드 입력 // 수량은 1이 아닌 경우만 입력 function goOrder(good_code, coupon_code, good_count, is_option) { if (IsLogin()) { if (good_count == null || good_count == "") { good_count = "1"; } var arrGoodCode = good_code.split(","); var arrGoodCount = good_count.split(","); if(arrGoodCode.length > 1){ var arrCartId = []; // 상품상세에서 여러 상품 바로구매의 경우 - 옵션상품 // 옵션상품은 쿠폰이 없다. for(i=0;i< arrGoodCode.length ;i++){ arrCartId[i] = goCart(arrGoodCode[i], '', arrGoodCount[i], "N"); } post('/Order/OrderWrite', { goods_dels1: arrCartId }, "post"); }else{ if (is_option == "Y") { confirmBox("상세보기로 이동하시겠습니까?", callbackMethodTrue, function(){}, ""); function callbackMethodTrue(){ goDetail(good_code); } return false; } goCart(good_code, coupon_code, good_count, "Y"); } } else { goLogon(); } } // 본품만, 수량1, 쇼핑찜 리스트에서 사용 function goOrderMulti(good_code_comma_list){ if (IsLogin()) { var arrCart = good_code_comma_list.split(","); arrCart.forEach(function (ele) { goCart(ele,'',1,'N'); }); $.ajax({ type: "POST", url: '/Cart/CartIdList', data: { 'GoodsCodeCommaList' :good_code_comma_list }, cache:false, async: false, success: function (data) { post('/Order/OrderWrite', { goods_dels1: data }, "post"); } }); } else { goLogon(); } } function CopyOrder(param) { var confirmMessage = "구매 가능한 상품만 재주문이 가능하며,
쿠폰으로 구매한 상품, 증정상품은 재주문에 포함 되지 않습니다.
계속 주문 하시겠습니까?"; var url = "/Cart/Check"; $.ajax({ type: "post" , dataType: "jsonp" , async:false , url: url , data: param , success: function (data) { //alert(data.Code); if (data.Code == "200") { confirmBox(confirmMessage, CopyOrderAction, function () { }, param) } else { infoBox(data.Message); } }, error: function (request, error, status) { errorBox(request.responseText) } }); } function CopyOrderAction(param) { var url = "/Cart/Copy"; $.ajax({ type: "post" , dataType: "jsonp" , async:false , url: url , data: param , success: function (data) { if (data.Code == "200") { //infoBox(param.ordNo); var $form = $('
'); $form.attr('action', '/order/orderwrite'); $form.attr('method', 'post'); $form.appendTo('body'); var ordNo = $(''); $form.append(ordNo); $form.submit(); } else { infoBox(data.Message); } }, error: function (request, error, status) { errorBox(request.responseText) } }); } function goGoodsDetail(goodCode) { location.href = "/Goods/Details?goodcode=" + goodCode; } function openOption(good_code) { var url = '/Common/ChangeGoodsOption?good_code=' + good_code window.open(url, "cart_option", "toolbar=0,menubar=0,scrollbars=auto,resizable=no,width=470,height=370;"); } //주소찾기 function AutoAddr() { $("#COMMONADDRESS").show(); $('#COMMONADDRESS').css({ 'left': 0, 'top': 0, 'bottom': 0, 'position': 'fixed','z-index':'1001' }); $("#COMMONADDRESS").css({ "overflow": "auto", "height": "100%","z-index": 999 }); $("#COMMONADDRESS").off('scroll touchmove mousewheel'); // 터치무브 및 마우스휠 스크롤 가능 $("#searchWord").focus(); } //주소록 찾기 function setAddr() { $("#AddressNearModel").show(); $('#AddressNearModel').css({ 'left': 0, 'top': 0, 'bottom': 0, 'position': 'fixed','z-index':'1001' }); $("#AddressNearModel").css({ "overflow": "auto", "height": "100%","z-index": 999 }); $("#AddressNearModel").off('scroll touchmove mousewheel'); // 터치무브 및 마우스휠 스크롤 가능 } var authUrl = "https://auth.hiliving.co.kr/m/RegisterChoise?sponsor="; //카카오톡 공유하기 // //카카오스토리 공유하기 // filter.indexOf(navigator.platform.toLowerCase())) { Kakao.Story.open({ install: true, url: url, text: title }); } else { Kakao.Story.share({ url: url, text: title }); } } } //]]> //페이스북 공유하기 function goFaceBook(url) { window.open('http://www.facebook.com/sharer/sharer.php?u=' + url); } //밴드 공유하기 function shareBand(url, authCode){ authUrl = authUrl + authCode; url = "가입하기 : " + authUrl + "\n상품바로가기 : " + url + "" url = encodeURIComponent(url); window.open('https://band.us/plugin/share?body='+url); } //var clipboard = new ClipboardJS("#ClipButton1"); //주소복사 function copyLink() { var clipboard = new ClipboardJS('#ClipButton1'); clipboard.on('success', function(e) { console.info('Action:', e.action); console.info('Text:', e.text); console.info('Trigger:', e.trigger); e.clearSelection(); }); var url = window.location.href; $("#ClipButton1").attr("data-clipboard-text",url); $("#ClipButton1").click(); infoBox("주소가 복사되었습니다 (" + url + ")"); clipboard.destroy(); } //이메일계정 체크 function chkEmail(str) { var str; var num = 0; var isEmail = /[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*/; if (!isEmail.test(str)) { num += 1; } if (num != 0) return "false"; } // Hide Header on on scroll down var didScroll; var lastScrollTop = 0; var delta = 5; var navbarHeight = $('header').outerHeight(); $(window).scroll(function (event) { didScroll = true; }); setInterval(function () { if (didScroll) { hasScrolled(); didScroll = false; } }, 250); function hasScrolled() { var st = $(this).scrollTop(); // Make sure they scroll more than delta if (Math.abs(lastScrollTop - st) <= delta) return; // If they scrolled down and are past the navbar, add class .nav-up. // This is necessary so you never see what is "behind" the navbar. if (st > lastScrollTop && st > navbarHeight) { // Scroll Down $('header').removeClass('nav-down').addClass('nav-up'); } else { // Scroll Up if (st + $(window).height() < $(document).height()) { $('header').removeClass('nav-up').addClass('nav-down'); } } lastScrollTop = st; } function isAllowStr(str, allowStr) { var i; var ch; for (i = 0; i < str.length; i++) { ch = str.charAt(i); if (allowStr.indexOf(ch) < 0) { return false; } } return true; } // 패스워드 체크 함수 function passwordValidation(passwd) { if (passwd.length === 0) { return "8자리 이상 16자리 이하로 입력해주세요."; } // 1. 가능문자 여부 체크 var notValid = /[^\w\~\!\@\#\$\%\^\&\*\(\)\_\+\|\{\}\:\"\<\>\?\`\-\=\[\]\;\'\,\.\,\\\,\/\/]/g.test(passwd); if (notValid) { return "영문,숫자 및 사용 가능한 특수문자로 입력해주세요."; } // 2. 영문,숫자,특수문자 2가지 이상 혼용 여부 체크 var num = /[0-9]/g.test(passwd) ? 1 : 0; var eng = /[a-z]/gi.test(passwd) ? 1 : 0; var spe = /[\~\!\@\#\$\%\^\&\*\(\)\_\+\|\{\}\:\"\<\>\?\`\-\=\[\]\;\'\,\.\,\\\,\/\/]/g.test(passwd) ? 1 : 0; //~!@#$%^&*()_+|{}:"<>?`-=\[];',./ if (num + eng + spe < 2) { return "영문,숫자,특수문자 2개이상 조합으로 입력해주세요."; } // 3. 자리수 체크 var passwdLength = passwd.length; if (passwdLength < 8 || passwdLength >= 16) { return "8자리 이상 16자리 이하로 입력해주세요."; } // 4. 반복 문자/숫자 체크 if (/(\w)\1\1\1/.test(passwd)) { return "동일한 문자는 3번까지 반복 입력가능합니다."; } return ""; } // 숫자여부를 가져옵니다. function CheckNum(str) { var Numlist="0123456789"; var flag=false; var i,j; for(i=0;i Number(maxLength)) { return false; } else { return true; } } // 바이트수 반환 function byteCheck(varText){ var codeByte = 0; for (var idx = 0; idx < varText.length; idx++) { var oneChar = escape(varText.charAt(idx)); if ( oneChar.length == 1 ) { codeByte ++; } else if (oneChar.indexOf("%u") != -1) { codeByte += 2; } else if (oneChar.indexOf("%") != -1) { codeByte ++; } } return codeByte; } // HtmlDecode function decodeEntity(inputStr) { var textarea = document.createElement("textarea"); textarea.innerHTML = inputStr; return textarea.value; }