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 reads your username when you visit EMC's voting page and autofills it on the voting websites that don't do it automatically from the link. It also rates EMC 5/5 stars on Minecraft-Server.net.

    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 53 lines of code available on GitHub (replacing the default template): https://github.com/Pokku3/emc-voting-username-script/blob/master/userscript.js (if you are looking for the old simple version, see here)
    4. Save the script with Ctrl+S (Cmd+S on Mac) or by selecting Save from the File menu.
    5. You may now close Tampermonkey's Dashboard by closing its tab.
    Now visiting the voting page here on EMC when logged in should save your username, and EMC voting websites should thereafter automatically fill in your username and rate 5/5 stars (or whatever you choose) on Minecraft-Server.net.

    A special thanks to ttyler333 for pointing out the EMC_USERNAME JavaScript variable that could be used to automatically determine your username.

    Tips & tricks:
    • On line 23 of the script, you may add a default username within the single quotes to match your Minecraft username in case you are not always logged in, as visiting the EMC voting page would in that case clear the name from storage. For me, the line would then become
      Code:
      var DEFAULT_USERNAME = 'Pokku8'; // <--- Feel free to add a default username wihin the quotes 
      This flowchart clarifies how the script exactly determines the username to be filled in.
    • As wafflecoffee pointed out, the simple legacy version may be more convenient if you want to create multiple copies of the script to vote with a specific account on a specific website (credit for the screenshot to wafflecoffee). In that case, only keep one @match line corresponding to the voting website (from lines 7-14) and write the username of your choice on line 23, and create copies in this fashion for each website.
    • If you'd rather give some other rating than 5/5 stars on Minecraft-Server.net, feel free to change 'rate-10' on the second last line
      Code:
      document.getElementById('rate-10').click();
      to 'rate-9' for a 4.5/5 rating, 'rate-8' for a 4/5 rating, etc.
      If you instead wish to disable the automatic rating clicking altogether, you may comment out (=ignore) the line by prepending two slashes like this:

      Code:
      // document.getElementById('rate-10').click();
    • 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).
    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.
  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
    Joy_the_Miner and Kaddrii like 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! :)
    Egeau, 607 and Pokku8 like this.
  5. it is in kittyland.
    wafflecoffee and Pokku8 like 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
    TomvanWijnen likes this.
  12. Minecraft-Server-List.com changed the name used to specify their input field. Line 20 has been updated accordingly:
    Code:
    <    var usernameForm = document.querySelectorAll('.form-control, .sm-form-control, .form-input, [name="mcname"], [name="ign"]');
    ---
    >    var usernameForm = document.querySelectorAll('.form-control, .sm-form-control, .form-input, [name="mcname"], [name="ignn"]');
    (One extra "n" to "ign" at the end of the line. Feel free to add it yourself manually if you find it convenient.)
    TomvanWijnen and 607 like this.
  13. TopG.org has stopped autofilling the username automatically from the link, so it has been added to the script (after line 6 in the previous version, now on line 7).
    Code:
    > // @match        https://topg.org/Minecraft/in-355353*
    Additionally MinecraftServers100 sometimes extends the link with some DDoS protection(?) parameters when opened in the background (like I do when opening all links from a bookmarks folder), so I have added an asterisk to the URL in the script to match any relevant URLs. (Formerly line 8, now 9.)
    Code:
    < // @match        https://minecraftservers100.com/vote/112
    ---
    > // @match        https://minecraftservers100.com/vote/112*
  14. Hmmm, A friend recommended this and just to clarify it just fills in the usernames right?


  15. Impulsive_Egg, Pokku8, Egeau and 2 others like this.
  16. IT should 100% be fine as the script doesn't automatically bypass the captcha a lot of sites use as well as auto submitting your vote.

    The only questionable part is the "auto" 5 star voting.
  17. An error measage pops up and i tried to fix it myself but i couldent but that got me intersted in coding :D
    607 likes this.
  18. By the way, greasemonkey says the script is running on every web page I visit.
    Trying tampermonkey now.

    edit: Tampermonkey functions way better. Recommend a comment stating that Greasemonkey does work, however its buggy.
  19. I've used this for more than a year, and have never had an issue with the auto 5 star thingy, it works great. :)

    I do wonder, where did you get greasemonkey from? If I read the post I only find tampermonkey. :p
    607 and Lukas3226 like this.
  20. Long time user of userscripts from eeh 2012+. Greasemonkey was on my browser and picked up the script. It's the same code but greasemonkey recommends moving to tampermonkey. As well, tampermonkey has a better UI.

    edit: As for the 5 star's... By "auto" rating something 5 stars i could see the voting site claiming its against their TOS. I never stated it didn't work. Just that is a potential issue as far as rules go.
    607 likes this.