Back to vBulletin 3.8 Add-ons

Style Switcher like on vB.org
Mod Version: 1.00, by MoMan

vB Version: 3.8.6 Rating: (0 vote - 0 average) Installs: 9
Released: 04 Sep 2010 Last Update: Never Downloads: 0
Not Supported Template Edits Code Changes Re-usable Code  

I've written a simple JS function that can be used if you want to implement a style selector like on vB.org (using colored icons instead of a dropdown).

Simply add this to vbulletin_global.js, or include it in your footer template:

Code:
function switch_style(F)
{
    E = "style";
    if(F == "")
    {
        return; 
    }
    var B=new String(window.location);
    var A=new String("");
    B=B.split("#");
    if(B[1])
    {
        A="#"+B[1]
    }
    B=B[0];
    if(B.indexOf(E+"id=")!=-1&&is_regexp)
    {
        var D=new RegExp(E+"id=\\d+&?");
        B=B.replace(D,"")
    }
    if(B.indexOf("?")==-1)
    {
        B+="?"
    }
    else
    {
        lastchar=B.substr(B.length-1);
        if(lastchar!="&"&&lastchar!="?")
        {
            B+="&"
        }
    }
    window.location=B+E+"id="+F+A
}
Then, you'd use something like this in your footer template:

HTML Code:
<a onclick="switch_style('9');return false;" href="$vboptions[bburl]/index.php?styleid=9" rel="nofollow"><img src="$vboptions[bburl]/images/redstyle.gif" alt="" title="Red Layout" border="0" width="13" height="13" class="inlineimg" /></a>
This will then switch your style to an ID of your choice (9 in the example above). You will have to have separate styles for each color you want to switch between.

Hope someone will find this useful! Enjoy!

Download

No files for download.

Similar Mods

Add-On Releases Easy Style Color switcher vBulletin 3.8 Add-ons
Style Bnat Syria way Sheet Switcher vBulletin 3.7 Styles

vblts.ru supports vBulletin®, 2022-2024