mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Option for unfocused sound play
This commit is contained in:
@ -1100,6 +1100,11 @@
|
|||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label for="play_sound_unfocused" class="checkbox_label">
|
||||||
|
<input id="play_sound_unfocused" type="checkbox" />
|
||||||
|
Sound only for unfocused window
|
||||||
|
</label>
|
||||||
|
|
||||||
<label for="fast_ui_mode" class="checkbox_label" title="Blur can cause browser lag, especially in Bubble Chat mode. To fix: Turn on your browser's Hardware Acceleration, and restart your browser or simply disable the blur effect with this toggle.">
|
<label for="fast_ui_mode" class="checkbox_label" title="Blur can cause browser lag, especially in Bubble Chat mode. To fix: Turn on your browser's Hardware Acceleration, and restart your browser or simply disable the blur effect with this toggle.">
|
||||||
<input id="fast_ui_mode" type="checkbox" />
|
<input id="fast_ui_mode" type="checkbox" />
|
||||||
No Blur Effect
|
No Blur Effect
|
||||||
|
@ -37,6 +37,7 @@ let power_user = {
|
|||||||
chat_display: chat_styles.DEFAULT,
|
chat_display: chat_styles.DEFAULT,
|
||||||
sheld_width: sheld_width.DEFAULT,
|
sheld_width: sheld_width.DEFAULT,
|
||||||
play_message_sound: false,
|
play_message_sound: false,
|
||||||
|
play_sound_unfocused: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const storage_keys = {
|
const storage_keys = {
|
||||||
@ -60,6 +61,10 @@ function playMessageSound() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (power_user.play_sound_unfocused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const audio = document.getElementById('audio_message_sound');
|
const audio = document.getElementById('audio_message_sound');
|
||||||
audio.volume = 0.8;
|
audio.volume = 0.8;
|
||||||
audio.pause();
|
audio.pause();
|
||||||
@ -144,6 +149,7 @@ function loadPowerUserSettings(settings) {
|
|||||||
$("#fast_ui_mode").prop("checked", power_user.fast_ui_mode);
|
$("#fast_ui_mode").prop("checked", power_user.fast_ui_mode);
|
||||||
$("#multigen").prop("checked", power_user.multigen);
|
$("#multigen").prop("checked", power_user.multigen);
|
||||||
$("#play_message_sound").prop("checked", power_user.play_message_sound);
|
$("#play_message_sound").prop("checked", power_user.play_message_sound);
|
||||||
|
$("#play_sound_unfocused").prop("checked", power_user.play_sound_unfocused);
|
||||||
$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true);
|
$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true);
|
||||||
$(`input[name="chat_display"][value="${power_user.chat_display}"]`).prop("checked", true);
|
$(`input[name="chat_display"][value="${power_user.chat_display}"]`).prop("checked", true);
|
||||||
$(`input[name="sheld_width"][value="${power_user.sheld_width}"]`).prop("checked", true);
|
$(`input[name="sheld_width"][value="${power_user.sheld_width}"]`).prop("checked", true);
|
||||||
@ -226,4 +232,9 @@ $(document).ready(() => {
|
|||||||
power_user.play_message_sound = !!$(this).prop('checked');
|
power_user.play_message_sound = !!$(this).prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#play_sound_unfocused").on('input', function () {
|
||||||
|
power_user.play_sound_unfocused = !!$(this).prop('checked');
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
});
|
});
|
Reference in New Issue
Block a user