rotemdan / MaximizerForYouTube

Maximizes the YouTube player to fill the entire browser viewport when in theater mode, plus a few other enhancements.
MIT License
15 stars 2 forks source link

Auto-expand not working #11

Open geonetor opened 1 year ago

geonetor commented 1 year ago

Very useful script, the only thing that does not work is description auto expand (i use Greek language in Youtube). I recommend you to use the following lines that work for me (script made by makise-homura):

document.addEventListener('dom-change', `function()`
{
// Expand descriptions
if (!document.getElementById('expand').hidden) {document.getElementById("expand").click();}

// Expand comment text
//document.querySelectorAll("span.more-button.style-scope.ytd-comment-renderer").forEach(x => (function(x) {if (x.offsetParent != null) {x.click();}})(x));

// Expand first part of comment subtrees
//document.querySelectorAll("#more-replies.more-button").forEach(x => (function(x) {if (!x.hidden) {x.click();}})(x));

// Expand other parts of comment subtrees
//document.querySelectorAll('ytd-button-renderer.style-scope.ytd-continuation-item-renderer').forEach(x => (function(x) {if (x.clientHeight > 0) {x.firstChild.firstChild.click();}})(x));
}, false);
rotemdan commented 1 year ago

Yes, when I fixed the script a few months ago, I didn't fix the auto-expand for the description. On 0.2.8 I changed to:

// Expands video description
function ensureExpandedVideoDescription() {
    setInterval(() => {
        $("tp-yt-paper-button#expand").click()
    }, 50);
}

And it seems to work so far.

Auto expanding comments is possible but isn't something I'd want to have by default, since it can make browsing the comments a bit more confusing or jumpy (due to the expansion happening while browsing) and not all users want to expand all comments.

Since this script is very simple and doesn't have options, I can't really add something like that for now.