added jquery to handle random extra products page-3
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Jan 2016 19:38:09 +0000 (14:38 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Jan 2016 19:38:09 +0000 (14:38 -0500)
js/app.js
js/custom/upcp.js

index dd11e12..d207309 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -30,6 +30,8 @@ $(document).ready(function () {
     }
    // createCookie("link", "null");
     document.cookie = "catView=grid";
+    
+    
     // don't display products on the main "products page"
     if ((window.location.href.indexOf("products-2") >= 0)){
         $("#gridView").css("display", "none");
@@ -43,6 +45,20 @@ $(document).ready(function () {
             location.reload();
         });
     }
+    if ((window.location.href.indexOf("products-3") >= 0)){
+        $("#gridView").css("display", "none");
+        $("#listView").css("display", "none");
+        $("#grid").on("click", function (e) {
+            document.cookie = "catView=grid";
+            location.reload();
+        });
+        $("#list").on("click", function (e) {
+            document.cookie = "catView=list";
+            location.reload();
+        });
+    }
+    
+    
     // hide product display initially
     if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){
         $("#productsView").css("display", "inherit");
@@ -52,6 +68,16 @@ $(document).ready(function () {
         $("#categoriesGridView").css("display", "none");
         $("#categoriesListView").css("display", "none");
     }
+    if ((window.location.href.indexOf("products-3/?michsci_category") >= 0)){
+        $("#productsView").css("display", "inherit");
+        $("#categoriesView").css("display", "none");
+        $("#gridView").css("display", "inherit");
+        $("#listView").css("display", "inherit");
+        $("#categoriesGridView").css("display", "none");
+        $("#categoriesListView").css("display", "none");
+    }
+    
+    
     // navigate back to products page if on single product page
     if ((window.location.href.indexOf("products-2/?pagename") >= 0)) {
 //        $("#viewBtns").css("display", "none");
@@ -75,6 +101,29 @@ $(document).ready(function () {
             document.cookie = "view=list";
             location.reload();
         });
+    }
+    if ((window.location.href.indexOf("products-3/?pagename") >= 0)) {
+        //        $("#viewBtns").css("display", "none");
+        $("#grid").on("click", function (e) {
+            document.cookie = "view=grid";
+            window.location.href =  window.location.pathname;
+        });
+        $("#list").on("click", function (e) {
+            document.cookie = "view=list";
+            window.location.href =  window.location.pathname;
+        });
+        $("#tagBox").css("display", "none");
+    }
+    // change output view from list to grid
+    if (!(window.location.href.indexOf("products-3/?pagename") >= 0)) {
+        $("#grid").on("click", function (e) {
+            document.cookie = "view=grid";
+            location.reload();
+        });
+        $("#list").on("click", function (e) {
+            document.cookie = "view=list";
+            location.reload();
+        });
     }
         $("#categoryDropdown").change(function() {
             $("#catSubmit").submit();
index 27e0df8..b3aeb66 100644 (file)
@@ -10,6 +10,8 @@ $(document).ready(function () {
     }
    // createCookie("link", "null");
     document.cookie = "catView=grid";
+    
+    
     // don't display products on the main "products page"
     if ((window.location.href.indexOf("products-2") >= 0)){
         $("#gridView").css("display", "none");
@@ -23,6 +25,20 @@ $(document).ready(function () {
             location.reload();
         });
     }
+    if ((window.location.href.indexOf("products-3") >= 0)){
+        $("#gridView").css("display", "none");
+        $("#listView").css("display", "none");
+        $("#grid").on("click", function (e) {
+            document.cookie = "catView=grid";
+            location.reload();
+        });
+        $("#list").on("click", function (e) {
+            document.cookie = "catView=list";
+            location.reload();
+        });
+    }
+    
+    
     // hide product display initially
     if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){
         $("#productsView").css("display", "inherit");
@@ -32,6 +48,16 @@ $(document).ready(function () {
         $("#categoriesGridView").css("display", "none");
         $("#categoriesListView").css("display", "none");
     }
+    if ((window.location.href.indexOf("products-3/?michsci_category") >= 0)){
+        $("#productsView").css("display", "inherit");
+        $("#categoriesView").css("display", "none");
+        $("#gridView").css("display", "inherit");
+        $("#listView").css("display", "inherit");
+        $("#categoriesGridView").css("display", "none");
+        $("#categoriesListView").css("display", "none");
+    }
+    
+    
     // navigate back to products page if on single product page
     if ((window.location.href.indexOf("products-2/?pagename") >= 0)) {
 //        $("#viewBtns").css("display", "none");
@@ -55,6 +81,29 @@ $(document).ready(function () {
             document.cookie = "view=list";
             location.reload();
         });
+    }
+    if ((window.location.href.indexOf("products-3/?pagename") >= 0)) {
+        //        $("#viewBtns").css("display", "none");
+        $("#grid").on("click", function (e) {
+            document.cookie = "view=grid";
+            window.location.href =  window.location.pathname;
+        });
+        $("#list").on("click", function (e) {
+            document.cookie = "view=list";
+            window.location.href =  window.location.pathname;
+        });
+        $("#tagBox").css("display", "none");
+    }
+    // change output view from list to grid
+    if (!(window.location.href.indexOf("products-3/?pagename") >= 0)) {
+        $("#grid").on("click", function (e) {
+            document.cookie = "view=grid";
+            location.reload();
+        });
+        $("#list").on("click", function (e) {
+            document.cookie = "view=list";
+            location.reload();
+        });
     }
         $("#categoryDropdown").change(function() {
             $("#catSubmit").submit();