Compare commits

..

3 commits

4 changed files with 20 additions and 5 deletions

View file

@ -2,6 +2,8 @@
import JadefinIntegrity from "./JadefinIntegrity.js"; import JadefinIntegrity from "./JadefinIntegrity.js";
import JadefinUtils from "./JadefinUtils.js";
import cyrb53a from "./utils/cyrb53.js"; import cyrb53a from "./utils/cyrb53.js";
export default JadefinIntegrity("JadefinLog", import.meta.url, () => class JadefinLog { export default JadefinIntegrity("JadefinLog", import.meta.url, () => class JadefinLog {
@ -64,7 +66,7 @@ export default JadefinIntegrity("JadefinLog", import.meta.url, () => class Jadef
return this; return this;
} }
if (args.length == 1) { if (args.length == 1 && !JadefinUtils.isFF) {
if (args[0] instanceof Error) { if (args[0] instanceof Error) {
console.error(args[0]); console.error(args[0]);
} else { } else {

View file

@ -16,6 +16,8 @@ export default JadefinIntegrity("JadefinUtils", import.meta.url, () => window["J
/** @type {any} */ /** @type {any} */
htmlVideoPlayer = null; htmlVideoPlayer = null;
isFF = globalThis.navigator?.userAgent.toLowerCase().includes("firefox") || false;
get isInMovie() { get isInMovie() {
return !!document.querySelector(".osdHeader"); return !!document.querySelector(".osdHeader");
} }

View file

@ -98,7 +98,7 @@ export default JadefinIntegrity("InputEater", import.meta.url, () => new (class
item.secondaryText = "Give up control over the party"; item.secondaryText = "Give up control over the party";
} }
return this.canBeEating; return this.canBeEating && current == ExtrasMenu.IN_MOVIE;
}, },
cb: () => { cb: () => {
this.isEnabled = !this.isEnabled; this.isEnabled = !this.isEnabled;

View file

@ -9,6 +9,8 @@ import JadefinUtils from "../../JadefinUtils.js";
// Thanks, Mozilla, for killing Firefox... https://bugzilla.mozilla.org/show_bug.cgi?id=1331110 // Thanks, Mozilla, for killing Firefox... https://bugzilla.mozilla.org/show_bug.cgi?id=1331110
export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () => new (class PatchFirefoxAnamorphic extends JadefinMod { export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () => new (class PatchFirefoxAnamorphic extends JadefinMod {
wantedWidth = 0;
constructor() { constructor() {
super(); super();
} }
@ -51,15 +53,22 @@ export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () =>
} }
if (this.video == video) { if (this.video == video) {
return this._dispatch(0); return this._dispatch(this.wantedWidth);
}
const streams = JadefinUtils.currentPlayer?.streamInfo?.mediaSource?.MediaStreams;
if (!streams) {
this.log.i("Waiting for media streams");
setTimeout(() => this.update(), 100);
return;
} }
this.video = video; this.video = video;
const ratioStr = JadefinUtils.currentPlayer.streamInfo.mediaSource.MediaStreams.find(s => s.Type == "Video").AspectRatio; const ratioStr = streams.find(s => s.Type == "Video").AspectRatio;
const ratioStrSplit = ratioStr && ratioStr.split(":"); const ratioStrSplit = ratioStr && ratioStr.split(":");
if (!ratioStrSplit || !ratioStrSplit[1]) { if (!ratioStrSplit || !ratioStrSplit[1]) {
this.log.i(`Aspect ratio couldn't be determined`); this.log.i("Aspect ratio couldn't be determined");
return this._dispatch(0); return this._dispatch(0);
} }
@ -81,6 +90,8 @@ export default JadefinIntegrity("PatchFirefoxAnamorphic", import.meta.url, () =>
* @param {number} width * @param {number} width
*/ */
_dispatch(width) { _dispatch(width) {
this.wantedWidth = width;
JadefinUtils.events.dispatchEvent(new CustomEvent("PatchFirefoxAnamorphic", { JadefinUtils.events.dispatchEvent(new CustomEvent("PatchFirefoxAnamorphic", {
detail: { detail: {
width width