YouTube - automatically expand subscription list

Automatically click the "Show More" subscriptions button in the side bar

< Feedback on YouTube - automatically expand subscription list

प्रश्न/टिप्पणी

§
पोस्ट केले: 2022-11-06
संपादित केले: 2022-11-06

I have a fix for the issue on Chrome if you want to take a look, instead of using window.addEventListener("loadstart", expandSubscriptions, true); we can use a Promise instead to wait for the DOM to load


// Wait for DOM to find elements
function waitForDOM(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}

const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
}
});

observer.observe(document.body, {
childList: true,
subtree: true
});
});
}

// Execute function
waitForDOM('ytd-guide-section-renderer').then((target) => {
expandSubscriptions()
});

valacarलेखक
§
पोस्ट केले: 2022-12-08
संपादित केले: 2022-12-08

Thanks, I've updated it (0.1.7) based on your code. I just used the MutationObserver part of it.

Also, sorry for the really late reply... Gmail decided to mark emails from greasyfork as spam :(

उत्तर पोस्ट करा

उत्तर पोस्ट करण्यासाठी साइन इन करा.