Skip to content

Instantly share code, notes, and snippets.

@sagan sagan/tver.jp_helper.js
Last active Mar 7, 2019

Embed
What would you like to do?
tver.jp helper
// 全屏播放时,按↓(箭头下)彻底隐藏视频信息栏,以方便截图。再次按↑恢复。
// 按←,→ 后退/前进5秒。按空格播放/暂停。
window.addEventListener("keydown", e => {
if (document.activeElement && document.activeElement.tagName == "INPUT") {
return;
}
let v = document.querySelector("video");
let a = document.querySelector(".video-js .vjs-dock-text"),
b = document.querySelector(".video-js .vjs-control-bar");
console.log("keydown", e, v);
switch (e.code) {
case "Space":
v.paused ? v.play() : v.pause();
e.preventDefault();
break;
case "ArrowLeft":
v.currentTime -= 5;
break;
case "ArrowRight":
v.currentTime += 5;
break;
case "ArrowUp":
a && a.style.removeProperty("opacity");
b && b.style.removeProperty("opacity");
break;
case "ArrowDown":
a && a.style.setProperty("opacity", "0", "important");
b && b.style.setProperty("opacity", "0", "important");
break;
}
e.stopImmediatePropagation();
});
// 去广告
const players = [
"exPlayer",
"tbsPlayer",
"txPlayer",
"cxPlayer",
"ytvPlayer",
"ntvPlayer"
];
setInterval(function adblock() {
for (let i = 0; i < players.length; i++) {
try {
delete videojs(players[i]).ads;
break;
} catch (e) {}
}
}, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.