admin-currency-selector.js
1 year ago
admin-currency-selector.min.js
1 year ago
bacs-accounts-currencies.js
5 years ago
bacs-accounts-currencies.min.js
5 years ago
cart_widget.js
2 months ago
cart_widget.min.js
2 months ago
currency-switcher-settings.js
1 year ago
currency-switcher-settings.min.js
1 year ago
dialogs.js
5 years ago
dialogs.min.js
5 years ago
exchange-rates.js
3 years ago
exchange-rates.min.js
3 years ago
files.js
5 years ago
files.min.js
5 years ago
languages_notice.js
5 years ago
languages_notice.min.js
5 years ago
lock_fields.js
1 year ago
lock_fields.min.js
1 year ago
multi-currency.js
5 years ago
multi-currency.min.js
5 years ago
pointer.js
1 year ago
pointer.min.js
1 year ago
prices.js
5 years ago
prices.min.js
5 years ago
products-screen-option.js
5 years ago
products-screen-option.min.js
5 years ago
scripts.js
1 year ago
scripts.min.js
1 year ago
taxonomy_translation.js
1 year ago
taxonomy_translation.min.js
1 year ago
tooltip_init.js
5 years ago
tooltip_init.min.js
5 years ago
trnsl_interface_dialog_warning.js
5 years ago
trnsl_interface_dialog_warning.min.js
5 years ago
troubleshooting.js
1 year ago
troubleshooting.min.js
1 year ago
wcml-attributes.js
5 years ago
wcml-attributes.min.js
5 years ago
wcml-messages.js
5 years ago
wcml-messages.min.js
5 years ago
wcml-multi-currency.js
2 months ago
wcml-multi-currency.min.js
2 months ago
wcml-setup.js
3 years ago
wcml-setup.min.js
3 years ago
wcml-translation-editor.js
2 weeks ago
wcml-translation-editor.min.js
2 weeks ago
widgets.js
5 years ago
widgets.min.js
5 years ago
wpml_tm.js
5 years ago
wpml_tm.min.js
5 years ago
cart_widget.js
57 lines
| 1 | document.addEventListener('DOMContentLoaded', function() { |
| 2 | document.addEventListener('click', function(e) { |
| 3 | if (e.target.matches('.wcml_removed_cart_items_clear')) { |
| 4 | e.preventDefault(); |
| 5 | wcml_cart_clear_removed_items(); |
| 6 | } |
| 7 | }); |
| 8 | }); |
| 9 | |
| 10 | document.addEventListener('DOMContentLoaded', function () { |
| 11 | // It has not been created yet, so the “original” code will build it. There is no need to refresh it. |
| 12 | if (!sessionStorage.getItem('wc_cart_created')) { |
| 13 | return; |
| 14 | } |
| 15 | |
| 16 | var getCookieValue = function (name) { |
| 17 | return document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || ''; |
| 18 | } |
| 19 | |
| 20 | // If it was stored in a different language, we need to refresh it because the language has changed. |
| 21 | if (actions.current_language != sessionStorage.getItem('wcml_current_language')) { |
| 22 | sessionStorage.setItem('wcml_current_language', actions.current_language); |
| 23 | actions.force_reset = 1; |
| 24 | } |
| 25 | |
| 26 | // Check sessionStorage as well as cookies, for backward compatibility. |
| 27 | var empty_cart_hash = !sessionStorage.getItem('woocommerce_cart_hash') |
| 28 | && !getCookieValue('woocommerce_cart_hash'); |
| 29 | |
| 30 | if (empty_cart_hash || actions.force_reset == 1) { |
| 31 | setTimeout(wcml_reset_cart_fragments, 0); |
| 32 | } |
| 33 | }); |
| 34 | |
| 35 | function wcml_reset_cart_fragments() { |
| 36 | try { |
| 37 | document.body.dispatchEvent(new Event('wc_fragment_refresh')); |
| 38 | sessionStorage.removeItem('wc_fragments'); |
| 39 | } catch (err) { } |
| 40 | } |
| 41 | |
| 42 | function wcml_cart_clear_removed_items() { |
| 43 | var xhr = new XMLHttpRequest(); |
| 44 | var formData = new FormData(); |
| 45 | |
| 46 | formData.append('action', 'wcml_cart_clear_removed_items'); |
| 47 | formData.append('wcml_nonce', document.querySelector('#wcml_clear_removed_items_nonce').value); |
| 48 | |
| 49 | xhr.open('POST', woocommerce_params.ajax_url); |
| 50 | xhr.onload = function() { |
| 51 | if (xhr.status === 200) { |
| 52 | window.location = window.location.href; |
| 53 | } |
| 54 | }; |
| 55 | xhr.send(formData); |
| 56 | } |
| 57 |