Ubah komentar dan daftar menjadi tab untuk Video YouTube
Impressive script. I wish you success.
Perhaps the
switch-case
(ex: blocks) are better to replace to with this
Oh! Thanks for your suggestion. .includes(...)
is much faster than switch-case
!!
https://jsbench.me/gxkr8tk2cb/1
And it is possible if the url contains the parameter list= then it is worth automatically activating the Playlist tab.
Yes. Agreed. Added.
Please update to the latest version.
Another question - why you use snapshots instead of direct link to the stylesheet? (UPD: direct link will allow you to quickly update styles for all users. But if you want to rewrite the styles, then those users who have not updated and use the old version will have problems. Double edged sword)
https://raw.githubusercontent.com/cyfung1031/Tabview-Youtube/main/css/style_content.css
Also using regex to find url parameters is not optimal. Better to use this
for example, such a function would be universal
// current url: https://www.youtube.com/watch?v=10f7RoJStXA&list=PLJJbgs-F6xms5HY5Tq6yNfDfpN1qHgKp7
const getQueryURL = (query, urlString) => new URL(urlString || location).searchParams.get(query);
getQueryURL('list'); // out string: 'PLJJbgs-F6xms5HY5Tq6yNfDfpN1qHgKp7'
And why did you unpublish the extension to the Chrome Web Store?
Another question -
why you use snapshots instead of direct link to the stylesheet?(UPD: direct link will allow you to quickly update styles for all users. But if you want to rewrite the styles, then those users who have not updated and use the old version will have problems. Double edged sword)
https://raw.githubusercontent.com/cyfung1031/Tabview-Youtube/main/css/style_content.css
You got the answer~ The CSS file is specific to each version. Both JS & CSS can be reverted to any previous version.
Also using regex to find url parameters is not optimal. Better to use
thisfor example, such a function would be universal
// current url: https://www.youtube.com/watch?v=10f7RoJStXA&list=PLJJbgs-F6xms5HY5Tq6yNfDfpN1qHgKp7 const getQueryURL = (query, urlString) => new URL(urlString || location).searchParams.get(query); getQueryURL('list'); // out string: 'PLJJbgs-F6xms5HY5Tq6yNfDfpN1qHgKp7'
I don't know this API before.
However the performance is not that good. It shall be a wrapper using RegEx's matching to extract the details of URL / SearchParams.
Actually I don't need to know the exact details of the params. I just need to know whether the url / searchparams contains "list"
I remember that Chromium's engine (Blink/V8) has focused on a lot RegEx optimization (& Gecko followed the optimization). So the performance would not be very poor.
Indeed, this line just perform when the playlist tab is created. So there is no time cost to execute no matter RegEx or API
I created a JSBench for this. You can test by yourself: https://jsbench.me/mbkr95bxbg/1
And why did you unpublish the extension to the Chrome Web Store?
I have never published it in Chrome Web Store. The similar extension is "SuperYoutube" but buggy and laggy.
This is originally based on that extension but with completely different coding.
Um.. Is it really necessary? I don't know.
Why You Should Use Userscripts And Not Extensions When Possible
The only reason could be "Popularity"?
Um.. Is it really necessary?
Of course not
The only reason could be "Popularity"?
This reason alone. You can of course, remember that the extension is a little safer but more greedy all because of the sandbox, more API capabilities and scripts use fewer resources and a little faster. Well come on, who is interested in this. Most people are too lazy. And they need to be presented with the script "on a silver platter". It is enough to compare the number of installations. The number of users indirectly affects their own assessment of the value of the work done. It's a shame when something that you put a lot of effort into is used by "one and a half" people.
However the performance is not that good.
You're using jquery but worry about optimization.
Ok let's just compare the visual work of yours and that extension. When you switch tabs, the extension instantly updates the contents of the tabs. Your script is redrawing all the content. Which takes a split second while the content is drawn. This is most likely due to the use of content-visibility
. Understand correctly, if you do not look "under the hood" and just the UI part. then it is not smooth.
Its extension does not deactivate "Theater mode" when the tab is activated. This is a significant drawback. I looked at its extensions code, and it is quite compact. I've always put code contactability over optimization.
What else did I dislike about your script. So this is the periodic non-loading of comments, and the freezing of the blinking icon of loading comments. This light-fore animation is annoying. And if you click on the tab, the comments are loaded. Perhaps due to the fact that the comment block is not in the viewport area.
I have to admit that all Google does UX is a trash heap. Finding anything you need is very difficult. Greasyfork, openuserjs it is often easier to find something of interest. And a quick glance at the code can be used to assess the presence of ads or other useless functions. Expansion in this regard is less practical. But this requires a higher level of user awareness.
Here it is easier to "reach out" to the author. I hope that my comments will help your script become better. And if possible, delete this thread. I do not like to leave my traces in history. Good luck!
if "Comments are turned off" there is no point in displaying the commentary tab
Impressive script. I wish you success.
Perhaps the
switch-case
(ex: blocks) are better to replace to with thisAnd it is possible if the url contains the parameter
list=
then it is worth automatically activating thePlaylist
tab.