codemirror
4 years ago
jquery-tiptip
5 years ago
select2
5 years ago
how-to.js
8 years ago
how-to.min.js
6 years ago
jquery.colorbox.js
8 years ago
jquery.colorbox.min.js
6 years ago
metabox.js
4 years ago
metabox.min.js
4 years ago
multisite-updater.js
2 years ago
multisite-updater.min.js
6 years ago
welcome-modal.js
3 years ago
welcome-modal.min.js
3 years ago
wp-pages.js
3 years ago
wp-pages.min.js
3 years ago
yit-cpt-unlimited.js
6 years ago
yit-cpt-unlimited.min.js
6 years ago
yit-plugin-panel.js
1 year ago
yit-plugin-panel.min.js
1 year ago
yit-wp-pointer.js
5 years ago
yit-wp-pointer.min.js
5 years ago
yith-bh-onboarding.js
3 years ago
yith-bh-onboarding.min.js
3 years ago
yith-colorpicker.min.js
5 years ago
yith-dashboard.js
7 years ago
yith-dashboard.min.js
6 years ago
yith-date-format.js
5 years ago
yith-date-format.min.js
5 years ago
yith-enhanced-select-wc-2.6.js
5 years ago
yith-enhanced-select-wc-2.6.min.js
5 years ago
yith-enhanced-select.js
2 years ago
yith-enhanced-select.min.js
2 years ago
yith-fields.js
2 years ago
yith-fields.min.js
2 years ago
yith-promo.js
7 years ago
yith-promo.min.js
6 years ago
yith-system-info.js
2 years ago
yith-system-info.min.js
2 years ago
yith-ui.js
1 year ago
yith-ui.min.js
1 year ago
yith-update-plugins.js
7 years ago
yith-update-plugins.min.js
6 years ago
yith-date-format.js
61 lines
| 1 | /* globals ajaxurl */ |
| 2 | jQuery( function ( $ ) { |
| 3 | |
| 4 | $( document ).on( 'click', '.yith-plugin-fw-date-format__option', function () { |
| 5 | var $t = $( this ), |
| 6 | $wrapper = $t.closest( '.yith-plugin-fw-date-format' ), |
| 7 | $example = $wrapper.find( '.example' ); |
| 8 | |
| 9 | $example.text( $t.data( 'preview' ) ); |
| 10 | $wrapper.find( '.yith-date-format-custom' ).val( $t.val() ); |
| 11 | } ); |
| 12 | |
| 13 | $( document ).on( 'click input', '.yith-date-format-custom', function () { |
| 14 | var $t = $( this ), |
| 15 | $wrapper = $t.closest( '.yith-plugin-fw-radio__row' ); |
| 16 | |
| 17 | $wrapper.find( 'input[type=radio]' ).prop( 'checked', true ); |
| 18 | } ); |
| 19 | |
| 20 | $( document ).on( 'input yith-date-format-change', '.yith-date-format-custom', function () { |
| 21 | var $t = $( this ), |
| 22 | $wrapper = $t.closest( '.yith-plugin-fw-date-format' ), |
| 23 | dataType = $wrapper.data( 'format' ), |
| 24 | js = $wrapper.data( 'js' ), |
| 25 | now = $wrapper.data( 'current' ), |
| 26 | example = $wrapper.find( '.example' ), |
| 27 | spinner = $wrapper.find( '.spinner' ); |
| 28 | |
| 29 | if ( 'yes' === js ) { |
| 30 | var newDate = new Date( now ); |
| 31 | newDate = $.datepicker.formatDate( $t.val(), newDate ); |
| 32 | example.text( newDate ); |
| 33 | } else { |
| 34 | clearTimeout( $.data( this, 'timer' ) ); |
| 35 | $t.data( 'timer', setTimeout( |
| 36 | function () { |
| 37 | if ( $t.val() ) { |
| 38 | spinner.addClass( 'is-active' ); |
| 39 | // Call WP ajax action. |
| 40 | var data = { |
| 41 | action: dataType + '_format', |
| 42 | date : $t.val() |
| 43 | }; |
| 44 | |
| 45 | $.post( ajaxurl, data, function ( response ) { |
| 46 | spinner.removeClass( 'is-active' ); |
| 47 | example.text( response ); |
| 48 | } ); |
| 49 | } |
| 50 | }, |
| 51 | 500 ) |
| 52 | ); |
| 53 | } |
| 54 | } ); |
| 55 | |
| 56 | $( document ).on( 'yith-plugin-fw-date-format-init', function () { |
| 57 | $( '.yith-date-format-custom' ).trigger( 'yith-date-format-change' ); |
| 58 | } ).trigger( 'yith-plugin-fw-date-format-init' ); |
| 59 | |
| 60 | } ); |
| 61 |