Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshot icon doesn't disappear when we turn off activate button #1840

Closed
pg2511 opened this issue Nov 17, 2023 · 3 comments
Closed

Screenshot icon doesn't disappear when we turn off activate button #1840

pg2511 opened this issue Nov 17, 2023 · 3 comments
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥

Comments

@pg2511
Copy link
Member

pg2511 commented Nov 17, 2023

Bug Report:

BUG: Screenshot icon doesn't disappear when we turn off activate button and same thing happens with repeat button

Screenshots:
image

Even if button is inactive, screenshot still showing
image

When i clicked Activate button screenshot icon appears, but once i disable the activate button, it doesn't hide and keeps on showing, and same thing happened with repeat button.

@pg2511 pg2511 added Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥ labels Nov 17, 2023
@pg2511
Copy link
Member Author

pg2511 commented Nov 17, 2023

I have created a PR #1841 which is solving this issue for both screenshot as well as repeat button please have a look @ImprovedTube and merge it.

@ImprovedTube
Copy link
Member

ImprovedTube commented Nov 18, 2023

welcome! @PG-257811 tysm for caring! now the removing might happen before reloading, but not necessarily immediately, if a feature runs again before the next pageload, that's for another reason / later.

  • we use/d to undo features only exactly when users undo the switches:
    // FEEDBACK WHEN THE USER CHANGED A SETTING
    ImprovedTube.init();
    } else if (message.action === 'storage-changed') {
    var camelized_key = message.camelizedKey;
    ImprovedTube.storage[message.key] = message.value;
    if(['block_vp9', 'block_h264', 'block_av1'].includes(message.key)){
    let atlas = {block_vp9:'vp9|vp09', block_h264:'avc1', block_av1:'av01'}
    localStorage['it-codec'] = Object.keys(atlas).reduce(function (all, key) {
    return ImprovedTube.storage[key] ? ((all?all+'|':'') + atlas[key]) : all}, '');
    if (!localStorage['it-codec']) {
    localStorage.removeItem('it-codec');
    }
    }
    if(message.key==="player_60fps"){
    if (ImprovedTube.storage.player_60fps === false) {
    localStorage['it-player30fps'] = true;
    } else {
    localStorage.removeItem('it-player30fps');
    }
    }
    if(ImprovedTube.storage[message.key]==="when_paused"){
    ImprovedTube.whenPaused();
    };
    if (camelized_key === 'blacklistActivate') {
    camelized_key = 'blacklist';
    } else if (camelized_key === 'playerForcedPlaybackSpeed') {
    camelized_key = 'playerPlaybackSpeed';
    } else if (camelized_key === 'theme') {
    ImprovedTube.myColors();
    ImprovedTube.setTheme();
    } else if (camelized_key === 'description') {
    if (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.description === "classic_expanded" )
    {try{document.querySelector("#more").click() || document.querySelector("#expand").click() ;} catch{} }
    if (ImprovedTube.storage.description === "normal" || ImprovedTube.storage.description === "classic" )
    {try{document.querySelector("#less").click() || document.querySelector("#collapse").click();} catch{}}
    ImprovedTube.improvedtubeYoutubeButtonsUnderPlayer();
    }
    else if (camelized_key === 'transcript') {
    if (ImprovedTube.storage.transcript === true) {try{document.querySelector('*[target-id*=transcript]').removeAttribute('visibility');}catch{}
    } if (ImprovedTube.storage.transcript === false){try{document.querySelector('*[target-id*=transcript] #visibility-button button').click();}catch{}}
    }
    else if (camelized_key === 'chapters') {
    if (ImprovedTube.storage.chapters === true){try{document.querySelector('*[target-id*=chapters]').removeAttribute('visibility');}catch{}
    } if (ImprovedTube.storage.chapters === false){try{document.querySelector('*[target-id*=chapters] #visibility-button button').click();}catch{}}
    }
    else if (camelized_key === 'commentsSidebar') {
    if(ImprovedTube.storage.comments_sidebar === false)
    {document.querySelector("#below").appendChild(document.querySelector("#comments"));
    document.querySelector("#secondary").appendChild(document.querySelector("#related")); }
    else{ImprovedTube.commentsSidebar();}
    }
    else if (camelized_key === 'forcedTheaterMode') { if(ImprovedTube.storage.forced_theater_mode === false && ImprovedTube.elements.ytd_watch && ImprovedTube.elements.player){
    var button = ImprovedTube.elements.player.querySelector("button.ytp-size-button");
    if (button && ImprovedTube.elements.ytd_watch.theater === true) {
    ImprovedTube.elements.ytd_watch.theater = false;
    setTimeout(function () { button.click();}, 100);
    }
    }
    }
    if (ImprovedTube[camelized_key]) {
    try{ImprovedTube[camelized_key]()}catch{};
    }
    } else if (message.focus === true && ImprovedTube.elements.player) {
    ImprovedTube.focus = true;

    this can save just a little time & electricity on the long run, since removing something from DOM (or even attempting to) can be slow like >= 1ms, and our code runs billions of times...
    • (and can do more like that there. And could sort them, so that similar ones are in a row, maybe one long line of code per feature there only - looking like a table.)
      • In short ou rCUO (Chief UI-feedback Officer [DOM change undoing]) is a great vacancy. Hope you might consider adopting this section of the project.)

@pg2511
Copy link
Member Author

pg2511 commented Nov 18, 2023

Okay, I got your point. Thanks for explaining this thing clearly.

@pg2511 pg2511 closed this as completed Nov 18, 2023
ImprovedTube added a commit that referenced this issue Nov 18, 2023
ImprovedTube added a commit that referenced this issue Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥
Projects
None yet
Development

No branches or pull requests

2 participants