From a212f19b315e709133d2411587bc76d5653c047b Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 28 Dec 2015 13:45:26 -0500 Subject: [PATCH] added comments and changed display style for filters --- js/app.js | 9 ++++++++- js/custom/upcp.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 8530760..0ecd75f 100644 --- a/js/app.js +++ b/js/app.js @@ -35,6 +35,7 @@ $(document).ready(function () { location.reload(); }); } + // hide product display initially if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){ $("#productsView").css("display", "inherit"); $("#categoriesView").css("display", "none"); @@ -56,7 +57,7 @@ $(document).ready(function () { window.location.href = window.location.pathname; }); } - // change output view + // change output view from list to grid if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) { $("#grid").on("click", function (e) { document.cookie = "view=grid"; @@ -75,17 +76,23 @@ $(document).ready(function () { return $(this).css('clear') == 'both'; }).remove(); + // show products if filter is selected else only display categories $("#tagBox :checkbox").click(function() { $(".product").hide(); + $("#gridView").css("display", "inherit"); + $("#listView").css("display", "inherit"); $("#categoriesGridView").hide(); $("3categoriesListView").hide() $("#tagBox :checkbox:checked").each(function() { $("." + $(this).val()).show(); }); + // hide products on front page, show all products if on products page if($("#tagBox :checkbox:checked").length === 0){ $(".product").show(); $("#categoriesGridView").show(); $("#categoriesListView").show(); + $("#gridView").css("display", "none"); + $("#listView").css("display", "none"); } }); }); diff --git a/js/custom/upcp.js b/js/custom/upcp.js index cfd04e2..ea3291d 100644 --- a/js/custom/upcp.js +++ b/js/custom/upcp.js @@ -15,6 +15,7 @@ $(document).ready(function () { location.reload(); }); } + // hide product display initially if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){ $("#productsView").css("display", "inherit"); $("#categoriesView").css("display", "none"); @@ -36,7 +37,7 @@ $(document).ready(function () { window.location.href = window.location.pathname; }); } - // change output view + // change output view from list to grid if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) { $("#grid").on("click", function (e) { document.cookie = "view=grid"; @@ -55,17 +56,23 @@ $(document).ready(function () { return $(this).css('clear') == 'both'; }).remove(); + // show products if filter is selected else only display categories $("#tagBox :checkbox").click(function() { $(".product").hide(); + $("#gridView").css("display", "inherit"); + $("#listView").css("display", "inherit"); $("#categoriesGridView").hide(); $("3categoriesListView").hide() $("#tagBox :checkbox:checked").each(function() { $("." + $(this).val()).show(); }); + // hide products on front page, show all products if on products page if($("#tagBox :checkbox:checked").length === 0){ $(".product").show(); $("#categoriesGridView").show(); $("#categoriesListView").show(); + $("#gridView").css("display", "none"); + $("#listView").css("display", "none"); } }); }); -- 2.17.1