PageSourceSearch

https://www.partscatcher.com/js/d5857d2a686ba988b75a446330de7b0b/legacy.js

js partscatcher.com collected 2026-10-04 05:00:06 UTC 13,421 bytes, 359 lines download raw bytes

1/*
2 * Bones Scripts File
3 * Author: Eddie Machado
4 *
5 * This file should contain any js scripts you want to add to the site.
6 * Instead of calling it in the header or throwing it inside wp_head()
7 * this file will be called automatically in the footer so as not to
8 * slow the page load.
9 *
10 * There are a lot of example functions and tools in here. If you don't
11 * need any of it, just remove it. They are meant to be helpers and are
12 * not required. It's your world baby, you can do whatever you want.
13*/
14
15
16/*
17 * Get Viewport Dimensions
18 * returns object with viewport dimensions to match css in width and height properties
19 * ( source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript )
20*/
21function updateViewportDimensions() {
22	var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
23	return { width:x,height:y };
24}
25// setting the viewport width
26var viewport = updateViewportDimensions();
27
28
29/*
30 * Throttle Resize-triggered Events
31 * Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile.
32 * ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed )
33*/
34var waitForFinalEvent = (function () {
35	var timers = {};
36	return function (callback, ms, uniqueId) {
37		if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; }
38		if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); }
39		timers[uniqueId] = setTimeout(callback, ms);
40	};
41})();
42
43// how long to wait before deciding the resize has stopped, in ms. Around 50-100 should work ok.
44var timeToWaitForLast = 100;
45
46
47/*
48 * Here's an example so you can see how we're using the above function
49 *
50 * This is commented out so it won't work, but you can copy it and
51 * remove the comments.
52 *
53 *
54 *
55 * If we want to only do it on a certain page, we can setup checks so we do it
56 * as efficient as possible.
57 *
58 * if( typeof is_home === "undefined" ) var is_home = $('body').hasClass('home');
59 *
60 * This once checks to see if you're on the home page based on the body class
61 * We can then use that check to perform actions on the home page only
62 *
63 * When the window is resized, we perform this function
64 * $(window).resize(function () {
65 *
66 *    // if we're on the home page, we wait the set amount (in function above) then fire the function
67 *    if( is_home ) { waitForFinalEvent( function() {
68 *
69 *	// update the viewport, in case the window size has changed
70 *	viewport = updateViewportDimensions();
71 *
72 *      // if we're above or equal to 768 fire this off
73 *      if( viewport.width >= 768 ) {
74 *        console.log('On home page and window sized to 768 width or more.');
75 *      } else {
76 *        // otherwise, let's do this instead
77 *        console.log('Not on home page, or window sized to less than 768.');
78 *      }
79 *
80 *    }, timeToWaitForLast, "your-function-identifier-string"); }
81 * });
82 *
83 * Pretty cool huh? You can create functions like this to conditionally load
84 * content and other stuff dependent on the viewport.
85 * Remember that mobile devices and javascript aren't the best of friends.
86 * Keep it light and always make sure the larger viewports are doing the heavy lifting.
87 *
88*/
89
90/*
91 * We're going to swap out the gravatars.
92 * In the functions.php file, you can see we're not loading the gravatar
93 * images on mobile to save bandwidth. Once we hit an acceptable viewport
94 * then we can swap out those images since they are located in a data attribute.
95*/
96function loadGravatars() {
97  // set the viewport using the function above
98  viewport = updateViewportDimensions();
99  // if the viewport is tablet or larger, we load in the gravatars
100  if (viewport.width >= 800) {
101  jQuery('.comment img[data-gravatar]').each(function(){
102    jQuery(this).attr('src',jQuery(this).attr('data-gravatar'));
103  });
104	}
105} // end function
106
107
108/*
109 * Put all your regular jQuery in here.
110*/
111jQuery(document).ready(function($) {
112
113  loadGravatars();
114
115
116// Mostrar formulario de contacto según el país seleccionado
117          /*
118          var pais = $('#contact_pais_es').val(); // get selected value
119          //console.log(pais);
120          if (pais == 'es') { // require a URL
121              $("[id^=wpcf7-f2142]").css("display", "");
122              $("[id^=wpcf7-f2146]").css("display", "none");
123              $("[id^=wpcf7-f2149]").css("display", "none");
124              $("[id^=wpcf7-f76]").css("display", "none");
125              $("[id^=wpcf7-f4889]").css("display", "none");
126
127          };
128          */
129
130      $('#pais').on('change', function () {
131          var pais = $(this).val(); // get selected value
132          var data = "";
133          if (pais == 'es') { // mostrar formulario para España
134              var options = $('#spainlist option');
135              $.each( options, function( i, val ) {
136                  data = data + "<option value='"+val.value+"'>"+val.text+"</option>";
137              });
138          }
139          if (pais == 'cn') { // require a URL
140              var options = $('#chinalist option');
141              $.each( options, function( i, val ) {
142                  data = data + "<option value='"+val.value+"'>"+val.text+"</option>";
143              });
144              
145          }
146          if (pais == 'br') { // require a URL
147             var options = $('#brazillist option');
148              $.each( options, function( i, val ) {
149                  data = data + "<option value='"+val.value+"'>"+val.text+"</option>";
150              });
151
152          }
153          if (pais == 'usa') { // require a URL
154              var options = $('#usalist option');
155              $.each( options, function( i, val ) {
156                  data = data + "<option value='"+val.value+"'>"+val.text+"</option>";
157              });
158
159          }
160          if (pais == 'in') { // require a URL
161              var options = $('#indialist option');
162              $.each( options, function( i, val ) {
163                  data = data + "<option value='"+val.value+"'>"+val.text+"</option>";
164              });
165          }
166
167          $("#spainlist").html(data);
168          return false;
169      });
170    
171
172/*if(window.location.href.indexOf('/cn/solar-power')){
173    jQuery(".textcontinentes").html('<span class="counter counter-default">4</span>');
174}*/
175
176  /* Luis fondo Menu activo */
177  $('.responsive-menu-pro-subarrow').click(function(){
178    if ( $('.responsive-menu-pro-subarrow').is('.responsive-menu-pro-subarrow-active') ){
179      
180      $(this).css('cssText', 'Background: #3c3c3b !important; Color: #fff !important;');
181      $(this).parent().css('cssText', 'Background: #3c3c3b !important; Color:#fff !important;');
182    }else{
183      $(this).css('cssText', 'Background: #fff !important; Color: #3c3c3b !important;');
184      $(this).parent().css('cssText', 'Background: #fff !important; Color:#3c3c3b !important;');
185      
186    }
187  });
188
189  $('.map .bg-map ').css('background','url(/wp-content/themes/hine2019/dist/images/pages/home/hine-map_'+$('meta[property="og:locale"]').attr('content')+'.jpg) no-repeat center center')
190                    .css('background-size', 'cover');
191
192	/* Hover sobre las imagenes de International Group */
193  $('.arrows li').hover(function(){
194    var locale = $('meta[property="og:locale"]').attr('content');
195    $('.map .arrows a').removeClass('active');
196    $('.map .box').find('div').removeClass('active');
197    $(this).find('a').addClass('active');
198    $('#map-link').attr('href', $(this).find('a').attr('href') ); 
199    
200
201    if ( $(this).is('.one') ){
202      $('.map .bg-map ').css('background','url(/wp-content/themes/hine2019/dist/images/pages/home/hine-map_'+locale+'.jpg) no-repeat center center')
203                        .css('background-size', 'cover');
204      $('.map .box .one').addClass('active');
205       
206                    
207
208    }else if ( $(this).is('.two') ){
209      $('.map .bg-map ').css('background','url(/wp-content/themes/hine2019/dist/images/pages/home/innovation.jpg) no-repeat center center')
210                        .css('background-size', 'cover');
211      $('.map .box .two').addClass('active'); 
212      					
213    }else if ( $(this).is('.three') ){
214      $('.map .bg-map ').css('background','url(/wp-content/themes/hine2019/dist/images/pages/home/catalogue.jpg) no-repeat center center')
215                        .css('background-size', 'cover');	
216      $('.map .box .three').addClass('active'); 		
217    }
218  });
219
220      /**
221     * Sticky menu
222     */
223    // var stickyNavTop = $('.offset').offset().top;
224
225    // var stickyNav = function () {
226    //     var scrollTop = $(window).scrollTop();
227    //         if (scrollTop > (stickyNavTop)) {
228
229    //         	console.log(scrollTop);
230    //         	console.log(stickyNavTop);
231    //         	$(".header").css('background', 'rgba(255,255,255, 1)').css('position','fixed').css('border-bottom', '1px solid #cccccc').css('transform', 'translateY(0%)').css('transition','all 0.5s linear');
232    //         	$(".nav > li > a").css('color','#3f3f3e');
233    //           $(".search-icon").css('fill','#3f3f3e');
234    //         	$(".logo-absolute").hide();
235    //         	$(".logo-fixed").show();
236
237
238
239    //         } else {
240
241    //         	$(".header").css('background', 'url(/wp-content/themes/hine2019/library/images/bg-header.png) no-repeat right center').css('position','absolute').css('border-bottom', '0px').css('transform', 'translateY(0%)').css('transition','none');
242    //             $(".main-menu li:after").css('background','#8b995a !important');
243    //         	// $(".nav > li > a").css('color','#fff');
244    //           $(".search-icon").css('fill','#fff');
245    //         	$(".logo-fixed").hide();
246    //         	$(".logo-absolute").show();
247  
248    //         }
249
250    // };
251
252    // stickyNav();
253
254    // $(window).scroll(function () {
255    //     stickyNav();
256    // });
257
258    
259    $('#searchsubmit').html('<i class="fa fa-search" aria-hidden="true"></i>');
260
261    $('#s').attr("placeholder", "Search");
262
263$('.cdp-cookies-boton-cerrar').text('ACCEPT');
264
265$('.download .menu ').click( {popped: false}, function(e){
266
267    if( $(this).hasClass('hine') ) {
268        $(this).parent().find('.sharebox').hide();
269        $(this).find('.share').show();
270        $(this).removeClass('hine');
271    
272    }else{
273         $(this).parent().parent().find('.item .sharebox').hide();
274         $(this).parent().parent().find('.item .menu').removeClass('hine');
275         $(this).parent().parent().find('.item .menu .share').show();
276        $(this).parent().find('.sharebox').show();
277        $(this).find('.share').hide();
278        $(this).addClass('hine');
279    }
280
281});
282
283
284
285  
286});
287
288jQuery(document).ready(function($){
289    let url = window.location.pathname.toString();
290
291    if ( url.indexOf("/eu/") > -1) {
292        jQuery('header #searchform input').attr('placeholder', 'Bilatu');
293    } if ( url.indexOf("/es/") > -1) {
294        jQuery('header #searchform input').attr('placeholder', 'Buscar');
295    } if ( url.indexOf("/pt/") > -1) {
296        jQuery('header #searchform input').attr('placeholder', 'Pesquisa');
297    } if ( url.indexOf("/cn/") > -1) {
298        jQuery('header #searchform input').attr('placeholder', '搜索');
299    }
300    
301
302    scroll_top_duration = 700,
303    $back_to_top = $('.up a');
304    $go_to_bottom = $('.down a');
305
306  $back_to_top.on('click', function(event){
307    event.preventDefault();
308    $('body,html').animate({
309      scrollTop: 0 ,
310      }, scroll_top_duration
311    );
312  });
313
314  $go_to_bottom.on('click', function(event){
315    event.preventDefault();
316    $('body,html').animate({
317      scrollTop: 860 ,
318      }, scroll_top_duration
319    );
320  });
321
322
323  /*
324  Ejecución de código js al producirse eventos en el DOM de los formularios de Contact Form 7:
325  wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invali
325d input.
326  wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
327  wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
328  wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
329  wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.
330  */
331
332  document.addEventListener('wpcf7mailsent', function( event ) {
333  // El código se lanza al identificar un formulario con su ID: [contact-form-7 id="5611" title="Call 2 Action - BR"]
334  // id="4857" en producción.
335    if ( '4857' == event.detail.contactFormId ) {
336        dataLayer.push({
337                        'event':'eventoPersonalizado',
338                        'eventCategory':'Contacto',
339                        'eventAction':'Formulario Dpto. Ventas BR',
340                        'eventLabel':'Enviado ok'
341                      });
342       }
343  }, false );
344
345  document.addEventListener( 'wpcf7invalid', function( event ) {
346  
347    if ( '4857' == event.detail.contactFormId ) {
348        dataLayer.push({
349                        'event':'eventoPersonalizado',
350                        'eventCategory':'Contacto',
351                        'eventAction':'Formulario Dpto. Ventas BR',
352                        'eventLabel':'Enviado error'
353                      });
354       }
355  }, false );
356
357
358
359}); 

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.