PageSourceSearch

https://matchdayauctions.com/wp-content/plugins/modeltheme-framework/js/filters-main.js?ver=1.0.0

js matchdayauctions.com collected 2026-10-08 05:51:23 UTC 6,671 bytes, 186 lines download raw bytes

1jQuery(document).ready(function($){
2	//open/close lateral filter
3	jQuery('.cd-filter-trigger').on('click', function(){
4		triggerFilter(true);
5	});
6	jQuery('.cd-filter .cd-close').on('click', function(){
7		triggerFilter(false);
8	});
9	function triggerFilter($bool) {
10		var elementsToTrigger = jQuery([jQuery('.cd-filter-trigger'), jQuery('.cd-filter'), jQuery('.cd-tab-filter'), jQuery('.cd-gallery')]);
11		elementsToTrigger.each(function(){
12			jQuery(this).toggleClass('filter-is-visible', $bool);
13		});
14	}
15	//mobile version - detect click event on filters tab
16	var filter_tab_placeholder = jQuery('.cd-tab-filter .placeholder a'),
17		filter_tab_placeholder_default_value = 'Select',
18		filter_tab_placeholder_text = filter_tab_placeholder.text();
19	
20	jQuery('.cd-tab-filter li').on('click', function(event){
21		//detect which tab filter item was selected
22		var selected_filter = jQuery(event.target).data('type');
23			
24		//check if user has clicked the placeholder item
25		if( jQuery(event.target).is(filter_tab_placeholder) ) {
26			(filter_tab_placeholder_default_value == filter_tab_placeholder.text()) ? filter_tab_placeholder.text(filter_tab_placeholder_text) : filter_tab_placeholder.text(filter_tab_placeholder_default_value) ;
27			jQuery('.cd-tab-filter').toggleClass('is-open');
28		//check if user has clicked a filter already selected 
29		} else if( filter_tab_placeholder.data('type') == selected_filter ) {
30			filter_tab_placeholder.text(jQuery(event.target).text());
31			jQuery('.cd-tab-filter').removeClass('is-open');	
32		} else {
33			//close the dropdown and change placeholder text/data-type value
34			$('.cd-tab-filter').removeClass('is-open');
35			filter_tab_placeholder.text(jQuery(event.target).text()).data('type', selected_filter);
36			filter_tab_placeholder_text = jQuery(event.target).text();
37			
38			//add class selected to the selected filter item
39			jQuery('.cd-tab-filter .selected').removeClass('selected');
40			jQuery(event.target).addClass('selected');
41		}
42	});
43	
44	//close filter dropdown inside lateral .cd-filter 
45	jQuery('.cd-filter-block h4').on('click', function(){
46		jQuery(this).toggleClass('closed').siblings('.cd-filter-content').slideToggle(300);
47	})
48	/************************************
49		MitItUp filter settings
50		More details: 
51		https://mixitup.kunkalabs.com/
52		or:
53		http://codepen.io/patrickkunka/
54	*************************************/
55	buttonFilter.init();
56	jQuery('.cd-gallery ul').mixItUp({
57	    controls: {
58	    	enable: false
59	    },
60	    callbacks: {
61	    	onMixStart: function(){
62	    		jQuery('.cd-fail-message').fadeOut(200);
63	    	},
64	      	onMixFail: function(){
65	      		jQuery('.cd-fail-message').fadeIn(200);
66	    	}
67	    }
68	});
69	//search filtering
70	//credits http://codepen.io/edprats/pen/pzAdg
71	var inputText;
72	var $matching = jQuery();
73	var delay = (function(){
74		var timer = 0;
75		return function(callback, ms){
76			clearTimeout (timer);
77		    timer = setTimeout(callback, ms);
78		};
79	})();
80	jQuery(".cd-filter-content input[type='search']").keyup(function(){
81	  	// Delay function invoked to make sure user stopped typing
82	  	delay(function(){
83	    	inputText = jQuery(".cd-filter-content input[type='search']").val().toLowerCase();
84	   		// Check to see if input field is empty
85	    	if ((inputText.length) > 0) {            
86	      		jQuery('.mix').each(function() {
87		        	var $this = jQuery(this);
88		        
89		        	// add item to be filtered out if input text matches items inside the title   
90		        	if($this.attr('class').toLowerCase().match(inputText)) {
91		          		$matching = $matching.add(this);
92		        	} else {
93		          		// removes any previously matched item
94		          		$matching = $matching.not(this);
95		        	}
96	      		});
97	      		jQuery('.cd-gallery ul').mixItUp('filter', $matching);
98	    	} else {
99	      		// resets the filter to show all item if input is empty
100	      		jQuery('.cd-gallery ul').mixItUp('filter', 'all');
101	    	}
102	  	}, 200 );
103	});
104});
105/*****************************************************
106	MixItUp - Define a single object literal 
107	to contain all filter custom functionality
108*****************************************************/
109var buttonFilter = {
110  	// Declare any variables we will need as properties of the object
111  	$filters: null,
112  	groups: [],
113  	outputArray: [],
114  	outputString: '',
115  
116  	// The "init" method will run on document ready and cache any jQuery objects we will need.
117  	init: function(){
118    	var self = this; // As a best practice, in each method we will asign "this" to the variable "self" so that it remains scope-agnostic. We will use it to refer to the parent "buttonFilter" object so that we can share methods and properties between all parts of the object.
119    
120    	self.$filters = jQuery('.cd-main-content');
121    	self.$container = jQuery('.cd-gallery ul');
122    
123	    self.$filters.find('.cd-filters').each(function(){
124	      	var $this = jQuery(this);
125	      
126		    self.groups.push({
127		        $inputs: $this.find('.filter'),
128		        active: '',
129		        tracker: false
130		    });
131	    });
132	    
133	    self.bindHandlers();
134  	},
135  
136  	// The "bindHandlers" method will listen for whenever a button is clicked. 
137  	bindHandlers: function(){
138    	var self = this;
139    	self.$filters.on('click', 'a', function(e){
140	      	self.parseFilters();
141    	});
142	    self.$filters.on('change', function(){
143	      self.parseFilters();           
144	    });
145  	},
146  
147  	parseFilters: function(){
148	    var self = this;
149	 
150	    // loop through each filter group and grap the active filter from each one.
151	    for(var i = 0, group; group = self.groups[i]; i++){
152	    	group.active = [];
153	    	group.$inputs.each(function(){
154	    		var $this = jQuery(this);
155	    		if($this.is('input[type="radio"]') || $this.is('input[type="checkbox"]')) {
156	    			if($this.is(':checked') ) {
157	    				group.active.push($this.attr('data-filter'));
158	    			}
159	    		} else if($this.is('select')){
160	    			group.active.push($this.val());
161	    		} else if( $this.find('.selected').length > 0 ) {
162	    			group.active.push($this.attr('data-filter'));
163	    		}
164	    	});
165	    }
166	    self.concatenate();
167  	},
168  
169  	concatenate: function(){
170    	var self = this;
171    
172    	self.outputString = ''; // Reset output string
173    
174	    for(var i = 0, group; group = self.groups[i]; i++){
175	      	self.outputString += group.active;
176	    }
177    
178	    // If the output string is empty, show all rather than none:    
179	    !self.outputString.length && (self.outputString = 'all'); 
180	
181    	// Send the output string to MixItUp via the 'filter' method:    
182		if(self.$container.mixItUp('isLoaded')){
183	    	self.$container.mixItUp('filter', self.outputString);
184		}
185  	}
186};

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.