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()) {
list.removeChild(list.firstChild)
}
res.instances.map((instance, index) => {
res.instances.map(function (instance, index) {
var li = document.createElement('li'),
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>',
@ -121,7 +121,7 @@ document.addEventListener('DOMContentLoaded', function () {
hold = true
listinstance(content, ac)
} else if (content.length > 0 && hold) {
timeout = setTimeout(() => {
timeout = setTimeout(function () {
listinstance(content, ac)
}, 300)
}
@ -135,7 +135,7 @@ document.addEventListener('DOMContentLoaded', function () {
while (list.hasChildNodes()) {
list.removeChild(list.firstChild)
}
res.instances.map(r => {
res.instances.map(function (r) {
var li = document.createElement('li')
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>' : '')
@ -162,7 +162,7 @@ document.addEventListener('DOMContentLoaded', function () {
var res = await result.json()
if (res.blocks && Array.isArray(res.blocks) && res.blocks.length > 0) {
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'),
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>',
@ -215,7 +215,9 @@ document.addEventListener('DOMContentLoaded', function () {
})
var placeholder = document.getElementById('placeholder')
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 {
placeholder.innerText = ''
}
@ -238,7 +240,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
document.getElementById('loader-content').style.display = 'none'
hold = false
}).catch(err => {
}).catch(function (err) {
// console.error(err)
document.getElementById('loader-content').style.display = 'none'
hold = false
@ -260,7 +262,7 @@ document.addEventListener('DOMContentLoaded', function () {
strong.appendChild(text)
li.appendChild(strong)
list.appendChild(li)
res.map((r, i) => {
res.map(function (r, i) {
var li = document.createElement('li'),
text = document.createTextNode(`${i + 1} - ${r.domain} - ${r.count} blocks`)
li.addEventListener('click', function (event) {
@ -284,7 +286,7 @@ document.addEventListener('DOMContentLoaded', function () {
placeholder.innerText = ''
hold = false
document.getElementById('loader-content').style.display = 'none'
}).catch(err => {
}).catch(function (err) {
console.error(err)
hold = false
document.getElementById('loader-content').style.display = 'none'
@ -336,7 +338,7 @@ document.addEventListener('DOMContentLoaded', function () {
var bounce = document.getElementById('bounce'),
host = new URL(window.location.href).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) {