PageSourceSearch

https://farmtronics.com/templates/squareflo-bravo-template/js/script.js?v=1790608919

js farmtronics.com collected 2026-09-28 15:22:47 UTC 10,560 bytes, 303 lines download raw bytes

1// JavaScript Document for charity html template
2
3$(document).ready(function() {
4    function windowResize(){
5        var o_container = $('.main-container');
6        o_container.css('min-height','');
7
8        var i_headerHeight = 0;
9        if($('.header').css('position') !== 'absolute' && $('.header').css('position') !== 'fixed'){
10            i_headerHeight = $('.header').outerHeight();
11        }
12
13        var i_footerHeight = $('body > .footer').outerHeight();
14
15        var i_marginTop = o_container.css('margin-top')+'';
16        if(typeof(i_marginTop) === 'undefined' || i_marginTop === '') {
17            i_marginTop = 0;
18        } else {
19            i_marginTop = i_marginTop.split('px').join('')*1;
20        }
21
22        var i_marginBottom = o_container.css('margin-bottom')+'';
23        if(typeof(i_marginBottom) === 'undefined' || i_marginBottom === '') {
24            i_marginBottom = 0;
25        } else {
26            i_marginBottom = i_marginBottom.split('px').join('') * 1;
27        }
28
29        var i_height = $(window).height()-i_footerHeight-i_headerHeight-i_marginTop-i_marginBottom;
30        if(o_container.height() < i_height){
31            o_container.css('min-height',i_height);
32        }
33    }
34    windowResize();
35    var t_windowResize;
36    $(window).resize(function(){
37        if(t_windowResize){
38            clearTimeout(t_windowResize);
39        }
40        setTimeout(function(){
41            windowResize();
42        },500);
43    });
44
45
46    $('a[href^=#].scroll-to-div').click(function(){
47        event.preventDefault();
48        var target = $(this).attr('href');
49        if (target == '#'){
50            $('html, body').animate({scrollTop : 0}, 600);
51        } else {
52            $('html, body').animate({
53                scrollTop: $(target).offset().top
54            }, 600);
55        }
56    });
57
58	$('.dropdown-toggle-regular').dropdown();
59	
60//open searchbar toggle code
61
62                "use strict";
63		// Search field toggle in top bar
64		$('li.search a').click(function(e) {
65			$(this).parent().find('#top-search').toggle().focus();
66			$('#top-links').toggleClass('search-open');
67			e.preventDefault();
68		});
69		
70		
71		// Client logo corousel
72		"use strict";
73		$("#owl-demo").owlCarousel({
74                                autoPlay: 3000, //Set AutoPlay to 3 seconds
75                                items : 4,
76                                itemsDesktop : [1199,2],
77                                itemsDesktopSmall : [979,2]
78                           
79                });
80                // Testiminail  corousel
81                        "use strict";
82                        $("#owl-demo-testimonial").owlCarousel({
83                 
84                      autoPlay: 3000, //Set AutoPlay to 3 seconds
85                 
86                      items : 1,
87                      itemsDesktop : [1199,3],
88                      itemsDesktopSmall : [979,3]
89                 
90                  });	
91  	/*
92			 * Contact form
93		 */
94		 /*$("#contact-form").submit(function() {
95		 	var form = $(this);
96		 	var script = $(this).attr("action");
97		 	$.ajax({
98			 		type : "POST",
99			 		url : script,
100			 		dataType : "html",
101			 		data : $(this).serialize(),
102			 		beforeSend : function() {
103			 			form.find('.loading').remove();
104			 			form.find('.dynamic').append('<div class="loading"><i class="fa fa-3x fa-spinner fa-spin"></i></div>')
105					},
106					success : function(response) {
107						form.find(".loading").remove();
108			 			form.find('.dynamic').append('<div class="result">' + response + '</div>')
109					}
110			});
111		 	return false;
112		});*/
113	
114		
115});
116$('.btn-search').on('click',function(e){
117                e.preventDefault();
118                var datasearch = $(this).attr('data-search');
119                var searchfield = $('#'+datasearch);
120                var searchval = searchfield.val();
121                searchval = searchval.replace(' ','+');
122                var urlParams = removeURLParameter(window.location.href, 'search', 'y', '');
123                //var url = removeURLParameter(window.location.href, 'search', '', 'y');
124                //console.log(url);
125                var url = $(location).attr('pathname');
126                url.indexOf(1);                
127                url.toLowerCase();
128                url = url.split("/")[1];
129                //url = //url.split('search')[0];
130                window.location.href='/'+url+'/search/keyword:'+searchval+urlParams;
131});
132$('.btn-search2').on('click',function(e){
133                e.preventDefault();
134                var datasearch = $(this).attr('data-search');
135                var searchfield = $('#'+datasearch);
136                var searchval = searchfield.val();
137                searchval = searchval.replace(' ','+');
138                var urlParams = removeURLParameter(window.location.href, 'search', 'y', '');
139                //var url = removeURLParameter(window.location.href, 'search', '', 'y');
140                //console.log(url);
141                var url = $(location).attr('pathname');
142                url.indexOf(1);                
143                url.toLowerCase();
144                url = url.split("/")[1];
145				        //console.log(url);
146                //url = //url.split('search')[0];
147				if(url == 'search'){
148					url = '';
149				} else {
150					url = '/'+url;
151				}
152				//console.log(url);
153                window.location.href = url+'/search/'+searchval+urlParams;
154});
155$('#search').keyup(function(e){
156  if(e.keyCode === 13){
157
158    var searchval = $(this).val();
159    searchval = searchval.replace(' ','+');
160    var urlParams = removeURLParameter(window.location.href, 'search', 'y', '');
161    var url = $(location).attr('pathname');
162    url.indexOf(1);
163    url.toLowerCase();
164    url = url.split("/")[1];
165    if(url == 'search'){
166      url = '';
167    } else {
168      url = '/'+url;
169    }
170    window.location.href = url+'/search/'+searchval+urlParams;
171    return false;
172  }
173});
174///////// javascipt form thankyou massage
175$('body').on('click','.navbar-toggle',function(e){
176                e.preventDefault();
177                var toggle = $(this).attr('data-toggle');
178                var target = $(this).attr('data-target');
179                //console.log(toggle);
180                //console.log(target);
181                var elem = $(target);
182                if (elem.hasClass(toggle)) {
183                                elem.removeClass(toggle);
184                } else {
185                                elem.addClass(toggle);
186                }
187                return false;
188});
189
190function thanks() {
191                "use strict";
192                document.getElementById('thank').innerHTML = "<div class='alert alert-success' role='alert'> Thank you! Your message has been successfully sent. We will contact you very soon! </div>"; 
193                document.getElementById('thank_1').innerHTML = "<div class='alert alert-success' role='alert'> Thank you! Your message has been successfully sent. We will contact you very soon! </div>"; 
194                return true;
195}
196$('html').click(function() {
197  $('ul.nav ul').hide();
198});
199$('.dropdown-toggle').on('click',function(e){
200                e.preventDefault();
201                e.stopPropagation();
202                var holder = $(this).closest('li');
203                var par = $(this).closest('.nav');
204                var ul = holder.find(' > ul');
205                if (ul.is(':visible')) {
206                                ul.hide();
207                } else {
208                                if ($(this).parent().parent().is('ul.nav')) {
209                                                $('ul',par).hide();
210                                }
211                                else if ($(this).parent().parent().parent().parent().is('ul.nav')) {
212                                                $('ul > li > ul',par).hide();
213                                }
214                                ul.show();
215                }
216                return false;
217});
218
219
220function removeURLParameter(url, parameter, returnParam, returnURL) {
221    //prefer to use l.search if you have a location/link object
222    var urlparts= url.split('?');   
223    if (urlparts.length>=2) {
224
225        var prefix= encodeURIComponent(parameter)+'=';
226        var pars= urlparts[1].split(/[&;]/g);
227
228        //reverse iteration as may be destructive
229        for (var i= pars.length; i-- > 0;) {    
230            //idiom for string.startsWith
231            if (pars[i].lastIndexOf(prefix, 0) !== -1) {  
232                pars.splice(i, 1);
233            }
234        }
235        if (returnURL == 'y') {
236                return urlparts[0];
237        }
238        if (pars.length > 0) {
239                if (returnParam == 'y') {
240                                return '?'+pars.join('&');
241                }
242                url= urlparts[0]+'?'+pars.join('&');
243        } else {
244                if (returnParam == 'y') {
245                                return '';
246                }
247                url = urlparts[0];
248        }
249        return url;
250    } else {
251        if (returnParam == 'y') {
252                return '';
253        }
254        return url;
255    }
256}
257
258$('#search').keypress(function(e) {
259    if(e.which == 13) {
260        $('.btn-search').click();
261    }
262});
263$('.datepicker').datepicker({
264                altFormat: "yy-mm-dd",
265                dateFormat: "yy-mm-dd"
266});
267$('.datepicker-1month').datepicker({
268                altFormat: "yy-mm-dd",
269                dateFormat: "yy-mm-dd",
270                minDate: "1M"
271});
272
273function changeGoogleStyles() {
274    if(($goog = $('.goog-te-menu-frame').contents().find('body')).length) {
275        var stylesHtml = '<style>'+
276            '.goog-te-menu2 {'+
277                'max-width:100% !important;'+
278                'overflow:scroll !important;'+
279                'box-sizing:border-box !important;'+
280                'height:auto !important;'+
281            '}'+
282        '</style>';
283        $goog.prepend(stylesHtml);
284    } else {
285        setTimeout(changeGoogleStyles, 50);
286    }
287}
288changeGoogleStyles();
289
290$('.block_main_photo').on('mouseenter',function(){
291                var data_id = $(this).data('id');
292                if ($('.block_hover_photo[data-id='+data_id+']').length > 0) {
293                                $(this).hide();
294                                $('.block_hover_photo[data-id='+data_id+']').show();
295                }
296});
297$('.block_hover_photo').on('mouseleave',function(){
298                var data_id = $(this).data('id');
299                if ($('.block_main_photo[data-id='+data_id+']').length > 0) {
300                                $(this).hide();
301                                $('.block_main_photo[data-id='+data_id+']').show();
302                }
303});

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.