|
1 | 1 | document.addEventListener("DOMContentLoaded", () => { |
2 | | - document.querySelector("button").addEventListener("click", () => { |
3 | | - chrome.notifications.create({ |
| 2 | + const firstExpose = document.querySelector('#expose1'); |
| 3 | + const secondExpose = document.querySelector('#expose2'); |
| 4 | + |
| 5 | + firstExpose.addEventListener("input", (event) => { |
| 6 | + localStorage.setItem('expose1', event.target.value); |
| 7 | + }); |
| 8 | + secondExpose.addEventListener("input", (event) => { |
| 9 | + localStorage.setItem('expose2', event.target.value); |
| 10 | + }); |
| 11 | + |
| 12 | + if (localStorage.getItem('expose1')) { |
| 13 | + firstExpose.value = localStorage.getItem('expose1'); |
| 14 | + } |
| 15 | + if (localStorage.getItem('expose2')) { |
| 16 | + secondExpose.value = localStorage.getItem('expose2'); |
| 17 | + } |
| 18 | + |
| 19 | + document.querySelector("#test-example").addEventListener("click", async () => { |
| 20 | + await chrome.notifications.create({ |
4 | 21 | type: "basic", |
| 22 | + iconUrl: "icon-48.png", |
5 | 23 | title: "x neue Anzeigen!", |
6 | 24 | message: "auf ImmoScout24", |
| 25 | + requireInteraction: true, |
| 26 | + }); |
| 27 | + }); |
| 28 | + document.querySelector("#test-one").addEventListener("click", async () => { |
| 29 | + const firstExposeId = firstExpose.value; |
| 30 | + |
| 31 | + await chrome.notifications.create("immo24:" + firstExposeId, { |
| 32 | + type: "basic", |
7 | 33 | iconUrl: "icon-48.png", |
| 34 | + title: "Test-Anzeige: "+firstExposeId, |
| 35 | + message: "auf ImmoScout24", |
| 36 | + requireInteraction: true, |
| 37 | + }); |
| 38 | + }); |
| 39 | + document.querySelector("#test-multiple").addEventListener("click", async () => { |
| 40 | + const firstExposeId = firstExpose.value; |
| 41 | + const secondExposeId = secondExpose.value; |
| 42 | + |
| 43 | + chrome.notifications.create("immo24:" + firstExposeId, { |
| 44 | + type: "basic", |
| 45 | + iconUrl: "icon-48.png", |
| 46 | + title: "Test-Anzeige: "+firstExposeId, |
| 47 | + message: "auf ImmoScout24", |
| 48 | + requireInteraction: true, |
| 49 | + }); |
| 50 | + chrome.notifications.create("immo24:" + secondExposeId, { |
| 51 | + type: "basic", |
| 52 | + iconUrl: "icon-48.png", |
| 53 | + title: "Test-Anzeige: "+secondExposeId, |
| 54 | + message: "auf ImmoScout24", |
8 | 55 | requireInteraction: true, |
9 | 56 | }); |
10 | 57 | }); |
|
0 commit comments