mirror of
https://github.com/FranP-code/wii-shop-extension.git
synced 2025-10-12 23:52:52 +00:00
Added Amazon Smile links to the site list, and added a listener for tab changes so the music properly stops if the shopping tab is changed or closed.
This commit is contained in:
@@ -31,6 +31,21 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Detect shopping tab becoming inactive/closed, if the domain matches a shopping site, play music
|
||||||
|
chrome.tabs.onActivated.addListener(function(activeInfo) {
|
||||||
|
chrome.tabs.get(activeInfo.tabId, function(tab) {
|
||||||
|
var url = new URL(tab.url)
|
||||||
|
var domain = url.hostname.toString().replace('www.','')
|
||||||
|
console.log(domain)
|
||||||
|
if (!siteList.includes(domain)) {
|
||||||
|
themeAudio.pause()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
themeAudio.play()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// Show notification on extension install
|
// Show notification on extension install
|
||||||
chrome.runtime.onInstalled.addListener(function() {
|
chrome.runtime.onInstalled.addListener(function() {
|
||||||
chrome.notifications.create({
|
chrome.notifications.create({
|
||||||
@@ -39,4 +54,4 @@ chrome.runtime.onInstalled.addListener(function() {
|
|||||||
'title': 'Wii Shop Music extension installed!',
|
'title': 'Wii Shop Music extension installed!',
|
||||||
'message': 'The Wii Shop theme will now play when you visit shopping websites.'
|
'message': 'The Wii Shop theme will now play when you visit shopping websites.'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,6 +13,21 @@ const siteList = [
|
|||||||
'amazon.nl',
|
'amazon.nl',
|
||||||
'amazon.es',
|
'amazon.es',
|
||||||
'amazon.co.uk',
|
'amazon.co.uk',
|
||||||
|
'smile.amazon.co.uk',
|
||||||
|
'smile.amazon.com',
|
||||||
|
'smile.amazon.com.au',
|
||||||
|
'smile.amazon.com.br',
|
||||||
|
'smile.amazon.ca',
|
||||||
|
'smile.amazon.cn',
|
||||||
|
'smile.amazon.fr',
|
||||||
|
'smile.amazon.de',
|
||||||
|
'smile.amazon.in',
|
||||||
|
'smile.amazon.it',
|
||||||
|
'smile.amazon.co.jp',
|
||||||
|
'smile.amazon.com.mx',
|
||||||
|
'smile.amazon.nl',
|
||||||
|
'smile.amazon.es',
|
||||||
|
'smile.amazon.co.uk',
|
||||||
'bestbuy.com',
|
'bestbuy.com',
|
||||||
'bhphotovideo.com',
|
'bhphotovideo.com',
|
||||||
'ebay.com',
|
'ebay.com',
|
||||||
@@ -42,4 +57,4 @@ const siteList = [
|
|||||||
'flipkart.com',
|
'flipkart.com',
|
||||||
'qvc.com',
|
'qvc.com',
|
||||||
'shopping.google.com'
|
'shopping.google.com'
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user