PageSourceSearch

https://optezpourletalent.ca/templates/vox/js/scripts.js?2026-03-26-17:25:49.

js optezpourletalent.ca collected 2026-09-29 07:36:50 UTC 13,401 bytes, 433 lines download raw bytes

1var $j = jQuery.noConflict();
2$j(document).ready(function () {
3    // Menu mobile //
4
5    $j(".menu-button").toggle(
6        function () {
7            $j("body").removeClass("menu-close").addClass("menu-open");
8            // $j("html, body").animate({ scrollTop: 0 }, "slow");
9        },
10        function () {
11            $j("body").removeClass("menu-open").addClass("menu-close");
12        }
13    );
14
15    $j(
16        ".module.menu-mobile li.deeper a, .module.menu-mobile li.deeper .separator"
17    ).click(function () {
18        $j(this).parent("li").toggleClass("open");
19    });
20
21    // Prepend
22    // $j('.equipe .item .item-image').each(function() {
23    // 	$j(this).parent().prepend($j(this));
24    // });
25    /*
26    // FAQ
27     $j(".moduletable.accordeon h4.newsflash-title.accordeon").click(function() {
28            $j(this).siblings(".moduletable.accordeon .intro").fadeToggle();
29            $j(this).toggleClass("open");
30        });
31    */
32
33    // Smooth scrolling to any internal tags
34    jQuery("a[href*=#]:not([href=#])").click(function () {
35        if (
36            location.pathname.replace(/^\//, "") ==
37            this.pathname.replace(/^\//, "") &&
38            location.hostname == this.hostname
39        ) {
40            var target = jQuery(this.hash);
41            target = target.length
42                ? target
43                : jQuery("[name=" + this.hash.slice(1) + "]");
44            if (target.length) {
45                jQuery("html,body").animate(
46                    {
47                        scrollTop: target.offset().top - 80,
48                    },
49                    500
50                );
51                return false;
52            }
53        }
54    });
55
56    $j("<br />").insertAfter(".home .blog-featured .item h2");
57
58    // Get height of roadmap image if body has class 'roadmap'
59    if ($j("body").hasClass("roadmap") && window.innerWidth > 700) {
60        var img = $j(
61            ".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard"
62        );
63        if (img.length) {
64            var imgHeight = img.height();
65            var barHeight = imgHeight / 2;
66            var contentHeight = imgHeight + 112;
67
68            // $j(".module.hrRoadmap .mod_flexicontent_standard_wrapper::before,.module.hrRoadmap .mod_flexicontent_standard_wrapper::after").css(
69            // 	"top", bgHeight + "px");
70
71            $j(
72                ".module.hrRoadmap .mod_flexicontent_standard_wrapper .content_standard"
73            ).css("top", contentHeight + "px");
74
75            //    $j("#editor").style.setProperty('--scrollbar-background', localStorage.getItem("Color"));
76
77            // document.documentElement.style.setProperty("--bar-height", barHeight + "px");
78        }
79
80
81    }
82
83    if ($j("body").hasClass("roadmap") && window.innerWidth < 700) {
84        var img = $j(
85            ".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard"
86        );
87        if (img.length) {
88            var imgHeight = img.height();
89            var barHeight = imgHeight / 2;
90            var bartop = (imgHeight / 2) + 45;
91
92            document.documentElement.style.setProperty("--bar-height", barHeight + "px");
93            document.documentElement.style.setProperty("--bar-top", bartop + "px");
94
95        }
96
97
98
99    }
100
101
102
103
104});
105
106// Menu scroll
107$j(document).scroll(function ($) {
108    var scroll = $j(window).scrollTop();
109
110    if (scroll > 120) {
111        $j("body").addClass("scroll");
112    }
113
114    if (scroll <= 120) {
115        $j("body").removeClass("scroll");
116    }
117});
118
119$j(document).scroll(function ($) {
120    var scroll = $j(window).scrollTop();
121
122    if (scroll > 200) {
123        $j("body").addClass("scrolled");
124    }
125
126    if (scroll <= 200) {
127        $j("body").removeClass("scrolled");
128    }
129});
130
131//// skip to content button - focus on next anchor
132$j(".module.skipButton a").click(function (evt) {
133    var anchortarget = $j(this).attr("href");
134    $j(anchortarget).attr("tabindex", -1).focus();
135});
136
137//// faq start
138$j(document).ready(function () {
139    var faq = 0;
140
141    $j(
142        "#flexicontent.fctype5 .element.field_qa .item, .stageAccordions .accItem"
143    ).each(function (oI, oE) {
144        var itemHeader = $j(oE).find("button");
145        var itemBody = $j(oE).find(".item-body");
146        // console.log(faq);
147        idHeader = "header-" + faq;
148        idBody = "body-" + faq;
149
150        itemHeader.attr("id", idHeader).attr("aria-controls", idBody);
151
152        itemBody.attr("id", idBody).attr("aria-labelledby", idHeader);
153
154        faq += 1;
155    });
156});
157
158const accordionHeaders = document.querySelectorAll(
159    "#flexicontent.fctype5 .element.field_qa .item .item-header, .stageAccordions .accItem .item-header"
160);
161Array.prototype.forEach.call(accordionHeaders, (accordionHeader) => {
162    let target = accordionHeader.nextElementSibling;
163    accordionHeader.onclick = () => {
164        let expanded =
165            accordionHeader.getAttribute("aria-expanded") === "true" || false;
166        accordionHeader.setAttribute("aria-expanded", !expanded);
167        target.hidden = expanded;
168        target.parentElement.classList.toggle("open");
169    };
170});
171
172//// faq end
173
174//// add super tyler
175$j("#flexicontent.funding .introblock").tyler({
176    mxwidth: 600,
177    space: 50,
178    bottom: 50,
179    minWidth: 460,
180});
181$j("#flexicontent.facts .introblock").tyler({
182    mxwidth: 600,
183    space: 50,
184    bottom: 50,
185    minWidth: 460,
186});
187
188//// add class to email element
189$j("#flexicontent.funding ul.introblock li.fc_bloglist_item").each(function (
190    oI,
191    oE
192) {
193    var email = $j(oE).find(".label.field_email");
194    if (email.length) {
195        email.parent().addClass("emailField");
196    }
197});
198
199// open sub menu on click
200$j(function () {
201    $j(".module.menu li.parent").on("click", function (e) {
202        if ($j(this).hasClass("open")) {
203            $j(".module.menu li.parent").removeClass("open");
204        } else {
205            $j(".module.menu li.parent").removeClass("open");
206            $j(this).addClass("open");
207            e.stopPropagation();
208        }
209    });
210    $j(document).on("click", function (e) {
211        if ($j(e.target).is(".module.menu li.parent.open") === false) {
212            $j(".module.menu li.parent").removeClass("open");
213        }
214    });
215});
216
217//// quiz start
218$j(document).ready(function () {
219    var quiz = 0;
220
221    $j("#flexicontent.quiz ul li.fc_bloglist_item").each(function (oI, oE) {
222        var itemHeader = $j(oE).find("button");
223        var itemBody = $j(oE).find(".item-body");
224        // console.log(faq);
225        idHeader = "header-" + quiz;
226        idBody = "body-" + quiz;
227
228        itemHeader.attr("id", idHeader).attr("aria-controls", idBody);
229
230        itemBody.attr("id", idBody).attr("aria-labelledby", idHeader);
231
232        quiz += 1;
233    });
234});
235
236const quizHeaders = document.querySelectorAll(
237    "#flexicontent.quiz ul li.fc_bloglist_item .item-header"
238);
239Array.prototype.forEach.call(quizHeaders, (accordionHeader) => {
240    let target = accordionHeader.nextElementSibling;
241    accordionHeader.onclick = () => {
242        let expanded =
243            accordionHeader.getAttribute("aria-expanded") === "true" || false;
244        accordionHeader.setAttribute("aria-expanded", !expanded);
245        target.hidden = expanded;
246    };
247});
248
249//// quiz end
250
251//// tool accordion start
252$j(document).ready(function () {
253    var tool = 0;
254
255    $j("#flexicontent .toolFAQ .mod_flexicontent_standard_wrapper").each(
256        function (oI, oE) {
257            var itemHeader = $j(oE).find("button");
258            var itemBody = $j(oE).find(".item-body");
259            // console.log(faq);
260            idHeader = "header-" + tool;
261            idBody = "body-" + tool;
262
263            itemHeader.attr("id", idHeader).attr("aria-controls", idBody);
264
265            itemBody.attr("id", idBody).attr("aria-labelledby", idHeader);
266
267            tool += 1;
268        }
269    );
270});
271
272const toolHeaders = document.querySelectorAll(
273    "#flexicontent .toolFAQ .mod_flexicontent_standard_wrapper .item-header"
274);
275Array.prototype.forEach.call(toolHeaders, (accordionHeader) => {
276    let target = accordionHeader.nextElementSibling;
277    accordionHeader.onclick = () => {
278        let expanded =
279            accordionHeader.getAttribute("aria-expanded") === "true" || false;
280        accordionHeader.setAttribute("aria-expanded", !expanded);
281        target.hidden = expanded;
282    };
283});
284
285//// tool accordion end
286
287if ($j("#label_fcfield_19").length) {
288    $j("#label_fcfield_19").html("Province");
289}
290
291if ($j('[lang="fr-fr"] #sortables_15').length) {
292    $j(".fc_files_uploader_toggle_btn").html("Télécharger");
293    $j(".fcfield-selectvalue").html("Mes dossiers");
294}
295
296if ($j('[lang="fr-fr"] #label_fcfield_20 .link').length) {
297    $j("#label_fcfield_20").html("Courriel");
298}
299
300if ($j('[lang="en-gb"] #label_fcfield_20 .link').length) {
301    $j("#label_fcfield_20").html("Email");
302}
303
304// open step on click
305$j(function () {
306    $j(".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard").on(
307        "click",
308        function (e) {
309            if ($j(this).hasClass("open")) {
310                $j(
311                    ".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard"
312                ).removeClass("open");
313            } else {
314                $j(
315                    ".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard"
316                ).removeClass("open");
317                $j(this).addClass("open");
318                e.stopPropagation();
319            }
320        }
321    );
322    $j(document).on("click", function (e) {
323        if (
324            $j(e.target).is(
325                ".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard.open"
326            ) === false
327        ) {
328            $j(
329                ".module.hrRoadmap .mod_flexicontent_standard_wrapper .image_standard"
330            ).removeClass("open");
331        }
332    });
333});
334
335
336
337
338
339
340// form work start 
341if ($j('.convertforms form').length) {
342
343    var form = $j(".convertforms form");
344
345    form.prepend('<div id="errorNotes"></div>');
346
347    // find required fields and add hidden note
348    $j('.cf-control-group.required').each(function (oI, oE) {
349        var asterix = $j(oE).find('.cf-control-label .cf-label');
350        asterix.append('<span lang="en" class="requiredNote" style="position: absolute!important;height: 1px!important;width: 1px!important;overflow: hidden!important;clip: rect(1px,1px,1px,1px)!important;">. Required</span><span lang="fr" class="requiredNote" style="position: absolute!important;height: 1px!important;width: 1px!important;overflow: hidden!important;clip: rect(1px,1px,1px,1px)!important;">. Obligatoire</span>')
351    })
352    // find required fields  end
353
354
355    // validation function start
356    var showAllErrorMessages = function () {
357
358        // scroll to top of form
359        $j(window).scrollTop($j("#errorNotes").offset().top);
360        // remove any previous errors
361        $j("#errorNotes").empty();
362
363        // add required rule to fields
364        $j.validator.addClassRules({
365            required: {
366                required: true
367            }
368        });
369
370        // validate form start
371        form.validate({
372
373            // prevent traditional form submission
374            submitHandler: function () { },
375
376            // check / radio errors on parent instead of input
377            errorPlacement: function (error, element) {
378                if (element.is(':radio') || element.is(':checkbox')) {
379                    error.appendTo(element.parent().parent());
380                } else {
381                    error.insertAfter(element);
382                }
383            },
384
385            // add error list above form
386            invalidHandler: function (event, validator) {
387                var errors = validator.numberOfInvalids();
388                if (errors) {
389                    $j("#errorNotes").append('<span class="errors en" role="alert" aria-live="polite" style="display:block;margin:40px 0 60px;">Please review the ' + errors + ' required fields and try again.</span><span class="errors fr" role="alert" aria-live="polite" style="display:block;margin:40px 0 60px;">Veuillez vérifier les ' + errors + ' champs obligatoires et réessayer.</sp
389an>');
390                    $j("#errorList").focus();
391                    $j("#errorList").show();
392
393                } else {
394                    $j("#errorList").hide();
395                }
396            }	// add error list end	  	
397
398        }) // form.validate end
399
400
401        if (form.valid() == true) {
402
403            // if valid go to the next page or submit
404            if ($j(this).hasClass('cf-btn')) {
405                $j('form .cf-fields').hide()
406            }
407            // if valid end
408
409        } else {
410            // if invalid start
411            if ($j(this).hasClass('cf-btn')) {
412                event.preventDefault();
413                return false;
414            }
415        } 	// if invalid end
416
417    } // validation function end
418
419
420    // call validation function on click
421    $j(".cf-control-input button", form).on("click", showAllErrorMessages);
422
423    // call validation function on enter
424    $j("input", form).on("keypress", function (event) {
425        var type = $j(this).attr("type");
426        if (/date|email|month|number|search|tel|text|time|url|week/.test(type)
427            && event.keyCode == 13) {
428            showAllErrorMessages();
429            event.preventDefault();
430            return false;
431        }
432    });	// // call validation function on enter / click end
433}// form work end

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.