mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'main' into dev
This commit is contained in:
@ -56,12 +56,15 @@ const storage_keys = {
|
||||
sheld_width: "TavernAI_sheld_width"
|
||||
};
|
||||
|
||||
//Updated at the bottom of this script document based on 'focus' and 'blur' events
|
||||
let browser_has_focus = true;
|
||||
|
||||
function playMessageSound() {
|
||||
if (!power_user.play_message_sound) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (power_user.play_sound_unfocused) {
|
||||
if (power_user.play_sound_unfocused && browser_has_focus) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -237,4 +240,12 @@ $(document).ready(() => {
|
||||
power_user.play_sound_unfocused = !!$(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('focus', function() {
|
||||
browser_has_focus = true;
|
||||
});
|
||||
|
||||
$(window).on('blur', function() {
|
||||
browser_has_focus = false;
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user