PageSourceSearch

https://www.diamondmindinc.com/wp-content/plugins/divi-icon-king-g…/js/divi-icon-king-gtm-icon-filter.js

js diamondmindinc.com collected 2026-10-02 06:23:31 UTC 4,495 bytes, 159 lines download raw bytes

1(function( $ ) {
2
3	var filter__icon_list_container, filter__icon_list;
4
5	var delay = ( function() {
6  		var timer = 0;
7  		return function( callback, ms ){
8    		clearTimeout ( timer );
9    		timer = setTimeout( callback, ms );
10  		};
11	})();
12
13	function findIconListContainer(){
14    // WP Customizer.
15	  if( $('body.wp-customizer').length == 1 ) {
16		  return '.customize-control-icon_picker';
17	  // VB.
18	  } else if ( $('body.et-fb').length == 1  ) {
19		   return '.et-fb-option-container';
20	  // New Backend Builder.
21	  } else if ( $('body.et-db').length == 1  ) {
22		  return '.et-fb-option-container';
23	  // Classic Backend Builder.
24	  } else {
25      return '.et-pb-option--select_icon';
26	  }
27	}
28
29	function findIconList(){
30		return $('div#et-fb-app').length == 1 ? 'ul.et-fb-font-icon-list li' : 'ul.et_font_icon li';
31	}
32	
33	function reset_search( el ) {
34		el.closest( '.dikg_icon_filter' ).find( '.dikg_icon_filter__input' ).val('');
35	}
36	
37	function clear_active_control() {
38		$( '.dikg_icon_filter__control_option--active' ).removeClass( 'dikg_icon_filter__control_option--active' );
39	}
40		
41	$( document ).on( 'keyup', '.dikg_icon_filter__input', function() {
42		
43		var $that = $(this);
44			
45		delay( function() {
46
47			value = $that.val().toLowerCase();
48
49			$iconList = $that.closest( filter__icon_list_container ).find( filter__icon_list );
50			
51			clear_active_control();
52
53			if( !value ){
54				$iconList.show();
55				return;
56			}
57			
58			var value = $.trim( value );
59
60			$iconList.hide().filter('li[data-terms*="'+value+'"]').show();
61					
62    }, 500 );
63	});
64		
65	// Filter by Family
66	$( document ).on( 'click', '.dikg_icon_filter__control_family', function() {
67		
68		clear_active_control();
69		
70		var $this = $( this ).addClass( 'dikg_icon_filter__control_option--active' );
71		
72		reset_search( $this );
73		
74		var value = $this.attr('data-value');
75		$iconList = $this.closest( filter__icon_list_container ).find( filter__icon_list );
76		
77		$iconList.show().filter( function() {
78      return !~$(this).attr('data-family').indexOf( value );
79    }).hide();
80	});
81	
82	// Filter by Icon Style
83	$( document ).on( 'click', '.dikg_icon_filter__control_style', function() {
84		
85		clear_active_control();
86		
87		var $this = $( this ).addClass( 'dikg_icon_filter__control_option--active' );
88		
89		reset_search( $this );
90		
91		var value = $this.attr('data-value');
92		$iconList = $this.closest( filter__icon_list_container ).find( filter__icon_list );
93		
94		$iconList.show().filter( function() {
95      var text = $(this).attr('data-style');
96      return !~text.indexOf( value );
97    }).hide();	});
98		
99	$(document).on( 'click', '.dikg_icon_filter--closed', function() {
100		
101		clear_active_control();
102	
103		var $parent_container = $( this );
104		filter__icon_list_container = findIconListContainer();
105		filter__icon_list           = findIconList();
106		
107		$parent_container
108		.removeClass( 'dikg_icon_filter--closed' )
109		.addClass( 'dikg_icon_filter--open' )
110		.prepend( '<input type="text" class="dikg_icon_filter__input" value="" placeholder="Whatcha looking for?" />' );
111		
112		$parent_container.find( '.dikg_icon_filter__btn' )
113		.removeClass( 'dikg_icon_filter--visible' )
114		.addClass( 'dikg_icon_filter--hidden' );
115		
116		$parent_container.find( '.dikg_icon_filter__controls' )
117		.removeClass( 'dikg_icon_filter--hidden' )
118		.addClass( 'dikg_icon_filter--visible' );
119		
120		$parent_container.find( '.dikg_icon_filter__input' ).focus();
121	});
122	
123	// Reset filter input
124	$(document).on( 'click', '.dikg_icon_filter__all', function() {
125		
126		clear_active_control();
127		
128		var $this = $( this );
129		reset_search( $this );
130		
131		$this.closest( filter__icon_list_container ).find( filter__icon_list ).show();
132	});
133	
134	// Close filtering
135	$(document).on( 'click', '.dikg_icon_filter__close', function() {
136		
137		clear_active_control();
138				
139		var $parent_container = $( this ).closest( '.dikg_icon_filter' );
140				
141		$parent_container.find( '.dikg_icon_filter__btn' )
142		.removeClass( 'dikg_icon_filter--hidden' )
143		.addClass( 'dikg_icon_filter--visible' );
144		
145		$parent_container.find( '.dikg_icon_filter__controls' )
146		.removeClass( 'dikg_icon_filter--visible' )
147		.addClass( 'dikg_icon_filter--hidden' );
148		
149		$parent_container.find( '.dikg_icon_filter__input' ).val('');
150		$parent_container.find( '.dikg_icon_filter__input' ).remove();
151		
152		$parent_container
153		.removeClass( 'dikg_icon_filter--open' )
154		.addClass( 'dikg_icon_filter--closed' );
155		
156		$(this).closest( filter__icon_list_container ).find( filter__icon_list ).show();
157	});
158	
159})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.