From 9b4b078e7ddf5dc62727e7246f3cf1297b4f83a2 Mon Sep 17 00:00:00 2001 From: program think backup <103631137+hello-world-1989@users.noreply.github.com> Date: Tue, 7 May 2024 20:32:42 +1200 Subject: [PATCH] Update custom.html --- public/temp/custom.html | 43 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/public/temp/custom.html b/public/temp/custom.html index dfcd4a6..f3c1e7d 100644 --- a/public/temp/custom.html +++ b/public/temp/custom.html @@ -66,35 +66,37 @@ const dataStr = await res.text(); - console.log('data str', dataStr); + if (dataStr?.includes('Cannot GET')) { + } else { + console.log('data str', dataStr); - const dataArr = dataStr?.split('\n'); + const dataArr = dataStr?.split('\n'); - const sponsorElement = document.getElementById('sponsor-list'); + const sponsorElement = document.getElementById('sponsor-list'); - const sponsors = dataArr - ?.filter((item) => item) - .map((item, i) => { - const line = item?.split('---'); - const description = line?.[0]; - const detail = line?.[1]; + const sponsors = dataArr + ?.filter((item) => item) + .map((item, i) => { + const line = item?.split('---'); + const description = line?.[0]; + const detail = line?.[1]; - let element = `

${detail}

`; + let element = `

${detail}

`; - if ( - detail?.startsWith('http://') || - detail?.startsWith('https://') || - detail?.startsWith('/custom') - ) { - element = `${detail}`; - } + } - return `
+ return `
@@ -104,9 +106,10 @@ ${element}
`; - }); + }); - sponsorElement.innerHTML = sponsors.join(''); + sponsorElement.innerHTML = sponsors.join(''); + } } catch (err) { console.error('Error sponsor txt', err); }