Server voting

I accidentally lost the code for voting pop up windows while editing my welcome message. Can someone please post the html code?

What is that even for? I have my own server and now I feel like voting is for something important.

1 Like

It’s for fun. Like a server competition.

Ohhh I see, whenever that message pops up it annoys the crap outa me so I just click cancel lol

1 Like

You can get it back when you view your server on blockheadsfans.com. :slight_smile:

It’s under the “join pop up goodies” tab

1 Like

Thank you so much!

1 Like

It annoys me too.

You can use this one instead if you want players to only vote when they can again. That way the popups don’t show every time you join the server.

Bibliophile made it, so credit to him. If you use this, make sure you edit the URL so it goes to your server instead of the one it’s on now.

    //Set this to the message which will be displayed asking players to vote
    var votemessage = "Please vote for the server!";
    //Set this to the number of hours until server members are prompted to vote for your server again, if they voted already
    var hours = 6;
    //Set this to the URL of your voting page.
    var url = "http://blockheadsfans.com/servers/vote.php?id=7894";
    //Set this to a message to display if the user has voted in the past x days, can be left blank
    var tymessage = "";
    
    //Implementation -- You probably don't need to change stuff below here.
    function setCookie(cname,cvalue,hours) {
        var d = new Date();
        d.setTime(d.getTime() + (hours*60*60*1000));
        var expires = "expires=" + d.toGMTString();
        document.cookie = cname+"="+cvalue+"; "+expires;
    }
    
    function getCookie(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for(var i=0; i<ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1);
            if (c.indexOf(name) == 0) {
                return c.substring(name.length, c.length);
            }
        }
        return "";
    }
    
    function checkVote() {
        var voteCheck = getCookie(document.title);
        if (voteCheck != "") {
            //Display if the user has voted
            if (tymessage != "") {
                 document.getElementById("tymessage").textContent = tymessage;
            } else {
                document.getElementById("tymessage").style.display = "none";
            }
        } else {
            //If the user agrees to vote send them to the vote page and set the day cookie
            if (confirm(votemessage)) {
                setCookie(document.title, "true", hours);
                location.assign(url);
            }
        }
    }
    addEventListener('load', checkVote);
</script>```
3 Likes