mirror of
https://github.com/taigrr/searchBGon
synced 2025-01-18 05:03:12 -08:00
17 lines
489 B
JavaScript
17 lines
489 B
JavaScript
function announce_close(){
|
|
console.log("closing all search tabs")
|
|
chrome.tabs.query({}, function(tabs) {
|
|
var closeable=[];
|
|
for (var i=0; i<tabs.length; ++i) {
|
|
console.log(tabs[i]);
|
|
if(tabs[i].url.includes("google.com/search?")) {
|
|
closeable.push(tabs[i].id)
|
|
} else if(tabs[i].url.includes("duckduckgo.com/?q=")){
|
|
closeable.push(tabs[i].id)
|
|
}
|
|
}
|
|
chrome.tabs.remove(closeable);
|
|
});
|
|
}
|
|
chrome.browserAction.onClicked.addListener(function(tab){announce_close()});
|