Created
May 17, 2022 07:27
-
-
Save TheDcoder/56fea4c684adc00ce330d5de70697e9a to your computer and use it in GitHub Desktop.
GOG Abolish Reputation System
This file contains 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 GOG Abolish Reputation System | |
// @author TheDcoder@protonmail.com | |
// @description Abolish GOG forum's reputation system | |
// @version 1.0 | |
// @namespace Violentmonkey Scripts | |
// @match http*://www.gog.com/forum/*/* | |
// @grant GM_addStyle | |
// @grant GM_registerMenuCommand | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @grant GM_notification | |
// ==/UserScript== | |
const NO_REP_CSS = | |
` | |
.big_user_info .b_u_rep .xywka, | |
.big_user_info .b_u_rep .t_u_stars_p, | |
.post_rate_red, .post_rate_green, | |
.rate_this_post_h_EN { | |
display: none; | |
} | |
.replay_h_EN { | |
right: 0 !important; | |
} | |
`; | |
const PROTEST_SIGNATURE = '[url=https://en.wikipedia.org/wiki/Bullying]✊[/url]'; | |
const OPTIONS = { | |
ADD_SIG: { | |
name: "Protest Signature", | |
key: 'add_signature', | |
def: true, | |
}, | |
}; | |
[ | |
OPTIONS.ADD_SIG, | |
].forEach(opt => { | |
GM_registerMenuCommand(`Toggle ${opt.name.toLowerCase()}`, () => { | |
toggle_option(opt); | |
}); | |
}); | |
if (window.location.pathname == '/forum/ajax/popUp') { | |
main_post(); | |
} else { | |
main_thread(); | |
} | |
async function main_post() { | |
var enabled = await get_option(OPTIONS.ADD_SIG); | |
if (!enabled) return; | |
var textarea = document.getElementById('text'); | |
textarea.value += '\n\n' + PROTEST_SIGNATURE; | |
} | |
async function main_thread() { | |
GM_addStyle(NO_REP_CSS); | |
} | |
async function get_option(opt) { | |
return await GM_getValue(opt.key, opt.def); | |
} | |
async function toggle_option(opt) { | |
var value = await GM_getValue(opt.key, opt.def); | |
value = !value; | |
await GM_setValue(opt.key, value); | |
notify_user(`${opt.name} has been ${value ? 'enabled' : 'disabled'}!`); | |
} | |
async function notify_user(msg) { | |
GM_notification({ | |
title: "GOG Abolish REP", | |
text: msg, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment