peertube-theme-nctv-dark/peertube-plugin-akismet/client/common-client-plugin.js
2022-12-06 09:58:18 +01:00

35 lines
1.1 KiB
JavaScript

async function register ({ registerHook, peertubeHelpers }) {
const htmlWarning = await peertubeHelpers.translate('Your IP address will be sent to the <a href="https://akismet.com/">Akismet antispam service</a> to check SPAM on this website.')
registerHook({
target: 'filter:signup.instance-about-plugin-panels.create.result',
handler: async result => {
return result.concat([
{
id: 'askismet',
title: await peertubeHelpers.translate('Policy regarding your IP address and Akismet'),
html: htmlWarning
}
])
}
})
registerHook({
target: 'action:video-watch.video-threads.loaded',
handler: async () => {
const ipMessage = document.createElement('div')
ipMessage.id = 'comment-add-akismet-warning'
ipMessage.innerHTML = htmlWarning
ipMessage.style = 'margin: 10px 0; font-size: 0.9em;'
if (document.getElementById(ipMessage.id)) return
document.querySelector('my-video-comment-add .textarea-wrapper').append(ipMessage)
}
})
}
export {
register
}