PageSourceSearch

https://nottinghamaqm.net/Scripts/reports/dailyRunningAveragePM_2_5.js?v=3.229.10.17%20(77.107)

js nottinghamaqm.net collected 2026-10-08 16:37:29 UTC 5,345 bytes, 181 lines download raw bytes

1
2function DailyRunningAveragePM_2_5() {
3
4    let super_ = DailyRunningAveragePM_2_5.prototype
5    let this_ = this;
6    this_.reportName = REPORTS.dailyRunningAveragePM_2_5;
7
8    this_.pullutantId = POLLUTANT.PM2_5;
9    this_.reportSystemPage = SYSTEM_PAGES.DAILY_HOUR_PM2_5_REPORT;
10    this_.EXCEL_FILE_NAME = "Daily Running Average PM_2.5 Report";
11
12    //override
13    this.init = function (config) {
14        super_.init(config, this_)
15    }
16
17    //override
18    this.getFromTimeBase = function () {
19        return "60"
20    }
21
22    //override
23    this.getToTimeBase = function () {
24        return "1440"
25    }
26
27    this.getReportType = function () {
28        return REPORT_TYPE.RunningAverage
29    }
30
31    //override
32    this.getFromTime = function () {
33
34        let isTimeEnding = configManager.read(webConfigs.TimeEnding)
35        let timebase = this_.getToTimeBase();
36
37        let time = new DateTime()
38
39        if (isTimeEnding) {
40            time.setHour(1);
41        }
42        else    // TimeBeginning
43        {
44            time.setHour(0);
45        }
46
47        time.setMinutes(0);
48
49        return time
50    }
51
52    //override
53    this.getToTime = function () {
54
55        let isTimeEnding = configManager.read(webConfigs.TimeEnding)
56        let timebase = this_.getToTimeBase();
57
58        let time = new DateTime()
59
60        if (isTimeEnding) {
61            time.setHour(0);
62        }
63        else    // TimeBeginning
64        {
65            time.setHour(23);
66        }
67
68        time.setMinutes(0);
69
70        return time
71    }
72
73    this.getStationsFilter = function () {
74
75        return {
76            pollutants: [this_.pullutantId]
77        }
78    }
79
80    this.createStationsControl = function (stationsContainer) {
81        return new stationsOnlyControl(this_, stationsContainer, this_.pullutantId)
82
83        function stationsOnlyControl(report, stationContainer, pollutantId) {
84
85            let this_ = this;
86            this_.stationsControl = null;
87            this_.report = report;
88
89            create($(stationContainer))
90
91            function create(container) {
92
93                KendoUtils.addRTLSupport(container)
94
95                this_.stationsControl = container
96            }
97
98            this.populateControls = function () {
99                populateStationsListBox()
100            }
101
102            this.getChannelsIdByStationId = function () {
103
104                let channelsIdByStationId = {}
105                getSelectedStations().forEach(function (stationId) {
106                    dataManager.getApiStationById(stationId)
107                    let channelId = apiStationUtils.pollutantIdToChannelId(stationId, pollutantId)
108
109                    if (channelId != null) {
110                        channelsIdByStationId[stationId] = [channelId]
111                    }
112                });
113
114                return channelsIdByStationId;
115            }
116
117            function populateStationsListBox() {
118                $(this_.stationsControl).empty()
119
120                let stations = getStations()
121                stations.forEach(function (station) {
122
123                    createStationItem(this_.stationsControl, station["stationId"], station["DisplayName"])
124                });
125
126                $("#searchStation").kendoTextBox({
127                    placeholder: SiteUtils.translate("Select..."),
128                });
129
130                $("#searchStation").off("input").on("input", function () {
131                    var query = this.value.toLowerCase();
132                    super_.onFilterStations(query);
133                });
134
135                function createStationItem(container, stationId, stationName) {
136                    let item = $("<div class=stationItemBox>").append(
137                        "<input type='hidden' class='stationValue' value='" + stationId + "'>" +
138                        `<input class="stationCheckboxItem" id="checkbox_${stationId}">`);
139
140                    $(container).append(item);
141
142                    $(`#checkbox_${stationId}`).kendoCheckBox({
143                        label: stationName,
144                    });
145                }
146            }
147
148            function getSelectedStations() {
149                let selectedStations = [];
150
151                $(this_.report.pageContainer).find(".stationCheckboxItem:checked").each(function () {
152
153                    //monitor name
154                    let value = $(this).closest(".stationItemBox").find(".stationValue").val()
155
156                    selectedStations.push(value)
157                    //selectedMonitors.push(parseInt(value))
158                });
159
160                return selectedStations;
161            }
162
163            function getStations() {
164
165                let filterBy = {
166                    regionId: this_.report.getRegion(),
167                    target: this_.report.getTarget(),
168                    owner: this_.report.getOwner(),
169                    active: $("#showActiveStations").prop('checked') == true ? true : null,
170                    pollutants: [this_.report.pullutantId],
171                }
172
173                let sort = true;
174                let stations = dataManager.getStationsByForReports(filterBy, sort)
175
176                return stations;
177            }
178        }
179
180    }
181}

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.