Subversion Repositories SmartDukaan

Rev

Rev 15042 | Rev 15065 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15042 Rev 15058
Line 485... Line 485...
485
	setCookie(cname, parseInt(currentCount)+1, 365);
485
	setCookie(cname, parseInt(currentCount)+1, 365);
486
}
486
}
487
var hidden, visibilityChange; 
487
var hidden, visibilityChange; 
488
function handleVisibilityChange() {
488
function handleVisibilityChange() {
489
  if (document[hidden]) {
489
  if (document[hidden]) {
490
    console.log('mujhe dekho');
-
 
491
    document.title = "Mujhe Dekho Please";
490
  	// pagetitle = document.title;
492
    var tout = setTimeout(function(){ document.location.reload(); }, 1000*60);
-
 
493
  } else {
491
  } else {
494
    console.log('active');
492
  	// document.title = pagetitle;
495
    clearTimeout(tout);
-
 
496
  }
493
  }
497
}
494
}
498
if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support 
495
if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support 
499
  hidden = "hidden";
496
  hidden = "hidden";
500
  visibilityChange = "visibilitychange";
497
  visibilityChange = "visibilitychange";
Line 524... Line 521...
524
});
521
});
525
$(document).on('click','.clearfilter',function(){	
522
$(document).on('click','.clearfilter',function(){	
526
	$('.filterbrand').each(function(){
523
	$('.filterbrand').each(function(){
527
		$(this).prop('checked',false);
524
		$(this).prop('checked',false);
528
	});	
525
	});	
-
 
526
	ga('send', 'event', 'filter', 'brand', 'clearfilter');
529
});
527
});
530
$(document).on('click','.applyfilter',function(){	
528
$(document).on('click','.applyfilter',function(){	
531
	var brands = [];
529
	var brands = [];
532
	var brandnames = [];
530
	var brandnames = [];
533
	$('.filterbrand').each(function(){
531
	$('.filterbrand').each(function(){
Line 540... Line 538...
540
	if(brands.length==0){
538
	if(brands.length==0){
541
		$('#message').html('Please choose a few brands first').removeClass('hidden');
539
		$('#message').html('Please choose a few brands first').removeClass('hidden');
542
		setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
540
		setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
543
		return false;
541
		return false;
544
	}else{
542
	}else{
545
		setCookie('brandschosen', brands, 2);
543
		setCookie('brandschosen', brands, 1);
546
		var url = $('#brandselecter').prop('action');
544
		var url = $('#brandselecter').prop('action');
547
		ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
545
		ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
548
		document.location = url+'&brands='+brands.join('^');
546
		document.location = url+'&brands='+brands.join('^');
549
	}	
547
	}	
550
});
548
});
Line 592... Line 590...
592
	}});
590
	}});
593
	}
591
	}
594
})
592
})
595
$(document).on('click','.clearfilters',function(){
593
$(document).on('click','.clearfilters',function(){
596
	setCookie('brandschosen', '', -1);
594
	setCookie('brandschosen', '', -1);
-
 
595
	ga('send', 'event', 'filter', 'brand', 'clearfilters');
597
	document.location.reload();
596
	document.location.reload();
598
});
597
});
599
function selectChosenBrands(){
598
function selectChosenBrands(){
600
	var brandschosen = getCookie('brandschosen');
599
	var brandschosen = getCookie('brandschosen');
601
	if(brandschosen && brandschosen.length>0){
600
	if(brandschosen && brandschosen.length>0){
602
		var brands = brandschosen.split(',');
601
		var brands = brandschosen.split(',');
603
		for(var i in brands){
602
		for(var i in brands){
604
			$('.brand').filter(function() { 
603
			$('.brand').filter(function() { 
605
			  	return $(this).data("brandid") == brands[i];
604
			  	return $(this).data("brandid") == brands[i];
606
			}).trigger( "click" );
605
			}).trigger( "click" ).removeClass('hidden');
607
		}
606
		}
608
	}
607
	}
609
}
608
}
610
609