Tabview YouTube Totara

To make tabs for Info, Comments, Videos and Playlist

< Feedback on Tabview YouTube Totara

Review: Good - script works

§
Posted: 06 April 2025

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

https://greasyfork.org/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?

§
Posted: 06 April 2025
Edited: 06 April 2025

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.

§
Posted: 06 April 2025

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.

§
Posted: 06 April 2025

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.

§
Posted: 06 April 2025

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

§
Posted: 06 April 2025

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 });
}
§
Posted: 06 April 2025

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

Post reply

Sign in to post a reply.