我正在尝试制作一个 chrome 扩展,使控件在本机 YouTube 页面内的 YouTube 视频上始终可见。
到目前为止我有这个js
$(document).ready(function() {
setInterval(function(){
$('.ytp-autohide').removeClass('ytp-autohide');
$('#player-container').mouseover();
},100);
});
Run Code Online (Sandbox Code Playgroud)
但删除 ytp-autohide 类会停止计时器/栏进度,我不知道如何通过 js mouseover 或类似方式激活 showcontrols 功能。
我可以以某种方式保持进度条和时间,或者用js重新创建鼠标悬停显示控件功能吗?
如果 URL 只有一个子目录长,我想让 jquery 触发。
例如,http://milpool.com/thrillho但不是http://milpool.com/thrillho/santoslhalper
我不知道目录的实际内容。
我以为会是这样的:
if (document.location.pathname.length) == 2 {
// do something
}
Run Code Online (Sandbox Code Playgroud)
但显然不是。