vForums Support > Programming & Coding :: Code Requests & Support :: > [F] On/off icon mod

[F] On/off icon mod - Posted By dog199200 (dog199200) on 19th Mar 08 at 4:15am
{Smile} can i get a code that will allow me to have a different on/off icon for a select board and that it will also change the on/off icon of the sub-boards with in it no matter how deep they are tunneled, to that same image, and if i have to add the code to the header/footer of each board thats ok. {Smile}

Re: On/off icon mod - Posted By Michael (wrighty) on 20th Mar 08 at 12:50am
So you want. The parent board to have a set on/off image, and the sub-boards of that parent board to have the same on/off as the parent board? {Unsure}

Re: On/off icon mod - Posted By dog199200 (dog199200) on 20th Mar 08 at 11:01pm
yes...basically, its to make the rp boards on/off icons to match the rp..if that makes any sence....


(for the rp area of my Deluxe Anime Forum forum...)

Re: On/off icon mod - Posted By Michael (wrighty) on 21st Mar 08 at 10:18pm
Well this is a code and a half! {Tongue Out}

<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

I'm pretty sure that this is what you wanted. It will give the same on/off ions to the board on the main page and to ANY sub-boards of that board. Irrespective of the depth that you are going to go! {Smile}

Have fun! ^_^

Re: On/off icon mod - Posted By dog199200 (dog199200) on 22nd Mar 08 at 3:28am
its not working at all....

Edit: at the current time i dont have the images up there but when i did nothing showed at all...

(Board: HackSerenity)

Re: On/off icon mod - Posted By Marc (cr0w) on 22nd Mar 08 at 4:23am
Could you open up the board to guests, please?

Re: On/off icon mod - Posted By dog199200 (dog199200) on 22nd Mar 08 at 4:52am
umm its not that, its that i have no subboards in it and i have posting disabled, i'm in the process of making that board...but other then that it is open to guests, i'll add stuff to it really quick..

Edit: i added a few sub-boards to it now it should show

Re: On/off icon mod - Posted By Marc (cr0w) on 22nd Mar 08 at 6:22am
Quote:
You must login to access this area.


Check your board settings. {Wink}

Re: On/off icon mod - Posted By Michael (wrighty) on 22nd Mar 08 at 10:23am
Can you try removing Cr0ws code for me temporarily as they may be conflicting. If they are, I'll have to rewrite it! {Smile}

Re: On/off icon mod - Posted By dog199200 (dog199200) on 22nd Mar 08 at 3:33pm
@Wrighty: nope that wouldn't be it...i just added that in last night, long after i reported that the code you made doesn't work...

@Marc: and oops i will fix that {Smile}


@Wrighty: if you don't mind me asking...why did you add me on the messanger?

Re: On/off icon mod - Posted By Marc (cr0w) on 22nd Mar 08 at 4:21pm
Still seeing the login message. {Unsure}

Re: On/off icon mod - Posted By dog199200 (dog199200) on 22nd Mar 08 at 5:38pm
sorry i got busy and forgot to fix it doing taht right now

edit: done

Re: On/off icon mod - Posted By Michael (wrighty) on 22nd Mar 08 at 6:44pm
Added you cause I was bored! {Tongue Out}

Also, should work because it works on my test board.

I will look at this later! {Smile}

Re: On/off icon mod - Posted By Marc (cr0w) on 22nd Mar 08 at 7:23pm
Dwight, put Wrighty's code above the Sub-Board Categories code. {Wink}

Re: On/off icon mod - Posted By Michael (wrighty) on 22nd Mar 08 at 8:06pm
sub-board categories code is in the board headers. Mine is global!

Re: On/off icon mod - Posted By Marc (cr0w) on 22nd Mar 08 at 8:08pm
 
sub-board categories code is in the board headers. Mine is global!


Should they not both be in the board footers? {Unsure}

Re: On/off icon mod - Posted By Michael (wrighty) on 22nd Mar 08 at 9:30pm
No because mine is coded to work on the main page also {Unsure}

Re: On/off icon mod - Posted By Marc (cr0w) on 22nd Mar 08 at 10:10pm
I'll modify my categorizing code in a minute to work with your on/off icon code. {Smile}

Re: On/off icon mod - Posted By Michael (wrighty) on 23rd Mar 08 at 1:11am
Sorry, I know why it's not working. You didn't put the BOARD name. You need to put 'HackSerenity' instead of 'RolePlay' {Smile}

Re: On/off icon mod - Posted By dog199200 (dog199200) on 23rd Mar 08 at 6:04pm
oops i didn't notice i did that, ok fixed that and it works so ty {Smile}

Re: [f] On/off icon mod - Posted By Michael (wrighty) on 23rd Mar 08 at 6:58pm
No problem! {Smile}