-
Notifications
You must be signed in to change notification settings - Fork 3
/
casino_bingo.js
85 lines (72 loc) · 1.83 KB
/
casino_bingo.js
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
var _isEnabled = true;
function checkNumber(){
var el = $('.prt-hit-box .number');
if(el.size()>0){
for(var a=el.get(0).className.split(' ');a.length>0;a.shift()){
if(/prt-hit-number-\d+/.test(a[0])){
var ret = a[0].split('-');
return ret[ret.length-1]
}
}
}
return null
}
function tapNumber(n){
var el = $('.prt-sheet-box .btn-number-close-'+n);
if(el.size()>0){
console.info('tap on '+n);
el.trigger('tap');
}
}
function mainCycle(){
var n = checkNumber();
if(_isEnabled && n!=null){
tapNumber(n);
}
setTimeout(mainCycle,delayTime);
}
function playNext(){
$('.btn-usual-ok').trigger('tap');
$('.pop-bingo-result .btn-play-again').trigger('tap');
$('.pop-bet .btn-play-ok').trigger('tap');
}
function _autoNext(){
if($('#pop').children().size()>0){
playNext();
}
_autoNextID = setTimeout(_autoNext,delayTime);
return '输入 stopAutoNext 来停止自动开始的命令。'
}
function _stopAutoNext(){
clearTimeout(_autoNextID);
return 'Good Luck :)';
}
Object.defineProperties(window,{
autoNext:{get:_autoNext},
stopAutoNext:{get:_stopAutoNext}
});
var delayTime=1000, _autoNextID=0;
mainCycle();
var cc = $('<div class="wg"><style>.wg{position:absolute;z-index:20;top:0}.wg button{width:76px;height:22px;margin-right:4px}</style></div>').appendTo(document.body),
cmd1 = $('<button>自动下一局</button>').appendTo(cc),
cmd2 = $('<button>不要帮我点</button>').appendTo(cc),
et = 'ontouchstart' in window ? 'touchstart' : 'mousedown';
cmd1.on(et,function(){
if(cmd1.text()=='停止'){
cmd1.text('自动下一局');
_stopAutoNext();
}else{
cmd1.text('停止');
_autoNext();
}
});
cmd2.on(et,function(){
if(cmd2.text()=='帮我点'){
cmd2.text('不要帮我点');
_isEnabled = true;
}else{
cmd2.text('帮我点');
_isEnabled = false;
}
});
console.info('自动点击已启用。');