Skip to content

Commit

Permalink
Merge branch 'master' into code-quality-experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
4yman-0 authored Dec 21, 2024
2 parents 632d4fc + 7b01d82 commit 27f3e44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ ImprovedTube.playerOnPause = function (event) {
};

if (document.documentElement.dataset.pageType === 'video'
&& (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript || ImprovedTube.storage.chapters)) {
ImprovedTube.forbidFocus = function (ms) {
const originalFocus = HTMLElement.prototype.focus; // Backing up default method - other methods: Element.prototype.scrollIntoView window.scrollTo window.scrollBy
&& (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript === true || ImprovedTube.storage.chapters === true )) {
ImprovedTube.forbidFocus = function (ms) {
originalFocus = HTMLElement.prototype.focus; // Backing up default method - other methods: Element.prototype.scrollIntoView window.scrollTo window.scrollBy
// Override YouTube's scroll method:
HTMLElement.prototype.focus = function () { console.log("Preventing YouTube's scripted scrolling, when expanding the video description for you"); }
if (document.hidden) ms = 3 * ms;
Expand Down
3 changes: 2 additions & 1 deletion js&css/web-accessible/www.youtube.com/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ ImprovedTube.shortcutResetPlaybackSpeed = function () {
4.7.19 GO TO SEARCH BOX
------------------------------------------------------------------------------*/
ImprovedTube.shortcutGoToSearchBox = function () {
document.querySelector('input#search')?.focus();
if (originalFocus) { HTMLElement.prototype.focus = originalFocus }
document.querySelector('input#search')?.focus(); //alternatively .click()
};
/*------------------------------------------------------------------------------
4.7.20 ACTIVATE FULLSCREEN
Expand Down

0 comments on commit 27f3e44

Please sign in to comment.