PageSourceSearch

http://hiart.net/js/shop.override.js

js hiart.net collected 2026-10-06 14:03:50 UTC 6,992 bytes, 170 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 += "</div>";
83                    opt += "<div class=\"opt_count\">";
84                    opt += "<button type=\"button\" class=\"sit_qty_minus\"><i class=\"fa fa-minus\" aria-hidden=\"true\"></i><span class=\"sound_only\">감소</span></button>";
85                    opt += "<input type=\"text\" name=\"ct_qty["+item_code+"][]\" value=\"1\" class=\"num_input\" size=\"5\">";
86                    opt += "<button type=\"button\" class=\"sit_qty_plus\"><i class=\"fa fa-plus\" aria-hidden=\"true\"></i><span class=\"sound_only\">증가</span></button>";
87                    opt += "<span class=\"sit_opt_prc\">"+opt_prc+"</span>";
88                    opt += "<button type=\"button\" class=\"sit_opt_del\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i><span class=\"sound_only\">삭제</span></button></div>";
89                    opt += "</li>";
90
91                    if($("#sit_sel_option > ul").size() < 1) {
92                        $("#sit_sel_option").html("<ul id=\"sit_opt_added\"></ul>");
93                        $("#sit_sel_option > ul").html(opt);
94                    } else{
95                        if(type) {
96                            if($("#sit_sel_option .sit_spl_list").size() > 0) {
97                                $("#sit_sel_option .sit_spl_list:last").after(opt);
98                            } else {
99                                if($("#sit_sel_option .sit_opt_list").size() > 0) {
100                                    $("#sit_sel_option .sit_opt_list:last").after(opt);
101                                } else {
102                                    $("#sit_sel_option > ul").html(opt);
103                                }
104                            }
105                        } else {
106                            if($("#sit_sel_option .sit_opt_list").size() > 0) {
107                                $("#sit_sel_option .sit_opt_list:last").after(opt);
108                            } else {
109                                if($("#sit_sel_option .sit_spl_list").size() > 0) {
110                                    $("#sit_sel_option .sit_spl_list:first").before(opt);
111                                } else {
112                                    $("#sit_sel_option > ul").html(opt);
113                                }
114                            }
115                        }
116                    }
117
118                    price_calculate();
119
120                } else {
121
122                    cached_function.apply(this, arguments); // use .apply() to call it
123
124                }   //end if
125
126            };
127        }());
128    }   //end if check function
129
130    if (typeof price_calculate === "function") {
131        price_calculate = (function() {
132            var cached_function = price_calculate;
133
134            return function() {
135                
136                if( $(".2017_renewal_itemform").length ){
137
138                    var it_price = parseInt($("input#it_price").val());
139
140                    if(isNaN(it_price))
141                        return;
142
143                    var $el_prc = $("input.io_price");
144                    var $el_qty = $("input[name^=ct_qty]");
145                    var $el_type = $("input[name^=io_type]");
146                    var price, type, qty, total = 0;
147
148                    $el_prc.each(function(index) {
149                        price = parseInt($(this).val());
150                        qty = parseInt($el_qty.eq(index).val());
151                        type = $el_type.eq(index).val();
152
153                        if(type == "0") { // 선택옵션
154                            total += (it_price + price) * qty;
155                        } else { // 추가옵션
156                            total += price * qty;
157                        }
158                    });
159
160                    $("#sit_tot_price").empty().html("<span>총 금액 </span><strong>"+number_format(String(total))+"</strong> 원");
161
162                } else {
163                    cached_function.apply(this, arguments); // use .apply() to call it
164                }
165                
166            };
167        }());
168    }   //end if check function
169
170});

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.