1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-03 08:28:31 +00:00
* Fixed: When built-in volume control is being replaced with gain control, automatically unmute the player when adjusting the gain control.
* Fixed: Issue with the webpack compatibility module not correctly flagging modules as available.
This commit is contained in:
SirStendec 2021-04-28 00:51:24 -04:00
parent b685ed3ce7
commit 7d040066c4
3 changed files with 42 additions and 8 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.21.2", "version": "4.21.3",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",

View file

@ -875,6 +875,7 @@ export default class PlayerBase extends Module {
cls.prototype.ffzScrollHandler = function(event) { cls.prototype.ffzScrollHandler = function(event) {
const vol_scroll = t.settings.get('player.volume-scroll'), const vol_scroll = t.settings.get('player.volume-scroll'),
gain_scroll = t.settings.get('player.gain.scroll'), gain_scroll = t.settings.get('player.gain.scroll'),
no_vol = t.settings.get('player.gain.no-volume'),
matches_gain = gain_scroll && matchesEvent(gain_scroll, event, this.ffz_rmb), matches_gain = gain_scroll && matchesEvent(gain_scroll, event, this.ffz_rmb),
matches_vol = vol_scroll && matchesEvent(vol_scroll, event, this.ffz_rmb); matches_vol = vol_scroll && matchesEvent(vol_scroll, event, this.ffz_rmb);
@ -915,9 +916,15 @@ export default class PlayerBase extends Module {
value = max; value = max;
video._ffz_gain_value = value; video._ffz_gain_value = value;
if ( no_vol && value !== 0 ) {
player.setMuted(false);
localStorage.setItem('video-muted', JSON.stringify({default: false}));
}
t.updateGain(this); t.updateGain(this);
} else if ( matches_vol && ! (video._ffz_compressed && t.settings.get('player.gain.no-volume')) ) { } else if ( matches_vol && ! (video._ffz_compressed && no_vol) ) {
const old_volume = video?.volume ?? player.getVolume(), const old_volume = video?.volume ?? player.getVolume(),
volume = Math.max(0, Math.min(1, old_volume + (delta > 0 ? amount : -amount))); volume = Math.max(0, Math.min(1, old_volume + (delta > 0 ? amount : -amount)));
@ -1135,7 +1142,7 @@ export default class PlayerBase extends Module {
if ( min >= max || max <= min ) if ( min >= max || max <= min )
gain = null; gain = null;
let tip, input, extra, fill, cont = container.querySelector('.ffz--player-gain'); let tip, tipcont, input, extra, fill, cont = container.querySelector('.ffz--player-gain');
if ( ! gain ) { if ( ! gain ) {
if ( cont ) if ( cont )
cont.remove(); cont.remove();
@ -1154,6 +1161,17 @@ export default class PlayerBase extends Module {
if ( value > max ) if ( value > max )
value = max; value = max;
if ( value == video._ffz_gain_value )
return;
const player = inst.props.mediaPlayerInstance,
core = player.core || player;
if ( value > 0 && this.settings.get('player.gain.no-volume') && core?.isMuted?.() ) {
core.setMuted(false);
localStorage.setItem('video-muted', JSON.stringify({default: false}));
}
video._ffz_gain_value = value; video._ffz_gain_value = value;
gain.gain.value = value; gain.gain.value = value;
@ -1187,12 +1205,12 @@ export default class PlayerBase extends Module {
</div> </div>
</div> </div>
</div> </div>
<div class="tw-tooltip tw-tooltip--align-center tw-tooltip--up" role="tooltip"> {tipcont = (<div class="tw-tooltip tw-tooltip--align-center tw-tooltip--up" role="tooltip">
<div> <div>
{tip = (<div class="ffz--p-tip" />)} {tip = (<div class="ffz--p-tip" />)}
{extra = (<div class="tw-regular ffz--p-value" />)} {extra = (<div class="tw-regular ffz--p-value" />)}
</div> </div>
</div> </div>)}
</div>); </div>);
/*input.addEventListener('contextmenu', e => { /*input.addEventListener('contextmenu', e => {
@ -1208,6 +1226,7 @@ export default class PlayerBase extends Module {
else { else {
input = cont.querySelector('input'); input = cont.querySelector('input');
fill = cont.querySelector('.ffz--gain-value'); fill = cont.querySelector('.ffz--gain-value');
tipcont = cont.querySelector('.tw-tooltip');
tip = cont.querySelector('.tw-tooltip .ffz--p-tip'); tip = cont.querySelector('.tw-tooltip .ffz--p-tip');
extra = cont.querySelector('.tw-tooltip .ffz--p-value'); extra = cont.querySelector('.tw-tooltip .ffz--p-value');
} }

View file

@ -16,7 +16,7 @@ const regex_cache = {};
function getRequireRegex(name) { function getRequireRegex(name) {
if ( ! regex_cache[name] ) if ( ! regex_cache[name] )
regex_cache[name] = new RegExp(`\\b${name}\\(([0-9a-zA-Z_+]+)\\)`, 'g'); regex_cache[name] = new RegExp(`\\b${name}\\(([0-9e_+]+)\\)`, 'g');
return regex_cache[name]; return regex_cache[name];
} }
@ -511,13 +511,28 @@ export default class WebMunch extends Module {
regex.lastIndex = 0; regex.lastIndex = 0;
let match; let match;
// Here, we check all the modules this module depends on
// so that we don't require a module with missing requirements
// because webpack sucks.
while((match = regex.exec(str))) { while((match = regex.exec(str))) {
const mod_id = match[1]; let mod_id = match[1];
if ( mod_id === 'e' )
continue;
// Modules are all numbers, but some are written in e notation.
// We need to correct that for string comparison.
if ( /^\d+e\d+$/.test(mod_id) ) {
const bits = mod_id.split('e');
mod_id = `${parseInt(bits[0], 10) * (10 ** parseInt(bits[1], 10))}`;
}
reqs.add(mod_id); reqs.add(mod_id);
if ( ! this._require.m[mod_id] ) if ( ! banned && ! this._require.m[mod_id] ) {
this.log.verbose(`Unable to load module ${id} due to missing dependency ${mod_id}`);
banned = true; banned = true;
} }
}
} else } else
fn[Requires] = false; fn[Requires] = false;