From 888804b6d232490beddc82998d20a83c9c0858e2 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 30 Dec 2015 15:45:15 -0500 Subject: [PATCH] added tag links --- js/app.js | 45 ++++++++++++++++++++++++++++++++++++++++++--- js/custom/upcp.js | 45 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 84 insertions(+), 6 deletions(-) diff --git a/js/app.js b/js/app.js index 80af492..2d6ace6 100644 --- a/js/app.js +++ b/js/app.js @@ -21,6 +21,13 @@ $(document).ready(function () { ;/*global document, window, alert, console, require*/ $(document).ready(function () { "use strict"; + + function createCookie(name, value) { + var date = new Date(); + date.setTime(date.getTime()+(3*1000)); + var expires = "; expires="+date.toGMTString(); + document.cookie = name+"="+value+expires+"; path=/"; + } document.cookie = "catView=grid"; // don't display products on the main "products page" if ((window.location.href.indexOf("products-2") >= 0)){ @@ -73,7 +80,7 @@ $(document).ready(function () { }); // show products if filter is selected else only display categories - $("#tagBox :checkbox").click(function() { + $("#tagBox :checkbox").on("click",function() { $(".product").hide(); $("#gridView").css("display", "inherit"); $("#listView").css("display", "inherit"); @@ -104,8 +111,40 @@ $(document).ready(function () { // $('.searchform').css("right", "5px"); $("#search-icon").css("visibility", "visible"); }); - $("#page-title").append($("#productBreadcrumbs")); $("#blog-side-info-wrapper").insertBefore("#categoriesGridView"); $("#blog-side-info-wrapper").insertBefore("#categoriesListView"); -}); + + var link; + $('#tags a').click(function() { + link = $(this).text(); + createCookie("link", link); + // $("#tagBox :checkbox").trigger("click"); + + }); + // get value of clicked tag ///////////////////// + function getCookie(cname) { + var name = cname + "="; + var ca = document.cookie.split(';'); + for(var i=0; i= 0)){ @@ -53,7 +60,7 @@ $(document).ready(function () { }); // show products if filter is selected else only display categories - $("#tagBox :checkbox").click(function() { + $("#tagBox :checkbox").on("click",function() { $(".product").hide(); $("#gridView").css("display", "inherit"); $("#listView").css("display", "inherit"); @@ -84,8 +91,40 @@ $(document).ready(function () { // $('.searchform').css("right", "5px"); $("#search-icon").css("visibility", "visible"); }); - $("#page-title").append($("#productBreadcrumbs")); $("#blog-side-info-wrapper").insertBefore("#categoriesGridView"); $("#blog-side-info-wrapper").insertBefore("#categoriesListView"); -}); + + var link; + $('#tags a').click(function() { + link = $(this).text(); + createCookie("link", link); + // $("#tagBox :checkbox").trigger("click"); + + }); + // get value of clicked tag ///////////////////// + function getCookie(cname) { + var name = cname + "="; + var ca = document.cookie.split(';'); + for(var i=0; i