Advertise Here

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

0 Members and 1 Guest are viewing this topic.

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
[Code] Drop-Down Skin Chooser
« on: June 03, 2008, 04:13:51 pm »
Headers or Footers:
Code: [Select]
<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["Black","http://h1.ripway.com/smcodes/Skins/black.css"];
Skin[n++] = ["Red","http://h1.ripway.com/smcodes/Skins/red.css"];
Skin[n++] = ["Green","http://h1.ripway.com/smcodes/Skins/green.css"];
Skin[n++] = ["NAME","URL"];

//Created by Agent Moose (smcodes.smfforfree3.com)
document.write("<script src='http://209.85.62.24/15/114/0/f82735/DropSkina.js'></scr" + "ipt>");
</script>

Original Request: http://smcodes.smfforfree3.com/index.php/topic,982.0.html

This Skin Chooser is probably something you all wanted, so here you are :)  Where ever you add this code to, that is where it will show.

There are three Skins avaliable for it right now, and I will not add anymore because it takes up my hosting.  So I made it so that you can add your own skins.

NAME = The Name of the skin
URL = The URL of the CSS file for the skin.

To upload your own skin, just follow these steps:
1. Find the Skin you want
2. Copy the CSS and save it in Notepad.  Doesn't matter what you name it
3. Find a place to upload that file.
4. Take the URL of that file and place it where it says URL.

To add more skins, add more of these lines:
Skin[n++] = ["NAME","URL"];

Enjoy :)


EDIT:
Thanks to simply, she figured out how to make the skin chooser not flash everytime the page loads.

A.  Set your forum to the Default Style

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

C.  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"];
1.   Replace "STYLE NAME"  with the name of the style
2.   Replace "smfforfree.com" with your forum's info
       for instance  (smfforfree.com, smfforfree2.com, smfforfree3.com, smfforfree4.com, mysmf.com, freesmfhosting.com)
3.   Replace "FORUM NAME" with the name of your forum.
4.   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.

D.  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: October 12, 2010, 02:38:52 pm by simply sibyl »
Check out Revolution X's Brand new Code Index!

Offline pker own

  • SMF For Free Sr. Member
  • *
  • Posts: 370
    • View Profile
    • Coreyscape Forums (Was A Server)

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #1 on: June 03, 2008, 04:30:56 pm »
I tried it, Didn't work for me :( i put in footers i'll go try headers.

EDIT: Put it in footers, Still no luck  :-\
« Last Edit: June 03, 2008, 04:32:36 pm by pker own »

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 #2 on: June 03, 2008, 04:45:35 pm »
The reason is because my bandwidth just ran out on my ripway account.  I would highly recommend you just uploading your own skins and putting them in the code.

Also, I updaed the code in the first post.
Check out Revolution X's Brand new Code Index!

Offline pker own

  • SMF For Free Sr. Member
  • *
  • Posts: 370
    • View Profile
    • Coreyscape Forums (Was A Server)

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #3 on: June 03, 2008, 04:47:38 pm »
Just done it, Didn't work i don't think i've done it right can i PM you my details on Ripway then you do it for me and ill send you stylesheet css?

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 #4 on: June 03, 2008, 05:11:29 pm »
Honestly, I don't want to do it because then other people will ask me.  But, I would highly recommend you not using Ripway.  If you don't log into it for 30 days, then your account will be deleted.

I would recomend using Google Pages.  When you uploaded a file, just right click on it and Copy Link Location.  Then, just past that URL in the URL section of the code.
Check out Revolution X's Brand new Code Index!

Offline pker own

  • SMF For Free Sr. Member
  • *
  • Posts: 370
    • View Profile
    • Coreyscape Forums (Was A Server)

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #5 on: June 03, 2008, 05:15:04 pm »
Hmm, I really think im thick in the head, I still don't know what to do lol nvm im gonna go find some more codes for my forum.

Offline Lucas A33

  • SMF For Free Full Member
  • *
  • Posts: 159
    • View Profile

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #6 on: June 03, 2008, 05:46:12 pm »
I really dont get it...

Offline Lucas A33

  • SMF For Free Full Member
  • *
  • Posts: 159
    • View Profile

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #7 on: June 03, 2008, 05:48:07 pm »
Oh!!! It worked awesomely! Thanks!

Offline Phoebe Jordan

  • SMF For Free Member
  • *
  • Posts: 42
    • View Profile
    • Romance Readers & Writers Forum

  • Total Badges: 12
    Badges: (View All)
    Apple User Topic Starter Combination Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #8 on: June 03, 2008, 07:06:37 pm »
Forum Url: http://romanceloversreadingandwr.smfforfree4.com
Okay it works but it goes wonky and everything is centered and not the way I thought it would look. luckily I tested it on my test forum.
« Last Edit: June 03, 2008, 07:08:22 pm by Phoebe Jordan »

Offline pker own

  • SMF For Free Sr. Member
  • *
  • Posts: 370
    • View Profile
    • Coreyscape Forums (Was A Server)

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #9 on: June 04, 2008, 04:17:26 am »
Hmm, It only seems to work on IE for me, Tried MFF and it doesn't work on there  :-\

Offline Lucas A33

  • SMF For Free Full Member
  • *
  • Posts: 159
    • View Profile

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Drop-Down Skin Chooser
« Reply #10 on: June 04, 2008, 02:38:13 pm »
Yep! Me to  :-\ :-\

Offline Enigma

  • SMF For Free Full Member
  • *
  • Posts: 102
  • Hello!
    • View Profile
    • Subspace-Channel

  • Total Badges: 28
    Badges: (View All)
    100 Posts Search Invisible Tenth year Anniversary Nineth year Anniversary
Re: [Code] Drop-Down Skin Chooser
« Reply #11 on: June 15, 2008, 09:47:32 am »
One sweet little code tried it on my test site, really cool thanks. -E

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 #12 on: June 17, 2008, 06:38:42 pm »
how do u get it to google 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 #13 on: June 17, 2008, 10:39:34 pm »
how do u get it to google pages ?

You need to make a googlepage account then you can upload files there and get the links
http://pages.google.com/

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 #14 on: June 18, 2008, 10:45:44 am »
ok when i choose a skin it doesnt change it it stays default

 

Related Topics

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