The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Theme Changer?

View previous topic View next topic Go down

In progress Theme Changer?

Post by JAD2350 on June 30th 2013, 9: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..

JAD2350
New Member

Posts : 3
Reputation : 1
Language : English

Back to top Go down

In progress Re: Theme Changer?

Post by SLGray on June 30th 2013, 11:46 pm



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


SLGray
Administrator
Administrator

Male Posts : 35674
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Theme Changer?

Post by JAD2350 on July 1st 2013, 12: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?

JAD2350
New Member

Posts : 3
Reputation : 1
Language : English

Back to top Go down

In progress Re: Theme Changer?

Post by Festina Lente on July 1st 2013, 12: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
Forumember

Male Posts : 279
Reputation : 20
Language : English

Back to top Go down

In progress Re: Theme Changer?

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



Forum Rules: :Forumotion Staff: :Appeal A Warning: :FAQ: :Tips & Tricks: :Forgotten Password/Login Issues
You need one post to send a PM
When your topic has been solved, ensure you mark the topic solved
Never post your email in public


Derri
Administrator
Administrator

Male Posts : 8355
Reputation : 571
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

In progress Re: Theme Changer?

Post by Mr.EasyBB on July 4th 2013, 8: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.

Mr.EasyBB
Forumember

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

http://www.avacweb.com

Back to top Go down

View previous topic View next topic Back to top


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