Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
woocommerce-table-rate-shipping
/
assets
/
js
:
settings.min.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
jQuery(document).ready(function($){"use strict";if(jQuery("#BETRS-method-options").on("click","a",function(c){c.preventDefault();var a=jQuery(this).attr("class"),b=jQuery(".betrs_settings_section");"expand"==a?b.each(function(a){$(this).find(".betrs_settings_inner").slideDown("fast")}):"collapse"==a&&b.each(function(a){$(this).find(".betrs_settings_inner").slideUp("fast")})}),void 0!=jQuery("#user_permissions.betrs_settings_section")){var a=jQuery("#user_permissions.betrs_settings_section table tbody tr");switch("everyone"==jQuery("#woocommerce_betrs_shipping_user_limitation").val()&&a.eq(1).css("display","none"),jQuery("#woocommerce_betrs_shipping_user_modification").val()){case"specific-users":a.eq(3).css("display","none");break;case"specific-roles":a.eq(4).css("display","none");break;default:a.eq(3).css("display","none"),a.eq(4).css("display","none")}}if(jQuery("#user_permissions.betrs_settings_section").on("change","#woocommerce_betrs_shipping_user_limitation",function(b){b.preventDefault();var c=$(this).val(),a=jQuery("#user_permissions.betrs_settings_section table tbody tr");"everyone"==c?a.eq(1).css("display","none"):a.eq(1).css("display","")}),jQuery("#user_permissions.betrs_settings_section").on("change","#woocommerce_betrs_shipping_user_modification",function(c){c.preventDefault();var b=$(this).val(),a=jQuery("#user_permissions.betrs_settings_section table tbody tr");a.eq(3).css("display","none"),a.eq(4).css("display","none"),"specific-roles"==b?a.eq(3).css("display",""):"specific-users"==b&&a.eq(4).css("display","")}),jQuery(document).on("click","#conditions.betrs_settings_section a.betrs_add_method_cond",function(b){b.preventDefault(),jQuery(this).block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var e=jQuery(this),a=jQuery(this).closest("td").find("table#method_conditions"),c=a.find("tr");if(1==a.length){var d={action:"betrs_add_method_condition",condID:c.length};$.post(ajaxurl,d,function(b){a.append(b),e.find(".blockUI").remove()})}}),jQuery(document).on("change","#conditions.betrs_settings_section select.method_cond",function(c){c.preventDefault();var a=jQuery(this),b=a.closest("tr"),d=a.val();b.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var e=b.index();$.post(ajaxurl,{action:"betrs_add_method_condition_extras",selected:d,condID:e},function(c){b.find(".cond_op_extras").length>0?b.find(".cond_op_extras").replaceWith(c):jQuery(a).parent().after(c),jQuery(document).trigger("betrs_update_options"),jQuery(document).trigger("betrs_update_datepickers"),b.find(".blockUI").remove(),b.trigger("wc-enhanced-select-init")})}),jQuery(document).on("click","#conditions.betrs_settings_section span.betrs_delete_method_cond",function(){return confirm(betrs_data.text_delete_confirmation)&&jQuery(this).closest("tr").remove(),!1}),void 0!=jQuery("#other.betrs_settings_section")){var a=jQuery("#other.betrs_settings_section table tbody"),b=a.find(".per-class-only");"per-class"!=jQuery("#woocommerce_betrs_shipping_condition").val()&&b.each(function(b,a){jQuery(a).closest("tr").css("display","none")})}function c(a){a.hasClass("open")?a.removeClass("open"):a.addClass("open")}function d(){jQuery(""),jQuery(".betrs_settings_section .single-row").each(function(a){op_number=a+1,jQuery(this).attr("data-row_id",op_number),jQuery(this).find(".shipping-headline").each(function(){jQuery(this).html(jQuery(this).html().replace(/(\d)+/,op_number))}),jQuery(this).find(".titlewrap input").each(function(){this.name=this.name.replace(/\[\d+\]/,"["+op_number+"]"),0==this.name.search("option_id")&&(this.value=op_number)}),(additional_box=jQuery(this).find(".additional-settings")).html(additional_box.html().replace(/\[\d+\]/g,"["+op_number+"]")),jQuery(this).find("table.table_rates tbody").children("tr").each(function(a){jQuery(this).find("td:not(:first-child, :last-child)").find("input,textarea,select").each(function(){this.name=this.name.replace(/\[\d+\]/,"["+op_number+"]")})})})}function e(b){b.preventDefault();var a=[],d=jQuery(this);if(jQuery(this).closest(".single-row").find(".wp-list-table.table_rates tbody tr th input:checked").each(function(d,b){var c=jQuery(b).closest("tr").find("input, select, textarea");a.push(c.serialize())}),0==a.length){alert(betrs_data.text_no_selection);return}var c='<div id="betrs-export-table-popup" class="betrs-popup"><div class="be-popup-container add_form"><h2>'+betrs_data.text_exporting+'</h2><p><img src="'+betrs_data.ajax_loader_url+'" alt="loading..." /></div></div>';return jQuery("body").append(c),f(),$.post(ajaxurl,{action:"betrs_export_table",rowsSelected:a},function(a){0==a?(jQuery("#betrs-export-table-popup").find("h2").text(betrs_data.text_error).addClass("betrs_error"),jQuery("#betrs-export-table-popup").find("h2").after("<p>"+betrs_data.text_error_server+"</p>"),jQuery("#betrs-export-table-popup").find("img").parent().remove(),setTimeout(function(){jQuery("#betrs-export-table-popup").remove()},3e3)):(d.attr("href","data:text/csv;base64,"+a),jQuery(".betrs_settings_section").off("click","a.betrs_table_export"),d[0].click(),jQuery("#betrs-export-table-popup").remove(),jQuery(".betrs_settings_section").on("click","a.betrs_table_export",e))}),!1}function f(){var a=jQuery(window).height();jQuery(".be-popup-container").css("max-height",a-180+"px")}jQuery("#general.betrs_settings_section").on("change","#woocommerce_betrs_shipping_condition",function(a){a.preventDefault(),"per-class"==$(this).val()?b.each(function(b,a){jQuery(a).closest("tr").css("display","")}):b.each(function(b,a){jQuery(a).closest("tr").css("display","none")})}),jQuery(".betrs_settings_section").on("click","h3",function(a){a.preventDefault(),c(jQuery(this)),$(this).next(".betrs_settings_inner").slideToggle("fast")}),jQuery(".betrs_settings_section").on("click",".next-link a",function(d){d.preventDefault();var a=jQuery(this).closest(".betrs_settings_inner"),b=jQuery(this).closest(".betrs_settings_section").next(".betrs_settings_section").find(".betrs_settings_inner");c(a.parent().find("h3")),a.slideUp("fast"),c(b.parent().find("h3")),b.slideDown("fast")}),jQuery(".betrs_settings_section").on("change",".operand_selector",function(d){d.preventDefault();var e=$(this).val(),a=jQuery(".volumetric_number").next(".description").find("span"),b=a.html();if("multiply"==e)var c=b.replace("/","x");else var c=b.replace("x","/");a.html(c)}),jQuery(".betrs_settings_section").on("click",".betrs-move-option-up",function(c){c.preventDefault();var a=jQuery(this).closest(".single-row"),b=a.prev(".single-row");return 0!==b.length&&(a.insertBefore(b),d()),!1}),jQuery(".betrs_settings_section").on("click",".betrs-move-option-down",function(c){c.preventDefault();var a=jQuery(this).closest(".single-row"),b=a.next(".single-row");return 0!==b.length&&(a.insertAfter(b),d()),!1}),jQuery(".betrs_settings_section").on("click","a.betrs_table_import",function(c){c.preventDefault();var b=jQuery(this).closest(".single-row").find(".wp-list-table.table_rates"),d=jQuery(this).closest(".single-row").attr("data-row_id"),a=b.find("tbody > tr").length;1==a&&b.find("tbody").children("tr:first").hasClass("no-items")&&a--;var e='<div id="betrs-import-table-popup" class="betrs-popup"><div class="be-popup-container add_form" id="betrs-import-table-form"><form method="post" enctype="multipart/form-data"><h3>'+betrs_data.text_importing_table+"</h3><p><span>"+betrs_data.text_importing_csv+'</span></p><input type="hidden" name="option_ID" id="option_ID" value="'+d+'" /><input type="hidden" name="row_ID" id="row_ID" value="'+a+'" /><p><input type="file" name="betrs_import_csv" id="betrs_import_csv" accept=".csv, text/csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" /></p><p><label><input type="checkbox" name="betrs_table_delete" id="betrs_table_delete" />'+betrs_data.text_importing_del+'</label></p><p><input type="submit" name="betrs_table_import" value="'+betrs_data.text_upload+'" class="form_submit" /> <a href="#" class="cancel">'+betrs_data.text_cancel+"</a></p></form></div></div>";jQuery("body").append(e),f()}),jQuery(document).on("submit","#betrs-import-table-form",function(d){d.preventDefault();var e=jQuery(this).find("input#option_ID").val(),g=jQuery(this).find("input#row_ID").val(),h=jQuery("#BETRS-table-rates-parent").find('.single-row[data-row_id="'+e+'"]').find(".wp-list-table.table_rates tbody"),i=jQuery(this).find("input#betrs_table_delete"),b=jQuery(this).find("input#betrs_import_csv");if(b.val()){var a=b[0].files[0],f=jQuery(this);if([".csv","text/csv","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"].indexOf(a.type)> -1||/(\.csv)$/i.test(a.name)){f.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var c=new FileReader;c.readAsText(a),c.onload=function(b){i.is(":checked")&&(h.find("tr").remove(),g=0),b.target.result;var c=$("#betrs-import-table-form form")[0],a=new FormData(c);a.append("betrs_import_csv",$("#betrs_import_csv").get(0).files),a.append("action","betrs_import_table"),a.append("rowID",g),$.ajax({type:"POST",enctype:"multipart/form-data",url:ajaxurl,data:a,processData:!1,contentType:!1,cache:!1,success:function(a){if(-1!=a.search("<tr"))h.append(a),$(document.body).trigger("wc-enhanced-select-init"),void 0!=h.find("tr.no-items")&&h.find("tr.no-items").remove(),jQuery("#betrs-import-table-popup").remove();else{var b=f.find("p span");b.text(betrs_data.text_error),b.css("color","#f44336"),f.find(".blockUI").remove()}},error:function(a){$("#result").text(a.responseText),console.log("ERROR : ",a),$("#btnSubmit").prop("disabled",!1)}})}}else jQuery(this).find('input[type="file"]').parent().css("border","1px solid #f44336")}else jQuery(this).find('input[type="file"]').parent().css("border","1px solid #f44336");return!1}),jQuery(window).on("resize",function(){f()}),jQuery(document).on("click",".be-popup-container .cancel",function(){return jQuery(".betrs-popup").remove(),!1})})