
var allCookies ={
getItem: function(sKey){
if(!sKey || !this.hasItem(sKey)){return null;}
return unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g,"\\$&")+ "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"),"$1"));
},
setItem: function(sKey,sValue,vEnd,sPath,sDomain,bSecure){
if(!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)){return;}
var sExpires = "";
if(vEnd){
switch(vEnd.constructor){
case Number:
sExpires = vEnd === Infinity ? "; expires=Tue, 19 Jan 2038 03:14:07 GMT" : "; max-age=" + vEnd;
break;
case String:
sExpires = "; expires=" + vEnd;
break;
case Date:
sExpires = "; expires=" + vEnd.toGMTString();
break;
}
}
document.cookie = escape(sKey)+ "=" + escape(sValue)+ sExpires +(sDomain ? "; domain=" + sDomain : "")+(sPath ? "; path=" + sPath : "")+(bSecure ? "; secure" : "");
},
removeItem: function(sKey,sPath){
if(!sKey || !this.hasItem(sKey)){return;}
document.cookie = escape(sKey)+ "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" +(sPath ? "; path=" + sPath : "");
},
hasItem: function(sKey){
return(new RegExp("(?:^|;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g,"\\$&")+ "\\s*\\=")).test(document.cookie);
},
keys: function(){
var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/);
for(var nIdx = 0;nIdx < aKeys.length;nIdx++){aKeys[nIdx] = unescape(aKeys[nIdx]);}
return aKeys;
}
};
function DarkModeApplyCookieSetting()
{
if(allCookies.getItem('darkModeCheck')=='true')DarkModeApply(true);
}
function DarkModeApply(onFlag)
{
if(!DarkModeApply.firstTimeFlag)
{
DarkModeApply.html_back=$('html').css('background');
DarkModeApply.box_back=$('.depressed-box').css('background');
DarkModeApply.span_color=$('span').css('color');
DarkModeApply.body_color=$('body').css('color');
DarkModeApply.p_color=$('p').css('color');
DarkModeApply.h_color=$('h1').css('color');
DarkModeApply.div_color=$('div').css('color');
DarkModeApply.sel_color=$('select').css('color');
DarkModeApply.sel_back=$('.myselect').css('background');
DarkModeApply.multisel_back=$('.multi-select').css('background');
DarkModeApply.logtext_back=$('.logtext').css('background');
DarkModeApply.normtext_color=$('.normtextinput').css('color');
DarkModeApply.normtext_back=$('.normtextinput').css('background');
DarkModeApply.firstTimeFlag=1;
}
if(onFlag)
{
$('html').css('background','#333');
$('body').css('background','#333');
$('.depressed-box').css('background','#555');
$('span').css('color','#000');
$('body').css('color','#ddd');
$('p').css('color','#ddd');
$('td').css('color','#ddd');
$('h1').css('color','#ddd');
$('select').css('color','#ddd');
$('.myselect').css('background','url(css/img/select-bg-dark.png) right center no-repeat');
$('.multi-select').css('background','#555');
$('.logtext').css('background','#555');
$('.logtext').css('color','#ddd');
$('.normtextinput').css('color','#ddd');
$('.normtextinput').css('background','#555');
$('.push').css('filter','invert(76%)');
$('#graphImg').css('filter','invert(100%)');
}
else
{
$('html').css('background',DarkModeApply.html_back);
$('body').css('background',DarkModeApply.html_back);
$('.depressed-box').css('background',DarkModeApply.box_back);
$('span').css('color',DarkModeApply.span_color);
$('body').css('color',DarkModeApply.body_color);
$('p').css('color',DarkModeApply.p_color);
$('td').css('color',DarkModeApply.p_color);
$('h1').css('color',DarkModeApply.h_color);
$('select').css('color',DarkModeApply.sel_color);
$('.myselect').css('background',DarkModeApply.sel_back);
$('.multi-select').css('background',DarkModeApply.multisel_back);
$('.logtext').css('color',DarkModeApply.sel_color);
$('.logtext').css('background',DarkModeApply.logtext_back);
$('.normtextinput').css('color',DarkModeApply.normtext_color);
$('.normtextinput').css('background',DarkModeApply.normtext_back);
$('.push').css('filter','invert(0%)');
$('#graphImg').css('filter','invert(0%)');
}
}
