peertube-theme-nctv-dark/peertube-plugin-akismet/client/common-client-plugin.js

35 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-09-26 09:23:26 +00:00
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;'
2022-12-06 08:58:18 +00:00
if (document.getElementById(ipMessage.id)) return
2022-09-26 09:23:26 +00:00
document.querySelector('my-video-comment-add .textarea-wrapper').append(ipMessage)
}
})
}
export {
register
}