mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-25 17:08:52 +01:00
remove useless code
This commit is contained in:
parent
c08ae8dce4
commit
0c2c264204
1 changed files with 1 additions and 46 deletions
|
@ -1312,52 +1312,7 @@ width: fit-content;
|
|||
|
||||
<script src="/css/custom-css.js"> </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>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue