PageSourceSearch

https://numericoach.fr/wp-content/themes/numericoach-theme/js/core.js?ver=1.2

js numericoach.fr collected 2026-10-01 23:49:04 UTC 9,077 bytes, 266 lines download raw bytes

1// Core file for all js functions.
2
3let popup__overflay, popup__content;
4
5
6/**
7 * Tests if an URL is valid
8 * 
9 * @param {string} string 
10 * @returns {boolean}
11 */
12function isValidUrl(string) {
13  try {
14    new URL(string);
15    return true;
16  } catch (err) {
17    return false;
18  }
19}
20
21/**
22 * Adds responsive stuff whenever needed.
23 */
24function applyResponsive() {
25  if (window.innerWidth < 768) {
26    jQuery('footer p.menu-title').on('click', function (el) {
27      if (jQuery('footer ul[data-child="' + el.currentTarget.getAttribute('data-parent') + '"]').hasClass('openMobile')) {
28        jQuery('footer ul').removeClass('openMobile');
29        el.currentTarget.classList.remove('openSS');
30      }
31      else {
32        jQuery('footer ul').removeClass('openMobile');
33        jQuery('footer p.menu-title').removeClass('openSS');
34        el.currentTarget.classList.add('openSS');
35        jQuery('footer ul[data-child="' + el.currentTarget.getAttribute('data-parent') + '"]').addClass('openMobile');
36      }
37    });
38  }
39}
40
41/**
42 * Function to create a popup. Only one popup at a time may be use with this.
43 * 
44 * @param {string} htmlContent 
45 */
46function openPopup(htmlContent) {
47  popup__overflay.classList.add('openPopup');
48  popup__content.innerHTML = htmlContent;
49}
50
51/**
52 * Function to close a popup opened with the previous function, openPopup.
53 */
54function closePopup() {
55  popup__overflay.classList.remove('openPopup');
56  popup__content.innerHTML = '';
57}
58
59/**
60 * Initialize everything once the document is ready, using the previous functions
61 */
62jQuery(document).ready(function () {
63  // Add target blank to all external links, used in the global wordpress menu
64  let allLinksOutside = document.querySelectorAll('a.external, li.external a');
65  allLinksOutside.forEach(function (el) {
66    el.setAttribute('target', '_blank');
67  });
68
69  popup__overflay = document.querySelector('.popup__overlay');
70  popup__content = document.querySelector('.popup__content');
71
72  popup__overflay.addEventListener('click', function (el) {
73    console.log(el.target.getAttribute('class').search('popup__overlay')); if (el.target.getAttribute('class').search('popup__overlay') != -1) {
74      closePopup();
75    }
76  });
77  jQuery('a[href="#contactFormation"]').on('click', function () {
78    window.open('https://go.numericoach.fr/discutons-en', '_blank').focus();
79  });
80  jQuery('a[href="#contactPrestation"]').on('click', function () {
81    window.open('https://go.numericoach.fr/prestations', '_blank').focus();
82  });
83  jQuery('a[href="#contactLicence"]').on('click', function () {
84    window.open('https://go.numericoach.fr/revente-de-licences-gw', '_blank').focus();
85  });
86  jQuery('a[href="#guideFinancement"]').on('click', function () {
87    openPopup('<iframe class="hs_external_hubspot" src="https://share-eu1.hsforms.com/18QkrJ1_PRGyOPs04SBSfNwf4sda"></iframe>');
88  });
89  jQuery('a[href="#candidature"]').on('click', function () {
90    openPopup('<iframe class="hs_external_hubspot" src="https://share-eu1.hsforms.com/1UuOd3ynQQXejtYUYP3_cXgf4sda"></iframe>');
91  });
92
93  applyResponsive();
94
95  jQuery('.btnx .elementor-button-link[href="#"]').parent().parent().parent().addClass('disabledBtn');
96  jQuery('.btnx a[href="#"]').parent().addClass('disabledBtn');
97  triggerSubligned();
98  jQuery('.styledSelec').select2({
99    minimumResultsForSearch: Infinity
100  });
101  jQuery('.greenSelect').select2({
102    minimumResultsForSearch: Infinity,
103    dropdownCssClass: 'greenSelect',
104    selectionCssClass: 'greenSelect'
105  });
106  jQuery('.redSelect').select2({
107    minimumResultsForSearch: Infinity,
108    dropdownCssClass: 'redSelect',
109    selectionCssClass: 'redSelect'
110  });
111  jQuery('.blueSelect').select2({
112    minimumResultsForSearch: Infinity,
113    dropdownCssClass: 'blueSelect',
114    selectionCssClass: 'blueSelect'
115  });
116  jQuery('.yellowSelect').select2({
117    minimumResultsForSearch: Infinity,
118    dropdownCssClass: 'yellowSelect',
119    selectionCssClass: 'yellowSelect'
120  });
121  jQuery('.typeSelector').on('select2:select', function (e) {
122    document.querySelector('body').style.opacity = '0.3';
123    document.querySelector('.formType').submit();
124  });
125  jQuery('.typeSelectorMobile').on('select2:select', function (e) {
126    document.querySelector('body').style.opacity = '0.3';
127    document.querySelector('.formTypeMobile').submit();
128  });
129
130  function isInViewportDouble(element) {
131    var rect = element.getBoundingClientRect();
132    var html = document.documentElement;
133    return (
134      rect.top >= 0 &&
135      rect.left >= 0 &&
136      rect.bottom <= (window.innerHeight - 200 || html.clientHeight - 200) &&
137      rect.right <= (window.innerWidth || html.clientWidth)
138    );
139  }
140  var prevScrollpos = window.pageYOffset;
141  window.onscroll = function () {
142    var currentScrollPos = window.pageYOffset;
143    if (currentScrollPos < 20) {
144      document.querySelector(".topNav").style.transform = "translateY(0px)";
145      document.querySelector(".headL").style.transform = "translateY(80px)";
146      document.querySelector('.headL').classList.remove('blurring');
147      document.querySelector('body').classList.remove('scrolling');
148    } else {
149      document.querySelector(".topNav").style.transform = "translateY(-80px)";
150      document.querySelector(".headL").style.transform = "translateY(0px)";
151      document.querySelector('.headL').classList.add('blurring');
152      document.querySelector('body').classList.add('scrolling');
153    }
154    triggerSubligned();
155    prevScrollpos = currentScrollPos;
156  }
157
158  function triggerSubligned() {
159    let listSubligned = document.querySelectorAll('.subligned');
160    for (let i = 0; i < listSubligned.length; i++) {
161      if (isInViewportDouble(listSubligned[i])) {
162        listSubligned[i].classList.add('subliAnim');
163      }
164      else {
165        listSubligned[i].classList.remove('subliAnim');
166      }
167    }
168  }
169  jQuery('.respHeader .hambMenu').on('click', function (el) {
170    jQuery('.respHeader').toggleClass('opened');
171  });
172  jQuery('#content').on('click', function (el) {
173    jQuery('.dropdwn').removeClass('active');
174    jQuery('.subMenuDesk').removeClass('showDrop');
175    jQuery('#content').removeClass('backdrp');
176  });
177  let listAvailablesMenu = Array.from(document.querySelectorAll('div[data-hash]')).map((menu) => menu.getAttribute('data-hash'));
178  let currentHash = location.hash;
179  currentHash = currentHash.replace('#', '');
180  // Protect mobile auto activation
181  if(window.screen.availWidth>1065) {
182    if (listAvailablesMenu.includes(currentHash)) {
183      jQuery('.headL .dropdwn').removeClass('active');
184      jQuery('.subMenuDesk').removeClass('showDrop');
185      jQuery('.headL .dropdwn.' + currentHash).addClass('active');
186      jQuery('.subMenuDesk.' + currentHash).addClass('showDrop');
187      jQuery('#content').addClass('backdrp');
188    }
189  }
190  jQuery('.headL .dropdwn').on('click', function (el) {
191    var activated = false;
192
193    if (jQuery(this).hasClass('active')) {
194      jQuery('.dropdwn').removeClass('active');
195      var activated = false;
196    }
197    else {
198      jQuery('.dropdwn').removeClass('active');
199      jQuery(this).toggleClass('active');
200      activated = true;
201    }
202    var nameSub = jQuery(this).attr('class').split(' ')[1];
203    jQuery('.subMenuDesk.' + nameSub).toggleClass('showDrop');
204    jQuery('.subMenuDesk:not(.' + nameSub + ')').removeClass('showDrop');
205    location.hash = nameSub;
206    if (activated) {
207      jQuery('#content').addClass('backdrp');
208    }
209    else {
210      jQuery('#content').removeClass('backdrp');
211    }
212    return false;
213  });
214
215  jQuery('.respHeader .dropdwn').on('click', function (el) {
216    var activated = false;
217
218    if (jQuery(this).hasClass('active')) {
219      jQuery('.dropdwn').removeClass('active');
220      var activated = false;
221    }
222    else {
223      jQuery('.dropdwn').removeClass('active');
224      jQuery(this).toggleClass('active');
225      activated = true;
226    }
227    var nameSub = jQuery(this).attr('class').split(' ')[1];
228    jQuery('.subMenuMobile.' + nameSub).toggleClass('showDrop');
229    jQuery('.subMenuMobile:not(.' + nameSub + ')').removeClass('showDrop');
230    location.hash = nameSub;
231    if (activated) {
232      jQuery('#content').addClass('backdrp');
233    }
234    else {
235      jQuery('#content').removeClass('backdrp');
236    }
237    return false;
238  });
239  
240  
241  jQuery('.retButton').on('click', function () {
242    jQuery('.subMenuMobile').removeClass('openedMobile');
243    jQuery('.subMenuMobile').removeClass('showDrop');
244    jQuery('.subMenuMobile').animate({
245      left: "-100%"
246    }, 5, function () {
247      setTimeout(function () {
248        jQuery('.subMenuMobile').css('left', '100%');
249      }, 500);
250    });
251  });
252  jQuery('a[href="#share"]').on('click', function (e) {
253    e.preventDefault();
254    SnackBar({
255      message: "Lien copié dans le presse-papier",
256      fixed: true,
257      status: "success"
258    });
259    navigator.clipboard.writeText(jQuery(this).attr('data-url'));
260  });
261});
262let globalMouse = { "x": window.innerWidth / 2, "y": window.innerHeight / 2 };
263jQuery(window).on('mousemove', function (event) {
264  globalMouse.x = event.clientX;
265  globalMouse.y = event.clientY;
266});

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.