Skip to content

Commit

Permalink
Add Chrome Extension
Browse files Browse the repository at this point in the history
Former-commit-id: 1245392
Former-commit-id: 9966b8e
  • Loading branch information
rizwansoaib committed Jan 22, 2020
1 parent 8701f9e commit 4d5ec88
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 0 deletions.
Binary file added Chrome extension/WhatsApp Monitor/beep.mp3
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions Chrome extension/WhatsApp Monitor/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"manifest_version": 2,
"name": "WhatsApp-Monitor",
"description": "WhatsApp-Monitor",
"version": "1.0",
"author": "Rizwan Ahmad",


"icons": {

"64": "images/icons/64.png",
"128": "images/icons/128.png"
},

"web_accessible_resources": [
"beep.mp3"
],

"content_scripts": [
{
"matches": ["https://web.whatsapp.com/*"],
"js": ["start.js" ]
}
],

"permissions": [
"storage","tabs","https://web.whatsapp.com/*"
],

"browser_action": {
"default_popup": "popup.html"

}


}
53 changes: 53 additions & 0 deletions Chrome extension/WhatsApp Monitor/online.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
var online = document.getElementsByClassName("_315-i");
var user = document.getElementsByClassName("_19RFN");
n=document.querySelector("#main > header > div._3V5x5 > div > div > span")
function trackuser() {

var flag=1;



setTimeout(function(){



try {
if (online[0].innerText == "online" || online[0].innerText == "typing..." ) {
n.innerText=user[0].innerText+"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0🅦🅗🅐🅣🅢🅐🅟🅟 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0🅜🅞🅝🅘🅣🅞🅡";
n.style.color="green";
online[0].style.color="green";

console.log(user[0].innerText + " is Online");
let url = chrome.runtime.getURL('beep.mp3')
let a = new Audio(url)
a.play()
flag=0;


} else {
console.log(online[0].innerText);
n.innerText=user[0].innerText+" [Offine]"+"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0🅦🅗🅐🅣🅢🅐🅟🅟\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0🅜🅞🅝🅘🅣🅞🅡";
n.style.color="red";

flag=1;
}
}
catch(error) {
console.error("User offline");
n.innerText=user[0].innerText+" [Offine]"+"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0🅦🅗🅐🅣🅢🅐🅟🅟\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0🅜🅞🅝🅘🅣🅞🅡";
n.style.color="red";
flag=1
}

var flag=""
chrome.storage.local.get('flag', function (result) {
flag = result.flag;
if(flag==1){trackuser();}

});


}, 3000);

}
trackuser()
35 changes: 35 additions & 0 deletions Chrome extension/WhatsApp Monitor/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Whatsapp Monitor</title>




</head>
<body style="width: 900px height:800px">


<h1>

<center><button id="start"; style="border-radius:40px;height:80px;width:150px;background-color:green;">Start</button></center>
<script type="text/javascript" src="popup.js"></script>

<center>


<h3>Open Contact Chat Window on WhatsApp Web</h3><br>




<a href="https://github.com/rizwansoaib/whatsapp-monitor" target="_blank">About WhatsApp Monitor</a>


</center>


</h1>

</body>
</html>
44 changes: 44 additions & 0 deletions Chrome extension/WhatsApp Monitor/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

function start() {

b.innerText='Stop';

b.style.backgroundColor="red";

chrome.storage.local.set({
'flag': 1

});

chrome.tabs.executeScript({
file: 'online.js'
});

}


function stop() {

chrome.storage.local.set({
'flag': 0

});



}

function get()
{
b=document.getElementById('start')
if(b.innerText=='Start'){start();}
else{stop();b.innerText='Start';b.style.backgroundColor="green";}

}

document.getElementById('start').addEventListener('click', get);





1 change: 1 addition & 0 deletions Chrome extension/WhatsApp Monitor/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert("You have WhatsApp Monitor Extension installed\nOpen Contacts Chat Window click extension then Start");

0 comments on commit 4d5ec88

Please sign in to comment.