javascript:(function() { /* Global variables. */ var expandButtonYouTubeTopSubscriptionToggleBtn = /* show more */ document.querySelector('ytd-guide-entry-renderer#expander-item[role="button"]'); var collapseButtonYouTubeTopSubscriptionToggleBtn = /* show less */ document.querySelector('ytd-guide-entry-renderer#collapser-item[role="button"]'); var idYouTubeTopSubscriptionToggleBtn = /* prevent duplicates */ document.getElementById("idYouTubeTopSubscriptionToggleBtn"); /********************************************************************************************* MAIN FUNCTION *********************************************************************************************/ function runYouTubeTopSubscriptionToggleBtn() { if (expandButtonYouTubeTopSubscriptionToggleBtn && !idYouTubeTopSubscriptionToggleBtn) { /* add button */ let clonedButton = document.createElement("button"); let clonedTextA = document.createElement("span"); let clonedTextB = document.createElement("span"); /* mimic current toggle button */ clonedButton.setAttribute("class", "title style-scope ytd-guide-entry-renderer"); clonedButton.setAttribute("style", "background: none; border: none; cursor: pointer"); clonedButton.setAttribute("data-toggle", "0"); clonedButton.setAttribute("id", "idYouTubeTopSubscriptionToggleBtn"); /* add text */ clonedTextA.innerText = "v "; clonedTextB.innerText = "Show More"; clonedTextA.setAttribute("style", "margin-left: 15px; font-family: monospace; " + "font-stretch: extra-expanded;font-weight: bold; font-size: larger;" ); clonedTextB.setAttribute("style", "margin-left: 20px; font-weight: 500"); clonedTextB.setAttribute("id", "idTextYouTubeTopSubscriptionToggleBtn"); clonedButton.insertAdjacentElement("afterbegin", clonedTextA); clonedButton.insertAdjacentElement("beforeend", clonedTextB); /* Attach event listener to the cloned button to trigger the original button's click */ clonedButton.addEventListener('click', () => { if (clonedButton.getAttribute("data-toggle") == "0") { expandButtonYouTubeTopSubscriptionToggleBtn.click(); /* update mimic data */ clonedButton.children[0].innerText = "^ "; clonedButton.children[1].innerText = "Show Less"; /* toggle switch attribute */ clonedButton.setAttribute("data-toggle", "1"); } else { collapseButtonYouTubeTopSubscriptionToggleBtn.click(); /* update mimic data */ clonedButton.children[0].innerText = "v "; clonedButton.children[1].innerText = "Show More"; /* toggle switch attribute */ clonedButton.setAttribute("data-toggle", "0"); } }); /* find the container where you want to insert the new button */ let subscriptions = /* HOT-GLUE - assumes index 0 */ document.getElementsByTagName("ytd-guide-collapsible-section-entry-renderer"); if (subscriptions[0]) { /* insert the cloned button as the first child of ytd-app */ subscriptions[0].insertAdjacentElement("afterbegin", clonedButton); console.log('Duplicated "Show More" button added successfully!'); } else { console.error('Could not find ytd-app element to insert the cloned button.'); } } else { console.error('Original "Show More" button not found.'); } } /* Run bookmarklet. */ runYouTubeTopSubscriptionToggleBtn(); })();