;/*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)){
});
// 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");
// $('.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<ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0)==' ') c = c.substring(1);
+ if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
+ }
+ return "";
+ }
+ ///////////////////////////////////////////////
+ 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();
+ });
+ }
+
+});
\ No newline at end of file
/*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)){
});
// 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");
// $('.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<ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0)==' ') c = c.substring(1);
+ if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
+ }
+ return "";
+ }
+ ///////////////////////////////////////////////
+ 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();
+ });
+ }
+
+});
\ No newline at end of file