PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.8.3
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.8.3
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / assets / js / admin / admin.min.js

admin.min.js in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.8.3, at assets/js/admin/admin.min.js

1 lines 18.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";!function(d,c,o){var s={};d(o).ready(function(){var e=d(".merchant-module-page-ajax-form"),a=d(".merchant-module-page-ajax-header");d(".merchant-module-save-button");d(".merchant-module-page-content").on("change keypress change.merchant",":input:not(.merchant-module-question-answer-textarea):not(.merchant-license-code-input)",function(){s.show_save||(a.addClass("merchant-show"),a.removeClass("merchant-saving"),s.show_save=!0)}),e.ajaxForm({beforeSubmit:function(){a.addClass("merchant-saving")},success:function(){var t;a.removeClass("merchant-show"),s.show_save=!1,d(".merchant-module-action").hasClass("merchant-enabled")||((t=d(".merchant-module-alert")).addClass("merchant-show"),d(o).off("click.merchant-alert-close"),d(o).on("click.merchant-alert-close",function(e){d(e.target).closest(".merchant-module-alert-wrapper").length||(t.removeClass("merchant-show"),d(o).off("click.merchant-alert-close"))}))}}),d(".merchant-module-question-answer-button").on("click",function(e){e.preventDefault();var e=d(this),t=d(".merchant-module-question-answer-textarea");d(".merchant-module-question-answer-dropdown").removeClass("merchant-show"),d(".merchant-module-question-thank-you-dropdown").addClass("merchant-show"),c.wp.ajax.post("merchant_module_feedback",{subject:t.data("subject"),message:t.val(),module:e.closest(".merchant-module-action").find(".merchant-module-page-button-action-activate").data("module"),nonce:c.merchant.nonce})}),d(".merchant-module-page-button-action-activate").on("click",function(e){e.preventDefault(),d(".merchant-module-question-list-dropdown").removeClass("merchant-show"),d(".merchant-module-question-answer-dropdown").removeClass("merchant-show"),d(".merchant-module-question-answer-form").removeClass("merchant-show"),d(".merchant-module-question-answer-title").removeClass("merchant-show"),d(".merchant-module-question-thank-you-dropdown").removeClass("merchant-show"),d(".merchant-module-question-answer-textarea").val(""),c.wp.ajax.post("merchant_module_activate",{module:d(this).data("module"),nonce:c.merchant.nonce}).done(function(){d("body").removeClass("merchant-module-disabled").addClass("merchant-module-enabled"),d(".merchant-module-action").addClass("merchant-enabled")})}),d(".merchant-module-page-button-action-deactivate").on("click",function(e){e.preventDefault(),c.wp.ajax.post("merchant_module_deactivate",{module:d(this).data("module"),nonce:c.merchant.nonce}).done(function(){d("body").removeClass("merchant-module-enabled").addClass("merchant-module-disabled"),d(".merchant-module-action").removeClass("merchant-enabled"),d(".merchant-module-question-list-dropdown").addClass("merchant-show")})}),d(".merchant-module-question-list-dropdown li").on("click",function(e){var t=d(this),a=t.data("answer-target"),a=d('[data-answer-title="'+a+'"]');a.length?(a.addClass("merchant-show").siblings().removeClass("merchant-show"),d(".merchant-module-question-answer-dropdown").addClass("merchant-show"),d(".merchant-module-question-answer-textarea").attr("data-subject",t.text().trim())):(d(".merchant-module-question-thank-you-dropdown").addClass("merchant-show"),d(".merchant-module-question-answer-dropdown").removeClass("merchant-show")),d(".merchant-module-question-answer-textarea").val(""),d(".merchant-module-question-list-dropdown").removeClass("merchant-show")}),d(".merchant-module-dropdown-close").on("click",function(e){e.preventDefault(),d(this).closest(".merchant-module-dropdown").removeClass("merchant-show")}),d(".merchant-module-page-button-deactivate").on("click",function(e){e.preventDefault();d(this);var t=d(".merchant-module-deactivate-dropdown");t.toggleClass("merchant-show"),d(o).off("click.merchant-close"),d(o).on("click.merchant-close",function(e){d(e.target).closest(".merchant-module-deactivate").length||(t.removeClass("merchant-show"),d(o).off("click.merchant-close"))})}),d(".merchant-range").each(function(){var e=d(this),n=e.find(".merchant-range-input"),i=e.find(".merchant-range-number-input");n.on("change input merchant.range merchant-init.range",function(e){var t=d(this),e=("merchant"===e.type?i:t).val()||0,a=t.attr("min")||0,a=(e-a)/((t.attr("max")||1)-a)*100;t.css({background:"linear-gradient(to right, #3858E9 0%, #3858E9 "+a+"%, #ddd "+a+"%, #ddd 100%)"}),n.val(e),i.val(e)}).trigger("merchant-init.range"),i.on("change input blur",function(){n.hasClass("merchant-range-input")&&n.val(d(this).val()).trigger("merchant.range")})}),{init:function(e){this.events()},events:function(){var a=this;d(".merchant-sortable").each(function(){var e=d(this),t=e.find(".merchant-sortable-input");d(e.find("ul.merchant-sortable-list").first()).sortable({update:function(){t.val(a.sortableGetNewVal(e)).trigger("change.merchant")}}).disableSelection().find("li").each(function(){d(this).find("i.visibility").click(function(){d(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){d(event.target).hasClass("dashicons-visibility")&&t.val(a.sortableGetNewVal(e)).trigger("change.merchant")})})},sortableGetNewVal:function(e){var e=d(e.find("li")),t=[];return _.each(e,function(e){d(e).hasClass("invisible")||t.push(d(e).data("value"))}),JSON.stringify(t)}}.init(),{init:function(e){var n=this;d(".merchant-sortable-repeater-control").each(function(){var e=JSON.parse(d(this).find(".merchant-sortable-repeater-input").val()),t=e.length;if(0<t&&(d(this).find(".repeater-input").val(e[0]),1<t))for(var a=1;a<t;++a)n.appendRow(d(this),e[a]);d(this).hasClass("disable-sorting")||d(this).find(".merchant-sortable-repeater.sortable").sortable({update:function(e,t){n.getAllInputs(d(this).parent())}})}),this.events()},events:function(){var t=this;d(".merchant-sortable-repeater.sortable").on("click",".customize-control-sortable-repeater-delete",function(e){e.preventDefault(),1<d(this).parent().parent().find(".repeater").length?d(this).parent().slideUp("fast",function(){var e=d(this).parent().parent();d(this).remove(),t.getAllInputs(e)}):t.getAllInputs(d(this).parent().parent().parent())}),d(".customize-control-sortable-repeater-add").click(function(e){e.preventDefault(),t.appendRow(d(this).parent()),t.getAllInputs(d(this).parent())}),d(".merchant-sortable-repeater.sortable").change(function(){t.getAllInputs(d(this).parent())}),d(".merchant-sortable-repeater.sortable").on("focusout",".repeater-input",function(){t.getAllInputs(d(this).parent())})},appendRow:function(e){var t='<div class="repeater" style="display:none"><input type="text" value="'+(1<arguments.length&&void 0!==arguments[1]?arguments[1]:"")+'" class="repeater-input" /><span class="dashicons dashicons-menu"></span><a class="customize-control-sortable-repeater-delete" href="#"><span class="dashicons dashicons-no-alt"></span></a></div>';e.find(".sortable").append(t),e.find(".sortable").find(".repeater:last").slideDown("slow",function(){d(this).find("input").focus()})},getAllInputs:function(e){var t=e.find(".repeater-input").map(function(){return d(this).val()}).toArray();e.find(".merchant-sortable-repeater-input").val(JSON.stringify(t)),e.find(".merchant-sortable-repeater-input").trigger("change")}}.init(),{init:function(e){var n=this;d(".merchant-flexible-content-control").each(function(){var a=d(this).find(".merchant-flexible-content");a.sortable({axis:"y",cursor:"move",helper:"original",handle:".customize-control-flexible-content-move",stop:function(e,t){a.trigger("merchant.sorted"),n.refreshNumbers(a)}})}),this.events()},events:function(){var a=this;d(".customize-control-flexible-content-add-button").click(function(e){e.preventDefault(),e.stopImmediatePropagation(),d(this).parent().find(".customize-control-flexible-content-add-list").toggleClass("active")}),d(".customize-control-flexible-content-add").click(function(e){e.preventDefault(),e.stopImmediatePropagation();var e=d(".merchant-flexible-content-control[data-id="+d(this).data("id")+"]"),t=e.find(".layouts"),a=d(this).data("layout"),t=t.find(".layout[data-type="+a+"]").clone(!0),a=e.find(".merchant-flexible-content"),n=a.find(".layout");t.find("input, select").each(function(){d(this).data("name")&&d(this).attr("name",d(this).data("name").replace("0",n.length))}),t.find(".layout-count").text(n.length+1),a.append(t),a.removeClass("empty"),d(this).parent().removeClass("active"),t.find(".merchant-module-page-setting-field-upload").length&&i(t.find(".merchant-module-page-setting-field-upload")),t.find(".merchant-module-page-setting-field-select_ajax").length&&r(t.find(".merchant-module-page-setting-field-select_ajax")),d(o).trigger("merchant-flexible-content-added",[t])}),d(".customize-control-flexible-content-delete").click(function(e){e.preventDefault();var e=d(this).closest(".layout"),t=e.parent();e.remove(),0===t.find(".layout").length&&t.addClass("empty"),a.refreshNumbers(t),d(o).trigger("merchant-flexible-content-deleted",[e])})},refreshNumbers:function(e){e.find(".layout").each(function(e){var t=d(this).find(".layout-count").text(),a=parseInt(t)-1;d(this).find(".layout-count").text(e+1),d(this).find("input, select").each(function(){d(this).attr("name")&&d(this).attr("name",d(this).attr("name").replace("["+a+"]","[*refreshed*"+e+"]"))})}),e.find(".layout").each(function(e){d(this).find("input, select").each(function(){d(this).attr("name",d(this).attr("name").replace("*refreshed*",""))})}),e.parent().find("input").trigger("change.merchant")}}.init(),d(o).on("merchant-admin-check-fields merchant-flexible-content-added",function(){d(".merchant-module-page-setting-field").each(function(){var e=d(this);if(e.data("condition")&&e.data("condition").length){var t=e.data("condition"),a=d(this).closest(".layout-body").find('input[name*="'+t[0]+'"],select[name*="'+t[0]+'"]');if((a=a.length?a:d('input[name="merchant['+t[0]+']"],select[name="merchant['+t[0]+']"]')).length){var n=!1;switch(t[1]){case"==":"radio"!==a.attr("type")&&"checkbox"!==a.attr("type")||a.is(":checked")&&a.val()==t[2]&&(n=!0),a.is("select")&&a.val()==t[2]&&(n=!0);break;case"any":"radio"!==a.attr("type")&&"checkbox"!==a.attr("type")||a.is(":checked")&&t[2].split("|").includes(a.val())&&(n=!0),a.is("select")&&t[2].split("|").includes(a.val())&&(n=!0)}n?e.removeClass("merchant-hide").addClass("merchant-show"):e.removeClass("merchant-show").addClass("merchant-hide")}}})}).trigger("merchant.change"),d(o).on("change",".merchant-module-page-setting-field",function(){d(o).trigger("merchant-admin-check-fields")}).trigger("merchant.change"),d(o).trigger("merchant-admin-check-fields"),d(o).on("merchant-admin-check-color-fields merchant-flexible-content-added",function(){d(".merchant-color").each(function(){var a,e=d(this),n=e.find(".merchant-color-picker"),i=e.find(".merchant-color-input"),r=!1;n.off("click").on("click",function(e){e.preventDefault(),e.stopPropagation();var t=d("body,html");t.addClass("merchant-height-auto"),r?a.setColor(i.val()):((a=new Pickr({el:n.get(0),container:"body",theme:"merchant",appClass:"merchant-pcr-app",default:i.val()||n.data("default-color")||"#212121",swatches:["#000000","#F44336","#E91E63","#673AB7","#03A9F4","#8BC34A","#FFEB3B","#FFC107","#FFFFFF"],sliders:"h",useAsButton:!0,components:{hue:!0,preview:!0,opacity:!0,interaction:{input:!0,clear:!0}},i18n:{"btn:clear":"Default"}})).on("change",function(e){e=(1===e.a?(a.setColorRepresentation("HEX"),e.toHEXA()):(a.setColorRepresentation("RGBA"),e.toRGBA())).toString(0);n.css({"background-color":e}),i.val()!==e&&i.val(e).trigger("change.merchant")}),a.on("clear",function(){var e=n.data("default-color");e?a.setColor(e):(n.css({"background-color":"white"}),i.val(""))}),a.on("hide",function(){t.removeClass("merchant-height-auto")}),n.data("pickr",a),setTimeout(function(){a.show()},200),r=!0)}),i.on("change keyup",function(){var e=d(this).val();n.css({"background-color":e})})})}),d(o).trigger("merchant-admin-check-color-fields");({init:function(){this.events()},events:function(){var l=this;d(o).on("click",".merchant-create-page-control-button",function(e){e.preventDefault();var t=d(this),a=t.parent().find(".merchant-create-page-control-create-message"),n=t.parent().find(".merchant-create-page-control-success-message"),e=(t.text(),t.data("creating-text")),i=(t.data("created-text"),t.data("page-title")),r=t.data("page-meta-key"),o=t.data("page-meta-value"),c=t.data("option-name"),s=t.data("nonce");if(!i)return!1;d(this).text(e),d(this).attr("disabled",!0),d.ajax({type:"post",url:ajaxurl,data:{action:"merchant_create_page_control",page_title:i,page_meta_key:r,page_meta_value:o,option_name:c,nonce:s},success:function(e){l.ajaxResponseHandler(e,t,n,a)}})})},ajaxResponseHandler:function(e,t,a,n){"success"===e.status&&(e=a.find("a").attr("href").replace("?post=&","?post="+e.page_id+"&"),a.find("a").attr("href",e),a.css("display","block"),n.remove(),t.remove())}}).init(),d(".merchant-module-page-setting-field-gallery").each(function(){var n,i=d(this),e=i.find(".merchant-gallery-button"),r=i.find(".merchant-gallery-input"),o=i.find(".merchant-gallery-images"),t=i.find(".merchant-gallery-remove");o.sortable({helper:"original",update:function(e,t){var a=[];o.find(".merchant-gallery-image").each(function(){a.push(d(this).data("item-id"))}),r.val(a.join(",")).trigger("change")}});t.on("click",function(e){e.preventDefault(),d(this).parent().remove();var t=[];o.find(".merchant-gallery-image").each(function(){t.push(d(this).data("item-id"))}),r.val(t.join(",")).trigger("change")}),e.on("click",function(e){d(this);var t=r.val(),a=t?"edit":"add";e.preventDefault(),void 0!==c.wp&&c.wp.media&&c.wp.media.gallery&&("add"==a?(n=c.wp.media({library:{type:"image"},frame:"post",state:"gallery",multiple:!0})).open():n=c.wp.media.gallery.edit('[gallery ids="'+t+'"]'),n.on("update",function(e){o.empty();e=e.models.map(function(e){var e=e.toJSON(),t=(e.sizes&&e.sizes.thumbnail&&e.sizes.thumbnail.url?e.sizes.thumbnail:e).url;return o.append('<div class="merchant-gallery-image" data-item-id="'+e.id+'"><i class="merchant-gallery-remove dashicons dashicons-no-alt"></i><img src="'+t+'" /></div>'),e.id});r.val(e.join(",")).trigger("change"),i.find(".merchant-gallery-remove").on("click",function(e){e.preventDefault(),d(this).parent().remove();var t=[];o.find(".merchant-gallery-image").each(function(){t.push(d(this).data("item-id"))}),r.val(t.join(",")).trigger("change")})}))})});var i=function(e){var a,n=e,e=n.find(".merchant-upload-button"),i=n.find(".merchant-upload-input"),r=n.find(".merchant-upload-wrapper");n.find(".merchant-upload-remove").on("click",function(e){e.preventDefault(),d(this).parent().remove(),i.val("").trigger("change")}),e.on("click",function(e){e.preventDefault(),void 0!==c.wp&&c.wp.media&&((a=a||c.wp.media({library:{type:"image"}})).open(),a.on("select",function(){r.empty();var e=a.state().get("selection").first().attributes,t=(e.sizes&&e.sizes.thumbnail&&e.sizes.thumbnail.url?e.sizes.thumbnail:e).url;r.append('<div class="merchant-upload-image"><i class="merchant-upload-remove dashicons dashicons-no-alt"></i><img src="'+t+'" /></div>'),i.val(e.id).trigger("change"),n.find(".merchant-upload-remove").on("click",function(e){e.preventDefault(),d(this).parent().remove(),i.val("").trigger("change")})}))})},r=(d(".merchant-module-page-setting-field-upload:not(.template)").each(function(){i(d(this))}),function(e){var t=e.find("select"),a=t.data("source"),n=c.merchant_admin_options,i={width:"100%"};"post"!==a&&"product"!==a||(i.minimumInputLength=1,i.ajax={url:n.ajaxurl,dataType:"json",delay:250,cache:!0,data:function(e){return{action:"merchant_admin_options_select_ajax",nonce:n.ajaxnonce,term:e.term,source:a}},processResults:function(e,t){return e.success?{results:e.data}:{}}}),t.select2(i),e.find(".select2-selection--multiple").append('<span class="merchant-select2-clear"></span>')}),n=(d(".merchant-module-page-setting-field-select_ajax:not(.template)").each(function(){r(d(this))}),d(".merchant-module-page-settings-responsive").each(function(){var e=d(this),a=e.find(".merchant-module-page-settings-devices button"),n=e.find(".merchant-module-page-settings-device-container");a.on("click",function(e){e.preventDefault();var t=d(this).data("device");a.removeClass("active"),n.removeClass("active"),d(this).addClass("active"),n.each(function(){d(this).data("device")===t&&d(this).addClass("active")})})}),d(".merchant-animated-buttons").each(function(){var e,t,a=d(this).find("label"),n=d(".merchant-animation-demo");a.on("click",function(){n.removeClass("merchant-animation-"+e),n.removeClass("merchant-animation-"+t),e=d(this).find("input").attr("value"),setTimeout(function(){n.addClass("merchant-animation-"+e)},100),setTimeout(function(){n.removeClass("merchant-animation-"+e)},1e3)}),a.mouseover(function(){n.removeClass("merchant-animation-"+e),t=d(this).find("input").attr("value"),n.addClass("merchant-animation-"+t)}).mouseout(function(){n.removeClass("merchant-animation-"+t)})}),d(".merchant-notifications-sidebar")),e=(n.length&&(d(".merchant-notifications").on("click",function(e){e.preventDefault();var t=d(this),e=n.find(".merchant-notification:first-child .merchant-notification-date").data("raw-date");n.toggleClass("opened"),t.hasClass("read")||d.post(c.merchant.ajax_url,{action:"merchant_notifications_read",nonce:c.merchant.nonce,latest_notification_date:e},function(e){e.success&&setTimeout(function(){t.addClass("read")},2e3)})}),d(c).on("scroll",function(){60<c.pageYOffset&&(n.addClass("closing"),setTimeout(function(){n.removeClass("opened"),n.removeClass("closing")},300))}),d(".merchant-notifications-sidebar-close").on("click",function(e){e.preventDefault(),n.addClass("closing"),setTimeout(function(){n.removeClass("opened"),n.removeClass("closing")},300)})),d(".merchant-tabs-nav")),t=(e.length&&e.each(function(){var a=d(this).data("tab-wrapper-id");d(this).find(".merchant-tabs-nav-link").on("click",function(e){e.preventDefault();var e=d(this).closest(".merchant-tabs-nav").find(".merchant-tabs-nav-link"),t=d(this).data("tab-to"),e=(e.each(function(){d(this).closest(".merchant-tabs-nav-item").removeClass("active")}),d(this).closest(".merchant-tabs-nav-item").addClass("active"),d('.merchant-tab-content-wrapper[data-tab-wrapper-id="'+a+'"]'));e.find("> .merchant-tab-content").removeClass("active"),e.find('> .merchant-tab-content[data-tab-content-id="'+t+'"]').addClass("active")})}),d(".merchant-module-alert"));t.length&&t.find(".merchant-module-alert-close").on("click",function(e){e.preventDefault(),t.removeClass("merchant-show"),d(o).off("click.merchant-alert-close")})})}(jQuery,window,document);