/* * We get all the html tags in the var elemes and in the not functions * We can add classes/divs/id we do not want to include * Then we remove/add the classes necessary for the contrast change * We define a cookie to keep the contrast for the curent session */ (function($) { $(document).ready(function(){ Mousetrap.bind('3', black_white); Mousetrap.bind('4', returnNormal); $( ".box.nea div:not(.pointer)" ).addClass( "exclude" ); $( ".arrow a").addClass( "exclude" ); $( ".social_media a").addClass( "exclude" ); $( ".multimedia div").addClass( "exclude" ); function black_white(){ wb(); } function returnNormal(){ nr(); } if ($.cookie('contrast') != undefined) { if ($.cookie('contrast') == 'b3-black-white') { bw(); } if ($.cookie('contrast') == 'b2-white-black') { wb(); } if ($.cookie('contrast') == 'b1-yellow-blue') { yb(); } if ($.cookie('contrast') == 'b4-normal') { nr(); } } $("#acb-b1-yellow-blue").click(function(){ yb(); }); $("#acb-b2-white-black").click(function(){ wb(); }); $("#acb-b3-black-white").click(function(){ bw(); }); $("#acb-b4-normal").click(function(){ nr(); }); /* for YB */ function yb(){ var elems = document.querySelectorAll ('*:not(img):not(.fixed):not(.right):not(.arrow):not(article):not(.img):not(.exclude):not(.logo):not(.day):not(.week):not(.month):not(.year)'); //remove $(elems).removeClass("acb-black_white"); $(elems).removeClass("acb-white_black"); //add $(elems).addClass("acb-blue_yellow"); $.cookie('contrast', 'b1-yellow-blue', {path: '/'} ); } /* for WB */ function wb(){ var elems = document.querySelectorAll ('*:not(img):not(.fixed):not(.right):not(.arrow):not(article):not(.img):not(.exclude):not(.logo):not(.day):not(.week):not(.month):not(.year)'); //remove $(elems).removeClass("acb-blue_yellow"); $(elems).removeClass("acb-white_black"); //add $(elems).addClass("acb-black_white"); $.cookie('contrast', 'b2-white-black', {path: '/'} ); } /* for BW */ function bw(){ var elems = document.querySelectorAll ('*:not(img):not(.fixed):not(.right):not(.arrow):not(article):not(.img):not(.exclude):not(.logo):not(.day):not(.week):not(.month):not(.year)'); //remove $(elems).removeClass("acb-blue_yellow"); $(elems).removeClass("acb-black_white"); //add $(elems).addClass("acb-white_black"); $.cookie('contrast', 'b3-black-white', {path: '/'} ); } //default function nr(){ var elems = document.querySelectorAll ('*:not(img):not(.fixed):not(.right):not(.arrow):not(article):not(.img):not(.exclude):not(.logo):not(.day):not(.week):not(.month):not(.year)'); //remove $(elems).removeClass("acb-blue_yellow"); $(elems).removeClass("acb-black_white"); $(elems).removeClass("acb-white_black"); $.cookie('contrast', 'b4-normal', {path: '/'} ); } }); })(jQuery);