woocommerce/assets/js/admin/settings.min.js

1 line
2.0 KiB
JavaScript

jQuery(window).load(function(){jQuery("select#woocommerce_allowed_countries, select#woocommerce_ship_to_countries").change(function(){if(jQuery(this).val()=="specific"){jQuery(this).parent().parent().next("tr").show()}else{jQuery(this).parent().parent().next("tr").hide()}}).change();jQuery(".colorpick").iris({change:function(e,t){jQuery(this).css({backgroundColor:t.color.toString()})},hide:true,border:true}).each(function(){jQuery(this).css({backgroundColor:jQuery(this).val()})}).click(function(){jQuery(".iris-picker").hide();jQuery(this).closest(".color_box, td").find(".iris-picker").show()});jQuery("body").click(function(){jQuery(".iris-picker").hide()});jQuery(".color_box, .colorpick").click(function(e){e.stopPropagation()});jQuery(function(){var e=false;jQuery("input, textarea, select, checkbox").change(function(){e=true});jQuery(".woo-nav-tab-wrapper a").click(function(){if(e){window.onbeforeunload=function(){return woocommerce_settings_params.i18n_nav_warning}}else{window.onbeforeunload=""}});jQuery(".submit input").click(function(){window.onbeforeunload=""})});jQuery("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td",scrollSensitivity:40,helper:function(e,t){t.children().each(function(){jQuery(this).width(jQuery(this).width())});t.css("left","0");return t},start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")}});jQuery("select.chosen_select").chosen({width:"350px",disable_search_threshold:5});jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true",width:"350px",disable_search_threshold:5});jQuery(".woocommerce").on("click",".select_all",function(){jQuery(this).closest("td").find("select option").attr("selected","selected");jQuery(this).closest("td").find("select").trigger("chosen:updated");return false});jQuery(".woocommerce").on("click",".select_none",function(){jQuery(this).closest("td").find("select option").removeAttr("selected");jQuery(this).closest("td").find("select").trigger("chosen:updated");return false})})