Work-around for Youtube video elements positioned off-display at replacement time.
This commit is contained in:
parent
a34287020c
commit
cd37d7987d
|
@ -55,6 +55,9 @@ var PlaceHolder = (() => {
|
|||
for (let p of props) {
|
||||
destStyle[p] = srcStyle[p];
|
||||
}
|
||||
if (src.offsetTop < 0 && src.offsetTop <= (-src.offsetHeight)) {
|
||||
destStyle.top = "0"; // fixes video player off-display position on Youtube
|
||||
}
|
||||
destStyle.display = srcStyle.display !== "block" ? "inline-block" : "block";
|
||||
}
|
||||
|
||||
|
|
|
@ -35,13 +35,11 @@ if ("MediaSource" in window) ns.on("capabilities", event => {
|
|||
notifyPage();
|
||||
|
||||
if (mediaBlocker) {
|
||||
(async () => {
|
||||
let exposedMime = `${mime} (MSE)`;
|
||||
setTimeout(() => {
|
||||
let me = Array.from(document.querySelectorAll("video,audio"))
|
||||
.find(e => e.srcObject === ms || urls && urls.has(e.src));
|
||||
|
||||
if (!me) return;
|
||||
let exposedMime = `${mime} (MSE)`;
|
||||
|
||||
try {
|
||||
let ph = PlaceHolder.create("media", request);
|
||||
ph.replace(me);
|
||||
|
@ -49,7 +47,7 @@ if ("MediaSource" in window) ns.on("capabilities", event => {
|
|||
} catch (e) {
|
||||
error(e);
|
||||
}
|
||||
})();
|
||||
}, 0);
|
||||
throw new Error(`${exposedMime} blocked by NoScript`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue