HomeAboutResidentsVisitorsBusinessGovernment Burkburnett, Texas CALENDAR </div></div></div><script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=5a2719df5f89cb0001ea0d06" type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script><script src="https://assets.website-files.com/5a2719df5f89cb0001ea0d06/js/city-of-burkburnett.bb919bf1b.js" type="text/javascript"></script><!--[if lte IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/placeholders/3.0.2/placeholders.min.js"></script><![endif]--><script> _dir = {}; _dir.display_year = new Date().getFullYear(); _dir.years = []; Webflow.push(function() { console.log('v0.2'); setup(); }); function setup() { console.log('year ' + _dir.display_year); directory_check('agenda_minutes'); directory_check('audits_budgets'); directory_check('ordinances'); directory_check('election_documents'); directory_check('announcements'); _dir.years = _dir.years.sort(function(a,b) { return parseInt(b) - parseInt(a); }); if(_dir.years.length > 0) { _dir.display_year = _dir.years[0]; } directory_buttons('year'); directory_update(); $('.directory_button.year').each(function() { $(this).click(function() { _dir.display_year = $(this).text().trim(); console.log('year updated ' + _dir.display_year); directory_update(); }); }); old_upload_check(); var selectors = ['.cms_description', '.paragraph']; linkAdder(selectors); } function directory_check(id) { console.log('directory check ' + id); var d = $('#'+id); if(d.length == 0) { console.log(id + ' not found' ); return; } var dir = parse_directory(d); _dir.directory = dir; } function directory_update() { if(_dir.directory && _dir.directory.length > 0) { _dir.directory.forEach(function(e) { if(e.date.year == _dir.display_year) { //e.e.show(); e.e.fadeIn(); } else{ e.e.hide(); } }); } } function directory_buttons(type) { var buttons = []; if(type == 'year') { _dir.years.forEach(function(y) { buttons.push('<h2 class="directory_button year">'+y+'</h2>'); }); $('#year_directory').append(buttons.join('')); } } function parse_directory(d) { var dir = []; console.log('parsing directory'); d.find('.announcement_item').each(function() { var item = {}; item.e = $(this); var dateData = $(this).find('.data_item.date').first().text(); if(dateData && dateData !== "") { item.date = parse_date(dateData); console.log('item found: ' + JSON.stringify(item.date)); dir.push(item); if(add_if_not_in_array(_dir.years, item.date.year)); } }); console.log('directory item count ' + dir.length); console.log('years ' + JSON.stringify(_dir.years)); console.log('directory', _dir); //if current year has no items, move to latest year if(!_dir.years || _dir.years.lenght == 0) { console.log('err no years collected'); } _dir.display_year = _dir.years[0]; //sorting by dateString (to include hour/minutes) dir = dir.sort((a,b)=> { return new Date(a.date.dateString) < new Date(b.date.dateString) }); return dir; } function parse_date(d) { //expected format m/d/y var date = {}; date.month = d.split('/')[0].trim(); date.day = d.split('/')[1].trim(); date.year = d.split('/')[2].split(' ')[0].trim(); date.dateString = d.trim(); console.log('parsing date', {d,date}); return date; } function number_to_month(m) { if(m < 1 || m > 12) { return 'err_'+m; } if(m == 1) {return 'January';} if(m == 2) {return 'Febuary';} if(m == 3) {return 'March';} if(m == 4) {return 'April';} if(m == 5) {return 'May';} if(m == 6) {return 'June';} if(m == 7) {return 'July';} if(m == 8) {return 'August';} if(m == 9) {return 'September';} if(m == 10) {return 'October';} if(m == 11) {return 'November';} if(m == 12) {return 'December';} } function add_if_not_in_array(a, e) { if(!array_contains(a,e)) { a.push(e); } } function array_contains(a, e) { for(var i = 0; i < a.length; i++) { if(a[i] == e) { return true; } } return false; } function old_upload_check() { console.log('old upload link check'); var l = 0; $('a').each(function() { l++; var href = $(this).attr('href'); if(href.indexOf('burkburnett.download') != -1) { console.log('old format found : ' + href); //$(this).attr('href', replace('burkburnett.download', 'uploads.burkburnett')); //console.log('updated'); } }); console.log(l + ' links found'); } //added March 6 function linkAdder (selectors) { //var selectors = ['.cms_description']; console.log('adding links'); selectors.forEach(function(selector) { var found = jQuery(selector); console.log(selector + ' found: ' + found.length); found.each(function() { insertLinks($(this)); }); }); } function insertLinks(j) { var editMade = false; //get text nodes: https://stackoverflow.com/questions/298750/ var textNodes = j.contents() .filter(function(){ return this.nodeType === 3 && /\S/.test(this.nodeValue); }); console.log(textNodes.length + ' text nodes found'); //interate over nodes, adding html links textNodes.each(function() { //var text = $(this).html(); //console.log($(this)); var split = $(this).text().split(' '); var edit = []; split.forEach(function(s) { if(s.length > 6 && s.indexOf('http') !== -1) { if(s[s.length-1] === '.') { s = s.slice(0, s.length-1) } console.log('found link>' + s); edit.push('<a class="inlineLink" href="'+s+'">'+s+'</a>'); editMade = true; } else { edit.push(s); } }); if(editMade) { var finalEdit = edit.join(' '); console.log('applying edits', finalEdit); $(this).replaceWith(finalEdit); } }); } </script></body></html>