LrcShow.aspx
资源名称:YDMusic.rar [点击查看]
上传用户:whzhongbo
上传日期:2022-07-31
资源大小:1531k
文件大小:7k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
DOS
- <%@ Page Language="vb" AutoEventWireup="false" Codebehind="LrcShow.aspx.vb" Inherits="YDMusic.LrcShow"%>
- <style>
- #lrcollbox td , #lrcollbox font { font-family: "宋体"; font-size: 12px;}
- #lrcoll td { color:#000000}
- #lrcbox { color:#FF6600;font-size: 14px;font-weight: bolder; }
- #lrcfilter { filter: alpha(opacity=0) }
- #lrcbc { color:#00CC00;font-size: 14px;font-weight: bold;}
- #lrcwt1,#lrcwt11 { filter: alpha(opacity=100) }
- #idDownload {behavior:url(#default#download); }
- A:visited { TEXT-DECORATION: none;color: #000000; }
- A:active { COLOR: #ff0000; TEXT-DECORATION: none; }
- A:link { TEXT-DECORATION:none ; Color:#000000 }
- A:hover { TEXT-DECORATION: underline; Color:#74ACDC }
- </style>
- <script language="JavaScript">
- function lrcClass(tt) //LRC歌词处理 类
- {
- this.inr = []; //行
- this.oTime = 0; //余补时间
- this.hailang;
- this.dts = -1; //当前行显示的s
- this.dte = -1; //当前行显示的e
- this.dlt = -1; //当前行
- this.ddh; //当前行数据
- this.fjh;
- this.haohaiplay;
- this.oceanx;
- this.cnane;
- this.playptr = 0;
- //以上几个属性是为了判断是否还在上次显示的时间范围,以减少循环次数
- if(/[offset:(-?d+)]/i.test(tt)) //取offset余补时间
- this.oTime = RegExp.$1/1000;
- tt = tt.replace(/[:][^$n]*(n|$)/g,"$1"); //去掉注解
- tt = tt.replace(/[[^[]:]*]/g,"");
- tt = tt.replace(/[[^[]]*[^[]d]+[^[]]*:[^[]]*]/g,"");
- tt = tt.replace(/[[^[]]*:[^[]]*[^[]d.]+[^[]]*]/g,"");
- tt = tt.replace(/<[^<>]*[^<>d]+[^<>]*:[^<>]*>/g,"");
- tt = tt.replace(/<[^<>]*:[^<>]*[^<>d.]+[^<>]*>/g,""); //去掉除时间标签的其它标签
- while(/[[^[]]+:[^[]]+]/.test(tt))
- {
- tt = tt.replace(/(([[^[]]+:[^[]]+])+[^[rn]*)[^[]*/,"n");
- var zzzt = RegExp.$1;
- /^(.+])([^]]*)$/.exec(zzzt);
- var ltxt = RegExp.$2;
- var eft = RegExp.$1.slice(1,-1).split("][");
- for(var ii=0; ii<eft.length; ii++)
- {
- var sf = eft[ii].split(":");
- var tse = parseInt(sf[0],10) * 60 + parseFloat(sf[1]);
- var sso = { t:[] , w:[] , n:ltxt }
- sso.t[0] = tse-this.oTime;
- this.inr[this.inr.length] = sso;
- }
- }
- this.inr = this.inr.sort( function(a,b){return a.t[0]-b.t[0];} );
- for(var ii=0; ii<this.inr.length; ii++)
- {
- while(/<[^<>]+:[^<>]+>/.test(this.inr[ii].n))
- {
- this.inr[ii].n = this.inr[ii].n.replace(/<(d+):([d.]+)>/,"%=%");
- var tse = parseInt(RegExp.$1,10) * 60 + parseFloat(RegExp.$2);
- this.inr[ii].t[this.inr[ii].t.length] = tse-this.oTime;
- }
- lrcbc.innerHTML = "<font>"+ this.inr[ii].n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/%=%/g,"</font><font>") +" </font>";
- var fall = lrcbc.getElementsByTagName("font");
- for(var wi=0; wi<fall.length; wi++)
- this.inr[ii].w[this.inr[ii].w.length] = fall[wi].offsetWidth;
- this.inr[ii].n = lrcbc.innerText;
- }
- this.print("<%# Config.WebUrl%>");
- lrcwt1.innerText = "";
- lrcwt2.innerText = "";
- lrcwt3.innerText = "";
- lrcwt4.innerText = "";
- lrcwt5.innerText = "";
- lrcwt6.innerText = "";
- lrcwt7.innerText = "";
- lrcwt8.innerText = "";
- lrcwt9.innerText = "";
- lrcwt10.innerText = "";
- lrcwt11.innerText = "";
- lrcbc.style.width = 0;
- }
- lrcClass.prototype.run = function()
- {
- try {
- if(this.oceanx==0)
- this.runing(this.haohaiplay.controls.currentPosition+this.playptr, this.haohaiplay.currentMedia.duration);
- else
- this.runing((this.haohaiplay.GetPosition()/1000)+this.playptr, this.haohaiplay.GetLength()/1000);
- } catch(hh){}
- }
- lrcClass.prototype.runing = function(tme, plen)
- {
- if(tme<this.dts || tme>=this.dte)
- {
- var ii;
- for(ii=this.inr.length-1; ii>=0 && this.inr[ii].t[0]>tme; ii--){}
- if(ii<0) return;
- this.ddh = this.inr[ii].t;
- this.fjh = this.inr[ii].w;
- this.dts = this.inr[ii].t[0];
- this.dte = (ii<this.inr.length-1)?this.inr[ii+1].t[0]:plen;
- lrcwt1.innerText = this.retxt(ii-6);
- lrcwt2.innerText = this.retxt(ii-5);
- lrcwt3.innerText = this.retxt(ii-4);
- lrcwt4.innerText = this.retxt(ii-3);
- lrcwt5.innerText = this.retxt(ii-2);
- lrcwt6.innerText = this.retxt(ii-1);
- lrcwt7.innerText = this.retxt(ii+1);
- lrcwt8.innerText = this.retxt(ii+2);
- lrcwt9.innerText = this.retxt(ii+3);
- lrcwt10.innerText = this.retxt(ii+4);
- lrcwt11.innerText = this.retxt(ii+5);
- this.print(this.retxt(ii));
- if(this.dlt==ii-1)
- {
- clearTimeout(this.hailang);
- this.golrcoll(0);
- }
- this.dlt = ii;
- }
- var bbw = 0;
- var ki;
- for(ki=0; ki<this.ddh.length && this.ddh[ki]<=tme; ki++)
- bbw += this.fjh[ki];
- var kt = ki-1;
- var sc = ((ki<this.ddh.length)?this.ddh[ki]:this.dte) - this.ddh[kt];
- var tc = tme - this.ddh[kt];
- bbw -= this.fjh[kt] - tc / sc * this.fjh[kt];
- if(bbw>lrcbox.offsetWidth)
- bbw = lrcbox.offsetWidth;
- lrcbc.style.width = Math.round(bbw);
- }
- lrcClass.prototype.retxt = function(i)
- {
- return (i<0 || i>=this.inr.length)?"":this.inr[i].n;
- }
- lrcClass.prototype.print = function(txt)
- {
- lrcbox.innerText = txt;
- lrcbc.innerText = txt;
- }
- lrcClass.prototype.golrcoll = function(s)
- {
- lrcoll.style.top = 25-(s++)*5;
- lrcwt1.filters.alpha.opacity = 90-s*18;
- lrcwt11.filters.alpha.opacity = s*18+10;
- if(s<=5)
- this.hailang = setTimeout(this.cnane+".golrcoll("+s+")",120);
- }
- </script>
- <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
- <download id="idDownload">
- <div align="center" id="lrcollbox" style="overflow:hidden; height:100%; width:100%;">
- <table border="0" cellspacing="0" cellpadding="0" width="100%" id="lrcoll" style="position:relative; top: 20px;">
- <tr><td nowrap height="20" align="center" id="lrcwt1"></td></tr>
- <tr><td nowrap height="20" align="center" id="lrcwt2"></td></tr>
- <tr><td nowrap height="20" align="center" id="lrcwt3"></td></tr>
- <tr><td nowrap height="20" align="center" id="lrcwt4"></td></tr>
- <tr><td nowrap height="20" align="center" id="lrcwt5"></td></tr>
- <tr><td nowrap height="20" align="center" id="lrcwt6"></td></tr>
- <tr>
- <td nowrap height="20" align="center" class="kong">
- <table border="0" cellspacing="0" cellpadding="0">
- <tr><td nowrap height="20"><span id="lrcbox" style="width:0;">歌词加载中......</span></td></tr>
- <tr style="position:relative; top: -20px; z-index:6;"><td nowrap height="20"><span id="lrcbc" style="overflow:hidden; width:0;"></span></td></tr>
- </table>
- </td>
- </tr>
- <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt7"></td></tr>
- <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt8"></td></tr>
- <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt9"></td></tr>
- <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt10"></td></tr>
- <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt11"></td></tr>
- </table>
- </div>
- <script language=javascript>
- var lrcobj;
- function LrcRun(m)
- {
- lrcobj = new lrcClass(m);
- lrcobj.cnane = "lrcobj";
- lrcobj.haohaiplay = parent.Player1;
- lrcobj.oceanx = 0; //0使用 Media Player,1使用 Real Player
- setInterval("lrcobj.run();",100);
- }
- function playertime(ACT){
- if (ACT=='1'){
- lrcobj.playptr++;
- }else if (ACT=='2'){
- lrcobj.playptr--;
- }else{
- lrcobj.playptr = 0;
- }
- }
- try {idDownload.startDownload("<%# WordUrl%>",LrcRun);} catch(hh){}
- </script>