Skip to content

Commit

Permalink
more tts chat bot saving menu fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
steveseguin committed Feb 16, 2025
1 parent a8a5c40 commit 0d06c98
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Social Stream Ninja",
"description": "Powerful tooling to engage live chat on Youtube, Twitch, Zoom, and more.",
"manifest_version": 3,
"version": "3.12.7",
"version": "3.12.8",
"homepage_url": "http://socialstream.ninja/",
"icons": {
"128": "icons/icon-128.png"
Expand Down
49 changes: 46 additions & 3 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,8 @@ function update(response, sync=true){
updateSettings(ele, sync, parseFloat(document.querySelector("input[data-numbersetting10='"+key+"']").value));
} else if ("optionparam10" in response.settings[key]){
updateSettings(ele, sync, response.settings[key].optionparam10);
} else if ("textparam10" in response.settings[key]){
updateSettings(ele, sync, response.settings[key].textparam10);
} else if (document.querySelector("input[data-optionparam10='"+key+"']")){
updateSettings(ele, sync, document.querySelector("input[data-optionparam10='"+key+"']").value);
} else {
Expand All @@ -1805,7 +1807,7 @@ function update(response, sync=true){
if (ele2){
ele2.value = parseFloat(keys[1]);
} else {
var ele2 = document.querySelector("input[data-numbersetting10='"+keys[0]+"']");
var ele2 = document.querySelector("input[data-numbersetting10='"+keys[0]+"'], input[data-textparam10='"+keys[0]+"']");
if (ele2){
ele2.value = keys[1];
}
Expand Down Expand Up @@ -2109,10 +2111,18 @@ function update(response, sync=true){
}
}
if ("textparam10" in response.settings[key]){
var ele = document.querySelector("input[data-textparam10='"+key+"']");
var ele = document.querySelector("input[data-textparam10='"+key+"'],textarea[data-textparam10='"+key+"']");
//console.log(ele);
if (ele){
ele.value = response.settings[key].textparam10;
updateSettings(ele, sync);

var ele = document.querySelector("input[data-param10='"+key+"']");
if (ele){
if (ele.checked){
updateSettings(ele, false, parseFloat(response.settings[key].textparam10));
}
}
}
}
if ("textparam11" in response.settings[key]){
Expand Down Expand Up @@ -2627,6 +2637,20 @@ function updateSettings(ele, sync=true, value=null){
if (sync){
chrome.runtime.sendMessage({cmd: "saveSetting", type: "textparam1", target:target, setting: ele.dataset.textparam1, "value": ele.value}, function (response) {});
}
} else if (ele.dataset.textparam10){

document.getElementById("chatbot").raw = removeQueryParamWithValue(document.getElementById("chatbot").raw, ele.dataset.textparam10);

if (ele.value && ele.dataset.textparam10 == "cssb64"){
document.getElementById("chatbot").raw = updateURL(ele.dataset.textparam10+"="+btoa(encodeURIComponent(ele.value)), document.getElementById("chatbot").raw);
} else if (ele.value){
document.getElementById("chatbot").raw = updateURL(ele.dataset.textparam10+"="+encodeURIComponent(ele.value), document.getElementById("chatbot").raw);
}
document.getElementById("chatbot").raw = document.getElementById("chatbot").raw.replace("&&", "&");
document.getElementById("chatbot").raw = document.getElementById("chatbot").raw.replace("?&", "?");
if (sync){
chrome.runtime.sendMessage({cmd: "saveSetting", type: "textparam10", target:target, setting: ele.dataset.textparam10, "value": ele.value}, function (response) {});
}
} else if (ele.dataset.textparam2){
document.getElementById("overlay").raw = removeQueryParamWithValue(document.getElementById("overlay").raw, ele.dataset.textparam2);

Expand Down Expand Up @@ -2998,10 +3022,29 @@ function updateSettings(ele, sync=true, value=null){

} else if (ele.dataset.param10){
if (ele.checked){
document.getElementById("chatbot").raw = updateURL(ele.dataset.param10, document.getElementById("chatbot").raw);
if (value!==null){

document.getElementById("chatbot").raw = updateURL(ele.dataset.param10, document.getElementById("chatbot").raw);

} else if (document.querySelector("input[data-numbersetting='"+ele.dataset.param10+"']")){

value = document.querySelector("input[data-numbersetting='"+ele.dataset.param10+"']").value;
document.getElementById("chatbot").raw = removeQueryParamWithValue(document.getElementById("chatbot").raw, ele.dataset.param10);
document.getElementById("chatbot").raw = updateURL(ele.dataset.param10+"="+value, document.getElementById("chatbot").raw);

} else if (document.querySelector("[data-optionparam10='"+ele.dataset.param10+"'], [data-textparam10='"+ele.dataset.param10+"']")){

value = document.querySelector("[data-optionparam10='"+ele.dataset.param10+"'], [data-textparam10='"+ele.dataset.param10+"']").value;
document.getElementById("chatbot").raw = removeQueryParamWithValue(document.getElementById("chatbot").raw, ele.dataset.param10);
document.getElementById("chatbot").raw = updateURL(ele.dataset.param10+"="+value, document.getElementById("chatbot").raw);

} else {
document.getElementById("chatbot").raw = updateURL(ele.dataset.param10, document.getElementById("chatbot").raw);
}
} else {
document.getElementById("chatbot").raw = removeQueryParamWithValue(document.getElementById("chatbot").raw, ele.dataset.param10);
}

document.getElementById("chatbot").raw = document.getElementById("chatbot").raw.replace("&&", "&");
document.getElementById("chatbot").raw = document.getElementById("chatbot").raw.replace("?&", "?");
if (sync){
Expand Down

0 comments on commit 0d06c98

Please sign in to comment.