SMF For Free Support Forum
Signup For Free Forum
September 07, 2008, 03:28:59 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: 1 [2]
  Print  
Author Topic: [Code] Drop-Down Skin Chooser  (Read 1252 times)
0 Members and 1 Guest are viewing this topic.
Stitch
SMF For Free Full Member
*
Offline Offline

Posts: 149


VMK will always remain in my heart.


View Profile WWW
« Reply #15 on: July 31, 2008, 05:59:50 pm »

finally got it to work but is there a way where it doesnt flash everytime you change pages
Logged

simply sibyl
not a dude
Global Moderator
*
Offline Offline

Posts: 8032


Don't PM me for Support


View Profile WWW
« Reply #16 on: August 04, 2008, 01:22:47 pm »

Moose I figured out a way to do this without having to upload files and the style will not "flash". 

Since this is using YOUR code Im posting it as an option in this thread and not making a new topic for it.   This one does have to go in the Header.   Maybe you can find a way for it to be able to be put in the footer.  (it'l work but it will make it flash)

Set your forum to the Default Style
(yes you still have to do this- its possilbe to use another but you will have some issues)

Find other styles you want to use. 
Add each of them in Manage Styles. 

For each of those stylesheets edit these lines in the code:
(add more if you need them, delete those you do not need)

Code:
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];

Replace "STYLE NAME"  with the name of the style
Replace "smfforfree.com" with your forum's info
   for instance  (smfforfree.com, smfforfree2.com, smfforfree3.com, smfforfree4.com, mysmf.com, freesmfhosting.com)
Replace "FORUM NAME" with the name of your forum.
Replace "STYLE" with the name of the stylesheet.
(the name you named the style when you created it in manage styles)

Do this for each one you want to use.

When done with the edits the code goes in your Header and will center the dropdown box at the top of your forum.

Code:

<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];

//Created by Agent Moose (smcodes.smfforfree3.com)
document.write("<center><select id='SkinChooser'><option value='default'>Choose Style</option>");
for(i=0;i<Skin.length;i++){
document.write("<option value='" + Skin[i][1] + "'>" + Skin[i][0] + "</option>");
};
document.write("</select> <input type='button' value='Change' onclick='setSkin();' /></center>");
function setCookie(name, value, expires){
var deCookie = name + "=" + escape(value);
if(expires){
expires= expires.toGMTString();
deCookie += "; expires=";
deCookie += expires;
};
document.cookie = deCookie;
};
function getCookie(name){
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1){
begin = dc.indexOf(prefix);
if (begin != 0) return false;
}else begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
};
function delCookie(name){
expires = new Date(1807,1,1);
expires = expires.toGMTString();
deCookie = name;
deCookie += "=delete; expires=";
deCookie += expires;
document.cookie = deCookie;
};
function changeSkin(Agent){
document.write("<link rel='stylesheet' type='text/css' href='" + Agent + "' />");
};
var Omi = "default";
document.getElementById("SkinChooser").onchange = function(){
if(Skin[parseInt(document.getElementById("SkinChooser").selectedIndex)-1]){
Omi = Skin[parseInt(document.getElementById("SkinChooser").selectedIndex)-1][1]
}else{
Omi = "default";
};};
function setSkin(){
if(Omi == "default") delCookie("Skin");
if(Omi != "default") setCookie("Skin",Omi,new Date(9999,1,1));
window.location.reload();
};
changeSkin(getCookie("Skin"));
</script>



« Last Edit: August 25, 2008, 06:01:10 pm by simply sibyl » Logged

Agent Moose
Moderator
*****
Offline Offline

Posts: 628


Do not PM me for Code Support or Request


View Profile WWW
« Reply #17 on: August 04, 2008, 06:38:04 pm »

To make it so that the center tag isn't outside of the script tag, use this one:
Code:
<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];
Skin[n++] = ["STYLE NAME","http://www.smfforfree.com/styles/FORUM NAME/STYLE.css?fin11"];

//Created by Agent Moose (smcodes.smfforfree3.com)
document.write("<center><select id='SkinChooser'><option value='default'>Choose Style</option>");
for(i=0;i<Skin.length;i++){
document.write("<option value='" + Skin[i][1] + "'>" + Skin[i][0] + "</option>");
};
document.write("</select> <input type='button' value='Change' onclick='setSkin();' /></center>");
function setCookie(name, value, expires){
var deCookie = name + "=" + escape(value);
if(expires){
expires= expires.toGMTString();
deCookie += "; expires=";
deCookie += expires;
};
document.cookie = deCookie;
};
function getCookie(name){
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1){
begin = dc.indexOf(prefix);
if (begin != 0) return false;
}else begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
};
function delCookie(name){
expires = new Date(1807,1,1);
expires = expires.toGMTString();
deCookie = name;
deCookie += "=delete; expires=";
deCookie += expires;
document.cookie = deCookie;
};
function changeSkin(Agent){
document.write("<link rel='stylesheet' type='text/css' href='" + Agent + "' />");
};
var Omi = "default";
document.getElementById("SkinChooser").onchange = function(){
if(Skin[parseInt(document.getElementById("SkinChooser").selectedIndex)-1]){
Omi = Skin[parseInt(document.getElementById("SkinChooser").selectedIndex)-1][1]
}else{
Omi = "default";
};};
function setSkin(){
if(Omi == "default") delCookie("Skin");
if(Omi != "default") setCookie("Skin",Omi,new Date(9999,1,1));
window.location.reload();
};
changeSkin(getCookie("Skin"));
</script>

Also I took out the line breaks so that it wont be a big code, even though it still is big.

And thanks simply Smiley
Logged

Eternal Flame Coming Soon

SMC Code Index - The best Code Index for all your Needs!  Includes a bunch of codes not on Support.
simply sibyl
not a dude
Global Moderator
*
Offline Offline

Posts: 8032


Don't PM me for Support


View Profile WWW
« Reply #18 on: August 04, 2008, 06:44:22 pm »

cool Moose..I wasnt sure where in the code to put that center tag and didnt want to mess it up.    Super that you shortened it too.   Thanks!   I edited the code and put yours in its place.
« Last Edit: August 05, 2008, 07:45:10 pm by simply sibyl » Logged

lordtentei
SMF For Free Member
*
Offline Offline

Posts: 60


View Profile
« Reply #19 on: August 04, 2008, 10:23:54 pm »

Thank you moose and sibyl.. I'm using it right now!

I put it at my sidebar and it is working!!!

Thanks guys! Wink
Logged
ishybadboy
SMF For Free Member
*
Offline Offline

Posts: 32



View Profile
« Reply #20 on: August 14, 2008, 01:25:21 am »

I see people complaining it doesn't work on MFF, Does for me.

http://www.ghostlypkz.smfforfree2.com/

Logged
Colonel Pepsi
SMF For Free Full Member
*
Offline Offline

Posts: 130

If you have more images for my site, PM me.


View Profile WWW
« Reply #21 on: August 26, 2008, 02:35:17 pm »

can someone who got it to work give me the code they used? i want to put the code in with all the skins already in it... and the all skin chooser didnt work for me so i want to try this one.
Logged

simply sibyl
not a dude
Global Moderator
*
Offline Offline

Posts: 8032


Don't PM me for Support


View Profile WWW
« Reply #22 on: August 26, 2008, 02:53:31 pm »

can someone who got it to work give me the code they used? i want to put the code in with all the skins already in it... and the all skin chooser didnt work for me so i want to try this one.

It is honestly better to set it up on your own forum and use your own links because if you use someone elses and they at some point modify the styles or delete them you will be effected by it.   You will have no control over the styles at all that way.
Logged

Colonel Pepsi
SMF For Free Full Member
*
Offline Offline

Posts: 130

If you have more images for my site, PM me.


View Profile WWW
« Reply #23 on: August 26, 2008, 03:05:01 pm »

If they just give me the code that they used and I use it how will it affect me when they edit it?
Logged

Stitch
SMF For Free Full Member
*
Offline Offline

Posts: 149


VMK will always remain in my heart.


View Profile WWW
« Reply #24 on: August 26, 2008, 03:36:41 pm »

because your skins are different from theirs and your forum name is different and all that
Logged

Colonel Pepsi
SMF For Free Full Member
*
Offline Offline

Posts: 130

If you have more images for my site, PM me.


View Profile WWW
« Reply #25 on: August 26, 2008, 04:26:20 pm »

Fine. But then where do I get the URLs for the CSS codes to put in it?
Logged

simply sibyl
not a dude
Global Moderator
*
Offline Offline

Posts: 8032


Don't PM me for Support


View Profile WWW
« Reply #26 on: August 26, 2008, 04:29:47 pm »

There are two different ways to do this code.  You'll need to read from the beginning to find that out.
Its going to depend on which way you choose to do it.   If you do it using Moose's directions in the first post follow his directions.   I've not used his so you would have to ask him questions if you have trouble with it.   If you do it following the directions I put in you will need to decide what styles you want to use,  install them on your forum in Manage Styles.  You can find a ton of stylesheets here:

Stylesheet Index

The directions for installing them on your forum at at the top of that Index.

If you used someone elses code.. the urls are from THIER forums and they have installed them.
They could edit them, delete them, do whatever they wish to with them and when they do yours would change to whatever they do to them since you would be using their links.
« Last Edit: August 26, 2008, 04:36:08 pm by simply sibyl » Logged

girlhues
SMF For Free Newbie
*
Offline Offline

Posts: 17


View Profile
« Reply #27 on: August 30, 2008, 10:11:37 am »

Thanks for this code - it's awesome! However, I am now having problems with it. I changed my domain name from allaboutbabv.com to adultbabv.com earlier this week. I also changed my forum title to adultbabv.  I was using this code before I changed the names and everything was fine. Since changing the name, I can't get it to work. I did go back and edit each line in the code to what you see below but what else am I missing?  Would it have something to do with my cookie name?  It's still reading SMFallaboutbabv. I did not want to change it because everything I have read says do not change it if you don't know enough about it....and I don't know enough lol I am new to all of this. 

OLD - Skin[n++] = ["black","http://www.allaboutbabv.com/styles/allaboutbabv/black.css?fin11"];

NEW
- Skin[n++] = ["black","http://www.adultbabv.com/styles/adultbabv/black.css?fin11"];

Thanks in advance!
Logged
simply sibyl
not a dude
Global Moderator
*
Offline Offline

Posts: 8032


Don't PM me for Support


View Profile WWW
« Reply #28 on: August 30, 2008, 10:35:53 am »

    It "could" be a cookie issue.   I would try deleting your cookies on your computer then try the page again.

I am not so sure you should have changed the urls for the stylesheets.
Try deleting cookies first and see how that goes.
Logged

girlhues
SMF For Free Newbie
*
Offline Offline

Posts: 17


View Profile
« Reply #29 on: August 30, 2008, 04:01:45 pm »

    It "could" be a cookie issue.   I would try deleting your cookies on your computer then try the page again.

I am not so sure you should have changed the urls for the stylesheets.
Try deleting cookies first and see how that goes.

I changed the code back to how I had it before the domain name change. It's working fine now! Thank you so much!
Logged


Pages: 1 [2]
  Print  
 
Jump to:  

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 0.439 seconds with 17 queries.