Tabview YouTube Totara

制作信息、评论、视频和播放列表的标签

< 脚本Tabview YouTube Totara的反馈

评价:好评 - 脚本运行良好

§
发表于:2025-04-06

Nice script, thank you. I've found a compatibility issue with the following script:

https://gf.qytechs.cn/en/scripts/13040-youtube-hide-watched-videos

When both are active, the above script does not work (Menu doesn't show up).
I solved this for the homepage by changing the MATCH attribute for Tabview to "youtube/watch/*" instead of "youtube/*".
Maybe it should be like that by default? Tabview isn't necessary on the homepage I think?

§
发表于:2025-04-06
编辑于:2025-04-06

Correction - Should be "youtube/watch*" without the second slash or it stops working on videos. I realize this is only a workaround, because the menu from the other script should also appear on video pages, but it's easier to do than finding the conflict.

§
发表于:2025-04-06

Update: My fix is not that good unfortunately, it only works at full page refresh which does not happen when clicking on a video from the homepage. So the actual conflict should be found, but I don't know how easy that is, or whether you should do it or the other dev. I'm not proficient enough at JS to find it.

§
发表于:2025-04-06

YouTube is Single Page App.

We always do https://www.youtube.com/*

Otherwise your scripts would not trigger when you navigate from the home page.

§
发表于:2025-04-06

Thanks for reporting. I will check with this compatibility issue later.

§
发表于:2025-04-06

His script is doing something wrong. His script made a compatibility issue.

delete these lines from his script.

    // Needed to bypass YouTube's Trusted Types restrictions, ie.
    // Uncaught TypeError: Failed to set the 'innerHTML' property on 'Element': This document requires 'TrustedHTML' assignment.
    if (window.trustedTypes?.createPolicy) {
        window.trustedTypes.createPolicy('default', {
            createHTML: (string, _sink) => string,
        });
    }

or replace them with my version


if (typeof trustedTypes !== 'undefined' && trustedTypes.defaultPolicy === null) {
  let s = s => s;
  trustedTypes.createPolicy('default', { createHTML: s, createScriptURL: s, createScript: s });
}
§
发表于:2025-04-06

Thank you for looking into this so quickly, and even coming up with a solution! I've tried your fix, it works.

发表回复

登录(不可用)以发表回复。

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址