From 9093603494ae02a63b37aaed304154c677063e65 Mon Sep 17 00:00:00 2001 From: thisgun Date: Wed, 28 Oct 2020 15:01:40 +0900 Subject: [PATCH] =?UTF-8?q?common.js=20=EC=9E=90=EB=B0=94=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=ED=95=A8=EC=88=98=20get=5Fcookie?= =?UTF-8?q?,=20font=5Fresize=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/common.js | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/js/common.js b/js/common.js index 071245a70..f5e61e91e 100644 --- a/js/common.js +++ b/js/common.js @@ -165,33 +165,9 @@ function set_cookie(name, value, expirehours, domain) // 쿠키 얻음 function get_cookie(name) { - var find_sw = false; - var start, end; - var i = 0; - - for (i=0; i<= document.cookie.length; i++) - { - start = i; - end = start + name.length; - - if(document.cookie.substring(start, end) == name) - { - find_sw = true - break - } - } - - if (find_sw == true) - { - start = end + 1; - end = document.cookie.indexOf(";", start); - - if(end < start) - end = document.cookie.length; - - return unescape(document.cookie.substring(start, end)); - } - return ""; + var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); + if (match) return unescape(match[2]); + return ""; } // 쿠키 지움 @@ -559,10 +535,12 @@ function font_resize(id, rmv_class, add_class, othis) { var $el = $("#"+id); - $el.removeClass(rmv_class).addClass(add_class); + if((typeof rmv_class !== "undefined" && rmv_class) || (typeof add_class !== "undefined" && add_class)){ + $el.removeClass(rmv_class).addClass(add_class); - set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain); - set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain); + set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain); + set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain); + } if(typeof othis !== "undefined"){ $(othis).addClass('select').siblings().removeClass('select');