Skip to content

Instantly share code, notes, and snippets.

@AliceDTRH
Last active May 10, 2022 15:10
Show Gist options
  • Save AliceDTRH/f1d5f35156865e67f382178cdfd41020 to your computer and use it in GitHub Desktop.
Save AliceDTRH/f1d5f35156865e67f382178cdfd41020 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Username autofill for stoneheart votesites
// @namespace https://alicedtrh.xyz/stoneheart-vote
// @version 0.1
// @description Automatically gets voting websites ready for voting.
// @author AliceDTRH
// @match https://best-minecraft-servers.co/server-stoneheart.4203/vote
// @match https://minecraftservers.org/vote/629851
// @match https://minecraft-server.net/vote/StoneHeart/
// @match https://minecraft-server-list.com/server/460764/vote/
// @match https://www.planetminecraft.com/server/stoneheart/vote/
// @match https://topminecraftservers.org/vote/24904
// @match https://minecraft-mp.com/server/299470/vote/
// @match https://minecraft-statistic.net/en/server/Stoneheart.html
// @match https://topg.org/minecraft-servers/server-639598
// @match https://craftlist.org/stoneheart
// @match https://minecraft.buzz/vote/4021
// @icon https://www.google.com/s2/favicons?sz=64&domain=votemc.github.io
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
const username = "REPLACEME";
let selector = 'input[name="username"]';
if(window.location.host == "minecraft-server.net") {
selector = 'input#mc_user';
}
if(window.location.host == "minecraft-server-list.com") {
selector = 'input#ignn';
}
if(window.location.host == "www.planetminecraft.com") {
selector = 'input[name="mcname"]';
}
if(window.location.host == "craftlist.org") {
document.querySelector("#voteModal").style.display = "block";
selector = "input#frm-voteForm-nickName";
}
if(window.location.host == "topg.org") {
selector = "input#game_user";
}
if(window.location.host == "minecraft-mp.com") {
selector = "input#nickname";
}
if(window.location.host == "topminecraftserver.org") {
selector = "input#username";
}
if(username == "REPLACEME") {
alert("You didn't change the username in the script...");
}
let result = document.querySelector(selector);
if(result == null) {
console.error(document.location.host + ": Didn't find username input");
return;
}
result.value = username;
result.scrollIntoView();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment