PageSourceSearch

https://www.ontariocourts.ca/scj/wp-content/themes/picostrap5-child-base/js/custom.js

js ontariocourts.ca collected 2026-09-24 08:40:56 UTC 3,354 bytes, 93 lines download raw bytes

1// to enable the enqueue of this optional JS file, 
2// you'll have to uncomment a row in the functions.php file
3// just read the comments in there mate
4
5// console.log("Custom js file loaded");
6
7
8// $( document ).ready(function() {
9// 	$('[data-bs-toggle="tooltip"]').tooltip(); 
10// 	console.log( "SCJ tooltips loaded" );
11// });
12
13
14// Start of Mega menu opacity gray screen
15
16document.addEventListener("DOMContentLoaded", function(){
17    document.querySelectorAll('.navbar .dropdown').forEach(function(everydropdown){
18        everydropdown.addEventListener('shown.bs.dropdown', function () {
19            el_overlay = document.createElement('span');
20            el_overlay.className = 'OCJ-screen-darken';
21            document.body.appendChild(el_overlay)
22
23        });
24
25        everydropdown.addEventListener('hide.bs.dropdown', function () {
26           
27            document.body.removeChild(document.querySelector('.OCJ-screen-darken'));
28        });
29    });
30
31});
32// End of Mega menu opacity gray screen
33
34
35// Listen to scroll to change header opacity class
36
37function checkScroll(){
38    var startY = $('.navbar').height() * 2; //The point where the navbar changes in px
39
40    if($(window).scrollTop() > startY){
41        $('.OCJ-navbar-footer').addClass("OCJ-navbar-footer-color");
42    }else{
43        $('.OCJ-navbar-footer').removeClass("OCJ-navbar-footer-color");
44    }
45}
46
47// if($('.OCJ-navbar-footer').length > 0){
48//     $(window).on("scroll load resize", function(){
49//         checkScroll();
50//     });
51// }
52// Listen to scroll to change header opacity class
53
54
55// A $( document ).ready() block.
56// $( document ).ready(function() {
57//     console.log( "SCJ ready!, Running JS file" );
58
59
60// });
61
62
63
64/* add target blank to all extenal links*/ 
65$(document).ready(function(){
66
67    $('#theme-main a:not([href*="ontariocourts.ca"],[href^="#"],[href^="./"],[href^="/scj"])').attr('target', '_blank'); 
68    $("#theme-main a[href$='pdf']").attr('target','_blank');
69    $("#theme-main a[href$='pdf']").addClass('fa-file-pdf'); 
70    $("#theme-main a[href$='doc']").addClass('fa-file-word'); 
71    $("#theme-main a[href$='docx']").addClass('fa-file-word'); 
72    // $('#theme-main a:not([name^="_Toc"],[href*="ontariocourts.ca"],[href^="#"],[href$="pdf"],[href^="mailto:"],[href$="docx"],[href$="xlsx"],[href^="./"],[href^="/scj"])').addClass('external'); 
73    $('#theme-main a[href^="http://"], #theme-main a[href^="https://"], #theme-main a[href^="//"]').not('[href*="ontariocourts.ca"]').addClass('external');
74    }); 
75
76
77// Expand All / Collapse All with MDB’s animation-aware logic:
78
79  document.getElementById("expandAllBtn").addEventListener("click", function () {
80    document.querySelectorAll(".accordion-wrapper ul li.collapse-icon div.collapse").forEach(function (el) {
81      // Initialize Collapse instance (use { toggle: false } to avoid auto toggle)
82      let collapseInstance = mdb.Collapse.getInstance(el) || new mdb.Collapse(el, { toggle: false });
83      collapseInstance.show();
84    });
85  });
86
87  // Collapse All
88  document.getElementById("collapseAllBtn").addEventListener("click", function () {
89    document.querySelectorAll(".accordion-wrapper ul li.collapse-icon div.collapse").forEach(function (el) {
90      let collapseInstance = mdb.Collapse.getInstance(el) || new mdb.Collapse(el, { toggle: false });
91      collapseInstance.hide();
92    });
93  });

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.