1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6(function ($, Drupal) { 7 8 'use strict'; 9 10 Drupal.behaviors.robroy = { 11 attach: function (context, settings) { 12 $(window).on('scroll', function(event) { 13 var top = this.scrollY,left = this.scrollX; 14 if(top > 100) { 15 $('#go-to-top').css('display','block'); 16 } 17 else { 18 $('#go-to-top').css('display','none'); 19 } 20 if (window.scrollY > 70) { 21 document.body.classList.add('fixed-header'); 22 } else { 23 document.body.classList.remove('fixed-header'); 24 } 25 }); 26 $(window).on('load', function(event) { 27 var secondaryActive = $('.region-secondary-menu li.active').length; 28 if(secondaryActive){ 29 $('.region-secondary-menu li.active a')[0].scrollIntoView({behavior: "auto", block: "end", inline: "end"}); 30 } 31 }); 32 $(document).ready(function(){ 33 let date = new Date(); 34 var copyrightYear = date.getFullYear(); 35 document.getElementById('copyrightyear').innerHTML = copyrightYear; 36 if( $('table').length > 0 ) { 37 $('table').not('.product-table').addClass('tablesaw'); 38 $('table').not('.product-table').attr('data-tablesaw-mode','stack'); 39 $('head').append('<script src="/libraries/tablesaw/dist/tablesaw-init.js"></script>'); 40 } 41 $('form.webform-submission-request-3d-cad-download-form').submit(function() { 42 this.submit(); 43 setTimeout(function(form) { 44 var cad3dmodalEl = document.getElementById('cad-drawing-request-412') 45 var cad3dmodal = bootstrap.Modal.getInstance(cad3dmodalEl) 46 cad3dmodal.hide(); 47 form.reset(); 48 }, 2000, this); 49 return true; 50 }); 51 $(once("scrollTopBehaviour",'#go-to-top',context)).on('click', function(){ 52 $("html, body").animate({ 53 scrollTop: 0 54 }, 'fast'); 55 }); 56 $(".blog-carousel, .video-carousel").owlCarousel({ 57 autoplay: false, 58 loop: false, 59 nav: true, 60 navText: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150.91 101.82"><path style="fill:#0a9357" d="m12.63 63.34 37.89 38.48 12.82-12.63-28.97-29.43h116.54v-18H34.54l29.39-28.93L51.3 0 0 50.52l12.63 12.82z"/></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150.91 101.82"><path style="fill:#0a9357" d="M138.28 38.48 100.39 0 87.57 12.63l28.97 29.43H0v18h116.37L86.98 89l12.63 12.82 51.3-50.52-12.63-12.82z"/></svg>'], 61 dots: false, 62 responsiveClass: true, 63 responsive: { 64 0: { 65 items: 1.05, 66 loop: true, 67 margin: 9 68 }, 69 600: { 70 items: 2, 71 margin: 29 72 }, 73 800: { 74 items: 2, 75 margin: 29 76 }, 77 1000: { 78 items: 3, 79 margin: 29 80 }, 81 1200: { 82 items: 3, 83 margin: 29 84 }, 85 1360: { 86 items: 4, 87 margin: 29 88 }, 89 }, 90 }); 91 }); 92 93 $(once("custom-select-to-list",'select[name="title"]', context)).each(function () { 94 const $select = $(this); 95 const $form = $select.closest('form'); 96 97 $select.hide(); 98 99 const $list = $('<ul class="custom-filter-list"></ul>').insertAfter($select); 100 101 $select.find('option').each(function () { 102 const $option = $(this); 103 const $li = $('<li></li>'); 104 const $link = $('<a href="#" data-value="' + $option.val() + '">' + $option.text() + '</a>'); 105 106 // Add active class if selected 107 if ($option.is(':selected')) { 108 $link.addClass('active'); 109 } 110 111 $li.append($link); 112 $list.append($li); 113 }); 114 115 $list.on('click', 'a', function (e) { 116 e.preventDefault(); 117 118 const $link = $(this); 119 const value = $link.data('value'); 120 121 // Set select value and trigger change 122 $select.val(value).trigger('change'); 123 124 // Update active class 125 $list.find('a').removeClass('active'); 126 $link.addClass('active'); 127
128 const $ajaxSubmit = $form.find('input.use-ajax[type="submit"], button.use-ajax[type="submit"]'); 129 if ($ajaxSubmit.length) { 130 const ajaxObject = Drupal.ajax($ajaxSubmit.get(0)); 131 ajaxObject.eventResponse($.Event('click')); 132 return false; 133 } 134 }); 135 }); 136 } 137 }; 138})(jQuery, Drupal);
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.