HEX
Server: LiteSpeed
System: Linux sg-cp4.cloudnetwork.vn 4.18.0-553.69.1.lve.el8.x86_64 #1 SMP Wed Aug 13 19:53:59 UTC 2025 x86_64
User: thu28850 (1134)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //home/thu28850/www/wp-content/plugins/kirki/kirki-packages/control-date/src/control.js
import "./control.scss";

wp.customize.controlConstructor['kirki-date'] = wp.customize.kirkiDynamicControl.extend({

	handleWidth: (input) => {
		var styleTag = document.querySelector('#kirki-style-datepicker');
		styleTag.innerHTML = '.kirki-datepicker-popup {width: ' + input.clientWidth.toString() + 'px;}';
	},

	initKirkiControl: function (control) {
		var selector;

		control = control || this;
		selector = control.selector + ' input.datepicker';

		var styleTag = document.querySelector('#kirki-style-datepicker');

		if (!styleTag) {
			styleTag = document.createElement('style');
			styleTag.id = 'kirki-style-datepicker';
			document.head.appendChild(styleTag);
		}

		// Init the datepicker.
		jQuery(selector).datepicker({
			dateFormat: 'yy-mm-dd',
			duration: 200,
			beforeShow: function (input, inst) {
				inst.dpDiv[0].classList.add('kirki-datepicker-popup');
				control.handleWidth(input);
			}
		});

		// Save the changes
		this.container.on('change keyup paste', 'input.datepicker', function () {
			control.setting.set(jQuery(this).val());
		});
	}
});