Skip to content

Commit 715c941

Browse files
committed
add time to notifications
1 parent 690f94a commit 715c941

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

background.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
4141
if (addedIds.size > 0 && prevIds.size > 0) {
4242
console.info(`‼️ ${addedIds.size} new listings`, addedIds);
4343
const ids = [...addedIds];
44+
const now = new Date();
45+
const time = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}`;
4446
for (const id of ids) {
4547
showNotification(
4648
id,
47-
`Neue Anzeige (${id})`,
49+
`[${time}] Neue Anzeige ${id}`,
4850
titleById[id] ?? '(keine Beschreibung)',
4951
);
5052
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Immo24 Notifier",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"manifest_version": 3,
55
"description": "Immo24 Notifier extension by Maximilian Hoffmann",
66
"homepage_url": "https://github.com/maxhoffmann/immo-extension",

popup.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,46 @@ document.addEventListener("DOMContentLoaded", () => {
1717
}
1818

1919
document.querySelector("#test-example").addEventListener("click", async () => {
20+
const now = new Date();
21+
const time = `${new Date().getHours().toString().padStart(2, "0")}:${new Date().getMinutes().toString().padStart(2, "0")}`;
2022
await chrome.notifications.create({
2123
type: "basic",
2224
iconUrl: "icon-48.png",
23-
title: "x neue Anzeigen!",
25+
title: `[${time}] Test-Anzeige XXXXXXXXX`,
2426
message: "auf ImmoScout24",
2527
requireInteraction: true,
2628
});
2729
});
2830
document.querySelector("#test-one").addEventListener("click", async () => {
2931
const firstExposeId = firstExpose.value;
32+
const now = new Date();
33+
const time = `${new Date().getHours().toString().padStart(2, "0")}:${new Date().getMinutes().toString().padStart(2, "0")}`;
3034

3135
await chrome.notifications.create("immo24:" + firstExposeId, {
3236
type: "basic",
3337
iconUrl: "icon-48.png",
34-
title: "Test-Anzeige: "+firstExposeId,
38+
title: `[${time}] Test-Anzeige ${firstExposeId}`,
3539
message: "auf ImmoScout24",
3640
requireInteraction: true,
3741
});
3842
});
3943
document.querySelector("#test-multiple").addEventListener("click", async () => {
4044
const firstExposeId = firstExpose.value;
4145
const secondExposeId = secondExpose.value;
46+
const now = new Date();
47+
const time = `${new Date().getHours().toString().padStart(2, "0")}:${new Date().getMinutes().toString().padStart(2, "0")}`;
4248

4349
chrome.notifications.create("immo24:" + firstExposeId, {
4450
type: "basic",
4551
iconUrl: "icon-48.png",
46-
title: "Test-Anzeige: "+firstExposeId,
52+
title: `[${time}] Test-Anzeige ${firstExposeId}`,
4753
message: "auf ImmoScout24",
4854
requireInteraction: true,
4955
});
5056
chrome.notifications.create("immo24:" + secondExposeId, {
5157
type: "basic",
5258
iconUrl: "icon-48.png",
53-
title: "Test-Anzeige: "+secondExposeId,
59+
title: `[${time}] Test-Anzeige ${secondExposeId}`,
5460
message: "auf ImmoScout24",
5561
requireInteraction: true,
5662
});

0 commit comments

Comments
 (0)