Skip to content

Instantly share code, notes, and snippets.

@Klaster1
Last active August 2, 2020 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Klaster1/e14c2ad40386c7c55c5c5411a06fee88 to your computer and use it in GitHub Desktop.
Save Klaster1/e14c2ad40386c7c55c5c5411a06fee88 to your computer and use it in GitHub Desktop.
Weight Weenies other report reasons
// ==UserScript==
// @name Weight Weenies report reasons
// @description Adds more predefined report reasons.
// @version 1.0
// @author Klaster_1
// @match https://weightweenies.starbike.com/forum/app.php/post/*/report
// @grant none
// @icon http://weightweenies.starbike.com/images/weenie.gif
// @downloadURL https://gist.githubusercontent.com/Klaster1/e14c2ad40386c7c55c5c5411a06fee88/raw/ww_fast_unreads.user.js
// @updateURL https://gist.githubusercontent.com/Klaster1/e14c2ad40386c7c55c5c5411a06fee88/raw/ww_fast_unreads.user.js
// ==/UserScript==
const furtherInfo = document.querySelector('textarea[name="report_text"]')
const select = document.querySelector('select[name="reason_id"]')
const option = document.createElement('option')
const doublepostLabel = "Other » Double post"
const furtherInfos = {
[doublepostLabel]: 'Double post.'
}
option.value = '4'
option.innerText = doublepostLabel
select.appendChild(option)
select.addEventListener('change', e => {
const reason = e.target.selectedOptions[0]?.innerText
if (reason) furtherInfo.value = furtherInfos[e.target.selectedOptions[0]?.innerText]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment