Commit bf451921 authored by Craig Earley's avatar Craig Earley
Browse files

extension now enthusiastically alerts you when you visit the google dot com

parent a8da1f14
var debug = 0;
var stop_url = "https://www.google.com/"
chrome.tabs.onUpdated.addListener(function (tabID, changeInfo, tab) {
var url;
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {
url = tabs[0].url;
if (debug){ console.log(url);}
if (changeInfo.status=='complete'){
chrome.tabs.sendMessage(tab.id, { action: 'saySomething' });
}
});
if (url==stop_url){
chrome.tabs.sendMessage(tab.id, { action: 'saySomething' });
if (debug) {console.log("background something");}} }
});});
chrome.runtime.onMessage.addListener(function (msg) {
/* We received a message, let's do as instructed */
if (msg.action == 'saySomething') {
window.alert('something');
window.alert('Google!');
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment