PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.2.8
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.2.8
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 / modules / side-cart / admin / preview.min.js

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

1 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function _typeof(e){return(_typeof="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)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var l=0;l<t.length;l++){var r=t[l];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,l){return t&&_defineProperties(e.prototype,t),l&&_defineProperties(e,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var l=e[Symbol.toPrimitive];if(void 0===l)return("string"===t?String:Number)(e);l=l.call(e,t||"default");if("object"!=_typeof(l))return l;throw new TypeError("@@toPrimitive must return a primitive value.")}(n=>{var e=(()=>_createClass(function e(){_classCallCheck(this,e),this.init()},[{key:"init",value:function(){this.preview(),this.events(),this.flexibleContentLabel()}},{key:"preview",value:function(){n(document).on("change",".merchant-field-slide_direction input",function(){n(this).is(":checked")&&n(".merchant-side-cart").removeClass("slide-left slide-right").addClass("slide-"+n(this).val())})}},{key:"events",value:function(){n(document).on("change keyup merchant.change",".merchant-module-page-setting-fields",this.flexibleContentLabel.bind(this))}},{key:"flexibleContentLabel",value:function(){var s=this;this.cartUpsellsToggleState()&&"custom_upsell"===this.cartUpsellType()&&n(".merchant-field-custom_upsells .merchant-flexible-content .layout").each(function(){var e=n(this),t=s.customUpsellTrigger(e),l=s.customUpsellCategories(e),r=s.customUpsellProducts(e);"categories"===t&&s.updateGroupLabel(e,"categories",l.length,l),"products"===t&&s.updateGroupLabel(e,"products",r.length,r),"all"===t&&s.updateGroupLabel(e,"all",10,[])})}},{key:"upsellsLabelBadge",value:function(e){if("products"===e.find(".merchant-field-custom_upsell_type select").val()){e=e.find(".merchant-field-upsells_product_ids .merchant-selected-products-preview li");if(e.length)return'<span class="merchant-upsells-badge">Upsells: '.concat(e.length,"</span>")}return""}},{key:"updateGroupLabel",value:function(e,t,l,r){var s=e.find(".layout-title");"categories"===t&&(1<l?s.html(merchant_side_cart_params.keywords.multi_categories+this.upsellsLabelBadge(e)):1===l?s.html(merchant_side_cart_params.keywords.category_trigger+" "+r[0]+this.upsellsLabelBadge(e)):s.html(merchant_side_cart_params.keywords.no_cats_selected+this.upsellsLabelBadge(e))),"products"===t&&(1<l?s.html(merchant_side_cart_params.keywords.multi_products+this.upsellsLabelBadge(e)):1===l?s.html(r[0].name+" (#"+r[0].id+")"+this.upsellsLabelBadge(e)):s.html(merchant_side_cart_params.keywords.no_products_selected+this.upsellsLabelBadge(e))),"all"===t&&s.html(merchant_side_cart_params.keywords.all_products+this.upsellsLabelBadge(e))}},{key:"customUpsellTrigger",value:function(e){return e.find(".merchant-field-upsell_based_on select").val()}},{key:"customUpsellProducts",value:function(e){var e=e.find(".merchant-field-product_ids .merchant-selected-products-preview li"),t=[];return e.each(function(){t.push({id:n(this).data("id"),name:n(this).data("name"),element:n(this)})}),t}},{key:"customUpsellCategories",value:function(e){return e.find(".merchant-field-category_slugs select").find("option:selected").map(function(){return n(this).text().trim()}).get()}},{key:"cartUpsellsToggleState",value:function(){return!!n(".merchant-field-use_upsells input").is(":checked")}},{key:"cartUpsellType",value:function(){return n(".merchant-field-upsells_type select").val()}}]))();n(document).ready(function(){new e})})(jQuery);