vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Sub-boards brackets "[..]"

[F] Sub-boards brackets "[..]" - Posted By Nick (nickb) on 14th May 08 at 6:16pm
I need a code that will put [] before and after the sub board names that shows up on the parent board so like:

some board
Some boards Description
Sub-boards: [sub-board 1] [sub-board 2] [sub-board 3] etc.

If you need any more info, please say so.

Thanks,
Darkmage

Re: Sub-boards brackets "[..]" - Posted By Michael (wrighty) on 15th May 08 at 3:15pm
Try this! {Grin}

<script>
/*Sub-Boards in []
Created By Wrighty*/

var x = get('font','tag');

for(c=0; c<x.length; c++){
    if(x[c].innerHTML.match(/Sub-Boards/) && x[c].size == '1'){
        var f = x[c].getElementsByTagName('a');
        for(y=0;y<f.length;y++){
            f[y].parentNode.insertBefore(document.createTextNode('['), f[y]);
            f[y].parentNode.insertBefore(document.createTextNode(']'), f[y].nextSibling);
        }
    }
}
</script>


Global Footer

Re: Sub-boards brackets "[..]" - Posted By Nick (nickb) on 15th May 08 at 8:05pm
Thanks, is there anyway they can be white, and it be separated with "-" instead of the "," Thanks.

Re: Sub-boards brackets "[..]" - Posted By Michael (wrighty) on 15th May 08 at 8:16pm
Try this! {Grin}

<script>
/*Sub-Boards in []
Created By Wrighty*/

var x = get('font','tag');

for(c=0; c<x.length; c++){
    if(x[c].innerHTML.match(/Sub-Boards/) && x[c].size == '1'){
        x[c].innerHTML = x[c].innerHTML.replace(/,/,' -');
        var f = x[c].getElementsByTagName('a');
        var l = document.createElement('font');
        l.appendChild(document.createTextNode('['));
        l.color = '#FFFFFF';
        var r = document.createElement('font');
        r.appendChild(document.createTextNode(']'));
        r.color = '#FFFFFF';
        for(y=0;y<f.length;y++){
            f[y].parentNode.insertBefore(l.cloneNode(true), f[y]);
            f[y].parentNode.insertBefore(r.cloneNode(true), f[y].nextSibling);
        }
    }
}
</script>


Global Footer

Re: Sub-boards brackets "[..]" - Posted By Nick (nickb) on 15th May 08 at 9:51pm
Thanks it works ^_^

Re: Sub-boards brackets "[..]" - Posted By Michael (wrighty) on 15th May 08 at 10:20pm
{Grin}

Welcome