Subversion Repositories SmartDukaan

Rev

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

Rev 13682 Rev 13686
Line 3... Line 3...
3
		loadingHtml: '<center><img src="/img/ajax-loader.gif" alt="Loading" /></center>',
3
		loadingHtml: '<center><img src="/img/ajax-loader.gif" alt="Loading" /></center>',
4
	    autoTriggerUntil: 3,
4
	    autoTriggerUntil: 3,
5
	    padding: 20,
5
	    padding: 20,
6
	});
6
	});
7
	$('.row').on('click','.viewproduct',function(e){
7
	$('.row').on('click','.viewproduct',function(e){
-
 
8
		$('#loadingModal').modal();
8
		var url = apihost+"clicks/add/"+me+"/"+$(this).data('id');
9
		var url = apihost+"clicks/add/"+me+"/"+$(this).data('id');
9
		$.ajax({
10
		$.ajax({
10
			url: url,
11
			url: url,
11
			// The name of the callback parameter, as specified by the YQL service
12
			// The name of the callback parameter, as specified by the YQL service
12
			jsonp: "callback",
13
			jsonp: "callback",
Line 16... Line 17...
16
			data: {
17
			data: {
17
				format: "json"
18
				format: "json"
18
			},
19
			},
19
			// Work with the response
20
			// Work with the response
20
			success: function( response ) {
21
			success: function( response ) {
-
 
22
				$('#loadingModal').modal('hide');
21
				if(response.success && response.type=='redirect'){
23
				if(response.success && response.type=='redirect'){
22
					document.location = response.url;
24
					document.location = response.url;
23
				}
25
				}
24
			}
26
			}
25
		});
27
		});
-
 
28
		ga('send', 'event', 'product', 'click', $(this).data('id'));
26
	});
29
	});
27
	$('.row').on('click','.likedeal',function(e){		
30
	$('.row').on('click','.likedeal',function(e){			
28
		var that = $(this);
31
		var that = $(this);
29
		if($(that).hasClass('active')){
32
		if($(that).hasClass('active')){
30
			//User has already liked it,so remove like
33
			//User has already liked it,so remove like
31
			var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";	
34
			var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";	
32
		}else{
35
		}else{
Line 48... Line 51...
48
					$(that).toggleClass('active');
51
					$(that).toggleClass('active');
49
					$(that).parent().find('li.dislikedeal',0).removeClass('active');
52
					$(that).parent().find('li.dislikedeal',0).removeClass('active');
50
				}
53
				}
51
			}
54
			}
52
		});
55
		});
-
 
56
		ga('send', 'event', 'product', 'like', $(this).data('id'));
53
	});
57
	});
54
	$('.row').on('click','#unlikebtn',function(e){
58
	$('.row').on('click','#unlikebtn',function(e){
55
		e.preventDefault();
59
		e.preventDefault();
56
		var url = $('#unlikeproductform').attr('action')+'?'+$('#unlikeproductform').serialize()
60
		var url = $('#unlikeproductform').attr('action')+'?'+$('#unlikeproductform').serialize()
57
		console.log(url);
61
		console.log(url);
Line 69... Line 73...
69
			success: function( response ) {
73
			success: function( response ) {
70
				// console.log(response);						
74
				// console.log(response);						
71
			}
75
			}
72
		});
76
		});
73
		$('#myModal').modal('hide');
77
		$('#myModal').modal('hide');
-
 
78
		ga('send', 'event', 'brand', 'hide', $('#myModal').find('#productToHide',0).val());
74
	})
79
	})
75
	$('.row').on('click','.dislikedeal',function(e){			
80
	$('.row').on('click','.dislikedeal',function(e){			
76
		var that = $(this);
81
		var that = $(this);
77
		if($(that).hasClass('active')){
82
		if($(that).hasClass('active')){
78
			//User has already liked it,so remove like
83
			//User has already liked it,so remove like
Line 99... Line 104...
99
					$(that).toggleClass('active');
104
					$(that).toggleClass('active');
100
					$(that).parent().find('li.likedeal',0).removeClass('active');
105
					$(that).parent().find('li.likedeal',0).removeClass('active');
101
				}
106
				}
102
			}
107
			}
103
		});
108
		});
-
 
109
		ga('send', 'event', 'product', 'dislike', $(this).data('id'));
104
	});
110
	});
105
});
111
});