· 8 years ago · Jan 11, 2018, 09:20 AM
1var time = 10000; //Tiempo en ms. No se aconseja menos.
2var domain = "gmail.com";
3var mailname = "jo";
4var startTime = 7;
5
6function telewin() {
7 var e = {
8 email: function () {
9 function e() {
10 return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1)
11 }
12 return mailname + e() + e() + e();
13 }() + "@" + domain,
14 receive_offert: !1
15 },
16 t = !1;
17 if (new Date().getHours() < startTime) {
18 console.log("*" + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + "* Hasta las " + startTime + ":00 el script no se ejecutará");
19 t = !1, timeOutId = setTimeout(telewin, time);
20 } else {
21 t || (t = !0, $.ajax({
22 type: "POST",
23 url: "https://d6ow8diqzony0.cloudfront.net/check-mail",
24 dataType: "json",
25 contentType: "application/json",
26 crossDomain: !0,
27 data: JSON.stringify(e),
28 success: function (s) {
29 if (!(t = !1)) {
30 var a = JSON.stringify(JSON.parse(s.body)),
31 n = JSON.parse(a);
32 if (!t) switch (n.responseMessage) {
33 case "EMAIL_SAVED":
34 $.ajax({
35 type: "POST",
36 url: "https://d6ow8diqzony0.cloudfront.net/check-prize",
37 dataType: "json",
38 contentType: "application/json",
39 crossDomain: !0,
40 data: JSON.stringify({
41 email: e.email
42 }),
43 success: function (s) {
44 t = !1, timeOutId = setTimeout(telewin, time);
45 var a = JSON.stringify(JSON.parse(s.body));
46 switch (JSON.parse(a).responseMessage) {
47 case "USER_IS_WINNER":
48 console.warn("*" + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + "* [GANADOR]" + e.email);
49 break;
50 case "USER_NOT_WIN":
51 console.log("*" + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + "* [NO GANADOR]" + e.email)
52 }
53 },
54 error: function (e) {
55 t = !1, console.log("*" + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + "* ERROR: " + e.message)
56 }
57 })
58 }
59 }
60 },
61 error: function (e) {
62 t = !1, console.log("*" + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + "* ERROR: " + e.message)
63 }
64 }));
65 }
66}
67
68function telequeda() {
69 $.ajax({
70 url: "./data.json",
71 dataType: "text",
72 success: function (e) {
73 timeOutId2 = setTimeout(telequeda, 6e4);
74 var t = JSON.parse(e);
75 prizesEnable = JSON.stringify(t.prizesEnable), console.log("*" + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + "* [INFO] Quedan " + prizesEnable + " Pizzas")
76 }
77 })
78}
79var timeOutId = 0,
80 timeOutId2 = 0;
81telewin(), telequeda(), timeOutId = setTimeout(telewin, time), timeOutId2 = setTimeout(telequeda, 6e4);