|
|
1
|
+/**
|
|
|
2
|
+ * Created by KIPI-C on 2017/6/26.
|
|
|
3
|
+ */
|
|
|
4
|
+var kaudio={
|
|
|
5
|
+ version:"1.0.6.11 build1",
|
|
|
6
|
+ author:"KIPI-C"
|
|
|
7
|
+};
|
|
|
8
|
+var kaplayer=0;
|
|
|
9
|
+var csstext=".kc-body{display:inline-block;height:32px;margin:1px 5px;}" +
|
|
|
10
|
+ ".k-body{width:100% !important;height:100% !important;border-radius:5px;background-color:#0cf;overflow:hidden;position:relative;cursor:default;top:0;left:0;}" +
|
|
|
11
|
+ ".kc-pauselog,.kc-playlog{display:block;width:30px;height:30px;border-radius:90px;background-size:100%;cursor:pointer;position:relative;top:0;left:0;}" +
|
|
|
12
|
+ ".kc-rangebody{display:block;height:100%;top:-6px;position:relative;}" +
|
|
|
13
|
+ ".kc-rangeli{display:block;margin-bottom:1px;width:100%;height:4px;background-color:rgba(0,0,0,.1)}" +
|
|
|
14
|
+ ".kc-rangep{width:4px;height:4px;background-color:#fff;cursor:pointer}" +
|
|
|
15
|
+ ".kc-rangeloadli{background-color:rgba(255,255,255,.4);position:absolute;top:0;left:0;cursor:pointer}" +
|
|
|
16
|
+ ".kc-soundbody{position:absolute;top:0;z-index:1;transition:left .9s ease;height:100%;background-color:#0cf;}" +
|
|
|
17
|
+ ".kc-nosoundicon,.kc-sound0icon,.kc-sound1icon,.kc-sound2icon,.kc-sound3icon,.kc-soundicon{display:block;margin:1px 0;width:30px;height:30px;border-radius:90px;cursor:pointer}" +
|
|
|
18
|
+ ".kc-nosoundicon,.kc-sound0icon,.kc-sound1icon,.kc-sound2icon,.kc-sound3icon{position:absolute;z-index:2;background-size:100%;top:0}" +
|
|
|
19
|
+ ".kc-soundli{display:block;margin-bottom:13px;margin-left:2px;height:20%;background-color:rgba(0,0,0,.1);position:absolute;}" +
|
|
|
20
|
+ ".kc-soundp{position:relative;bottom:25%;height:180%;background-color:#fff;cursor:pointer}" +
|
|
|
21
|
+ ".kc-infbody{color:#fff;display:block;padding-top:8px;height:100%;text-align:center;font-weight:700;font-size:13px;cursor:default;position:relative;}" +
|
|
|
22
|
+ ".kc-lrctable{display:table;font-weight:400;color:#fff;position:absolute;top:0;left:32px;padding:0}" +
|
|
|
23
|
+ ".kc-lrcbody{display:table-cell;overflow:hidden;vertical-align:middle;text-align:center;line-height:80%}" +
|
|
|
24
|
+ "#kc-lrcfilebox{display:none}";
|
|
|
25
|
+ document.head.innerHTML='<!--k-audio.js style--><style>'+csstext+"</style><!--/k-audio.js style-->"+document.head.innerHTML;
|
|
|
26
|
+function kac(audio,width,height,lrc,translation){
|
|
|
27
|
+ if(width===null||width===""||width===" "||width===undefined){width=320;}else{width=parseInt(width)}
|
|
|
28
|
+ if(height===null||height===""||height===" "||height===undefined){height=32;}else{height=parseInt(height)}
|
|
|
29
|
+ if (width<height*10){
|
|
|
30
|
+ width=height+10;
|
|
|
31
|
+ }var hh=height-32;
|
|
|
32
|
+ kaplayer++;
|
|
|
33
|
+ var kbody,bloc,lrcbody,lrctext,lrcbody2,lrcli,lrclong,x,xx,xxx,ar,ti,al,timetoupmin,timetoups,timetoupms,upt,lrcnuber,lrccc,infonuber=0,kap=kaplayer;
|
|
|
34
|
+ var play,pause,rangep,rangeli,rangeloadli,rangebody,cnt,cat,rangepl,soundbody,soundicon,soundbodyleft,soundpl,sound0icon,sound1icon,sound2icon,sound3icon,nosound,v,vv,soundli,soundp,infbody,lrcfilebox,lrctable,$$$show=false;
|
|
|
35
|
+ var pl,konname,konpart,konfor=[],kontype=[],kontext=[],loadfirst=false,lrcbodytext,kontexttype=[],
|
|
|
36
|
+ lrcarray=[],lrcpart=[],timetouptime=[],lrcpart2=[];
|
|
|
37
|
+ var $play=false;cx=audio;
|
|
|
38
|
+ var down=false;var down1=false;
|
|
|
39
|
+ this.preload=function (a) {
|
|
|
40
|
+ cx.preload=a;
|
|
|
41
|
+ };
|
|
|
42
|
+ this.version=function () {
|
|
|
43
|
+ return "1.0.6.11 build 1"
|
|
|
44
|
+ };
|
|
|
45
|
+ this.author=function () {
|
|
|
46
|
+ return "KIPI-C"
|
|
|
47
|
+ };
|
|
|
48
|
+ this.style=function(color){
|
|
|
49
|
+ color=color.toString();
|
|
|
50
|
+ soundbody.style.backgroundColor=color;
|
|
|
51
|
+ kbody.style.backgroundColor=color;
|
|
|
52
|
+ if(color==="black"||color==="#fff"||color==="#ffffff"){
|
|
|
53
|
+ rangeli.style.background="rgba(254,254,254,.3)";
|
|
|
54
|
+ soundli.style.background="rgba(254,254,254,.3)";
|
|
|
55
|
+ }else {
|
|
|
56
|
+ rangeli.style.background="rgba(0,0,0,.1)";
|
|
|
57
|
+ soundli.style.background="rgba(0,0,0,.1)";
|
|
|
58
|
+ }
|
|
|
59
|
+ return color
|
|
|
60
|
+ };
|
|
|
61
|
+ this.width=function (w) {
|
|
|
62
|
+ setwh(w)
|
|
|
63
|
+ };
|
|
|
64
|
+ this.height=function (h) {
|
|
|
65
|
+ setwh("",h)
|
|
|
66
|
+ };
|
|
|
67
|
+ this.play=function () {
|
|
|
68
|
+ cx.play();
|
|
|
69
|
+ $play=true;
|
|
|
70
|
+ $$hide("play");
|
|
|
71
|
+ $$show("pause");
|
|
|
72
|
+ };
|
|
|
73
|
+ this.pause=function () {
|
|
|
74
|
+ cx.pause();
|
|
|
75
|
+ $play=false;
|
|
|
76
|
+ $$hide("pause");
|
|
|
77
|
+ $$show("play");
|
|
|
78
|
+ };
|
|
|
79
|
+ this.speed=function (a) {
|
|
|
80
|
+ cx.playbackRate=a;
|
|
|
81
|
+ return a
|
|
|
82
|
+ };
|
|
|
83
|
+ this.load=function () {
|
|
|
84
|
+ cx.load();
|
|
|
85
|
+ };
|
|
|
86
|
+ this.stop=function () {
|
|
|
87
|
+ cx.currentTime=cx.duration;
|
|
|
88
|
+ };
|
|
|
89
|
+ this.currentTime=function (a) {
|
|
|
90
|
+ try{
|
|
|
91
|
+ if (a){cx.currentTime=a;}}
|
|
|
92
|
+ catch (e){return !1}
|
|
|
93
|
+ };
|
|
|
94
|
+ this.loadkbag=function (a) {
|
|
|
95
|
+ $.get(a,function (b,x) {
|
|
|
96
|
+ c(b,x);
|
|
|
97
|
+ function c(b,x) {
|
|
|
98
|
+ if (x==="success"){
|
|
|
99
|
+ b=b.replace(/\n/g,"");
|
|
|
100
|
+ b=b.replace(/ /g,"");
|
|
|
101
|
+ pl=b.indexOf("{");
|
|
|
102
|
+ konname=b.slice(0,pl);
|
|
|
103
|
+ if (konname==="main") {
|
|
|
104
|
+ b = b.slice(pl + 1, b.length - 2);
|
|
|
105
|
+ konpart = b.split(",");
|
|
|
106
|
+ x = 0;
|
|
|
107
|
+ while (x < konpart.length) {
|
|
|
108
|
+ var kp = konpart[x];
|
|
|
109
|
+ var a = kp.indexOf(":");
|
|
|
110
|
+ var b = kp.indexOf("[");
|
|
|
111
|
+ konfor[x] = kp.slice(1, a);
|
|
|
112
|
+ kontype[x] = kp.slice(a + 1, b);
|
|
|
113
|
+ kontext[x] = kp.slice(b+1, kp.length - 1);
|
|
|
114
|
+ var c=kontext[x].indexOf("\"");
|
|
|
115
|
+ var d=kontext[x].indexOf("\"",c);
|
|
|
116
|
+ var f=kontext[x].indexOf("@");
|
|
|
117
|
+ if (c>=0&&d>=0){kontexttype[x]="String"}
|
|
|
118
|
+ if (c<0){kontexttype[x]="Nuber"}
|
|
|
119
|
+ if (f===0){kontexttype[x]="Class"}
|
|
|
120
|
+ x++;
|
|
|
121
|
+ }
|
|
|
122
|
+ x=0;
|
|
|
123
|
+ while (x<konpart.length){
|
|
|
124
|
+ var aa=true,bb=true;
|
|
|
125
|
+ var dg="document.getElementById('";
|
|
|
126
|
+ var dg2="')";
|
|
|
127
|
+ switch (konfor[x]){
|
|
|
128
|
+ case "kbody":konfor[x]="ka-body"+kap;break;
|
|
|
129
|
+ case "soundbody":konfor[x]="ka-soundbody"+kap;break;
|
|
|
130
|
+ case "lrcbody":konfor[x]="ka-lrcbody"+kap;break;
|
|
|
131
|
+ case "allsoundicon":konfor[x]="ka-soundicon"+kap;break;
|
|
|
132
|
+
|
|
|
133
|
+ default:aa=false;break;
|
|
|
134
|
+ }
|
|
|
135
|
+ switch (kontype[x]){
|
|
|
136
|
+ case "bgcolor":kontype[x]=".style.backgroundColor";break;
|
|
|
137
|
+ case "text":kontype[x]=".innerHTML";break;
|
|
|
138
|
+ case "bgimage":kontype[x]=".style.backgroundImage";break;
|
|
|
139
|
+ default:bb=false;break;
|
|
|
140
|
+ }
|
|
|
141
|
+ switch(kontext[x]){
|
|
|
142
|
+ default:break;
|
|
|
143
|
+ }
|
|
|
144
|
+ if (aa&&bb&&kontext[x]){
|
|
|
145
|
+ eval(dg+konfor[x]+dg2+kontype[x]+"="+"\'"+kontext[x]+"\'");
|
|
|
146
|
+ }
|
|
|
147
|
+ if(konfor[x]==="ka-lrcbody"+kap&&kontype[x]===".innerHTML"){
|
|
|
148
|
+ loadfirst=true;lrcbodytext=kontext[x];
|
|
|
149
|
+ }
|
|
|
150
|
+ x++;
|
|
|
151
|
+ }
|
|
|
152
|
+ }
|
|
|
153
|
+ }
|
|
|
154
|
+ else {
|
|
|
155
|
+ console.warn("加载pkg失败")
|
|
|
156
|
+ }
|
|
|
157
|
+ }
|
|
|
158
|
+ })
|
|
|
159
|
+
|
|
|
160
|
+ };
|
|
|
161
|
+ this.info=function () {
|
|
|
162
|
+ return {"ar":ar, "ti":ti, "al":al}
|
|
|
163
|
+ };
|
|
|
164
|
+ var cx=audio;
|
|
|
165
|
+
|
|
|
166
|
+ jready();
|
|
|
167
|
+
|
|
|
168
|
+//------------测试版1.0.6.11 build 1-----------------
|
|
|
169
|
+ //-------------------下列函数来自网络-------------------
|
|
|
170
|
+ function getMousePos(event){
|
|
|
171
|
+ var xx;var e = event || window.event;var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; xx = e.pageX || e.clientX + scrollX;return xx;
|
|
|
172
|
+ }
|
|
|
173
|
+ function getElementLeft(element){
|
|
|
174
|
+ var actualLeft = element.offsetLeft;var current = element.offsetParent;while (current !== null){actualLeft += current.offsetLeft;current = current.offsetParent;}return actualLeft;
|
|
|
175
|
+ }
|
|
|
176
|
+ function GetCurrentStyle (obj, prop) {
|
|
|
177
|
+ if (obj.currentStyle) {
|
|
|
178
|
+ return obj.currentStyle[prop];
|
|
|
179
|
+ }
|
|
|
180
|
+ else if (window.getComputedStyle) {
|
|
|
181
|
+ prop=prop.replace (/([A-Z])/g, "-$1");
|
|
|
182
|
+ prop=prop.toLowerCase ();
|
|
|
183
|
+ return document.defaultView.getComputedStyle (obj,null)[prop];
|
|
|
184
|
+ }
|
|
|
185
|
+ }
|
|
|
186
|
+ function lrcread(lrc){
|
|
|
187
|
+ $.get(lrc,function (r) {
|
|
|
188
|
+ aa(r);});
|
|
|
189
|
+ function aa(t) {
|
|
|
190
|
+ if(lrc){
|
|
|
191
|
+ {
|
|
|
192
|
+ $(document).ready(function () {
|
|
|
193
|
+ lrctext=t.replace(/\n/g,"").replace(/\r/g,"");
|
|
|
194
|
+ while(lrcli!==-1){
|
|
|
195
|
+ lrcli=lrctext.indexOf("[",lrcli+1);
|
|
|
196
|
+ lrcarray.push(lrcli);
|
|
|
197
|
+ }
|
|
|
198
|
+ lrclong=lrcarray.push()-1;
|
|
|
199
|
+ x=0;xx=0;
|
|
|
200
|
+ while(x!==lrclong){
|
|
|
201
|
+ if(x===0){xx=0}else{xx=lrcarray[x];}
|
|
|
202
|
+ if (x===lrclong-1){
|
|
|
203
|
+ lrcpart[x]=lrctext.slice(xx,lrctext.length);
|
|
|
204
|
+ }else{lrcpart[x]=lrctext.slice(xx,lrcarray[x+1]);}
|
|
|
205
|
+ x++;
|
|
|
206
|
+ }
|
|
|
207
|
+ x=0;xx=0;xxx=0;
|
|
|
208
|
+
|
|
|
209
|
+ x=0;xx=0;
|
|
|
210
|
+ while(x!==lrclong){
|
|
|
211
|
+ xx=lrcpart[x].substr(1,2);
|
|
|
212
|
+ switch (xx){
|
|
|
213
|
+ case "ar":ar=lrcpart[x].slice(4,lrcpart[x].lastIndexOf("]"));infonuber++;break;
|
|
|
214
|
+ case "ti":ti=lrcpart[x].slice(4,lrcpart[x].lastIndexOf("]"));infonuber++;break;
|
|
|
215
|
+ case "al":al=lrcpart[x].slice(4,lrcpart[x].lastIndexOf("]"));infonuber++;break;
|
|
|
216
|
+ case null:infonuber++;break;
|
|
|
217
|
+ case undefined:break;
|
|
|
218
|
+ case " ":infonuber++;break;
|
|
|
219
|
+ case " ":infonuber++;break;
|
|
|
220
|
+ default:timetoupmin=xx;timetoups=String().concat(lrcpart[x].charAt(4),lrcpart[x].charAt(5));
|
|
|
221
|
+ if(lrcpart[x].charAt(6)===":"||lrcpart[x].charAt(6)==="."){timetoupms=String().concat(lrcpart[x].charAt(7),lrcpart[x].charAt(8))}
|
|
|
222
|
+ timetoupmin=parseInt(timetoupmin*60000);timetoups=parseInt(timetoups*1000);timetoupms=parseInt(timetoupms);
|
|
|
223
|
+ timetouptime[xxx]=(timetoupmin+timetoups+timetoupms);
|
|
|
224
|
+ lrcpart[x]=lrcpart[x].slice(10,lrcpart[x].length);
|
|
|
225
|
+ if (lrcpart[x].indexOf("|")>=0){
|
|
|
226
|
+ lrcpart2[x]=lrcpart[x].slice(lrcpart[x].indexOf("|")+1,lrcpart[x].length);
|
|
|
227
|
+ lrcpart[x]=lrcpart[x].slice(0,lrcpart[x].indexOf("|"));}
|
|
|
228
|
+ xxx++;
|
|
|
229
|
+ break;
|
|
|
230
|
+ }
|
|
|
231
|
+ x++;
|
|
|
232
|
+ }
|
|
|
233
|
+ if (!ar&&!ti){ar="k-audio.js";lrcbody.style.fontSize=18+"px";}else {
|
|
|
234
|
+ if (ar&&ti){ar=ar+" - "}
|
|
|
235
|
+ if (ar===undefined){ar="";}
|
|
|
236
|
+ if (ti===undefined){ti=""}
|
|
|
237
|
+ lrcbody.innerHTML=ar+ti;}
|
|
|
238
|
+ if (loadfirst){lrcbody.innerHTML=lrcbodytext;}
|
|
|
239
|
+ x=0;
|
|
|
240
|
+ lrccc=-1;
|
|
|
241
|
+ setInterval(function () {
|
|
|
242
|
+ var ct=cx.currentTime;
|
|
|
243
|
+ var $time=Math.round(ct*1000);
|
|
|
244
|
+ function checktime($$$$) {
|
|
|
245
|
+ return $$$$<$time;
|
|
|
246
|
+ }
|
|
|
247
|
+ upt=timetouptime.filter(checktime);
|
|
|
248
|
+ lrcnuber=upt.length;
|
|
|
249
|
+ if (lrcnuber>0){
|
|
|
250
|
+ if (lrccc!==lrcnuber){lrcbody.style.fontSize=9+hh/4+"px";lrccc=lrcnuber;lrcbody.innerHTML=lrcpart[lrccc+infonuber-1];
|
|
|
251
|
+ if (translation){
|
|
|
252
|
+ lrcbody2.innerHTML=lrcpart2[lrccc+infonuber-1];}}}
|
|
|
253
|
+ },1);
|
|
|
254
|
+
|
|
|
255
|
+ })}
|
|
|
256
|
+
|
|
|
257
|
+ }}
|
|
|
258
|
+}
|
|
|
259
|
+ //----------------end--------------------------
|
|
|
260
|
+
|
|
|
261
|
+ /*主函数*/
|
|
|
262
|
+
|
|
|
263
|
+
|
|
|
264
|
+ function jready() {
|
|
|
265
|
+ if(window.jQuery||$()){kacc(audio,lrc,width,height);}
|
|
|
266
|
+ else{console.warn("没有检测到jQuery服务!");}
|
|
|
267
|
+ }
|
|
|
268
|
+ function kacc(audio,lrc,width,height){
|
|
|
269
|
+
|
|
|
270
|
+ audio.id="kac"+kaplayer;
|
|
|
271
|
+ /*-------------MAIN--------------*/
|
|
|
272
|
+
|
|
|
273
|
+ $("#kac"+kaplayer).wrap(function(){
|
|
|
274
|
+ return "<div class='kc-body' id='kc-body"+kaplayer+"'></div>"
|
|
|
275
|
+ });
|
|
|
276
|
+ bloc=audio.parentNode;
|
|
|
277
|
+ kbody=bloc.appendChild(document.createElement("div"));
|
|
|
278
|
+ kbody.className="k-body";
|
|
|
279
|
+ kbody.id="ka-body"+kaplayer;
|
|
|
280
|
+ audio.controls=false;
|
|
|
281
|
+ allready();
|
|
|
282
|
+ if (cx.autoplay){
|
|
|
283
|
+ cx.play();
|
|
|
284
|
+ }
|
|
|
285
|
+ function allready() {
|
|
|
286
|
+ playready();
|
|
|
287
|
+ pauseready();
|
|
|
288
|
+ rangeready();
|
|
|
289
|
+ soundready();
|
|
|
290
|
+ infready();
|
|
|
291
|
+ lrcready();
|
|
|
292
|
+ whencx();
|
|
|
293
|
+ whenend();
|
|
|
294
|
+ whenrangeli();
|
|
|
295
|
+ whensound();
|
|
|
296
|
+ setwh(width,height);
|
|
|
297
|
+ }
|
|
|
298
|
+ function playready() {
|
|
|
299
|
+ play=kbody.appendChild(document.createElement("canvas"));
|
|
|
300
|
+ play.setAttribute("width","60");
|
|
|
301
|
+ play.setAttribute("height","60");
|
|
|
302
|
+ canvasauto(play);
|
|
|
303
|
+ var ctx=play.getContext("2d");
|
|
|
304
|
+ ctx.beginPath();
|
|
|
305
|
+ ctx.moveTo(20,15);
|
|
|
306
|
+ ctx.lineTo(20,45);
|
|
|
307
|
+ ctx.lineTo(45,30);
|
|
|
308
|
+ ctx.lineTo(20,15);
|
|
|
309
|
+ ctx.strokeStyle = "#fff";
|
|
|
310
|
+ ctx.lineWidth = 1.5;
|
|
|
311
|
+ ctx.stroke();
|
|
|
312
|
+ ctx.fillStyle = '#fff';
|
|
|
313
|
+ ctx.fill();
|
|
|
314
|
+ ctx.closePath();
|
|
|
315
|
+ canvasround(ctx);
|
|
|
316
|
+ play.className="kc-playlog";
|
|
|
317
|
+ play.addEventListener("click",function(){cx.play();$$hide("play");$$show("pause");$play=true;});
|
|
|
318
|
+ }
|
|
|
319
|
+ function pauseready() {
|
|
|
320
|
+ pause=kbody.appendChild(document.createElement("canvas"));
|
|
|
321
|
+ pause.className="kc-pauselog";
|
|
|
322
|
+ pause.setAttribute("width","60");
|
|
|
323
|
+ pause.setAttribute("height","60");
|
|
|
324
|
+ canvasauto(pause);
|
|
|
325
|
+ var ctx=pause.getContext("2d");
|
|
|
326
|
+ ctx.beginPath();
|
|
|
327
|
+ ctx.fillStyle = '#fff';
|
|
|
328
|
+ ctx.fillRect(19, 17.5, 7.5, 25);
|
|
|
329
|
+ ctx.fillRect(34, 17.5, 7.5, 25);
|
|
|
330
|
+ ctx.closePath();
|
|
|
331
|
+ canvasround(ctx);
|
|
|
332
|
+ pause.addEventListener("click",function (){cx.pause();$$hide("pause");$$show("play");$play=!1;});
|
|
|
333
|
+ $$hide("pause");
|
|
|
334
|
+ }
|
|
|
335
|
+ function rangeready() {
|
|
|
336
|
+ rangebody = kbody.appendChild(document.createElement("div"));
|
|
|
337
|
+ rangebody.className = "kc-rangebody";
|
|
|
338
|
+ rangebody.style.width=parseInt(width-height*4)+"px";
|
|
|
339
|
+ rangebody.style.left=height+"px";
|
|
|
340
|
+ rangeli = rangebody.appendChild(document.createElement("div"));
|
|
|
341
|
+ rangeli.className = "kc-rangeli";
|
|
|
342
|
+ rangeloadli = rangeli.appendChild(document.createElement("div"));
|
|
|
343
|
+ rangeloadli.className = "kc-rangeloadli";
|
|
|
344
|
+ rangep = rangeli.appendChild(document.createElement("div"));
|
|
|
345
|
+ rangep.className = "kc-rangep";
|
|
|
346
|
+ rangep.setAttribute("draggable","false");
|
|
|
347
|
+ cnt = cx.currentTime;
|
|
|
348
|
+
|
|
|
349
|
+ }
|
|
|
350
|
+ function soundready() {
|
|
|
351
|
+ soundbody=kbody.appendChild(document.createElement("div"));
|
|
|
352
|
+ soundbody.className="kc-soundbody";
|
|
|
353
|
+ soundbody.id="ka-soundbody"+kaplayer;
|
|
|
354
|
+ soundbody.style.left=(width-height)+"px";
|
|
|
355
|
+ soundbody.style.width=width-(32+hh)-(width-height*4)+"px";
|
|
|
356
|
+ soundbodyleft=soundbody.style.left;
|
|
|
357
|
+ soundicon=soundbody.appendChild(document.createElement("canvas"));
|
|
|
358
|
+ soundicon.className="kc-soundicon";
|
|
|
359
|
+ soundicon.id="ka-soundicon"+kaplayer;
|
|
|
360
|
+ soundicon.setAttribute("width","60");
|
|
|
361
|
+ soundicon.setAttribute("height","60");
|
|
|
362
|
+ canvasauto(soundicon);
|
|
|
363
|
+ var ctx=soundicon.getContext("2d");
|
|
|
364
|
+ canvasround(ctx);
|
|
|
365
|
+ ctx.beginPath();
|
|
|
366
|
+ ctx.fillStyle="#fff";
|
|
|
367
|
+ ctx.fillRect(11.5,22.5,6,15);
|
|
|
368
|
+ ctx.closePath();
|
|
|
369
|
+ ctx.beginPath();
|
|
|
370
|
+ ctx.moveTo(17.5,22.5);
|
|
|
371
|
+ ctx.lineTo(17.5,37.5);
|
|
|
372
|
+ ctx.lineTo(26.5,43.5);
|
|
|
373
|
+ ctx.lineTo(26.5,16.5);
|
|
|
374
|
+ ctx.lineTo(17.5,22.5);
|
|
|
375
|
+ ctx.strokeStyle = "#fff";
|
|
|
376
|
+ ctx.lineWidth = 1.5;
|
|
|
377
|
+ ctx.stroke();
|
|
|
378
|
+ ctx.fillStyle = '#fff';
|
|
|
379
|
+ ctx.fill();
|
|
|
380
|
+ ctx.closePath();
|
|
|
381
|
+ sound0icon=soundbody.appendChild(document.createElement("canvas"));
|
|
|
382
|
+ sound0icon.className="kc-sound0icon";
|
|
|
383
|
+ canvasauto(sound0icon);
|
|
|
384
|
+ sound1icon=soundbody.appendChild(document.createElement("canvas"));
|
|
|
385
|
+ sound1icon.className="kc-sound1icon";
|
|
|
386
|
+ canvasauto(sound1icon);
|
|
|
387
|
+ sound1icon.setAttribute("width","60");
|
|
|
388
|
+ sound1icon.setAttribute("height","60");
|
|
|
389
|
+ ctx=sound1icon.getContext("2d");
|
|
|
390
|
+ ctx.beginPath();
|
|
|
391
|
+ ctx.arc(27.2,30,6,3.14/2*3+0.5,3.14/2-0.5);
|
|
|
392
|
+ ctx.lineWidth = 3;
|
|
|
393
|
+ ctx.strokeStyle = "#fff";
|
|
|
394
|
+ ctx.stroke();
|
|
|
395
|
+ ctx.closePath();
|
|
|
396
|
+ sound2icon=soundbody.appendChild(document.createElement("canvas"));
|
|
|
397
|
+ sound2icon.className="kc-sound2icon";
|
|
|
398
|
+ canvasauto(sound2icon);
|
|
|
399
|
+ sound2icon.setAttribute("width","60");
|
|
|
400
|
+ sound2icon.setAttribute("height","60");
|
|
|
401
|
+ ctx=sound2icon.getContext("2d");
|
|
|
402
|
+ ctx.beginPath();
|
|
|
403
|
+ ctx.arc(27.2,30,6,3.14/2*3+0.5,3.14/2-0.5);
|
|
|
404
|
+ ctx.lineWidth = 3;
|
|
|
405
|
+ ctx.strokeStyle = "#fff";
|
|
|
406
|
+ ctx.stroke();
|
|
|
407
|
+ ctx.closePath();
|
|
|
408
|
+ ctx.beginPath();
|
|
|
409
|
+ ctx.arc(30,30,10,3.14/2*3+0.5,3.14/2-0.5);
|
|
|
410
|
+ ctx.lineWidth = 3;
|
|
|
411
|
+ ctx.strokeStyle = "#fff";
|
|
|
412
|
+ ctx.stroke();
|
|
|
413
|
+ ctx.closePath();
|
|
|
414
|
+ sound3icon=soundbody.appendChild(document.createElement("canvas"));
|
|
|
415
|
+ sound3icon.className="kc-sound3icon";
|
|
|
416
|
+ canvasauto(sound3icon);
|
|
|
417
|
+ sound3icon.setAttribute("width","60");
|
|
|
418
|
+ sound3icon.setAttribute("height","60");
|
|
|
419
|
+ ctx=sound3icon.getContext("2d");
|
|
|
420
|
+ ctx.beginPath();
|
|
|
421
|
+ ctx.arc(27.2,30,6,3.14/2*3+0.5,3.14/2-0.5);
|
|
|
422
|
+ ctx.lineWidth = 3;
|
|
|
423
|
+ ctx.strokeStyle = "#fff";
|
|
|
424
|
+ ctx.stroke();
|
|
|
425
|
+ ctx.closePath();
|
|
|
426
|
+ ctx.beginPath();
|
|
|
427
|
+ ctx.arc(30,30,10,3.14/2*3+0.5,3.14/2-0.5);
|
|
|
428
|
+ ctx.lineWidth = 3;
|
|
|
429
|
+ ctx.strokeStyle = "#fff";
|
|
|
430
|
+ ctx.stroke();
|
|
|
431
|
+ ctx.closePath();
|
|
|
432
|
+ ctx.beginPath();
|
|
|
433
|
+ ctx.arc(33,30,14,3.14/2*3+0.5,3.14/2-0.5);
|
|
|
434
|
+ ctx.lineWidth = 3;
|
|
|
435
|
+ ctx.strokeStyle = "#fff";
|
|
|
436
|
+ ctx.stroke();
|
|
|
437
|
+ ctx.closePath();
|
|
|
438
|
+ nosound=soundbody.appendChild(document.createElement("canvas"));
|
|
|
439
|
+ nosound.className="kc-nosoundicon";
|
|
|
440
|
+ canvasauto(nosound);
|
|
|
441
|
+ nosound.setAttribute("width","60");
|
|
|
442
|
+ nosound.setAttribute("height","60");
|
|
|
443
|
+ ctx=nosound.getContext("2d");
|
|
|
444
|
+ ctx.beginPath();
|
|
|
445
|
+ ctx.fillStyle = '#fff';
|
|
|
446
|
+ ctx.rotate(Math.PI/180*42);
|
|
|
447
|
+ ctx.fillRect(48.5,-19,5,28);
|
|
|
448
|
+ ctx.closePath();
|
|
|
449
|
+ ctx.beginPath();
|
|
|
450
|
+ ctx.fillStyle = '#fff';
|
|
|
451
|
+ ctx.rotate(Math.PI/180*97);
|
|
|
452
|
+ ctx.fillRect(-13,-63,5,28);
|
|
|
453
|
+ ctx.closePath();
|
|
|
454
|
+ soundli=soundbody.appendChild(document.createElement("div"));
|
|
|
455
|
+ soundli.className="kc-soundli";
|
|
|
456
|
+ soundli.style.width=width-(32+hh)*2-(width-height*4)-(width/60)+"px";
|
|
|
457
|
+ soundli.style.top=0.4*height+"px";
|
|
|
458
|
+ soundli.style.left=0.97*height+"px";
|
|
|
459
|
+ soundp=soundli.appendChild(document.createElement("div"));
|
|
|
460
|
+ soundp.className="kc-soundp";
|
|
|
461
|
+ soundp.style.width=(((width/70))+"px");
|
|
|
462
|
+ soundp.setAttribute("draggable","false");
|
|
|
463
|
+ soundpl=GetCurrentStyle(soundli,"width");
|
|
|
464
|
+ soundpl=parseInt(soundpl);
|
|
|
465
|
+ soundp.style.marginLeft=width-(32+hh)*2-(width-height*4)-(width/45)+"px";
|
|
|
466
|
+ $$hide("nosound");
|
|
|
467
|
+ $$hide("sound0icon");
|
|
|
468
|
+ $$hide("sound1icon");
|
|
|
469
|
+ $$hide("sound2icon");
|
|
|
470
|
+ cx.volume=1;
|
|
|
471
|
+ }
|
|
|
472
|
+ function infready() {
|
|
|
473
|
+ infbody=kbody.appendChild(document.createElement("div"));
|
|
|
474
|
+ infbody.className="kc-infbody";
|
|
|
475
|
+ infbody.innerHTML="00:00";
|
|
|
476
|
+ infbody.style.left=parseInt(width-height*3)+"px";
|
|
|
477
|
+ infbody.style.width=4+hh/9+"pc";
|
|
|
478
|
+ infbody.style.top=-(height*2.3)+hh*.6+10+"px";
|
|
|
479
|
+ infbody.style.fontSize=14+hh/3+"px"
|
|
|
480
|
+ }
|
|
|
481
|
+ function lrcready() {
|
|
|
482
|
+ lrctable=kbody.appendChild(document.createElement("table"));
|
|
|
483
|
+ lrctable.className="kc-lrctable";
|
|
|
484
|
+ lrctable.style.left=height+"px";
|
|
|
485
|
+ lrctable.style.width=(width-height*4)+"px";
|
|
|
486
|
+ lrctable.style.height=height-8+"px";
|
|
|
487
|
+ lrctable.style.fontSize=8+hh/9+"px";
|
|
|
488
|
+ lrcbody=lrctable.appendChild(document.createElement("tr")).appendChild(document.createElement("td"));
|
|
|
489
|
+ lrcbody.className="kc-lrcbody";
|
|
|
490
|
+ lrcbody.id="ka-lrcbody"+kaplayer;
|
|
|
491
|
+ lrcbody2=lrctable.appendChild(document.createElement("tr")).appendChild(document.createElement("td"));
|
|
|
492
|
+ lrcbody2.className="kc-lrcbody";
|
|
|
493
|
+ lrcbody2.id="ka-lrcbody2"+kaplayer;
|
|
|
494
|
+ lrcfilebox=lrcbody.appendChild(document.createElement("div"));
|
|
|
495
|
+ lrcfilebox.className="kc-lrcfilebox";
|
|
|
496
|
+ lrcfilebox.id="kc-lrcfilebox"+kaplayer;
|
|
|
497
|
+ lrcread(lrc);
|
|
|
498
|
+ }
|
|
|
499
|
+
|
|
|
500
|
+ function canvasround(ctx) {
|
|
|
501
|
+ ctx.beginPath();
|
|
|
502
|
+ ctx.arc(30,30,29,0,Math.PI*2);
|
|
|
503
|
+ ctx.lineWidth = 1.5;
|
|
|
504
|
+ ctx.strokeStyle = "#fff";
|
|
|
505
|
+ ctx.stroke();
|
|
|
506
|
+ ctx.closePath();
|
|
|
507
|
+ }
|
|
|
508
|
+//sub
|
|
|
509
|
+
|
|
|
510
|
+ return cx;
|
|
|
511
|
+/* end */
|
|
|
512
|
+}
|
|
|
513
|
+ function canvasauto(ee) {
|
|
|
514
|
+ ee.style.width=30+hh+"px";
|
|
|
515
|
+ ee.style.height=30+hh+"px";
|
|
|
516
|
+ ee.style.margin=1+"px";
|
|
|
517
|
+ }
|
|
|
518
|
+ function setwh(w,h) {
|
|
|
519
|
+ if(w===null||w===""||w===" "||w===undefined){w=width;}else{w=parseInt(w)}
|
|
|
520
|
+ if(h===null||h===""||h===" "||h===undefined){h=height;}else{h=parseInt(h)}
|
|
|
521
|
+ if (h*10>width){
|
|
|
522
|
+ width=w=h*10;
|
|
|
523
|
+ }if (w<h*10){
|
|
|
524
|
+ w=h*10;
|
|
|
525
|
+ }
|
|
|
526
|
+ width=w;
|
|
|
527
|
+ height=h;
|
|
|
528
|
+ hh=height-32;
|
|
|
529
|
+ bloc.style.width=w+"px";
|
|
|
530
|
+ bloc.style.height=h+"px";
|
|
|
531
|
+ canvasauto(play);
|
|
|
532
|
+ canvasauto(pause);
|
|
|
533
|
+ canvasauto(soundicon);
|
|
|
534
|
+ canvasauto(sound0icon);
|
|
|
535
|
+ canvasauto(sound1icon);
|
|
|
536
|
+ canvasauto(sound1icon);
|
|
|
537
|
+ canvasauto(sound2icon);
|
|
|
538
|
+ canvasauto(sound3icon);
|
|
|
539
|
+ canvasauto(nosound);
|
|
|
540
|
+ rangebody.style.width=parseInt(width-height*4)+"px";
|
|
|
541
|
+ rangebody.style.left=height+"px";
|
|
|
542
|
+ soundbody.style.left=(width-height)+"px";
|
|
|
543
|
+ soundbody.style.width=width-(32+hh)-(width-height*4)+"px";
|
|
|
544
|
+ soundbodyleft=soundbody.style.left;
|
|
|
545
|
+ soundli.style.width=width-(32+hh)*2-(width-height*4)-(width/60)+"px";
|
|
|
546
|
+ soundli.style.top=0.4*height+"px";
|
|
|
547
|
+ soundli.style.left=0.97*height+"px";
|
|
|
548
|
+ soundp.style.width=(((width/70))+"px");
|
|
|
549
|
+ soundp.setAttribute("draggable","false");
|
|
|
550
|
+ soundpl=GetCurrentStyle(soundli,"width");
|
|
|
551
|
+ soundpl=parseInt(soundpl);
|
|
|
552
|
+ soundp.style.marginLeft=width-(32+hh)*2-(width-height*4)-(width/45)+"px";
|
|
|
553
|
+ infbody.style.left=parseInt(width-height*3)+"px";
|
|
|
554
|
+ infbody.style.width=4+hh/9+"pc";
|
|
|
555
|
+ infbody.style.top=-(height*2.3)+hh*.6+10+"px";
|
|
|
556
|
+ infbody.style.fontSize=14+hh/3+"px";
|
|
|
557
|
+ lrctable.style.left=height+"px";
|
|
|
558
|
+ lrctable.style.width=(width-height*4)+"px";
|
|
|
559
|
+ lrctable.style.height=height-8+"px";
|
|
|
560
|
+ lrctable.style.fontSize=10+hh/9+"px";
|
|
|
561
|
+ }
|
|
|
562
|
+ function whencx() {
|
|
|
563
|
+ $(document).ready(function () {
|
|
|
564
|
+ cx.addEventListener("abort",function () {
|
|
|
565
|
+ lrcbody.innerHTML=("加载错误,浏览器已经放弃了加载!");
|
|
|
566
|
+ console.warn("加载错误,浏览器已经放弃了加载");
|
|
|
567
|
+ rangeli.style.backgroundColor="rgba(0, 0, 0, .3)";
|
|
|
568
|
+ });
|
|
|
569
|
+
|
|
|
570
|
+ cx.addEventListener("stalled",function () {
|
|
|
571
|
+ lrcbody.innerHTML=("加载失败,找不到该文件!");
|
|
|
572
|
+ console.warn("加载失败,找不到该文件");
|
|
|
573
|
+ rangeli.style.backgroundColor="rgba(0, 0, 0, .3)";
|
|
|
574
|
+ });
|
|
|
575
|
+ cx.addEventListener("error",function () {
|
|
|
576
|
+ lrcbody.innerHTML=("加载时出现错误!");
|
|
|
577
|
+ rangeli.style.backgroundColor="rgba(0, 0, 0, .3)";
|
|
|
578
|
+ console.warn("加载时出现错误")
|
|
|
579
|
+ });
|
|
|
580
|
+ });
|
|
|
581
|
+ cx.addEventListener("play",function () {
|
|
|
582
|
+ $$hide("play");$$show("pause");$play=true;
|
|
|
583
|
+ });
|
|
|
584
|
+ cx.addEventListener("emptied",function () {
|
|
|
585
|
+ lrcbody.innerHTML="k-audio.js";
|
|
|
586
|
+ });
|
|
|
587
|
+ cx.addEventListener("pause",function () {
|
|
|
588
|
+ cx.pause();$$hide("pause");$$show("play");$play=!1;
|
|
|
589
|
+ });
|
|
|
590
|
+ cx.addEventListener("volumechange",function () {
|
|
|
591
|
+ soundp.style.marginLeft=(soundpl-6+width/130)*cx.volume+"px";
|
|
|
592
|
+ });
|
|
|
593
|
+ cx.addEventListener("waiting",function () {
|
|
|
594
|
+ rangeli.style.backgroundColor="rgba(255,255,100,.2)"
|
|
|
595
|
+ });
|
|
|
596
|
+ cx.addEventListener("timeupdate", function (){
|
|
|
597
|
+ rangeli.style.backgroundColor="rgba(0,0,0,.1)";
|
|
|
598
|
+ cnt = cx.currentTime;
|
|
|
599
|
+ cat=cx.duration;
|
|
|
600
|
+ rangepl=GetCurrentStyle(rangeli,"width");
|
|
|
601
|
+ rangepl=parseInt(rangepl);
|
|
|
602
|
+ var hour=Math.floor(cnt/3600);
|
|
|
603
|
+ var min=Math.floor(cnt/60-(Math.round(cnt/3600)*60));
|
|
|
604
|
+ var second=Math.round(cnt-(Math.floor(cnt/60)*60));
|
|
|
605
|
+ if(hour===0){hour="";}else{hour=hour+":";hour.toString();if(hour.length<2){hour="0"+hour;}}
|
|
|
606
|
+ min=min.toString();second=second.toString();
|
|
|
607
|
+ if(min.length<2){min="0"+min;}
|
|
|
608
|
+ min=min+":";
|
|
|
609
|
+ if(second.length<2){second="0"+second;}
|
|
|
610
|
+ if (down===false){
|
|
|
611
|
+ infbody.innerHTML=hour+min+second;
|
|
|
612
|
+ rangep.setAttribute("style","margin-left:"+Math.round(cnt/cat*(rangepl-4))+"px;");
|
|
|
613
|
+ }
|
|
|
614
|
+ rangeloadli.style.width=(cx.buffered.end(0)/cat)*rangepl+"px";
|
|
|
615
|
+ rangeloadli.style.height=GetCurrentStyle(rangeli,"height")
|
|
|
616
|
+ });
|
|
|
617
|
+
|
|
|
618
|
+
|
|
|
619
|
+
|
|
|
620
|
+ }
|
|
|
621
|
+ function whenrangeli() {
|
|
|
622
|
+ var p;
|
|
|
623
|
+ rangeli.addEventListener("click",function () {
|
|
|
624
|
+ down=true;
|
|
|
625
|
+ });
|
|
|
626
|
+ rangeli.addEventListener("click",function () {
|
|
|
627
|
+ var mouseX=getMousePos();
|
|
|
628
|
+ var rangezb=getElementLeft(rangeli);
|
|
|
629
|
+ var rangex=mouseX-rangezb;
|
|
|
630
|
+ rangepl=GetCurrentStyle(rangeli,"width");
|
|
|
631
|
+ rangepl.toString();
|
|
|
632
|
+ rangepl.replace("px","");
|
|
|
633
|
+ rangepl=parseInt(rangepl);
|
|
|
634
|
+ p=rangex/rangepl;
|
|
|
635
|
+ cnt = cx.currentTime;
|
|
|
636
|
+ cat = cx.duration;
|
|
|
637
|
+ cx.currentTime=cat*p;
|
|
|
638
|
+ down=false;
|
|
|
639
|
+ });
|
|
|
640
|
+ rangeli.addEventListener("mouseup",function () {
|
|
|
641
|
+ down=false;
|
|
|
642
|
+ });
|
|
|
643
|
+ rangep.addEventListener("mouseout",function () {
|
|
|
644
|
+ down=false;
|
|
|
645
|
+ });
|
|
|
646
|
+ rangep.addEventListener("mousemove",function () {
|
|
|
647
|
+ if (down===true){
|
|
|
648
|
+ var mouseX=getMousePos();
|
|
|
649
|
+ var rangezb=getElementLeft(rangeli);
|
|
|
650
|
+ var rangex=mouseX-rangezb;
|
|
|
651
|
+ rangepl=GetCurrentStyle(rangeli,"width");
|
|
|
652
|
+ rangepl.toString();
|
|
|
653
|
+ rangepl.replace("px","");
|
|
|
654
|
+ rangepl=parseInt(rangepl);
|
|
|
655
|
+ p=rangex/rangepl;
|
|
|
656
|
+ rangep.setAttribute("style","margin-left:"+Math.round(p*(rangepl-4))+"px;")
|
|
|
657
|
+ }
|
|
|
658
|
+ });
|
|
|
659
|
+ }
|
|
|
660
|
+ function whensound() {
|
|
|
661
|
+ infbody.addEventListener("click",function () {
|
|
|
662
|
+ soundbody.style.left=parseInt(width*.7)+"px";
|
|
|
663
|
+ $$$show=true;
|
|
|
664
|
+ });
|
|
|
665
|
+ infbody.addEventListener("mouseout",function () {
|
|
|
666
|
+ soundbody.style.left=soundbodyleft;
|
|
|
667
|
+ $$$show=true;
|
|
|
668
|
+ });
|
|
|
669
|
+ soundbody.addEventListener("mouseover",function () {
|
|
|
670
|
+ soundbody.style.left=parseInt(width-height*4+32+hh)+"px";
|
|
|
671
|
+ $$$show=true;
|
|
|
672
|
+ });
|
|
|
673
|
+ soundbody.addEventListener("mouseout",function () {
|
|
|
674
|
+ soundbody.style.left=soundbodyleft;
|
|
|
675
|
+ $$$show=false;
|
|
|
676
|
+ });
|
|
|
677
|
+ sound0icon.addEventListener("click",function () {
|
|
|
678
|
+ if ($$$show){
|
|
|
679
|
+ $$hide("sound0icon");
|
|
|
680
|
+ $$show("nosound");
|
|
|
681
|
+ vv=0;
|
|
|
682
|
+ v=cx.volume;
|
|
|
683
|
+ cx.muted=true;
|
|
|
684
|
+ }});
|
|
|
685
|
+ sound1icon.addEventListener("click",function () {
|
|
|
686
|
+ if ($$$show) {
|
|
|
687
|
+ $$hide("sound1icon");
|
|
|
688
|
+ $$show("nosound");
|
|
|
689
|
+ vv = 1;
|
|
|
690
|
+ v = cx.volume;
|
|
|
691
|
+ cx.muted = true;
|
|
|
692
|
+ }});
|
|
|
693
|
+ sound2icon.addEventListener("click",function () {
|
|
|
694
|
+ if ($$$show) {
|
|
|
695
|
+ $$hide("sound2icon");
|
|
|
696
|
+ $$show("nosound");
|
|
|
697
|
+ vv = 2;
|
|
|
698
|
+ v = cx.volume;
|
|
|
699
|
+ cx.muted = true;
|
|
|
700
|
+ }});
|
|
|
701
|
+ sound3icon.addEventListener("click",function () {
|
|
|
702
|
+ if ($$$show) {
|
|
|
703
|
+ $$hide("sound3icon");
|
|
|
704
|
+ $$show("nosound");
|
|
|
705
|
+ vv = 3;
|
|
|
706
|
+ v = cx.volume;
|
|
|
707
|
+ cx.muted = true;
|
|
|
708
|
+ }});
|
|
|
709
|
+ nosound.addEventListener("click",function () {
|
|
|
710
|
+ if ($$$show) {
|
|
|
711
|
+ $$hide("nosound");
|
|
|
712
|
+ cx.muted = false;
|
|
|
713
|
+ switch (vv) {
|
|
|
714
|
+ case 0:
|
|
|
715
|
+ $$show("sound0icon");
|
|
|
716
|
+ break;
|
|
|
717
|
+ case 1:
|
|
|
718
|
+ $$show("sound1icon");
|
|
|
719
|
+ break;
|
|
|
720
|
+ case 2:
|
|
|
721
|
+ $$show("sound2icon");
|
|
|
722
|
+ break;
|
|
|
723
|
+ case 3:
|
|
|
724
|
+ $$show("sound3icon");
|
|
|
725
|
+ break;
|
|
|
726
|
+ }
|
|
|
727
|
+ }});
|
|
|
728
|
+ soundp.addEventListener("mousedown",function () {
|
|
|
729
|
+ down1=true;
|
|
|
730
|
+ });
|
|
|
731
|
+ soundp.addEventListener("mousemove",function () {
|
|
|
732
|
+ if(down1===true){
|
|
|
733
|
+ var mouseX=getMousePos();
|
|
|
734
|
+ var soundzb=getElementLeft(soundli);
|
|
|
735
|
+ var soundx=mouseX-soundzb;
|
|
|
736
|
+ soundpl=GetCurrentStyle(soundli,"width");
|
|
|
737
|
+ soundpl.toString();
|
|
|
738
|
+ soundpl.replace("px","");
|
|
|
739
|
+ soundpl=parseInt(soundpl);
|
|
|
740
|
+ var ppp=soundx*100/soundpl/100;
|
|
|
741
|
+ if (ppp>1||ppp<0){ppp=1;}
|
|
|
742
|
+ soundp.style.marginLeft=(soundpl-6+width/130)*ppp+"px";
|
|
|
743
|
+ }
|
|
|
744
|
+ });
|
|
|
745
|
+ soundli.addEventListener("mouseup",function () {
|
|
|
746
|
+ cx.muted=false;
|
|
|
747
|
+ });
|
|
|
748
|
+ soundp.addEventListener("mouseup",function () {
|
|
|
749
|
+ down1=false;
|
|
|
750
|
+ cx.muted=false;
|
|
|
751
|
+ });
|
|
|
752
|
+ soundp.addEventListener("mouseout",function () {
|
|
|
753
|
+ down1=false;
|
|
|
754
|
+ });
|
|
|
755
|
+ soundli.addEventListener("click",function () {
|
|
|
756
|
+ var mouseX=getMousePos();
|
|
|
757
|
+ var soundzb=getElementLeft(soundli);
|
|
|
758
|
+ var soundx=mouseX-soundzb;
|
|
|
759
|
+ soundpl=GetCurrentStyle(soundli,"width");
|
|
|
760
|
+ soundpl.toString();
|
|
|
761
|
+ soundpl.replace("px","");
|
|
|
762
|
+ soundpl=parseInt(soundpl);
|
|
|
763
|
+ var ppp=soundx*100/soundpl/100;
|
|
|
764
|
+ if (ppp>1||ppp<0){ppp=1;}
|
|
|
765
|
+ soundp.style.marginLeft=(soundpl-6+width/130)*ppp+"px";
|
|
|
766
|
+ cx.volume=ppp;
|
|
|
767
|
+ if (ppp===0){$$show("sound0icon");$$hide("sound1icon");$$hide("sound2icon");$$hide("sound3icon");$$hide("nosound");}
|
|
|
768
|
+ if (ppp>0&&ppp<=0.33){$$show("sound1icon");$$hide("sound0icon");$$hide("sound2icon");$$hide("sound3icon");$$hide("nosound");}
|
|
|
769
|
+ if (ppp>0.33&&ppp<=0.66){$$show("sound2icon");$$hide("sound0icon");$$hide("sound1icon");$$hide("sound3icon");$$hide("nosound");}
|
|
|
770
|
+ if (ppp>0.66&&ppp<=1){$$show("sound3icon");$$hide("sound0icon");$$hide("sound2icon");$$hide("sound1icon");$$hide("nosound");}
|
|
|
771
|
+ })
|
|
|
772
|
+ }
|
|
|
773
|
+
|
|
|
774
|
+ function whenend() {
|
|
|
775
|
+ cx.addEventListener("ended",function(){
|
|
|
776
|
+ $$hide("pause");
|
|
|
777
|
+ $$show("play");
|
|
|
778
|
+ $play=!1;
|
|
|
779
|
+ rangep.setAttribute("style","margin-left:"+0+"px;");
|
|
|
780
|
+ infbody.innerHTML="00:00";
|
|
|
781
|
+ lrcbody.innerHTML=ar+ti;
|
|
|
782
|
+ })
|
|
|
783
|
+ }
|
|
|
784
|
+function $$hide(a) {
|
|
|
785
|
+ eval(a+".style.display=\"none\";")
|
|
|
786
|
+ }
|
|
|
787
|
+ function $$show(a) {
|
|
|
788
|
+ eval(a+".style.display=\"block\";")
|
|
|
789
|
+ }
|
|
|
790
|
+
|
|
|
791
|
+} |