Script for Autofilling Your Username When Voting

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

  1. I would think it very unlikely that their TOS would not appreciate auto star rating but would be fine with auto name filling. :p Neither of those tasks are meant to prove you are human, and both of those tasks are unlikely to have a different result from day to day.
    Pokku8 and ttyler333 like this.
  2. Changelogs now in this thread? Nice~
  3. Now this is what the EMC forums were made for ;)
  4. May I suggest a change to your username section. This will access the Global JS variable EMC_USERNAME. No script editing involved for the end user :).
    Code:
    usernameForm[i].value = EMC_USERNAME; // <--- CHANGE YOUR NAME
    607 likes this.
  5. Oh wow, this suddenly got a lot of attention! I'm gladly taking suggestions and I'm happy to clarify anything I can. The original post is getting quite old, so it wouldn't surprise me if the instructions start having inaccuracies beyond the code.

    Thank you very much for the suggestion! I'm trying to test it but I seem to be missing something... :oops: Where is that global variable set exactly? I can't get it to work with just that change, but such a simplification would be very welcome.

    As for the automatic rating on Minecraft-Server.net, it's pretty much what 607 said:
    (If I may rant, I have to add that I don't really understand why they introduced such a rating system in the first place. As far as I know, people can only vote for one server within a set time period, so obviously 99% of people are going to vote for their favorite server and give a 5-star rating. I can only see it as an annoyance to keep you half a second longer on their website watching ads—assuming you don't have an ad blocker.)

    Let me still add the following instructions for transparency and clarity:
    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 click altogether, you may comment out (=ignore) the line by prepending two slashes like this:
    Code:
    // document.getElementById('rate-10').click();
    607 and ttyler333 like this.
  6. if you view the pages source you'll see its defined at the top of the page. Line 6 when I view source.

    I ran a basic code in tampermonkey, however it still has the option for the username to be inputted in the quotes. But that defeats the purpose of adding the global var.
    Code:
     var username = (EMC_USERNAME === undefined ? EMC_USERNAME : "");
    alert(username);
    edit: By the way, I also added https://empireminecraft.com/wiki/vote/ to the code so that the script runs on the vote page. :)
    607 and Pokku8 like this.
  7. Ah, I see. Nice finding! Right now I'm a bit too busy to implement that (exams...) as I would need to figure out GM_setValue and GM_getValue for persistent storage including some error handling. I hope to be able to work on it in a month or two.
    ttyler333 and 607 like this.
  8. I understand. I think tampermonkey has a great library to manage setValue/getValue a little better than stock.


    With your permission I'd like to make additions to your script. Credit will be given.
    607 likes this.
  9. Sure, feel free to improve it as you see fit!
    607 and ttyler333 like this.
  10. how does one get the changes that people are making?
  11. I finally got the time to upgrade the script with the suggestion from ttyler333. :)

    Changes:
    • The code is now on GitHub for easier version management and due to the script having become longer.
    • The script now reads your username on the vote page when you are logged in. It is no longer necessary to manually edit the script, but you may add a default username (on line 23) in case you tend to load the EMC voting page when not logged in, since that clears the username from storage. Exact details on how the script determines the username to be filled are shown in this flowchart.
    • The old version of the script is available in the v1 branch of the GitHub repository in case someone has a specific use case where the new version does not work.
    • The tip for using Firefox on Android has been removed as most add-ons, including Tampermonkey, no longer work in it. Alternative solutions are welcome.
    Let me know if you encounter any bugs or if you have any other ideas for improvements!
    ttyler333 and 607 like this.
  12. Pokku8 and 607 like this.
  13. Ah I see! I was wondering how people had it actually set up when they said they used this to vote with many accounts. I'll keep the old version updated as well then ;)

    (That gives me the idea that the storage could be used to rotate a set of usernames, but that's a project for another time!)
    FadedMartian, ttyler333, 607 and 2 others like this.
  14. Looks good! ;)
  15. this looks great! I will be trying it soon

    Thank you for making this!
    607 likes this.
  16. After two years of websites remaining unchanged, TopG.org now changed their URL and the identifier for their username input field. I've updated the scripts accordingly:
    607, triphora and Tuqueque like this.