PageSourceSearch

https://www.tacinc.org/wp-content/themes/socialdriver/js/framework-scripts.js

js tacinc.org collected 2026-10-03 21:20:39 UTC 53,163 bytes, 1,464 lines download raw bytes

1
2(function($){
3
4	$.extend($.expr[':'], {
5		focusable: function(element) {
6			var nodeName = element.nodeName.toLowerCase(),
7				tabIndex = $.attr(element, 'tabindex');
8			return (/input|select|textarea|button|object/.test(nodeName)
9				? !element.disabled
10				: 'a' == nodeName || 'area' == nodeName
11					? element.href || !isNaN(tabIndex)
12					: !isNaN(tabIndex))
13				// the element and all of its ancestors must be visible
14				// the browser may report that the area is hidden
15				&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
16		}
17	});
18
19	function getNum(val) {
20	   if (isNaN(val)) {
21	     return 0;
22	   }
23	   return val;
24	}
25
26	$(document).ready(function () {
27		
28		// PREVENT WINDOW FROM ZOOMING
29
30		function changeViewPort() {
31			if ($( window ).width() <= 991) {
32				$('meta[name=viewport]').attr('content', 'width=device-width, initial-scale=1');
33			}
34		}
35                        
36		var deviceAgent = navigator.userAgent.toLowerCase();
37		var isMobile = deviceAgent.match(/(iphone|ipod|android|iemobile)/)
38		var templateDirectory = $("#sf-option-params").data("template-directory");
39		var stylesheetDirectory = $("#sf-option-params").data("stylesheet-directory");
40		var homeURL = $("#sf-option-params").data("home");
41		var document_title = document.title;
42		var document_url = document.URL;
43		var pushToHistory;
44 
45		function detectIE() {
46		    var ua = window.navigator.userAgent;
47
48		    var msie = ua.indexOf('MSIE ');
49		    if (msie > 0) {
50		        // IE 10 or older => return version number
51		        return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
52		    }
53
54		    var trident = ua.indexOf('Trident/');
55		    if (trident > 0) {
56		        // IE 11 => return version number
57		        var rv = ua.indexOf('rv:');
58		        return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
59		    }
60
61		    var edge = ua.indexOf('Edge/');
62		    if (edge > 0) {
63		       // IE 12 => return version number
64		       return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
65		    }
66
67		    // other browser
68		    return false;
69		}
70
71		if (window.history && window.history.pushState) {
72
73		    window.onpopstate = function(e){
74		    	if ( e.state && e.state != null && e.state.postid ) {
75					openModal(e.state.reference, e.state.postid, false);
76		    	} else {
77					$("body").removeClass("page-modal-open");
78		    	}
79		    	return false;
80		    };
81
82		}
83
84		if ($("#logo-modal").length > 0 && $(".sd-modal-header").length > 0 && $("#logo").length > 0) {
85			var logo = $("#logo > a").html();
86			$("#logo-modal").html(logo);
87			$("#logo-modal").click(function (e) {
88				e.preventDefault();
89				window.location.href = $("#logo > a").prop("href");
90				return false;
91			});
92		}
93
94		$("body.remove-styles .fadeIn").each(function () {
95			$(this).data("delay", 0);
96		});
97
98		/* MODAL ACTION */
99
100		var windowPosition = $(document).scrollTop();
101
102		if ( $(".sf-menu-item-modal a, a.sf-menu-item-modal").length > 0 ) {
103			$(".sf-menu-item-modal a, a.sf-menu-item-modal").each(function () {
104				$(this).prop("onclick", "javascript: return false;");
105				$(this).off().on("click", function(e){
106					e.preventDefault();
107					var post = $(this).attr('href');
108					$(this).find(".sd-modal-content").each(function () {
109						$(this).hide();
110					});
111					var post_id = $(this).data("postid");
112					if ( $("#modal-container .container").html() == "" ) {
113						window.location.href = post;
114					} else {
115						openModal(post, post_id, true);
116					}
117					return false;
118				});
119			});
120		}
121
122		if ( $("#close-modal, .close-modal-link").length > 0 ) {
123			$("#close-modal, .close-modal-link").off().on("click", function (e) {
124				e.preventDefault();
125				closeModal(true);
126				return false;
127			});
128		}
129
130		function openModal(href, post_id, pushToHistory) {
131			$("body").removeClass("page-modal-done").addClass("page-modal-loading");
132			windowPosition = $(document).scrollTop();
133			$(window).scrollTop(0);
134			if ( $("body").find(".sd-modal-content-"+post_id).length > 0 ) {
135				$("body").find(".sd-modal-content-"+post_id).fadeIn("fast", function () {
136					$(window).scrollTop(0);
137				});
138				$("body").removeClass("page-modal-loading").addClass("page-modal-done");
139			} else {
140				$.get( templateDirectory + "/api/modal_content.php?id=" + post_id, function( content ) {
141					$("body").find("#modal-container > .container").append('<div class="sd-modal-content sd-modal-content-' + post_id + '" data-postid="' + post_id + '">' + content + '</div>')
142					SWIFT.page.injectsvgs();
143					$("body").find(".sd-modal-content-"+post_id).fadeIn("fast", function () {
144						$(window).scrollTop(0);
145					});
146					$("body").removeClass("page-modal-loading").addClass("page-modal-done");
147				}, "html")
148				.fail(function() {
149					window.location.href = href;
150	  			});
151			}
152			$("body").removeClass("mobile-menu-open");
153			$("body").addClass("page-modal-open");
154		}
155
156		function closeModal(pushToHistory) {
157			$("body").find(".sd-modal-content").hide();
158			$("body").find(".sd-modal-content iframe").each(function () {
159				$(this).prop("src", $(this).prop("src").replace("&autoplay=1", "&autoplay=0"));
160			});
161			if ( $("body").find("#container.force-close").length > 0 ) {
162				window.history.back();
163			} else {
164				$("body").removeClass("page-modal-open");
165				$(document).scrollTop(windowPosition);
166			}
167			$("body").removeClass("page-modal-done").removeClass("page-modal-loading");
168		}
169
170		function requiresSVGLoad() {
171
172			$("body").addClass('page-fading-in');
173			jQuery('#main-container').animate({
174				'opacity': 1,
175				'paddingTop': '0'
176			}, 0, 'easeOutExpo', function() {
177				$("body").removeClass('page-fading-in');
178				$("body").addClass("page-loaded");
179			});
180			jQuery('#site-loading').animate({
181				'opacity': 0,
182			}, 300, 'easeInExpo', function() {
183				jQuery(this).css('display', 'none');
184			});
185
186			mainContainerAdjustments();
187			$(window).resize(function () { mainContainerAdjustments(); });
188
189			jQuery('.carousel-items').each(function () {
190				SWIFT.carouselWidgets.carouselMinHeight(jQuery('#'+jQuery(this).attr('id')));
191			});
192
193		}
194
195		function mainContainerAdjustments() {
196			if ( $("#main-container").length > 0 && $("body").find(".swift-slider-outer").length <= 0 ) {
197				if ( $(".header-wrap").length > 0 && $(".header-wrap").css("position") == "absolute" && $(".header-wrap").css("display") != "none" ) {
198					$("#main-container").css("padding-top", $(".header-wrap").height() + "px");
199				} else if ( $("#mobile-header").length > 0 && $("#mobile-header").css("position") == "absolute" && $("#mobile-header").css("display") != "none" ) {
200					$("#main-container").css("padding-top", $("#mobile-header").height() + "px");
201				} else {
202					$("#main-container").css("padding-top", "0px");
203				}
204			} else {
205				$("#main-container").css("padding-top", "0px");
206			}
207		}
208
209		if ( $("img.inject-me").length > 0 ) {
210
211			var mySVGsToInject = document.querySelectorAll('img.inject-me');
212			var injectorOptions = {};
213			SVGInjector(mySVGsToInject, injectorOptions, function (totalSVGsInjected) {
214				/* SVG IMAGES HAVE BEEN INJECRED */
215				requiresSVGLoad();
216			});
217
218		} else {
219
220			requiresSVGLoad();
221
222		}
223
224		$("table.tablepress").each(function () {
225			var headers = Array();
226			$(this).find("th").each(function () {
227				headers.push($(this).html());
228			});
229			if ( headers.length > 0 ) {
230				$(this).find("tr").each(function () {
231					var row = $(this);
232					row.find("td").each(function (index, cell) {
233						$(this).prepend('<div class="cell-header hidden-lg hidden-md hidden-sm">'+headers[index]+'</div>');
234					});
235				});
236			}
237		});
238
239		if ( $("body:not(.mh-sticky) #mobile-menu-wrap.menu-type-dropdown").length > 0 ) {
240			$("#mobile-menu-wrap a").each(function () {
241				$(this).click(function () {
242					//$("body, html").addClass('mobile-menu-closing'); 
243					//SWIFT.nav.hideMobileMenu();
244					if ( jQuery("body.mh-dropdown").length > 0 ) {
245						if ( jQuery("body:not(.mh-sticky) #mobile-menu-wrap.menu-type-dropdown").length > 0 ) {
246							var menuHeight = jQuery("#mobile-menu-wrap").height();
247							jQuery("#mobile-header").css("margin-bottom", menuHeight + "px");
248							jQuery("#mobile-menu-wrap").css("min-height", menuHeight + "px");
249						}
250					}
251				});
252			});
253		}
254
255		if ( $("form a.search-icon-position").length > 0 ) {
256			$("form a.search-icon-position").each(function () {
257				$(this).click(function (e) {
258					e.preventDefault();
259					$(this).closest("form").submit();
260					return false;
261				});
262			});
263		}
264
265		// FIX IE SCROLLING ISSUE 
266
267		if ( detectIE() && $("body").hasClass("has-parallax") ) {
268
269			/* PATCH FOR SCROLLING */
270
271	    	if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
272			window.onmousewheel = document.onmousewheel = wheel;
273
274		}
275
276		// ADD ARROW UP/DOWN SCROLLING
277
278		var time = 1000;
279		var distance = 300;
280
281		function wheel(event) {
282		    if (event.wheelDelta) delta = event.wheelDelta / 120;
283		    else if (event.detail) delta = -event.detail / 3;
284
285		    handle();
286		    if (event.preventDefault) event.preventDefault();
287		    event.returnValue = false;
288		}
289
290		function handle() {
291
292		    $('html, body').stop().animate({
293		        scrollTop: $(window).scrollTop() - (distance * delta)
294		    }, time);
295		}
296
297		$(document).keydown(function (e) {
298
299		    switch (e.which) {
300		        //up
301		        case 38:
302		            e.preventDefault();
303		            $('html, body').stop().animate({
304		                scrollTop: $(window).scrollTop() - distance
305		            }, time);
306		            break;
307
308		            //down
309		        case 40:
310		            e.preventDefault();
311		            $('html, body').stop().animate({
312		                scrollTop: $(window).scrollTop() + distance
313		            }, time);
314		            break;
315		    }
316		});
317
318		jQuery.extend({
319		    isValidSelector: function(selector) {
320		        if (typeof(selector) !== 'string') {
321		            return false;
322		        }
323		        try {
324		            var $element = $(selector);
325		        } catch(error) {
326		            return false;
327		        }
328		        return true;
329		    }
330		});
331
332        if ( jQuery('#container .sf-button a[href*="#"], #container .spb_text_column a[href*="#"], .swift-slider-outer a[href*="#"]').length > 0 ) {
333            jQuery('#container .sf-button a[href*="#"], #container .spb_text_column a[href*="#"], .swift-slider-outer a[href*="#"]').each(function () {
334                if ( $.isValidSelector(this.hash) && this.hash != "#" && jQuery(this.hash).length > 0 ) {   
335                    jQuery(this).on('click', function(e) {
336                        e.preventDefault();
337                        jQuery('html, body').stop().animate({
338                            scrollTop: getNum(jQuery(this.hash).offset().top) - getNum(jQuery("#header-sticky-wrapper #header").height()) - getNum(jQuery("#wpadminbar:visible").height())
339                        }, 500, 'easeInOutExpo');
340                        return false;
341                    });
342                } else {
343                    jQuery(this).on('click', function(e) {
344                        return true;
345                    });
346                }
347            }); 
348        }
349
350		function stickyMenu() {
351			if ( ( $(".swift-slider-outer").length > 0 || $(".page-heading").length > 0 ) && $("#header").length > 0 ) {
352				var bottomPosition = 0;
353				if ( $(".swift-slider-outer").length > 0 ) {
354					bottomPosition = bottomPosition + $(".swift-slider-outer").outerHeight();
355				}
356				if ( $(".page-heading").length > 0 ) {
357					bottomPosition = bottomPosition + $(".page-heading").outerHeight();
358				}
359				if ( $("body").hasClass("admin-bar") > 0 ) {
360					bottomPosition = bottomPosition + $("#wpadminbar:visible").outerHeight();
361				}
362				var posFromTop = $( window ).scrollTop();
363				if ( $("#header-section").hasClass("header-vert") ) {
364					if ( ( posFromTop + 40 ) >= bottomPosition ) {
365						if ( !$(".header-wrap").hasClass("below-header") ) {
366							$(".header-wrap").addClass("below-header");
367						}
368					} else {
369						if ( $(".header-wrap").hasClass("below-header") ) {
370							$(".header-wrap").removeClass("below-header");
371						}
372					}
373				} else {
374					if ( ( posFromTop + 40 ) >= bottomPosition ) {
375						if ( !$("#header").hasClass("below-header") ) {
376							$("#header").addClass("below-header");
377						}
378					} else {
379						if ( $("#header").hasClass("below-header") ) {
380							$("#header").removeClass("below-header");
381						}
382					}
383				}
384			}
385		}
386
387		if ( $("#header").hasClass("sticky-header") || $("#header-section").hasClass("header-vert") ) {
388			$( window ).scroll(function () { stickyMenu(); });
389			stickyMenu();
390		}
391
392		$('.blog-wrap a.load-more-btn, .search-form a, .blog-wrap .blog-item a, #breadcrumbs a, .spb_text_column .spb-asset-content a, .menu a, a.sf-button, button.sf-button, .mobile-menu-link').on('touchstart', function(e){
393			$(this).addClass('tapped').addClass('hover');
394		});
395		$('.blog-wrap a.load-more-btn, .search-form a, .blog-wrap .blog-item a, #breadcrumbs a, .spb_text_column .spb-asset-content a, .menu a, a.sf-button, button.sf-button, .mobile-menu-link').on('touchend', function(e){
396			$(this).removeClass('tapped').removeClass('hover');
397		});
398
399		/* ADJUST STYLING FOR ADJACENT ELEMENTS */
400		if ( $(".elementor-tab-content, .elementor-widget-text-editor .elementor-text-editor, .spb_text_column > .spb-asset-content, article .content-wrap, .image-edge-content").length > 0 ) {
401			$container = $(".elementor-tab-content, .elementor-widget-text-editor .elementor-text-editor, .spb_text_column > .spb-asset-content, article .content-wrap, .image-edge-content");
402			$container.find("h1:not(:empty),h2:not(:empty),h3:not(:empty),h4:not(:empty),h5:not(:empty),h6:not(:empty),blockquote:not(:empty),p:not(:empty),ul:not(:empty),ol:not(:empty),li:not(:empty)").each(function () {
403				if ( $(this).prev().length > 0 ) {
404					if ( $(this).prev().is("h1:not(:empty)") ) {
405						$(this).addClass("after-h1");
406					} else if ( $(this).prev().is("h2:not(:empty)") ) {
407						$(this).addClass("after-h2");
408					} else if ( $(this).prev().is("h3:not(:empty)") ) {
409						$(this).addClass("after-h3");
410					} else if ( $(this).prev().is("h4:not(:empty)") ) {
411						$(this).addClass("after-h4");
412					} else if ( $(this).prev().is("h5:not(:empty)") ) {
413						$(this).addClass("after-h5");
414					} else if ( $(this).prev().is("h6:not(:empty)") ) {
415						$(this).addClass("after-h6");
416					} else if ( $(this).prev().is("blockquote:not(:empty)") ) {
417						$(this).addClass("after-blockquote");
418					} else if ( $(this).prev().is("p:not(:empty)") ) {
419						$(this).addClass("after-p");
420					} else if ( $(this).prev().is("ul:not(:empty)") ) {
421						$(this).addClass("after-ul");
422					} else if ( $(this).prev().is("ol:not(:empty)") ) {
423						$(this).addClass("after-ol");
424					} else if ( $(this).prev().is("li:not(:empty)") ) {
425						$(this).addClass("after-li");
426					}
427				} else {
428					$(this).addClass("first");
429				}
430				if ( $(this).next().length > 0 ) {
431					if ( $(this).next().is("h1:not(:empty)") ) {
432						$(this).addClass("before-h1");
433					} else if ( $(this).next().is("h2:not(:empty)") ) {
434						$(this).addClass("before-h2");
435					} else if ( $(this).next().is("h3:not(:empty)") ) {
436						$(this).addClass("before-h3");
437					} else if ( $(this).next().is("h4:not(:empty)") ) {
438						$(this).addClass("before-h4");
439					} else if ( $(this).next().is("h5:not(:empty)") ) {
440						$(this).addClass("before-h5");
441					} else if ( $(this).next().is("h6:not(:empty)") ) {
442						$(this).addClass("before-h6");
443					} else if ( $(this).next().is("blockquote:not(:empty)") ) {
444						$(this).addClass("before-blockquote");
445					} else if ( $(this).next().is("p:not(:empty)") ) {
446						$(this).addClass("before-p");
447					} else if ( $(this).next().is("ul:not(:empty)") ) {
448						$(this).addClass("before-ul");
449					} else if ( $(this).next().is("ol:not(:empty)") ) {
450						$(this).addClass("before-ol");
451					} else if ( $(this).next().is("li:not(:empty)") ) {
452						$(this).addClass("before-li");
453					}
454				} else {
455					$(this).addClass("last");
456				}
457			});
458		}
459
460		/* EQUAL HEIGHT COLUMNS */
461		if ( $(".spb-row-container.col-equal-height").length > 0 ) {
462			if ( $(".spb-row-container.col-equal-height").find(".row").length > 0 && $(window).width() > 767 ) {
463				$element = $(".spb-row-container.col-equal-height > .spb_content_element > .container > .row > .spb_box_content, .spb-row-container.col-equal-height > .spb_content_element > .container > .row > .spb_text_column, .spb-row-container.col-equal-height > .spb_content_element > .container > .row > .spb-column-container");
464				$element.parent().imagesLoaded(function () {
465					$element.parent().equalHeights();
466				});
467			}
468		}
469
470		if ( $("body.search .page-heading .results-count").length > 0 ) {
471			$("body.search .page-heading .results-count").html($("body.search .blog-items").data("found-posts"));
472		}
473
474		$(".blog-wrap .keyword-text").each(function () {
475			$(this).html($(this).parents(".blog-wrap").find(".search-form input").val());
476		});
477
478		$(".blog-wrap .results-count").each(function () {
479			$(this).html($(this).parents(".blog-wrap").find(".blog-items").data("found-posts"));
480		});
481
482		function convertToSlug(Text) {
483		    return Text
484		        .toLowerCase()
485		        .replace(/ /g,'-')
486		        .replace(/[^\w-]+/g,'')
487		        ;
488		}
489
490		if ( $("body.page-template-owners-manual").length > 0 ) {
491			$tableofcontents = $("#table-of-contents");
492			$("#main-container").imagesLoaded(function () {
493				$("#main-container > .container").find(".spb_text_column h2,.spb_text_column h3:not(.count-subject),.spb_text_column h4,.spb_text_column h5,.spb_text_column h6").each(function () {
494					if ( $(this).text() != "Table of Contents" ) {
495						var heading = "";
496						var headingid = $(this).prop("id");
497						if ( headingid == "" ) {
498							headingid = convertToSlug($(this).text());
499							$(this).prop("id", headingid);
500						}
501						if ( $(this)[0].outerHTML.indexOf("<h2") >= 0 ) {
502							heading = "h2";
503						} else if ( $(this)[0].outerHTML.indexOf("<h3") >= 0 ) {
504							heading = "h3";
505						}
506						if ( heading != "" ) {
507							$tableofcontents.append("<p class='heading-" + heading + "' data-offset='" + (Math.round($(this).offset().top)-($("#header").height()+70)) + "'><a href='#" + headingid + "'>" + $(this).text() + "</a></p>");
508						}
509						heading = "";
510					}
511				});
512
513				$tableofcontents.append("<p class='back-to-top'><a class='brand-outline elementor-button-link elementor-button elementor-size-sm' href='#main-container'>Back to Top</a></p>");
514
515				$("#table-of-contents").find('a[href*="#"]:not([href="#"])').keyup(function (event) {
516					if (event.keyCode === 9) {
517						$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
518						$(this).addClass("accessibility-focus");
519					}
520				});
521				$("#table-of-contents").find('a[href*="#"]:not([href="#"])').click(function () {
522					$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
523				});
524				$("#table-of-contents").find('a[href*="#"]:not([href="#"])').mousedown(function () {
525					$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
526				});
527
528				if ( $("#table-of-contents-wrapper .sticky-wrapper").length > 0 ) {
529					$("#table-of-contents-wrapper .sticky-wrapper").stick_in_parent({
530						parent: "#main-container > .container > .row",
531				        spacer: false,
532				        offset_top: ($("#header").height() - parseFloat($("#table-of-contents-wrapper .sticky-wrapper").css("padding-top"))),
533				        inner_scrolling: 0,
534				    });
535
536				    var body = jQuery('body');
537				    var anchor;
538				    var tableComponent;
539
540				    $("#table-of-contents-wrapper .sticky-wrapper a").click(function (e) {
541				    	e.preventDefault();
542
543				    	tableComponent = $(this);
544				    	anchor = "#" + $(this).prop("href").split("#")[1];
545						var adjustment = 0;
546
547						if (jQuery('#wpadminbar:visible').length > 0) {
548							adjustment = jQuery('#wpadminbar').height();
549						}
550
551						if (body.hasClass('sticky-header-enabled')) {
552							adjustment = jQuery('.sticky-header').outerHeight() > 0 ? adjustment + jQuery('.sticky-header').outerHeight() : adjustment + jQuery('#header-section').outerHeight();
553						}
554
555						SWIFT.isScrolling = true;
556
557					    jQuery('html, body').stop().animate({
558							scrollTop: getNum(jQuery(anchor).offset().top) - getNum(adjustment) - 25
559						}, 1000, 'easeInOutExpo', function() {
560							SWIFT.isScrolling = false;
561						});
562				    	return false;
563				    });
564
565					$(window).scroll(function(){
566						$("#table-of-contents p, #in-elementor a:not(.toggle-items)").each(function () {
567							var positionData = Math.round($(this).data("offset"))+($("#header").height()+70);
568							if ( $(window).scrollTop() >= positionData ) {
569								$(this).hide();
570							} else {
571								$(this).show();
572							}
573						});
574					});
575				}
576			});
577		}
578
579		_.mixin({
580			isTrue: function( val ) {
581				if( typeof val === "undefined")
582					return false;
583
584				if( _.isString( val ) )
585					return val.toLowerCase() === "true";
586
587				if(_.isNumber( val ) )
588					return 0 !== val;
589			},
590			isFalse: function( val ) {
591				return !_.isTrue( val );
592			}
593		});		
594
595		var dropdown = $('.spb_blog_widget .filter-wrap .filter-dropdown, .spb_algolia_widget .filter-wrap .filter-dropdown');
596
597		dropdown.each(function() {
598			$(this).find('> .post-filter-tabs > li > a[data-term="uncategorized"]').parent().remove();
599			var taxonomy = $(this).data('taxonomy-label');
600			var initial_selected = $(this).find('> .post-filter-tabs li.selected a span.item-name').text();
601			if ( $(this).find('> .post-filter-tabs li.selected a span.item-name').length > 1 ) {
602				initial_selected = [];
603				$(this).find('> .post-filter-tabs li.selected a span.item-name').each(function (i, selected ) {
604					console.log(selected);
605					initial_selected[i] = $(this).text();
606				});
607				initial_selected = initial_selected.join(", ");
608			}
609			filter_name = taxonomy;
610			if ( $(this).parents(".blog-wrap").find(".results-summary").length <= 0 ) {
611				if ( initial_selected == 'Show all' || initial_selected == "" ) {
612					filter_name = taxonomy;
613				} else {
614					filter_name = initial_selected;
615				}
616			}
617
618			if ( $(this).parent().is("ul") ) {
619				$(this).prepend('<li><a href="#" class="chosen-single" data-filtername="' + filter_name + '" title="Select ' + taxonomy + '"><span>' + filter_name + '</span></a></li>');
620			} else {
621				$(this).prepend('<a href="#" class="chosen-single" data-filtername="' + filter_name + '" title="Select ' + taxonomy + '"><span>' + filter_name + '</span></a>');
622			}
623
624			if ( $(this).find("> .post-filter-tabs .selected").length <= 0 ) {
625				$(this).find("> .post-filter-tabs a.all").parent("li").addClass("selected").addClass("default");
626			}
627
628		});
629
630		// DROPDOWN FILTER - BLOG FEED
631		dropdown.find('a.chosen-single').on("click", function(e) {
632			e.preventDefault();
633			if ( $(this).parent().hasClass('closed') ) {
634				$(this).parent().removeClass('closed').addClass('open');
635			} else if ( $(this).parent().hasClass('open') ) {
636				$(this).parent().removeClass('open').addClass('closed');
637			}
638			return false;
639		});
640		dropdown.find('.post-filter-tabs > li > .toggle-accordion a, .post-filter-tabs > li > .toggle-accordion button').on("click", function(e) {
641			var clicked_dropdown = $(this).parent('.subfilter-dropdown');
642			if ( clicked_dropdown.length > 0 ) {
643				/* IS TOPICS SELECTION */
644				e.preventDefault();
645				if ( $(this).parent().hasClass('closed') ) {
646					$(this).parent().removeClass('closed').addClass('open');
647				} else if ( $(this).parent().hasClass('open') ) {
648					$(this).parent().removeClass('open').addClass('closed');
649				}
650				return false;
651			} else {
652				if ( $(this).parents(".blog-wrap").find(".results-summary").length <= 0 ) {
653					if ( !$(this).hasClass("all") && !$(this).hasClass("All") && $(this).data("term") != "" ) {
654						$(this).parents(".filter-dropdown").find(".chosen-single").html($(this).prop("title"));
655						$(this).parents(".filter-dropdown").find(".chosen-single").addClass("selected-dropdown");
656					} else {
657						$(this).parents(".filter-dropdown").find(".chosen-single").html($(this).parents(".filter-dropdown").find(".chosen-single").data("filtername"));
658						$(this).parents(".filter-dropdown").find(".chosen-single").removeClass("selected-dropdown");
659					}
660				}
661				if ( !$(this).parents(".filter-wrap").hasClass("multiselect") ) {
662					$(this).parent().removeClass('open').addClass('closed');
663				}
664			}
665		});
666
667		$(document).click(function(event) { 
668		    if( $(event.target).parents('.filter-dropdown.open').length <= 0 ) {
669		    	$(".spb_blog_widget, .spb_algolia_widget").each(function () {
670					if ( !$(this).hasClass("filter-display-sidebar") ) {
671						$(this).find(".filter-dropdown").removeClass("open").addClass("closed");	
672					}
673				});
674		    }        
675		});
676		
677		$("#container a").focus(function () {
678			if ( $(this).parents(".menu").length <= 0 || ( $(this).parent().hasClass("menu-item") == false && $(this).parent().hasClass("parent") == false ) ) {
679				$("#header-section .menu ul.sub-menu, #header-section .menu .mega-menu-sub").fadeOut(0);	
680			}
681			if ( $(this).parent().hasClass("filter-dropdown") == false && $(this).parent().parent().hasClass("post-filter-tabs") == false ) {
682				$(".spb_blog_widget, .spb_algolia_widget").each(function () {
683					if ( !$(this).hasClass("filter-display-sidebar") ) {
684						$(this).find(".filter-dropdown").removeClass("open").addClass("closed");	
685					}
686				});
687			}
688		});
689
690		if ( $('.spb_text_column iframe[src*="youtube.com"], .spb_text_column iframe[src*="vimeo.com"], .spb_video_widget iframe[src*="youtube.com"], .spb_video_widget iframe[src*="vimeo.com"]').length > 0 ) {
691			$('.spb_text_column iframe[src*="youtube.com"], .spb_text_column iframe[src*="vimeo.com"], .spb_video_widget iframe[src*="youtube.com"], .spb_video_widget iframe[src*="vimeo.com"]').each(function () {
692				if ( $(this).parents(".video-wrap").length <= 0 && !$(this).parent().hasClass("video-sizing-wrap") ) {
693					$(this).wrap('<div class="video-sizing-wrap"></div>');
694				}
695			});
696		}
697
698		/* START MEGA NAV */
699
700		var hoverTimer;
701		var hoverDelay = 0;
702		var meganavBid = new Bid(function( $this ) { 
703				$(".meganavigation .sub-menu-meganav .menu-wrap").html("");
704			    openMeganav($this);
705			}, hoverDelay);
706
707		if ( $(".meganavigation .header-right").length > 0 ) {
708			if ( $(".header-search-form .submit-search").length > 0 ) {
709				$(".header-search-form .submit-search").on("click",function (e) {
710					e.preventDefault();
711					$form = $(this).closest("form.header-search-form");
712					$form.submit();
713					return false;
714				});	
715			}
716		}
717
718		if ( $(".meganavigation .menu > li.parent > .sub-menu").length > 0 ) {
719					
720	        function openMeganav($this) {
721
722	        	$(".meganav-wrap").css("top", $(".header-wrap").height() + "px");
723				var $menuItem = $this.parent("li.parent");
724				$menuItem.addClass("show-submenu");
725				var submenuHTML = $menuItem.find("> .sub-menu").wrap('<p/>').parent().html();
726				$menuItem.find("> p > .sub-menu").unwrap();
727
728				if ( submenuHTML == undefined || submenuHTML == "" ) {
729					closeMeganav();
730				} else {
731					$(".meganav-wrap .sub-menu-meganav > .menu-wrap").html('<div class="heading">' + $this.text() + '</div>' + submenuHTML + "<a href='#' class='close-meganav'>Close Meganavigation</a>");
732					$(".meganav-wrap .sub-menu-meganav > .menu-wrap").prop("id", "post-id-" + $this.data("postid"));
733					$(".meganav-wrap .sub-menu-meganav > .menu-wrap").find("a,button,input,textarea,select,*[role=button],*[role=tab]").each(function (i) {
734						$(this).keyup(function (event) {
735							if (event.keyCode === 9) {
736								if ( i >= ( $(".meganav-wrap .sub-menu-meganav > .menu-wrap").find("a,button,input,textarea,select,*[role=button],*[role=tab]").length-1 ) ) {
737									if ( $(".meganavigation .show-submenu").next("li").length > 0 ) {
738										$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
739										$(".meganavigation .show-submenu").next("li").find("> a").addClass("accessibility-focus");
740										$(".meganavigation .show-submenu").next("li").find("> a").trigger('mouseenter');	
741									} else {
742										$(".meganavigation .show-submenu > a").parents(".float-menu").next().find("a,button,input,textarea,select,*[role=button],*[role=tab]");
743										debugger;
744									}
745								} else {
746									$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
747									$(this).addClass("accessibility-focus");
748								}
749							}
750						});
751					});
752					$(".meganav-wrap .sub-menu-meganav > .menu-wrap").find("a.close-meganav").click(function (e) {
753						e.preventDefault();
754						closeMeganav();
755						return false;
756					});
757					$(".meganav-wrap").prop("id", "meganav-postid-" + $this.data("postid"));
758					$(".meganav-wrap").removeClass("secondary-menu-items").removeClass("tertiary-menu-items");
759					if ( $(".meganav-wrap .sub-menu .sub-menu").length > 0 ) {
760						$(".meganav-wrap").addClass("tertiary-menu-items");
761					} else if ( $(".meganav-wrap .sub-menu").length > 0 ) {
762						$(".meganav-wrap").addClass("secondary-menu-items");
763					}
764					$(".meganav-wrap .sub-menu-meganav > div:not(.menu-wrap)").hide();
765					$('.meganav-wrap .sub-menu-meganav > div:not(.menu-wrap)[data-menu="' + $this.data("postid") + '"]').show();
766					$("body").addClass("show-meganav");
767					$(".accessibility-focus-menu").removeClass("accessibility-focus-menu");
768					$(".accessibility-focus").removeClass("accessibility-focus");
769					$('.meganav-wrap').fadeIn(0, function (){ 
770						$('.sub-menu-meganav').height("auto")
771						$('.sub-menu-meganav').height($('.sub-menu-meganav').height());
772						$(".meganav-wrap").addClass("show-meganav");
773						if ( $(".header-wrap").css("display") != "none" ) {
774							$("#main-container").css("padding-top", $(".header-wrap").height() + "px");
775						} else {
776							$("#main-container").css("padding-top", "0px");
777						}	
778					});
779				}
780	        }
781
782	        function closeMeganav() {
783        		if ( meganavBid ) {
784					meganavBid.stop();
785				}
786        		if ( hoverTimer ) {
787				    clearTimeout(hoverTimer);
788				}
789				$(".show-submenu").each(function () { $(this).removeClass("show-submenu"); });
790				$(".meganav-wrap").removeClass("show-meganav").css("display", "none");
791				$(".show-submenu").removeClass("show-submenu");
792				$("body").removeClass("show-meganav");
793				$(".meganavigation .sub-menu-meganav .menu-wrap").html("");
794				if ( $(".header-wrap").css("display") != "none" ) {
795					$("#main-container").css("padding-top", $(".header-wrap").height() + "px");
796				} else {
797					$("#main-container").css("padding-top", "0px");
798				}
799	        }					
800
801			$(".meganavigation .menu > li.parent > a").on("blur", function () {
802				$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
803				$(".meganav-wrap.show-meganav .menu-wrap > .sub-menu > .menu-item:first-child > a").focus().addClass("accessibility-focus");	
804			});
805
806			$(".meganavigation .menu > li.parent > a").keyup(function (event) {
807				if (event.keyCode === 9) {
808					// openMeganav($(this));
809				}
810			});
811
812			$("#header").mouseover(function (e) {
813				if( $(e.target).parents('.std-menu').length <= 0 && $(e.target).parents(".meganav-wrap").length <= 0 && $(e.target).is(".meganav-wrap").length <= 0 ){
814	        		closeMeganav();
815				}
816			});
817
818			$(".swift-slider-outer a, #main-container, #logo a").each(function () {
819				$(this).mouseover(function (e) {
820					closeMeganav();
821				});
822				$(this).mouseleave(function (e) {
823	        		if ( meganavBid ) {
824						meganavBid.stop();
825					}
826	        		if ( hoverTimer ) {
827					    clearTimeout(hoverTimer);
828					}
829				});
830			});
831
832			$(".meganavigation .menu > li.parent > .sub-menu").each(function () {
833				var $menu = $(this).parents(".menu");
834				$menu.find(" > li > a").each(function () {
835					if ( $(this).parent().hasClass("sub-menu-click-reveal") ) {
836						$(this).unbind("click").off().on("click", function (e) {
837							e.preventDefault();
838							if ( !$(this).parent().hasClass("show-submenu") ) {
839								jQuery(this).parent().addClass("show-submenu");
840								$(".show-submenu").each(function () { $(this).removeClass("show-submenu"); });
841							} else {
842								jQuery(this).parent().removeClass("show-submenu");
843								if ( meganavBid ) {
844									meganavBid.stop();
845								}
846				        		if ( hoverTimer ) {
847								    clearTimeout(hoverTimer);
848								}
849							}
850							return false;
851						});
852					} else {
853						$(this).mouseover(function () {
854							$(".show-submenu").each(function () { $(this).removeClass("show-submenu"); });
855						}); 
856						$(this).mouseleave(function () {
857			        		if ( meganavBid ) {
858								meganavBid.stop();
859							}
860			        		if ( hoverTimer ) {
861							    clearTimeout(hoverTimer);
862							}
863						});
864					}
865				});
866				$menu.find("> li.parent > a").each(function () {
867					if ( $(this).parent().hasClass("sub-menu-click-reveal") ) {
868						$(this).unbind("click").off().on("click", function (e) {
869							e.preventDefault();
870							if ( !$(this).parent().hasClass("show-submenu") ) {
871								jQuery(this).parent().addClass("show-submenu");
872								var $this = $(this);
873				        		if ( meganavBid ) {
874									meganavBid.stop();
875								}
876				        		if ( hoverTimer ) {
877								    clearTimeout(hoverTimer);
878								}
879							    hoverTimer = setTimeout(function () {
880									meganavBid.bump( $this );
881							    }, hoverDelay); 
882							} else {
883								jQuery(this).parent().removeClass("show-submenu");
884				        		if ( meganavBid ) {
885									meganavBid.stop();
886								}
887				        		if ( hoverTimer ) {
888								    clearTimeout(hoverTimer);
889								}
890							}
891							return false;
892						});
893					} else {
894						$(this).mouseover(function () {
895							var $this = $(this);
896			        		if ( meganavBid ) {
897								meganavBid.stop();
898							}
899			        		if ( hoverTimer ) {
900							    clearTimeout(hoverTimer);
901							}
902						    hoverTimer = setTimeout(function () {
903								meganavBid.bump( $this );
904						    }, hoverDelay); 
905						});
906						$(this).mouseleave(function () {
907			        		if ( meganavBid ) {
908								meganavBid.stop();
909							}
910			        		if ( hoverTimer ) {
911							    clearTimeout(hoverTimer);
912							}
913						});
914					}
915				});
916			});
917
918			$(".meganavigation .menu > li:not(.parent) > a").each(function () {
919				var $menu = $(this).parents(".menu");
920				$menu.find("> li:not(.parent) > a").each(function () {
921					$(this).mouseover(function () {
922						var $this = $(this);
923		        		if ( meganavBid ) {
924							meganavBid.stop();
925						}
926		        		if ( hoverTimer ) {
927						    clearTimeout(hoverTimer);
928						}
929					    hoverTimer = setTimeout(function () {
930							meganavBid.bump( $this );
931					    }, hoverDelay); 
932					});
933					$(this).mouseleave(function () {
934		        		if ( meganavBid ) {
935							meganavBid.stop();
936						}
937		        		if ( hoverTimer ) {
938						    clearTimeout(hoverTimer);
939						}
940					});
941				});
942			});
943
944		}
945
946		/* END MEGA NAV */
947
948		/* START IFRAME HEIGHT */
949
950		if($("iframe.iframe-resize").length > 0 ) {
951			$("iframe.iframe-resize").css("height", "");
952			$("iframe.iframe-resize").removeAttr("height");
953			$("iframe.iframe-resize").removeAttr("type");
954			$("iframe.iframe-resize").iFrameResize({heightCalculationMethod: "max"});
955		}
956		/* END IFRAME HEIGHT */
957
958		/**
959		 * Resource Download through Gravity Form
960		 * Using the URL entered into Gravity Forms SPB element, it is copied to a hidden input's value to be used by the form's confirmation message.
961		 * The confirmation message has a hidden link which uses the download URL, and uses javascript to click the link, opening the download in a new tab.
962		 */
963		if ( $('.spb_gravityforms_widget').length > 0 ) {
964			$('.spb_gravityforms_widget').each(function () {
965				if ( $(this).find('.gform_body .gform_hidden input[value="download-url"]').length > 0 ) {
966					$url = $(this).data('download-url');
967					$(this).find('.gform_body .gform_hidden input[value="download-url"]').val($url);
968				}
969			});
970		}
971
972		/* Accessibility Focus Data */
973		$("a,button,input,textarea,select,*[role=button],*[role=tab]").keyup(function (event) {
974			if (event.keyCode === 9) {
975				$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
976				$(this).addClass("accessibility-focus");
977			}
978		});
979		$("a,button,input,textarea,select,*[role=button],*[role=tab]").click(function () {
980			// $("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
981		});
982		$("a,button,input,textarea,select,*[role=button],*[role=tab]").mousedown(function () {
983			// $("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
984		});
985		$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
986
987		/* HIGHCHARTS */
988		if ( $(".spb_highcharts .highcharts-container").length > 0 ) {
989
990		    var charts = [];
991
992			$(".spb_highcharts .highcharts-container").each(function() {
993				try {
994					var raw_data = $(this).find(".data").html();
995				    var data = $.parseJSON(raw_data.replace(/&amp;/g, '&'));
996					var charttype = $(this).data("charttype").replace(/&quot;/g, '"');
997					var valuedisplay = $(this).data("valuedisplay").replace(/&quot;/g, '"');
998					var xCategories = $(this).data("xcategories").slice(1, -1).replace(/&quot;/g, '"').replace(/', '/g, "','").split("','");
999					
1000					var displayx = $(this).data("displayx").replace(/&quot;/g, '"');
1001					var displayy = $(this).data("displayy").replace(/&quot;/g, '"');
1002					var displaylegend = $(this).data("displaylegend").replace(/&quot;/g, '"');
1003					var displaytooltips = $(this).data("displaytooltips").replace(/&quot;/g, '"');
1004
1005					var suffix = "";
1006					var prefix = "";
1007					var yaxisformat = "";
1008					if ( valuedisplay == "percentage" ) {
1009						suffix = "%";
1010					} else if ( valuedisplay == "currency" ) {
1011						prefix = "$";
1012					}
1013					if ( !xCategories ) {
1014						xCategories = null;
1015					}
1016
1017                    //calculate the height
1018                    var base = 130; //sum of top and bottom margin
1019                    var mult = 85; //desired height per category
1020                    var len = xCategories.length;
1021                    var height = ((len * mult) + base);
1022
1023					if ( charttype != "" ) {
1024
1025						var chartOptions = {
1026					      	chart: {
1027					            plotBackgroundColor: null,
1028					            plotBorderWidth: null,
1029					            plotShadow: false,
1030					            height: height,
1031					          	type: charttype,
1032        						style: false
1033					      	},
1034					      	series: data,
1035                            credits: {
1036                                enabled: false
1037                            }
1038					  	};
1039
1040					  	if ( $(this).data("title") != "" ) {
1041							chartOptions.title = {
1042							    text: '<h4 class="highcharts-title">' + $(this).data("title") + '</h4>',
1043					          	useHTML: true,
1044        						styledMode: true
1045							}
1046					  	} else {
1047							chartOptions.title = false;
1048					  	}
1049
1050					  	if ( $(this).data("subtitle") != "" ) {
1051							chartOptions.subtitle = {
1052							    text: '<h6 class="highcharts-subtitle">' + $(this).data("subtitle") + '</h6>',
1053					          	useHTML: true,
1054        						styledMode: true
1055							}
1056					  	} else {
1057							chartOptions.subtitle = false;
1058					  	}
1059
1060					  	if ( displaytooltips == "yes" ) {
1061					  		chartOptions.tooltip = {
1062		                        enabled: true,
1063		                        backgroundColor: "rgba(255,255,255,1)",
1064		                        borderColor: "rgba(255,255,255,1)",
1065		                        borderWidth: 0,
1066		                        useHTML: true,
1067					      	  	shared: true,
1068                                formatter: function () {
1069						            var points = this.points;
1070						            var tooltipMarkup = '';
1071						            if ( points ) {
1072							            var pointsLength = points.length;
1073							            var index;
1074							            var y_value_kwh;
1075
1076							            for(index = 0; index < pointsLength; index += 1) {
1077							              y_value_kwh = points[index].y;
1078
1079							              tooltipMarkup = '<span class="chart-tooltip chart-color-' + index + '" style="color:' + points[index].series.color + ';">' + points[index].series.name + ': ' + prefix + y_value_kwh + suffix + '</span><br/>' + tooltipMarkup;
1080							            }
1081							        }
1082
1083						            return tooltipMarkup;
1084							    }
1085					      	};
1086					  	} else {
1087					  		chartOptions.tooltip = {
1088		                        enabled: false
1089		                    };
1090					  	}
1091
1092						if ( displayx == "yes" ) { 
1093							chartOptions.xAxis = {
1094                    			categories: xCategories,
1095            					type: "category",
1096					          	useHTML: true,
1097      							tickLength: 0,
1098					          	title: {
1099					              	text: $(this).data("xlabel")
1100					          	},
1101					          	labels: {
1102					          		useHTML: true
1103					          	}
1104					      	};
1105					      	if ( displayy == "yes" ) {
1106					      		chartOptions.xAxis.minorTickLength = 0;
1107					      		chartOptions.xAxis.lineWidth = 0;
1108					      		chartOptions.xAxis.minorGridLineWidth = 0;
1109					      		chartOptions.xAxis.lineColor = "transparent";
1110					      	}
1111						} else {
1112							chartOptions.xAxis = {
1113								enabled: false,
1114      							tickLength: 0,
1115								minorTickLength: 0,
1116							   	lineWidth: 0,
1117							   	minorGridLineWidth: 0,
1118							   	lineColor: 'transparent',
1119      							title: {
1120									enabled: false
1121      							},
1122								labels: {
1123									enabled: false
1124								}
1125							};
1126						}
1127
1128						if ( displayy == "yes" ) { 
1129							chartOptions.yAxis = {
1130					          	title: {
1131					              	text: $(this).data("ylabel")
1132					          	},
1133					          	useHTML: true,
1134					          	labels: {
1135					          		useHTML: true,
1136	                                formatter: function () {
1137	                                	var value = this.value;
1138	                                	if ( value > 1000000 ) {
1139	                                		value = (value/1000000) + "M";
1140	                                	} else if ( value > 1000 ) {
1141	                                		value = (value/1000) + "k";
1142	                                	} else {
1143	                                		value = this.value + suffix;
1144	                                	}
1145							            return value;
1146							        }
1147					          	}
1148					      	};
1149						} else {
1150							chartOptions.yAxis = {
1151								enabled: false,
1152      							title: {
1153									enabled: false
1154      							},
1155								labels: {
1156									enabled: false
1157								},
1158								gridLineColor: 'transparent',
1159      							tickLength: 0,
1160								minorTickLength: 0,
1161							   	lineWidth: 0,
1162							   	minorGridLineWidth: 0,
1163							   	lineColor: 'transparent',
1164							};
1165						}
1166
1167						if ( displaylegend == "yes" ) { 
1168							chartOptions.legend = {
1169						    	reversed: true,
1170					          	useHTML: true
1171						  	};
1172						} else {
1173							chartOptions.legend = {
1174								enabled: false
1175							};
1176						}
1177
1178						if ( charttype == "stacked" ) {
1179							chartOptions.chart.type = "bar";
1180							chartOptions.plotOptions = {
1181						        bar: {
1182						            stacking: 'normal',
1183						            pointWidth: 40,
1184						            dataLabels: {
1185						                enabled: false,
1186						            }
1187						        }
1188						    };
1189						    if ( displayy == "yes" ) { 
1190							    chartOptions.yAxis.stackLabels = {
1191						            enabled: false,
1192							        useHTML: true,
1193							    };
1194							    if ( valuedisplay == "percentage" ) {
1195							    	chartOptions.yAxis.min = 0;
1196							    	chartOptions.yAxis.max = 100;
1197							    }
1198							}
1199							if ( displaytooltips == "no" ) {
1200								chartOptions.plotOptions.bar.dataLabels = {
1201					                enabled: true,
1202					                useHTML: true,
1203							        format: '<span class="data-label-item">' + prefix + '{point.y}' + suffix + '</span>',
1204					            };
1205							}
1206						} else if ( charttype == "bar" ) {
1207							chartOptions.plotOptions = {
1208					            bar: {
1209   									point:{
1210								        events: {
1211        									click: function() { return false; },
1212								            legendItemClick: function () {
1213								                return false; 
1214								            }
1215								        }
1216								    }
1217					            },
1218						        series: {
1219						            events: {
1220						                legendItemClick: function () {
1221						                    return false;
1222						                }
1223						            }
1224						        }
1225					        };
1226							chartOptions.legend.reversed = false;
1227							chartOptions.tooltip.formatter = function () {
1228					            var points = this.points;
1229					            var tooltipMarkup = '';
1230					            if ( points.length ) {
1231						            var pointsLength = points.length;
1232						            var index;
1233						            var y_value_kwh;
1234
1235						            for(index = 0; index < pointsLength; index += 1) {
1236						              y_value_kwh = points[index].y;
1237
1238						              tooltipMarkup = tooltipMarkup + '<span class="chart-tooltip chart-color-' + index + '" style="color:' + points[index].series.color + ';">' + points[index].series.name + ': ' + prefix + y_value_kwh + suffix + '</span><br/>';
1239						            }
1240						        }
1241
1242					            return tooltipMarkup;
1243						    };
1244							if ( displaytooltips == "no" ) {
1245								chartOptions.plotOptions = {
1246							        bar: {
1247							            dataLabels: {
1248							                enabled: true,
1249							                useHTML: true,
1250							                format: '<span class="data-label-item">' + prefix + '{point.y}' + suffix + '</span>',
1251							            }
1252							        }
1253							    };
1254							}
1255						} else if ( charttype == "column" ) {
1256							chartOptions.plotOptions = {
1257					            column: {
1258   									point:{
1259								        events: {
1260        									click: function() { return false; },
1261								            legendItemClick: function () {
1262								                return false; 
1263								            }
1264								        }
1265								    }
1266					            },
1267						        series: {
1268						            events: {
1269						                legendItemClick: function () {
1270						                    return false;
1271						                }
1272						            }
1273						        }
1274					        };
1275							chartOptions.legend.reversed = false;
1276							chartOptions.tooltip.formatter = function () {
1277					            var points = this.points;
1278					            var tooltipMarkup = '';
1279					            if ( points.length ) {
1280						            var pointsLength = points.length;
1281						            var index;
1282						            var y_value_kwh;
1283
1284						            for(index = 0; index < pointsLength; index += 1) {
1285						              y_value_kwh = points[index].y;
1286
1287						              tooltipMarkup = tooltipMarkup + '<span class="chart-tooltip chart-color-' + index + '" style="color:' + points[index].series.color + ';">' + points[index].series.name + ': ' + prefix + y_value_kwh + suffix + '</span><br/>';
1288						            }
1289						        }
1290
1291					            return tooltipMarkup;
1292						    };
1293							if ( displaytooltips == "no" ) {
1294								chartOptions.plotOptions = {
1295							        column: {
1296							            dataLabels: {
1297							                enabled: true,
1298							                useHTML: true,
1299							                format: '<span class="data-label-item">' + prefix + '{point.y}' + suffix + '</span>',
1300							            }
1301							        }
1302							    };
1303							}
1304						} else if ( charttype == "pie" ) {
1305							chartOptions.plotOptions = {
1306					            pie: {
1307					                allowPointSelect: true,
1308					                cursor: 'pointer',
1309					                dataLabels: {
1310					                    enabled: false
1311					                },
1312					                showInLegend: true
1313					            },
1314						        series: {
1315						            events: {
1316						                legendItemClick: function () {
1317						                    return false;
1318						                }
1319						            }
1320						        }
1321					        };
1322							if ( displaylegend == "yes" ) { 
1323								chartOptions.legend.reversed = false;
1324							}
1325							if ( displaytooltips == "yes" ) {
1326								chartOptions.tooltip.formatter = function () {
1327						            var tooltipMarkup = '<span class="chart-tooltip" style="color:' + this.color + ';">' + this.point.name + ': <strong>' + prefix + this.point.y + suffix + '</strong></span>';
1328						            return tooltipMarkup;
1329							    };
1330							} else if ( displaytooltips == "no" ) {
1331								if ( displaylegend == "yes" ) { 
1332									chartOptions.plotOptions.pie = {
1333							            allowPointSelect: true,
1334							            cursor: 'pointer',
1335						                showInLegend: true,
1336							            dataLabels: {
1337							                enabled: true,
1338							                format: '<span class="data-label-item">' + prefix + '{point.percentage:.1f}' + suffix + '</span>',
1339							                useHTML: true,
1340							                filter: {
1341							                    property: 'percentage',
1342							                    operator: '>',
1343							                    value: 4
1344							                }
1345							            }
1346								    };
1347								} else if ( displaylegend == "no" ) {
1348									chartOptions.plotOptions.pie = {
1349							            allowPointSelect: true,
1350							            cursor: 'pointer',
1351						                showInLegend: true,
1352							            dataLabels: {
1353							                enabled: true,
1354							                format: '<span class="data-label-item">{point.name}' + ': ' + prefix + '{point.percentage:.1f}' + suffix + '</span>',
1355							                useHTML: true,
1356							                filter: {
1357							                    property: 'percentage',
1358							                    operator: '>',
1359							                    value: 4
1360							                }
1361							            }
1362								    };
1363								}
1364							}
1365						} else if ( charttype == "solidgauge" ) {
1366							chartOptions.chart = {
1367								type: 'solidgauge',
1368        						height: '100%'
1369							};
1370							chartOptions.title = false;
1371							chartOptions.subtitle = false;
1372							chartOptions.tooltip = false;
1373						    chartOptions.pane = {
1374						        startAngle: 0,
1375						        endAngle: 360,
1376						        background: [{ // Track for Move
1377						            outerRadius: '112%',
1378						            innerRadius: '80%',
1379						            backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[0])
1380						                .setOpacity(0.3)
1381						                .get(),
1382						            borderWidth: 0
1383						        }],
1384						    };
1385						    chartOptions.yAxis = {
1386						        min: 0,
1387						        max: 100,
1388						        lineWidth: 0,
1389						        tickPositions: [],
1390						    };
1391						    chartOptions.plotOptions = {
1392						        solidgauge: {
1393						            dataLabels: {
1394						                enabled: false
1395						            },
1396						            linecap: 'square',
1397						            stickyTracking: false,
1398						            rounded: false,
1399						        }
1400						    };
1401						    chartOptions.series = [{
1402						        data: [{
1403						            color: Highcharts.getOptions().colors[0],
1404						            radius: '112%',
1405						            innerRadius: '80%',
1406						            y: parseInt(raw_data)
1407						        }]
1408						    }];
1409						    chartOptions.xAxis = false;
1410						    chartOptions.legend = false;
1411						}
1412
1413					    Highcharts.chart($(this).prop("id"), chartOptions);
1414
1415					    if ( charttype == "solidgauge" ) {
1416					    	$(this).append("<div class='inner-stat'>" + prefix + parseInt(raw_data) + suffix + "</div>");
1417					    }
1418
1419					}
1420				} catch (e) {
1421				    // not json
1422				    console.log(e);
1423				}
1424			});
1425		}
1426
1427		if ( $(".page-template-call-to-action .form-card").length > 0 ) {
1428			function position_form() {
1429				var position_top = $("#main-container > .container").offset().top;
1430				$(".page-template-call-to-action .form-card").css("margin-top", ( ( position_top - 100 ) * -1 ) + "px");
1431			}
1432			position_form();
1433			$(window).resize(function () { position_form(); });
1434		}
1435
1436		$("aside.sidebar .mobile-sidebar-toggle button").click(function (e) {
1437			e.preventDefault();
1438			$sidebar = $(this).parents("aside.sidebar");
1439			if ( $sidebar.hasClass("open") ) {
1440				$sidebar.find(".sidebar-content").slideUp("fast", function () {
1441					$sidebar.removeClass("open");
1442				});
1443				$(this).attr("aria-expanded","false");
1444			} else {
1445				$sidebar.find(".sidebar-content").slideDown("fast", function () {
1446					$sidebar.addClass("open");
1447				});
1448				$(this).attr("aria-expanded","true");
1449			}
1450			return false;
1451		});
1452
1453		$("#accessibility-skip-menu").on("click", function (e) {
1454			e.preventDefault;
1455
1456			$("a,button,input,textarea,select,*[role=button],*[role=tab]").removeClass("accessibility-focus");
1457			$("#main-container").find("a:visible,button:visible,input:visible,textarea:visible,select:visible,*[role=button]:visible,*[role=tab]:visible").first().focus().addClass("accessibility-focus");
1458
1459			return false;
1460		});
1461		
1462	});
1463
1464})(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.