관리-도구
편집 파일: kkart_admin.min.js
!function(c,a){c(function(){var e,t,o,n,r;void 0!==a&&(t=(e=c(".edit-php.post-type-product")).find(".page-title-action:first"),0===e.find(".kkart-BlankState").length?(a.urls.export_products&&t.after('<a href="'+a.urls.export_products+'" class="page-title-action">'+a.strings.export_products+"</a>"),a.urls.import_products&&t.after('<a href="'+a.urls.import_products+'" class="page-title-action">'+a.strings.import_products+"</a>")):t.hide(),c(".kkart-progress-form-wrapper .button-next").on("click",function(){return c(".kkart-progress-form-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),!0}),c(document.body).on("kkart_add_error_tip",function(e,t,i){var o=t.position();0===t.parent().find(".kkart_error_tip").length&&(t.after('<div class="kkart_error_tip '+i+'">'+a[i]+"</div>"),t.parent().find(".kkart_error_tip").css("left",o.left+t.width()-t.width()/2-c(".kkart_error_tip").width()/2).css("top",o.top+t.height()).fadeIn("100"))}).on("kkart_remove_error_tip",function(e,t,i){t.parent().find(".kkart_error_tip."+i).fadeOut("100",function(){c(this).remove()})}).on("click",function(){c(".kkart_error_tip").fadeOut("100",function(){c(this).remove()})}).on("blur",".kkart_input_decimal[type=text], .kkart_input_price[type=text], .kkart_input_country_iso[type=text]",function(){c(".kkart_error_tip").fadeOut("100",function(){c(this).remove()})}).on("change",".kkart_input_price[type=text], .kkart_input_decimal[type=text], .kkart-order-totals #refund_amount[type=text]",function(){var e,t,i=a.decimal_point;(c(this).is(".kkart_input_price")||c(this).is("#refund_amount"))&&(i=a.mon_decimal_point),e=new RegExp("[^-0-9%\\"+i+"]+","gi"),t=new RegExp("\\"+i+"+","gi");var o=c(this).val(),i=o.replace(e,"").replace(t,i);o!==i&&c(this).val(i)}).on("keyup",".kkart_input_price[type=text], .kkart_input_decimal[type=text], .kkart_input_country_iso[type=text], .kkart-order-totals #refund_amount[type=text]",function(){var e,t=!1,i=c(this).is(".kkart_input_price")||c(this).is("#refund_amount")?(t=!0,n=new RegExp("[^-0-9%\\"+a.mon_decimal_point+"]+","gi"),e=new RegExp("[^\\"+a.mon_decimal_point+"]","gi"),"i18n_mon_decimal_error"):c(this).is(".kkart_input_country_iso")?(n=new RegExp("([^A-Z])+|(.){3,}","im"),"i18n_country_iso_error"):(t=!0,n=new RegExp("[^-0-9%\\"+a.decimal_point+"]+","gi"),e=new RegExp("[^\\"+a.decimal_point+"]","gi"),"i18n_decimal_error"),o=c(this).val(),n=o.replace(n,"");t&&1<n.replace(e,"").length&&(n=n.replace(e,"")),o!==n?c(document.body).triggerHandler("kkart_add_error_tip",[c(this),i]):c(document.body).triggerHandler("kkart_remove_error_tip",[c(this),i])}).on("change","#_sale_price.kkart_input_price[type=text], .kkart_input_price[name^=variable_sale_price]",function(){var e=c(this),t=-1!==e.attr("name").indexOf("variable")?e.parents(".variable_pricing").find(".kkart_input_price[name^=variable_regular_price]"):c("#_regular_price"),e=parseFloat(window.accounting.unformat(e.val(),a.mon_decimal_point));parseFloat(window.accounting.unformat(t.val(),a.mon_decimal_point))<=e&&c(this).val("")}).on("keyup","#_sale_price.kkart_input_price[type=text], .kkart_input_price[name^=variable_sale_price]",function(){var e=c(this),t=-1!==e.attr("name").indexOf("variable")?e.parents(".variable_pricing").find(".kkart_input_price[name^=variable_regular_price]"):c("#_regular_price"),e=parseFloat(window.accounting.unformat(e.val(),a.mon_decimal_point));parseFloat(window.accounting.unformat(t.val(),a.mon_decimal_point))<=e?c(document.body).triggerHandler("kkart_add_error_tip",[c(this),"i18n_sale_less_than_regular_error"]):c(document.body).triggerHandler("kkart_remove_error_tip",[c(this),"i18n_sale_less_than_regular_error"])}).on("init_tooltips",function(){c(".tips, .help_tip, .kkart-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),c(".column-kkart_actions .kkart-action-button").tipTip({fadeIn:50,fadeOut:50,delay:200}),c(".parent-tips").each(function(){c(this).closest("a, th").attr("data-tip",c(this).data("tip")).tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}).css("cursor","help")})}),c(document.body).trigger("init_tooltips"),c(".kkart_input_table.sortable tbody").sortable({items:"tr",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"kkart-metabox-sortable-placeholder",start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")}}),c(".kkart_input_table.sortable tbody input").on("click",function(){c(this).focus()}),c(".kkart_input_table .remove_rows").click(function(){var e=c(this).closest(".kkart_input_table").find("tbody");return 0<e.find("tr.current").length&&e.find("tr.current").each(function(){c(this).remove()}),!1}),r=n=o=!1,c(document.body).bind("keyup keydown",function(e){n=e.shiftKey,o=e.ctrlKey||e.metaKey}),c(".kkart_input_table").on("focus click","input",function(e){var t=c(this).closest("table, tbody"),i=c(this).closest("tr");("focus"===e.type&&r!==i.index()||"click"===e.type&&c(this).is(":focus"))&&(r=i.index(),n||o?n?(c("tr",t).removeClass("current"),i.addClass("selected_now").addClass("current"),0<c("tr.last_selected",t).length&&(i.index()>c("tr.last_selected",t).index()?c("tr",t).slice(c("tr.last_selected",t).index(),i.index()):c("tr",t).slice(i.index(),c("tr.last_selected",t).index()+1)).addClass("current"),c("tr",t).removeClass("last_selected"),i.addClass("last_selected")):(c("tr",t).removeClass("last_selected"),o&&c(this).closest("tr").is(".current")?i.removeClass("current"):i.addClass("current").addClass("last_selected")):(c("tr",t).removeClass("current").removeClass("last_selected"),i.addClass("current").addClass("last_selected")),c("tr",t).removeClass("selected_now"))}).on("blur","input",function(){r=!1}),c(".kkart_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)").addClass("alternate"),c(document.body).on("click",".show_order_items",function(){return c(this).closest("td").find("table").toggle(),!1}),c("select.availability").change(function(){"all"===c(this).val()?c(this).closest("tr").next("tr").hide():c(this).closest("tr").next("tr").show()}).change(),c(".hide_options_if_checked").each(function(){c(this).find("input:eq(0)").change(function(){c(this).is(":checked")?c(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide():c(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show()}).change()}),c(".show_options_if_checked").each(function(){c(this).find("input:eq(0)").change(function(){c(this).is(":checked")?c(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show():c(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide()}).change()}),c("input#kkart_enable_reviews").change(function(){c(this).is(":checked")?c("#kkart_enable_review_rating").closest("tr").show():c("#kkart_enable_review_rating").closest("tr").hide()}).change(),c("table.attributes-table tbody tr:nth-child(odd)").addClass("alternate"),c(".kkart_gateways").on("click",".kkart-payment-gateway-method-toggle-enabled",function(){var t=c(this),e=t.closest("tr"),i=t.find(".kkart-input-toggle"),e={action:"kkart_toggle_gateway_enabled",security:a.nonces.gateway_toggle,gateway_id:e.data("gateway_id")};return i.addClass("kkart-input-toggle--loading"),c.ajax({url:a.ajax_url,data:e,dataType:"json",type:"POST",success:function(e){!0===e.data?(i.removeClass("kkart-input-toggle--enabled, kkart-input-toggle--disabled"),i.addClass("kkart-input-toggle--enabled"),i.removeClass("kkart-input-toggle--loading")):!1===e.data?(i.removeClass("kkart-input-toggle--enabled, kkart-input-toggle--disabled"),i.addClass("kkart-input-toggle--disabled"),i.removeClass("kkart-input-toggle--loading")):"needs_setup"===e.data&&(window.location.href=t.attr("href"))}}),!1}),c("#wpbody").on("click","#doaction, #doaction2",function(){if("remove_personal_data"===(c(this).is("#doaction")?c("#bulk-action-selector-top"):c("#bulk-action-selector-bottom")).val())return window.confirm(a.i18n_remove_personal_data_notice)}))})}(jQuery,kkart_admin);