PageSourceSearch

https://cityofhuron.org/_assets_/js/agenda-list-revamp.js

js cityofhuron.org collected 2026-10-02 17:47:35 UTC 6,759 bytes, 212 lines download raw bytes

1(function($){
2	$(document).ready(function(){
3
4
5		if($('.doc-center-counter').length){
6			var docCount = 0;
7			var docMsg = "";
8			$('.doc-center-counter').each(function(){
9				docCount = $(this).parent().parent().find('.file-group>li').length;
10
11				if(docCount < 1) docMsg = "No meetings";
12				else if(docCount == 1)docMsg = "1 meeting";
13				else docMsg = docCount + " meetings";
14				$(this).text(docMsg);
15			});
16		} else {
17			$('h3.docs-toggle').each(function(){
18			    $(this).find('small').text(countDocuments($(this).siblings('.inner-cat-wrap').find('li').length));
19			});
20
21			$('h4.docs-toggle').each(function(){
22			    $(this).find('small').text(countDocuments($(this).siblings('.file-group').find('li').length));
23			});
24		}
25
26   // RZ Class
27	if(typeof RZ !== "undefined"){
28	    if(RZ.login){
29	     $('body').addClass("user-logged-in");
30	    } else{
31	        $('body').addClass("user-not-logged-in");
32	    }
33      }
34	  });
35    var innerCatWrap = $('.inner-cat-wrap');
36    var hash = location.hash.length > 0 ? location.hash.replace('#','') : undefined;
37    var oldSearch = '';
38
39    if (hash == undefined)
40    {
41        hash = '';
42    } else {
43        var outerHashClass, innerHashClass;
44        innerHashClass = hash.indexOf('sub') >= 0 ? '.' + hash.substr(hash.indexOf('sub')) : '';
45        outerHashClass = hash.indexOf('sub') >= 0 ? '.' + hash.substr(0,hash.indexOf('sub')) : '.' + hash;
46
47        rzDocToggleOuter($(outerHashClass));
48        if(outerHashClass.length){
49            rzDocToggleInner($(innerHashClass));
50        }
51    }
52
53
54    if($('body').hasClass('user-logged-in')){
55        $('.docs-toggle>small').css('margin-right','71px');
56    }
57
58    var startingPos = $(document).scrollTop();
59    $(document).scroll(function(){
60        startingPos = $(document).scrollTop();
61    });
62
63    $('h3.docs-toggle').on('click',function(){
64        rzDocToggleOuter($(this));
65        hash = $(this).prev('.rz-doc-center-hash').attr('name');
66        location.hash = hash;
67        $(document).scrollTop(startingPos);
68    });
69
70    $('h4.docs-toggle').on('click',function(){
71        rzDocToggleInner($(this));
72        if(hash.indexOf('sub')>= 0){
73            hash = hash.substr(0,hash.indexOf('sub'));
74        }
75        hash += $(this).prev('.rz-doc-center-sub-hash').attr('name');
76        location.hash = hash;
77    });
78
79
80    // Press Enter
81    $('#file-search').on("keypress", function(e){
82        if(e.keycode == '13'){
83            searchUpdate();
84        }
85    });// Enter
86
87    $('.rz-doc-search-reset').on('click',function(){
88        $('#file-search').val('');
89        $('#categorties-wrap').slideDown();
90        $('.search-results').slideUp(function(){
91            $(this).remove();
92        });
93        $('.rz-doc-search-reset').slideUp();
94        oldSearch = '';
95    });
96
97
98    $('.rz-doc-search-submit').on('click',function(e){
99        e.preventDefault();
100        searchUpdate();
101    });
102
103    function searchUpdate(){
104        var searchValue = $('#file-search').val().toUpperCase();
105
106        if(searchValue.length > 0 && searchValue !== oldSearch){
107            searchDocuments(searchValue);
108        }
109
110        oldSearch = searchValue;
111    }
112
113
114    // toggle outer
115    function rzDocToggleOuter(el){
116        var thisInnerCatWrap = el.parent().find('.inner-cat-wrap');
117        $('.inner-cat-wrap').not(el).stop().slideUp(300);
118        flipArrows(el);
119
120        $('.inner-cat').find('.file-group').stop().slideUp(300);
121        thisInnerCatWrap.stop().slideToggle(300,function(){
122            $('.inner-cat-wrap').each(function(){
123                fixSlideToggles($(this));
124            });
125        });
126    }/////////////////////////////////////////////////////////////// toggle outer
127
128
129    // toggle inner
130    function rzDocToggleInner(el){
131        flipArrows(el);
132        $('.inner-cat .file-group').not(el).stop().slideUp(300);
133        var thisFileGroup = el.parent().find('.file-group');
134        thisFileGroup.stop().slideToggle(300,function(){
135            $('.inner-cat .file-group').each(function(){
136                fixSlideToggles($(this));
137            });
138        });
139    }/////////////////////////////////////////////////////////////// toggle inner
140
141
142    // fix toggles
143    function fixSlideToggles(el){
144        if(el.css('display') === 'none'){
145            el.attr('style','');
146            el.parent().find('.fa').removeClass('toggled-open');
147        }
148    }//////////////////////////////////////////////////////////////// fix toggles
149
150    function flipArrows(el){
151        if(el.hasClass('inner-cat-wrap')){
152            setTimeout(function(){
153                el.parent().find('.docs-toggle').first().find('.fa').addClass('toggled-open');
154            },100);
155        } else if(el.hasClass('file-group')){
156            setTimeout(function(){
157                el.prev().prev().find('.fa').addClass('toggled-open');
158            },200);
159        } else {
160            if((el).is('h3')){
161                $('h3.docs-toggle').not(el).find('.fa').removeClass('toggled-open');
162            } else {
163                $('h4.docs-toggle').not(el).find('.fa').removeClass('toggled-open');
164            }
165            el.find('.fa').toggleClass('toggled-open');
166        }
167    }
168
169
170    // search
171    function searchDocuments(searchValue){
172        var fileText = '';
173        var $fileGroup = $('<ul>',{'class':'file-group search-results'});
174        $fileGroup.empty();
175        $('.search-results').remove();
176        $('.file-group a').each(function(i,el){
177            fileText = $(el).text().toUpperCase();
178
179            if(fileText.indexOf(searchValue) >= 0){
180                $fileGroup.append($(el).parent().clone());
181            } else {
182                var $desc = $(el).parent().children(".doc-file-desc");
183                if ($desc.length > 0) {
184					fileText = $desc.text().toUpperCase();
185					if(fileText.indexOf(searchValue) >= 0){
186						$fileGroup.append($(el).parent().clone());
187					}
188				}
189			}
190        }).promise().then(function(){
191            if(!$($fileGroup).find('li').length){
192                $fileGroup.append('<li class="text-danger">No results found for: "'+searchValue+'"</li>');
193            }
194            $('#document-center').append($fileGroup);
195            $('#categorties-wrap').slideUp();
196            $('.search-results').slideDown();
197            $('.rz-doc-search-reset').slideDown();
198        });// end loop & promise
199
200
201    }//////////////////////////////////////////////////////////////// search
202
203	 function countDocuments(num){
204		 if(num != 1){
205			 return num + ' documents';
206		 } else {
207			 return num + ' document';
208		 }
209	 }
210
211
212})(jQuery);

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.