PageSourceSearch

https://flamigfarm.com/wp-content/plugins/wd-plugin/assests/js/wd_search_font.js?ver=1.1

js flamigfarm.com collected 2026-10-08 02:40:51 UTC 4,181 bytes, 120 lines download raw bytes

1jQuery(document).ready(function() {
2	
3	var delay = (function () {
4            var timer = 0;
5            return function (callback, ms) {
6                clearTimeout(timer);
7                timer = setTimeout(callback, ms);
8            };
9	})();
10	
11	jQuery.fn.appendResult = function(o, url, site_url, s, img, s_view_l, type){
12		
13		if(o.length > 0){
14			for(var i=0; i<o.length; i++) {
15				var category ='';
16				if(o[i]['cat'].length > 0) {
17					category ='<p class="category">';
18					for(var cc = 0; cc < o[i]['cat'].length; cc++) {
19						if(cc > 0) category += ', <a href="'+o[i]['cat'][cc]['url']+'" rel="tag">'+o[i]['cat'][cc]['name']+'</a>';
20						else category += ' <a href="'+o[i]['cat'][cc]['url']+'" rel="tag">'+o[i]['cat'][cc]['name']+'</a>';
21					}
22					category +='</a>';
23				}
24				if(img) img = '<a class="thumbnail" href="'+o[i]['url']+'" title="'+o[i]['post_title']+'">'+o[i]['src']+'</a>';
25				else img ='';
26				var title = o[i]['post_title'];
27				title = title.toUpperCase();
28				s_up = s.toUpperCase();
29				var s_pos = title.indexOf(s_up);
30				if(s_pos >=0) {
31					title = title.insertAt(s_pos, '<span class="line-height">');
32					s_pos = title.indexOf(s_up) + s_up.length;
33					title = title.insertAt(s_pos, '</span>');
34				}
35				
36				jQuery(this).find('ul').append('\
37					<li>\
38						'+img+'\
39						<div class="content"><a href="'+o[i]['url']+'" title="'+o[i]['post_title']+'">\
40							'+title+'\
41						</a>\
42						'+category+'</div>\
43					</li>\
44				');
45			}
46			//_this.parent().find('.list_result ul')
47			if( s_view_l && o.length !== 1 ){
48				jQuery(this).find('ul').append('\
49					<li class="search_all"><a class="button none-bg primary button-white" href="'+site_url+'?s='+s+'&post_type='+type+'">Show All</a></li>\
50				');
51			}
52			
53		}
54	}
55	
56	String.prototype.insertAt=function(index, string) { 
57		return this.substr(0, index) + string + this.substr(index);
58	}
59	
60	var wd_timeout = jQuery('.wd_woo_search_box #wd_searchform input[name=s]').data('timeout');
61	
62	jQuery('.wd_woo_search_box #wd_searchform input[name=s]').keyup(function(){
63		var _this = jQuery(this).parents('#wd_searchform');
64		var s = jQuery(this).val();
65		var $this = jQuery(this);
66		var search_result = $this.parents('form#wd_searchform').nextAll('.list_result');
67		delay(function () {
68			if(s==''){
69				_this.parent().find('.list_result').html('');
70			} else {
71				var $data = $this.data();
72				$data.action = 'wd_seach_result';
73				$data.s = s;
74				
75				var taxonomy = _this.find('input[name=taxonomy]').val();
76				var term = _this.find('select[name=term]').val();
77				if(typeof taxonomy !== 'undefined') {
78					$data.taxonomy = taxonomy;
79					$data.type = 'product';
80				}
81				if(typeof term !== 'undefined') {
82					$data.term = term;
83				}
84				
85				jQuery.ajax({
86					type	: "POST",
87					url		: $data.ajax_url,
88					data	: $data,
89					dataType: 'json',
90					beforeSend: function(o){
91						_this.find('[type=submit] .fa').removeClass('fa-search').addClass('fa-spinner fa-spin');
92					},
93					success: function(data){
94						
95						if((typeof data['pro_res']!= 'undefined' && data['pro_res'].length > 0) || (typeof data['blog_res']!= 'undefined' && data['blog_res'].length > 0)) {
96							search_result.html('<ul class="product_list_widget"></ul>');
97							if ($data.type == 'all') {
98								search_result.appendResult(data['pro_res'], $data.ajax_url, $data.site_url, s, true, true, 'product');
99								search_result.appendResult(data['blog_res'], $data.ajax_url, $data.site_url, s, false, true, 'post');
100							} else if($data.type == 'post') {
101								search_result.appendResult(data['blog_res'], $data.ajax_url, $data.site_url, s, false, false, 'post');
102							} else {
103								search_result.appendResult(data['pro_res'], $data.ajax_url, $data.site_url, s, true, false, 'product');
104							}
105						} else {
106							search_result.html('<ul class="product_list_widget"><li>Not found!</li></ul>');
107						}
108						
109						_this.find('[type=submit] .fa').removeClass('fa-spinner fa-spin').addClass('fa-search');
110					}
111				});
112			}
113			
114        }, wd_timeout);
115		
116		
117	});
118	
119	
120});

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.