-
Notifications
You must be signed in to change notification settings - Fork 36
/
bga.min.js
299 lines (299 loc) · 12.4 KB
/
bga.min.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
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
(function(g, d) {
function h(a) {
a = a || {};
this.a = this.type = null;
this.d = "/usr/themes/Themia/src/"
;
this.A = {
kiana: {
s: {
stand: {
h: 0,
src: this.d + "img/kiana-1.png"
},
move: {
h: 0,
src: this.d + "img/kiana-2.png"
},
hover: {
h: 1100,
src: this.d + "img/kiana-3.gif"
},
click: {
h: 0,
src: this.d + "img/kiana-4.png"
}
},
j: {
click: "快看快看,我抽到了什么~;去死去死去死去死!;主人,人家钱包都空了;变态!;Kiana,变身!;嗯,miHoYo什么的,最讨厌了~;千万别小看我哟~;要加油哦!;我就知道主人最疼人家啦~;锵锵~;烦死啦,走开走开啦!".split(";"),
//\u5236\u4f5cby\uff1a\u6d88\u5931\u7684853\uff0c\u611f\u8c22AlexGuo1998\u7684\u652f\u6301
drag: ["呀~~"]
},
e: {},
random: []
}
};
this.r = this.p = this.v = this.m = null;
this.f = 0;
this.i = 1;
this.bound = this.t = !1;
this.k = {
mobile: {
mousedown: "touchstart",
mousemove: "touchmove",
mouseup: "touchend"
},
pc: {
mousedown: "mousedown",
mousemove: "mousemove",
mouseup: "mouseup"
}
};
this.u = a.u || !1;
this.w = a.w || !0;
this.B = a.B || !0;
this.g = "pc";
/AppleWebKit.*Mobile.*/i.test(navigator.userAgent) && (this.g = "mobile");
d('<style type="text/css">.bhxy-click{transform-origin: 50% 100%;animation: bhxy-click 0.5s linear;-webkit-transform-origin: 50% 100%;-webkit-animation: bhxy-click 0.5s linear;}@keyframes bhxy-click{0%{transform:scale(1,1);}10%{transform:scale(1.1,0.95);}30%{transform:scale(1,1);}}@-webkit-keyframes bhxy-click{0%{-webkit-transform:scale(1,1);}10%{-webkit-transform:scale(1.1,0.9);}30%{-webkit-transform:scale(1,1);}}@media screen and (max-width: 768px)/*设置浏览器宽度小于多少数值隐藏挂件*/ {.bhxykiana{display: none}}</style>').appendTo("head")
}
h.prototype = {
constructor: h,
I: function(a, c) {
var b = this;
if (a && this.A[a]) {
this.a = {
b: d("<div class='bhxykiana'>").css({
position: "fixed",
width: 115,
height: 170,
bottom: 10,
right: 30,
cursor: "pointer",
zIndex: 10050
}),
C: d("<img />").css({
display: "block",
width: "100%",
height: "100%"
}),
c: null,
e: null
};
void 0 !== c && this.a.b.css(c);
this.a.b.append(this.a.C).appendTo("body");
this.a.b.on("click",
function() {
"undefined" != typeof _czc && _czc.push(["_trackEvent", "hxzj_ads_click", "click", b.type]);
b.f <= b.i && (b.stop(), b.change("click"), b.j("click"), b.start(3E3));
b.f = 0
});
var f = this.a.b;
this.a.b.on(this.k[this.g].mousedown + ".bhxy",
function(a) {
a.preventDefault();
var c = b.n(a).x - d(this).offset().left,
h = b.n(a).y - d(this).offset().top;
d(document).on(b.k[b.g].mousemove + ".bhxy",
function(a) {
b.f > b.i && (b.change("move"), b.f == b.i + 1 && b.j("drag", "drag"));
b.f++;
a.preventDefault();
var e = b.n(a).G - c;
a = b.n(a).H - h;
a >= d(g).height() - f.height() - 5 && b.bound ? a = d(g).height() - f.height() - 5 : 0 >= a && b.bound && (a = 0);
e >= d(g).width() - f.width() - 5 && b.bound ? e = d(g).width() - f.width() - 5 : 0 >= e && b.bound && (e = 0);
f.css({
right: "auto",
bottom: "auto",
left: e,
top: a
})
});
d(document).on(b.k[b.g].mouseup + ".bhxy",
function() {
b.f > b.i && (b.a.b.removeClass("bhxy-click"), setTimeout(function() {
b.a.b.addClass("bhxy-click")
},
0), b.l(), b.o(!1));
d(document).off(b.k[b.g].mousemove + ".bhxy");
d(document).off(b.k[b.g].mouseup + ".bhxy")
})
});
"pc" == this.g && (this.a.b.on("mouseenter.bhxy",
function() {
b.t = !0;
b.f <= b.i && "click" != b.m && b.change("hover");
b.q.show()
}), this.a.b.on("mouseleave.bhxy",
function() {
b.t = !1;
b.f <= b.i && "click" != b.m && b.change("stand");
b.q.hide()
}));
this.B && (this.q = d("<div>").addClass("close-btn-wrp").css({
position: "absolute",
top: -10,
right: 0,
width: "100%",
height: 20
}).hide().appendTo(this.a.b), d("<div>").addClass("close-btn").text("×").css({
position: "absolute",
top: 0,
right: 0,
width: 18,
height: 18,
lineHeight: "15px",
fontSize: 20,
textAlign: "center",
cursor: "pointer",
backgroundColor: "#ddd",
borderRadius: "4px"
}).appendTo(this.q).on("click",
function(a) {
a.stopPropagation();
b.disable()
}));
this.F(a);
this.start();
return this.a
}
},
start: function(a) {
this.u || a ? this.o(a) : this.o(!1);
this.u && this.random()
},
stop: function() {
clearTimeout(this.p);
clearTimeout(this.v)
},
o: function(a) {
var c = this;
clearTimeout(this.p); ! 1 === a ? a = 0 : 0 != a && (a = a || 3E3);
this.p = setTimeout(function() {
c.t ? c.change("hover") : c.change("stand")
},
a)
},
random: function() {
var a = this,
c = 1E3 * Math.round(5 * Math.random() + 5);
clearTimeout(this.v);
this.v = setTimeout(function() {
clearTimeout(a.p);
var b = a.a.c.random;
b.length && (b = b[Math.round(Math.random() * (b.length - 1))], a.change(b), a.o(3E3), a.random())
},
c)
},
change: function(a) {
this.a.c.s[a] && (this.m = a, this.a.C.attr("src", this.a.c.s[a].src))
},
F: function(a) {
this.stop();
this.type = a;
this.a.c = this.A[a || "22"];
this.change("stand");
this.start()
},
j: function(a, c) {
var b = this,
f = this.a.c.j[a] || a,
e = a;
clearTimeout(this.r);
this.l(0);
d.isArray(f) && (e = Math.floor(Math.random() * f.length), f = f[e]);
var g = d("<div>").html(f).attr({
style: "transition:0.3s",
dialog: "true"
}).css({
position: "absolute",
top: -20,
left: -100,
visibility: "hidden",
opacity: 0,
backgroundColor: "#213C7F",
color: "#fff",
padding: "5px 10px",
fontSize: "13px",
width: 130,
wordWrap: "break-word",
zIndex: 10050,
borderRadius: 4
}).appendTo(this.a.b);
this.w && this.J(a, c || e);
setTimeout(function() {
g.css({
visibility: "visible",
opacity: 0.75
});
b.r = setTimeout(function() {
b.l()
},
2E3)
},
0)
},
J: function(a, c) {
var b = this;
this.D && this.D[0].pause();
this.a.c.e[a] || (this.a.c.e[a] = {});
var f = "number" == typeof c ? c + 1 : c,
e;
if (this.a.c.e[a]["v-" + f]) e = this.a.c.e[a]["v-" + f][0],
e.currentTime = 0,
e.play();
else {
var g = d("<audio>").appendTo(this.a.b).hide();
e = g[0];
if (!e || !e.play || !e.canPlayType("audio/mpeg")) {
this.w = !1;
g.remove();
return
}
e.addEventListener("ended",
function() {
"move" != b.m && b.start();
b.l()
});
g.attr("src", this.d + "voice/" + this.type + "_" + f + ".mp3");
e.volume = .2;
e.play();
this.a.c.e[a]["v-" + f] = g
}
this.stop();
this.D = this.a.c.e[a]["v-" + f]
},
l: function(a) {
clearTimeout(this.r);
this.a.b.find("[dialog]").stop(!0, !0).fadeOut("undefined" == typeof a ? 400 : a,
function() {
d(this).remove()
})
},
n: function(a) {
a = a.originalEvent;
var c = [];
c.y = "undefined" !== typeof a.pageY && (a.pageY || a.pageX) ? a.pageY: a.touches[0].pageY;
c.x = "undefined" !== typeof a.pageX && (a.pageY || a.pageX) ? a.pageX: a.touches[0].pageX;
c.H = "undefined" !== typeof a.clientY && (a.clientY || a.clientX) ? a.clientY: a.touches[0].clientY;
c.G = "undefined" !== typeof a.clientX && (a.clientY || a.clientX) ? a.clientX: a.touches[0].clientX;
return c
},
disable: function() {
this.a.b.hide()
}
};
d(function() {
if ("undefined" == typeof g.K) {
var a = g.bhxyG = new h;
a.setModel = a.F;
a.I("kiana")
}
})
})(window, jQuery);
preloadList = '/usr/themes/Themia/src/img/kiana-1.png /usr/themes/Themia/src/img/kiana-2.png /usr/themes/Themia/src/img/kiana-3.gif /usr/themes/Themia/src/img/kiana-4.png'.split(' ');
for (i = 0; i < preloadList.length; i++) img = new Image,
img.src = preloadList[i];
preloadListaud = '/usr/themes/Themia/src/voice/kiana_1.mp3 /usr/themes/Themia/src/voice/kiana_2.mp3 /usr/themes/Themia/src/voice/kiana_3.mp3 /usr/themes/Themia/src/voice/kiana_4.mp3 /usr/themes/Themia/src/voice/kiana_5.mp3 /usr/themes/Themia/src/voice/kiana_6.mp3 /usr/themes/Themia/src/voice/kiana_7.mp3 /usr/themes/Themia/src/voice/kiana_8.mp3 /usr/themes/Themia/src/voice/kiana_9.mp3 /usr/themes/Themia/src/voice/kiana_10.mp3 /usr/themes/Themia/src/voice/kiana_11.mp3 /usr/themes/Themia/src/voice/kiana_drag.mp3'.split(' ');
for (i = 0; i < preloadListaud.length; i++) aud = new Audio,
aud.src = preloadListaud[i];