vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Miscellaneous Hacks - Style Switcher like on vB.org (https://vborg.vbsupport.ru/showthread.php?t=249919)

8thos 07-22-2011 10:23 PM

I'll PM MoMan then.

great kitten 07-23-2011 02:47 AM

screenshots please

8thos 07-23-2011 02:57 AM

Quote:

Originally Posted by great kitten (Post 2223775)
screenshots please

Scroll down to the bottom of the page. Do you see the style switcher? That's what it looks like.

8thos 07-23-2011 11:20 AM

It works in vb4. He just gave bad directions, that's all.

Put this javascript in your headinclude or footer.


HTML Code:

<script type="text/javascript" src="clientscript/vbulletin_global.js">
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
}</script>


8thos 07-23-2011 05:46 PM

Same code but compressed to reduce page load time.

HTML Code:

<script type="text/javascript"src="clientscript/vbulletin_global.js">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}</script>


MoMan 07-26-2011 10:04 AM

Of course it works- all this function does is it redirects your browser ;)

BTW, in your above code, you should get rid of the src="clientscript/vbulletin_global.js" attribute.

Does vb4 not use vbulletin_global.js?

dany_danay 02-18-2012 12:31 PM

Work in vb4?How can i get this on the header?


All times are GMT. The time now is 05:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01161 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete