added conditional for cookies
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 31 Dec 2015 13:49:44 +0000 (08:49 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 31 Dec 2015 13:49:44 +0000 (08:49 -0500)
js/app.js
js/custom/upcp.js

index f65a61a..8624996 100644 (file)
--- 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
index 26bba86..286067e 100644 (file)
@@ -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