Added settings for PM-related audio pings.

This commit is contained in:
rainbow napkin 2025-10-06 19:06:47 -04:00
parent 53fc46adc3
commit 976e157cf1
4 changed files with 83 additions and 3 deletions

3
.gitignore vendored
View file

@ -11,5 +11,4 @@ state.json
chatexamples.txt
server.cert
server.key
www/nonfree/*
www/nonfree/README.md
www/nonfree/*

View file

@ -45,5 +45,26 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
<p>Aspect-Ratio Lock Chat Width Minimum: </p>
<input type="number">
</span>
<h4>Notification Settings</h4>
<span id="settings-panel-ping-on-pm-rx" class="settings-panel-setting">
<p>Play Sound for received PMs: </p>
<select>
<option value="all">All</option>
<option value="unread">Unread Only</option>
<option value="never">Never</option>
</select>
</span>
<span id="settings-panel-ping-on-pm-tx" class="settings-panel-setting">
<p>Play sound for sent PMs: </p>
<input type="checkbox">
</span>
<span id="settings-panel-ping-on-new-sesh" class="settings-panel-setting">
<p>Play sound on new PM sesh: </p>
<input type="checkbox">
</span>
<span id="settings-panel-ping-on-end-sesh" class="settings-panel-setting">
<p>Play sound on PM sesh end: </p>
<input type="checkbox">
</span>
</div>
</div>

View file

@ -313,7 +313,11 @@ class channel{
["syncDelta", 6],
["chatWidthMin", 20],
["userlistHidden", false],
["cinemaMode", false]
["cinemaMode", false],
["rxPMSound", 'unread'],
["txPMSound", false],
["newSeshSound", true],
["endSeshSound", true]
]);
}

View file

@ -62,6 +62,26 @@ class settingsPanel extends panelObj{
*/
this.chatWidthMinimum = this.panelDocument.querySelector("#settings-panel-min-chat-width input");
/**
* Audible Ping on PM Recieved
*/
this.rxPMSound = this.panelDocument.querySelector("#settings-panel-ping-on-pm-rx select");
/**
* Audible Ping on PM Transmit
*/
this.txPMSound = this.panelDocument.querySelector("#settings-panel-ping-on-pm-tx input");
/**
* Audible Ping on new PM sesh
*/
this.newSeshSound = this.panelDocument.querySelector("#settings-panel-ping-on-new-sesh input");
/**
* Audible Ping on old PM sesh
*/
this.endSeshSound = this.panelDocument.querySelector("#settings-panel-ping-on-end-sesh input");
this.renderSettings();
this.setupInput();
@ -79,6 +99,10 @@ class settingsPanel extends panelObj{
this.liveSyncTolerance.addEventListener('change', this.updateLiveSyncTolerance.bind(this));
this.syncDelta.addEventListener('change', this.updateSyncDelta.bind(this));
this.chatWidthMinimum.addEventListener('change', this.updateChatWidthMinimum.bind(this));
this.rxPMSound.addEventListener('change', this.updateRXPMSound.bind(this));
this.txPMSound.addEventListener('change', this.updateTXPMSound.bind(this));
this.newSeshSound.addEventListener('change', this.updateNewPMSeshSound.bind(this));
this.endSeshSound.addEventListener('change', this.updateEndPMSeshSound.bind(this));
}
/**
@ -91,6 +115,10 @@ class settingsPanel extends panelObj{
this.liveSyncTolerance.value = localStorage.getItem("liveSyncTolerance");
this.syncDelta.value = localStorage.getItem("syncDelta");
this.chatWidthMinimum.value = localStorage.getItem("chatWidthMin");
this.rxPMSound.value = localStorage.getItem('rxPMSound');
this.txPMSound.checked = localStorage.getItem('txPMSound') == 'true';
this.newSeshSound.checked = localStorage.getItem('newSeshSound') == 'true';
this.endSeshSound.checked = localStorage.getItem('endSeshSound') == 'true';
}
/**
@ -189,4 +217,32 @@ class settingsPanel extends panelObj{
localStorage.setItem("chatWidthMin", this.chatWidthMinimum.value);
client.processConfig("chatWidthMin", this.chatWidthMinimum.value);
}
/**
* Handles changes to RX PM Sound setting
*/
updateRXPMSound(){
localStorage.setItem('rxPMSound', this.rxPMSound.value);
}
/**
* Handles changes to TX PM Sound setting
*/
updateTXPMSound(){
localStorage.setItem('txPMSound', this.txPMSound.checked);
}
/**
* Handles changes to New PM Sesh Sound setting
*/
updateNewPMSeshSound(){
localStorage.setItem('newSeshSound', this.newSeshSound.checked);
}
/**
* Handles changes to Old PM Sesh Sound setting
*/
updateEndPMSeshSound(){
localStorage.setItem('endSeshSound', this.endSeshSound.checked);
}
}