fix video alignment default settings

This commit is contained in:
Tamius Han 2023-04-16 02:16:57 +02:00
parent 977d103c3a
commit 085bd4aab9
4 changed files with 18 additions and 6 deletions

View File

@ -253,6 +253,17 @@ const ExtensionConfPatch = [
},
})
}
}, {
forVersion: '5.99.5',
updateFn: (userOptions: SettingsInterface, defaultOptions) => {
if (!userOptions.sites['@global'].defaults.alignment || !userOptions.sites['@global'].defaults.alignment.x || !userOptions.sites['@global'].defaults.alignment.y) {
userOptions.sites['@global'].defaults.alignment = {
x: VideoAlignmentType.Center,
y: VideoAlignmentType.Center
};
}
userOptions.sites['@empty'].defaults.alignment = {x: VideoAlignmentType.Default, y: VideoAlignmentType.Default};
}
}
];

View File

@ -1447,8 +1447,8 @@ const ExtensionConf: SettingsInterface = {
defaults: {
crop: {type: AspectRatioType.Reset}, // does NOT override Aard
stretch: StretchType.NoStretch,
alignment: {x: VideoAlignmentType.Center, y: VideoAlignmentType.Center},
}
},
"@empty": { // placeholder settings object with fallbacks to @global
enable: {
@ -1471,6 +1471,7 @@ const ExtensionConf: SettingsInterface = {
defaults: {
crop: null,
stretch: StretchType.Default,
alignment: {x: VideoAlignmentType.Default, y: VideoAlignmentType.Default},
}
},
"www.youtube.com" : {

View File

@ -66,16 +66,16 @@ export class SiteSettings {
// these can contain default options, but can also be undefined
if (this.data.defaults?.stretch === StretchType.Default || this.data.defaults?.stretch === undefined) {
this.data.defaults.stretch = _cp(this.defaultSettings.defaults.stretch);
this.data.defaults.stretch = _cp(this.defaultSettings.defaults.stretch ?? StretchType.NoStretch);
}
if (this.data.defaults?.alignment === undefined) { // distinguish between undefined and 0!
this.data.defaults.alignment = _cp(this.defaultSettings.defaults.alignment);
this.data.defaults.alignment = _cp(this.defaultSettings.defaults.alignment ?? {x: VideoAlignmentType.Center, y: VideoAlignmentType.Center});
} else {
if (this.data.defaults?.alignment.x === VideoAlignmentType.Default) {
this.data.defaults.alignment.x = _cp(this.defaultSettings.defaults.alignment.x);
this.data.defaults.alignment.x = _cp(this.defaultSettings.defaults.alignment.x ?? VideoAlignmentType.Center);
}
if (this.data.defaults.alignment.y === VideoAlignmentType.Default) {
this.data.defaults.alignment.y = _cp(this.defaultSettings.defaults.alignment.y);
this.data.defaults.alignment.y = _cp(this.defaultSettings.defaults.alignment.y ?? VideoAlignmentType.Center);
}
}
}

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Ultrawidify",
"description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.",
"version": "5.99.0-4",
"version": "5.99.5",
"applications": {
"gecko": {
"id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}"