Skip to content

Commit

Permalink
better transcript, <meta>, embed #867, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed Apr 4, 2023
1 parent 7aaf48f commit 2d849e6
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 97 deletions.
11 changes: 5 additions & 6 deletions js&css/extension/www.youtube.com/appearance/footer/footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
# Hide
--------------------------------------------------------------*/

/*--------------------------------------------------------------
# HIDE
--------------------------------------------------------------*/
html[it-hide-footer='true'] ytd-guide-renderer #footer,
html[it-hide-footer='true'] yt-mealbar-promo-renderer {
display: none !important;
}


html[it-hide-footer='true'] ytd-guide-renderer #footer {
display: none !important;
}
46 changes: 29 additions & 17 deletions js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,44 @@ html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'],
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'] ytd-engagement-panel-section-list-renderer #content
{ max-height: 77vh !important; }
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'] #title
{ opacity: 0.3; }
{ opacity: 0.4; }
html[data-page-type=video][it-transcript='true'][it-sidebar-left='transcript'] ytd-watch-flexy:not([fullscreen]) #columns
{ display:flex !important; max-width:98% !important; }
{ display:flex !important; max-width:99% !important; }
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'],
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript']:not([it-sidebar-left='true']) ytd-engagement-panel-section-list-renderer #content {
min-width: max(450px,15vw) !important; max-width: min(24vw,750px) !important; transform: translateX(-18px);}
min-width: max(445px,17vw) !important; max-width: min(24vw,650px) !important; margin-left: -20px !important;}
html[data-page-type=video][it-transcript='true']:not([it-player-size='1080p']):not([it-player-size='1440p']):not([it-player-size='2160p']):not([it-player-size='custom']):not([it-player-size='max_width']) ytd-watch-flexy:not([fullscreen]) #player{
max-width: 1280px !important; }

@media screen and (min-width: 1599px) {
html[data-page-type=video][it-transcript='true'] ytd-watch-flexy:not([fullscreen]) #secondary
{ display:flex !important; max-width: 98% !important; }
{ display:flex !important; max-width: 99% !important; }
html[data-page-type=video][it-transcript='true'] ytd-browse > ytd-two-column-browse-results-renderer {
object-fit: contain !important; max-width: 98% !important; margin: -5px; }
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) #secondary
{ direction: rtl; float: right;max-width: 600px !important; display:flex !important; object-fit: contain !important;}
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) td-engagement-panel-section-list-renderer
{ text-align: right !important; direction: ltr; }
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) #player
{ left:-10px !important;}
object-fit: contain !important; max-width: 99% !important; margin: -5px; }
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true'] *[target-id*='transcript'],
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) *[target-id*='transcript'] { min-width: 440px !important; max-width 440px !important; object-fit: contain !important; overflow-x: hidden !important; float: right; /* direction: rtl; */
} html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) td-engagement-panel-section-list-renderer
{ !important; text-align: right !important; /* direction: ltr; */
} html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) #player
{ z-index:1000 !important; left:-10px !important;}
}

html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer:hover { overflow-x: visible !important; }
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer:has(+ ytd-transcript-segment-renderer.active) yt-formatted-string
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.25em !important;}
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer.active yt-formatted-string
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.35em !important;}
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer.active + ytd-transcript-segment-renderer yt-formatted-string
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.3em !important;}
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer.active + ytd-transcript-segment-renderer + ytd-transcript-segment-renderer yt-formatted-string
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.25em !important;}

html[data-page-type=video][it-compactSpacing='true'] *[target-id*='transcript'] ytd-transcript-segment-renderer * { max-height: 15px !important; margin-bottom:-5px !important; margin-top:-5px !important; }
html[data-page-type=video][it-compactSpacing='true'] *[target-id*='transcript'],
html[data-page-type=video][it-compactSpacing='true'] *[target-id*='transcript'] ytd-engagement-panel-section-list-renderer #content
{ max-height: 69vh !important; margin-top:40px !important; }


/*--------------------------------------------------------------
# RELATED VIDEOS
--------------------------------------------------------------*/
Expand Down Expand Up @@ -133,26 +149,22 @@ html[data-page-type=video][it-no-page-margin='true'] ytd-browse > ytd-two-column
max-width: auto !important; }






/*--------------------------------------------------------------
# MOVE SIDEBAR LEFT
--------------------------------------------------------------*/
html[it-sidebar-left='true'] #columns>#primary,
html[it-sidebar-left='true'] #head>#upnext{
order: 5 !important;}

html[it-sidebar-left='true'][it-comments-sidebar='true'] #comments{order: 6 !important;}


html[it-sidebar-left='true'] #columns>#secondary>#related {margin-left: calc(0.5vw + 4px); margin-right:1vw !important;}

/*--------------------------------------------------------------
# MOVE THUMBNAILS RIGHT
--------------------------------------------------------------*/
html[it-thumbnails-right='true'] ytd-watch-next-secondary-results-renderer ytd-thumbnail {
order: 7 !important;
order: 5 !important;
}

/*--------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion js&css/extension/www.youtube.com/general/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,9 @@ html[it-hide-animated-thumbnails='true'] #preview>ytd-video-preview {

html[it-hide-thumbnail-overlay='true'] #hover-overlays {
display: none !important;
}
}


html[it-embeddedHidePauseOverlay='true'] .ytp-pause-overlay {display:none !important}
html[it-embeddedHideYoutubeLogo='true'] a.ytp-youtube-button svg path {display:none !important}
html[it-embeddedHideShare='true'] .ytp-share-button-visible:has(.ytp-share-icon) {display:none !important}
21 changes: 11 additions & 10 deletions js&css/extension/www.youtube.com/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ html[it-player-crop-chapter-titles=false] .ytp-chapter-title {
width: auto !important;
}


/*------------------------------------------------------------------------------
4.2 ADS
------------------------------------------------------------------------------*/
html[it-player-ads=subscribed_channels] #related #player-ads,
html[it-player-ads=subscribed_channels] #masthead-ad,
html[it-player-ads=block_all] #related #player-ads,
html[it-player-ads=block_all] #masthead-ad,
html[it-player-ads=subscribed_channels] *[target-id*='engagement-panel-ads'],
html[it-player-ads=subscribed_channels] .ytd-ad-slot-renderer,
html[it-player-ads="block_all"] *[target-id*='engagement-panel-ads'],
html[it-player-ads="block_all"] .ytd-ad-slot-renderer {
display: none !important;}
html[it-ads=subscribed_channels] #related #player-ads,
html[it-ads=subscribed_channels] #masthead-ad,
html[it-ads=subscribed_channels] *[target-id*='engagement-panel-ads'],
html[it-ads=subscribed_channels] .ytd-ad-slot-renderer,
html[it-ads=subscribed_channels] yt-mealbar-promo-renderer,
html[it-ads=block_all] #related #player-ads,
html[it-ads=block_all] #masthead-ad,
html[it-ads=block_all] *[target-id*='engagement-panel-ads'],
html[it-ads=block_all] .ytd-ad-slot-renderer,
html[it-ads=block_all] yt-mealbar-promo-renderer {
display: none !important;}

/*------------------------------------------------------------------------------
4.3 MINIPLAYER
Expand Down
43 changes: 29 additions & 14 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,24 @@ ImprovedTube.ytElementsHandler = function (node) {
}
}
} else if (name === 'META') {
if (node.getAttribute('itemprop') === 'genre') {
ImprovedTube.category = node.content;
}
if (node.getAttribute('name') === 'keywords') {
ImprovedTube.keywords = node.content;
}
if (node.getAttribute('itemprop') === 'name') {
ImprovedTube.title = node.content;
}
// if (node.getAttribute('name') === 'interactionCount') { ImprovedTube.likes = node.content; }
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') === 'keywords') {ImprovedTube.keywords = node.content;}
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') === 'genre') {ImprovedTube.category = node.content;}

} else if (name === 'YTD-TOGGLE-BUTTON-RENDERER' || name === 'YTD-PLAYLIST-LOOP-BUTTON-RENDERER') {
if (
node.parentComponent &&
Expand Down Expand Up @@ -207,9 +215,9 @@ ImprovedTube.ytElementsHandler = function (node) {
}else if (document.documentElement.dataset.pageType === 'video'){
if (id ==='description-inner') {
setTimeout(function () {
ImprovedTube.description(node);
ImprovedTube.descriptionLayout(node);
}, 300);
}else if (id === 'meta') {setTimeout(function () { ImprovedTube.description(node.querySelector('#more')); }, 200);
}else if (id === 'meta') {setTimeout(function () { ImprovedTube.descriptionLayout(node.querySelector('#more')); }, 200);
}else if (id === 'below' ){setTimeout(function () { }, 0);
}else if (id === 'panels'){setTimeout(function () {
ImprovedTube.transcript(node);
Expand Down Expand Up @@ -258,12 +266,13 @@ ImprovedTube.videoPageUpdate = function () {
ImprovedTube.channelVideosCount();
ImprovedTube.upNextAutoplay();
ImprovedTube.playerAutofullscreen();
ImprovedTube.playerSize();

ImprovedTube.playerScreenshotButton();
ImprovedTube.playerRepeatButton();
ImprovedTube.playerRotateButton();
ImprovedTube.playerPopupButton();
ImprovedTube.playerControls();
ImprovedTube.playerSize();
}
};

Expand Down Expand Up @@ -313,14 +322,20 @@ ImprovedTube.initPlayer = function () {
ImprovedTube.subtitlesBackgroundOpacity();
ImprovedTube.playerQuality();
ImprovedTube.playerVolume();
ImprovedTube.playerScreenshotButton();
ImprovedTube.playerRepeatButton();
ImprovedTube.playerRotateButton();
ImprovedTube.playerPopupButton();
ImprovedTube.playerControls();

setTimeout(function () {
ImprovedTube.forcedTheaterMode();
}, 150);

if (location.href.indexOf('/embed/') === -1) {
ImprovedTube.miniPlayer();
}
} else { setTimeout(function() { document.querySelectorAll('a.ytp-youtube-button').remove();
document.querySelector('a.ytp-youtube-button svg path').setAttribute("d","m 45.405 11.073 m -37.302 -0.407 L 10.96 20.86 L 10.96 25.82 L 13.42 25.82 L 13.42 20.86 L 16.32 10.56 L 13.83 10.56 L 12.78 15.25 C 12.49 16.62 12.31 17.59 12.23 18.17 L 12.16 18.17 C 12.097 17.529 11.84 16.38 11.59 15.23 L 10.59 10.56 L 8.1 10.56 Z m 22 0 L 30.1 12.58 L 32.59 12.58 L 32.59 25.82 L 35.06 25.82 L 35.06 12.58 l 2.49 0 l 0 -2.02 l -7.45 0", "important" ) },3000) }
}
};

Expand Down
11 changes: 5 additions & 6 deletions js&css/web-accessible/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ new MutationObserver(function (mutationList) {
});

ImprovedTube.init = function () {

window.addEventListener('yt-page-data-updated', function () {
window.addEventListener('yt-page-data-updated', function () {
ImprovedTube.pageType();
});

ImprovedTube.pageType();
var yt_player_updated = function () {
document.dispatchEvent(new CustomEvent('improvedtube-player-loaded'));

Expand All @@ -54,20 +53,20 @@ ImprovedTube.init = function () {

window.addEventListener('yt-player-updated', yt_player_updated);

this.playerOnPlay();
this.playerH264();
this.player60fps();
this.playerSDR();
this.shortcuts();
this.playerOnPlay();
this.onkeydown();
this.onmousedown();
this.youtubeLanguage();

if (ImprovedTube.elements.player && ImprovedTube.elements.player.setPlaybackRate) {
ImprovedTube.videoPageUpdate();
ImprovedTube.initPlayer();
}

if (window.matchMedia) {
document.documentElement.dataset.systemColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
} ImprovedTube.myColors();
Expand Down
5 changes: 3 additions & 2 deletions js&css/web-accessible/www.youtube.com/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ catch{}}}
CHAPTERS
--------------------------------------------------------------*/
ImprovedTube.chapters = function (el){ if (ImprovedTube.storage.chapters === true){
try{node.querySelector('*[target-id*=chapters]').removeAttribute('visibility');}
try{el.querySelector('*[target-id*=chapters]').removeAttribute('visibility');}
catch{}}
}

/*------------------------------------------------------------------------------
LIVECHAT
------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -296,7 +297,7 @@ ImprovedTube.improvedtubeYoutubeButtonsUnderPlayer = function () {
DESCRIPTION
------------------------------------------------------------------------------*/

ImprovedTube.description = function (el) {
ImprovedTube.descriptionLayout = function (el) {
if (this.storage.description === "expanded" || this.storage.description === "classic_expanded" )
if(el)try{el.click()}catch{setTimeout(function(){el.click();},1000);}
};
Expand Down
10 changes: 5 additions & 5 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ ImprovedTube.autoplay = function () {
(document.documentElement.dataset.pageType === "channel" && ImprovedTube.storage.channel_trailer_autoplay === false)
)
) {
setTimeout(function () {
video.pauseVideo();
});
setTimeout(function () {console.log("autoplayyOFFFF");
video.pauseVideo();
});
}
};

Expand Down Expand Up @@ -959,10 +959,10 @@ ImprovedTube.screenshot = function () {
cvs.toBlob(function (blob) {
if (ImprovedTube.storage.player_screenshot_save_as !== 'clipboard') {
var a = document.createElement('a');

console.log("screeeeeeen");
a.href = URL.createObjectURL(blob);

a.download = location.href.match(/(\?|\&)v=[^&]+/)[0].substr(3) + '-' + new Date(ImprovedTube.elements.player.getCurrentTime() * 1000).toISOString().substr(11, 8).replace(/:/g, '-') + '.png';
a.download = location.href.match(/(\?|\&)v=[^&]+/)[0].substr(3) || location.href.match(/()embed\/[^&]+/)[0].substr(3) || improvedTube.videoID || location.href.match + '-' + new Date(ImprovedTube.elements.player.getCurrentTime() * 1000).toISOString().substr(11, 8).replace(/:/g, '-') + '.png';

a.click();
} else {
Expand Down
9 changes: 7 additions & 2 deletions menu/skeleton-parts/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,15 +854,20 @@ extension.skeleton.main.layers.section.appearance.on.click.sidebar = {
text: 'Transcript',
value: false,
storage: 'transcript',
id: 'transcript',
on: { click: function () { setTimeout(() => {
if (satus.storage.get('transcript')) {
if (satus.storage.get('no_page_margin')) {
this.nextSibling.click();
this.nextSibling.nextSibling.click();
}
}
}, "250"); }
}
},
compactSpacing: {
component: "switch",
text: "Compact spacing",
},
no_page_margin: {
component: 'switch',
text: 'To the side! (No page margin)',
Expand All @@ -871,7 +876,7 @@ extension.skeleton.main.layers.section.appearance.on.click.sidebar = {
click: function () { setTimeout(() => {
if (satus.storage.get('no_page_margin')) {
if (satus.storage.get('transcript')) {
this.previousSibling.click();
this.previousSibling.previousSibling.click();
}
}
}, "250"); }
Expand Down
40 changes: 39 additions & 1 deletion menu/skeleton-parts/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,25 @@ extension.skeleton.main.layers.section.general = {
}
]
},
ads: {
text: 'ads',
component: 'select',
options: [{
text: 'onAllVideos',
value: 'all_videos',
default: 'true'
}, {
text: 'blockAll',
value: 'block_all'
}, {
text: 'blockMusic',
value: 'block_music'
}, {
text: 'onSubscribedChannels',
value: 'subscribed_channels'
}],
storage: 'ads'
},
youtube_home_page: {
component: 'select',
text: 'youtubeHomePage',
Expand Down Expand Up @@ -1077,7 +1096,26 @@ extension.skeleton.main.layers.section.general = {
component: 'switch',
text: 'removeRelatedSearchResults'
},
},
},
embed: {
component: 'section',
variant: 'card',
title: 'Emdedded Youtube',

embeddedHidePauseOverlay: {
component: 'switch',
text: 'Hide Pause Overlay',

},
embeddedHideYoutubeLogo: {
component: 'switch',
text: 'Hide YouTube Logo'
},
embeddedHideShare: {
component: 'switch',
text: "Hide 'Share'"
},
},
section_2: {
component: 'section',
variant: 'card',
Expand Down
Loading

0 comments on commit 2d849e6

Please sign in to comment.