Skip to content

Commit

Permalink
thanks to #2421 @raszpl
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed Jul 28, 2024
1 parent 5d4961f commit c25ffdb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions js&css/web-accessible/www.youtube.com/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,22 @@ ImprovedTube.commentsSidebar = function () { if (ImprovedTube.storage.comments_s
TRANSCRIPT
--------------------------------------------------------------*/
ImprovedTube.transcript = function (el) { if (ImprovedTube.storage.transcript === true) {
el.querySelector('*[target-id*=transcript]')?.removeAttribute('visibility');} }
const available = el.querySelector('[target-id*=transcript][visibility*=HIDDEN]') || el.querySelector('[target-id*=transcript]').clientHeight;
if (available) {
const descriptionTranscript = el.querySelector('ytd-video-description-transcript-section-renderer button[aria-label]');
descriptionTranscript ? descriptionTranscript.click() : el.querySelector('[target-id*=transcript]')?.removeAttribute('visibility');
}
};
/*----------------------------------------------------------------
CHAPTERS
--------------------------------------------------------------*/
ImprovedTube.chapters = function (el) { if (ImprovedTube.storage.chapters === true) {
el.querySelector('*[target-id*=chapters]')?.removeAttribute('visibility');} }
const available = el.querySelector('[target-id*=chapters][visibility*=HIDDEN]') || el.querySelector('[target-id*=chapters]').clientHeight;
if (available) {
const modernChapters = el.querySelector('[modern-chapters] #navigation-button button[aria-label]');
modernChapters ? modernChapters.click() : el.querySelector('[target-id*=chapters]')?.removeAttribute('visibility');
}
};
/*------------------------------------------------------------------------------
LIVECHAT
------------------------------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion js&css/web-accessible/www.youtube.com/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ ImprovedTube.shortcutChapters = function () {
visibilityButton ? visibilityButton.click() : document.querySelector('*[target-id*=chapters] #visibility-button button')?.click();
}
if (!modernChapters && visibilityButton) {
console.error('shortcutChapters: Cant fint proper Enble button, falling back to unreliable bruteforce method');
console.error('shortcutChapters: Cant fint proper Enable button, falling back to unreliable bruteforce method');
}
};
/*------Transcript------*/
Expand Down

0 comments on commit c25ffdb

Please sign in to comment.