MediaWiki:Common.js/lightswitch.js

From The Official Visionaire Studio: Adventure Game Engine Wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(function() {
 
	var cookie_monster = $.cookie('lightmode');

	//if (cookie_monster == 'lightmode')
	//{
 	//	$(".themeToggle").attr({href : "http://wiki.visionaire-tracker.net/css/light.css"});
	//} else {
 	//	$(".themeToggle").attr({href : "http://wiki.visionaire-tracker.net/css/dark.css"});
 	//}

	function toggleCSS() {
		if (cookie_monster == 'lightmode')
		{
 			cookie_monster = $.cookie('lightmode', 'darkmode');
 			$(".themeToggle").attr({href : "http://wiki.visionaire-tracker.net/css/dark.css"});
		} else {
			cookie_monster = $.cookie('darkmode', 'lightmode');
 			 $(".themeToggle").attr({href : "http://wiki.visionaire-tracker.net/css/light.css"});
 		}
	};
 
	//$( "#switchLights" ).click(function() { toggleCSS(); });
        $( "#switchLights .lightmode" ).click(function() { 
  			cookie_monster = $.cookie('lightmode', 'darkmode');
 			$("#switchLights").attr({class : "darkmode"}); 
 			$(".themeToggle").attr({href : "http://wiki.visionaire-tracker.net/css/dark.css"});
        });

        $( "#switchLights .darkmode" ).click(function() { 
  			cookie_monster = $.cookie('darkmode', 'lightmode');
 			$("#switchLights").attr({class : "lightmode"}); 
 			$(".themeToggle").attr({href : "http://wiki.visionaire-tracker.net/css/light.css"});        
        });
 
});