Script for Autofilling Your Username When Voting

Discussion in 'Player Guides, Tips and Tricks' started by Pokku8, Feb 20, 2019.

  1. Greetings!

    If you find voting for EMC a chore because you need to fill your username for each website after the first three ones, this guide should help you save time.

    I have written a short script that autofills your username on the voting websites that don't do it automatically from the link. It also rates EMC 5/5 stars on Minecraft-Server.net. While the script is very barebones, it gets the job done.

    Instructions:
    1. Install the Tampermonkey extension for your browser. You can find the link appropriate for your browser at https://tampermonkey.net/. It's a generic extension that allows you to install various scripts.
    2. Access Tampermonkey's Dashboard by clicking on the extension icon in the toolbar and choosing Dashboard. This will open a view with your currently installed scripts (which should be empty if you just installed the extension).
    3. Click the + icon left from the "Installed userscripts" tab to create a new script. Copy the following code (replacing the default template):
      Code:
      // ==UserScript==
             // @name        Autofill username in EMC vote forms
             // @version      1.02
             // @description  Autofill your Minecraft username in the forms of websites when voting for Empire Minecraft
             // @author      Pokku8
             // By class:
             // @match        https://minecraft-server.net/vote/Aikar/
             // @match        https://minecraftservers100.com/vote/112
             // @match        https://minecraftservers.biz/empire-minecraft/
             // @match        https://minecraftservers.org/vote/134885
             // By name:
             // @match        https://www.planetminecraft.com/server/empire-minecraft-2906938/vote/
             // @match        https://minecraft-server-list.com/server/240530/vote/
             // @grant        none
             // ==/UserScript==
             
             (function() {
                 'use strict';
                 // Fill username
                 var usernameForm = document.querySelectorAll('.form-control, .sm-form-control, .form-input, [name="mcname"], [name="ign"]');
                 for (var i = 0; i < usernameForm.length; i++) {
                     usernameForm[i].value = 'YOURNAME'; // <--- CHANGE YOUR NAME
                 }
             
                 // Rate 5/5 on Minecraft-Server.net
                 document.getElementById('rate-10').click();
             })();
      Unfortunately, there does not seem to be syntax highlighting for JavaScipt, but feel free to review the code—you should always be wary of running scripts found on the Internet.
    4. On line 22 of the script, change YOURNAME within the single quotes to match your Minecraft username. For me, the line would then become
      Code:
      usernameForm[i].value = 'Pokku8'; // <--- CHANGE YOUR NAME
    5. Save the script with Ctrl+S (Cmd+S on Mac) or by selecting Save from the File menu.
    6. You may now close Tampermonkey's Dashboard by closing its tab. Now visiting EMC voting websites should automatically fill your username and rate 5/5 stars on Minecraft-Server.net.
    Tips & tricks:
    • For even quicker voting, I also use an extension called I'm not robot captcha clicker, which clicks the checkboxes of captchas. (It does not solve them though; it just clicks them the first time.) Since the extension does not seem to be open source, I won't link it here as I do not want to promote any commercial entities that may snoop on your browser traffic.
    • As TomvanWijnen pointed out below, bookmarking all voting websites into a folder further speeds up voting as you can then open all websites at once by right-clicking the folder and choosing "Open all" (or something similar depending on your browser).
    • This script also works on Android if you use Firefox since you can install add-ons as usual. If you want to copy the script from your computer to your phone, an easy way is to back up the script to the cloud on your PC (Tampermonkey's Dashboard > Utility tab > Cloud > Export) and then restore it on your phone (... > Cloud > Show backups > Import). However, on Android I have to solve a lot of captchas for some reason. Also note that ServerPact.com, which claims you cannot vote on mobile, works if you "Request desktop site" on Firefox.
    I might have forgotten to mention something, so comments and questions are welcome. Improvements to my JavaScript are also welcome as long as they don't overly complicate it. I will also try to update the script as websites change their systems.
    ThaKloned, 607, TomvanWijnen and 3 others like this.
  2. MinecraftServer.biz changed their voting link, and I have updated the script accordingly.
    Line 9 has been changed as follows:
    Code:
    < // @match https://minecraftservers.biz/empire-minecraft/vote/
    ---
    > // @match https://minecraftservers.biz/empire-minecraft/
    TomvanWijnen likes this.
  3. Is this legal
    Foxy_Kitty likes this.
  4. Wow, this is fantastic! :D I really don't understand all the complaints about how voting takes so long, as it generally takes me less than a minute each day to vote on all 9 sites, but this is great to have and will definitely help speed that up even more (putting all links in a bookmark that you can "open all sites at once" is a also a great tip)! :D Especially for that pesky 4th site, where you have to move your hand from your mouse to your keyboard (I'm usually lazy and have my left hand far from my keyboard while voting :p) to type the first letter for the auto suggestion to pop up... :p

    As I vote for different accounts on each site, I created 6 scripts to reflect that behaviour. I'm really looking forward to making good use out of this in the future, thanks a lot! :)
    607 and Pokku8 like this.
  5. it is in kittyland.
    Pokku8 likes this.
  6. Thanks for the feedback! Bookmarking the websites into a folder is indeed a great tip. I have it like that in one browser I use, but I forgot to mention it in the post so I'll add it. I hadn't thought about multiple accounts, but I guess this kind of script avoids misclicks with the drop-down suggestions. It's nice to hear that you could build upon this to make it more suitable for you thanks to the open source approach!
    607 and TomvanWijnen like this.
  7. I have been using this for months without any repercussions, so I consider it "legal" or at least unnoticeable if it's not :D
    TomvanWijnen likes this.
  8. That is cool!
    Doesn't the "I'm not robot captcha clicker" actually lose time in the long run, though? I imagine that if you use the extension, you'll actually have to do the captchas most of the time. Or does it still trust you?
    Pokku8 likes this.
  9. I tried it twice, the first time was beautiful, the second time it sucked more than a black hole, and the third time I had already deleted the extension. :D
    607 likes this.
  10. It actually does trust me as long as I'm logged in to my Google account (which drastically reduces captchas to solve even without the extension). Usually I have 0–4 captchas I would need to solve, but by (i) voting first for the sites that just accept the captcha without additional proof and then (ii) refreshing the sites that initially wanted me to solve a captcha, I usually get away without solving any captchas. Sometimes as an alternative to (i), I solve the captcha on one site and then refresh the other picky ones, at which point they no longer ask to solve a captcha.

    So in my case, I haven't noticed any difference between using the extension and clicking the captchas myself given that I'm logged in to Google.
    607 likes this.
  11. MinecraftServers100 is now using HTTPS rather than HTTP. Line 8 has been updated accordingly:
    Code:
    < // @match        http://minecraftservers100.com/vote/112
    ---
    > // @match        https://minecraftservers100.com/vote/112