-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fdf89e
commit 970a0a5
Showing
1 changed file
with
9 additions
and
15 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,38 +1,32 @@ | ||
|
||
function notifications(){ | ||
|
||
chrome.notifications.create( | ||
{ | ||
title:'Prithvi: A greener future', | ||
message:'If you\'re planning to buy something, greener alternatives are just a click away!', | ||
title:'Prithvi: A Greener Future', | ||
message:'If you\'re planning to buy something, Greener alternatives are just a click away!', | ||
type:'basic', | ||
iconUrl:'icon.png' | ||
} | ||
) | ||
} | ||
|
||
|
||
var quer1; | ||
chrome.tabs.onUpdated.addListener(function (changeInfo, tab) { | ||
|
||
var quer1; | ||
chrome.tabs.onUpdated.addListener(function (tabID, changeInfo, tab) { | ||
if (changeInfo.status == 'complete') { | ||
|
||
let url = tab.url; | ||
var start = url.indexOf("q=")+2; | ||
var end = url.indexOf("&", start); | ||
quer1 = url.substring(start, end); | ||
console.log(quer1); | ||
|
||
var allKeys=["buy","price","cheap", "product", "shop", "sale","amazon","flipkart","myntra","purchase","ecological"]; | ||
|
||
var counter=0; | ||
for(i=0;i<allKeys.length;i++){ | ||
if(quer1.includes(allKeys[i])&&counter==0){ | ||
notifications(); | ||
|
||
if(quer1.includes(allKeys[i])&&counter==0){ | ||
|
||
notifications(); | ||
counter++; | ||
} | ||
counter++; | ||
} | ||
} | ||
}); | ||
} | ||
}); |