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
1 month ago
cart_widget.min.js
1 month 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
1 month ago
wcml-multi-currency.min.js
1 month ago
wcml-setup.js
3 years ago
wcml-setup.min.js
3 years ago
wcml-translation-editor.js
1 week ago
wcml-translation-editor.min.js
1 week 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
scripts.js
113 lines
| 1 | var WCML = { |
| 2 | sanitize: function(s) { |
| 3 | if (typeof s === 'string' || s instanceof String) { |
| 4 | return s.replace(/<script[^>]*?>.*?<\/script>/gi, ''); |
| 5 | } |
| 6 | |
| 7 | return s; |
| 8 | } |
| 9 | }; |
| 10 | |
| 11 | jQuery(function ($) { |
| 12 | var discard = false; |
| 13 | |
| 14 | window.onbeforeunload = function (e) { |
| 15 | if (discard) { |
| 16 | return $('#wcml_warn_message').val(); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | $('.wcml-section input[type="submit"]').click(function () { |
| 21 | discard = false; |
| 22 | }); |
| 23 | |
| 24 | $('#wcml_custom_exchange_rates').submit(function () { |
| 25 | |
| 26 | var thisf = $(this); |
| 27 | |
| 28 | thisf.find(':submit').parent().prepend(icl_ajxloaderimg + ' ') |
| 29 | thisf.find(':submit').prop('disabled', true); |
| 30 | |
| 31 | $.ajax({ |
| 32 | |
| 33 | type: 'post', |
| 34 | dataType: 'json', |
| 35 | url: ajaxurl, |
| 36 | data: thisf.serialize(), |
| 37 | success: function () { |
| 38 | thisf.find(':submit').prev().remove(); |
| 39 | thisf.find(':submit').prop('disabled', false); |
| 40 | } |
| 41 | |
| 42 | }) |
| 43 | |
| 44 | return false; |
| 45 | }) |
| 46 | |
| 47 | $(document).on('click', '.wcml_save_base', function (e) { |
| 48 | e.preventDefault(); |
| 49 | |
| 50 | var elem = $(this); |
| 51 | var dialog_saving_data = $(this).closest('.wcml-dialog-container'); |
| 52 | var link = '#wcml-edit-base-slug-' + elem.attr('data-base') + '-' + elem.attr('data-language') + '-link'; |
| 53 | var dialog_container = '#wcml-edit-base-slug-' + elem.attr('data-base') + '-' + elem.attr('data-language'); |
| 54 | $.ajax({ |
| 55 | type: "post", |
| 56 | url: ajaxurl, |
| 57 | dataType: 'json', |
| 58 | data: { |
| 59 | action: "wcml_update_base_translation", |
| 60 | base: elem.attr('data-base'), |
| 61 | base_value: dialog_saving_data.find('#base-original').val(), |
| 62 | base_translation: dialog_saving_data.find('#base-translation').val(), |
| 63 | language: elem.attr('data-language'), |
| 64 | wcml_nonce: $('#wcml_update_base_nonce').val() |
| 65 | }, |
| 66 | success: function (response) { |
| 67 | $(dialog_container).remove(); |
| 68 | $(link).find('i').remove(); |
| 69 | $(link).append('<i class="otgs-ico-edit" >'); |
| 70 | $(link).parent().prepend(WCML.sanitize(response)); |
| 71 | } |
| 72 | }) |
| 73 | }); |
| 74 | |
| 75 | /** |
| 76 | * Function to display larger image on hover while you are in product list. |
| 77 | **/ |
| 78 | |
| 79 | $(function() { |
| 80 | $('.original-image').mousemove(function(e) { |
| 81 | $img = $("#" + $(this).data('image-id')); |
| 82 | $img.show(200); |
| 83 | $img.offset({ |
| 84 | top: e.pageY - 100, |
| 85 | left: e.pageX + 15 |
| 86 | }); |
| 87 | }).mouseleave(function() { |
| 88 | $img = $("#" + $(this).data('image-id')); |
| 89 | $img.hide(200); |
| 90 | }); |
| 91 | }); |
| 92 | |
| 93 | /* |
| 94 | * Collapse functionality helper. Markup should resemble something like this |
| 95 | * <container#containerID> |
| 96 | * <button#buttonID aria-expanded="false" aria-controls="wrapperID"> |
| 97 | * <span>button text</span> |
| 98 | * </button> |
| 99 | * <wrapper#wrapperID role="region" aria-labelledby="buttonID">content</wrapper> |
| 100 | * </container> |
| 101 | */ |
| 102 | function expandContainer(buttonID, containerID) { |
| 103 | $(`#${buttonID}`).on('click', function() { |
| 104 | const ariaExpanded = $(this).attr('aria-expanded') === 'true'; |
| 105 | $(this).attr('aria-expanded', !ariaExpanded); |
| 106 | $(`#${containerID}`).toggleClass('expanded'); |
| 107 | }); |
| 108 | } |
| 109 | expandContainer('translate_manually_toggle', 'translate_manually'); |
| 110 | |
| 111 | }); |
| 112 | |
| 113 |