-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
188 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,44 @@ | ||
// background.js | ||
// background.js | ||
chrome.runtime.onInstalled.addListener(() => { | ||
|
||
chrome.runtime.onInstalled.addListener(() => { | ||
console.log("Extension installed and background script running."); | ||
const manifest = chrome.runtime.getManifest(); | ||
const serverUrl = manifest.SERVER_URL; // Access your custom field | ||
console.log('Server URL:', serverUrl); // Outputs: https://example.com/api | ||
chrome.tabs.create({ url: 'https://github.com/rizwansoaib/whatsapp-monitor/tree/master' }); | ||
|
||
// Store the value using chrome.storage API if needed | ||
chrome.storage.local.set({ serverUrl }); | ||
chrome.notifications.create('notificationId', { | ||
type: 'basic', | ||
iconUrl: 'images/icons/128.png', | ||
title: 'TrackWapp Notification', | ||
message: 'Notification are Enabled and Working', | ||
priority: 2 | ||
}); | ||
}); | ||
|
||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { | ||
if (message.action === "open_popup") { | ||
chrome.action.setPopup({popup: "popup.html"}, () => { | ||
chrome.action.openPopup(); | ||
}); | ||
} | ||
}); | ||
/* | ||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | ||
if (changeInfo.status === 'complete' && tab.url.includes("*://web.whatsapp.com/*")) { | ||
chrome.scripting.executeScript( | ||
{ | ||
target: {tabId: tab.id}, | ||
files: ['websocket.js'], | ||
// function: () => {}, // files or function, both do not work. | ||
}); | ||
} | ||
}); | ||
|
||
// Load the server URL if present | ||
chrome.storage.local.get(['serverUrl'], (result) => { | ||
if (result.serverUrl) { | ||
document.getElementById('serverUrl').value = result.serverUrl; | ||
} | ||
}); | ||
chrome.power.requestKeepAwake('system'); | ||
chrome.power.requestKeepAwake('display'); | ||
|
||
|
||
chrome.runtime.setUninstallURL('https://htmlpreview.github.io/?https://github.com/rizwansoaib/whatsapp-monitor/blob/master/Chrome-Extension/uninstall.html'); | ||
|
||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { | ||
if (message.action === "open_popup") { | ||
chrome.action.setPopup({popup: "popup.html"}, () => { | ||
chrome.action.openPopup(); | ||
}); | ||
} else if (message.action === 'showNotification') { | ||
|
||
|
||
chrome.notifications.create('notificationId', { | ||
type: 'basic', | ||
iconUrl: 'images/icons/128.png', | ||
title: 'TrackWapp Notification', | ||
message: `📱${message.user} is Online in WhatsApp`, | ||
priority: 2 | ||
}); | ||
|
||
// Automatically delete the notification after 30 seconds | ||
setTimeout(() => { | ||
chrome.notifications.clear('notificationId'); | ||
}, 10000); | ||
|
||
*/ | ||
} | ||
}); |
Binary file modified
BIN
-7.57 KB
(15%)
Chrome-Extension/WhatsApp Monitor/images/icons/csv_download.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.