Created
October 14, 2025 19:39
-
-
Save jhauga/f7be2360de10033c2bccfc8cec76b23c to your computer and use it in GitHub Desktop.
Bookmarklet - use this bookmarklet for Hide short watch history on YouTube history feed. Ensure to copy/paste the top condensed line of the bookmarklet. Info at "https://github.com/isocialPractice/bookmarklets".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// *********************************************************** /// | |
| // ****************** BROWSER BOOKMARKLET GIST ***************** // | |
| // ************************************************************* // | |
| // // | |
| // LICENSE ///////////////////////////////////////////////////// | |
| // ******* // | |
| // The code in this gist is public domain. // | |
| // Licensed as Public Domain CC0 // | |
| ////////////////////////////////////////////////////////////////// | |
| // | |
| // COPY / PAST BELOW LINE TO USE | |
| javascript:(function() { /* Global variables. */ var shortParentHideShortHistroy = /* select parent tag of short history */ "ytd-reel-shelf-renderer"; var docBodyHideShortHistory = /* select the documen body tag */ document.getElementsByTagName("body"); var styleHideShortHistory = /* style to add to page */ ` ${shortParentHideShortHistroy} { display: none; } `; /* To ensure current page in browse is youtube history */ var currentPageHideShortHistory = location.href.toLowerCase(); var historyHideShortHistory = /* ensure on history page */ "youtube.com/feed/history"; /************************************* SUPPORT FUNCTIONS *************************************/ /* Ensure current page is youtube history. */ const checkIfYouTubeHistoryHideShortHistory = () => { if (currentPageHideShortHistory.indexOf(historyHideShortHistory) > -1) { return true; } else { return false; } }; /* Add style element to page. */ const addStyleTagHideShortHistory = () => { let doc = docBodyHideShortHistory[0]; /* body element */ let sTag = document.createElement("style"); /* create sytle tag */ sTag.innerText = styleHideShortHistory; /* use data from variable */ /* insert into page */ doc.insertAdjacentElement("afterbegin", sTag); }; /********************************************************************************************* MAIN FUNCTION *********************************************************************************************/ function hideShortHistory() { /* check if current page is history feed */ if (checkIfYouTubeHistoryHideShortHistory() == true) { /* on history continue bookmarklet */ setTimeout(addStyleTagHideShortHistory, 100); /* delay a bit */ } else { /* do nothing */ let skip; } } /* Call main function. */ hideShortHistory();})(); | |
| // MAKE ANY EDITS AS NEEDED | |
| // ************************************************************* | |
| // Use the JS Formatted Bookmarklet below to see if any changes | |
| // need to be made in accordance to the page you want to use | |
| // it for. After making needed changes ensure that the revised | |
| // bookmarklet is condensed before using it in your browser. | |
| // For more info on this bookmarklet visit: | |
| // https://github.com/isocialPractice/bookmarklets | |
| // ************************************************************* | |
| // ************************************************************* | |
| // ************************JS-FORMATTED************************* | |
| javascript:(function() { | |
| /* Global variables. */ | |
| var shortParentHideShortHistroy = /* select parent tag of short history */ | |
| "ytd-reel-shelf-renderer"; | |
| var docBodyHideShortHistory = /* select the documen body tag */ | |
| document.getElementsByTagName("body"); | |
| var styleHideShortHistory = /* style to add to page */ | |
| ` | |
| ${shortParentHideShortHistroy} { | |
| display: none; | |
| } | |
| `; | |
| /* To ensure current page in browse is youtube history */ | |
| var currentPageHideShortHistory = | |
| location.href.toLowerCase(); | |
| var historyHideShortHistory = /* ensure on history page */ | |
| "youtube.com/feed/history"; | |
| /************************************* SUPPORT FUNCTIONS *************************************/ | |
| /* Ensure current page is youtube history. */ | |
| const checkIfYouTubeHistoryHideShortHistory = () => { | |
| if (currentPageHideShortHistory.indexOf(historyHideShortHistory) > -1) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| }; | |
| /* Add style element to page. */ | |
| const addStyleTagHideShortHistory = () => { | |
| let doc = docBodyHideShortHistory[0]; /* body element */ | |
| let sTag = document.createElement("style"); /* create sytle tag */ | |
| sTag.innerText = styleHideShortHistory; /* use data from variable */ | |
| /* insert into page */ | |
| doc.insertAdjacentElement("afterbegin", sTag); | |
| }; | |
| /********************************************************************************************* | |
| MAIN FUNCTION | |
| *********************************************************************************************/ | |
| function hideShortHistory() { | |
| /* check if current page is history feed */ | |
| if (checkIfYouTubeHistoryHideShortHistory() == true) { | |
| /* on history continue bookmarklet */ | |
| setTimeout(addStyleTagHideShortHistory, 100); /* delay a bit */ | |
| } else { | |
| /* do nothing */ | |
| let skip; | |
| } | |
| } | |
| /* Call main function. */ | |
| hideShortHistory(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment