/* LAYOUT FILTERS */ jQuery(document).ready(function() { if (typeof filters_init === "undefined") { filters_init = true; console.log("CYA LAYERS BAR INIT"); if (jQuery(".wrap_filters").length > 0) { function GetURLParameters() { var params = []; var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); params.push([ sParameterName[0], sParameterName[1] ]); } return params; } function GetURLParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } return null; } var src_1 = "/lib/images/smileys/local/checked_w.png"; var src_0 = "/lib/images/smileys/local/unchecked_w.png"; if ("" == jQuery(".wrap_filters").html()) { jQuery(".wrap_filters").html( ' Comments' + ' Designs' + ' Tips' ); } var comments_selector = ".wrap_hi, .wrap_answer, .wrap_q, .wrap_a, .wrap_gg, .wrap_patch, .wrap_av, .wrap_username"; var designs_selector = "[class*=gd_],[class$=_design][class*=design_][class^=plugin_include_content]"; var tips_selector = ".wrap_tooltip"; var hidden_layer_comments = (jQuery("#toggle_comments").html().indexOf("unchecked") > -1); var hidden_layer_designs = (jQuery("#toggle_designs" ).html().indexOf("unchecked") > -1); var hidden_layer_tips = (jQuery("#toggle_tips" ).html().indexOf("unchecked") > -1); function toggle_comments() { console.log("CYA LAYERS: Toggle comments"); hidden_layer_comments = !hidden_layer_comments; jQuery(comments_selector ).toggle(); jQuery("#toggle_comments").html(' Comments'); Cookies.set('CYA_LAYERS_comments', hidden_layer_comments ? 0 : 1); } function toggle_designs() { console.log("CYA LAYERS: Toggle designs"); hidden_layer_designs = !hidden_layer_designs; jQuery(designs_selector ).toggle(); jQuery("#toggle_designs" ).html(' Designs' ); Cookies.set('CYA_LAYERS_designs', hidden_layer_designs ? 0 : 1); } function toggle_tips() { console.log("CYA LAYERS: Toggle tips"); hidden_layer_tips = !hidden_layer_tips; jQuery(tips_selector ).toggle(); jQuery("#toggle_tips" ).html(' Tips' ); Cookies.set('CYA_LAYERS_tips', hidden_layer_tips ? 0 : 1); } console.log("CYA LAYERS BAR INIT", "React to click events"); jQuery("#toggle_comments").click(function() { console.log("CYA LAYERS: APPLY comments CLICK"); toggle_comments (); }); jQuery("#toggle_designs" ).click(function() { console.log("CYA LAYERS: APPLY designs CLICK"); toggle_designs (); }); jQuery("#toggle_tips" ).click(function() { console.log("CYA LAYERS: APPLY tips CLICK"); toggle_tips (); }); console.log("CYA LAYERS BAR INIT", "React to cookies settings"); if ((hidden_layer_comments ? "1" : "0") === Cookies.get('CYA_LAYERS_comments') ) { console.log("CYA LAYERS: APPLY comments COOKIE"); toggle_comments (); } if ((hidden_layer_designs ? "1" : "0") === Cookies.get('CYA_LAYERS_designs') ) { console.log("CYA LAYERS: APPLY designs COOKIE"); toggle_designs (); } if ((hidden_layer_tips ? "1" : "0") === Cookies.get('CYA_LAYERS_tips') ) { console.log("CYA LAYERS: APPLY tips COOKIE"); toggle_tips (); } console.log("CYA LAYERS BAR INIT", "React to URL settings"); if ((hidden_layer_comments ? "1" : "0") === GetURLParameter('comments') ) { console.log("CYA LAYERS: APPLY comments URL param"); toggle_comments (); } if ((hidden_layer_designs ? "1" : "0") === GetURLParameter('designs') ) { console.log("CYA LAYERS: APPLY designs URL param"); toggle_designs (); } if ((hidden_layer_tips ? "1" : "0") === GetURLParameter('tips') ) { console.log("CYA LAYERS: APPLY tips URL param"); toggle_tips (); } if ((hidden_layer_tips ? "1" : "0") === GetURLParameter('tooltips') ) { console.log("CYA LAYERS: APPLY tips URL param"); toggle_tips (); } } }});