/*** new school **/ var new_win = null; $(function(){ function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } $(".reveal_all").click(function() { var name_u = trim($(this).attr('name')); $($(this)).unbind('click'); $(this).addClass('codes_revealed'); if( $(this).attr("storehascodes") == "1" ) { $(".codetype-code").each( function() { $(this).attr("opening_all", "1"); $(this).click(); $(this).attr("opening_all", "0"); }); } var new_win = window.open($("a",$(this)).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} var html = 'Scroll Down To View Discounts'; $(this).html(html); window.location = window.location + "#discounts"; return false; } ); $(".click_reveal, .limited_reveal").click(function() { if ( $(this).hasClass("limited_reveal") ) { var $thisdiv = $(this); var $id = $(this).attr('id'); $.post("http://www.myvouchercodes.ie/uniquecode.php", { id: $id }), function(data){ $("a.limrev", $thisdiv).html(''+data+''); } } if (!!$(this).attr("codeid")) { $("."+$(this).attr("codeid")+"_desc").hide(); $("."+$(this).attr("codeid")+"_more").hide(); $("."+$(this).attr("codeid")+"_tip").hide(); $("."+$(this).attr("codeid")+"_confirm").show(); $("."+$(this).attr("codeid")+"_show").hide(); $("."+$(this).attr("codeid")+"_hide").show(); $($(this)).unbind('click'); $("#"+$(this).attr("codeid")+"").addClass('code_clicked'); } else { //This method is kept for backwards compatiblity but should be phased out as it only allows //elements contained within the button itself to be changed and controlled... //the above replacement allows other elements within the same coderow to use the button's behaviour //(i.e. if the code title is clicked the button will turn green and expand) $(".show",$(this)).hide(); $(".hide",$(this)).show(); $($(this)).unbind('click'); $(".code",$(this)).addClass('code_clicked'); } if( $(this).attr("opening_all") != "1" ) { var new_win = window.open( $("#"+$(this).attr("codeid")+"_outlink").attr("value") ,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} } return false; }); $("a.link_reveal").click(function(){ var test = $(this).attr("href"); /* $(".code_confirm",$(this).parents(".type-voucher-code")).show(); $(".code",$(this).parents(".type-voucher-code")).addClass('code_clicked'); $(".show",$(this).parents(".type-voucher-code")).hide(); $(".hide",$(this).parents(".type-voucher-code")).show(); */ new_win = window.open($(this).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} return false; }); //New click to reveal for small 'Click here' on the new code row $(".click_reveal_small").click(function(){ $(".show_small",$(this)).hide(); $(".hide_small",$(this)).show(); new_win = window.open($("a",$(".show_small,",$(this))).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} $($(this)).unbind('click'); return false; }); /////////////////////////////////////// THE REST OF THESE ARE POSSIBLY DEPRECATED (MAYBE NOT FOR PROJECTS THOUGH) $(".hover_reveal").mouseover(function(){ $(".hide",$(this)).show(); $(".show",$(this)).hide(); }); $(".hover_reveal").mouseout(function(){ $(".hide",$(this)).hide(); $(".show",$(this)).show(); }); $(".hover_reveal").mouseup(function(){ $($(this)).unbind('mouseover'); $($(this)).unbind('mouseout'); $($(this)).unbind('mouseup'); $(".code_confirm",$(this)).show(); $(".code",$(this)).addClass('code_clicked'); new_win = window.open($("a",$(".hide,",$(this))).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} return false; }); $(".full_reveal").click(function(){ $(".code_confirm",$(this)).show(); $(".code",$(this)).addClass('code_clicked'); $($(this)).unbind('click'); new_win = window.open($("a",$(".code,",$(this))).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} return false; }); $(".no_reveal").click(function(){ $(".deal",$(this)).addClass('code_clicked'); new_win = window.open($("a",$(".deal,",$(this))).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); return false; }); $(".exp_reveal").mouseup(function(){ $(".deal",$(this)).addClass('code_clicked'); $($(this)).unbind('mouseup'); new_win = window.open($("a",$(".deal,",$(this))).attr("href"),'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); if (new_win) {new_win.blur();} return false; }); $(".exp_reveal").click(function(){ return false; }); window.hoverJSloaded = true; if(window.revealAllClicked) { $(".reveal_all").click(); } if(window.clickRevealClicked != null) { $(window.clickRevealClicked).click(); } });