PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.5.4
Secure Custom Fields v6.5.4
6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / assets / src / js / _acf-field-time-picker.js
secure-custom-fields / assets / src / js Last commit date
bindings 1 year ago commands 1 year ago 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-time-picker.js
72 lines
1 ( function ( $, undefined ) {
2 var Field = acf.models.DatePickerField.extend( {
3 type: 'time_picker',
4
5 $control: function () {
6 return this.$( '.acf-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 timeFormat: this.get( 'time_format' ),
17 altField: $input,
18 altFieldTimeOnly: false,
19 altTimeFormat: 'HH:mm:ss',
20 showButtonPanel: true,
21 controlType: 'select',
22 oneLine: true,
23 closeText: acf.get( 'dateTimePickerL10n' ).selectText,
24 timeOnly: true,
25 };
26
27 // add custom 'Close = Select' functionality
28 args.onClose = function ( value, dp_instance, t_instance ) {
29 // vars
30 var $close = dp_instance.dpDiv.find( '.ui-datepicker-close' );
31
32 // if clicking close button
33 if ( ! value && $close.is( ':hover' ) ) {
34 t_instance._updateDateTime();
35 }
36 };
37
38 // filter
39 args = acf.applyFilters( 'time_picker_args', args, this );
40
41 // add date time picker
42 acf.newTimePicker( $inputText, args );
43
44 // action
45 acf.doAction( 'time_picker_init', $inputText, args, this );
46 },
47 } );
48
49 acf.registerFieldType( Field );
50
51 // add
52 acf.newTimePicker = function ( $input, args ) {
53 // bail early if no datepicker library
54 if ( typeof $.timepicker === 'undefined' ) {
55 return false;
56 }
57
58 // defaults
59 args = args || {};
60
61 // initialize
62 $input.timepicker( args );
63
64 // wrap the datepicker (only if it hasn't already been wrapped)
65 if ( $( 'body > #ui-datepicker-div' ).exists() ) {
66 $( 'body > #ui-datepicker-div' ).wrap(
67 '<div class="acf-ui-datepicker" />'
68 );
69 }
70 };
71 } )( jQuery );
72