PageSourceSearch

https://governor.mt.gov/_files/js/scripts.js

js mt.gov collected 2026-09-24 07:17:21 UTC 9,714 bytes, 208 lines download raw bytes

1// Add aria-label to Links
2$(document).ready(function(){
3    $('a[href]:not([aria-label])').each(function(){
4       var contentText = $(this).text();
5       $(this).attr('aria-label', contentText);
6    });
7    
8     var currentUrl = encodeURI(window.location.href.replace("https://", "").replace("http://", ""));
9    $('a[href="https://mt.gov/discover/disclaimer"').closest('li').after('<li class="nav-item"><a class="nav-link" target="_blank" href="https://gov.mt.gov/forms/governorsoffice/GOVAccessibilityContactRequest?Referring=' + currentUrl + '" title="Report Accessibility Concern" target="_blank">Report Accessibility Concern</a></li>');
10    
11    //var skipContentLinkCount = $('.screen-reader-text').length;
12    //if(skipContentLinkCount == 0){
13    //    $('body').prepend('<a class="screen-reader-text" href="#main-content" aria-label="Skip to main content">Skip to main content</a>');
14    //}
15});
16    
17    //Add BS Class to all Tables
18    $('table').addClass('table table-bordered');
19    
20    //Add BS Class to all Tables
21    $('img').addClass('img-fluid');
22    
23    //Add BS Classes to Lists in Side Menu
24    $('#sidebarMenu').find('ul').addClass('nav flex-column');
25    $('ul.nav').find('li').addClass('nav-item');
26    $('li.nav-item').find('a').addClass('nav-link');
27
28$(document).ready(function(){
29    //Multilevel dropdown
30    $('.dropdown-menu a.dropdown-toggle:not(.hover)').on('click', function(e) {
31        if (!$(this).next().hasClass('show')) {
32            $(this).parents('.dropdown-submenu').first().find('.show').removeClass("show");
33        }
34        $(this).next(".dropdown-submenu").toggleClass('show');
35        $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
36            $(e.target).find('.dropdown-submenu.show').removeClass("show");
37        });
38        return false;
39    });
40    
41    //Anchor Links
42    // $('a[href^="#"]:not(.accordion-toggle)').on('click',function (e) {
43    //     e.preventDefault();
44    //     var target = this.hash;
45    //     var $trget = $(target);
46    //     // Example: your header is 70px tall.
47    //     var newTop = $trget.offset().top - 70; 
48    //     $('html, body').animate ({
49    //         scrollTop: newTop
50    //     }, 500, 'swing', function () {
51    //         window.location.hash = target;
52    //     }); 
53    // });
54    
55    // $('.collapse').on('shown.bs.collapse', function(e) {
56    //     $('html, body').animate({
57    //         scrollTop: $(e.target).parent().offset().top - 120
58    //     }, 500);
59    // });
60});
61
62// Open Accordion or Tab From Another Page
63jQuery(document).ready(function ($) {
64    let selectedTab = window.location.hash;
65    $('.nav-link[href="' + selectedTab + '"]' ).trigger('click');
66    $('a.accordion-toggle[href="' + selectedTab + '"]').trigger('click');
67});
68
69// Jump to Anchor in Accordion or Tab From Another Page
70jQuery(document).ready(function ($) {
71    const hash = window.location.hash;
72    if (hash) {
73        const tab = $(hash).parents(".tab-pane")[0];
74        if (tab) {
75            $(".nav-link[href='#" + tab.id + "']").trigger("click");
76        } else {
77            $(hash).parents(".card").find(".accordion-toggle").trigger("click");
78        }
79        window.location.hash = "";
80        window.location.hash = hash;
81    }
82 });
83 
84 
85//cookie consent modal
86
87 window.addEventListener('load', function () {
88        // obtain cookieconsent plugin
89        const cc = initCookieConsent();
90
91        // run plugin with config object
92        cc.run({
93            autorun: true,
94            current_lang: 'en',
95            autoclear_cookies: true,
96            page_scripts: true,
97
98            onFirstAction: function(user_preferences, cookie){
99                // callback triggered only once
100                console.log('User accept type:', user_preferences.accept_type);
101                console.log('User accepted these categories', user_preferences.accepted_categories)
102                console.log('User reject these categories:', user_preferences.rejected_categories);
103            },
104
105            onAccept: function (cookie) {
106           if (event.target.matches('#c-p-bn')){
107	            console.log("Accept was clicked");
108             
109                window.dataLayer = window.dataLayer || [];
110                function gtag(){dataLayer.push(arguments);}
111                gtag('accepted_categories', {
112                  'analytics_storage':'granted'                 
113                });}
114                else{
115                     window.dataLayer = window.dataLayer || [];
116                    function gtag(){dataLayer.push(arguments);}
117                    gtag('rejected_categories', {
118                      'analytics_storage':'denied' 
119                    });
120                }
121
122
123            },
124
125            onChange: function (cookie, changed_preferences) {
126                    window.dataLayer = window.dataLayer || [];
127                    function gtag(){dataLayer.push(arguments);}
128                    gtag('rejected_categories', {
129                      'analytics_storage':'denied' 
130                    });
131            },
132
133            languages: {
134                en: {
135                    consent_modal: {
136                        title: 'The state of Montana uses Google Analytics',
137                        description: 'We use cookies to improve your browsing experience and analyze our traffic with the use of Google Analytics. Please accept these before using the site. <a aria-label="Cookie policy" class="cc-link" target="blank" href="https://governor.mt.gov/Cookies_GoogleAnalytics">Read more</a>',
138                        primary_btn: {
139                            text: 'Accept',
140                            role: 'accept_all'              // 'accept_selected' or 'accept_all'
141                        },
142                        secondary_btn: {
143                            text: 'Reject All',
144                            role: 'settings'                // 'settings' or 'accept_necessary'
145                        }
146                    },
147                    settings_modal: {
148                        title: 'Cookie preferences',
149                        save_settings_btn: 'Save settings',
150                        accept_all_btn: 'Accept all',
151                        reject_all_btn: 'Reject all',       // optional, [v.2.5.0 +]
152                        cookie_table_headers: [
153                            {col1: 'Name'},
154                            {col2: 'Domain'},
155                            {col3: 'Expiration'},
156                            {col4: 'Description'},
157                            {col5: 'Type'}
158                        ],
159                        blocks: [
160                            {
161                                title: 'Cookie usage',
162                                description: 'We use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want.'
163                            }, 
164                            {
165                            //     title: 'Strictly necessary cookies',
166                            //     description: 'These cookies are essential for the proper functioning of my website. Without these cookies, the website would not work properly.',
167                            //     toggle: {
168                            //         value: 'necessary',
169                            //         enabled: true,
170                            //         readonly: true
171                            //     }
172                            // }, {      
173                            
174                                title: 'Google Analytics Cookies',
175                                description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you.',
176                                toggle: {
177                                    value: 'analytics',
178                                    enabled: true,
179                                    readonly: false
180                                },
181                                // cookie_table: [
182                                //     {
183                                //         col1: '^_ga',
184                                //         col2: 'google.com',
185                                //         col3: '2 years',
186                                //         col4: 'description ...',
187                                //         col5: 'Permanent cookie',
188                                //         is_regex: true
189                                //     },
190                                //     {
191                                //         col1: '_gid',
192                                //         col2: 'google.com',
193                                //         col3: '1 day',
194                                //         col4: 'description ...',
195                                //         col5: 'Permanent cookie'
196                                //     }
197                                // ]
198                            }, {
199                                title: 'More information',
200                                description: 'For any queries in relation to our policy on cookies and your choices, please <a class="cc-link" target="blank" href="https://governor.mt.gov/Cookies_GoogleAnalytics">read more</a>.',
201                            }
202                        ]
203                    }
204                }
205            }
206        });
207    });
208

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.