vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Database of Codes/Hacks/Mods :: Different On/Off Icons - View Topic
Topic Rating: *****
Printable View
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Different On/Off Icons (3rd Apr 08 at 5:30pm UTC)
This code was another request. It lets you choose a set on/off icon for a board and all of the sub-boards in that board. It's a rather useful code for those people that run an RPG forum.


<script>
/*Different On/Off Icons
Created By Wrighty
No Ripping, Reposting or Claiming*/

var icon = {

    list: [
        ["general","officon_.jpg","onicon_.jpg"],
        ["general","officon_.jpg","onicon_.jpg"],
        ["general","officon_.jpg","onicon_.jpg"]
    ],

    _d: get('td','tag'),
    change: {
        board: function(){
            for(a=0;a<icon.list.length;a++){
                for(i=0;i<icon._d.length;i++){
                    if(icon._d[i].width=="6%" && icon._d[i+1].innerHTML.match(new RegExp('/board/'+icon.list[a][0]))){
                        switch(icon._d[i].firstChild.alt){
                            case 'No New Posts':
                                icon._d[i].firstChild.src = icon.list[a][1];
                            break;
                            case 'New Posts':
                                icon._d[i].firstChild.src = icon.list[a][2];
                            break;
                        }
                    }
                }
            }
        },
        sub_board: function(){
            for(a=0;a<icon.list.length;a++){
                for(i=0;i<icon._d.length;i++){
                    if(icon._d[i].width=="6%"){
                        switch(icon._d[i].firstChild.alt){
                            case 'No New Posts':
                                icon._d[i].firstChild.src = icon.list[a][1];
                            break;
                                case 'New Posts':
                            icon._d[i].firstChild.src = icon.list[a][2];
                            break;
                        }
                    }
                }
            }
        }
    }
};
if(location.href.match(/.co.uk(\/$|$)/) || location.href.match(/\/category\//)){
    icon.change.board();
}
for(i=0;i<icon.list.length;i++){
    if(location.href.match(new RegExp('/board/'+icon.list[i][0])) || get('nav_tree','id').innerHTML.match(new RegExp('/board/'+icon.list[i][0]))){
        icon.change.sub_board();
    }
}
</script>


To add more boards use this:

        ["general","officon_.jpg","onicon_.jpg"],
        ["general","officon_.jpg","onicon_.jpg"],
        ["general","officon_.jpg","onicon_.jpg"]


Simply add more of those to the end. Make sure to leave off a comma on the last line.

Any problems. Feel free to make a new thread! {Smile}

Global Footer
 Printable View

All times are GMT+0 :: The current time is 1:34am
Page generated in 0.1663 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums