PageSourceSearch

https://e3lithium.ca/_templates/2/source/js/main.js?v=0.103

js e3lithium.ca collected 2026-09-24 21:00:22 UTC 18,794 bytes, 523 lines download raw bytes

1
2$(document).ready(function () {
3
4var widthCheck = function(){
5  return $('#width-check').css('z-index');
6}
7var resized = function(){
8  tableSize();
9  setMobile();
10  videoSize();
11  sustainabilityScroll();
12  sideSticky();
13}
14
15// MOBILE CHECK 
16function detectmob() {
17  var $check = $('#width-check').css('z-index');
18
19  if(!!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Windows Phone|webOS/i)) {
20    return true;
21  } else if($check != 0) {
22    return true;
23  } else {
24    return false;
25  }
26}
27function setMobile(){
28  if(detectmob()){
29    $('body').addClass('mobile');
30  } else {
31    $('body').removeClass('mobile');
32  }
33}
34setMobile();
35
36// NAV SCROLL
37var $scrollCheck = 0;
38var navScroll = function(){ 
39  var $scrollTop = $(window).scrollTop();
40  var $bottom = $(window).scrollTop() + $(window).height();
41  // console.log('top: '+$scrollTop+' bottom: '+$bottom+' height: '+$(document).height());
42  // if ($bottom <= ($(document).height() - 60)) {
43    if (($scrollTop >= 1)) {        // if the site has scrolled hide the top, unless we scroll up
44      $('header.desktop').addClass('scrolled');  
45      $scrollCheck = $scrollTop;      
46    } else {
47      $('header.desktop').removeClass('scrolled');  
48      $scrollCheck = $scrollTop;       
49    }
50  // }
51} 
52navScroll();
53
54// MOBILE TABLE FIX
55var tableFix = function(){
56  $('#content table').each(function(){
57    if(!$(this).hasClass('nofix')){
58      $(this).wrap("<div class='overflow " + $(this).attr('class') + "'></div>");
59    }
60  });
61}
62tableFix();
63var tableSize = function(){   
64  $('#content div.overflow').each(function(){
65    $(this).next('p.instruction').remove();
66    $(this).after('<p class="instruction">Scroll right to view more <i class="fas fa-arrow-right"></i></p>');
67    var $width = $(this).width();
68    var $scrollWidth = this.scrollWidth;
69    if ($scrollWidth > $width) {
70      $(this).next('p.instruction').addClass('show');
71    }
72  });
73}
74tableSize();
75
76//STOCK DATA DISPLAY
77var stockDisplay = function(){  
78    $('.stock-price .symbols h5').on('click touch', function(){
79      $('.stock-price .info, .stock-price .symbols h5').removeClass('selected');
80      $('.stock-price .info#'+ $(this).data('exchange')).addClass('selected');
81      $(this).addClass('selected');
82    });
83}
84stockDisplay();
85
86// INVESTOR OVERVIEW ANIMATIONS
87var investorOverviewAnimations = function() {
88  if(window.innerHeight < 1060) {
89    $('#investor-landing .downloads').removeClass('delay-4');
90    $('#investor-landing .stock-price').removeClass('delay-5').addClass('delay-1');
91  }  
92}
93investorOverviewAnimations();
94
95// SUSTAINABILITY GOALS SECTION
96var sustainabilityGoals = function(){
97  var $clicked = false;
98  $('#sustainability-landing .figures > div:first-of-type').addClass('active');
99  $('#sustainability-landing .figures-text > div:first-of-type').addClass('active');
100  $('#sustainability-landing .figures > div').each(function(){
101    var $this = $(this);
102    var $index = $('#sustainability-landing .figures > div').index($this);
103    var $text = $('#sustainability-landing .figures-text > div').eq($index).html();
104    $this.find('.mobile').append($text);
105  });
106  $('#sustainability-landing .figures > div').on('click touch', function(){
107    var $this = $(this);
108    var $index = $('#sustainability-landing .figures > div').index($this);
109    $('#sustainability-landing .figures > div').removeClass('active');
110    $('#sustainability-landing .figures-text > div').removeClass('active');
111    $('#sustainability-landing .figures > div').eq($index).addClass('active');
112    $('#sustainability-landing .figures-text > div').eq($index).addClass('active');
113  });
114  $('#sustainability-landing .figures > div').mousedown(function(){
115    $clicked = true;
116  });
117  var $clickCount = 0;
118  var $clickNum = $('#sustainability-landing .figures > div').length;  
119
120  setInterval(function() {
121    if(!$clicked) {
122      if($clickCount == $clickNum) {
123        $clickCount = 0;
124      }
125      $('#sustainability-landing .figures > div').eq($clickCount).click();
126      $clickCount++;
127    }
128  }, 3500);
129}
130sustainabilityGoals();
131
132// ARROW SCROLL
133var sustainabilityScroll = function() {
134  var $offset = 254;
135  if(widthCheck() > 0){
136    $offset = 77;
137  }
138  $('#sustainability-landing .controls > div').on('click touch', function(){
139    var $class = $(this).attr('class').split(' ')[0];
140    var $target = $('#sustainability-landing .text').find('.'+$class).eq(0);
141    $('html, body').animate({
142      'scrollTop':   $target.offset().top - $offset
143    }, 1250);
144  });
145}
146sustainabilityScroll();
147
148// SUSTAINABILITY STICKY NAV
149var stickySustainability = function(){
150  if($('#sustainability-landing').length){
151    var $pos = $('#sustainability-landing .sustainability-content').offset().top;
152    var $winPos = $(window).scrollTop();
153    var $check = $pos - 86;
154    if ($winPos > $check){
155      $('#sustainability-landing .controls').addClass('stuck');
156    } else {
157      $('#sustainability-landing .controls').removeClass('stuck');
158    }
159  }
160}
161
162// WHY INVEST SCROLL STICKY 
163var sideSticky = function() {
164  if($('#stickybar').length) {
165    var $scrollTop = $(window).scrollTop();         // Window scroll position
166    var $sidebarOffsetTop = $('main > .sidebar').offset().top - 172;    // Top of sidebar to indicate time to scroll
167    var $sidebarBottom = $sidebarOffsetTop + $('main > .sidebar').height();   
168    var $sidebarTop = $sidebarBottom - $('#stickybar').height();        // Indicates when sidebar need to switch to absolute
169    var $sidebar = $('#stickybar');
170    if ($scrollTop >= $sidebarTop) {                // If sidebar all the way down
171      $sidebar.addClass('stuck');  
172      $sidebar.removeClass('sticky');
173    } else if ($scrollTop >= $sidebarOffsetTop){    // If sidebar needs to be sticky
174      $sidebar.addClass('sticky');     
175      $sidebar.removeClass('stuck');     
176    } else {                                        // Normal case
177      $sidebar.removeClass('sticky');     
178      $sidebar.removeClass('stuck');
179    }
180  }
181}
182
183// ACCORDIONS
184var accordions = function(){
185  $('.accordion > *:first-child').on('click touch',function(){
186    $(this).next().toggle('slow');
187    $(this).parent('.accordion').toggleClass('open');
188    tableSize();
189  });
190}
191accordions();
192
193// WOW CLASS ADDITION 
194var wowAnimated = function(){
195  $('.wow').each(function(){
196    $(this).addClass('animate__animated');
197  });
198}
199if(!isIOS){wowAnimated();}
200// WOW ANIMATIONS
201function afterReveal (el) {
202  el.addEventListener('animationend', function () {
203    var $this = $(this);
204    $this.find('.delayedAnimation').css('animation-name','fadeIn');
205  });
206}
207if(isIOS){
208  $('.delayedAnimation').css('animation-name','fadeIn');
209}
210if(!isIOS){
211  var wow = new WOW(
212    {
213      boxClass:     'wow',      // animated element css class (default is wow)
214      animateClass: 'animate__animated', // animation css class (default is animated)
215      offset:       200,          // distance to the element when triggering the animation (default is 0)
216      mobile:       true,       // trigger animations on mobile devices (default is true)
217      live:         true,       // act on asynchronously loaded content (default is true)
218      callback:     function(box) {
219        // the callback is fired every time an animation is started
220        afterReveal(box);
221      },
222      scrollContainer: null // optional scroll container selector, otherwise use window
223    }
224  );
225  wow.init();
226  var wowBottom = new WOW(
227    {
228      boxClass:     'wowBottom',      // animated element css class (default is wow)
229      animateClass: 'animate__animated', // animation css class (default is animated)
230      offset:       0,          // distance to the element when triggering the animation (default is 0)
231      mobile:       true,       // trigger animations on mobile devices (default is true)
232      live:         true,       // act on asynchronously loaded content (default is true)
233      callback:     function(box) {
234        // the callback is fired every time an animation is started
235
236      },
237      scrollContainer: null // optional scroll container selector, otherwise use window
238    }
239  );
240  wowBottom.init();
241}
242
243
244// ARROW CIRCLE LINKS
245var arrowCircles = function(){  
246  $('.arrow-button').each(function(){
247    var $svg = '<svg viewBox="0 0 37 37" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><circle cx="18.5" cy="18.5" r="17.5" stroke="#000000" fill="none" stroke-width="1"/><linearGradient id="Gradient" gradientTransform="rotate(233)"><stop offset="0%" stop-color="#ff9900" /><stop offset="100%" stop-color="#d44d27" /></linearGradient></svg>';
248    $(this).append($svg);
249  });
250}
251arrowCircles();
252
253// READ MORE EXPAND COLLAPSE
254$('.read-more').on('click touch', function (e) {
255  var originalHeight = $(this).siblings().css('min-height');
256  var autoHeight = $(this).siblings().get(0).scrollHeight;
257  
258  if ($(this).siblings().hasClass('active')) {
259    $(this).siblings().removeClass('active').animate( { height:originalHeight }, { queue:false, duration:500 });
260    $(this).html("Read More <span>[+]</span>");
261  } else {
262    $(this).siblings().addClass('active').animate( { height:autoHeight }, { queue:false, duration:500 });
263    $(this).html("Read Less <span>[-]</span>");
264  }
265});
266
267// VIEW MORE EXPAND COLLAPSE
268$('.view-more').on('click touch', function (e) {
269  var originalHeight = $(this).siblings().css('min-height');
270  var autoHeight = $(this).siblings().get(0).scrollHeight;
271  
272  if ($(this).siblings().hasClass('active')) {
273    $(this).siblings().removeClass('active').animate( { height:originalHeight }, { queue:false, duration:500 });
274    $(this).html("View More <span>[+]</span>");
275  } else {
276    $(this).siblings().addClass('active').animate( { height:autoHeight }, { queue:false, duration:500 });
277    $(this).html("View Less <span>[-]</span>");
278  }
279});
280
281// // ARROW SCROLL
282// var arrowScroll = function() {
283//   var $offset = 122;
284//   if(widthCheck() > 0){
285//     $offset = 77;
286//   }
287//   $('#hero .arrow').on('click touch', function(){
288//     $('html, body').animate({
289//       'scrollTop':   $('#signup-container-home').offset().top - $offset
290//     }, 1250);
291//   })
292// }
293// arrowScroll();
294
295
296// BG VIDEO SIZING
297var videoSize = function(){
298  var $height = $('#hero .video').outerHeight();
299  var $heroHeight = $('#hero').outerHeight();
300  var $screenWidth = $('#hero').outerWidth();
301  var $width = $height / 0.5625;
302
303  if($width > $screenWidth) {
304    $('#hero .video').css('width',$width+'px');
305    var $left = ($width - $screenWidth) / 2;
306    $('#hero .video').css('left','-'+$left+'px');
307    $('#hero .video').css('height','auto');
308  } else {
309    $('#hero .video').css('width',$screenWidth+'px');
310    $('#hero .video').css('left','0px');
311    $height = $screenWidth * 0.5625;
312    $('#hero .video').css('height',$height+'px');
313  }
314  if($height > $heroHeight) {
315    var $adjustment = ($height - $heroHeight) / 2;
316    $('#hero .video').css('top','-'+$adjustment+'px');
317  } else {
318    $('#hero .video').css('top','0px');
319  }  
320}
321videoSize();
322
323// INVESTORS OVERVIEW
324
325// ABOUT TEXT CHANGE
326var investorsAbout = function() {
327  $('#investor-landing .investor-about .controls > div').on('click touch', function(){
328    var $index = $(this).index();
329    $index = $index + 1;
330    $('#investor-landing .investor-about .controls > div').removeClass('active');
331    $('#investor-landing .investor-about .text > div').removeClass('active');
332    $('#investor-landing .investor-about .controls > div:nth-of-type('+$index+')').addClass('active');
333    $('#investor-landing .investor-about .text > div:nth-of-type('+$index+')').addClass('active');
334  });
335}
336investorsAbout();
337
338// SIGNUP TERMS MODAL
339var termsModal = function() {
340  $('#request-info-form input, #signup-form input, #signup-form button, #sidebar-signup-form button, #popup-signup-form button').on('click touch', function(e){
341    if($('#terms').is(':checked')){
342      var $checked = true;
343    } else {
344      var $checked = false;
345    }    
346    if(!$checked){      
347      e.preventDefault();
348      $('input').blur();
349      $('#terms-modal').toggleClass('show');      
350      $('html').toggleClass('terms-modal'); 
351    }
352  });
353  $('#terms-modal .close, #terms-modal button').on('click touch', function(){
354    $('#terms-modal').toggleClass('show');
355    $('html').toggleClass('terms-modal'); 
356  });
357}
358termsModal();
359
360// ********************* SIGN UP POPUP - JUNE 2022 ********************* //REMOVED DECEMBER 2024********************* //
361// $('#signup-popup .close').on('click touch', function(e){
362//   e.preventDefault();
363//   $('#signup-popup').toggleClass('show');
364//   $('html').toggleClass('terms-modal');
365// });
366
367// var signupPopup = function() {
368//   if(Cookies.get('e3lithium-signup') != 'yes' && Cookies.get('e3lithium-signedup') != 'signedup'){       // Check to see if cookie exists
369//     //SHOW MODAL
370//     setTimeout(function(){$('#signup-popup').toggleClass('show'); $('html').toggleClass('terms-modal');}, 10000);
371//   }
372//   $('#signup-popup .close').on('click touch', function(e){
373    // Cookies.set('e3lithium-signup', 'yes', {expires: 1/24});  // Cookie lasts 1 hour
374    // Cookies.set('e3lithium-signup', 'yes', {expires: 1/288});    // Cookie lasts 5 min
375    // Cookies.set('e3lithium-signup', 'yes', {expires: 0});    // No Cookie
376//     Cookies.set('e3lithium-signup', 'yes', {expires: 1});
377//   });
378//   $('#popup-signup-form button').on('click touch', function(e){
379//     // Cookies.set('e3lithium-signup', 'yes', {expires: 1/24});  // Cookie lasts 1 hour
380//     // Cookies.set('e3lithium-signup', 'yes', {expires: 1/288});    // Cookie lasts 5 min
381//     // Cookies.set('e3lithium-signup', 'yes', {expires: 0});    // No Cookie
382//     Cookies.set('e3lithium-signedup', 'signedup', {expires: 0});
383//   });
384// }
385// // Cookies.set('e3lithium-signup', 'no', {expires: 0});
386// if($('body').hasClass('str-imperialagreement')){signupPopup();}
387
388
389
390
391
392//EMAIL SIGNUP
393function check_email_address(email) {
394  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,}))$/;
395  return re.test(email);
396}
397
398
399var error_checking = function() {
400  $('.required input').focusout(function() {
401    if ($(this).val() == "") {
402      $(this).parent().addClass("error");
403    } else {
404      if ($(this).parent().hasClass("signup-email")) {
405        if (!check_email_address($(this).val())) {
406          $(this).parent().addClass("error");
407        } else {
408          $(this).parent().removeClass('error');
409          $(this).parent().addClass('success');
410        }
411      } else {
412        $(this).parent().removeClass('error');
413        $(this).parent().addClass('success');
414      }
415    }
416  });
417
418
419  $('#signup-form, #signup-form-home, #sidebar-signup-form, #popup-signup-form').on('click touch', function(){
420    $('.grecaptcha-badge').addClass('show');
421  });
422  $('#signup-form, #sidebar-signup-form, #popup-signup-form').submit ( function() {
423
424     var $message = $('.signup-message'); // Variable for selecting appropriate signup message
425    $message.empty().hide();
426
427    var $this = $(this);
428
429    grecaptcha.ready(function() {                                                  // Call the V3 Recaptcha system
430      grecaptcha.execute($recaptcha_site_key, {action: 'submit'}).then(function(token) {
431        if ( $('#recaptchaResponse1').length > 0 )  {$('#recaptchaResponse1').val(token);}
432
433        if ( $('#recaptchaResponse2').length > 0 )  {$('#recaptchaResponse2').val(token);}
434        
435        if ( $('#recaptchaResponse3').length > 0 )  {$('#recaptchaResponse3').val(token);}
436     
437        // ORIGINAL AJAX CODE GOES HERE
438
439         var $form = $this,
440          formData = $form.serialize(),
441          formUrl = $form.attr('action'),
442          formMethod = $form.attr('method'),
443          //responseMsg = $('.signup-message');
444          responseMsg = $message;
445
446        $.ajax({     
447          url: formUrl,
448          type: formMethod,
449          data: formData,
450
451          success:function(data){
452            var responseData = jQuery.parseJSON(data);
453            switch(responseData.SUCCESS){
454            case 'false':
455              $('.form-details, #form-details').show();
456              responseMsg.empty().hide().fadeIn('slow').append(responseData.CONFIRMATION);
457              break;
458            case 'true':
459              $('.form-details, #form-details').hide().removeClass('show');
460              $('#about').removeClass('show');
461              $('.grecaptcha-badge').removeClass('show');
462              responseMsg.empty().hide().fadeIn('slow').append(responseData.CONFIRMATION);
463              break;
464            }
465          }
466        });
467      });
468    });
469  return false;
470  });
471}
472error_checking();
473
474  // MODAL
475  $('.popup-link').on('click', function(e) {
476    $('#'+$(this).data('popup')).stop().fadeIn();
477    if ($(this).data('popup') == "search-popup") $('#s').focus();
478  });
479  $('.popup-container .close').on('click', function(e) {
480    $('.popup-container').stop().fadeOut();
481  });
482
483
484  //MOBILE MENU
485  $('.hamburger').on('click touch', function(e){
486    e.stopPropagation();
487    if($('header.mobile').hasClass("open")) {
488      $(this).parent().siblings('nav').slideUp(300);
489      $('header.mobile').removeClass('open');
490      $(this).attr("aria-expanded","false");
491    } else {
492      $(this).parent().siblings('nav').slideDown(300);
493      $('header.mobile').addClass('open');
494      $(this).attr("aria-expanded","true");
495    }
496  });
497  $('.mobile-menu .has-children a.has-submenu').on('click touch', function(e) {
498    e.preventDefault();
499    if($(this).parent('.has-children').hasClass("active")) {
500        $('.has-children').removeClass('active').children('ul').slideUp(300);
501      } else {
502        $('.has-children').removeClass('active').children('ul').slideUp(300);
503        $(this).parent('.has-children').addClass('active');
504        $(this).siblings('ul').slideDown(300);
505      }
506  });
507  // Mobile chrome resizes on scroll, add width check to fix
508  var width = $(window).width();
509  var height = $(window).height();
510  $(window).resize(function() {
511    if($(window).width() != width || $(window).height() != height){
512      setTimeout(function(){resized();},250);
513    }
514  });
515
516  $(window).scroll(function() {
517    navScroll();
518    // stickySustainability();
519    sideSticky();
520  });
521
522});
523

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.