made the qrcode generator a function

its now called when the ip is changed too, so you don't need to refresh
This commit is contained in:
Kristy Fournier 2025-03-06 11:24:06 -05:00
parent 7505bc28d3
commit 49d50462ab
3 changed files with 22 additions and 17 deletions

View file

@ -86,6 +86,7 @@ changes visibility with JS-->
<p class="italic">Hit settings icon to refresh the code</p> <p class="italic">Hit settings icon to refresh the code</p>
<div id="qrcode" alt="QR code to the remote URL"></div> <div id="qrcode" alt="QR code to the remote URL"></div>
</div> </div>
<p class="versionNumber">Version 1.0.0</p>
</div> </div>
</div> </div>
<!--All the buttons are down here but settings is just doing its own thing--> <!--All the buttons are down here but settings is just doing its own thing-->

View file

@ -164,17 +164,11 @@ function ipSetter(){
alertText("Your IP is now set to "+ipBox+" at port 19054 (Default)") alertText("Your IP is now set to "+ipBox+" at port 19054 (Default)")
} }
} }
qrCodeGenerate()
} }
async function checkSettings(skipServer=false) { function qrCodeGenerate() {
//check client stuff first so if the server doesn't exist it can still be changed and seen
if (ip.slice(-5)=="19054") {
// don't show the port if it is the default
document.getElementById("iptextbox").value = ip.slice(0,-6)
} else {
document.getElementById("iptextbox").value = ip;
}
let tempURL = "http://" + document.location.href.split("/")[2] + "/?ip=" + ip; let tempURL = "http://" + document.location.href.split("/")[2] + "/?ip=" + ip;
document.getElementById("qrcode").innerHTML = "" document.getElementById("qrcode").innerHTML = ""
new QRCode(document.getElementById("qrcode"), { new QRCode(document.getElementById("qrcode"), {
@ -185,6 +179,17 @@ async function checkSettings(skipServer=false) {
colorLight : "#eeeeee", colorLight : "#eeeeee",
correctLevel : QRCode.CorrectLevel.H correctLevel : QRCode.CorrectLevel.H
}); });
}
async function checkSettings(skipServer=false) {
//check client stuff first so if the server doesn't exist it can still be changed and seen
if (ip.slice(-5)=="19054") {
// don't show the port if it is the default
document.getElementById("iptextbox").value = ip.slice(0,-6)
} else {
document.getElementById("iptextbox").value = ip;
}
qrCodeGenerate()
document.getElementById("alerttimetextbox").value = alertTime document.getElementById("alerttimetextbox").value = alertTime
partyButtonState = document.getElementById("partymode-button").innerHTML; partyButtonState = document.getElementById("partymode-button").innerHTML;
x = await getFromServer({setting: "getsettings"}, "settings"); x = await getFromServer({setting: "getsettings"}, "settings");
@ -361,12 +366,4 @@ if (alertTime == "") {
document.cookie = "alertTime="+alertTime+"; path=/;" document.cookie = "alertTime="+alertTime+"; path=/;"
} }
// this is the code that makes the qr code at the very start // this is the code that makes the qr code at the very start
let tempURL = "http://" + document.location.href.split("/")[2] + "/?ip=" + ip; qrCodeGenerate()
new QRCode(document.getElementById("qrcode"), {
text: tempURL,
width: 256,
height: 256,
colorDark : "#000000",
colorLight : "#eeeeee",
correctLevel : QRCode.CorrectLevel.H
});

View file

@ -172,6 +172,13 @@ h4 {
border-bottom: 0; border-bottom: 0;
} }
.versionNumber {
font-size: 8px;
font-style: italic;
text-align: left;
width: 80%;
}
#volumerange { #volumerange {
background-color: #4477AA; background-color: #4477AA;
color: #4477ff; color: #4477ff;