diff --git a/background.js b/background.js new file mode 100644 index 0000000..bd51518 --- /dev/null +++ b/background.js @@ -0,0 +1,19 @@ +// Mock DNR list +const DNRList = ['123-456-7890', '234-567-8901']; // Add any sample phone numbers here. + +// Listening for messages from content.js +chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.type === 'CHECK_DNR') { + const isOnDNR = DNRList.includes(message.phoneNumber); + + if (isOnDNR) { + // Here, you can take any action you'd like. For example: + chrome.notifications.create({ + type: 'basic', + iconUrl: 'icon48.png', + title: 'DNR Alert!', + message: `The guest with phone number ${message.phoneNumber} is on the DNR list!` + }); + } + } +}); diff --git a/content.js b/content.js index 4244a62..4e793a1 100644 --- a/content.js +++ b/content.js @@ -1,6 +1,6 @@ // Check if the current page is the Reservation Information page // (You might need more specific conditions depending on the page structure.) -if (document.title.includes('Reservation Information')) { +if (document.title.includes('Daisugi, the Japanese technique of growing trees out of other trees (2020) | Hacker News')) { // Find the element containing the guest's phone number. // This is a placeholder. You'll need to adjust this based on the actual structure of the webpage. diff --git a/icons/icon128.png b/icons/icon128.png new file mode 100755 index 0000000..eefe062 Binary files /dev/null and b/icons/icon128.png differ diff --git a/icons/icon16.png b/icons/icon16.png new file mode 100755 index 0000000..eefe062 Binary files /dev/null and b/icons/icon16.png differ diff --git a/icons/icon48.png b/icons/icon48.png new file mode 100755 index 0000000..eefe062 Binary files /dev/null and b/icons/icon48.png differ diff --git a/manifest.json b/manifest.json index 775079e..890d139 100644 --- a/manifest.json +++ b/manifest.json @@ -3,13 +3,13 @@ "name": "DNR Advantage", "version": "1.0", "description": "Chrome extension for checking guests against a Do Not Rent list.", - "permissions": ["notifications", "activeTab", "storage", "http://*/*", "https://*/*"], + "permissions": ["notifications", "activeTab", "storage"], "background": { "service_worker": "background.js" }, "content_scripts": [ { - "matches": [""], + "matches": ["https://news.ycombinator.com/*"], "js": ["content.js"] } ], diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..be339c9 --- /dev/null +++ b/popup.html @@ -0,0 +1,23 @@ + + + + DNR Advantage Popup + + + +

DNR Advantage

+

Guest Check:

+ + + +