fix netflix fix some more
This commit is contained in:
parent
8d47eaf74c
commit
303213da73
@ -720,7 +720,7 @@ class Resizer {
|
||||
y: 0
|
||||
};
|
||||
|
||||
const problemStats = getElementStyles(this.video, ['top', 'left', 'transform']);
|
||||
const problemStats = getElementStyles(this.video, ['top', 'left', 'transform'], ['transform']);
|
||||
if (problemStats.left?.css && problemStats.top?.css && problemStats.transform?.css?.includes(`translate(-${problemStats.left.css}, -${problemStats.top.css})`)) {
|
||||
translate.x -= ~~problemStats.left.pxValue;
|
||||
translate.y -= ~~problemStats.top.pxValue;
|
||||
|
@ -49,7 +49,7 @@ function getPixelValue(value: string, element?: HTMLElement, prop?: string) {
|
||||
}
|
||||
};
|
||||
|
||||
export default function getElementStyles(element: HTMLElement, props: string[]): ProcessedElementStyles {
|
||||
export default function getElementStyles(element: HTMLElement, props: string[], theoryProps?: string[]): ProcessedElementStyles {
|
||||
const stylesheets = document.styleSheets;
|
||||
const computedStyles = getComputedStyle(element);
|
||||
const stylesOut = {};
|
||||
@ -68,12 +68,17 @@ export default function getElementStyles(element: HTMLElement, props: string[]):
|
||||
}
|
||||
|
||||
const cssValue = rule.style.getPropertyValue(property);
|
||||
|
||||
if (theoryProps?.includes(property)) {
|
||||
stylesOut[property] = {css: cssValue};
|
||||
}
|
||||
|
||||
const actualValue = computedStyles.getPropertyValue(property);
|
||||
|
||||
const theory = getPixelValue(cssValue, element, property);
|
||||
const practice = getPixelValue(actualValue, element, property);
|
||||
|
||||
if (theory === practice) {
|
||||
if (theory && practice && (Math.abs(theory - practice) < 1)) {
|
||||
stylesOut[property] = {
|
||||
css: cssValue,
|
||||
pxValue: theory
|
||||
|
Loading…
Reference in New Issue
Block a user