From 2f41f520af3fad08cea4415ae4e50389239e7e0a Mon Sep 17 00:00:00 2001 From: SirStendec Date: Sun, 25 Apr 2021 13:11:28 -0400 Subject: [PATCH] 4.21.1 * Fixed: Scrolling to adjust volume not falling back to built-in volume when gain control is bound to the same input but not currently enabled. * Fixed: Badges not appearing correctly in Firefox with high-DPI displays or page zoom. --- package.json | 2 +- src/modules/chat/badges.jsx | 3 +++ src/sites/shared/player.jsx | 36 +++++++++++++++++++----------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index bc0d7f20..dd852ddc 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.21.0", + "version": "4.21.1", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/modules/chat/badges.jsx b/src/modules/chat/badges.jsx index fdd46326..d6d1fbbe 100644 --- a/src/modules/chat/badges.jsx +++ b/src/modules/chat/badges.jsx @@ -133,6 +133,9 @@ export function generateBadgeCSS(badge, version, data, style, is_dark, badge_ver if ( data.urls && scale === 1 ) { image_set = `${WEBKIT}image-set(${image} 1x${data.urls[2] ? `, url("${data.urls[2]}") 2x` : ''}${data.urls[4] ? `, url("${data.urls[4]}") 4x` : ''})` + } else if ( data.urls && scale === 2 ) { + image_set = `${WEBKIT}image-set(${image} 1x${data.urls[4] ? `, url("${data.urls[4]}") 2x` : ''})`; + } else if ( ! svg && scale < 4 ) { if ( scale === 1 ) image_set = `${WEBKIT}image-set(${image} 1x, url("${base_image}2${trans ? '_trans' : ''}.png") 2x, url("${base_image}4${trans ? '_trans' : ''}.png") 4x)`; diff --git a/src/sites/shared/player.jsx b/src/sites/shared/player.jsx index 0a7f824a..c61e1980 100644 --- a/src/sites/shared/player.jsx +++ b/src/sites/shared/player.jsx @@ -877,36 +877,26 @@ export default class PlayerBase extends Module { gain_scroll = t.settings.get('player.gain.scroll'), matches_gain = gain_scroll && matchesEvent(gain_scroll, event, this.ffz_rmb), - matches_vol = ! matches_gain && vol_scroll && matchesEvent(vol_scroll, event, this.ffz_rmb); + matches_vol = vol_scroll && matchesEvent(vol_scroll, event, this.ffz_rmb); if ( ! matches_gain && ! matches_vol ) return; const delta = event.wheelDelta || -(event.deltaY || event.detail || 0), player = this.props?.mediaPlayerInstance, - video = player?.mediaSinkManager?.video || player?.core?.mediaSinkManager?.video; + video = player?.mediaSinkManager?.video || player?.core?.mediaSinkManager?.video, + has_gain = video?._ffz_compressed && video?._ffz_gain != null, + doing_gain = has_gain && matches_gain; - if ( ! player?.getVolume || (matches_gain && ! video) ) + if ( ! player?.getVolume ) return; - if ( matches_gain ? wantsRMB(gain_scroll) : wantsRMB(vol_scroll) ) + if ( doing_gain ? wantsRMB(gain_scroll) : wantsRMB(vol_scroll) ) this.ffz_scrolled = true; const amount = t.settings.get('player.volume-scroll-steps'); - if ( matches_vol && ! (video._ffz_compressed && t.settings.get('player.gain.no-volume')) ) { - const old_volume = video?.volume ?? player.getVolume(), - volume = Math.max(0, Math.min(1, old_volume + (delta > 0 ? amount : -amount))); - - player.setVolume(volume); - localStorage.volume = volume; - - if ( volume !== 0 ) { - player.setMuted(false); - localStorage.setItem('video-muted', JSON.stringify({default: false})); - } - - } else if ( matches_gain ) { + if ( doing_gain ) { let value = video._ffz_gain_value; if ( value == null ) value = t.settings.get('player.gain.default'); @@ -926,6 +916,18 @@ export default class PlayerBase extends Module { video._ffz_gain_value = value; t.updateGain(this); + + } else if ( matches_vol && ! (video._ffz_compressed && t.settings.get('player.gain.no-volume')) ) { + const old_volume = video?.volume ?? player.getVolume(), + volume = Math.max(0, Math.min(1, old_volume + (delta > 0 ? amount : -amount))); + + player.setVolume(volume); + localStorage.volume = volume; + + if ( volume !== 0 ) { + player.setMuted(false); + localStorage.setItem('video-muted', JSON.stringify({default: false})); + } } event.preventDefault();