Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { defineConfig, globalIgnores } from 'eslint/config'
import { defineConfig, globalIgnores } from 'eslint/config';
import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import globals from 'globals';

export default defineConfig([
globalIgnores([
'build/*',
'js/OpenLayers-*/**',
'opening_hours.js/**',
'node_modules/**'
]),

globalIgnores([
'build/*',
'js/OpenLayers-*/**',
'opening_hours.js/**',
]),
{
files: ['**/*.js'],
extends: [js.configs.recommended],
files: ['**/*.js', '**/*.mjs'],
extends: [js.configs.recommended],
plugins: {
'@stylistic': stylistic,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
Expand All @@ -33,14 +34,15 @@ export default defineConfig([
},
},
rules: {
"no-var": "error",
"prefer-const": "error",
"prefer-template": "error",
"template-curly-spacing": ["error", "never"],
'no-var': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
'@stylistic/semi': ['error', 'always'],
'@stylistic/quotes': ['error', 'single'],
},
},
{
// Legacy non-module scripts (OpenLayers, etc.)
// Legacy non-module scripts (OpenLayers, etc.)
files: [
'js/OpenStreetMap.js',
'js/popupmarker.js',
Expand All @@ -54,7 +56,5 @@ export default defineConfig([
OpenLayers: 'readonly',
},
},
rules: {
},
},
])
]);
14 changes: 7 additions & 7 deletions js/loadstatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ OpenLayers.Control.LoadStatus=OpenLayers.Class(OpenLayers.Control,{
for (const layer in this.map.layers) {
this.attachLayer (layer);
}
this.map.events.register ("addlayer", this, this.registerLayer);
this.map.events.register ('addlayer', this, this.registerLayer);
},

registerLayer: function (evt) {
Expand All @@ -42,15 +42,15 @@ OpenLayers.Control.LoadStatus=OpenLayers.Class(OpenLayers.Control,{

attachLayer: function (layer) {
if (!layer || layer==this || !layer.events || layer.noLoadStatus) { return; }
layer.events.register ("loadend", this, this.eventHandler);
layer.events.register ("loadstart", this, this.eventHandler);
layer.events.register ('loadend', this, this.eventHandler);
layer.events.register ('loadstart', this, this.eventHandler);
},

eventHandler: function (evt) {
if (evt && evt.type=="loadstart") {
if (evt && evt.type=='loadstart') {
this.loadStatus[evt.object.id] = evt.object.name || evt.object.id;
}
if (evt && evt.type=="loadend") {
if (evt && evt.type=='loadend') {
this.loadStatus[evt.object.id] = null;
}
const list = [];
Expand All @@ -59,10 +59,10 @@ OpenLayers.Control.LoadStatus=OpenLayers.Class(OpenLayers.Control,{
}
const text=this.options.html || this.defaultHtml;
this.div.innerHTML=OpenLayers.String.format(text, {layers: list.join(',<br/>')});
this.div.style.display = list.length>=1 ? "block" : "none";
this.div.style.display = list.length>=1 ? 'block' : 'none';
},

CLASS_NAME:"OpenLayers.Control.LoadStatus"
CLASS_NAME:'OpenLayers.Control.LoadStatus'
});

//--------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ function createMap() {
}

let crashed, oh, it;
if (["collection_times", "service_times"].includes(data._oh_key)) {
if (['collection_times', 'service_times'].includes(data._oh_key)) {
OHMode = 2;
}
try {
Expand Down Expand Up @@ -693,7 +693,7 @@ function initializeUI() {
const showFilterOptions = ['none', 'error', 'warnOnly', 'errorOnly', 'open', 'unknown', 'closed', 'openOrUnknown'];
for (let i = 0; i < showFilterOptions.length; i++) {
const filter_id = showFilterOptions[i];
filterHTML += `<label><input type="radio" name="filter"`
filterHTML += '<label><input type="radio" name="filter"'
+ ` value="${filter_id}"`
+ ` id="filter_form_${filter_id}"`
+ ` onclick="applyNewFilter(this)">${i18next.t(`texts.filter.${filter_id}`)}</input></label><br>`;
Expand Down
22 changes: 11 additions & 11 deletions js/popupmarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {

// Set CSS classes
if (marker.icon && marker.icon.imageDiv) {
marker.icon.imageDiv.className = "olPopupMarker";
marker.icon.imageDiv.className = 'olPopupMarker';
if (marker.icon.imageDiv.firstChild) {
marker.icon.imageDiv.firstChild.className = "olPopupMarker";
marker.icon.imageDiv.firstChild.className = 'olPopupMarker';
}
}

Expand All @@ -67,8 +67,8 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {

// Attach click handler
if (marker.icon && marker.icon.imageDiv) {
OpenLayers.Event.observe(marker.icon.imageDiv, "click", OpenLayers.Function.bindAsEventListener(this.markerClick, marker));
OpenLayers.Event.observe(marker.icon.imageDiv, "touchend", OpenLayers.Function.bindAsEventListener(this.markerClick, marker));
OpenLayers.Event.observe(marker.icon.imageDiv, 'click', OpenLayers.Function.bindAsEventListener(this.markerClick, marker));
OpenLayers.Event.observe(marker.icon.imageDiv, 'touchend', OpenLayers.Function.bindAsEventListener(this.markerClick, marker));
}
this.addMarker(marker);
return marker;
Expand Down Expand Up @@ -134,7 +134,7 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {
}

this.map.addPopup(this.currentPopup);
this.map.events.triggerEvent("popupopen");
this.map.events.triggerEvent('popupopen');
},

/**
Expand All @@ -146,7 +146,7 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {
this.currentPopup.destroy();
this.currentPopup = null;

this.map.events.triggerEvent("popupclose");
this.map.events.triggerEvent('popupclose');
return true;
},

Expand Down Expand Up @@ -177,8 +177,8 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {
* @returns {string} Escaped HTML
*/
html: function (text) {
if (text === null || text === undefined) return "";
return String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (text === null || text === undefined) return '';
return String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
},

/**
Expand All @@ -197,7 +197,7 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {
* @returns {string} HTML content
*/
createHtmlFromData: function (data) {
return `<div>Marker: ${this.html(data.id || "unknown")}</div>`;
return `<div>Marker: ${this.html(data.id || 'unknown')}</div>`;
},

/**
Expand All @@ -213,8 +213,8 @@ OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers, {
items.push(this.createHtmlFromData(list[i]));
}

return items.join("<hr/>\n");
return items.join('<hr/>\n');
},

CLASS_NAME: "OpenLayers.Layer.PopupMarker",
CLASS_NAME: 'OpenLayers.Layer.PopupMarker',
});
Loading