· 7 years ago · Oct 25, 2018, 11:24 AM
1var mail_name = 'PON_UN_MAIL_AQUI'; // CAMBIA 'PON_UN_MAIL_AQUI' POR LO QUE QUIERAS (SIN '@gmail.com')
2
3function repeat() {
4 var repeat_time = Math.floor((Math.random() * 2500) + 2500);
5
6 console.log('%c ##### Siguiente intento en ' + repeat_time + ' milisegundos ', 'background-color: grey; color: white;');
7
8 setTimeout(init, repeat_time);
9}
10
11function play(mail, callback) {
12 $.ajax({
13 contentType: 'application/json',
14 crossDomain: true,
15 data: JSON.stringify({email: mail}),
16 dataType: 'json',
17 type: 'POST',
18 url: 'https://www.ganasdetelepizza.es//check-prize',
19
20 success: function (result) {
21 var response = JSON.parse(JSON.stringify(JSON.parse(result['body'])));
22
23 callback(response.responseMessage);
24 }
25 });
26}
27
28function validate(mail, callback) {
29 $.ajax({
30 contentType: 'application/json',
31 crossDomain: true,
32 data: JSON.stringify({email: mail, receive_offert: true}),
33 dataType: 'json',
34 type: 'POST',
35 url: 'https://www.ganasdetelepizza.es//check-mail',
36
37 success: function(result) {
38 var response = JSON.parse(JSON.stringify(JSON.parse(result['body'])));
39
40 callback(response.responseMessage);
41 }
42 });
43}
44
45var attemps = 0;
46
47function init() {
48 var mail = mail_name + attemps + '@gmail.com';
49
50 console.log('%c # Intento ' + attemps++ + ' con mail ' + mail + ' ', 'background-color: blue; color: white;');
51
52 validate(mail, function(response) {
53 if(response == 'EMAIL_SAVED') {
54 play(mail, function(response) {
55 if(response == 'USER_IS_WINNER') {
56 console.log('%c ########## HAS GANADO %c (mail: ' + mail + ') ', 'background-color: green; color: white; font-size: 16px; font-weight: bold', 'background-color: white; color: green;font-size: 16px; font-size: 11px; font-weight: bold;');
57 }
58 else {
59 console.log('%c ### No has ganado (' + response + ') ', 'background-color: red; color: white; font-weight: bold;');
60
61 repeat();
62 }
63 });
64 }
65 else {
66 console.log('%c ### No has ganado (' + response + ') ', 'background-color: red; color: white; font-weight: bold;');
67
68 repeat();
69 }
70 });
71}
72
73init();