PageSourceSearch

https://shokz.co.kr/js/shop.override.js

js shokz.co.kr collected 2026-09-30 06:28:19 UTC 7,446 bytes, 178 lines download raw bytes

1jQuery(function($){
2
3    $(".2017_renewal_itemform select.it_supply").on("shop_sel_supply_process", function(e, param){
4        
5        var add_exec = param.add_exec;
6        var $el = $(this);
7        var val = $el.val();
8		
9        //블랙캣77님이 해당 코드에 도움을 주셨습니다.
10        var eq = $("select.it_supply").index($(this));
11        var item = $el.closest(".sit_option").find("label").eq(eq).text();
12        
13        if(!val) {
14            alert(item+"을(를) 선택해 주십시오.");
15            return false;
16        }
17
18        var info = val.split(",");
19
20        // 재고체크
21        if(parseInt(info[2]) < 1) {
22            alert(info[0]+"은(는) 재고가 부족하여 구매할 수 없습니다.");
23            return false;
24        }
25
26        var id = item+chr(30)+info[0];
27        var option = item+":"+info[0];
28        var price = info[1];
29        var stock = info[2];
30
31        // 금액 음수 체크
32        if(parseInt(price) < 0) {
33            alert("구매금액이 음수인 상품은 구매할 수 없습니다.");
34            return false;
35        }
36
37        if(add_exec) {
38            if(same_option_check(option))
39                return false;
40
41            add_sel_option(1, id, option, price, stock);
42        }
43
44        return false;
45    });
46
47    if (typeof add_sel_option === "function") {
48
49        add_sel_option = (function() {
50            var cached_function = add_sel_option;
51
52            return function() {
53                
54                if( $(".2017_renewal_itemform").length ){
55                    var a = arguments;
56                    var type=a[0],
57                        id=a[1],
58                        option=a[2],
59                        price=a[3],
60                        stock=a[4];
61
62                    var item_code = $("input[name='it_id[]']").val();
63                    var opt = "";
64                    var li_class = "sit_opt_list";
65                    if(type)
66                        li_class = "sit_spl_list";
67
68                    var opt_prc;
69                    if(parseInt(price) >= 0)
70                        opt_prc = "+"+number_format(String(price))+"원";
71                    else
72                        opt_prc = number_format(String(price))+"원";
73
74                    opt += "<li class=\""+li_class+"\">";
75                    opt += "<input type=\"hidden\" name=\"io_type["+item_code+"][]\" value=\""+type+"\">";
76                    opt += "<input type=\"hidden\" name=\"io_id["+item_code+"][]\" value=\""+id+"\">";
77                    opt += "<input type=\"hidden\" name=\"io_value["+item_code+"][]\" value=\""+option+"\">";
78                    opt += "<input type=\"hidden\" class=\"io_price\" value=\""+price+"\">";
79                    opt += "<input type=\"hidden\" class=\"io_stock\" value=\""+stock+"\">";
80                    opt += "<div class=\"opt_name\">";
81                    opt += "<span class=\"sit_opt_subj\">"+option+"</span>";
82                    /*opt += "<span class=\"sit_opt_prc\">"+opt_prc+"</span>";*/
83                    opt += "</div>";
84                    opt += "<div class=\"opt_count\">";
85                    opt += "<button type=\"button\" class=\"sit_opt_del\" value=\"삭제\"><span class=\"sound_only\">삭제</span></button>";
86                    opt += "<div class=\"opt_count_wrap\">";
87                    opt += "<button type=\"button\" class=\"sit_qty_minus\" value=\"감소\"><span class=\"minus-btn\"></span><span class=\"sound_only\">감소</span></button>";
88                    opt += "<input type=\"text\" name=\"ct_qty["+item_code+"][]\" value=\"1\" class=\"num_input\" size=\"5\">";
89                    opt += "<button type=\"button\" class=\"sit_qty_plus\" value=\"증가\"><span class=\"add-btn\"></span><span class=\"sound_only\">증가</span></button>";
90                    opt += "</div>";
91                    opt += "</div>";
92
93                    opt += "</li>";
94
95                    if($("#sit_sel_option > ul").length < 1) {
96                        $("#sit_sel_option").html("<ul id=\"sit_opt_added\"></ul>");
97                        $("#sit_sel_option > ul").html(opt);
98                    } else{
99                        if(type) {
100                            if($("#sit_sel_option .sit_spl_list").length > 0) {
101                                $("#sit_sel_option .sit_spl_list:last").after(opt);
102                            } else {
103                                if($("#sit_sel_option .sit_opt_list").length > 0) {
104                                    $("#sit_sel_option .sit_opt_list:last").after(opt);
105                                } else {
106                                    $("#sit_sel_option > ul").html(opt);
107                                }
108                            }
109                        } else {
110                            if($("#sit_sel_option .sit_opt_list").length > 0) {
111                                $("#sit_sel_option .sit_opt_list:last").after(opt);
112                            } else {
113                                if($("#sit_sel_option .sit_spl_list").length > 0) {
114                                    $("#sit_sel_option .sit_spl_list:first").before(opt);
115                                } else {
116                                    $("#sit_sel_option > ul").html(opt);
117                                }
118                            }
119                        }
120                    }
121
122                    price_calculate();
123
124                    $("#sit_sel_option").trigger("add_sit_sel_option", [opt]);
125
126                } else {
127
128                    cached_function.apply(this, arguments); // use .apply() to call it
129
130                }   //end if
131
132            };
133        }());
134    }   //end if check function
135
136    if (typeof price_calculate === "function") {
137        price_calculate = (function() {
138            var cached_function = price_calculate;
139
140            return function() {
141                
142                if( $(".2017_renewal_itemform").length ){
143
144                    var it_price = parseInt($("input#it_price").val());
145
146                    if(isNaN(it_price))
147                        return;
148
149                    var $el_prc = $("input.io_price");
150                    var $el_qty = $("input[name^=ct_qty]");
151                    var $el_type = $("input[name^=io_type]");
152                    var price, type, qty, total = 0;
153
154                    $el_prc.each(function(index) {
155                        price = parseInt($(this).val());
156                        qty = parseInt($el_qty.eq(index).val());
157                        type = $el_type.eq(index).val();
158                        console.log(price, qty, type, 'shop.override.js', 'it_price')
159                        if(type == "0") { // 선택옵션
160                            // total += (it_price + price) * qty;
161                            total += price * qty;
162                        } else { // 추가옵션
163                            total += price * qty;
164                        }
165                    });
166                    //点击数量事件,改变总价
167                    $("#sit_tot_price").empty().html("<span>총 금액 </span><strong>" + number_format(String(total)) + "</strong> 원");
168
169                    $("#sit_tot_price").trigger("price_calculate", [total]);
170                } else {
171                    cached_function.apply(this, arguments); // use .apply() to call it
172                }
173                
174            };
175        }());
176    }   //end if check function
177
178});

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.