PageSourceSearch

https://laivagold.com/_templates/2/source/js/scripts.js?v=0.421

js laivagold.com collected 2026-10-04 22:57:09 UTC 10,443 bytes, 329 lines download raw bytes

1function check_email_address(email) {
2  var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
3  return re.test(email);
4}
5
6$(document).ready(function(){
7// ********************* MOBILE CHECK ********************* //
8function detectmob() {                        // function to test if on a mobile device
9  var $check = $('#width-check').css('z-index');
10  if(!!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Windows Phone|webOS/i)) {
11    return true;
12  } else if($check != 0) {
13    return true;
14  } else {
15    return false;
16  }
17}
18
19var mobileMenuFunctions = function() {
20  $('header#is-mobile ul.top > li.has-submenu > a').on('click touch', function(e){
21    e.preventDefault();
22    if($(this).hasClass('show')) {
23      $('header#is-mobile ul.top').removeClass('show');
24      $('header#is-mobile ul.top > li.has-submenu').removeClass('show');
25      $('header#is-mobile ul.top > li.has-submenu > a').removeClass('show');
26      $('header#is-mobile ul.sub').slideUp();
27    } else {
28      $('header#is-mobile ul.top').removeClass('show');
29      $('header#is-mobile ul.top > li.has-submenu').removeClass('show');
30      $('header#is-mobile ul.top > li.has-submenu > a').removeClass('show');
31      $('header#is-mobile ul.sub').slideUp();
32      $(this).next().slideToggle();
33      $(this).addClass('show');
34      $(this).closest('ul.top').addClass('show');
35      $(this).closest('li').addClass('show');
36    }
37  });
38  $('header#is-mobile ul.sub > li.has-submenu > a').on('click touch', function(e){
39    e.preventDefault();
40    $(this).next().slideToggle();
41    $(this).toggleClass('show');
42  });
43
44  // MOBILE NAV OPEN
45  $('header#is-mobile .menu-icon').on('click touch', function(){
46    $('header#is-mobile').toggleClass('open');
47  });
48
49}
50mobileMenuFunctions();
51
52var mobileMenuHeightFix = function() {        // Function to make 100vh actually work on mobile
53  let vh = window.innerHeight * 0.01;         // in CSS replace 100vh with calc(var(--vh, 1vh) * 100)
54  document.documentElement.style.setProperty('--vh', `${vh}px`);
55}
56mobileMenuHeightFix();
57
58// BMCL DOWNLOADS 1
59var bmclDownloads1 = function() {
60  $('.bmcl-downloads-1 > div').each(function(){
61    var $link = $(this).find('a').clone();
62    var $text = $(this).find('a').text();
63    $link.html('');
64    $link.attr('aria-label',$text);
65    $(this).append('<div><div class="icon"></div></div>');
66    $(this).append($link);
67  });
68}
69bmclDownloads1();
70
71// BMCL ACCORDION 1
72var bmclAccordion1Handler = function(){
73  $('div[class^="bmcl-accordion-"] > div').on('click touch',function(){
74    $(this).toggleClass('active');
75    $(this).find('div').slideToggle();
76  });
77}
78bmclAccordion1Handler();
79
80// BMCL-Table-1
81var tableFix = function(){
82  $('table[class^="bmcl-table"]').each(function(){
83    if (!$(this).parents('.overflow').length) {
84      $(this).wrap("<div class='overflow'></div>");
85    }
86  });
87}
88tableFix();
89
90var tableSize = function(){
91  $('div.overflow').each(function(){
92    $(this).next('p.table-overflow-msg').remove();
93    $(this).after('<p class="table-overflow-msg">Scroll right to view more <img alt="Scroll" src="'+$path+'_resources/icons/table-overflow-arrow.svg"/></p>');
94    var $width = $(this).width();
95    var $scrollWidth = this.scrollWidth;
96    if ($scrollWidth > $width) {
97      $(this).next('p.table-overflow-msg').addClass('show');
98    }
99  });
100}
101tableSize();
102
103// ********************* Nav Scroll ********************* //
104// $(window).bind("scroll", function() {
105//   if ($(this).scrollTop() > 0) {
106//     $("header").addClass("fixed");
107//   } else {
108//     $("header").removeClass("fixed");
109//   }
110// });
111
112//********************** Search ***************************//
113$('.top-search i').on('click', function(e) {
114  e.preventDefault();
115  $('.top-search').toggleClass('active');
116  $('.top-search i ').toggleClass('fa-search fa-times');
117  $('.top-search  #s').focus();
118});
119
120// ********************* Required Input Handling ********************* //
121  //Error checking
122  $('.required input').focusout(function() {
123    if ($(this).val() == "") {
124      $(this).parent().addClass("error");
125    } else {
126      if ($(this).parent().hasClass("signup-email")) {
127        if (!check_email_address($(this).val())) {
128          $(this).parent().addClass("error");
129          }
130         else {
131          $(this).parent().removeClass('error');
132        }
133      } else {
134          $(this).parent().removeClass('error');
135      }
136    }
137  });
138
139// ********************* Recaptcha Show ********************* //
140$('form.signup').on('click touch', function(){
141  $('.grecaptcha-badge').addClass('show');
142});
143
144// ********************* Form Submission & Error Checking  ********************* //
145$('#consent-modal .close, #consent-modal button').on('click touch',function(){
146  $('#consent-modal').removeClass('show');
147  if($('#consent-modal input[type="checkbox"]').is(":checked")) {$('form.signup').submit();}
148});
149
150
151$('form.signup').submit ( function(e) {
152  e.preventDefault();
153  var $consent = ($('#consent-modal input[type="checkbox"]').is(":checked")) ? true : false;
154
155  if(!$consent) {
156    $('#consent-modal').addClass('show');
157  } else {
158  
159    var $form = $(this)
160    var $message = $(this).next('.signup-message'); // Variable for selecting appropriate signup message
161    $message.empty().hide().fadeIn('slow').append("Please wait!");
162
163    grecaptcha.ready(function() {         // Call the V3 Recaptcha system
164      grecaptcha.execute($recaptcha_site_key, {action: 'submit'}).then(function(token) {
165
166        $("recaptchaResponse1").val(token);
167        $("recaptchaResponse2").val(token);
168
169        var formData = $form.serialize();
170        var formArray = $form.serializeArray();
171        var formUrl = $form.attr('action');
172        var formMethod = $form.attr('method');
173        var responseMsg = $message;
174
175        // console.log(formData);
176        $.ajax({
177          url: formUrl,
178          type: formMethod,
179          data: formData,
180          success:function(data){
181            var responseData = jQuery.parseJSON(data);
182            switch(responseData.SUCCESS){
183            case 'false':
184              // grecaptcha.reset();
185              $form.show();
186              responseMsg.empty().hide().fadeIn('slow').append(responseData.CONFIRMATION);
187              break;
188            case 'true':
189
190              $('.grecaptcha-badge').removeClass('show');
191              $form.hide();
192              $message.css("position","static");
193              responseMsg.empty().hide().fadeIn('slow').append(responseData.CONFIRMATION);
194              break;
195            }
196          }
197        });
198
199      });
200  });
201}
202return false;
203});
204
205
206
207// $('form.signup').submit(function(event) {
208//     // Prevent the default form submission
209//     event.preventDefault();
210//     var errors = false;
211//     var form = $(this);
212//     var $message = $(this).next('.signup-message');
213//     $message.empty().hide().fadeIn('slow').append("Please wait!");
214
215//     form.find('.required input').each( function(){
216//       $(this).parent().removeClass('error');
217//       if ($(this).val() == "") {
218//         $(this).parent().addClass("error");
219//         $message.empty().hide().fadeIn('slow').append("Required fields empty!")
220//         errors = true;
221//       } else if ($(this).parent().hasClass("signup-email") && !check_email_address($(this).val())) {
222//         $(this).parent().addClass("error");
223//         $message.empty().hide().fadeIn('slow').append("error!")
224//         errors = true;
225//       }
226//     });
227    
228//     function splitname(fullname) {
229//       var nameparts = fullname.trim().split(' ');
230//       return [nameparts[0], nameparts.slice(1).join(' ')];
231//     }
232//     // Get the HubSpot tracking cookie (hubspotutk)
233//     function getCookie(name) {
234//         var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
235//         return match ? decodeURIComponent(match[3]) : '';
236//     }
237
238//     var hubspotutk = getCookie('hubspotutk');
239//     var formData = {};
240//     $.each(form.serializeArray(), function(i, field) {
241//       if ( field.name === "fullname" ) {
242//         var nameArray = splitname(field.value);
243//         formData['firstname'] = nameArray[0];
244//         formData['lastname'] = nameArray[1];
245//       } else {
246//         formData[field.name] = field.value;
247//       }
248//     });
249
250//     // Structure the data in HubSpot's required JSON format
251//     var postData = {
252//         "fields": [],
253//         "context": {
254//             "hutk": hubspotutk,
255//             "pageUri": window.location.href,
256//             "pageName": document.title
257//         }
258//     };
259//     for (var fieldName in formData) {
260//       postData.fields.push({ "name": fieldName, "value": formData[fieldName] });
261//     }
262    
263//     // Replace with your actual Portal ID and Form ID from HubSpot
264//     var portalId = '342463803';
265//     var formId = 'ddcdead9-fbbd-4ce0-9a66-bba6af610379';
266//     var apiUrl = 'https://api.hsforms.com/submissions/v3/integration/submit/' + portalId + '/' + formId;
267
268//     if ( !errors ) {
269//       // Send the AJAX request
270//       $.ajax({
271//           type: 'POST',
272//           url: apiUrl,
273//           contentType: 'application/json',
274//           data: JSON.stringify(postData),
275//           success: function(response) {
276//             form.hide();
277//             $message.css("position", "static").empty().fadeIn('slow').append(response.inlineMessage);
278//           },
279//           error: function(xhr, status, error) {
280//               // Handle errors
281//               $message.empty().fadeIn('slow').append('Error: ' + error);
282//           }
283//       });
284//     }
285
286// });
287
288
289
290
291
292
293// ********************* Window Scroll Function ********************* //
294var scrollTimeout = null;
295$(window).scroll(function() {
296  mobileMenuHeightFix();
297  if (scrollTimeout) clearTimeout(scrollTimeout);
298  scrollTimeout = setTimeout(function(){
299    /* Put functions that need to be delayed here */
300  },250);
301
302});
303
304// ********************* Resize Functions ********************* //
305var resizeRotate = function(){
306  mobileMenuHeightFix();
307  tableSize();
308}
309
310// Mobile chrome resizes on scroll, add width check to fix
311var width = $(window).width();
312var height = $(window).height();
313$(window).resize(function() {
314  if($(window).width() != width || $(window).height() != height){
315    setTimeout(function(){resizeRotate();},250);
316  }
317});
318
319
320
321
322
323
324
325
326
327
328
329});

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.