arrow to function
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-09-21 22:23:39 +02:00
parent 83a28e3ad3
commit 3f77fbd93d

View File

@ -44,7 +44,7 @@ document.addEventListener('DOMContentLoaded', function () {
while (list.hasChildNodes()) { while (list.hasChildNodes()) {
list.removeChild(list.firstChild) list.removeChild(list.firstChild)
} }
res.instances.map((instance, index) => { res.instances.map(function (instance, index) {
var li = document.createElement('li'), var li = document.createElement('li'),
text = document.createTextNode((index + 1) + '. '), text = document.createTextNode((index + 1) + '. '),
link = '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + instance.instance + '" onclick="window.location.href=this.href; window.location.reload(false);">' + instance.instance + '</a>', link = '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + instance.instance + '" onclick="window.location.href=this.href; window.location.reload(false);">' + instance.instance + '</a>',
@ -121,7 +121,7 @@ document.addEventListener('DOMContentLoaded', function () {
hold = true hold = true
listinstance(content, ac) listinstance(content, ac)
} else if (content.length > 0 && hold) { } else if (content.length > 0 && hold) {
timeout = setTimeout(() => { timeout = setTimeout(function () {
listinstance(content, ac) listinstance(content, ac)
}, 300) }, 300)
} }
@ -135,7 +135,7 @@ document.addEventListener('DOMContentLoaded', function () {
while (list.hasChildNodes()) { while (list.hasChildNodes()) {
list.removeChild(list.firstChild) list.removeChild(list.firstChild)
} }
res.instances.map(r => { res.instances.map(function (r) {
var li = document.createElement('li') var li = document.createElement('li')
li.innerHTML = r.domain + (r.blocks ? ' - ' + r.blocks + ' blocks' : '') li.innerHTML = r.domain + (r.blocks ? ' - ' + r.blocks + ' blocks' : '')
+ (r.nodeinfo ? ' <a href="/api/detail_nodeinfo/' + r.domain + '" title="Nodeinfo for ' + r.domain + '" target="_blank">&#9432;</a>' : '') + (r.nodeinfo ? ' <a href="/api/detail_nodeinfo/' + r.domain + '" title="Nodeinfo for ' + r.domain + '" target="_blank">&#9432;</a>' : '')
@ -162,7 +162,7 @@ document.addEventListener('DOMContentLoaded', function () {
var res = await result.json() var res = await result.json()
if (res.blocks && Array.isArray(res.blocks) && res.blocks.length > 0) { if (res.blocks && Array.isArray(res.blocks) && res.blocks.length > 0) {
var csv = '#domain,#severity,#reject_media,#reject_reports,#public_comment,#obfuscate\n' var csv = '#domain,#severity,#reject_media,#reject_reports,#public_comment,#obfuscate\n'
res.blocks.map((r, i) => { res.blocks.map(function (r, i) {
var liblock = document.createElement('li'), var liblock = document.createElement('li'),
text = document.createTextNode((i + 1) + '. '), text = document.createTextNode((i + 1) + '. '),
link = '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + r.domain + '" onclick="window.location.href=this.href; window.location.reload(false);">' + r.domain + '</a>', link = '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + r.domain + '" onclick="window.location.href=this.href; window.location.reload(false);">' + r.domain + '</a>',
@ -215,7 +215,9 @@ document.addEventListener('DOMContentLoaded', function () {
}) })
var placeholder = document.getElementById('placeholder') var placeholder = document.getElementById('placeholder')
if (res.suggests.length > 0) { if (res.suggests.length > 0) {
placeholder.innerHTML = res.suggests.map(instance => '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + instance + '" onclick="suggest(this.innerText);">' + instance + '</a>').join(', ') placeholder.innerHTML = res.suggests.map(function (instance) {
return '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + instance + '" onclick="suggest(this.innerText);">' + instance + '</a>'
}).join(', ')
} else { } else {
placeholder.innerText = '' placeholder.innerText = ''
} }
@ -238,7 +240,7 @@ document.addEventListener('DOMContentLoaded', function () {
} }
document.getElementById('loader-content').style.display = 'none' document.getElementById('loader-content').style.display = 'none'
hold = false hold = false
}).catch(err => { }).catch(function (err) {
// console.error(err) // console.error(err)
document.getElementById('loader-content').style.display = 'none' document.getElementById('loader-content').style.display = 'none'
hold = false hold = false
@ -260,7 +262,7 @@ document.addEventListener('DOMContentLoaded', function () {
strong.appendChild(text) strong.appendChild(text)
li.appendChild(strong) li.appendChild(strong)
list.appendChild(li) list.appendChild(li)
res.map((r, i) => { res.map(function (r, i) {
var li = document.createElement('li'), var li = document.createElement('li'),
text = document.createTextNode(`${i + 1} - ${r.domain} - ${r.count} blocks`) text = document.createTextNode(`${i + 1} - ${r.domain} - ${r.count} blocks`)
li.addEventListener('click', function (event) { li.addEventListener('click', function (event) {
@ -284,7 +286,7 @@ document.addEventListener('DOMContentLoaded', function () {
placeholder.innerText = '' placeholder.innerText = ''
hold = false hold = false
document.getElementById('loader-content').style.display = 'none' document.getElementById('loader-content').style.display = 'none'
}).catch(err => { }).catch(function (err) {
console.error(err) console.error(err)
hold = false hold = false
document.getElementById('loader-content').style.display = 'none' document.getElementById('loader-content').style.display = 'none'
@ -336,7 +338,7 @@ document.addEventListener('DOMContentLoaded', function () {
var bounce = document.getElementById('bounce'), var bounce = document.getElementById('bounce'),
host = new URL(window.location.href).host host = new URL(window.location.href).host
reg = '(<\/?p>|(https?:\/\/)?' + host + ')' reg = '(<\/?p>|(https?:\/\/)?' + host + ')'
bounce.innerHTML = res.map(p => `${p.content.replace(new RegExp(reg, 'igm'), '')} ${dayjs().to(p.published)}`).join(' | ') bounce.innerHTML = res.map(function (p) { return `${p.content.replace(new RegExp(reg, 'igm'), '')} ${dayjs().to(p.published)}` }).join(' | ')
} }
}) })
fetch('/api/served').then(async function (result) { fetch('/api/served').then(async function (result) {