From cceae0c843945fa24baa1096e6d8c9fa0b1c7977 Mon Sep 17 00:00:00 2001 From: cheetah Date: Tue, 29 Nov 2022 00:43:22 +0100 Subject: [PATCH] added umlaut switch --- config.json | 12 ++++++------ html/index.html | 7 ++++++- index.js | 29 ++++++++++++++++++++--------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/config.json b/config.json index 851e79a..1908b9a 100644 --- a/config.json +++ b/config.json @@ -4,29 +4,29 @@ "params": { "type": "simple", "routing": { - "device": "birdyslim", + "device": "generic", "connectors": [ [ - "ecityruf", + "dummy", "1234567" ] ] } } }, - "menuSupport": false, + "germanUmlautSupport": true, "regions": [ { "name": "muc", "active": true, "dwdID": "mxx", - "_id": "eyJuYW1lIjoibXVjIiwiYWN0aXZlIjp0cnVlLCJkd2RJRCI6Im14eCIsIl9pZCI6ImV5SnVZVzFsSWpvaWJYVmpJaXdpWVdOMGFYWmxJanAwY25WbExDSmtkMlJKUkNJNkltMTRlQ0lzSWw5cFpDSTZJbVY1U25WWlZ6RnNTV3B2YVdKWVZtcEphWGRwV1ZkT01HRllXbXhKYW5Bd1kyNVdiRXhEU210a01sSktVa05KTmtsdE1YUmxRMGx6U1d3NWNGcERTVFpKYlZZMVUyNVdXbFo2Um5OVFYzQjJZVmRLV1ZadGNFcGhXR1J3VjFaa1QwMUhSbGxYYlhoS1lXNUJkMWt5TlZkaVJYaEVVMjEwYTAxc1NrdFZhMDVLVG10c2RFMVlVbXhSTUc4MVNXNHdQU0o5In0=" + "_id": "eyJuYW1lIjoibXVjIiwiYWN0aXZlIjp0cnVlLCJkd2RJRCI6Im14eCIsIl9pZCI6ImV5SnVZVzFsSWpvaWJYVmpJaXdpWVdOMGFYWmxJanAwY25WbExDSmtkMlJKUkNJNkltMTRlQ0lzSWw5cFpDSTZJbVY1U25WWlZ6RnNTV3B2YVdKWVZtcEphWGRwV1ZkT01HRllXbXhKYW5Bd1kyNVdiRXhEU210a01sSktVa05KTmtsdE1UUmxRMGx6U1d3NWNGc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mFsbGdhZXUiLCJhY3RpdmUiOnRydWUsImR3ZElEIjoib2F4IiwiX2lkIjoiZXlKdVlXMWxJam9pYjNOMFlXeHNaMkZsZFNJc0ltRmpkR2wyWlNJNmRISjFaU3dpWkhka1NVUWlPaUp2WVd3aWZRPT0ifQ==" + "_id": "eyJuYW1lIjoib2JlcmFsbGdhZXUiLCJhY3RpdmUiOnRydWUsImR3ZElEIjoib2F4IiwiX2lkIjoiZXlKdVlXMWxJam9pYjJKbGNtRnNiR2RoWlhVaUxDSmhZM1JwZG1VaU9uUnlkV1VzSW1SM1pFbEVJam9pYjJGNElpd2lYMmxrSWpvaVpYbEtkVmxYTVd4SmFtOXBZakpLYkdOdFJuTmlSMlJvV2xoVmFVeERTbWhaTTFKd1pHMVZhVTl1VW5sa1YxVnpTVzFTTTFwRmJFVkphbTlwWWpKR05FbHBkMmxZTW14clNXcHZhVnBZYkV0a1ZteFlUVmQ0U21GdE9YQlpha3BMWWtkT2RGSnVUbWxTTWxKdlYyeG9WbUZWZUVSVGJXaGFUVEZLZDFwSE1WWmhWVGwxVlc1c2ExWXhWbnBUVnpGVFRURndSbUpGVmtwaGJUbHdXV3BLUjA1RmJIQmtNbXhaVFcxNGNsTlhjSFpoVm5CWllrVjBhMVp0ZUZsVVZtUTBVMjFHZEU5WVFscGhhelZRVkZWYWMxZEhWa2xVYlVaT1lURndlbGRyV2s5VGJVMTNZa2hTVTJKWVFuSlZha296WlZaa2MxUnJjRTlpVmtwS1ZUSndSMWxXVlhwYVNFSllZVEpvY2xsVVJrOVdiRlpZWWtaQ2FGWllRWGxXTVZwclRUSkdXRmRzU2xGV1JFSndXbXhGT1ZCVFNqa2lmUT09In0=" } ] -} +} \ No newline at end of file diff --git a/html/index.html b/html/index.html index 573463f..f990bff 100644 --- a/html/index.html +++ b/html/index.html @@ -27,7 +27,12 @@ -

Regions:

+ + + + +

Regions:

+
mdi-plus Add diff --git a/index.js b/index.js index 605dff3..7b064ae 100644 --- a/index.js +++ b/index.js @@ -12,18 +12,29 @@ const stateMachine = {} socket.on('msgmgr:event', async (eventType, eventData) => { console.log(eventType, eventData) }) - -const umlautMap = { - '\u00dc': 'U', - '\u00c4': 'A', - '\u00d6': 'O', - '\u00fc': 'u', - '\u00e4': 'a', - '\u00f6': 'o', - '\u00df': 'ss', +const umlautMapGermany = { + '\u00dc': ']', + '\u00c4': '[', + '\u00d6': "\\", + '\u00fc': '}', + '\u00e4': '{', + '\u00f6': '|', + '\u00df': '~', +} +const umlautMapIntl = { + '\u00dc': 'U', + '\u00c4': 'A', + '\u00d6': 'O', + '\u00fc': 'u', + '\u00e4': 'a', + '\u00f6': 'o', + '\u00df': 'ss', } function replaceUmlaute(str) { + let umlautMap = config.germanUmlautSupport + ? umlautMapGermany + : umlautMapIntl return str .replace(/[\u00dc|\u00c4|\u00d6][a-z]/g, (a) => { const big = umlautMap[a.slice(0, 1)];