From: Anthony Talarico Date: Thu, 31 Dec 2015 13:49:44 +0000 (-0500) Subject: added conditional for cookies X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=f57cc22391573bf3da4df0bf54fd94ccb4e8dbac;p=WP-Themes%2Fmichsci.git added conditional for cookies --- diff --git a/js/app.js b/js/app.js index f65a61a..8624996 100644 --- a/js/app.js +++ b/js/app.js @@ -134,15 +134,17 @@ $(document).ready(function () { } /////////////////////////////////////////////// var selectedTag = getCookie("link"); - $(":checkbox[value=" + selectedTag + "]").prop("checked", true); - if($(":checkbox[value=" + selectedTag + "]").prop("checked", true)){ - $(".product").hide(); - $("#gridView").css("display", "inherit"); - $("#listView").css("display", "inherit"); - $("#categoriesGridView").hide(); - $("#categoriesListView").hide() - $("#tagBox :checkbox:checked").each(function() { - $("." + $(this).val()).show(); - }); - } + if(selectedTag){ + $(":checkbox[value=" + selectedTag + "]").prop("checked", true); + if($(":checkbox[value=" + selectedTag + "]").prop("checked", true)){ + $(".product").hide(); + $("#gridView").css("display", "inherit"); + $("#listView").css("display", "inherit"); + $("#categoriesGridView").hide(); + $("#categoriesListView").hide() + $("#tagBox :checkbox:checked").each(function() { + $("." + $(this).val()).show(); + }); + } + } }); \ No newline at end of file diff --git a/js/custom/upcp.js b/js/custom/upcp.js index 26bba86..286067e 100644 --- a/js/custom/upcp.js +++ b/js/custom/upcp.js @@ -114,15 +114,17 @@ $(document).ready(function () { } /////////////////////////////////////////////// var selectedTag = getCookie("link"); - $(":checkbox[value=" + selectedTag + "]").prop("checked", true); - if($(":checkbox[value=" + selectedTag + "]").prop("checked", true)){ - $(".product").hide(); - $("#gridView").css("display", "inherit"); - $("#listView").css("display", "inherit"); - $("#categoriesGridView").hide(); - $("#categoriesListView").hide() - $("#tagBox :checkbox:checked").each(function() { - $("." + $(this).val()).show(); - }); - } + if(selectedTag){ + $(":checkbox[value=" + selectedTag + "]").prop("checked", true); + if($(":checkbox[value=" + selectedTag + "]").prop("checked", true)){ + $(".product").hide(); + $("#gridView").css("display", "inherit"); + $("#listView").css("display", "inherit"); + $("#categoriesGridView").hide(); + $("#categoriesListView").hide() + $("#tagBox :checkbox:checked").each(function() { + $("." + $(this).val()).show(); + }); + } + } }); \ No newline at end of file