MediaWiki:Common.js/lightswitch.js: Difference between revisions
From The Official Visionaire Studio: Adventure Game Engine Wiki
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
{ | { | ||
$.cookie('name', 'true'); | $.cookie('name', 'true'); | ||
$("body").css("background", "#000000"); | $("body").css("background-color", "#000000"); | ||
} else { | } else { | ||
$.cookie('name', null); | $.cookie('name', null); | ||
$("body").css("background", "#ffffff"); | $("body").css("background-color", "#ffffff"); | ||
} | } | ||
/* | /* | ||
| Line 35: | Line 35: | ||
$("#switchLights").click(function() { | $("#switchLights").click(function() { | ||
if ($('body').css("background") | if ($('body').css("background") == "rgb(0, 0, 0)") { | ||
{ | { | ||
$("body").css({background: "#ffffff"}); | $("body").css({background-color: "#ffffff"}); | ||
$.cookie('name', null); | $.cookie('name', null); | ||
} else { | } else { | ||
$("body").css({background: "#000000"}); | $("body").css({background-color: "#000000"}); | ||
$.cookie('name', 'true'); | $.cookie('name', 'true'); | ||
} | } | ||
Revision as of 20:03, 5 November 2014
$( document ).ready(function() {
var cookie_monster = $.cookie('name');
if (cookie_monster)
{
$.cookie('name', 'true');
$("body").css("background-color", "#000000");
} else {
$.cookie('name', null);
$("body").css("background-color", "#ffffff");
}
/*
$("#switchLights").click(function() {
if (cookie_monster == 'dark')
{
$.cookie('name', 'light');
$("body").css({background: "#ffffff"});
} else {
$.cookie('name', 'dark');
$("body").css({background: "#000000"});
}
});
*/
/*
$("#switchLights").click(function() {
$('#switchLights').toggle(function () {
$("body").css({background: "#ffffff"}); $.cookie('name', null);
}, function() {
$("body").css({background: "#000000"}); $.cookie('name', 'true');
});
});
*/
$("#switchLights").click(function() {
if ($('body').css("background") == "rgb(0, 0, 0)") {
{
$("body").css({background-color: "#ffffff"});
$.cookie('name', null);
} else {
$("body").css({background-color: "#000000"});
$.cookie('name', 'true');
}
});
});