Advertise Here

Author Topic: Skin Chooser  (Read 5050 times)

0 Members and 1 Guest are viewing this topic.

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Skin Chooser
« on: October 11, 2010, 05:00:34 am »
I am trying to allow members (or visitors.. no restrictions).. to choose their own skins
I looked for ages through past posts.. but everything is so old.. or dead.

I can't use this code if its not working... or where can I activate it in the control panel ?

Control Panel
Allow members to select their own themes.
Allow members to select the "Default" theme.

Both are checked.. but nothing shows up???  :(
My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #1 on: October 11, 2010, 09:41:52 am »
Hiya..   Those settings are for themes, and since the forum's use just one theme (default core) there are no others to change.
What you "can" do is setup some different stylesheets.   They  change the look of the default theme.   There are a few codes posted here in the codes board for swapping stylesheets so your users can do that.  

Here's the index of the codes in that board:
Codes Index      

List of stylesheets posted here:

Stylesheet Index

Holiday Stylesheets      

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #2 on: October 11, 2010, 02:35:22 pm »
So there's no way that a user can change with the themes that are already in the control panel?

Think I should mess with a test board.. or is it quite logical?

Haven't messed up anything yet.. but this is deeper  ;)
My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #3 on: October 11, 2010, 02:37:09 pm »
Correct - the reason is there is only ONE theme.
The stylesheets you add are not themes - they are stylesheets that change the look of the Default Theme.
Via the software itself there is currently no way for your members to choose a stylesheet.

It's always a good idea to test codes via a test forum first.   
If you screw up, your real forum is safe
(and your members arent bothered by it)
;)
« Last Edit: October 11, 2010, 02:39:45 pm by simply sibyl »

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #4 on: October 11, 2010, 03:29:06 pm »
MySite - http://films.smfforfree.com/index.php

I managed to get as far as installing Agent Moose's drop down list.. for style sheet picker
but it doesn't look like those (with css docs?) are hosted anymore.. so nothing seems to happen

My question.. before getting brave and uploading (wordpad doc) with css (?) codes...
I was wondering if there are internal links (for Control Panel stylesheets) that I can post in Moose's codes

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

If not or not possible... ouch.. will see what happens
But am I on the right track anyway?  :-\

ok when i choose a skin it doesnt change it it stays default

This guy had this problem in 2008.. and I have it still... if that helps anything

EDIT: Looks like I'm getting there... just keep trying you say  ;D
Went with the 2nd CODE block from the above mentioned post... works better than 1st (on test site so far)  ;)

EDIT Again: Ok Sybil... this one's for you.. sorry
This is the code... I changed more than the 1st 4.. but only the 1st 4 work
... then also if I try re-order them alphabetically... they go out of order... like they are mismatched
Code: [Select]
<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["RedMetal","http://films.smfforfree.com/styles/Films/RedMetal.css?fin11"];
Skin[n++] = ["Christmas","http://films.smfforfree.com/styles/Films/Christmas.css?fin11"];
Skin[n++] = ["Chronicles","http://films.smfforfree.com/styles/Films/Chronicles.css?fin11"];
Skin[n++] = ["LightBrown","http://films.smfforfree.com/styles/Films/LightBrown.css?fin11"];
Skin[n++] = ["Black","http://films.smfforfree.com/styles/Films/Black.css?fin11"];
Skin[n++] = ["Camo","http://films.smfforfree.com/styles/Films/Camo.css?fin11"];
Skin[n++] = ["Cat","http://films.smfforfree.com/styles/Films/Cat.css?fin11"];
Skin[n++] = ["Grey","http://films.smfforfree.com/styles/Films/Grey.css?fin11"];
Skin[n++] = ["HeliosRed","http://films.smfforfree.com/styles/Films/HeliosRed.css?fin11"];
Skin[n++] = ["LightBlue","http://films.smfforfree.com/styles/Films/LightBlue.css?fin11"];
Skin[n++] = ["Rusted","http://films.smfforfree.com/styles/Films/Rusted.css?fin11"];
Skin[n++] = ["TechnoGlassBlue","http://films.smfforfree.com/styles/Films/TechnoGlassBlue.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>

I would also like to know how to add the Default @ the top... if you can (as it didn't work)

And then lastly... those 4 work on my www.smfforfree.com (test site above) but not on my main www.smfforfree3.com site
Are there issues between the two... or are they not the same?

Thanks
« Last Edit: October 11, 2010, 06:25:56 pm by zaHawk »
My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #5 on: October 11, 2010, 09:38:03 pm »

EDIT Again: Ok Sybil... this one's for you.. sorry
This is the code... I changed more than the 1st 4.. but only the 1st 4 work
... then also if I try re-order them alphabetically... they go out of order... like they are mismatched
Code: [Select]
<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["RedMetal","http://films.smfforfree.com/styles/Films/RedMetal.css?fin11"];
Skin[n++] = ["Christmas","http://films.smfforfree.com/styles/Films/Christmas.css?fin11"];
Skin[n++] = ["Chronicles","http://films.smfforfree.com/styles/Films/Chronicles.css?fin11"];
Skin[n++] = ["LightBrown","http://films.smfforfree.com/styles/Films/LightBrown.css?fin11"];
Skin[n++] = ["Black","http://films.smfforfree.com/styles/Films/Black.css?fin11"];
Skin[n++] = ["Camo","http://films.smfforfree.com/styles/Films/Camo.css?fin11"];
Skin[n++] = ["Cat","http://films.smfforfree.com/styles/Films/Cat.css?fin11"];
Skin[n++] = ["Grey","http://films.smfforfree.com/styles/Films/Grey.css?fin11"];
Skin[n++] = ["HeliosRed","http://films.smfforfree.com/styles/Films/HeliosRed.css?fin11"];
Skin[n++] = ["LightBlue","http://films.smfforfree.com/styles/Films/LightBlue.css?fin11"];
Skin[n++] = ["Rusted","http://films.smfforfree.com/styles/Films/Rusted.css?fin11"];
Skin[n++] = ["TechnoGlassBlue","http://films.smfforfree.com/styles/Films/TechnoGlassBlue.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>

I would also like to know how to add the Default @ the top... if you can (as it didn't work)

And then lastly... those 4 work on my www.smfforfree.com (test site above) but not on my main www.smfforfree3.com site
Are there issues between the two... or are they not the same?

Thanks

The urls for the 1st 4 are correct for the stylesheets but the rest of them are not.   They appear to be some of the styles that are included with the forum.   Did you install them?   If not do so then it should work.  If you did then try changing the forums style to one of those then using your browser view the source code.    (View/Source in IE)  (View/Page Source) in Firefox.  You'll see the code for the css near the top of the source code.     Its been a lonnnnng time since Ive looked at this code so it may take some digging to figure this one out.
« Last Edit: October 11, 2010, 09:58:33 pm by simply sibyl »

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #6 on: October 12, 2010, 04:36:41 am »
It seems the same from source code
Code: [Select]
</head>
<body><!--Begin Headers--><script>
var n = 0;var Skin = new Array();
Skin[n++] = ["RedMetal","http://films.smfforfree.com/styles/Films/RedMetal.css?fin11"];
Skin[n++] = ["Christmas","http://films.smfforfree.com/styles/Films/Christmas.css?fin11"];
Skin[n++] = ["Chronicles","http://films.smfforfree.com/styles/Films/Chronicles.css?fin11"];
Skin[n++] = ["LightBrown","http://films.smfforfree.com/styles/Films/LightBrown.css?fin11"];
Skin[n++] = ["Black","http://films.smfforfree.com/styles/Films/Black.css?fin11"];
Skin[n++] = ["Camo","http://films.smfforfree.com/styles/Films/Camo.css?fin11"];
Skin[n++] = ["Grey","http://films.smfforfree.com/styles/Films/Grey.css?fin11"];

//Created by Agent Moose (smcodes.smfforfree3.com)


On the test forum... I also don't know why it flashes the default background in-between changes
I initially didn't have black or grey installed... but none of black (5th), Camo (6th) or grey (7th) work yet
I even changed the caps of black & grey to small (as in SMF control panel styles).. also no difference
Almost as if it doesn't exist.. then return to default ... which I understand.. but can't be missing

I had a look at the rest of Moose's coding .. but know very little.. so its gibberish to me   ;)

EDIT: took out extended code - messing up the post width  ;)
« Last Edit: October 12, 2010, 06:09:31 am by zaHawk »
My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #7 on: October 12, 2010, 04:44:23 am »
Given your source code grey should be:
Code: [Select]
http://www.smfforfree.com/styles/films/grey.css?fi11

See the difference in the url and the url you are using?
One way you can test to see if you have the url correct is put it in your browsers address bar and try going to it - if it is correct you'll get a box to download the css.   

The way Moose's code is written it does flash between changes.    There is a second option for that code if you read abit further down in the directions.  That one does not cause the "flash"   (at least it didnt back then when it was created)   Could depend on browsers too; that code was afterall written some time ago and there have been updates to the smf software since that time/browser updates as well.   I think Moose had modified it so that it will align center too so you don't have to put it in a div.  None of the codes posted for swapping stylesheets are perfect;  but are the only way of doing what you are wanting to do.
« Last Edit: October 12, 2010, 04:46:21 am by simply sibyl »

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #8 on: October 12, 2010, 06:06:37 am »
I don't see any difference.. except that it should be my forum name... and not SMF...? I will have another look

But any idea why it works on SMFforFree.com.. but not on SMFforFree3.com? (the 1st 4 anyway)
I pasted it exactly the same.. and updated it to the main site name as well
My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #9 on: October 12, 2010, 06:16:38 am »
I'll try to explain the URLs and what you need to do

From the instructions for the code this is how the urls should be:

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)


Im going to use the RedMetal style you set up as an example so you can see where you went wrong with it.

You used:

Code: [Select]
Skin[n++] = ["RedMetal","http://films.smfforfree.com/styles/Films/RedMetal.css?fin11"];

That should be:

Code: [Select]
Skin[n++] = ["RedMetal","http://www.smfforfree.com/styles/Films/RedMetal.css?fin11"];

When you replace "smfforfree.com" in the code you replace only the "smfforfree.com" part of it.    If the forum is on smfforfree3.com then change the "smfforfree.com" to "smfforfree3.com"     You added "films" to it and shouldnt have.  Put "films" only where it says "FORUM NAME"     The code will look to the styles/films folder for the css file.
« Last Edit: October 12, 2010, 06:20:32 am by simply sibyl »

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #10 on: October 12, 2010, 06:33:03 am »
Ok.. I see what was wrong... sorry

Strangely it was working on the 1st 4 on my site name in that place.. this is the update
Code: [Select]
Skin[n++] = ["RedMetal","http://www.smfforfree.com/styles/Films/RedMetal.css?fin11"];
Skin[n++] = ["Christmas","http://www.smfforfree.com/styles/Films/Christmas.css?fin11"];
Skin[n++] = ["Chronicles","http://www.smfforfree.com/styles/Films/Chronicles.css?fin11"];
Skin[n++] = ["LightBrown","http://www.smfforfree.com/styles/Films/LightBrown.css?fin11"];
Skin[n++] = ["Black","http://www.smfforfree.com/styles/Films/black.css?fin11"];
Skin[n++] = ["Camo","http://www.smfforfree.com/styles/Films/camo.css?fin11"];
Skin[n++] = ["Grey","http://www.smfforfree.com/styles/Films/grey.css?fin11"];
Somehow... the 1st 4 still work.. and now black is working .. but not "camo" & "grey" (and they are installed)

On the other hand.. my main site.. it ain't working at all
Code: [Select]
Skin[n++] = ["RedMetal","http://www.smfforfree3.com/styles/southafricannetworks/RedMetal.css?fin11"];
Skin[n++] = ["Christmas","http://www.smfforfree3.com/styles/southafricannetworks/Christmas.css?fin11"];
Skin[n++] = ["Chronicles","http://www.smfforfree3.com/styles/southafricannetworks/Chronicles.css?fin11"];
Skin[n++] = ["LightBrown","http://www.smfforfree3.com/styles/southafricannetworks/LightBrown.css?fin11"];

It looks the same... except for the smfforfree3 & my site name (just the name - not the link?).. and styles are installed

Thanks for the help
My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #11 on: October 12, 2010, 06:39:40 am »
Remember -  you have to set the forum to the Default Style in order for this to work properly.   After doing so try it again and also try clearing your browser cache.   Need some sleep here and will check back in later to see how you are getting on with it.     Might be some other tips throughout that codes thread that could help.

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #12 on: October 12, 2010, 01:13:57 pm »
Still no luck... I tried clearing the cache
Also set my forum to default... then tried drop-down list .. no change on main forum

I tried to find other sites.. to view their source codes.. to see where I'm wrong... but not much luck

Give this site a shot.. and see if skins change... it didn't for me
http://skins.smfforfree3.com/ ... script might be old... dunno

 :-\

My site - South African Networks
Also has a R500 prize for Gamers  ;)

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: Skin Chooser
« Reply #13 on: October 12, 2010, 01:59:32 pm »
Still no luck... I tried clearing the cache
Also set my forum to default... then tried drop-down list .. no change on main forum

I tried to find other sites.. to view their source codes.. to see where I'm wrong... but not much luck

Give this site a shot.. and see if skins change... it didn't for me
http://skins.smfforfree3.com/ ... script might be old... dunno

 :-\


I checked your source code for that site.   The urls for the css are incorrect.
To try to clear this up I have set it up on my forum on smfforfree3.com.
It works perfectly.
Im going to post the code I used for you.

The ONLY edits you need to do are:
For each of the lines for the skin change:
1.  The name you want to appear in the dropdown box.
     (example:   Change Media to the name of your stylesheet)
2.  If you set this up on your smfforfree3.com forum leave that part alone   If its on smfforfree.com remove the "3"
3.  Change "sibylstestsite" to the name of your forum - exactly as it is in your url.
4.  The name of the css file -  EXACTLY as it is in the style picker's dropdown box in Manage Styles

Do NOT change the www before the smfforfree3.com to your forums name -  leave that alone.  The ONLY place you need to put YOUR forums name is where it says "sibylstestsite"

After you have done those edits put the code in your HEADER.    It will automatically center the dropdown box.
Make sure the Default style is chosen in the stylepicker as your forum's default style.


Code: [Select]
<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["Default","http://www.smfforfree3.com/styles/sibylstestsite/default.css?fin11"];
Skin[n++] = ["Media","http://www.smfforfree3.com/styles/sibylstestsite/media.css?fin11"];
Skin[n++] = ["Olive","http://www.smfforfree3.com/styles/sibylstestsite/olive.css?fin11"];
Skin[n++] = ["Pool Shark","http://www.smfforfree3.com/styles/sibylstestsite/poolshark.css?fin11"];
Skin[n++] = ["Alienation","http://www.smfforfree3.com/styles/sibylstestsite/alienation.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>


You can see that it works here:
http://sibylstestsite.smfforfree3.com/index.php
I added several more to it so you can see it will work with many more.

The above code is also posted on that forum, along with instructions:
http://sibylstestsite.smfforfree3.com/index.php/topic,127.msg186.html#msg186
« Last Edit: October 12, 2010, 02:24:00 pm by simply sibyl »

Offline zaHawk

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

  • Total Badges: 23
    Badges: (View All)
    Level 5 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary Fifth year Anniversary
Re: Skin Chooser
« Reply #14 on: October 12, 2010, 02:58:08 pm »
Those Skins are marvelous... works great as you said

I was struggling - results in quote (maybe for others to see)
Quote
I copied and pasted your code.. changed your name to mine
Code: [Select]
Skin[n++] = ["Default","http://www.smfforfree3.com/styles/southafricannetworks/default.css?fin11"];
Skin[n++] = ["Black","http://www.smfforfree3.com/styles/southafricannetworks/black.css?fin11"];
Skin[n++] = ["Camo","http://www.smfforfree3.com/styles/southafricannetworks/Camo.css?fin11"];
Skin[n++] = ["Cat","http://www.smfforfree3.com/styles/southafricannetworks/cat.css?fin11"];
Skin[n++] = ["Christmas","http://www.smfforfree3.com/styles/southafricannetworks/christmas.css?fin11"];

Please see attached pic... You can see my installed style.. and that the case sensitivity was noted
My site http://southafricannetworks.smfforfree3.com has all of them set to default..so something still not right

I use Opera... and deleted the cache.. but seems to have decreased it only
But I have also tested it on Firefox (nope)... Chrome (nope)... Explorer... er.. Camo worked... then all went to default again

Went back to Header & Footer... took "old saved code" out of footer..from that moment it worked  ::) (know you might wanna shoot me)  :knuppel2:
It's working now... but will add others VERY cautiously  :-\

Fingers crossed... and Thanks Sybil.. starting to realize how hard you work.. and how valuable you are to SMF  ;)
My site - South African Networks
Also has a R500 prize for Gamers  ;)

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
1844 Views
Last post April 11, 2007, 10:33:04 am
by Vixen