From a5022b18b471da1b22d3acd8625dea4194f70e5a Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 12 Jan 2016 14:38:09 -0500 Subject: [PATCH] added jquery to handle random extra products page-3 --- js/app.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++ js/custom/upcp.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/js/app.js b/js/app.js index dd11e12..d207309 100644 --- 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(); diff --git a/js/custom/upcp.js b/js/custom/upcp.js index 27e0df8..b3aeb66 100644 --- a/js/custom/upcp.js +++ b/js/custom/upcp.js @@ -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(); -- 2.17.1