(function( $ ) {
	'use strict';

	/**
	 * All of the code for your public-facing JavaScript source
	 * should reside in this file.
	 *
	 * Note: It has been assumed you will write jQuery code here, so the
	 * $ function reference has been prepared for usage within the scope
	 * of this function.
	 *
	 * This enables you to define handlers, for when the DOM is ready:
	 *
	 * $(function() {
	 *
	 * });
	 *
	 * When the window is loaded:
	 *
	 * $( window ).load(function() {
	 *
	 * });
	 *
	 * ...and/or other possibilities.
	 *
	 * Ideally, it is not considered best practise to attach more than a
	 * single DOM-ready or window-load handler for a particular page.
	 * Although scripts in the WordPress core, Plugins and Themes may be
	 * practising this, we should strive to set a better example in our own work.
	 */
	jQuery(window).on('load', function( $ ){
		/* wdk_btn_share */
		jQuery(".wdk_btn_share a").on('click', function(e) { 
			e.preventDefault();
			navigator.share({});
		});
		
		/* wdk_btn_print */
		jQuery(".wdk_btn_print a").on('click', function(e) { 
			e.preventDefault();
			window.print();
		});
		
		setTimeout(() => {
			jQuery('<a class="wdk_field_btn_reset"><i aria-hidden="true" class="fas fa-times-circle"></i></a>').appendTo('.reset_allow .wdk_dropdown_tree > .btn-group, .reset_allow .wdk-field.wdk_search_field_search.INPUTBOX').on('click', function(e){
				e.preventDefault();
				e.stopPropagation();
	
				var f;
				f = jQuery(this).closest('.wdk-field');
				  
				if(f.hasClass('LOCATION') || f.hasClass('CATEGORY')) {
					f.find('input').val('');
					f.find('.wdk_dropdown_tree button:first-child').html(f.find('.list_items li').first().text());
				} else if(f.hasClass('INPUTBOX')) {
					f.find('input').val('');
				}
				
			});
		}, 500);
	});
})(jQuery);