Last active
August 2, 2020 19:42
-
-
Save Klaster1/e14c2ad40386c7c55c5c5411a06fee88 to your computer and use it in GitHub Desktop.
Weight Weenies other report reasons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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