From f57cc22391573bf3da4df0bf54fd94ccb4e8dbac Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 31 Dec 2015 08:49:44 -0500 Subject: [PATCH] added conditional for cookies --- js/app.js | 24 +++++++++++++----------- js/custom/upcp.js | 24 +++++++++++++----------- 2 files changed, 26 insertions(+), 22 deletions(-) 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 -- 2.17.1