· 7 years ago · Jan 09, 2019, 04:06 PM
1//ZONA SEGURA, PUEDEN JUGAR AQUI
2
3var domain = "gmail.com"
4
5
6//SI NO ENTIENDES NI PAPA, ATRAS!!!!!
7
8var time_check = 10000 //No lo bajes o quedas ban
9
10var time_pizzas = 60000 //Tampoco lo bajes
11
12var timeout_telewin = 0;
13
14var timeout_telequeda = 0;
15
16function telewin(){
17
18 function guid() {
19
20 function s4() {
21
22 return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
23
24 }
25
26 if(domain=="gmail.com"){
27
28 var sep = 0;
29
30 return "TUNOMBRE" + s4() + sep + s4() + sep + s4() + s4() + s4();
31
32 }else{
33
34 var sep = "-";
35
36 return s4() + sep + s4() + s4() + s4();
37
38 }
39
40
41
42 }
43
44
45 var data ={
46
47 email: guid()+"@"+domain,
48
49 receive_offert: false,
50
51 }
52
53 $.ajax({
54
55 type: "POST",
56
57 url: "https://d6ow8diqzony0.cloudfront.net/check-mail",
58
59 dataType: 'json',
60
61 contentType: "application/json",
62
63 crossDomain : true,
64
65 data: JSON.stringify(data),
66
67 success: function (result) {
68
69 busy = false;
70
71 if(!busy){
72
73 var body = JSON.stringify(JSON.parse(result['body']) );
74
75 var response = JSON.parse(body);
76
77 if(!busy){
78
79 switch(response.responseMessage) {
80
81 case 'EMAIL_SAVED':
82
83 $.ajax({
84
85 type: "POST",
86
87 url: "https://d6ow8diqzony0.cloudfront.net/check-prize",
88
89 dataType: 'json',
90
91 contentType: "application/json",
92
93 crossDomain : true,
94
95 data: JSON.stringify({email: data.email}),
96
97 success: function (result) {
98
99 busy = false;
100
101 var body = JSON.stringify(JSON.parse(result['body']));
102
103 var response = JSON.parse(body);
104
105 switch(response.responseMessage) {
106
107 case 'USER_IS_WINNER':
108
109 console.log("[GANADOR]" + data.email)
110
111 break;
112
113 case 'USER_NOT_WIN':
114
115 console.log("[NO GANADOR]" + data.email)
116
117 break;
118
119 }
120
121 timeout = setTimeout(function(){telewin()}, time_check);
122
123 },
124
125 error: function (e) {
126
127 timeout = setTimeout(function(){telewin()}, time_check);
128
129 console.log("ERROR: "+ e.message);
130
131 }
132
133 });
134
135 break;
136
137 }
138
139
140
141 }
142
143 }
144
145 },
146
147 error: function (e) {
148
149 console.log("ERROR: "+ e.message);
150
151 }
152
153 });
154
155
156
157}
158
159var pizzas = 1000;
160
161var busy_telequeda = false;
162
163var timing = 44000
164
165function telequeda() {
166
167 if(!busy_telequeda){
168
169 busy_telequeda = true;
170
171 $.ajax({
172
173 url: "./data.json",
174
175 dataType: "text",
176
177 success: function(e) {
178
179 busy_telequeda = false;
180
181 timeout_telequeda = setTimeout(function(){telequeda()}, time_pizzas);
182
183 var t = JSON.parse(e);
184
185 prizesEnable = JSON.stringify(t.prizesEnable), console.log("[INFO] Quedan " + prizesEnable + " Pizzas")
186
187 },
188
189 error: function (e) {
190
191 busy_telequeda = false;
192
193 timeout_telequeda = setTimeout(function(){telequeda()}, time_pizzas);
194
195 console.log("ERROR: "+ e.message);
196
197 }
198
199 })
200
201 }
202
203}
204
205timeout_telewin = setTimeout(function(){telewin()}, time_check);
206
207timeout_telequeda = setTimeout(function(){telequeda()}, time_pizzas);