bopo-frontend.js
3 years ago
bopo-frontend.min.js
3 years ago
bopo-product.js
2 weeks ago
bopo-product.min.js
3 years ago
bopo-settings.js
4 years ago
bopo-settings.min.js
4 years ago
dropdown.min.js
4 years ago
select2.js
4 years ago
select2.min.js
4 years ago
shortcode-scripts.js
3 years ago
shortcode-scripts.min.js
4 years ago
transition.min.js
4 years ago
shortcode-scripts.js
46 lines
| 1 | jQuery(window).on('elementor/frontend/init', () => { |
| 2 | 'use strict'; |
| 3 | elementorFrontend.hooks.addAction('frontend/element_ready/woo-bopo-bundle.default', function ($scope) { |
| 4 | if (!window.elementor) { |
| 5 | return; |
| 6 | } |
| 7 | let $shortcode_container = $scope.find('.bopobb-shortcode-form'); |
| 8 | $shortcode_container.each(function () { |
| 9 | bopobbElementInit($shortcode_container); |
| 10 | }); |
| 11 | }); |
| 12 | }); |
| 13 | |
| 14 | function bopobbElementInit($container) { |
| 15 | let item_width = parseInt($container.find('.bopobb-single-wrap .bopobb-item-top:first-child').width() * bopobbShortcodeVars.image_rate), |
| 16 | count_item = $container.find('.bopobb-single-wrap .bopobb-items-bottom-wrap .bopobb-item-product').length, |
| 17 | $alert = $container.find('.bopobb-alert'), |
| 18 | ready_purchase = true; |
| 19 | if ($container.find('.bopobb-items-bottom-wrap.bopobb-template-1').length) { |
| 20 | for (let i = 0; i < count_item; i++) { |
| 21 | if ($container.find('.bopobb-single-wrap .bopobb-item-top.bopobb-item-' + i).attr('data-default') == 0) { |
| 22 | ready_purchase = false; |
| 23 | if (item_width) { |
| 24 | $container.find('.bopobb-single-wrap .bopobb-item-top.bopobb-item-' + i + ' .bopobb-item-img-wrap.bopobb-item-change') |
| 25 | .addClass('bopobb-icon-plus2').css('min-height', item_width); |
| 26 | } else { |
| 27 | $container.find('.bopobb-single-wrap .bopobb-item-top.bopobb-item-' + i + ' .bopobb-item-img-wrap.bopobb-item-change') |
| 28 | .addClass('bopobb-icon-plus2'); |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } else { |
| 33 | for (let i = 0; i < count_item; i++) { |
| 34 | if (!$container.find('.bopobb-single-wrap .bopobb-items-bottom-wrap .bopobb-item-product.bopobb-item-' + i).attr('data-id')) { |
| 35 | ready_purchase = false; |
| 36 | $container.find('.bopobb-single-wrap .bopobb-items-bottom-wrap .bopobb-item-product.bopobb-item-' + i + ' .bopobb-item-img') |
| 37 | .css('min-height', bopobbShortcodeVars.image_height + 'px'); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | if (!ready_purchase) { |
| 43 | $container.find('p.price').hide(); |
| 44 | $alert.html(bopobbShortcodeVars.alert_empty).slideDown(); |
| 45 | } |
| 46 | } |