summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/PlaceHolder.js3
-rw-r--r--src/content/media.js8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/content/PlaceHolder.js b/src/content/PlaceHolder.js
index 4c860ec..7043caf 100644
--- a/src/content/PlaceHolder.js
+++ b/src/content/PlaceHolder.js
@@ -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";
}
diff --git a/src/content/media.js b/src/content/media.js
index 4b8f852..8a9526b 100644
--- a/src/content/media.js
+++ b/src/content/media.js
@@ -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`);
}