PageSourceSearch

https://maphealth.ca/wp-content/themes/map-child/js/scientist-script.js?ver=7.1.2

js maphealth.ca collected 2026-10-03 22:33:47 UTC 4,251 bytes, 114 lines download raw bytes

1//FILTERING THE SCIENTIST BASED ON AFFILIATIONS
2const orderMap = { '12':'212', '114':'14' }; // used to re-order categories of scientists. by default they show up in order of their id.
3
4$(document).ready(function(){
5    let slug = document.location.hash;
6    slug = slug ? slug.substring(1) : 'core';
7    let btn = $('.scientist-category__name[data-slug="'+slug+'"]');
8    let sid = btn.attr('data-id');
9    
10
11    btn.addClass('clicked');   // ADDING DEFAULT ACTIVE STATE
12    $('.scientist-category-mobile-dropdown-trigger').text( btn.text() );
13    // $('.single-scientist').filter("[data-affiliation=" + sid + "]").fadeIn();
14
15    const aVals = sid.split(',');
16    aVals.forEach(aVal => {
17        let order = orderMap[aVal] || aVal; // affiliates (12 should show up last)
18        $('.single-scientist').filter("[data-affiliation~=" + aVal + "]").css('order',order);
19        $('.scientist-heading, .single-scientist').filter("[data-affiliation~=" + aVal + "]").fadeIn();   
20    });
21});
22
23$('.scientist-category__name').click(function(){
24    
25    let affiliateValue = $(this).attr('data-id');                       //SORTING DATA VALUE FOR CLICKED ITEM
26    let affiliateSlug = $(this).attr('data-slug');
27    $('.scientist-category__name').removeClass('clicked');    //UNHIGHLIGHT OTHER ITEMS
28    $('.scientist-category__name[data-slug='+affiliateSlug+']').addClass('clicked');                                        //MAKING CLICKED ITEM HIGHLIGHTED
29
30    $('#people-menu')[0].scrollIntoView();
31    history.pushState(null,null,'#'+affiliateSlug);
32
33    
34
35    if ( $(this).hasClass('clicked') ){
36        $('.scientist-heading, .single-scientist').hide();
37        // account for scientists = 10 + 12 + 111
38        // executives = 112, 113
39        const aVals = affiliateValue.split(',');
40        aVals.forEach(aVal => {
41            let order = orderMap[aVal] || aVal; // affiliates (12 should show up last)
42            $('.single-scientist').filter("[data-affiliation~=" + aVal + "]").css('order',order);
43            $('.scientist-heading, .single-scientist').filter("[data-affiliation~=" + aVal + "]").fadeIn();
44        });
45
46    } else {
47        //$('.single-scientist').fadeIn();
48    }
49});
50
51/* 
52$('.scientist-link').click(function(){
53    
54    let affiliateValue = $(this).attr('data-id');                       //SORTING DATA VALUE FOR CLICKED ITEM
55    let affiliateSlug = $(this).attr('data-slug');
56
57    $('.scientist-category__name').removeClass('clicked'); 
58    $('.scientist-category__name[data-slug='+affiliateSlug+']').addClass('clicked');
59
60    // history.pushState(null,null,'#'+affiliateSlug);
61    $('.scientist-heading, .single-scientist').hide();
62
63    const aVals = affiliateValue.split(',');
64    aVals.forEach(aVal => {
65        let order = orderMap[aVal] || aVal; // affiliates (12 should show up last)
66        $('.single-scientist').filter("[data-affiliation~=" + aVal + "]").css('order',order);
67        $('.scientist-heading, .single-scientist').filter("[data-affiliation~=" + aVal + "]").fadeIn();
68    });
69
70}); */
71
72
73
74
75
76
77// //REARRANGING THE SCIENTIST TAXONOMY
78// $(document).ready(function(){
79//     let wrapper = $('.scientist-category__items');
80
81//     wrapper.find('.scientist-category__name').sort(function(a,b){
82//         return +a.getAttribute('data-id') - +b.getAttribute('data-id');
83//     }).appendTo(wrapper);
84// })
85
86
87
88
89
90
91
92//SCIENTIST CATEGORY DROPDOWN
93$(document).ready(function(){
94    if($(window).outerWidth() < 960){
95        let trigger = $('.scientist-category-mobile-dropdown-trigger'),
96            target = $('.scientist-category-mobile-dropdown'),
97            openHeight = target.children().outerHeight();
98        
99        trigger.click(function(){
100            // $(this).empty().css('padding', '0px');
101            $(this).hide();
102            target.animate({'height' : openHeight + 'px'}, 300);
103        });
104        
105        $('.scientist-category__name').click(function(){
106            let updateTrigger = $(this).text();
107            trigger.html(updateTrigger); //.css('padding', '20px 0');
108            trigger.show();
109            target.animate({'height' : '0px'}, 300);
110        })
111        
112        
113    }
114})

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.