The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Theme Changer?

5 posters

Go down

In progress Theme Changer?

Post by JAD2350 June 30th 2013, 10:26 pm

Hey everyone. 
Can you guys make an update on the theme changer tutorial? The other topic is quite confusing and I don't know if it even works anymore. 
One of you guys should try the tutorial yourself; the attachment doesn't really go along with the tutorial that well. It's not being specific enough.. 

Thanks. Hope someone can help..
avatar
JAD2350
New Member

Posts : 3
Reputation : 1
Language : English

Back to top Go down

In progress Re: Theme Changer?

Post by SLGray July 1st 2013, 12:46 am



Theme Changer? Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

In progress Re: Theme Changer?

Post by JAD2350 July 1st 2013, 1:01 am

Thank you, but I've tried that one, but it requires the power of the owner/creator. At the moment, I'm only an administrator on the forum. Do you have any other advice?
avatar
JAD2350
New Member

Posts : 3
Reputation : 1
Language : English

Back to top Go down

In progress Re: Theme Changer?

Post by Festina Lente July 1st 2013, 1:14 am

I have this theme changer:

http://www.webartzforum.com/t301-forumotion-theme-changer

I tested it on IE and Google Chrome and it doesn't work. It works only on Mozilla Firefox and I'm satisfied 'cause Firefox is my default browser.
Festina Lente
Festina Lente
Forumember

Male Posts : 279
Reputation : 20
Language : English

Back to top Go down

In progress Re: Theme Changer?

Post by Derri July 1st 2013, 1:42 am

Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

In progress Re: Theme Changer?

Post by Mr.EasyBB July 4th 2013, 9:58 am

Code:

 $(function() {
var css = "<style>body {margin-top:50px !important;} select {color: #fff !important; background-color: #000 !important;} option {font-family: verdana; font-size: 10px; color: white;} option.sl {color: #fff !important; background-color: #000;} SELECT{ font-family: verdana; font-size: 10px; color: white; </style>",
 select = '<div style="position: absolute; width: 150px; height: 15px; z-index: 1; left: 5px; top: 35px" id="skinselector"><form><select id="changeTheme" onchange="changeskin(this.options[this.selectedIndex].value);">',
 

   //ADD THEMES TO THE themes And it will automatically add it. Don't forget to add the if statement like below in the second note.
themes =["Default","Pink","Blue","Gold","Purple","Dark"];
 
   for(var i=0;i<themes.length;i++){
     var options = '<option class="sl" value="'+themes[i]+'">'+themes[i]+' Theme</option>';
    select+=options;
    }
 var head = $('head'),
     body = $('body');
     head.append(css);
     body.append(select);
body.append('<link rel="stylesheet" id="themeChanger" type="text/css" href="" />');
var themeChanger= document.getElementById('themeChanger');
var scheme = getCookie('template1');
var path = window.location.hostname;
if (scheme == 'Default') {
  themeChanger.href= path+"/21-ltr.css";
} else if (scheme == 'Pink') {
    themeChanger.href=path+"/156736-ltr.css";
} else if (scheme == 'Blue') {
      themeChanger.href=path+"/181526-ltr.css";
} else if (scheme == 'Gold') {
      themeChanger.href=path+"/198644-ltr.css";
} else if (scheme == 'Purple') {
      themeChanger.href=path+"/156869-ltr.css";
} else if (scheme == 'Dark') {
   themeChanger.href=path+"/172924-ltr.css";
}//whenever adding another theme add another else if statement with the CSS


  $('#changeTheme').change(function() {
    var themeName = $(this).val();
    var themeChanger= $('#themeChanger');
       if (themeName == 'Default') {
  themeChanger.attr('href',path+"/21-ltr.css");
} else if (themeName == 'Pink') {
    themeChanger.attr('href',path+"/156736-ltr.css"); 
} else if (themeName == 'Blue') {
      themeChanger.attr('href',path+"/181526-ltr.css");
} else if (themeName == 'Gold') {
      themeChanger.attr('href',path+"/198644-ltr.css");
} else if (themeName == 'Purple') {
      themeChanger.attr('href',path+"/156869-ltr.css"); 
} else if (themeName == 'Dark') {
   themeChanger.attr('href',path+"/172924-ltr.css");
}
  });
});
function changeskin(change) {
var scheme = change;
var name = 'template1';
var ExpDate = new Date ();
ExpDate.setTime(ExpDate.getTime() + (180 * 24 * 3600 * 1000));
setCookie(name,scheme,ExpDate);
}
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) +
((expires === null) ? "" : "; expires=" + expires.toGMTString());
}




The code could probably be written a lot better, this was just something I redesigned for someone, and it was originally a mess. I will look into this more tomorrow and see if I can reredeign this to make it a whole lot better. This will automatically change the theme, and whenever going to another link that is the same domain it will stay the same as I've add the my personal cookie code.
avatar
Mr.EasyBB
Forumember

Posts : 71
Reputation : 9
Language : HTML/CSS/JS/JQUERY/MOOTOOLS

http://www.avacweb.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum