Mood

Go down

Mood

Post by ryan09 on Sat May 16, 2009 9:31 am

(For Admins)

Ok i am good with PC and one of my mates is too, we each made out own little mood program, mine came out best so im putting it here to see if you would like to use it!
_______
The folowing script is coded- Instructions on how to use are at the bottom
_______


Code:
<script type="text/javascript">
<!--
/********************************************
*
* Mood Hack (Smiley Version)
*
* Created By Ryan09
*
* This script can not be redistributed without
* permission from the creator.
*
* Copyright © 2009 - 2010
*
*
*
* All rights reserved
*
*********************************************/

// Should staff be the only ones to set this?

var pv_mood_staff = false;

// Change the options here, you can add more if needed

var pv_mood_options = [
    ["http://s2.images.proboards.com/smiley.gif", "Smiley"],
    ["http://s2.images.proboards.com/wink.gif", "Wink"],
    ["http://s2.images.proboards.com/cheesy.gif", "Cheesy"],
    ["http://s2.images.proboards.com/grin.gif", "Grin"],
    ["http://s2.images.proboards.com/angry.gif", "Angry"],
    ["http://s2.images.proboards.com/sad.gif", "Sad"],
    ["http://s2.images.proboards.com/shocked.gif", "Shocked"],
    ["http://s2.images.proboards.com/cool.gif", "Cool"],
    ["http://s2.images.proboards.com/huh.gif", "Huh"],
    ["http://s2.images.proboards.com/rolleyes.gif", "Roll Eyes"],
    ["http://s2.images.proboards.com/tongue.gif", "Tongue"],
    ["http://s2.images.proboards.com/embarassed.gif", "Embarrassed"],
    ["http://s2.images.proboards.com/lipsrsealed.gif", "Lips Are Sealed"],
    ["http://s2.images.proboards.com/undecided.gif", "Undecided"],
    ["http://s2.images.proboards.com/kiss.gif", "Kiss"],
    ["http://s2.images.proboards.com/cry.gif", "Cry"]
];

var pv_mood = {

    selected: 0,

    field: ((pv_mood_staff)? "customtitle" : "location"),

    init: function(){
        if(location.href.match(/=modifyprofile/i) && document.modifyForm){
            if(document.modifyForm[this.field]){
                this.get_option();
                this.setup_options();
   
                if(document.addEventListener){
                    document.modifyForm.addEventListener("submit", pv_mood.save, false);
                } else if(document.attachEvent){
                    document.modifyForm.attachEvent("onsubmit", pv_mood.save);
                } else {
                    document.modifyForm.onsubmit = pv_mood.save;
                }
            }
        }

        this.mini_profile();
    },

    get_option: function(){
        var field = document.modifyForm[this.field];
   
        if(field.parentNode.innerHTML.match(/\[MO:(\d+)\]/)){
            this.selected = RegExp.$1;
            field.value = field.value.replace(/\[MO:(\d+)\]/, "");
            field.parentNode.innerHTML = field.parentNode.innerHTML.replace(/\[MO:(\d+)\]/g, "");

            if(field == "customtitle"){
                var loc = document.modifyForm["location"];

                loc.value = loc.value.replace(/\[MO:(\d+)\]/, "");
                loc.parentNode.innerHTML = loc.parentNode.innerHTML.replace(/\[MO:(\d+)\]/g, "");
            }
        }
    },

    setup_options: function(){
        var select = document.createElement("select");
        var the_options = [["", "Select Mood"]].concat(pv_mood_options);

        for(o = 0; o < the_options.length; o ++){
            var opt = document.createElement("option");

            opt.appendChild(document.createTextNode(the_options[o][1]));
            opt.value = o;
            opt.selected = ((this.selected == o)? true : false);
            select.appendChild(opt);
        }

        var row = document.modifyForm[this.field].parentNode.parentNode.parentNode;
        var font = document.createElement("font");
        var font_2 = document.createElement("font");
        var new_row = row.parentNode.insertRow(row.rowIndex + 1);
        var new_cell = new_row.insertCell(0);

        font.appendChild(document.createTextNode("Mood:"));
        font.size = "-1";

        font_2.appendChild(document.createTextNode("Select your mood from the drop down. This will be viewed by other members."));
        font_2.size = "-2";

        select.onchange = function(){
            pv_mood.selected = this.options[this.options.selectedIndex].value;
        }

        new_cell.appendChild(font);
        new_row.insertCell(1).appendChild(select);
        new_row.insertCell(2).appendChild(font_2);
    },

    save: function(){
        var field = document.modifyForm[pv_mood.field];

        field.maxLength += 8;
        field.value += "[MO:" + pv_mood.selected + "]";
    },

    mini_profile: function(){
        var cell = document.getElementsByTagName("td");

        for(c = 0; c < cell.length; c ++){
            if(cell.item(c).width == "20%" && cell.item(c).className.match("windowbg") && cell.item(c).innerHTML.match(/Posts: \d+/) && cell.item(c).innerHTML.match(/(<br\s?\/?>)?(\[MO:(\d+)\])/gi)){
                if(RegExp.$3 != 0){
                    var img = document.createElement("img");
                    var text = document.createTextNode("Mood: ");

                    img.src = (pv_mood_options[RegExp.$3 - 1])? pv_mood_options[RegExp.$3 - 1][0] : "http://s2.images.proboards.com/blank.gif";

                    cell.item(c).appendChild(document.createElement("br"));
                    cell.item(c).appendChild(text);
                    cell.item(c).appendChild(img);
                }

                cell.item(c).innerHTML = cell.item(c).innerHTML.replace(/(<br\s?\/?>)?(\[MO:(\d+)\])/gi, "");

                if(!pv_mood_staff && cell.item(c).innerHTML.match(/Location:\s+<br\s?\/?>/i)){
                    cell.item(c).innerHTML = cell.item(c).innerHTML.replace(/Location:\s+<br\s?\/?>/i, "");
                }

                if(cell.item(c + 1).innerHTML.match(/\[MO:\d+\]/gi)){
                    if(cell.item(c + 1).innerHTML.match(/>\[MO:\d+\]<\/f/gi)){
                        cell.item(c + 1).innerHTML = cell.item(c + 1).innerHTML.replace(/\[MO:\d+\]/i, "n/a");
                    } else {
                        cell.item(c + 1).innerHTML = cell.item(c + 1).innerHTML.replace(/\[MO:\d+\]/i, "");
                    }
                }
            }
        }
    }
};

pv_mood.init();

//-->
</script>

1. Go into Admin panel
2. Click on Desplay
3. Goto Genrealities (or something like that)
4. where it says Home Page message Paste the code in there.
5. Click Save.
6. Then its moment of truth

(It will apperr in your profile so you can change it)

All members shoud now be able to access there mood in there profile editor. =)
It will apperr under the persons Avatar.
avatar
ryan09
Mega Poster
Mega Poster

Male
Number of posts : 571
Description : EliteMod is what i do!

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum