Youtube No Flexy Mode

Disable Flexy Mode

< 腳本Youtube No Flexy Mode的回應

評論:正評 - 腳本一切正常

§
發表於:2018-05-22

Does not work until reloading the page or go straight into the video link...

As title says, maybe you should do something so that it will work great with the HTML history API.

Botan作者
§
發表於:2018-05-22

Yes. I didn't try that condition. But you are right. The problem is that EXPERIMENTFLAGS.kevlarflexywatchnew_dom has to be set as soon as possible. That's why I've updated the script. For me youtube now looks like it should do, no matter if i first visit the homepage or a video.

§
發表於:2018-05-23

@Botan said: Yes. I didn't try that condition. But you are right. The problem is that EXPERIMENTFLAGS.kevlarflexywatchnew_dom has to be set as soon as possible. That's why I've updated the script. For me youtube now looks like it should do, no matter if i first visit the homepage or a video.

Well, it kinda works here, but did you just make the code to run constantly?

Botan作者
§
發表於:2018-05-23

Yes and no. Since the object 'yt' and the element 'movie_player' may not be available at document-start, I used timers who check the accessibility. As soon as they are, clearTimer is called to stop those check since only one call is required.

§
發表於:2018-05-23

@Botan said: Yes and no. Since the object 'yt' and the element 'movie_player' may not be available at document-start, I used timers who check the accessibility. As soon as they are, clearTimer is called to stop those check since only one call is required.

// @run-at document-end

(function() { 'use strict'; if (window.top != window.self) return; console.log('Youtube No Flexy Mode'); var ytPlayer; function setBackground () { ytPlayer = document.getElementById("movie_player") || document.getElementsByClassName("html5-video-player")[0]; if (ytPlayer) { ytPlayer.style.background='#000000'; console.log('Set player background color to #000000!'); } }; function ytNoFlexy() { if (typeof window.yt === "undefined" || window.yt.config_.EXPERIMENT_FLAGS.kevlar_flexy_watch_new_dom === false) return; else { window.yt.config_.EXPERIMENT_FLAGS.kevlar_flexy_watch_new_dom = false; console.log('Flexy disabled!'); } } ytNoFlexy(); setBackground(); document.addEventListener("yt-navigate-start", ytNoFlexy, true); document.addEventListener("yt-navigate-finish", setBackground, true); })();

I got this to run ok on my side (don't laugh if my method is too stupid, I'm not good at this :pensive: ), what do you think about this? By the way, why do you set background to #000000? Maybe I didn't look carefully, but I hardly noticed anything weird without it :/

Botan作者
§
發表於:2018-05-23

Uh that looks good. Can I use your version and apply it to greasyfork ?. Well I noticed that on videos like https://www.youtube.com/watch?v=v2AC41dglnM the background color seems to be transparent.

§
發表於:2018-05-23

@Botan said: Uh that looks good. Can I use your version and apply it to greasyfork ?. Well I noticed that on videos like https://www.youtube.com/watch?v=v2AC41dglnM the background color seems to be transparent.

Ahh I see.

Feel free man, maybe there's a better way but well, this works ok for now :sweat_smile:

Botan作者
§
發表於:2018-05-23

Yes, it works, but I still hope Youtube will get the hands on it so this fix is no longer needed.

發表回覆

登入以回復