| Line 1... |
Line 1... |
| 1 |
var livePriceCalls = [];
|
1 |
var livePriceCalls = [];
|
| 2 |
var outOfStockCount = 0;
|
2 |
var outOfStockCount = 0;
|
| 3 |
function getcashbackstring(type,value) {
|
3 |
function getcashbackstring(type,value) {
|
| 4 |
if(value==0){
|
4 |
if(value==0){
|
| 5 |
return '';
|
5 |
return '';
|
| 6 |
}
|
6 |
}
|
| 7 |
if(type==2){
|
7 |
if(type==2){
|
| 8 |
return ' +'+value+' Cashback';
|
8 |
return ' +'+value+' Cashback';
|
| 9 |
}else if(type==1){
|
9 |
}else if(type==1){
|
| 10 |
return ' +'+value+'% Cashback';
|
10 |
return ' +'+value+'% Cashback';
|
| 11 |
}else{
|
11 |
}else{
|
| 12 |
return '';
|
12 |
return '';
|
| 13 |
}
|
13 |
}
|
| 14 |
};
|
14 |
};
|
| 15 |
function showShopcluesPopup(url){
|
15 |
function showShopcluesPopup(url){
|
| 16 |
$('#shopcluesUrl').prop('href',url);
|
16 |
$('#shopcluesUrl').prop('href',url);
|
| 17 |
$('#shopcluesModal').modal('show');
|
17 |
$('#shopcluesModal').modal('show');
|
| 18 |
return;
|
18 |
return;
|
| 19 |
};
|
19 |
};
|
| 20 |
function showPaytmPopup(url){
|
20 |
function showPaytmPopup(url){
|
| 21 |
$('#paytmUrl').prop('href',url);
|
21 |
$('#paytmUrl').prop('href',url);
|
| 22 |
$('#paytmModal').modal('show');
|
22 |
$('#paytmModal').modal('show');
|
| 23 |
return;
|
23 |
return;
|
| 24 |
};
|
24 |
};
|
| 25 |
function showPaytmHelpPopup() {
|
25 |
function showPaytmHelpPopup() {
|
| 26 |
$('#loadingModal').modal('hide');
|
26 |
$('#loadingModal').modal('hide');
|
| 27 |
$('#paytmHelpModal').modal('show');
|
27 |
$('#paytmHelpModal').modal('show');
|
| 28 |
}
|
28 |
}
|
| 29 |
function redirectToPaytm(url){
|
29 |
function redirectToPaytm(url){
|
| 30 |
url = 'http://mobilehotindia.com/r.html?'+Base64.encode(url);
|
30 |
url = 'http://mobilehotindia.com/r.html?'+Base64.encode(url);
|
| 31 |
$('#paytmHelpModal').modal('hide');
|
31 |
$('#paytmHelpModal').modal('hide');
|
| 32 |
//check if paytm is active or not
|
32 |
//check if paytm is active or not
|
| 33 |
var paytmactive = getCookie('paytmActive',1);
|
33 |
var paytmactive = getCookie('paytmActive',1);
|
| 34 |
if(paytmactive && paytmactive == 'true'){
|
34 |
if(paytmactive && paytmactive == 'true'){
|
| 35 |
document.location = url;
|
35 |
document.location = url;
|
| 36 |
pma.send('apk','paytm','active',me,null);
|
36 |
pma.send('apk','paytm','active',me,null);
|
| 37 |
}else{
|
37 |
}else{
|
| 38 |
pma.send('apk','paytm','inactive',me,null);
|
38 |
pma.send('apk','paytm','inactive',me,null);
|
| 39 |
$('#loadingModal').modal('hide');
|
39 |
$('#loadingModal').modal('hide');
|
| 40 |
showPaytmPopup(url);
|
40 |
showPaytmPopup(url);
|
| 41 |
}
|
41 |
}
|
| 42 |
}
|
42 |
}
|
| 43 |
|
43 |
|
| 44 |
function redirectTohomeShop18(url){
|
44 |
function redirectTohomeShop18(url){
|
| 45 |
url = 'http://mobilehotindia.com/r.html?'+Base64.encode(url);
|
45 |
url = 'http://mobilehotindia.com/r.html?'+Base64.encode(url);
|
| 46 |
//check if paytm is active or not
|
46 |
//check if paytm is active or not
|
| 47 |
var homeShop18active = getCookie('homeshop18',1);
|
47 |
var homeShop18active = getCookie('homeshop18',1);
|
| 48 |
if(homeShop18active && homeShop18active == 'true'){
|
48 |
if(homeShop18active && homeShop18active == 'true'){
|
| 49 |
document.location = url;
|
49 |
document.location = url;
|
| 50 |
pma.send('apk','homeShop18','active',me,null);
|
50 |
pma.send('apk','homeShop18','active',me,null);
|
| 51 |
}else{
|
51 |
}else{
|
| 52 |
pma.send('apk','homeShop18','inactive',me,null);
|
52 |
pma.send('apk','homeShop18','inactive',me,null);
|
| 53 |
$('#loadingModal').modal('hide');
|
53 |
$('#loadingModal').modal('hide');
|
| 54 |
showhomeShop18Popup(url);
|
54 |
showhomeShop18Popup(url);
|
| 55 |
}
|
55 |
}
|
| 56 |
}
|
56 |
}
|
| 57 |
|
57 |
|
| 58 |
function showhomeShop18Popup(url){
|
58 |
function showhomeShop18Popup(url){
|
| 59 |
$('#homeShop18Url').prop('href',url);
|
59 |
$('#homeShop18Url').prop('href',url);
|
| 60 |
$('#homeShop18Modal').modal('show');
|
60 |
$('#homeShop18Modal').modal('show');
|
| 61 |
return;
|
61 |
return;
|
| 62 |
};
|
62 |
};
|
| 63 |
|
63 |
|
| 64 |
$(function(){
|
64 |
$(function(){
|
| 65 |
if($('.scrollselector > .card').length>0) {
|
65 |
if($('.scrollselector > .card').length>0) {
|
| 66 |
setTimeout(function(){ document.location.reload(); }, 1000*15*60);
|
66 |
setTimeout(function(){ document.location.reload(); }, 1000*15*60);
|
| Line 328... |
Line 328... |
| 328 |
}
|
328 |
}
|
| 329 |
ga('send', 'event', 'preferences', 'update', me);
|
329 |
ga('send', 'event', 'preferences', 'update', me);
|
| 330 |
properties = pma.formDataToObject($('#categorypreference-'+$(this).data('id')).serializeArray());
|
330 |
properties = pma.formDataToObject($('#categorypreference-'+$(this).data('id')).serializeArray());
|
| 331 |
pma.send('preferences', 'update', 'set', me, properties);
|
331 |
pma.send('preferences', 'update', 'set', me, properties);
|
| 332 |
});
|
332 |
});
|
| - |
|
333 |
|
| - |
|
334 |
|
| - |
|
335 |
$(document).on('click','.accsproduct',function(){
|
| - |
|
336 |
$('#loadingModal').modal();
|
| - |
|
337 |
var url = $(this).data('url');
|
| - |
|
338 |
window.location = url;
|
| - |
|
339 |
});
|
| - |
|
340 |
|
| 333 |
$(document).on('click','.viewproduct',function(e){
|
341 |
$(document).on('click','.viewproduct',function(e){
|
| 334 |
if(typeof livePriceCalls != undefined) {
|
342 |
if(typeof livePriceCalls != undefined) {
|
| 335 |
for(var i in livePriceCalls){
|
343 |
for(var i in livePriceCalls){
|
| 336 |
livePriceCalls[i].abort();
|
344 |
livePriceCalls[i].abort();
|
| 337 |
}
|
345 |
}
|
| Line 378... |
Line 386... |
| 378 |
});
|
386 |
});
|
| 379 |
}else{
|
387 |
}else{
|
| 380 |
redirectToPaytm(response.url);
|
388 |
redirectToPaytm(response.url);
|
| 381 |
}
|
389 |
}
|
| 382 |
|
390 |
|
| 383 |
}
|
391 |
}
|
| 384 |
//for homeshop 18
|
392 |
//for homeshop 18
|
| 385 |
else if(store == 7)
|
393 |
else if(store == 7)
|
| 386 |
{
|
394 |
{
|
| 387 |
redirectTohomeShop18(response.url);
|
395 |
redirectTohomeShop18(response.url);
|
| 388 |
|
396 |
|
| 389 |
}
|
397 |
}
|
| 390 |
else if (store == 3 || store == 2) {
|
398 |
else if (store == 3 || store == 2) {
|
| 391 |
if (store == 2){
|
399 |
if (store == 2){
|
| 392 |
response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
|
400 |
response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
|
| 393 |
}
|
401 |
}
|
| 394 |
if (store == 3){
|
402 |
if (store == 3){
|
| 395 |
response.url = '/r.html?'+Base64.encode(response.url);
|
403 |
response.url = '/r.html?'+Base64.encode(response.url);
|
| 396 |
}
|
404 |
}
|
| 397 |
if(response.showmessage == 1) {
|
405 |
if(response.showmessage == 1) {
|
| 398 |
$('#loadingModal').modal('hide');
|
406 |
$('#loadingModal').modal('hide');
|
| 399 |
$('#customMessage').html(response.message);
|
407 |
$('#customMessage').html(response.message);
|
| 400 |
$('#customMessageModal').modal('show');
|
408 |
$('#customMessageModal').modal('show');
|
| 401 |
setTimeout(function(){ document.location = response.url;}, 1000*3);
|
409 |
setTimeout(function(){ document.location = response.url;}, 1000*3);
|
| 402 |
} else{
|
410 |
} else{
|
| 403 |
document.location = response.url;
|
411 |
document.location = response.url;
|
| 404 |
}
|
412 |
}
|
| 405 |
} else {
|
413 |
} else {
|
| 406 |
response.url = '/r.html?'+Base64.encode(response.url);
|
414 |
response.url = '/r.html?'+Base64.encode(response.url);
|
| 407 |
document.location = response.url;
|
415 |
document.location = response.url;
|
| - |
|
416 |
}
|
| 408 |
}
|
417 |
}
|
| 409 |
}
|
- |
|
| 410 |
},
|
418 |
},
|
| 411 |
error: function() {
|
419 |
error: function() {
|
| 412 |
document.location = url;
|
420 |
document.location = url;
|
| 413 |
}
|
421 |
}
|
| 414 |
});
|
422 |
});
|
| 415 |
ga('send', 'event', 'product', 'click', $(this).data('url'));
|
423 |
ga('send', 'event', 'product', 'click', $(this).data('url'));
|
| 416 |
var properties = {};
|
424 |
var properties = {};
|
| 417 |
properties.sku = String($(this).data('id'));
|
425 |
properties.sku = String($(this).data('id'));
|
| 418 |
properties.source = String($(this).data('source'));
|
426 |
properties.source = String($(this).data('source'));
|
| 419 |
properties.url = encodeURIComponent($(this).data('url'));
|
427 |
properties.url = encodeURIComponent($(this).data('url'));
|
| 420 |
properties.price = String($(this).data('price'));
|
428 |
properties.price = String($(this).data('price'));
|
| 421 |
pma.send('products','url','click',me,properties);
|
429 |
pma.send('products','url','click',me,properties);
|
| 422 |
});
|
430 |
});
|
| 423 |
$(document).on('click','.likeit',function(e){
|
431 |
$(document).on('click','.likeit',function(e){
|
| 424 |
var that = $(this);
|
432 |
var that = $(this);
|
| 425 |
if($(that).find('span.likedeal').hasClass('active')){
|
433 |
if($(that).find('span.likedeal').hasClass('active')){
|
| 426 |
//User has already liked it,so remove like
|
434 |
//User has already liked it,so remove like
|
| 427 |
var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";
|
435 |
var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";
|
| 428 |
}else{
|
436 |
}else{
|
| 429 |
var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/like";
|
437 |
var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/like";
|
| 430 |
}
|
438 |
}
|
| 431 |
$.ajax({
|
439 |
$.ajax({
|
| 432 |
url: url,
|
440 |
url: url,
|
| 433 |
// The name of the callback parameter, as specified by the YQL service
|
441 |
// The name of the callback parameter, as specified by the YQL service
|
| 434 |
jsonp: "callback",
|
442 |
jsonp: "callback",
|
| 435 |
// Tell jQuery we're expecting JSONP
|
443 |
// Tell jQuery we're expecting JSONP
|
| 436 |
dataType: "jsonp",
|
444 |
dataType: "jsonp",
|
| 437 |
// Tell YQL what we want and that we want JSON
|
445 |
// Tell YQL what we want and that we want JSON
|
| 438 |
data: {
|
446 |
data: {
|
| 439 |
format: "json"
|
447 |
format: "json"
|
| 440 |
},
|
448 |
},
|
| 441 |
// Work with the response
|
449 |
// Work with the response
|
| 442 |
success: function( response ) {
|
450 |
success: function( response ) {
|
| 443 |
if(response.success){
|
451 |
if(response.success){
|
| 444 |
that.find('span.likedeal').toggleClass('active');
|
452 |
that.find('span.likedeal').toggleClass('active');
|
| 445 |
$(".img-overlay div[name='dislikediv_"+that.data('id')+"']").find('span.dislikedeal').removeClass('active');
|
453 |
$(".img-overlay div[name='dislikediv_"+that.data('id')+"']").find('span.dislikedeal').removeClass('active');
|
| 446 |
}
|
454 |
}
|
| 447 |
}
|
455 |
}
|
| 448 |
});
|
456 |
});
|
| 449 |
ga('send', 'event', 'product', 'like', $(this).data('id'));
|
457 |
ga('send', 'event', 'product', 'like', $(this).data('id'));
|
| 450 |
var properties = {};
|
458 |
var properties = {};
|
| 451 |
properties.sku = String($(this).data('id'));
|
459 |
properties.sku = String($(this).data('id'));
|
| 452 |
pma.send('products','favourites','like',me,properties);
|
460 |
pma.send('products','favourites','like',me,properties);
|
| 453 |
});
|
461 |
});
|
| 454 |
$('#myModal').on('click','#unlikebtn',function(e){
|
462 |
$('#myModal').on('click','#unlikebtn',function(e){
|
| 455 |
e.preventDefault();
|
463 |
e.preventDefault();
|
| 456 |
var url = $('#unlikeproductform').attr('action')+'?'+$('#unlikeproductform').serialize()
|
464 |
var url = $('#unlikeproductform').attr('action')+'?'+$('#unlikeproductform').serialize()
|
| 457 |
$.ajax({
|
465 |
$.ajax({
|
| 458 |
url: url,
|
466 |
url: url,
|
| 459 |
// The name of the callback parameter, as specified by the YQL service
|
467 |
// The name of the callback parameter, as specified by the YQL service
|
| 460 |
jsonp: "callback",
|
468 |
jsonp: "callback",
|
| 461 |
// Tell jQuery we're expecting JSONP
|
469 |
// Tell jQuery we're expecting JSONP
|
| 462 |
dataType: "jsonp",
|
470 |
dataType: "jsonp",
|
| 463 |
// Tell YQL what we want and that we want JSON
|
471 |
// Tell YQL what we want and that we want JSON
|
| 464 |
data: {
|
472 |
data: {
|
| 465 |
format: "json"
|
473 |
format: "json"
|
| 466 |
},
|
474 |
},
|
| 467 |
// Work with the response
|
475 |
// Work with the response
|
| 468 |
success: function( response ) {
|
476 |
success: function( response ) {
|
| 469 |
}
|
477 |
}
|
| 470 |
});
|
478 |
});
|
| 471 |
$('#myModal').modal('hide');
|
479 |
$('#myModal').modal('hide');
|
| 472 |
ga('send', 'event', 'brand', 'hide', $('#myModal').find('#productToHide',0).val());
|
480 |
ga('send', 'event', 'brand', 'hide', $('#myModal').find('#productToHide',0).val());
|
| 473 |
pma.send('brands','hide',$('#myModal').find('#productToHide',0).val(),me);
|
481 |
pma.send('brands','hide',$('#myModal').find('#productToHide',0).val(),me);
|
| 474 |
})
|
482 |
})
|
| 475 |
$(document).on('click','.dislikeit',function(e){
|
483 |
$(document).on('click','.dislikeit',function(e){
|
| 476 |
var that = $(this);
|
484 |
var that = $(this);
|
| 477 |
if($(that).find('span.dislikedeal').hasClass('active')){
|
485 |
if($(that).find('span.dislikedeal').hasClass('active')){
|
| 478 |
//User has already liked it,so remove like
|
486 |
//User has already liked it,so remove like
|
| 479 |
var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/dislike";
|
487 |
var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/dislike";
|
| 480 |
}else{
|
488 |
}else{
|
| 481 |
$('#myModal').find('#productToHide',0).val($(this).data('id'));
|
489 |
$('#myModal').find('#productToHide',0).val($(this).data('id'));
|
| 482 |
var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/dislike";
|
490 |
var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/dislike";
|
| 483 |
}
|
491 |
}
|
| 484 |
$.ajax({
|
492 |
$.ajax({
|
| 485 |
url: url,
|
493 |
url: url,
|
| 486 |
// The name of the callback parameter, as specified by the YQL service
|
494 |
// The name of the callback parameter, as specified by the YQL service
|
| 487 |
jsonp: "callback",
|
495 |
jsonp: "callback",
|
| 488 |
// Tell jQuery we're expecting JSONP
|
496 |
// Tell jQuery we're expecting JSONP
|
| 489 |
dataType: "jsonp",
|
497 |
dataType: "jsonp",
|
| 490 |
// Tell YQL what we want and that we want JSON
|
498 |
// Tell YQL what we want and that we want JSON
|
| 491 |
data: {
|
499 |
data: {
|
| 492 |
format: "json"
|
500 |
format: "json"
|
| 493 |
},
|
501 |
},
|
| 494 |
// Work with the response
|
502 |
// Work with the response
|
| 495 |
success: function( response ) {
|
503 |
success: function( response ) {
|
| 496 |
if(response.success){
|
504 |
if(response.success){
|
| 497 |
that.find('span.dislikedeal').toggleClass('active');
|
505 |
that.find('span.dislikedeal').toggleClass('active');
|
| 498 |
$(".img-overlay div[name='likediv_"+that.data('id')+"']").find('span.likedeal').removeClass('active');
|
506 |
$(".img-overlay div[name='likediv_"+that.data('id')+"']").find('span.likedeal').removeClass('active');
|
| 499 |
}
|
507 |
}
|
| 500 |
}
|
508 |
}
|
| 501 |
});
|
509 |
});
|
| 502 |
ga('send', 'event', 'product', 'dislike', $(this).data('id'));
|
510 |
ga('send', 'event', 'product', 'dislike', $(this).data('id'));
|
| 503 |
var properties = {};
|
511 |
var properties = {};
|
| 504 |
properties.sku = String($(this).data('id'));
|
512 |
properties.sku = String($(this).data('id'));
|
| 505 |
pma.send('products','favourites','dislike',me,properties);
|
513 |
pma.send('products','favourites','dislike',me,properties);
|
| 506 |
});
|
514 |
});
|
| 507 |
$('.deletefav').on('click',function(){
|
515 |
$('.deletefav').on('click',function(){
|
| 508 |
var that = $(this);
|
516 |
var that = $(this);
|
| 509 |
$('#loadingModal').modal();
|
517 |
$('#loadingModal').modal();
|
| 510 |
var url = apihost+"/user_actions/deletefav/"+me+"/"+$(this).data('id');
|
518 |
var url = apihost+"/user_actions/deletefav/"+me+"/"+$(this).data('id');
|
| 511 |
$.ajax({
|
519 |
$.ajax({
|
| 512 |
url: url,
|
520 |
url: url,
|
| 513 |
// The name of the callback parameter, as specified by the YQL service
|
521 |
// The name of the callback parameter, as specified by the YQL service
|
| 514 |
jsonp: "callback",
|
522 |
jsonp: "callback",
|
| 515 |
// Tell jQuery we're expecting JSONP
|
523 |
// Tell jQuery we're expecting JSONP
|
| 516 |
dataType: "jsonp",
|
524 |
dataType: "jsonp",
|
| 517 |
// Tell YQL what we want and that we want JSON
|
525 |
// Tell YQL what we want and that we want JSON
|
| 518 |
data: {
|
526 |
data: {
|
| 519 |
format: "json"
|
527 |
format: "json"
|
| 520 |
},
|
528 |
},
|
| 521 |
// Work with the response
|
529 |
// Work with the response
|
| 522 |
success: function( response ) {
|
530 |
success: function( response ) {
|
| 523 |
$('#loadingModal').modal('hide');
|
531 |
$('#loadingModal').modal('hide');
|
| 524 |
if(response.success){
|
532 |
if(response.success){
|
| 525 |
$('#fav-'+$(that).data('id')).hide('slow');
|
533 |
$('#fav-'+$(that).data('id')).hide('slow');
|
| 526 |
}
|
534 |
}
|
| 527 |
}
|
535 |
}
|
| 528 |
});
|
536 |
});
|
| 529 |
ga('send', 'event', 'favourites', 'remove', $(this).data('id'));
|
537 |
ga('send', 'event', 'favourites', 'remove', $(this).data('id'));
|
| 530 |
var properties = {};
|
538 |
var properties = {};
|
| 531 |
properties.sku = String($(this).data('id'));
|
539 |
properties.sku = String($(this).data('id'));
|
| 532 |
pma.send('products','favourites','remove',me,properties);
|
540 |
pma.send('products','favourites','remove',me,properties);
|
| 533 |
});
|
541 |
});
|
| 534 |
$('.clearfavs').on('click',function(){
|
542 |
$('.clearfavs').on('click',function(){
|
| 535 |
var that = $(this);
|
543 |
var that = $(this);
|
| 536 |
$('#loadingModal').modal();
|
544 |
$('#loadingModal').modal();
|
| 537 |
var url = apihost+"/user_actions/deleteallfavs/"+me+'/'+$(this).data('type');
|
545 |
var url = apihost+"/user_actions/deleteallfavs/"+me+'/'+$(this).data('type');
|
| 538 |
$.ajax({
|
546 |
$.ajax({
|
| 539 |
url: url,
|
547 |
url: url,
|
| 540 |
// The name of the callback parameter, as specified by the YQL service
|
548 |
// The name of the callback parameter, as specified by the YQL service
|
| 541 |
jsonp: "callback",
|
549 |
jsonp: "callback",
|
| 542 |
// Tell jQuery we're expecting JSONP
|
550 |
// Tell jQuery we're expecting JSONP
|
| 543 |
dataType: "jsonp",
|
551 |
dataType: "jsonp",
|
| 544 |
// Tell YQL what we want and that we want JSON
|
552 |
// Tell YQL what we want and that we want JSON
|
| 545 |
data: {
|
553 |
data: {
|
| 546 |
format: "json"
|
554 |
format: "json"
|
| 547 |
},
|
555 |
},
|
| 548 |
// Work with the response
|
556 |
// Work with the response
|
| 549 |
success: function( response ) {
|
557 |
success: function( response ) {
|
| 550 |
$('#loadingModal').modal('hide');
|
558 |
$('#loadingModal').modal('hide');
|
| 551 |
if(response.success){
|
559 |
if(response.success){
|
| 552 |
$('.deletefav').each(function(){
|
560 |
$('.deletefav').each(function(){
|
| 553 |
$('#fav-'+$(this).data('id')).hide('slow');
|
561 |
$('#fav-'+$(this).data('id')).hide('slow');
|
| 554 |
})
|
562 |
})
|
| 555 |
}
|
563 |
}
|
| 556 |
$(that).hide();
|
564 |
$(that).hide();
|
| 557 |
}
|
565 |
}
|
| 558 |
});
|
566 |
});
|
| 559 |
ga('send', 'event', 'favourites', 'removeall', me);
|
567 |
ga('send', 'event', 'favourites', 'removeall', me);
|
| 560 |
pma.send('products','favourites','removeall',me);
|
568 |
pma.send('products','favourites','removeall',me);
|
| 561 |
});
|
569 |
});
|
| 562 |
$('.revealbrands').on('click',function(){
|
570 |
$('.revealbrands').on('click',function(){
|
| 563 |
$(this).parent().find('.notfeatured').toggleClass('hidden');
|
571 |
$(this).parent().find('.notfeatured').toggleClass('hidden');
|
| 564 |
if($(this).html()=='Others'){
|
572 |
if($(this).html()=='Others'){
|
| 565 |
$(this).html('Hide');
|
573 |
$(this).html('Hide');
|
| 566 |
}else{
|
574 |
}else{
|
| 567 |
$(this).html('Others');
|
575 |
$(this).html('Others');
|
| 568 |
}
|
576 |
}
|
| 569 |
});
|
577 |
});
|
| 570 |
$(document).on('click','.showtips',function(){
|
578 |
$(document).on('click','.showtips',function(){
|
| 571 |
$('.apptips').toggleClass('hidden');
|
579 |
$('.apptips').toggleClass('hidden');
|
| 572 |
});
|
580 |
});
|
| 573 |
$(document).on('click','.creditedcashbacks',function(){
|
581 |
$(document).on('click','.creditedcashbacks',function(){
|
| 574 |
if($(this).find('.glyphicon-plus',0).length>0){
|
582 |
if($(this).find('.glyphicon-plus',0).length>0){
|
| 575 |
$(this).find('.glyphicon-plus',0).removeClass('glyphicon-plus').addClass('glyphicon-minus');
|
583 |
$(this).find('.glyphicon-plus',0).removeClass('glyphicon-plus').addClass('glyphicon-minus');
|
| 576 |
}else{
|
584 |
}else{
|
| 577 |
$(this).find('.glyphicon-minus',0).removeClass('glyphicon-minus').addClass('glyphicon-plus');
|
585 |
$(this).find('.glyphicon-minus',0).removeClass('glyphicon-minus').addClass('glyphicon-plus');
|
| 578 |
}
|
586 |
}
|
| 579 |
$(this).next().toggleClass('hidden');
|
587 |
$(this).next().toggleClass('hidden');
|
| 580 |
});
|
588 |
});
|
| 581 |
$(document).on('click','.panel-heading a',function(){
|
589 |
$(document).on('click','.panel-heading a',function(){
|
| 582 |
if($(this).find('.glyphicon-plus',0).length>0){
|
590 |
if($(this).find('.glyphicon-plus',0).length>0){
|
| 583 |
$(this).find('.glyphicon-plus',0).removeClass('glyphicon-plus').addClass('glyphicon-minus');
|
591 |
$(this).find('.glyphicon-plus',0).removeClass('glyphicon-plus').addClass('glyphicon-minus');
|
| 584 |
}else{
|
592 |
}else{
|
| 585 |
$(this).find('.glyphicon-minus',0).removeClass('glyphicon-minus').addClass('glyphicon-plus');
|
593 |
$(this).find('.glyphicon-minus',0).removeClass('glyphicon-minus').addClass('glyphicon-plus');
|
| 586 |
}
|
594 |
}
|
| 587 |
});
|
595 |
});
|
| 588 |
$(document).on('click','.prefcatselect',function(){
|
596 |
$(document).on('click','.prefcatselect',function(){
|
| 589 |
$('.prefcatselect').removeClass('active')
|
597 |
$('.prefcatselect').removeClass('active')
|
| 590 |
$(this).addClass('active');
|
598 |
$(this).addClass('active');
|
| 591 |
$('.categorypreferences').addClass('hidden');
|
599 |
$('.categorypreferences').addClass('hidden');
|
| 592 |
$('#cat-'+$(this).data('id')).toggleClass('hidden');
|
600 |
$('#cat-'+$(this).data('id')).toggleClass('hidden');
|
| 593 |
});
|
601 |
});
|
| 594 |
$(document).on('click','.refresh',function(){
|
602 |
$(document).on('click','.refresh',function(){
|
| 595 |
document.location.reload();
|
603 |
document.location.reload();
|
| 596 |
});
|
604 |
});
|
| 597 |
$(document).on('click','.hasmoretext',function(){
|
605 |
$(document).on('click','.hasmoretext',function(){
|
| 598 |
$('#fulltext').html($(this).data('fulltext'));
|
606 |
$('#fulltext').html($(this).data('fulltext'));
|
| 599 |
$('#fullTextModal').modal();
|
607 |
$('#fullTextModal').modal();
|
| 600 |
});
|
608 |
});
|
| 601 |
$(document).on('click','.favswitch',function(){
|
609 |
$(document).on('click','.favswitch',function(){
|
| 602 |
$('.favswitch').removeClass('active')
|
610 |
$('.favswitch').removeClass('active')
|
| 603 |
$(this).addClass('active');
|
611 |
$(this).addClass('active');
|
| 604 |
$('.clearfavs').addClass('hidden');
|
612 |
$('.clearfavs').addClass('hidden');
|
| 605 |
$('.card').addClass('hidden');
|
613 |
$('.card').addClass('hidden');
|
| 606 |
$('.'+$(this).data('type')).removeClass('hidden');
|
614 |
$('.'+$(this).data('type')).removeClass('hidden');
|
| 607 |
});
|
615 |
});
|
| 608 |
$(document).on('click','.brandpreferences .brands',function(){
|
616 |
$(document).on('click','.brandpreferences .brands',function(){
|
| 609 |
$(this).parents('.row').siblings('.controls').find('.editcategorypreferences',0).click();
|
617 |
$(this).parents('.row').siblings('.controls').find('.editcategorypreferences',0).click();
|
| 610 |
});
|
618 |
});
|
| 611 |
$(document).on('click','.tryagainforliveprice',function(){
|
619 |
$(document).on('click','.tryagainforliveprice',function(){
|
| 612 |
fetchLivePrice($(this).parent());
|
620 |
fetchLivePrice($(this).parent());
|
| 613 |
$(this).parent().html('Getting Live Prices');
|
621 |
$(this).parent().html('Getting Live Prices');
|
| 614 |
});
|
622 |
});
|
| 615 |
$(document).on('click','.alert > a',function(){
|
623 |
$(document).on('click','.alert > a',function(){
|
| 616 |
ga('send', 'event', 'notifications', 'click', $(this).html());
|
624 |
ga('send', 'event', 'notifications', 'click', $(this).html());
|
| 617 |
pma.send('notifications','click',$(this).html(),me);
|
625 |
pma.send('notifications','click',$(this).html(),me);
|
| 618 |
});
|
626 |
});
|
| 619 |
$(document).on('click','.banner',function(){
|
627 |
$(document).on('click','.banner',function(){
|
| 620 |
ga('send', 'event', 'banners', 'click', $(this).data('name'));
|
628 |
ga('send', 'event', 'banners', 'click', $(this).data('name'));
|
| 621 |
pma.send('banners','click',$(this).data('name'),me);
|
629 |
pma.send('banners','click',$(this).data('name'),me);
|
| 622 |
});
|
630 |
});
|
| 623 |
});
|
631 |
});
|
| 624 |
function setCookie(cname, cvalue, days, forceCookie) {
|
632 |
function setCookie(cname, cvalue, days, forceCookie) {
|
| 625 |
if(typeof(Storage) !== "undefined" && !forceCookie) {
|
633 |
if(typeof(Storage) !== "undefined" && !forceCookie) {
|
| 626 |
localStorage.setItem(cname, cvalue);
|
634 |
localStorage.setItem(cname, cvalue);
|
| 627 |
} else{
|
635 |
} else{
|
| 628 |
var d = new Date();
|
636 |
var d = new Date();
|
| 629 |
d.setTime(d.getTime() + (days*24*60*60*1000));
|
637 |
d.setTime(d.getTime() + (days*24*60*60*1000));
|
| 630 |
var expires = "expires="+d.toUTCString();
|
638 |
var expires = "expires="+d.toUTCString();
|
| 631 |
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
|
639 |
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
|
| 632 |
}
|
640 |
}
|
| 633 |
}
|
641 |
}
|
| 634 |
|
642 |
|
| 635 |
function getCookie(cname,forceCookie) {
|
643 |
function getCookie(cname,forceCookie) {
|
| 636 |
if(typeof(Storage) !== "undefined" && !forceCookie) {
|
644 |
if(typeof(Storage) !== "undefined" && !forceCookie) {
|
| 637 |
return localStorage.getItem(cname);
|
645 |
return localStorage.getItem(cname);
|
| 638 |
} else {
|
646 |
} else {
|
| 639 |
var name = cname + "=";
|
647 |
var name = cname + "=";
|
| 640 |
var ca = document.cookie.split(';');
|
648 |
var ca = document.cookie.split(';');
|
| 641 |
for(var i=0; i<ca.length; i++) {
|
649 |
for(var i=0; i<ca.length; i++) {
|
| 642 |
var c = ca[i];
|
650 |
var c = ca[i];
|
| 643 |
while (c.charAt(0)==' ') c = c.substring(1);
|
651 |
while (c.charAt(0)==' ') c = c.substring(1);
|
| 644 |
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
|
652 |
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
|
| 645 |
}
|
653 |
}
|
| 646 |
return "";
|
654 |
return "";
|
| 647 |
}
|
655 |
}
|
| 648 |
}
|
656 |
}
|
| 649 |
|
657 |
|
| 650 |
function needToDisplayPaytmPopup(me){
|
658 |
function needToDisplayPaytmPopup(me){
|
| 651 |
var id = 'tip'
|
659 |
var id = 'tip'
|
| 652 |
var cname = 'paytm-help-count-'+me+'-'+id;
|
660 |
var cname = 'paytm-help-count-'+me+'-'+id;
|
| 653 |
var cookieval = getCookie(cname,1);
|
661 |
var cookieval = getCookie(cname,1);
|
| 654 |
if(!cookieval || cookieval == 'NaN' || cookieval==''){
|
662 |
if(!cookieval || cookieval == 'NaN' || cookieval==''){
|
| 655 |
incrementPopupCount(id,0,'paytm-help-count-');
|
663 |
incrementPopupCount(id,0,'paytm-help-count-');
|
| 656 |
return true;
|
664 |
return true;
|
| 657 |
} else if(cookieval < 5) {
|
665 |
} else if(cookieval < 5) {
|
| 658 |
incrementPopupCount(id,cookieval,'paytm-help-count-');
|
666 |
incrementPopupCount(id,cookieval,'paytm-help-count-');
|
| 659 |
return true;
|
667 |
return true;
|
| 660 |
} else{
|
668 |
} else{
|
| 661 |
return false;
|
669 |
return false;
|
| 662 |
}
|
670 |
}
|
| 663 |
};
|
671 |
};
|
| 664 |
|
672 |
|
| 665 |
function showpopup(id,count,interval){
|
673 |
function showpopup(id,count,interval){
|
| 666 |
var cname = 'notif-count-'+me+'-'+id;
|
674 |
var cname = 'notif-count-'+me+'-'+id;
|
| 667 |
var cookieval = getCookie(cname,1);
|
675 |
var cookieval = getCookie(cname,1);
|
| 668 |
var cname = 'notif-lastshown-'+me+'-'+id;
|
676 |
var cname = 'notif-lastshown-'+me+'-'+id;
|
| 669 |
var lastshown = getCookie(cname,1);
|
677 |
var lastshown = getCookie(cname,1);
|
| 670 |
if(!cookieval || cookieval == 'NaN' || cookieval==''){
|
678 |
if(!cookieval || cookieval == 'NaN' || cookieval==''){
|
| 671 |
incrementPopupCount(id,0,'notif-count-');
|
679 |
incrementPopupCount(id,0,'notif-count-');
|
| 672 |
setLastShown(id,'notif-lastshown-');
|
680 |
setLastShown(id,'notif-lastshown-');
|
| 673 |
return true;
|
681 |
return true;
|
| 674 |
} else{
|
682 |
} else{
|
| 675 |
var d = new Date();
|
683 |
var d = new Date();
|
| 676 |
var t = d.getTime();
|
684 |
var t = d.getTime();
|
| 677 |
if(t-lastshown>interval*60*1000){
|
685 |
if(t-lastshown>interval*60*1000){
|
| 678 |
if(cookieval>=count){
|
686 |
if(cookieval>=count){
|
| 679 |
return false;
|
687 |
return false;
|
| 680 |
}else{
|
688 |
}else{
|
| 681 |
setLastShown(id,'notif-lastshown-');
|
689 |
setLastShown(id,'notif-lastshown-');
|
| 682 |
incrementPopupCount(id,cookieval,'notif-count-');
|
690 |
incrementPopupCount(id,cookieval,'notif-count-');
|
| 683 |
return true;
|
691 |
return true;
|
| 684 |
}
|
692 |
}
|
| 685 |
}
|
693 |
}
|
| 686 |
}
|
694 |
}
|
| 687 |
}
|
695 |
}
|
| 688 |
function setLastShown(id,cookiename){
|
696 |
function setLastShown(id,cookiename){
|
| 689 |
var cname = cookiename+me+'-'+id;
|
697 |
var cname = cookiename+me+'-'+id;
|
| 690 |
var d = new Date();
|
698 |
var d = new Date();
|
| 691 |
setCookie(cname, d.getTime(), 365, 1);
|
699 |
setCookie(cname, d.getTime(), 365, 1);
|
| 692 |
}
|
700 |
}
|
| 693 |
function incrementPopupCount(id,currentCount,cookiename) {
|
701 |
function incrementPopupCount(id,currentCount,cookiename) {
|
| 694 |
var cname = cookiename+me+'-'+id;
|
702 |
var cname = cookiename+me+'-'+id;
|
| 695 |
setCookie(cname, parseInt(currentCount)+1, 365, 1);
|
703 |
setCookie(cname, parseInt(currentCount)+1, 365, 1);
|
| 696 |
}
|
704 |
}
|
| 697 |
var hidden, visibilityChange;
|
705 |
var hidden, visibilityChange;
|
| 698 |
function handleVisibilityChange() {
|
706 |
function handleVisibilityChange() {
|
| 699 |
if (document[hidden]) {
|
707 |
if (document[hidden]) {
|
| 700 |
// pagetitle = document.title;
|
708 |
// pagetitle = document.title;
|
| 701 |
} else {
|
709 |
} else {
|
| 702 |
// document.title = pagetitle;
|
710 |
// document.title = pagetitle;
|
| 703 |
}
|
711 |
}
|
| 704 |
}
|
712 |
}
|
| 705 |
if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support
|
713 |
if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support
|
| 706 |
hidden = "hidden";
|
714 |
hidden = "hidden";
|
| 707 |
visibilityChange = "visibilitychange";
|
715 |
visibilityChange = "visibilitychange";
|
| Line 721... |
Line 729... |
| 721 |
} else {
|
729 |
} else {
|
| 722 |
// Handle page visibility change
|
730 |
// Handle page visibility change
|
| 723 |
document.addEventListener(visibilityChange, handleVisibilityChange, false);
|
731 |
document.addEventListener(visibilityChange, handleVisibilityChange, false);
|
| 724 |
}
|
732 |
}
|
| 725 |
$('.notificationok').on('click',function(e){
|
733 |
$('.notificationok').on('click',function(e){
|
| 726 |
e.preventDefault();
|
734 |
e.preventDefault();
|
| 727 |
$('.notificationmodal').modal('hide');
|
735 |
$('.notificationmodal').modal('hide');
|
| 728 |
// setTimeout(function(){ $('.notificationmodal').modal('hide'); }, 1000);
|
736 |
// setTimeout(function(){ $('.notificationmodal').modal('hide'); }, 1000);
|
| 729 |
ga('send', 'event', 'popupnotification-'+$(this).parent().data('id'), 'ok', me);
|
737 |
ga('send', 'event', 'popupnotification-'+$(this).parent().data('id'), 'ok', me);
|
| 730 |
var properties = {};
|
738 |
var properties = {};
|
| 731 |
properties.id = String($(this).parent().data('id'));
|
739 |
properties.id = String($(this).parent().data('id'));
|
| 732 |
pma.send('popupnotification','click','ok',me,properties);
|
740 |
pma.send('popupnotification','click','ok',me,properties);
|
| 733 |
document.location = $(this).parent().prop('href');
|
741 |
document.location = $(this).parent().prop('href');
|
| 734 |
});
|
742 |
});
|
| 735 |
$(document).on('click','.clearfilter',function(){
|
743 |
$(document).on('click','.clearfilter',function(){
|
| 736 |
$('.filterbrand').each(function(){
|
744 |
$('.filterbrand').each(function(){
|
| 737 |
$(this).prop('checked',false);
|
745 |
$(this).prop('checked',false);
|
| 738 |
});
|
746 |
});
|
| 739 |
ga('send', 'event', 'filter', 'brand', 'reset');
|
747 |
ga('send', 'event', 'filter', 'brand', 'reset');
|
| 740 |
pma.send('filters','brands','reset',me);
|
748 |
pma.send('filters','brands','reset',me);
|
| 741 |
});
|
749 |
});
|
| 742 |
|
750 |
|
| 743 |
$(document).on('click','.clearfiltersubcategory',function(){
|
751 |
$(document).on('click','.clearfiltersubcategory',function(){
|
| 744 |
$('.filtersubcategory').each(function(){
|
752 |
$('.filtersubcategory').each(function(){
|
| 745 |
$(this).prop('checked',false);
|
753 |
$(this).prop('checked',false);
|
| 746 |
});
|
754 |
});
|
| 747 |
ga('send', 'event', 'filter', 'subcategory', 'reset');
|
755 |
ga('send', 'event', 'filter', 'subcategory', 'reset');
|
| 748 |
pma.send('filters','subcategory','reset',me);
|
756 |
pma.send('filters','subcategory','reset',me);
|
| 749 |
});
|
757 |
});
|
| 750 |
$(document).on('click','.applyfilter',function(){
|
758 |
$(document).on('click','.applyfilter',function(){
|
| 751 |
$(this).prop('disabled',true);
|
759 |
$(this).prop('disabled',true);
|
| 752 |
$('#loadingModal').modal();
|
760 |
$('#loadingModal').modal();
|
| 753 |
var brands = [];
|
761 |
var brands = [];
|
| 754 |
var brandnames = [];
|
762 |
var brandnames = [];
|
| 755 |
var subcategories = [];
|
763 |
var subcategories = [];
|
| 756 |
var subcatnames = [];
|
764 |
var subcatnames = [];
|
| 757 |
$('.filterbrand').each(function(){
|
765 |
$('.filterbrand').each(function(){
|
| 758 |
if($(this).prop('checked')){
|
766 |
if($(this).prop('checked')){
|
| 759 |
brands.push($(this).val());
|
767 |
brands.push($(this).val());
|
| 760 |
brandnames.push($(this).parent().siblings('.brandname').html());
|
768 |
brandnames.push($(this).parent().siblings('.brandname').html());
|
| 761 |
}
|
769 |
}
|
| 762 |
});
|
770 |
});
|
| 763 |
|
771 |
|
| 764 |
$('.filtersubcategory').each(function(){
|
772 |
$('.filtersubcategory').each(function(){
|
| 765 |
if($(this).prop('checked')){
|
773 |
if($(this).prop('checked')){
|
| 766 |
subcategories.push($(this).val());
|
774 |
subcategories.push($(this).val());
|
| 767 |
subcatnames.push($(this).parent().siblings('.subcategoryname').html());
|
775 |
subcatnames.push($(this).parent().siblings('.subcategoryname').html());
|
| 768 |
}
|
776 |
}
|
| 769 |
});
|
777 |
});
|
| 770 |
|
778 |
|
| 771 |
if(brands.length==0 && subcategories.length==0){
|
779 |
if(brands.length==0 && subcategories.length==0){
|
| 772 |
$('#loadingModal').modal('hide');
|
780 |
$('#loadingModal').modal('hide');
|
| 773 |
$('#message').html('Please choose a few brands/subcategories first').removeClass('hidden');
|
781 |
$('#message').html('Please choose a few brands/subcategories first').removeClass('hidden');
|
| 774 |
setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
|
782 |
setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
|
| 775 |
$(this).prop('disabled',false);
|
783 |
$(this).prop('disabled',false);
|
| 776 |
return false;
|
784 |
return false;
|
| 777 |
}else if(brands.length==0 && subcategories.length>0 ){
|
785 |
}else if(brands.length==0 && subcategories.length>0 ){
|
| 778 |
setCookie('subcategorieschosen', subcategories, 0.25, true);
|
786 |
setCookie('subcategorieschosen', subcategories, 0.25, true);
|
| 779 |
var url = $('#subcategoryselecter').prop('action');
|
787 |
var url = $('#subcategoryselecter').prop('action');
|
| 780 |
ga('send', 'event', 'filter', 'subcategory', subcatnames.join('|'));
|
788 |
ga('send', 'event', 'filter', 'subcategory', subcatnames.join('|'));
|
| 781 |
properties = {};
|
789 |
properties = {};
|
| 782 |
for(var i in subcatnames){
|
790 |
for(var i in subcatnames){
|
| 783 |
properties['subcategories_'+i] = subcatnames[i];
|
791 |
properties['subcategories_'+i] = subcatnames[i];
|
| 784 |
}
|
792 |
}
|
| 785 |
pma.send('filters','subcategories','addfilter',me,properties);
|
793 |
pma.send('filters','subcategories','addfilter',me,properties);
|
| 786 |
var postdata = {'user_id':me,'type':'subcategory','filters':subcatnames.join('|')};
|
794 |
var postdata = {'user_id':me,'type':'subcategory','filters':subcatnames.join('|')};
|
| 787 |
$.post( "/user_filters/add", postdata, function( data ) {
|
795 |
$.post( "/user_filters/add", postdata, function( data ) {
|
| 788 |
$('#loadingModal').modal('hide');
|
796 |
$('#loadingModal').modal('hide');
|
| 789 |
$(this).prop('disabled',false);
|
797 |
$(this).prop('disabled',false);
|
| 790 |
document.location = url+'&subcategories='+subcategories.join('^');
|
798 |
document.location = url+'&subcategories='+subcategories.join('^');
|
| 791 |
});
|
799 |
});
|
| 792 |
}else if(brands.length>0 && subcategories.length==0 ){
|
800 |
}else if(brands.length>0 && subcategories.length==0 ){
|
| 793 |
setCookie('brandschosen', brands, 0.25, true);
|
801 |
setCookie('brandschosen', brands, 0.25, true);
|
| 794 |
var url = $('#brandselecter').prop('action');
|
802 |
var url = $('#brandselecter').prop('action');
|
| 795 |
ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
|
803 |
ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
|
| 796 |
properties = {};
|
804 |
properties = {};
|
| 797 |
for(var i in brandnames){
|
805 |
for(var i in brandnames){
|
| 798 |
properties['brand_'+i] = brandnames[i];
|
806 |
properties['brand_'+i] = brandnames[i];
|
| 799 |
}
|
807 |
}
|
| 800 |
pma.send('filters','brands','addfilter',me,properties);
|
808 |
pma.send('filters','brands','addfilter',me,properties);
|
| 801 |
var postdata = {'user_id':me,'type':'brand','filters':brandnames.join('|')};
|
809 |
var postdata = {'user_id':me,'type':'brand','filters':brandnames.join('|')};
|
| 802 |
$.post( "/user_filters/add", postdata, function( data ) {
|
810 |
$.post( "/user_filters/add", postdata, function( data ) {
|
| 803 |
$('#loadingModal').modal('hide');
|
811 |
$('#loadingModal').modal('hide');
|
| 804 |
$(this).prop('disabled',false);
|
812 |
$(this).prop('disabled',false);
|
| 805 |
document.location = url+'&brands='+brands.join('^');
|
813 |
document.location = url+'&brands='+brands.join('^');
|
| 806 |
});
|
814 |
});
|
| 807 |
}else if(brands.length>0 && subcategories.length>0 ){
|
815 |
}else if(brands.length>0 && subcategories.length>0 ){
|
| 808 |
setCookie('brandschosen', brands, 0.25, true);
|
816 |
setCookie('brandschosen', brands, 0.25, true);
|
| 809 |
setCookie('subcategorieschosen', subcategories, 0.25, true);
|
817 |
setCookie('subcategorieschosen', subcategories, 0.25, true);
|
| 810 |
var url = $('#brandselecter').prop('action');
|
818 |
var url = $('#brandselecter').prop('action');
|
| 811 |
ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
|
819 |
ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
|
| 812 |
ga('send', 'event', 'filter', 'subcategory', subcatnames.join('|'));
|
820 |
ga('send', 'event', 'filter', 'subcategory', subcatnames.join('|'));
|
| 813 |
properties = {};
|
821 |
properties = {};
|
| 814 |
for(var i in brandnames){
|
822 |
for(var i in brandnames){
|
| 815 |
properties['brand_'+i] = brandnames[i];
|
823 |
properties['brand_'+i] = brandnames[i];
|
| 816 |
}
|
824 |
}
|
| 817 |
for(var i in subcatnames){
|
825 |
for(var i in subcatnames){
|
| 818 |
properties['subcategory_'+i] = subcatnames[i];
|
826 |
properties['subcategory_'+i] = subcatnames[i];
|
| 819 |
}
|
827 |
}
|
| 820 |
pma.send('filters','brandsnsubcategories','addfilter',me,properties);
|
828 |
pma.send('filters','brandsnsubcategories','addfilter',me,properties);
|
| 821 |
var dataStr = brandnames.join('|');
|
829 |
var dataStr = brandnames.join('|');
|
| 822 |
dataStr = dataStr + subcatnames.join('|');
|
830 |
dataStr = dataStr + subcatnames.join('|');
|
| 823 |
var postdata = {'user_id':me,'type':'brandnsubcategory','filters':dataStr};
|
831 |
var postdata = {'user_id':me,'type':'brandnsubcategory','filters':dataStr};
|
| 824 |
$.post( "/user_filters/add", postdata, function( data ) {
|
832 |
$.post( "/user_filters/add", postdata, function( data ) {
|
| 825 |
$('#loadingModal').modal('hide');
|
833 |
$('#loadingModal').modal('hide');
|
| 826 |
$(this).prop('disabled',false);
|
834 |
$(this).prop('disabled',false);
|
| 827 |
document.location = url+'&brands='+brands.join('^')+"&subcategories="+subcategories.join("^");
|
835 |
document.location = url+'&brands='+brands.join('^')+"&subcategories="+subcategories.join("^");
|
| 828 |
});
|
836 |
});
|
| 829 |
}
|
837 |
}
|
| 830 |
|
838 |
|
| 831 |
/*if(brands.length==0){
|
839 |
/*if(brands.length==0){
|
| 832 |
$('#loadingModal').modal('hide');
|
840 |
$('#loadingModal').modal('hide');
|
| 833 |
$('#message').html('Please choose a few brands first').removeClass('hidden');
|
841 |
$('#message').html('Please choose a few brands first').removeClass('hidden');
|
| 834 |
setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
|
842 |
setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
|
| 835 |
$(this).prop('disabled',false);
|
843 |
$(this).prop('disabled',false);
|
| 836 |
return false;
|
844 |
return false;
|
| 837 |
}else{
|
845 |
}else{
|
| 838 |
setCookie('brandschosen', brands, 0.25, true);
|
846 |
setCookie('brandschosen', brands, 0.25, true);
|
| 839 |
var url = $('#brandselecter').prop('action');
|
847 |
var url = $('#brandselecter').prop('action');
|
| 840 |
ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
|
848 |
ga('send', 'event', 'filter', 'brand', brandnames.join('|'));
|
| 841 |
properties = {};
|
849 |
properties = {};
|
| 842 |
for(var i in brandnames){
|
850 |
for(var i in brandnames){
|
| 843 |
properties['brand_'+i] = brandnames[i];
|
851 |
properties['brand_'+i] = brandnames[i];
|
| 844 |
}
|
852 |
}
|
| 845 |
pma.send('filters','brands','addfilter',me,properties);
|
853 |
pma.send('filters','brands','addfilter',me,properties);
|
| 846 |
var postdata = {'user_id':me,'type':'brand','filters':brandnames.join('|')};
|
854 |
var postdata = {'user_id':me,'type':'brand','filters':brandnames.join('|')};
|
| 847 |
$.post( "/user_filters/add", postdata, function( data ) {
|
855 |
$.post( "/user_filters/add", postdata, function( data ) {
|
| 848 |
$('#loadingModal').modal('hide');
|
856 |
$('#loadingModal').modal('hide');
|
| 849 |
$(this).prop('disabled',false);
|
857 |
$(this).prop('disabled',false);
|
| 850 |
document.location = url+'&brands='+brands.join('^');
|
858 |
document.location = url+'&brands='+brands.join('^');
|
| 851 |
});
|
859 |
});
|
| 852 |
}
|
860 |
}
|
| 853 |
|
861 |
|
| 854 |
if(subcategories.length==0){
|
862 |
if(subcategories.length==0){
|
| 855 |
$('#loadingModal').modal('hide');
|
863 |
$('#loadingModal').modal('hide');
|
| 856 |
$('#message').html('Please choose a few Sub-categories first').removeClass('hidden');
|
864 |
$('#message').html('Please choose a few Sub-categories first').removeClass('hidden');
|
| 857 |
setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
|
865 |
setTimeout(function(){ $('#message').addClass('hidden'); }, 3000);
|
| 858 |
$(this).prop('disabled',false);
|
866 |
$(this).prop('disabled',false);
|
| 859 |
return false;
|
867 |
return false;
|
| 860 |
}else{
|
868 |
}else{
|
| 861 |
setCookie('subcategorieschosen', subcategories, 0.25, true);
|
869 |
setCookie('subcategorieschosen', subcategories, 0.25, true);
|
| 862 |
var url = $('#subcategoryselecter').prop('action');
|
870 |
var url = $('#subcategoryselecter').prop('action');
|
| 863 |
ga('send', 'event', 'filter', 'subcategory', brandnames.join('|'));
|
871 |
ga('send', 'event', 'filter', 'subcategory', brandnames.join('|'));
|
| 864 |
properties = {};
|
872 |
properties = {};
|
| 865 |
for(var i in brandnames){
|
873 |
for(var i in brandnames){
|
| 866 |
properties['brand_'+i] = brandnames[i];
|
874 |
properties['brand_'+i] = brandnames[i];
|
| 867 |
}
|
875 |
}
|
| 868 |
pma.send('filters','subcategories','addfilter',me,properties);
|
876 |
pma.send('filters','subcategories','addfilter',me,properties);
|
| 869 |
var postdata = {'user_id':me,'type':'subcategory','filters':subcatnames.join('|')};
|
877 |
var postdata = {'user_id':me,'type':'subcategory','filters':subcatnames.join('|')};
|
| 870 |
$.post( "/user_filters/add", postdata, function( data ) {
|
878 |
$.post( "/user_filters/add", postdata, function( data ) {
|
| 871 |
$('#loadingModal').modal('hide');
|
879 |
$('#loadingModal').modal('hide');
|
| 872 |
$(this).prop('disabled',false);
|
880 |
$(this).prop('disabled',false);
|
| 873 |
document.location = url+'&brands='+brands.join('^');
|
881 |
document.location = url+'&brands='+brands.join('^');
|
| 874 |
});
|
882 |
});
|
| 875 |
}*/
|
883 |
}*/
|
| 876 |
});
|
884 |
});
|
| 877 |
|
885 |
|
| 878 |
|
886 |
|
| 879 |
$(document).on('click','#showallbrands',function(){
|
887 |
$(document).on('click','#showallbrands',function(){
|
| 880 |
$('.brand').removeClass('hidden');
|
888 |
$('.brand').removeClass('hidden');
|
| 881 |
$('.subcategory').removeClass('hidden');
|
889 |
$('.subcategory').removeClass('hidden');
|
| 882 |
$(this).hide();
|
890 |
$(this).hide();
|
| 883 |
});
|
891 |
});
|
| 884 |
$(document).on('input','#brandfilter',function(){
|
892 |
$(document).on('input','#brandfilter',function(){
|
| 885 |
$('.brand').addClass('hidden');
|
893 |
$('.brand').addClass('hidden');
|
| 886 |
$('#showallbrands').hide();
|
894 |
$('#showallbrands').hide();
|
| 887 |
var that = $(this);
|
895 |
var that = $(this);
|
| 888 |
$('li.brand').filter(function() {
|
896 |
$('li.brand').filter(function() {
|
| 889 |
return $(this).data("brand").toLowerCase().indexOf($(that).val().toLowerCase()) != -1;
|
897 |
return $(this).data("brand").toLowerCase().indexOf($(that).val().toLowerCase()) != -1;
|
| 890 |
}).removeClass('hidden','slow');
|
898 |
}).removeClass('hidden','slow');
|
| 891 |
});
|
899 |
});
|
| 892 |
|
900 |
|
| 893 |
$(document).on('input','#subcatfilter',function(){
|
901 |
$(document).on('input','#subcatfilter',function(){
|
| 894 |
$('.subcategory').addClass('hidden');
|
902 |
$('.subcategory').addClass('hidden');
|
| 895 |
$('#showallbrands').hide();
|
903 |
$('#showallbrands').hide();
|
| 896 |
var that = $(this);
|
904 |
var that = $(this);
|
| 897 |
$('li.subcategory').filter(function() {
|
905 |
$('li.subcategory').filter(function() {
|
| 898 |
return $(this).data("brand").toLowerCase().indexOf($(that).val().toLowerCase()) != -1;
|
906 |
return $(this).data("brand").toLowerCase().indexOf($(that).val().toLowerCase()) != -1;
|
| 899 |
}).removeClass('hidden','slow');
|
907 |
}).removeClass('hidden','slow');
|
| 900 |
});
|
908 |
});
|
| 901 |
|
909 |
|
| 902 |
|
910 |
|
| 903 |
$(document).on('click','.filterbrand',function(){
|
911 |
$(document).on('click','.filterbrand',function(){
|
| 904 |
var clicked = $(this).parent().parent();
|
912 |
var clicked = $(this).parent().parent();
|
| 905 |
// all the LIs above the clicked one
|
913 |
// all the LIs above the clicked one
|
| 906 |
var previousAll = clicked.prevAll();
|
914 |
var previousAll = clicked.prevAll();
|
| 907 |
|
915 |
|
| 908 |
// only proceed if it's not already on top (no previous siblings)
|
916 |
// only proceed if it's not already on top (no previous siblings)
|
| 909 |
if(previousAll.length > 0) {
|
917 |
if(previousAll.length > 0) {
|
| 910 |
// top LI
|
918 |
// top LI
|
| 911 |
var top = $(previousAll[previousAll.length - 1]);
|
919 |
var top = $(previousAll[previousAll.length - 1]);
|
| 912 |
|
920 |
|
| 913 |
// immediately previous LI
|
921 |
// immediately previous LI
|
| 914 |
var previous = $(previousAll[0]);
|
922 |
var previous = $(previousAll[0]);
|
| 915 |
|
923 |
|
| 916 |
// how far up do we need to move the clicked LI?
|
924 |
// how far up do we need to move the clicked LI?
|
| 917 |
var moveUp = clicked.attr('offsetTop') - top.attr('offsetTop');
|
925 |
var moveUp = clicked.attr('offsetTop') - top.attr('offsetTop');
|
| 918 |
|
926 |
|
| 919 |
// how far down do we need to move the previous siblings?
|
927 |
// how far down do we need to move the previous siblings?
|
| 920 |
var moveDown = (clicked.offset().top + clicked.outerHeight()) - (previous.offset().top + previous.outerHeight());
|
928 |
var moveDown = (clicked.offset().top + clicked.outerHeight()) - (previous.offset().top + previous.outerHeight());
|
| 921 |
|
929 |
|
| 922 |
// let's move stuff
|
930 |
// let's move stuff
|
| 923 |
clicked.css('position', 'relative');
|
931 |
clicked.css('position', 'relative');
|
| 924 |
previousAll.css('position', 'relative');
|
932 |
previousAll.css('position', 'relative');
|
| 925 |
clicked.animate({'top': -moveUp});
|
933 |
clicked.animate({'top': -moveUp});
|
| 926 |
previousAll.animate({'top': moveDown}, {complete: function() {
|
934 |
previousAll.animate({'top': moveDown}, {complete: function() {
|
| 927 |
// rearrange the DOM and restore positioning when we're done moving
|
935 |
// rearrange the DOM and restore positioning when we're done moving
|
| 928 |
clicked.parent().prepend(clicked);
|
936 |
clicked.parent().prepend(clicked);
|
| 929 |
clicked.css({'position': 'static', 'top': 0});
|
937 |
clicked.css({'position': 'static', 'top': 0});
|
| 930 |
previousAll.css({'position': 'static', 'top': 0});
|
938 |
previousAll.css({'position': 'static', 'top': 0});
|
| 931 |
}});
|
939 |
}});
|
| 932 |
}
|
940 |
}
|
| 933 |
})
|
941 |
})
|
| 934 |
$(document).on('click','.filtersubcategory',function(){
|
942 |
$(document).on('click','.filtersubcategory',function(){
|
| 935 |
var clicked = $(this).parent().parent();
|
943 |
var clicked = $(this).parent().parent();
|
| 936 |
// all the LIs above the clicked one
|
944 |
// all the LIs above the clicked one
|
| 937 |
var previousAll = clicked.prevAll();
|
945 |
var previousAll = clicked.prevAll();
|
| 938 |
|
946 |
|
| 939 |
// only proceed if it's not already on top (no previous siblings)
|
947 |
// only proceed if it's not already on top (no previous siblings)
|
| 940 |
if(previousAll.length > 0) {
|
948 |
if(previousAll.length > 0) {
|
| 941 |
// top LI
|
949 |
// top LI
|
| 942 |
var top = $(previousAll[previousAll.length - 1]);
|
950 |
var top = $(previousAll[previousAll.length - 1]);
|
| 943 |
|
951 |
|
| 944 |
// immediately previous LI
|
952 |
// immediately previous LI
|
| 945 |
var previous = $(previousAll[0]);
|
953 |
var previous = $(previousAll[0]);
|
| 946 |
|
954 |
|
| 947 |
// how far up do we need to move the clicked LI?
|
955 |
// how far up do we need to move the clicked LI?
|
| 948 |
var moveUp = clicked.attr('offsetTop') - top.attr('offsetTop');
|
956 |
var moveUp = clicked.attr('offsetTop') - top.attr('offsetTop');
|
| 949 |
|
957 |
|
| 950 |
// how far down do we need to move the previous siblings?
|
958 |
// how far down do we need to move the previous siblings?
|
| 951 |
var moveDown = (clicked.offset().top + clicked.outerHeight()) - (previous.offset().top + previous.outerHeight());
|
959 |
var moveDown = (clicked.offset().top + clicked.outerHeight()) - (previous.offset().top + previous.outerHeight());
|
| 952 |
|
960 |
|
| 953 |
// let's move stuff
|
961 |
// let's move stuff
|
| 954 |
clicked.css('position', 'relative');
|
962 |
clicked.css('position', 'relative');
|
| 955 |
previousAll.css('position', 'relative');
|
963 |
previousAll.css('position', 'relative');
|
| 956 |
clicked.animate({'top': -moveUp});
|
964 |
clicked.animate({'top': -moveUp});
|
| 957 |
previousAll.animate({'top': moveDown}, {complete: function() {
|
965 |
previousAll.animate({'top': moveDown}, {complete: function() {
|
| 958 |
// rearrange the DOM and restore positioning when we're done moving
|
966 |
// rearrange the DOM and restore positioning when we're done moving
|
| 959 |
clicked.parent().prepend(clicked);
|
967 |
clicked.parent().prepend(clicked);
|
| 960 |
clicked.css({'position': 'static', 'top': 0});
|
968 |
clicked.css({'position': 'static', 'top': 0});
|
| 961 |
previousAll.css({'position': 'static', 'top': 0});
|
969 |
previousAll.css({'position': 'static', 'top': 0});
|
| 962 |
}});
|
970 |
}});
|
| 963 |
}
|
971 |
}
|
| 964 |
})
|
972 |
})
|
| 965 |
$(document).on('click','.clearfilters',function(){
|
973 |
$(document).on('click','.clearfilters',function(){
|
| 966 |
setCookie('brandschosen', '', -1, true);
|
974 |
setCookie('brandschosen', '', -1, true);
|
| 967 |
setCookie('subcategorieschosen','',-1, true);
|
975 |
setCookie('subcategorieschosen','',-1, true);
|
| 968 |
ga('send', 'event', 'filter', 'brand', 'clearfilters');
|
976 |
ga('send', 'event', 'filter', 'brand', 'clearfilters');
|
| 969 |
ga('send', 'event', 'filter', 'subcategory', 'clearfilters');
|
977 |
ga('send', 'event', 'filter', 'subcategory', 'clearfilters');
|
| 970 |
pma.send('filters','brands','clearfilters',me);
|
978 |
pma.send('filters','brands','clearfilters',me);
|
| 971 |
pma.send('filters','subcategory','clearfilters',me);
|
979 |
pma.send('filters','subcategory','clearfilters',me);
|
| 972 |
var postdata = {'user_id':me,'type':'clear'};
|
980 |
var postdata = {'user_id':me,'type':'clear'};
|
| 973 |
$('#loadingModal').modal('show');
|
981 |
$('#loadingModal').modal('show');
|
| 974 |
$.post("/user_filters/add", postdata, function( data ) {
|
982 |
$.post("/user_filters/add", postdata, function( data ) {
|
| 975 |
// document.location.reload();
|
983 |
// document.location.reload();
|
| 976 |
window.location.replace(window.location.href.split('?')[0]);
|
984 |
window.location.replace(window.location.href.split('?')[0]);
|
| 977 |
});
|
985 |
});
|
| 978 |
});
|
986 |
});
|
| 979 |
function selectChosenBrands(){
|
987 |
function selectChosenBrands(){
|
| 980 |
var brandschosen = decodeURIComponent(getCookie('brandschosen',true));
|
988 |
var brandschosen = decodeURIComponent(getCookie('brandschosen',true));
|
| 981 |
var subcategorieschosen = decodeURIComponent(getCookie('subcategorieschosen',true));
|
989 |
var subcategorieschosen = decodeURIComponent(getCookie('subcategorieschosen',true));
|
| 982 |
if(brandschosen && brandschosen.length>0){
|
990 |
if(brandschosen && brandschosen.length>0){
|
| 983 |
var brands = brandschosen.split(',');
|
991 |
var brands = brandschosen.split(',');
|
| 984 |
for(var i in brands){
|
992 |
for(var i in brands){
|
| 985 |
$('.brand').filter(function() {
|
993 |
$('.brand').filter(function() {
|
| 986 |
return $(this).data("brandid") == brands[i];
|
994 |
return $(this).data("brandid") == brands[i];
|
| 987 |
}).removeClass('hidden').find('.filterbrand',0).trigger( "click" );
|
995 |
}).removeClass('hidden').find('.filterbrand',0).trigger( "click" );
|
| 988 |
}
|
996 |
}
|
| 989 |
}
|
997 |
}
|
| 990 |
if(subcategorieschosen && subcategorieschosen.length>0){
|
998 |
if(subcategorieschosen && subcategorieschosen.length>0){
|
| 991 |
var subcategories = subcategorieschosen.split(',');
|
999 |
var subcategories = subcategorieschosen.split(',');
|
| 992 |
for(var i in subcategories){
|
1000 |
for(var i in subcategories){
|
| 993 |
$('.subcategory').filter(function() {
|
1001 |
$('.subcategory').filter(function() {
|
| 994 |
return $(this).data("brandid") == subcategories[i];
|
1002 |
return $(this).data("brandid") == subcategories[i];
|
| 995 |
}).removeClass('hidden').find('.filtersubcategory',0).trigger( "click" );
|
1003 |
}).removeClass('hidden').find('.filtersubcategory',0).trigger( "click" );
|
| 996 |
}
|
1004 |
}
|
| 997 |
}
|
1005 |
}
|
| 998 |
}
|
1006 |
}
|
| 999 |
|
1007 |
|
| 1000 |
function clearFilters(){
|
1008 |
function clearFilters(){
|
| 1001 |
setCookie('brandschosen', '', -1, true);
|
1009 |
setCookie('brandschosen', '', -1, true);
|
| 1002 |
setCookie('subcategorieschosen','',-1, true);
|
1010 |
setCookie('subcategorieschosen','',-1, true);
|
| 1003 |
}
|
1011 |
}
|
| 1004 |
function showPosition(position) {
|
1012 |
function showPosition(position) {
|
| 1005 |
setCookie('latitude',position.coords.latitude,1,true);
|
1013 |
setCookie('latitude',position.coords.latitude,1,true);
|
| 1006 |
setCookie('longitude',position.coords.longitude,1,true);
|
1014 |
setCookie('longitude',position.coords.longitude,1,true);
|
| 1007 |
}
|
1015 |
}
|
| 1008 |
$(function () {
|
1016 |
$(function () {
|
| 1009 |
$("#popovertrigger5").popover('hide').remove();
|
1017 |
$("#popovertrigger5").popover('hide').remove();
|
| 1010 |
$('.data-up:first').append('<a id="popovertrigger5" data-container="body" data-toggle="popover" data-placement="left" data-content="Quick buy multiple items together"></a>');
|
1018 |
$('.data-up:first').append('<a id="popovertrigger5" data-container="body" data-toggle="popover" data-placement="left" data-content="Quick buy multiple items together"></a>');
|
| 1011 |
setPopOver("popovertrigger5", ".plusqtybutton", 'click', 3000);
|
1019 |
setPopOver("popovertrigger5", ".plusqtybutton", 'click', 3000);
|
| Line 1077... |
Line 1085... |
| 1077 |
}
|
1085 |
}
|
| 1078 |
}
|
1086 |
}
|
| 1079 |
ga('send', 'event', 'popover', me, cookieval);
|
1087 |
ga('send', 'event', 'popover', me, cookieval);
|
| 1080 |
}
|
1088 |
}
|
| 1081 |
$('.getapp').on('click',function(){
|
1089 |
$('.getapp').on('click',function(){
|
| 1082 |
/*var that = $(this);
|
1090 |
/*var that = $(this);
|
| 1083 |
var req = $.ajax({
|
1091 |
var req = $.ajax({
|
| 1084 |
url: 'http://104.200.25.40:8057/appAffiliates/generateRedirectUrl/'+me+'/'+$(that).data('id'),
|
1092 |
url: 'http://104.200.25.40:8057/appAffiliates/generateRedirectUrl/'+me+'/'+$(that).data('id'),
|
| 1085 |
// Tell jQuery we're expecting JSONP
|
1093 |
// Tell jQuery we're expecting JSONP
|
| 1086 |
dataType: "jsonp",
|
1094 |
dataType: "jsonp",
|
| 1087 |
// Tell YQL what we want and that we want JSON
|
1095 |
// Tell YQL what we want and that we want JSON
|
| 1088 |
method: 'get',
|
1096 |
method: 'get',
|
| 1089 |
// timeout: 30000,
|
1097 |
// timeout: 30000,
|
| 1090 |
// Work with the response
|
1098 |
// Work with the response
|
| 1091 |
success: function( response ) {
|
1099 |
success: function( response ) {
|
| 1092 |
console.log(response);
|
1100 |
console.log(response);
|
| 1093 |
}
|
1101 |
}
|
| 1094 |
});*/
|
1102 |
});*/
|
| 1095 |
$('#loadingModal').modal('show');
|
1103 |
$('#loadingModal').modal('show');
|
| 1096 |
document.location = '/abouts/apphint';
|
1104 |
document.location = '/abouts/apphint';
|
| 1097 |
});
|
1105 |
});
|
| 1098 |
function showpopover(id){
|
1106 |
function showpopover(id){
|
| 1099 |
try {
|
1107 |
try {
|
| 1100 |
$('[data-toggle="popover"]#'+id).popover({html:true,viewport:{container:'body'}, trigger:'manual'});
|
1108 |
$('[data-toggle="popover"]#'+id).popover({html:true,viewport:{container:'body'}, trigger:'manual'});
|
| 1101 |
$('[data-toggle="popover"]#'+id).popover('show');
|
1109 |
$('[data-toggle="popover"]#'+id).popover('show');
|
| 1102 |
}catch(err){
|
1110 |
}catch(err){
|
| 1103 |
//
|
1111 |
//
|
| 1104 |
}
|
1112 |
}
|
| 1105 |
}
|
1113 |
}
|
| 1106 |
$(document).on('click','.nodeals',function(){
|
1114 |
$(document).on('click','.nodeals',function(){
|
| 1107 |
document.location = $(this).data('href');
|
1115 |
document.location = $(this).data('href');
|
| 1108 |
});
|
1116 |
});
|
| 1109 |
$(document).on('click','.selectbrand',function(e){
|
1117 |
$(document).on('click','.selectbrand',function(e){
|
| 1110 |
e.preventDefault();
|
1118 |
e.preventDefault();
|
| 1111 |
var brands = $(this).data('id');
|
1119 |
var brands = $(this).data('id');
|
| 1112 |
var brandname = $(this).html();
|
1120 |
var brandname = $(this).html();
|
| 1113 |
//console.log(brandname);
|
1121 |
//console.log(brandname);
|
| 1114 |
|
1122 |
|
| 1115 |
setCookie('brandschosen', brands, 1, true);
|
1123 |
setCookie('brandschosen', brands, 1, true);
|
| 1116 |
var url = $(this).data('href');
|
1124 |
var url = $(this).data('href');
|
| 1117 |
ga('send', 'event', 'selectbrand', 'brand', brandname);
|
1125 |
ga('send', 'event', 'selectbrand', 'brand', brandname);
|
| 1118 |
properties = {};
|
1126 |
properties = {};
|
| 1119 |
properties['brand'] = brandname;
|
1127 |
properties['brand'] = brandname;
|
| 1120 |
pma.send('filters','brands','selectbrand',me,properties);
|
1128 |
pma.send('filters','brands','selectbrand',me,properties);
|
| 1121 |
var postdata = {'user_id':me,'type':'brand','filters':brandname};
|
1129 |
var postdata = {'user_id':me,'type':'brand','filters':brandname};
|
| 1122 |
$.post( "/user_filters/add", postdata, function( data ) {
|
1130 |
$.post( "/user_filters/add", postdata, function( data ) {
|
| 1123 |
$('#loadingModal').modal('hide');
|
1131 |
$('#loadingModal').modal('hide');
|
| 1124 |
$(this).addClass('activebrand');
|
1132 |
$(this).addClass('activebrand');
|
| 1125 |
document.location = url+'&brands='+brands;
|
1133 |
document.location = url+'&brands='+brands;
|
| 1126 |
});
|
1134 |
});
|
| 1127 |
});
|
1135 |
});
|
| 1128 |
|
1136 |
|
| 1129 |
$(document).on('click','.selectsubcat',function(e){
|
1137 |
$(document).on('click','.selectsubcat',function(e){
|
| 1130 |
e.preventDefault();
|
1138 |
e.preventDefault();
|
| 1131 |
$('.clearfilters').click();
|
1139 |
$('.clearfilters').click();
|
| 1132 |
var brands = $(this).data('id');
|
1140 |
var brands = $(this).data('id');
|
| 1133 |
var brandname = $(this).html();
|
1141 |
var brandname = $(this).html();
|
| 1134 |
//console.log(brandname);
|
1142 |
//console.log(brandname);
|
| 1135 |
|
1143 |
|
| 1136 |
setCookie('subcategorieschosen', brands, 1, true);
|
1144 |
setCookie('subcategorieschosen', brands, 1, true);
|
| 1137 |
var url = $(this).data('href');
|
1145 |
var url = $(this).data('href');
|
| 1138 |
// alert(url);
|
1146 |
// alert(url);
|
| 1139 |
// ga('send', 'event', 'subcategorieschosen', 'brand', brandname);
|
1147 |
// ga('send', 'event', 'subcategorieschosen', 'brand', brandname);
|
| 1140 |
document.location = url;
|
1148 |
document.location = url;
|
| 1141 |
// properties = {};
|
1149 |
// properties = {};
|
| 1142 |
// properties['brand'] = brandname;
|
1150 |
// properties['brand'] = brandname;
|
| 1143 |
// pma.send('filters','brands','selectbrand',me,properties);
|
1151 |
// pma.send('filters','brands','selectbrand',me,properties);
|
| 1144 |
// // var postdata = {'user_id':me,'type':'brand','filters':brandname};
|
1152 |
// // var postdata = {'user_id':me,'type':'brand','filters':brandname};
|
| 1145 |
// $.post( "/user_filters/add", postdata, function( data ) {
|
1153 |
// $.post( "/user_filters/add", postdata, function( data ) {
|
| 1146 |
// $('#loadingModal').modal('hide');
|
1154 |
// $('#loadingModal').modal('hide');
|
| 1147 |
// $(this).addClass('activebrand');
|
1155 |
// $(this).addClass('activebrand');
|
| 1148 |
// document.location = url+'&brands='+brands;
|
1156 |
// document.location = url+'&brands='+brands;
|
| 1149 |
// });
|
1157 |
// });
|
| 1150 |
});
|
1158 |
});
|
| 1151 |
|
1159 |
|
| 1152 |
$(document).on('click','.shownexttip',function(e){
|
1160 |
$(document).on('click','.shownexttip',function(e){
|
| 1153 |
$(this).addClass('hidden').remove();
|
1161 |
$(this).addClass('hidden').remove();
|
| 1154 |
$('#firsttip').addClass('hidden').remove();
|
1162 |
$('#firsttip').addClass('hidden').remove();
|
| 1155 |
$('#secondtip').removeClass('hidden');
|
1163 |
$('#secondtip').removeClass('hidden');
|
| 1156 |
$('.gotit').removeClass('hidden');
|
1164 |
$('.gotit').removeClass('hidden');
|
| 1157 |
});
|
1165 |
});
|
| 1158 |
var Base64 = {
|
1166 |
var Base64 = {
|
| 1159 |
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
1167 |
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
| 1160 |
encode: function(input) {
|
1168 |
encode: function(input) {
|
| 1161 |
var output = "";
|
1169 |
var output = "";
|
| Line 1259... |
Line 1267... |
| 1259 |
var pma = new function() {
|
1267 |
var pma = new function() {
|
| 1260 |
this.apiurl = "http://45.33.50.227:8081/";
|
1268 |
this.apiurl = "http://45.33.50.227:8081/";
|
| 1261 |
this.endpoints = {'identify':'identify','profile':'profile','track':'track'};
|
1269 |
this.endpoints = {'identify':'identify','profile':'profile','track':'track'};
|
| 1262 |
|
1270 |
|
| 1263 |
this.send = function (category,action,label,user_id,properties) {
|
1271 |
this.send = function (category,action,label,user_id,properties) {
|
| 1264 |
if(!properties){
|
1272 |
if(!properties){
|
| 1265 |
properties = {};
|
1273 |
properties = {};
|
| 1266 |
}
|
1274 |
}
|
| 1267 |
properties.location = window.location.href;
|
1275 |
properties.location = window.location.href;
|
| 1268 |
// properties.appCodeName = navigator.appCodeName;
|
1276 |
// properties.appCodeName = navigator.appCodeName;
|
| 1269 |
// properties.appName = navigator.appName;
|
1277 |
// properties.appName = navigator.appName;
|
| 1270 |
// properties.appVersion = navigator.appVersion;
|
1278 |
// properties.appVersion = navigator.appVersion;
|
| 1271 |
properties.cookieEnabled = String(navigator.cookieEnabled);
|
1279 |
properties.cookieEnabled = String(navigator.cookieEnabled);
|
| 1272 |
properties.platform = navigator.platform;
|
1280 |
properties.platform = navigator.platform;
|
| 1273 |
properties.userAgent = navigator.userAgent;
|
1281 |
properties.userAgent = navigator.userAgent;
|
| 1274 |
properties.ip = ip;
|
1282 |
properties.ip = ip;
|
| 1275 |
if (navigator.geolocation) {
|
1283 |
if (navigator.geolocation) {
|
| 1276 |
if(getCookie('latitude',true)){
|
1284 |
if(getCookie('latitude',true)){
|
| 1277 |
properties.latitude = getCookie('latitude');
|
1285 |
properties.latitude = getCookie('latitude');
|
| 1278 |
}
|
1286 |
}
|
| 1279 |
if(getCookie('longitude',true)){
|
1287 |
if(getCookie('longitude',true)){
|
| 1280 |
properties.longitude = getCookie('longitude');
|
1288 |
properties.longitude = getCookie('longitude');
|
| 1281 |
}
|
1289 |
}
|
| 1282 |
}
|
1290 |
}
|
| 1283 |
properties.screenHeight = String(screen.height);
|
1291 |
properties.screenHeight = String(screen.height);
|
| 1284 |
properties.screenWidth = String(screen.width);
|
1292 |
properties.screenWidth = String(screen.width);
|
| 1285 |
// console.log(properties);
|
1293 |
// console.log(properties);
|
| 1286 |
$.ajax({
|
1294 |
$.ajax({
|
| 1287 |
url: this.apiurl + this.endpoints.track,
|
1295 |
url: this.apiurl + this.endpoints.track,
|
| 1288 |
data: {'category':category,'action':action,'label':label,'user_id':user_id,'properties':cassandraMAP.stringify(properties)},
|
1296 |
data: {'category':category,'action':action,'label':label,'user_id':user_id,'properties':cassandraMAP.stringify(properties)},
|
| 1289 |
// Tell jQuery we're expecting JSONP
|
1297 |
// Tell jQuery we're expecting JSONP
|
| 1290 |
dataType: "json",
|
1298 |
dataType: "json",
|
| 1291 |
// Tell YQL what we want and that we want JSON
|
1299 |
// Tell YQL what we want and that we want JSON
|
| 1292 |
method: 'post',
|
1300 |
method: 'post',
|
| 1293 |
// Work with the response
|
1301 |
// Work with the response
|
| 1294 |
success: function( response ) {
|
1302 |
success: function( response ) {
|
| 1295 |
//Well, well, well :)
|
1303 |
//Well, well, well :)
|
| 1296 |
}
|
1304 |
}
|
| 1297 |
});
|
1305 |
});
|
| 1298 |
};
|
1306 |
};
|
| 1299 |
|
1307 |
|
| 1300 |
this.formDataToObject = function(formdata){
|
1308 |
this.formDataToObject = function(formdata){
|
| 1301 |
var properties = {};
|
1309 |
var properties = {};
|
| 1302 |
var keys = [];
|
1310 |
var keys = [];
|
| 1303 |
var formdata = JSON.parse(JSON.stringify(formdata));
|
1311 |
var formdata = JSON.parse(JSON.stringify(formdata));
|
| 1304 |
for (var i in formdata) {
|
1312 |
for (var i in formdata) {
|
| 1305 |
var key = formdata[i].name;
|
1313 |
var key = formdata[i].name;
|
| 1306 |
if(index = keys.indexOf(key)==-1){
|
1314 |
if(index = keys.indexOf(key)==-1){
|
| 1307 |
properties[key] = formdata[i].value;
|
1315 |
properties[key] = formdata[i].value;
|
| 1308 |
}else{
|
1316 |
}else{
|
| 1309 |
properties[key+'_'+i] = formdata[i].value;
|
1317 |
properties[key+'_'+i] = formdata[i].value;
|
| 1310 |
}
|
1318 |
}
|
| 1311 |
keys.push(key);
|
1319 |
keys.push(key);
|
| 1312 |
};
|
1320 |
};
|
| 1313 |
return properties;
|
1321 |
return properties;
|
| 1314 |
}
|
1322 |
}
|
| 1315 |
}
|
1323 |
}
|
| 1316 |
//App page
|
1324 |
//App page
|
| 1317 |
$.fn.stars = function() {
|
1325 |
$.fn.stars = function() {
|
| 1318 |
return $(this).each(function() {
|
1326 |
return $(this).each(function() {
|
| 1319 |
// Get the value
|
1327 |
// Get the value
|
| Line 1326... |
Line 1334... |
| 1326 |
// Replace the numerical value with stars
|
1334 |
// Replace the numerical value with stars
|
| 1327 |
$(this).html($span);
|
1335 |
$(this).html($span);
|
| 1328 |
});
|
1336 |
});
|
| 1329 |
}
|
1337 |
}
|
| 1330 |
$(function() {
|
1338 |
$(function() {
|
| 1331 |
$('span.stars').stars();
|
1339 |
$('span.stars').stars();
|
| 1332 |
});
|
1340 |
});
|
| 1333 |
|
1341 |
|
| 1334 |
function sendCartChangeEvent(){
|
1342 |
function sendCartChangeEvent(){
|
| 1335 |
var cart_details_old = localStorage.getItem('cart_details_old');
|
1343 |
var cart_details_old = localStorage.getItem('cart_details_old');
|
| 1336 |
var cart_details = localStorage.getItem('cart_details');
|
1344 |
var cart_details = localStorage.getItem('cart_details');
|
| 1337 |
if (cart_details_old == cart_details){
|
1345 |
if (cart_details_old == cart_details){
|
| 1338 |
return;
|
1346 |
return;
|
| 1339 |
} else if(cart_details!=null){
|
1347 |
} else if(cart_details!=null){
|
| 1340 |
JSON.parse(cart_details);
|
1348 |
JSON.parse(cart_details);
|
| 1341 |
|
1349 |
|
| 1342 |
}
|
1350 |
}
|
| 1343 |
}
|
1351 |
}
|
| 1344 |
|
1352 |
|
| 1345 |
//setInterval(30000, )
|
1353 |
//setInterval(30000, )
|
| 1346 |
|
1354 |
|