Subversion Repositories SmartDukaan

Rev

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

Rev 20716 Rev 20753
Line 460... Line 460...
460
	    clearTimeout(clickActionTimeout);
460
	    clearTimeout(clickActionTimeout);
461
	    clickActionTimeout = null;
461
	    clickActionTimeout = null;
462
	  }
462
	  }
463
	}
463
	}
464
    
464
    
465
$(document).on('stopdrag', '.viewproduct', function() {
-
 
466
  clearClickActionTimeout();
-
 
467
});    
-
 
468
    $(document).on('click','.viewproduct',function(e){
465
    $(document).on('click','.viewproduct',function(e){
469
    var that = this;
466
    e.preventDefault();
470
  	clearClickActionTimeout();
467
  	clearClickActionTimeout();
471
  	clickActionTimeout = setTimeout(function() {
468
  	clickActionTimeout = setTimeout(function() {
472
    localStorage.pages = $('div.scrollselector').html();
469
    localStorage.pages = $('div.scrollselector').html();
473
		setCookie('fresh', "0", .1, true);
470
		setCookie('fresh', "0", .1, true);
474
        var proid = $(that).data("proid");
471
        var proid = $(this).data("proid");
475
        var identifier = $(that).data("identifier");
472
        var identifier = $(this).data("identifier");
476
        
473
        
477
        if(typeof livePriceCalls != undefined) {
474
        if(typeof livePriceCalls != undefined) {
478
            for(var i in livePriceCalls){
475
            for(var i in livePriceCalls){
479
                livePriceCalls[i].abort();
476
                livePriceCalls[i].abort();
480
            }
477
            }
481
        }
478
        }
482
        $('#loadingModal').modal();
479
        $('#loadingModal').modal();
483
        var store = $(that).data('source');
480
        var store = $(this).data('source');
484
        var url = apihost+"clicks/add/"+me+"/"+$(that).data('id')+'/'+$(that).data('source')+'/?url='+encodeURIComponent($(that).data('url'))+'&price='+$(that).data('price');
481
        var url = apihost+"clicks/add/"+me+"/"+$(this).data('id')+'/'+$(this).data('source')+'/?url='+encodeURIComponent($(this).data('url'))+'&price='+$(this).data('price');
485
        $.ajax({
482
        $.ajax({
486
            url: url,
483
            url: url,
487
            // The name of the callback parameter, as specified by the YQL service
484
            // The name of the callback parameter, as specified by the YQL service
488
            jsonp: "callback",
485
            jsonp: "callback",
489
            // Tell jQuery we're expecting JSONP
486
            // Tell jQuery we're expecting JSONP
Line 550... Line 547...
550
            },
547
            },
551
            error: function() {
548
            error: function() {
552
                document.location = url;
549
                document.location = url;
553
            }
550
            }
554
        });
551
        });
555
        ga('send', 'event', 'product', 'click', $(that).data('url'));
552
        ga('send', 'event', 'product', 'click', $(this).data('url'));
556
        var properties = {};
553
        var properties = {};
557
        properties.sku = String($(that).data('id'));
554
        properties.sku = String($(this).data('id'));
558
        properties.source = String($(that).data('source'));
555
        properties.source = String($(this).data('source'));
559
        properties.url = encodeURIComponent($(that).data('url'));
556
        properties.url = encodeURIComponent($(this).data('url'));
560
        properties.price = String($(that).data('price'));
557
        properties.price = String($(this).data('price'));
561
        pma.send('products','url','click',me,properties);
558
        pma.send('products','url','click',me,properties);
562
  		}, 400);
559
  		}, 200);
563
    });
560
    });
564
    $(document).on('click','.likeit',function(e){   
561
    $(document).on('click','.likeit',function(e){   
565
        var that = $(this);
562
        var that = $(this);
566
        if($(that).find('span.likedeal').hasClass('active')){
563
        if($(that).find('span.likedeal').hasClass('active')){
567
            //User has already liked it,so remove like
564
            //User has already liked it,so remove like