1
0
mirror of https://gitlab.com/ceda_ei/google-meet-captions-regex synced 2025-07-09 18:26:52 +02:00

Compare commits

..

1 Commits
master ... v1.2

Author SHA1 Message Date
bc15bc411c Add build.sh. Version bump. 2020-09-15 18:32:12 +05:30
4 changed files with 7 additions and 26 deletions

View File

@ -1,13 +0,0 @@
function handleMatch(match) {
new Notification("Match found", {body: match});
const audio = new Audio(browser.runtime.getURL("static/notif.mp3"));
audio.play();
}
function handleMessage(request) {
if (request.type == "match")
return handleMatch(request.match);
}
browser.runtime.onMessage.addListener(handleMessage);

View File

@ -5,7 +5,6 @@ yarn install
yarn build yarn build
cd .. cd ..
[[ -d web-ext-artifacts ]] || mkdir web-ext-artifacts
FILENAME="$(basename "$PWD")-$(jq -r .version manifest.json).zip" FILENAME="$(basename "$PWD")-$(jq -r .version manifest.json).zip"
zip -r "web-ext-artifacts/$FILENAME" LICENSE gmcr.js manifest.json background.js popup/build/ icons/ zip -r "web-ext-artifacts/$FILENAME" LICENSE gmcr.js manifest.json popup/build/ icons/
zip -r "web-ext-artifacts/source-$FILENAME" $(git ls-files) zip -r "web-ext-artifacts/source-$FILENAME" $(git ls-files)

View File

@ -13,6 +13,7 @@ function surroundText(haystack, wordList, padding) {
surroundingText += "..."; surroundingText += "...";
surroundingText += "<br>"; surroundingText += "<br>";
console.log(start, end, surroundingText);
}); });
return surroundingText.trim(); return surroundingText.trim();
} }
@ -51,15 +52,15 @@ function captionUpdate() {
} else { } else {
[ matched, surroundingText ] = simpleMatch(captions, storage.words); [ matched, surroundingText ] = simpleMatch(captions, storage.words);
} }
console.log(matched, surroundingText);
/* The lastNotification prevents repetitive notifications because /* The lastNotification prevents repetitive notifications because
* of constant updates. * of constant updates.
*/ */
if (matched && surroundingText !== lastNotification) { if (matched && surroundingText !== lastNotification) {
browser.runtime.sendMessage({ new Notification("Match found", {body: surroundingText});
type: "match",
match: surroundingText
});
lastNotification = surroundingText; lastNotification = surroundingText;
const audio = new Audio(browser.runtime.getURL("static/notif.mp3"));
audio.play();
} }
}) })
} }

View File

@ -1,13 +1,12 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Google Meet Caption Regex", "name": "Google Meet Caption Regex",
"version": "1.4", "version": "1.2",
"description": "Send a notification when a caption in Google Meet matches a certain regex.", "description": "Send a notification when a caption in Google Meet matches a certain regex.",
"homepage_url": "https://gitlab.com/ceda_ei/google-meet-captions-regex", "homepage_url": "https://gitlab.com/ceda_ei/google-meet-captions-regex",
"permissions": [ "permissions": [
"background",
"notifications", "notifications",
"storage" "storage"
], ],
@ -23,16 +22,11 @@
"default_popup": "popup/build/index.html" "default_popup": "popup/build/index.html"
}, },
"background": {
"scripts": ["background.js"]
},
"content_scripts": [ "content_scripts": [
{ {
"matches": ["https://meet.google.com/*"], "matches": ["https://meet.google.com/*"],
"js": ["gmcr.js"] "js": ["gmcr.js"]
} }
], ],
"web_accessible_resources": ["static/*"] "web_accessible_resources": ["static/*"]
} }