Advertise Here

Author Topic: [Code] Drop-Down Skin Chooser  (Read 14497 times)

0 Members and 1 Guest are viewing this topic.

Offline Stitch

  • SMF For Free Full Member
  • *
  • Posts: 213
  • VMK will always remain in my heart.
    • View Profile
    • Project: Phoenix

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« 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

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Drop-Down Skin Chooser
« 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: [Select]
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: [Select]

<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 »

Offline Agent Moose

  • Moderator
  • *****
  • Posts: 836
  • Do not PM me for Code Support or Request
    • View Profile

  • Total Badges: 32
    Badges: (View All)
    Search Level 6 Tenth year Anniversary Nineth year Anniversary Eighth year Anniversary
Re: [Code] Drop-Down Skin Chooser
« 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: [Select]
<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 :)
Check out Revolution X's Brand new Code Index!

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Drop-Down Skin Chooser
« 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 »

Offline lordtentei

  • SMF For Free Member
  • *
  • Posts: 55
    • View Profile

  • Total Badges: 11
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Drop-Down Skin Chooser
« 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! ;)

Offline ishybadboy

  • SMF For Free Member
  • *
  • Posts: 46
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 10 Posts
Re: [Code] Drop-Down Skin Chooser
« 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/


Offline Josh[y]

  • SMF For Free Sr. Member
  • *
  • Posts: 478
  • <Insert whitty tagline here.>
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« 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.

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Drop-Down Skin Chooser
« 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.

Offline Josh[y]

  • SMF For Free Sr. Member
  • *
  • Posts: 478
  • <Insert whitty tagline here.>
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« 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?

Offline Stitch

  • SMF For Free Full Member
  • *
  • Posts: 213
  • VMK will always remain in my heart.
    • View Profile
    • Project: Phoenix

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« 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

Offline Josh[y]

  • SMF For Free Sr. Member
  • *
  • Posts: 478
  • <Insert whitty tagline here.>
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« 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?

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Drop-Down Skin Chooser
« 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 »

Offline girlhues

  • SMF For Free Member
  • *
  • Posts: 67
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Drop-Down Skin Chooser
« 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!

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Drop-Down Skin Chooser
« 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.

Offline girlhues

  • SMF For Free Member
  • *
  • Posts: 67
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Drop-Down Skin Chooser
« 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!

 

Related Topics

  Subject / Started by Replies Last post
12 Replies
9236 Views
Last post August 14, 2008, 05:00:44 am
by ishybadboy