PageSourceSearch

https://www.ourair.org/wp-content/themes/hello-elementor-child/js/sbcapcd.js?ver=1790928180

js ourair.org collected 2026-10-02 08:04:04 UTC 5,131 bytes, 125 lines download raw bytes

1function userwayFixes() {
2	jQuery('#mega-menu-menu-1 > .mega-menu-item > .mega-menu-link').focus(function(){
3		if (jQuery('.userway-s1.userway-s9').length>0) {
4			jQuery('#mega-menu-menu-1 > .mega-menu-item > .mega-menu-link').trigger('mouseleave');
5			jQuery(this).closest('.mega-menu-item').trigger('mouseenter');
6		}
7	});
8	/*
9	jQuery('.elementor-accordion .elementor-accordion-item .elementor-tab-title .elementor-accordion-title').each(function(){
10		if (jQuery(this).attr('href')=='') {
11			jQuery(this).attr('href', 'javascript:return;');
12		}
13	});
14	jQuery('.elementor-accordion .elementor-accordion-item .elementor-tab-title .elementor-accordion-title').focus(function(){
15		if (jQuery('.userway-s1.userway-s9').length>0) {
16		
17		}
18	});
19	*/
20}
21
22function translate() {
23    jQuery(".link-toggle-history-wrapper a").text(texts.linkshow);
24    jQuery('.observation').each(function(){
25        var text = jQuery(this).text();
26        const arrText = text.split(" ");
27        if(arrText[2] === "OZONE"){
28            jQuery(this).text(arrText[0] + " " + arrText[1] + " " + texts.ozone);
29        }
30        if(arrText[2] === "PM2.5"){
31            jQuery(this).text(arrText[0] + " " + arrText[1] + " " + texts.pm25);
32        }
33        if(arrText[2] === "PM10"){
34            jQuery(this).text(arrText[0] + " " + arrText[1] + " " + texts.pm10);
35        }
36	});
37	jQuery('.history-cell').each(function(){
38        var currentText = jQuery(this).text();
39        if(currentText === "OZONE"){
40            jQuery(this).text(texts.ozone);
41        }
42        if(currentText === "PM2.5"){
43            jQuery(this).text(texts.pm25);
44        }
45        if(currentText === "PM10"){
46            jQuery(this).text(texts.pm10);
47        }
48        if(currentText === "Hour"){
49            jQuery(this).text(texts.hour);
50        }
51	});
52	var options = { year: 'numeric', month: 'long', day: 'numeric' };
53	const queryString = window.location.search;
54	const urlParams = new URLSearchParams(queryString);
55	const lang = urlParams.get('lang');
56	
57	if(lang === "es"){
58	    var dateText = jQuery('.aqi-time').text();
59    	dateText = dateText.replace('As of ', ''); 
60    	const arrDate = dateText.split(" at");
61    	const arrEngDate = dateText.split("at ");
62    	const d = new Date(arrDate[0]);
63    	
64	    dateEs =  d.toLocaleDateString("es-ES", options);
65	    const arrDateEs = dateEs.split(" ");
66	    
67	    jQuery('.aqi-time').text(texts.asof + " " + arrDateEs[2].charAt(0).toUpperCase() + arrDateEs[2].slice(1)+ " " + arrDateEs[0] + ", "+ " " + arrDateEs[4] + " " + texts.at + " " + arrEngDate[1]);
68	}
69}
70
71jQuery(document).ready(function($) {
72	
73	if(jQuery("body.home").length){
74		//initAirQualitySummary();
75		jQuery(".hide-new-container").css({display:"flex"});
76		jQuery('.summary-only').toggle()
77		
78	} else {
79		jQuery(".hide-new-container").css({display:"flex"}); //uncomment to enable new
80		//initAirQualitySummary(); // comment to enable new
81	}
82	jQuery('.elementor-social-icons-wrapper .elementor-social-icon').each(function(){
83		if (jQuery(this).attr('alt')!='' || jQuery(this).attr('title')!='') {
84			textOverride = jQuery(this).attr('alt');
85			if (jQuery(this).attr('title')!='') {
86				textOverride = jQuery(this).attr('title');
87			}
88			jQuery(this).find('.elementor-screen-only').html(textOverride);
89		}
90	});
91	setTimeout(userwayFixes, 10000);
92});
93
94function initAirQualitySummary() {
95	if (jQuery('#sbc-air-quality-summary').length > 0) {
96		jQuery('#sbc-air-quality-summary').html(texts.loading + '...').load('/wp-admin/admin-ajax.php?action=sbc_air_quality_summary&history='+jQuery('#sbc-air-quality-summary').attr('data-history')+'&pm_only='+jQuery('#sbc-air-quality-summary').attr('data-pm_only')+'&all_aqi='+jQuery('#sbc-air-quality-summary').attr('data-all_aqi')+'&disable_aqi_colors='+jQuery('#sbc-air-quality-summary').attr('data-disable_aqi_colors'), function(response, status, xhr){
97			if (status == 'success') {
98				airnow_history_init();
99				setTimeout(translate, 200);
100				jQuery('#sbc-air-quality-summary[data-history=true] .airnow-history-wrapper .airnow-history-table').each(function(){
101
102					/*
103					if (jQuery(this).find('.history-cell-ozone.empty-value').length == jQuery(this).find('.row-history').length || jQuery(this).find('.history-cell-ozone.zero-value').length == jQuery(this).find('.row-history').length) {
104						jQuery(this).find('.history-cell-ozone').css('display','none');
105					}
106					if (jQuery(this).find('.history-cell-pm25.empty-value').length == jQuery(this).find('.row-history').length || jQuery(this).find('.history-cell-pm25.zero-value').length == jQuery(this).find('.row-history').length) {
107						jQuery(this).find('.history-cell-pm25').css('display','none');
108					}
109					if (jQuery(this).find('.history-cell-pm10.empty-value').length == jQuery(this).find('.row-history').length || jQuery(this).find('.history-cell-pm10.zero-value').length == jQuery(this).find('.row-history').length) {
110						jQuery(this).find('.history-cell-pm10').css('display','none');
111					}
112					*/
113				});
114			}
115		});
116	}
117}
118
119
120
121// initAirQualitySummary();
122
123// window.setInterval(function(){
124// 	initAirQualitySummary()
125// }, 1000 * 60 * 15); // Run every 15 min

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.