pro
1 year ago
_acf-compatibility.js
1 year ago
_acf-condition-types.js
1 year ago
_acf-condition.js
1 year ago
_acf-conditions.js
1 year ago
_acf-field-accordion.js
1 year ago
_acf-field-button-group.js
1 year ago
_acf-field-checkbox.js
1 year ago
_acf-field-color-picker.js
1 year ago
_acf-field-date-picker.js
1 year ago
_acf-field-date-time-picker.js
1 year ago
_acf-field-file.js
1 year ago
_acf-field-google-map.js
1 year ago
_acf-field-icon-picker.js
1 year ago
_acf-field-image.js
1 year ago
_acf-field-link.js
1 year ago
_acf-field-oembed.js
1 year ago
_acf-field-page-link.js
1 year ago
_acf-field-post-object.js
1 year ago
_acf-field-radio.js
1 year ago
_acf-field-range.js
1 year ago
_acf-field-relationship.js
1 year ago
_acf-field-select.js
1 year ago
_acf-field-tab.js
1 year ago
_acf-field-taxonomy.js
1 year ago
_acf-field-time-picker.js
1 year ago
_acf-field-true-false.js
1 year ago
_acf-field-url.js
1 year ago
_acf-field-user.js
1 year ago
_acf-field-wysiwyg.js
1 year ago
_acf-field.js
1 year ago
_acf-fields.js
1 year ago
_acf-helpers.js
1 year ago
_acf-hooks.js
1 year ago
_acf-internal-post-type.js
1 year ago
_acf-media.js
1 year ago
_acf-modal.js
1 year ago
_acf-model.js
1 year ago
_acf-notice.js
1 year ago
_acf-panel.js
1 year ago
_acf-popup.js
1 year ago
_acf-postbox.js
1 year ago
_acf-screen.js
1 year ago
_acf-select2.js
1 year ago
_acf-tinymce.js
1 year ago
_acf-tooltip.js
1 year ago
_acf-unload.js
1 year ago
_acf-validation.js
1 year ago
_acf.js
1 year ago
_browse-fields-modal.js
1 year ago
_field-group-compatibility.js
1 year ago
_field-group-conditions.js
1 year ago
_field-group-field.js
1 year ago
_field-group-fields.js
1 year ago
_field-group-locations.js
1 year ago
_field-group-settings.js
1 year ago
_field-group.js
1 year ago
acf-escaped-html-notice.js
1 year ago
acf-field-group.js
1 year ago
acf-input.js
1 year ago
acf-internal-post-type.js
1 year ago
acf.js
1 year ago
_acf-field-date-time-picker.js
94 lines
| 1 | ( function ( $, undefined ) { |
| 2 | var Field = acf.models.DatePickerField.extend( { |
| 3 | type: 'date_time_picker', |
| 4 | |
| 5 | $control: function () { |
| 6 | return this.$( '.acf-date-time-picker' ); |
| 7 | }, |
| 8 | |
| 9 | initialize: function () { |
| 10 | // vars |
| 11 | var $input = this.$input(); |
| 12 | var $inputText = this.$inputText(); |
| 13 | |
| 14 | // args |
| 15 | var args = { |
| 16 | dateFormat: this.get( 'date_format' ), |
| 17 | timeFormat: this.get( 'time_format' ), |
| 18 | altField: $input, |
| 19 | altFieldTimeOnly: false, |
| 20 | altFormat: 'yy-mm-dd', |
| 21 | altTimeFormat: 'HH:mm:ss', |
| 22 | changeYear: true, |
| 23 | yearRange: '-100:+100', |
| 24 | changeMonth: true, |
| 25 | showButtonPanel: true, |
| 26 | firstDay: this.get( 'first_day' ), |
| 27 | controlType: 'select', |
| 28 | oneLine: true, |
| 29 | }; |
| 30 | |
| 31 | // filter |
| 32 | args = acf.applyFilters( 'date_time_picker_args', args, this ); |
| 33 | |
| 34 | // add date time picker |
| 35 | acf.newDateTimePicker( $inputText, args ); |
| 36 | |
| 37 | // action |
| 38 | acf.doAction( 'date_time_picker_init', $inputText, args, this ); |
| 39 | }, |
| 40 | } ); |
| 41 | |
| 42 | acf.registerFieldType( Field ); |
| 43 | |
| 44 | // manager |
| 45 | var dateTimePickerManager = new acf.Model( { |
| 46 | priority: 5, |
| 47 | wait: 'ready', |
| 48 | initialize: function () { |
| 49 | // vars |
| 50 | var locale = acf.get( 'locale' ); |
| 51 | var rtl = acf.get( 'rtl' ); |
| 52 | var l10n = acf.get( 'dateTimePickerL10n' ); |
| 53 | |
| 54 | // bail early if no l10n |
| 55 | if ( ! l10n ) { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | // bail early if no datepicker library |
| 60 | if ( typeof $.timepicker === 'undefined' ) { |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | // rtl |
| 65 | l10n.isRTL = rtl; |
| 66 | |
| 67 | // append |
| 68 | $.timepicker.regional[ locale ] = l10n; |
| 69 | $.timepicker.setDefaults( l10n ); |
| 70 | }, |
| 71 | } ); |
| 72 | |
| 73 | // add |
| 74 | acf.newDateTimePicker = function ( $input, args ) { |
| 75 | // bail early if no datepicker library |
| 76 | if ( typeof $.timepicker === 'undefined' ) { |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | // defaults |
| 81 | args = args || {}; |
| 82 | |
| 83 | // initialize |
| 84 | $input.datetimepicker( args ); |
| 85 | |
| 86 | // wrap the datepicker (only if it hasn't already been wrapped) |
| 87 | if ( $( 'body > #ui-datepicker-div' ).exists() ) { |
| 88 | $( 'body > #ui-datepicker-div' ).wrap( |
| 89 | '<div class="acf-ui-datepicker" />' |
| 90 | ); |
| 91 | } |
| 92 | }; |
| 93 | } )( jQuery ); |
| 94 |