Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed Aug 7, 2023
1 parent 7d34746 commit f6d277b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
35 changes: 19 additions & 16 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,27 @@ ImprovedTube.ytElementsHandler = function (node) {
}
} else if (name === 'META') {
if(node.getAttribute('name')) {
if(node.getAttribute('name') === 'themeColor') {ImprovedTube.themeColor = node.content;}
//if(node.getAttribute('name') === 'title') {ImprovedTube.title = node.content;}
//if(node.getAttribute('name') === 'description') {ImprovedTube.description = node.content;}
//if(node.getAttribute('name') === 'title') {ImprovedTube.title = node.content;} //duplicate
//if(node.getAttribute('name') === 'description') {ImprovedTube.description = node.content;} //duplicate
//if node.getAttribute('name') === 'themeColor') {ImprovedTube.themeColor = node.content;} //might help our darkmode/themes
//Do we need any of these here before the player starts?
if(node.getAttribute('name') === 'keywords') {ImprovedTube.keywords = node.content;}
} else if (node.getAttribute('itemprop')) {
if(node.getAttribute('itemprop') === 'name') {ImprovedTube.title = node.content;}
if(node.getAttribute('itemprop') === 'description') {ImprovedTube.description = node.content;}
if(node.getAttribute('itemprop') === 'paid') {ImprovedTube.paid = node.content;}
if(node.getAttribute('itemprop') === 'channelId') {ImprovedTube.channelId = node.content;}
if(node.getAttribute('itemprop') === 'videoId') {ImprovedTube.videoId = node.content;}
if(node.getAttribute('itemprop') === 'unlisted') {ImprovedTube.unlisted = node.content;}
// if(node.getAttribute('itemprop') === 'regionsAllowed'){ImprovedTube.regionsAllowed = node.content;}
if(node.getAttribute('itemprop') === 'duration') {ImprovedTube.duration = node.content;}
if(node.getAttribute('itemprop') === 'isFamilyFriendly'){ImprovedTube.isFamilyFriendly = node.content;}
if(node.getAttribute('itemprop') === 'interactionCount'){ImprovedTube.views = node.content;}
if(node.getAttribute('itemprop') === 'datePublished' ){ImprovedTube.datePublished = node.content;}
if(node.getAttribute('itemprop') === 'uploadDate') {ImprovedTube.uploadDate = node.content;}
if(node.getAttribute('itemprop') === 'name') {ImprovedTube.title = node.content;}
if(node.getAttribute('itemprop') === 'genre') {ImprovedTube.category = node.content;}
//if(node.getAttribute('itemprop') === 'channelId') {ImprovedTube.channelId = node.content;}
//if(node.getAttribute('itemprop') === 'videoId') {ImprovedTube.videoId = node.content;}
//The following infos will enable awesome, smart features. Some of which everyone should use.
//if(node.getAttribute('itemprop') === 'description') {ImprovedTube.description = node.content;}
//if(node.getAttribute('itemprop') === 'duration') {ImprovedTube.duration = node.content;}
//if(node.getAttribute('itemprop') === 'interactionCount'){ImprovedTube.views = node.content;}
//if(node.getAttribute('itemprop') === 'isFamilyFriendly'){ImprovedTube.isFamilyFriendly = node.content;}
//if(node.getAttribute('itemprop') === 'unlisted') {ImprovedTube.unlisted = node.content;}
//if(node.getAttribute('itemprop') === 'regionsAllowed'){ImprovedTube.regionsAllowed = node.content;}
//if(node.getAttribute('itemprop') === 'paid') {ImprovedTube.paid = node.content;}
// if(node.getAttribute('itemprop') === 'datePublished' ){ImprovedTube.datePublished = node.content;}
//to use in the "how long ago"-feature, not to fail without API key? just like the "day-of-week"-feature above
// if(node.getAttribute('itemprop') === 'uploadDate') {ImprovedTube.uploadDate = node.content;}
}
} else if (name === 'YTD-TOGGLE-BUTTON-RENDERER' || name === 'YTD-PLAYLIST-LOOP-BUTTON-RENDERER') {
if (
Expand Down Expand Up @@ -154,7 +157,7 @@ ImprovedTube.ytElementsHandler = function (node) {
} else if (id === 'movie_player') {
if (!this.elements.player) {
ImprovedTube.elements.player = node;
ImprovedTube.elements.player.stopVideo();
// if (this.storage.player_autoplay === false) { ImprovedTube.elements.player.stopVideo(); }
ImprovedTube.elements.video = node.querySelector('video');
ImprovedTube.elements.player_left_controls = node.querySelector('.ytp-left-controls');
ImprovedTube.elements.player_thumbnail = node.querySelector('.ytp-cued-thumbnail-overlay-image');
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"short_name" : "ImprovedTube",
"name": "'Improve YouTube!' 🎧 (for YouTube & Videos)",
"description": "__MSG_description_ext__",
"version": "4.27",
"version": "4.28",
"default_locale": "en",
"icons": {
"16": "stuff/icons/16.png",
Expand Down

1 comment on commit f6d277b

@raszpl
Copy link
Contributor

@raszpl raszpl commented on f6d277b Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImprovedTube.keywords ImprovedTube.title ImprovedTube.category
are not used anywhere

there is something here https://github.com/code-charity/youtube/blob/7f8b0c58ee1c31289b7220e41e406c5d2fb89fed/js%26css/web-accessible/www.youtube.com/player.js#L89-L91C3
but its using uninitialized ImprovedTube.elements.keywords ImprovedTube.elements.title ImprovedTube.elements.category and its some ugly hack to check if current video is a music clip by grepping for weird strings inside title and description :o so this feature was permanently broken :)

//The following infos will enable awesome, smart features. Some of which everyone should use.

whole 'META' is a bad way of going about it, we are comparing 11000 times for something instead of using

document.getElementsByTagName('meta').title.getAttribute("content")
document.querySelector('meta[itemprop=genre]').content

once when applicable, etc.

Edit: holy crap player is so broken :o https://github.com/code-charity/youtube/blob/7f8b0c58ee1c31289b7220e41e406c5d2fb89fed/js%26css/web-accessible/www.youtube.com/player.js#L89-L91C3 this thing executes 10x a second no matter what setting playback speed every time until description loads. Ill fix it :/

Please sign in to comment.