MediaWiki:Common.js/lightswitch.js: Difference between revisions

From The Official Visionaire Studio: Adventure Game Engine Wiki
No edit summary
No edit summary
Line 3: Line 3:
var cookie_monster = $.cookie('name');
var cookie_monster = $.cookie('name');


   if (cookie_monster == true)
   if (cookie_monster == 'dark')
                 {
                 {
                   $.cookie('name', true);
                   $.cookie('name', 'dark');
                   $("body").css("background", "#000000");
                   $("body").css("background", "#000000");
               } else {
               } else {
                   $.cookie('name', false);
                   $.cookie('name', 'light');
                   $("body").css("background", "#ffffff");
                   $("body").css("background", "#ffffff");
               }
               }
   
   
         $("#switchLights").click(function() {  
         $("#switchLights").click(function() {  
         if (cookie_monster == true)
         if (cookie_monster == 'dark')
               {
               {
                   $.cookie('name', false);
                   $.cookie('name', 'light');
                   $("body").css("background", "#ffffff");
                   $("body").css("background", "#ffffff");
                 } else {
                 } else {
                   $.cookie('name', 'darkmode');
                   $.cookie('name', 'dark');
                   $("body").css("background", "#000000");
                   $("body").css("background", "#000000");
                 }
                 }

Revision as of 18:34, 5 November 2014

$( document ).ready(function() {
 
	var cookie_monster = $.cookie('name');

  		if (cookie_monster == 'dark')
                {
                  $.cookie('name', 'dark');
                  $("body").css("background", "#000000");
               } else {
                   $.cookie('name', 'light');
                   $("body").css("background", "#ffffff");
               }
 
        $("#switchLights").click(function() { 
  	       if (cookie_monster == 'dark')
               {
                   $.cookie('name', 'light');
                   $("body").css("background", "#ffffff");
                } else {
                   $.cookie('name', 'dark');
                   $("body").css("background", "#000000");
                }
        });
 
});