From 10b057dd86897704c51a328239780bc5fed0f273 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Fri, 3 Dec 2021 04:35:58 +0530 Subject: fix: fix javascript error in 'circuit' recipe --- all.json | 2 +- recipes/circuit/index.js | 5 +---- recipes/circuit/package.json | 2 +- recipes/circuit/webview.js | 17 +++-------------- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/all.json b/all.json index 368efc1..c137a30 100644 --- a/all.json +++ b/all.json @@ -207,7 +207,7 @@ "featured": false, "id": "circuit", "name": "Circuit", - "version": "1.0.1", + "version": "1.0.2", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/circuit/icon.svg" } diff --git a/recipes/circuit/index.js b/recipes/circuit/index.js index e467459..fbbcd9a 100644 --- a/recipes/circuit/index.js +++ b/recipes/circuit/index.js @@ -1,5 +1,2 @@ -"use strict"; - // just pass through Ferdi - -module.exports = Ferdi => Ferdi; \ No newline at end of file +module.exports = Ferdi => Ferdi; diff --git a/recipes/circuit/package.json b/recipes/circuit/package.json index 1beaa12..82eb193 100644 --- a/recipes/circuit/package.json +++ b/recipes/circuit/package.json @@ -1,7 +1,7 @@ { "id": "circuit", "name": "Circuit", - "version": "1.0.1", + "version": "1.0.2", "license": "MIT", "config": { "serviceURL": "https://eu.yourcircuit.com/" diff --git a/recipes/circuit/webview.js b/recipes/circuit/webview.js index b5e3fd5..8cd2e2f 100644 --- a/recipes/circuit/webview.js +++ b/recipes/circuit/webview.js @@ -1,23 +1,12 @@ -"use strict"; - module.exports = Ferdi => { const getMessages = function getMessages() { - // Initialize empty vars - var match = []; // Get value of tag where in case of new messages the number of messages appear const titleValue = document.querySelector('title').text; - // Extract the number from the tag - match = titleValue.match(/\d+/); - unread = match != null && match.length > 0 ? match[0] : 0; - // Set unread msgs badge + const match = titleValue.match(/\d+/); + const unread = match != null && match.length > 0 ? match[0] : 0; Ferdi.setBadge(Ferdi.safeParseInt(unread)); }; - const loopFunc = () => { - getMessages(); - }; - - Ferdi.loop(loopFunc); - + Ferdi.loop(getMessages); }; -- cgit v1.2.3-54-g00ecf