remove useless code

This commit is contained in:
Ashley 2023-11-11 13:08:10 +00:00
parent c08ae8dce4
commit 0c2c264204

View file

@ -1312,52 +1312,7 @@ width: fit-content;
<script src="/css/custom-css.js"> </script> <script src="/css/custom-css.js"> </script>
<script> <script>
// Fetch URLs and handle progress saving
const urls = document.querySelectorAll('a[href*="/watch?v="]');
const spinner = document.createElement('div');
spinner.id = 'fetch-spinner';
spinner.classList.add('hide');
document.body.appendChild(spinner);
const text = document.createElement('div');
text.id = 'fetch-text';
text.classList.add('hide');
document.body.appendChild(text);
document.body.classList.add('blur');
let fetchedCount = 0;
urls.forEach(link => {
const url = new URL(link.href);
if (url.host !== 'www.youtube.com' && url.host !== 'youtube.com' && url.host !== "redirect.poketube.fun") {
console.log(`Fetching ${url.origin}`);
spinner.classList.remove('hide');
text.classList.remove('hide');
fetch(url.href)
.then(response => {
if (response.status === 500) {
// do nothing
}
console.log(`Fetched ${url.origin}`);
fetchedCount++;
console.clear()
if (fetchedCount === urls.length) {
spinner.classList.add('hide');
text.classList.add('hide');
document.body.classList.remove('blur');
}
})
.catch(error => {
spinner.classList.add('hide');
text.classList.add('hide');
console.clear()
if (!(error instanceof TypeError && error.message.includes('Failed to fetch'))) {
console.error(`Error fetching ${url.origin}: ${error}`);
}
});
}
});
</script> </script>
</body> </body>