-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathlottery.html
403 lines (322 loc) · 8.39 KB
/
lottery.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<title></title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100' rel='stylesheet' type='text/css'>
<style type="text/css">
*{ margin: 0; padding: 0; }
li{ list-style: none; }
html,body{ height: 100%;}
body{
/*
background: #4c7a9e url(http://www.preview.imithemes.com/okidoapp/images/bg_showcase.jpg);
-webkit-background-size: cover;
*/
background: #4c7a9e url(img/noise.png);
}
.clearfix:before, .clearfix:after {
content: '';
display: table;
}
.clearfix:after{
clear: both;
}
.clearfix{
*zoom: 1;
}
.box-counter-container {
position: fixed;
left: 50%;
top: 50%;
width: 886px;
margin-top: -60px;
margin-left: -443px;
text-align: center;
}
.box-counter {
position: relative;
float: left;
margin: 0 10px;
padding: 0;
width: 100px;
height: 120px;
border-radius: 5px;
background: #4caed3;
box-shadow: 5px 5px 0px rgba(0,0,0,0.08);
overflow: hidden;
}
.box-counter:nth-child(1) {
width: 225px
}
.box-counter:nth-child(2) {
width: 300px
}
.box-counter:nth-child(3) {
width: 300px
}
.box-counter:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 5px;
box-shadow: inset 0px 0px 50px 10px #4caed3;
z-index: 999;
}
.box-counter:after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 50%;
border-radius: 5px 5px 0px 0px;
box-shadow: inset 0px -50px 70px -50px rgba(100,150,180,0.35);
border-bottom: 1px solid rgba(100,150,180,0.22);
z-index: 1000;
}
.box-counter ul{
height: 100%;
}
.box-counter li{
float: left;
width: 75px;
height: 100%;
-webkit-transition: all .1s linear;
}
.box-counter .none li{
color: #fff;
text-align: center;
line-height: 120px;
font-family: Roboto;
font-size: 6em;
text-shadow: 0px 0px 2px rgba(255,255,255,1), 2px 2px 0px rgba(0,0,0,0.08);
}
.box-counter .prefix li:nth-child(1) {
background: url(img/num1.png) repeat-y;
}
.box-counter .prefix li:nth-child(2) {
background: url(img/num3458.png) repeat-y;
}
.box-counter .prefix li:nth-child(3) {
background: url(img/num0-9.png) repeat-y;
}
.box-counter .suffix li{
background: url(img/num0-9.png) repeat-y;
}
</style>
</head>
<body>
<div class="box-counter-container clearfix">
<div class="box-counter">
<ul class="none">
<li>*</li>
<li>*</li>
<li>*</li>
</ul>
</div>
<div class="box-counter">
<ul class="none">
<li>*</li>
<li>*</li>
<li>*</li>
<li>*</li>
</ul>
</div>
<div class="box-counter">
<ul class="none">
<li>*</li>
<li>*</li>
<li>*</li>
<li>*</li>
</ul>
</div>
</div>
<!--
/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/
~~(Math.random() * max)
~~(Math.random() * (min - max + 1) + max)
( new Date().getTime() * 7 - 13 ) % totalCount + 1
//数组排序 [].sort(function () { return 0.5 - Math.random(); })
-->
<script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.min.js"></script>
<script type="text/javascript">
/*
抽奖前测试!
Url: http://5.youxiake.com/circle.php?do=circleinfor&event=joindetail&actid=6050
$.each($('.userlist tr:not(.list_header)'), function(i, n){
if( !/^13[0-9\*]{9}$|14[0-9\*]{9}|15[0-9\*]{9}$|18[0-9\*]{9}$/.test( $(this).find('td:eq(7)').html() ) ){
console.log( $(this).find('td:eq(7)').html() ) //查找是否存在非大陆手机号码!
}
})
url: http://5.youxiake.com/circle.php?do=circleinfor&event=joindetail&actid=6050
var teldata = {};
$.each($('.userlist tr:not(.list_header)'), function(i, n){
var $this = $(this);
teldata[ i + 1 ] = {
'tel' : $.trim( $this.find('td:eq(7)').text() ),
'name': $.trim( $this.find('td:eq(0)').text() )
}
});
function json2str(o) {
var arr = [];
var fmt = function(s) {
if (typeof s == 'object' && s != null) return json2str(s);
return /^(string|number)$/.test(typeof s) ? "'" + s + "'" : s;
}
for (var i in o) arr.push("'" + i + "':" + fmt(o[i]));
return '{' + arr.join(',') + '}';
}
json2str( teldata )
url: http://5.youxiake.com/circle.php?do=circleinfor&event=moreuser&actid=6050
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://raw.github.com/douglascrockford/JSON-js/master/json2.js';
head.appendChild(script);
JSON.stringify( telData )
$('#userlist li').each(function(i, n){
telData[ i + 1 ][ 'url' ] = $(this).find('img').attr('src')
})
*/
/*
* strat
*/
$( '.box-counter:eq(0) > ul' ).attr( 'class', 'prefix' ).find( 'li' ).empty();
$( '.box-counter:eq(2) > ul' ).attr( 'class', 'suffix' ).find( 'li' ).empty();
/*$( '.box-counter ul:not(.none) li' ).filter(function( i ){ return i > 1 }).each(function(){
var bg = Bingo( $( this ) );
$( this ).data( 'bg', bg );
bg.start()
})*/
//空格控制
var action = $( '.box-counter ul:not(.none) li' ).filter(function( i ){ return i > 0 }),
b = true,
c = Lucky( action );
$( document ).on('keydown', function( e ){
if( e.keyCode == 32 ){//空格
if( b ){
c.aStart();
b = false;
}else{
c.lottery();
b = true;
}
}
})
/*Control( action )
function Control( args ){
$.each(args, function( i, n ){
setTimeout(function(){
var single = $( n ),
bingo = Bingo( single );
bingo.start();
$( n ).data( 'bingo', bingo);
}, i * 150)
})
}*/
function Lucky( args ){
var args = args;
return {
//顺序运动
aStart: function(){
$.each(args, function( i, n ){
var single = $( n );
if( single.data( 'bingo' ) == undefined ){
single.data( 'bingo', Bingo( single ) );
}
setTimeout(function(){
single.data( 'bingo' ).start();
}, i * 150)
})
},
//抽奖
lottery: function(){
//异步获取Json、手机号
var lucky = '15967197636';
value = [];
for(var i = 0; i < lucky.length; i++){
( i > 0 && i < 3 || i > 6 ) && value.push( lucky.charAt( i ) )
}
$.each(args, function(i, n){
var single = $( n ),
bingo = single.data( 'bingo' );
bingo.endTo( ~~value[ i ], i * 200, !i )
})
}
}
}
/*
* 摇奖机Bingo
* 从下至上循环摇动,控制backgroundPositionY
* arg $对象
*/
function Bingo( arg ) {
var code = '3458', //网络识别号 [ 2 ]{ 3, 4, 5, 8 }
//RegExp( /^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/ )
loop = 0, //循环次数
running = 0, //0 - 9
timer = null; //控制摇动时间
/*
* 增加随机步数selfAuto
* 保证每次跳跃次数不一致
* 范围 Math.random() * 10 -- [ 0 - 9 ]
*/
function selfAuto() {
running += ~~( Math.random() * 10 );
format();
}
/*
* 格式化format
* running 保持0-9区间
*/
function format() {
if( running >= 10 ){
loop ++;
running -= 10;
}
}
return {
start: function() {
selfAuto();
arg.css({
'background-position-y': -120 * ( 10 * loop + running )
})
//[50, 100]
timer = setTimeout( arguments.callee, Math.random() * 50 + 50 )
},
stop: function(){
clearTimeout( timer )
},
endTo: function( num, timer ) {
this.stop();
timer = timer || 200;
//网络识别号 [ 2 ]{ 3, 4, 5, 8 }
if( arguments[2] != undefined && arguments[2] ) {
var to = code.indexOf( num ),
from = ( 10 * loop + running ) % 4;
if( to >= from ) {
running += to - from;
} else {
running += 4 + to - from;
}
format();
} else {
if( num < running ) {
loop ++;
}
running = num;
}
arg.animate({
'background-position-y': -120 * ( 10 * loop + running )
}, timer)
}
}
}
</script>
</body>
</html>