1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed scrobbler

This commit is contained in:
krateng 2023-03-28 00:06:59 +02:00
parent b4c8a0d68b
commit 11a5cb7401
3 changed files with 17 additions and 5 deletions

View File

@ -83,6 +83,13 @@ function onTabUpdated(tabId, changeInfo, tab) {
//console.log("Still on same page!") //console.log("Still on same page!")
tabManagers[tabId].update(); tabManagers[tabId].update();
// check if the setting for this page is still active
chrome.storage.local.get(["service_active_" + page],function(result){
if (!result["service_active_" + page]) {
delete tabManagers[tabId];
}
});
return return
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "Maloja Scrobbler", "name": "Maloja Scrobbler",
"version": "1.12", "version": "1.13",
"description": "Scrobbles tracks from various sites to your Maloja server", "description": "Scrobbles tracks from various sites to your Maloja server",
"manifest_version": 2, "manifest_version": 2,
"permissions": [ "permissions": [

View File

@ -46,17 +46,22 @@ document.addEventListener("DOMContentLoaded",function() {
document.getElementById("serverurl").addEventListener("focusout",checkServer); document.getElementById("serverurl").addEventListener("focusout",checkServer);
document.getElementById("apikey").addEventListener("focusout",checkServer); document.getElementById("apikey").addEventListener("focusout",checkServer);
document.getElementById("serverurl").addEventListener("input",saveConfig); document.getElementById("serverurl").addEventListener("input",saveServer);
document.getElementById("apikey").addEventListener("input",saveConfig); document.getElementById("apikey").addEventListener("input",saveServer);
chrome.runtime.onMessage.addListener(onInternalMessage); chrome.runtime.onMessage.addListener(onInternalMessage);
chrome.storage.local.get(config_defaults,function(result){ chrome.storage.local.get(config_defaults,function(result){
console.log(result);
for (var key in result) { for (var key in result) {
// booleans
if (result[key] == true || result[key] == false) { if (result[key] == true || result[key] == false) {
document.getElementById(key).checked = result[key]; document.getElementById(key).checked = result[key];
} }
// text
else{ else{
document.getElementById(key).value = result[key]; document.getElementById(key).value = result[key];
} }
@ -95,8 +100,8 @@ function onInternalMessage(request,sender) {
function saveConfig() { function saveServer() {
for (var key in config_defaults) { for (var key of ["serverurl","apikey"]) {
var value = document.getElementById(key).value; var value = document.getElementById(key).value;
chrome.storage.local.set({ [key]: value }); chrome.storage.local.set({ [key]: value });
} }