1var mainCart = mainCart || {}; 2 3mainCart.chr = function(code){ 4 return String.fromCharCode(code); 5} 6 7jQuery(function ($) { 8 9 var select_option_el = "select.it_option", 10 overclass = "overlay", 11 cartclass = "sct_cartop", 12 cart_btn_class = "sct_btn"; 13 14 mainCart.add_wishitem = function(el) { 15 16 var $el = $(el), 17 it_id = $el.data("it_id"); 18 19 if(!it_id) { 20 alert("ìíì½ëê° ì¬ë°ë¥´ì§ ììµëë¤."); 21 return false; 22 } 23 24 $.post( 25 g5_theme_shop_url + "/ajax.action.php", 26 { it_id: it_id, action : "wish_update" }, 27 function(error) { 28 if(error != "OK") { 29 alert(error.replace(/\\n/g, "\n")); 30 return false; 31 } 32 33 mainCart.update_wish_side(); 34 alert("ìíì ìì리ì¤í¸ì ë´ììµëë¤."); 35 return; 36 } 37 ); 38 } 39 40 mainCart.add_cart = function(frm) { 41 42 var $frm = $(frm); 43 var $sel = $frm.find(select_option_el); 44 var it_name = $frm.find("input[name^=it_name]").val(); 45 var it_price = parseInt($frm.find("input[name^=it_price]").val()); 46 var id = ""; 47 var value, info, sel_opt, item, price, stock, run_error = false; 48 var option = sep = ""; 49 var count = $sel.length; 50 51 if(count > 0) { 52 $sel.each(function(index) { 53 value = $(this).val(); 54 item = $(this).prev("label").text(); 55 56 if(!value) { 57 run_error = true; 58 return false; 59 } 60 61 // ìµì ì íì ë³´ 62 sel_opt = value.split(",")[0]; 63 64 if(id == "") { 65 id = sel_opt; 66 } else { 67 id += mainCart.chr(30)+sel_opt; 68 sep = " / "; 69 } 70 71 option += sep + item + ":" + sel_opt; 72 }); 73 74 if(run_error) { 75 alert(it_name+"ì "+item+"ì(를) ì íí´ ì£¼ììì¤."); 76 return false; 77 } 78 79 price = value[1]; 80 stock = value[2]; 81 } else { 82 price = 0; 83 stock = $frm.find("input[name^=it_stock]").val(); 84 option = it_name; 85 } 86 87 // ê¸ì¡ ìì ì²´í¬ 88 if(it_price + parseInt(price) < 0) { 89 alert("구매ê¸ì¡ì´ ììì¸ ìíì 구매í ì ììµëë¤."); 90 mainCart.add_cart_after(); 91 return false; 92 } 93 94 // ìµì ì íì ë³´ ì ì© 95 $frm.find("input[name^=io_id]").val(id); 96 $frm.find("input[name^=io_value]").val(option); 97 $frm.find("input[name^=io_price]").val(price); 98 99 $.ajax({ 100 url: $(frm).attr("action"), 101 type: "POST",
102 data: $(frm).serialize(), 103 dataType: "json", 104 async: true, 105 cache: false, 106 success: function(data, textStatus) { 107 108 mainCart.add_cart_after(frm); 109 110 if(data.error != "") { 111 alert(data.error); 112 return false; 113 } 114 115 mainCart.update_cart_side(); 116 117 alert("ìíì ì¥ë°êµ¬ëì ë´ììµëë¤."); 118 119 mainCart.add_cart_after(); 120 }, 121 error : function(request, status, error){ 122 mainCart.add_cart_after(frm); 123 alert('false ajax :'+request.responseText); 124 } 125 }); 126 127 return false; 128 } 129 130 mainCart.update_cart_side = function(){ 131 var ajax_url = g5_theme_shop_url || g5_shop_url; 132 133 $.ajax({ 134 url: ajax_url + "/ajax.action.php", 135 type: "GET", 136 data: {"action":"refresh_cart"}, 137 dataType: "html", 138 async: true, 139 cache: false, 140 success: function(data, textStatus) { 141 var inner_html = $(data).filter(".side-cart").html(), 142 cart_count = $(data).find(".cart-count").text(); 143 144 $(".sidebar-shop-box .side-cart").html(inner_html); 145 $(".cart-count").text(cart_count); 146 }, 147 error : function(request, status, error){ 148 alert("false ajax :"+request.responseText); 149 } 150 }); 151 152 return true; 153 } 154 155 mainCart.update_wish_side = function(){ 156 var ajax_url = g5_theme_shop_url || g5_shop_url; 157 158 if (typeof g5_is_member == "undefined" || ! g5_is_member) { 159 return false; 160 } 161 162 $.ajax({ 163 url: ajax_url + "/ajax.action.php", 164 type: "GET", 165 data: {"action":"refresh_wish"}, 166 dataType: "html", 167 async: true, 168 cache: false, 169 success: function(data, textStatus) { 170 var inner_html = $(data).filter(".side-wish").html(); 171 wish_count = $(data).find(".wish-count").text(); 172 173 $(".sidebar-shop-box .side-wish").html(inner_html); 174 $(".wish-count").text(wish_count); 175 }, 176 error : function(request, status, error){ 177 alert("false ajax :"+request.responseText); 178 } 179 }); 180 181 return true; 182 } 183 184 mainCart.add_cart_after = function(frm){ 185 var $over_rayers = $("."+overclass), 186 $cart_rayers = $("."+cartclass); 187 188 $over_rayers.each(function(i) { 189 $(this).removeClass(overclass); 190 }); 191 192 $cart_rayers.each(function(i) { 193 if( !(frm && $(this).find("select").length) ){ 194 $(this).html("").removeClass(cartclass); 195 } 196 }); 197 } 198 199 $(document).on("click", ".btn_cart", function(e) { 200 e.preventDefault(); 201 202 var $this = $(this), 203 it_id = $this.data("it_id"), 204 $sct_li = $this.closest(".item-opts-box"), 205 $cart_optbox = $("#cart_optbox"); 206 207 $("#cart_optbox").not($cart_optbox).removeClass(cartclass).html(''); 208 $(".item-opts-box").not($sct_li).removeClass(overclass); 209 210 $.ajax({ 211 url: g5_theme_shop_url+"/ajax.action.php", 212 type: "POST", 213 data: { 214 "it_id" : it_id, 215 "action" : "get_item_option" 216 }, 217 dataType: "json", 218 async: true, 219 cache: false, 220 success: function(data, textStatus) { 221 if(data.error != "") { 222 alert(data.error); 223 return false; 224 } 225 226 $sct_li.addClass(overclass); 227 $cart_optbox.addClass(cartclass).html(data.html); 228 229 if(!data.option) { 230 mainCart.add_cart($cart_optbox.find("form").get(0)); 231 $cart_optbox.removeClass(cartclass); 232 $cart_optbox.empty(); 233 return; 234 } 235 }, 236 error : function(request, status, error){ 237 alert('false ajax :'+request.responseText); 238 } 239 }); 240 }); 241 242 $(document).on("change", "select.it_option", function() { 243 var $frm = $(this).closest("form"); 244 var $sel = $frm.find("select.it_option"); 245 var sel_count = $sel.length; 246 var idx = $sel.index($(this)); 247 var val = $(this).val(); 248 var it_id = $frm.find("input[name='it_id[]']").val(); 249 250 // ì íê°ì´ ìì ê²½ì° íì ìµì ì disabled 251 if(val == "") { 252 $frm.find("select.it_option:gt("+idx+")").val("").attr("disabled", true); 253 return; 254 } 255 256 // íìì íìµì ë¡ë 257 if(sel_count > 1 && (idx + 1) < sel_count) { 258 var opt_id = ""; 259 260 // ìì ìµì ì ê°ì ì½ì´ ìµì id ë§ë¬ 261 if(idx > 0) { 262 $frm.find("select.it_option:lt("+idx+")").each(function() { 263 if(!opt_id) 264 opt_id = $(this).val(); 265 else 266 opt_id += mainCart.chr(30)+$(this).val(); 267 }); 268 269 opt_id += mainCart.chr(30)+val; 270 } else if(idx == 0) { 271 opt_id = val; 272 } 273 274 $.post( 275 g5_shop_url + "/itemoption.php", 276 { it_id: it_id, opt_id: opt_id, idx: idx, sel_count: sel_count }, 277 function(data) { 278 $sel.eq(idx+1).empty().html(data).attr("disabled", false); 279 280 // selectì ìµì ì´ ë³ê²½ëì ê²½ì° íì ìµì disabled 281 if(idx+1 < sel_count) { 282 var idx2 = idx + 1; 283 $frm.find("select.it_option:gt("+idx2+")").val("").attr("disabled", true); 284 } 285 } 286 ); 287 } else if((idx + 1) == sel_count) { // ì íìµì ì²ë¦¬ 288 if(val == "") 289 return; 290 291 var info = val.split(","); 292 // ì¬ê³ ì²´í¬ 293 if(parseInt(info[2]) < 1) { 294 alert("ì ííì ì íìµì ìíì ì¬ê³ ê° ë¶ì¡±íì¬ êµ¬ë§¤í ì ììµëë¤."); 295 return false;
296 } 297 } 298 }); 299 300 $(document).on("click", ".cartopt_cart_btn", function(e) { 301 e.preventDefault(); 302 303 mainCart.add_cart(this.form); 304 }); 305 306 $(document).on("click", ".cartopt_close_btn", function(e) { 307 e.preventDefault(); 308 309 mainCart.add_cart_after(); 310 }); 311 312 $(document).on("click", ".btn_wish", function(e) { 313 e.preventDefault(); 314 315 mainCart.add_wishitem(this); 316 }); 317});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.