1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
!function(e){var t={};function i(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(n,a,function(t){return e[t]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=186)}({1:function(e,t){e.exports=jQuery},11:function(e,t,i){var n=i(3).default;e.exports=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!==n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},14:function(e,t,i){"use strict";(function(e,n){i.d(t,"a",(function(){return a}));var a=function(t){t.tooltip({content:function(){return e(this).prop("title")},tooltipClass:"edd-ui-tooltip",position:{my:"center top",at:"center bottom+10",collision:"flipfit"},hide:{duration:200},show:{duration:200}})};n(document).ready((function(e){a(e(".edd-help-tip"))}))}).call(this,i(1),i(1))},186:function(e,t,i){"use strict";i.r(t),function(e,t){var n=i(6),a=i(14),r=(i(187),{init:function(){this.add(),this.move(),this.remove(),this.type(),this.prices(),this.files(),this.updatePrices(),this.showAdvanced()},clone_repeatable:function(t){var i,n=1;t.parent().find(".edd_repeatable_row").each((function(){var t=e(this).data("key");parseInt(t)>n&&(n=t)})),i=n+=1;var r=t.clone();return r.removeClass("edd_add_blank"),r.attr("data-key",i),r.find("input, select, textarea").val("").each((function(){var t=e(this),n=t.attr("name"),a=t.attr("id");n&&(n=n.replace(/\[(\d+)\]/,"["+parseInt(i)+"]"),t.attr("name",n)),t.attr("data-key",i),void 0!==a&&(a=a.replace(/(\d+)/,parseInt(i)),t.attr("id",a))})),r.find("select").each((function(){e(this).val(t.find('select[name="'+e(this).attr("name")+'"]').val())})),r.find('input[type="checkbox"]').each((function(){e(this).is(":checked")&&e(this).prop("checked",!1),e(this).val(1)})),r.find("span.edd_price_id").each((function(){e(this).text(parseInt(i))})),r.find("input.edd_repeatable_index").each((function(){e(this).val(parseInt(e(this).data("key")))})),r.find("span.edd_file_id").each((function(){e(this).text(parseInt(i))})),r.find(".edd_repeatable_default_input").each((function(){e(this).val(parseInt(i)).removeAttr("checked")})),r.find(".edd_repeatable_condition_field").each((function(){e(this).find("option:eq(0)").prop("selected","selected")})),r.find("label").each((function(){var t=e(this).attr("for");t&&e(this).attr("for",t.replace(/(\d+)/,parseInt(i)))})),r.find(".search-choice").remove(),r.find(".chosen-container").remove(),Object(a.a)(r.find(".edd-help-tip")),r},add:function(){e(document.body).on("click",".edd_add_repeatable",(function(t){t.preventDefault();var i=e(this).closest(".edd_repeatable_table").find(".edd_repeatable_row").last(),a=r.clone_repeatable(i);a.insertAfter(i).find("input, textarea, select").filter(":visible").eq(0).focus(),a.find(".edd-select-chosen").each((function(){var t=e(this);t.chosen(Object(n.a)(t))})),a.find(".edd-select-chosen").css("width","100%"),a.find(".edd-select-chosen .chosen-search input").attr("placeholder",edd_vars.search_placeholder)}))},move:function(){e(".edd_repeatable_table .edd-repeatables-wrap").sortable({axis:"y",handle:".edd-draghandle-anchor",items:".edd_repeatable_row",cursor:"move",tolerance:"pointer",containment:"parent",distance:2,opacity:.7,scroll:!0,update:function(){var t=0;e(this).find(".edd_repeatable_row").each((function(){e(this).find("input.edd_repeatable_index").each((function(){e(this).val(t)})),t++}))},start:function(e,t){t.placeholder.height(t.item.height()-2)}})},remove:function(){e(document.body).on("click",".edd-remove-row, .edd_remove_repeatable",(function(t){t.preventDefault();var i,n=e(this).parents(".edd_repeatable_row"),a=n.parent().find(".edd_repeatable_row").length,r=e(this).data("type"),d="div.edd_repeatable_"+r+"s";if(i=(e(this).is(".ui-sortable .edd_repeatable_row:first-child .edd-remove-row, .ui-sortable .edd_repeatable_row:first-child .edd_remove_repeatable")?n.next(".edd_repeatable_row"):n.prev(".edd_repeatable_row")).find("select, input, textarea, button").filter(":visible").eq(0),"price"===r){var o=n.data("key");e('.edd_repeatable_condition_field option[value="'+o+'"]').remove()}if(a>1)e("input, select",n).val(""),n.fadeOut("fast").remove(),i.focus();else switch(r){case"price":alert(edd_vars.one_price_min);break;case"file":e("input, select",n).val("");break;default:alert(edd_vars.one_field_min)}e(d).each((function(t){e(this).find("input, select").each((function(){var i=e(this).attr("name");i=i.replace(/\[(\d+)\]/,"["+t+"]"),e(this).attr("name",i).attr("id",i)}))}))}))},type:function(){e(document.body).on("change","#_edd_product_type",(function(t){var i=e("#edd_products"),n=e("#edd_download_files"),a=e("#edd_download_limit_wrap");"bundle"===e(this).val()?(i.show(),n.hide(),a.hide()):(i.hide(),n.show(),a.show())}))},prices:function(){e(document.body).on("change","#edd_variable_pricing",(function(t){var i=e(this).is(":checked"),n=e("#edd_regular_price_field"),a=e("#edd_variable_price_fields, .edd_repeatable_table .pricing"),r=e(".edd-bundled-product-row, .edd-repeatable-row-standard-fields");i?(n.hide(),a.show(),r.addClass("has-variable-pricing")):(n.show(),a.hide(),r.removeClass("has-variable-pricing"))}))},files:function(){var t;window.formfield="",e(document.body).on("click",".edd_upload_file_button",(function(i){i.preventDefault();var n=e(this);window.formfield=n.closest(".edd_repeatable_upload_wrapper"),t||((t=wp.media.frames.file_frame=wp.media({title:n.data("uploader-title"),frame:"post",state:"insert",button:{text:n.data("uploader-button-text")},multiple:"0"!==e(this).data("multiple")})).on("menu:render:default",(function(e){e.unset("library-separator"),e.unset("gallery"),e.unset("featured-image"),e.unset("embed"),e.unset("playlist"),e.unset("video-playlist"),e.set({})})),t.on("insert",(function(){t.state().get("selection").each((function(t,i){var n="image"===(t=t.toJSON()).type&&e(".attachment-display-settings .size option:selected").val(),a=t.url,d=t.title.length>0?t.title:t.filename;if(n&&void 0!==t.sizes[n]&&(a=t.sizes[n].url),"image"===t.type&&(d=n&&void 0!==t.sizes[n]?d+"-"+t.sizes[n].width+"x"+t.sizes[n].height:d+"-"+t.width+"x"+t.height),0===i)window.formfield.find(".edd_repeatable_attachment_id_field").val(t.id),window.formfield.find(".edd_repeatable_thumbnail_size_field").val(n),window.formfield.find(".edd_repeatable_upload_field").val(a),window.formfield.find(".edd_repeatable_name_field").val(d);else{var o=window.formfield,l=r.clone_repeatable(o);l.find(".edd_repeatable_attachment_id_field").val(t.id),l.find(".edd_repeatable_thumbnail_size_field").val(n),l.find(".edd_repeatable_upload_field").val(a),l.find(".edd_repeatable_name_field").val(d),l.insertAfter(o)}}))}))),t.open()})),e(".edd_repeatable_upload_field").on("focus",(function(){var t=e(this);t.data("originalFile",t.val())})).on("change",(function(){var t=e(this);t.data("originalFile")!==t.val()&&t.closest(".edd-repeatable-row-standard-fields").find(".edd_repeatable_attachment_id_field").val(0)})),window.formfield=""},updatePrices:function(){e("#edd_price_fields").on("keyup",".edd_variable_prices_name",(function(){var t=e(this).parents(".edd_repeatable_row").data("key"),i=e(this).val(),n=e(".edd_repeatable_condition_field option[value="+t+"]");n.length>0?n.text(i):e(".edd_repeatable_condition_field").append(e("<option></option>").attr("value",t).text(i))}))},showAdvanced:function(){e(document.body).on("click",".toggle-custom-price-option-section",(function(t){t.preventDefault();var i=e(this),n=i.html()===edd_vars.show_advanced_settings;n?i.html(edd_vars.hide_advanced_settings):i.html(edd_vars.show_advanced_settings);var a=i.parents(".edd-repeatable-row-header");a.siblings(".edd-custom-price-option-sections-wrap").slideToggle(),e(":input:not(input[type=button],input[type=submit],button):visible:first",n?a.siblings(".edd-custom-price-option-sections-wrap"):a.siblings(".edd-repeatable-row-standard-fields")).focus()}))}});t(document).ready((function(e){r.init()}))}.call(this,i(1),i(1))},187:function(e,t,i){(function(e){e(document).ready((function(e){e("body").on("click","#the-list .editinline",(function(){var t=e(this).closest("tr").attr("id");t=t.replace("post-","");var i=e("#post-"+t).find(".column-price .downloadprice-"+t).val();i!==e("#post-"+t+".column-price .downloadprice-"+t).val()?e(".regprice","#edd-download-data").val(i).attr("disabled",!1):e(".regprice","#edd-download-data").val(edd_vars.quick_edit_warning).attr("disabled","disabled")})),e(document.body).on("click","#bulk_edit",(function(){var t=e("#bulk-edit"),i=new Array;t.find("#bulk-titles").children().each((function(){i.push(e(this).attr("id").replace(/^(ttle)/i,""))}));var n=e('#edd-download-data input[name="_edd_regprice"]').val(),a={action:"edd_save_bulk_edit",edd_bulk_nonce:i,post_ids:i,price:n};e.post(ajaxurl,a)}))}))}).call(this,i(1))},2:function(e,t,i){var n=i(7);e.exports=function(e,t,i){return(t=n(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports},3:function(e,t){function i(t){return e.exports=i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,i(t)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},6:function(e,t,i){"use strict";(function(e){i.d(t,"a",(function(){return l}));var n=i(2),a=i.n(n);function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function d(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){a()(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var o={disable_search_threshold:13,search_contains:!0,inherit_select_classes:!0,single_backstroke_delete:!1,placeholder_text_single:edd_vars.one_option,placeholder_text_multiple:edd_vars.one_or_more_option,no_results_text:edd_vars.no_results_text},l=function(t){!t instanceof e&&(t=e(t));var i=o;return t.data("search-type")&&delete i.disable_search_threshold,d(d({},i),{},{width:t.css("width")})}}).call(this,i(1))},7:function(e,t,i){var n=i(3).default,a=i(11);e.exports=function(e){var t=a(e,"string");return"symbol"===n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports}}); |