LrcShow.aspx
上传用户:whzhongbo
上传日期:2022-07-31
资源大小:1531k
文件大小:7k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="LrcShow.aspx.vb" Inherits="YDMusic.LrcShow"%>
  2. <style>
  3. #lrcollbox td , #lrcollbox font { font-family: "宋体"; font-size: 12px;}
  4. #lrcoll td  { color:#000000}
  5. #lrcbox  { color:#FF6600;font-size: 14px;font-weight: bolder; }
  6. #lrcfilter  { filter: alpha(opacity=0)                 }
  7. #lrcbc  { color:#00CC00;font-size: 14px;font-weight: bold;}
  8. #lrcwt1,#lrcwt11  { filter: alpha(opacity=100)       }
  9. #idDownload  {behavior:url(#default#download);      }
  10. A:visited  { TEXT-DECORATION: none;color: #000000;       }
  11. A:active  { COLOR: #ff0000; TEXT-DECORATION: none;       }
  12. A:link  { TEXT-DECORATION:none ; Color:#000000      }
  13. A:hover { TEXT-DECORATION: underline; Color:#74ACDC       }
  14. </style>
  15. <script language="JavaScript">
  16. function lrcClass(tt) //LRC歌词处理 类
  17. {
  18.   this.inr = []; //行
  19.   this.oTime = 0; //余补时间
  20.   this.hailang;
  21.   this.dts = -1; //当前行显示的s
  22.   this.dte = -1; //当前行显示的e
  23.   this.dlt = -1; //当前行
  24.   this.ddh; //当前行数据
  25.   this.fjh;
  26.   this.haohaiplay;
  27.   this.oceanx;
  28.   this.cnane;
  29.   this.playptr = 0;
  30. //以上几个属性是为了判断是否还在上次显示的时间范围,以减少循环次数
  31.   if(/[offset:(-?d+)]/i.test(tt)) //取offset余补时间
  32.     this.oTime = RegExp.$1/1000;
  33.   tt = tt.replace(/[:][^$n]*(n|$)/g,"$1"); //去掉注解
  34.   tt = tt.replace(/[[^[]:]*]/g,"");
  35.   tt = tt.replace(/[[^[]]*[^[]d]+[^[]]*:[^[]]*]/g,"");
  36.   tt = tt.replace(/[[^[]]*:[^[]]*[^[]d.]+[^[]]*]/g,"");
  37.   tt = tt.replace(/<[^<>]*[^<>d]+[^<>]*:[^<>]*>/g,"");
  38.   tt = tt.replace(/<[^<>]*:[^<>]*[^<>d.]+[^<>]*>/g,""); //去掉除时间标签的其它标签
  39.   while(/[[^[]]+:[^[]]+]/.test(tt))
  40.   {
  41.     tt = tt.replace(/(([[^[]]+:[^[]]+])+[^[rn]*)[^[]*/,"n");
  42.     var zzzt = RegExp.$1;
  43.     /^(.+])([^]]*)$/.exec(zzzt);
  44.     var ltxt = RegExp.$2;
  45.     var eft = RegExp.$1.slice(1,-1).split("][");
  46.     for(var ii=0; ii<eft.length; ii++)
  47.     {
  48.       var sf = eft[ii].split(":");
  49.       var tse = parseInt(sf[0],10) * 60 + parseFloat(sf[1]);
  50.       var sso = { t:[] , w:[] , n:ltxt }
  51.       sso.t[0] = tse-this.oTime;
  52.       this.inr[this.inr.length] = sso;
  53.     }
  54.   }
  55.   this.inr = this.inr.sort( function(a,b){return a.t[0]-b.t[0];} );
  56.   for(var ii=0; ii<this.inr.length; ii++)
  57.   {
  58.     while(/<[^<>]+:[^<>]+>/.test(this.inr[ii].n))
  59.     {
  60.       this.inr[ii].n = this.inr[ii].n.replace(/<(d+):([d.]+)>/,"%=%");
  61.       var tse = parseInt(RegExp.$1,10) * 60 + parseFloat(RegExp.$2);
  62.       this.inr[ii].t[this.inr[ii].t.length] = tse-this.oTime;
  63.     }
  64.     lrcbc.innerHTML = "<font>"+ this.inr[ii].n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/%=%/g,"</font><font>") +" </font>";
  65.     var fall = lrcbc.getElementsByTagName("font");
  66.     for(var wi=0; wi<fall.length; wi++)
  67.       this.inr[ii].w[this.inr[ii].w.length] = fall[wi].offsetWidth;
  68.     this.inr[ii].n = lrcbc.innerText;
  69.   }
  70.   this.print("<%# Config.WebUrl%>");
  71.   lrcwt1.innerText = "";
  72.   lrcwt2.innerText = "";
  73.   lrcwt3.innerText = "";
  74.   lrcwt4.innerText = "";
  75.   lrcwt5.innerText = "";
  76.   lrcwt6.innerText = "";
  77.   lrcwt7.innerText = "";
  78.   lrcwt8.innerText = "";
  79.   lrcwt9.innerText = "";
  80.   lrcwt10.innerText = "";
  81.   lrcwt11.innerText = "";
  82.   lrcbc.style.width = 0;
  83. }
  84. lrcClass.prototype.run = function()
  85. {
  86.   try {
  87.     if(this.oceanx==0)
  88.       this.runing(this.haohaiplay.controls.currentPosition+this.playptr, this.haohaiplay.currentMedia.duration);
  89.     else
  90.       this.runing((this.haohaiplay.GetPosition()/1000)+this.playptr, this.haohaiplay.GetLength()/1000);
  91.   } catch(hh){}
  92. }
  93. lrcClass.prototype.runing = function(tme, plen)
  94. {
  95.   if(tme<this.dts || tme>=this.dte)
  96.   {
  97.     var ii;
  98.     for(ii=this.inr.length-1; ii>=0 && this.inr[ii].t[0]>tme; ii--){}
  99.     if(ii<0) return;
  100.     this.ddh = this.inr[ii].t;
  101.     this.fjh = this.inr[ii].w;
  102.     this.dts = this.inr[ii].t[0];
  103.     this.dte = (ii<this.inr.length-1)?this.inr[ii+1].t[0]:plen;
  104.     lrcwt1.innerText = this.retxt(ii-6);
  105.     lrcwt2.innerText = this.retxt(ii-5);
  106.     lrcwt3.innerText = this.retxt(ii-4);
  107.     lrcwt4.innerText = this.retxt(ii-3);
  108.     lrcwt5.innerText = this.retxt(ii-2);
  109. lrcwt6.innerText = this.retxt(ii-1);
  110. lrcwt7.innerText = this.retxt(ii+1);
  111. lrcwt8.innerText = this.retxt(ii+2);
  112. lrcwt9.innerText = this.retxt(ii+3);
  113. lrcwt10.innerText = this.retxt(ii+4);
  114. lrcwt11.innerText = this.retxt(ii+5);
  115.     this.print(this.retxt(ii));
  116.     if(this.dlt==ii-1)
  117.     {
  118.       clearTimeout(this.hailang);
  119.       this.golrcoll(0);
  120.     }
  121.     this.dlt = ii;
  122.   }
  123.   var bbw = 0;
  124.   var ki;
  125.   for(ki=0; ki<this.ddh.length && this.ddh[ki]<=tme; ki++)
  126.     bbw += this.fjh[ki];
  127.   var kt = ki-1;
  128.   var sc = ((ki<this.ddh.length)?this.ddh[ki]:this.dte) - this.ddh[kt];
  129.   var tc = tme - this.ddh[kt];
  130.   bbw -= this.fjh[kt] - tc / sc * this.fjh[kt];
  131.   if(bbw>lrcbox.offsetWidth)
  132.     bbw = lrcbox.offsetWidth;
  133.   lrcbc.style.width = Math.round(bbw);
  134. }
  135. lrcClass.prototype.retxt = function(i)
  136. {
  137.   return (i<0 || i>=this.inr.length)?"":this.inr[i].n;
  138. }
  139. lrcClass.prototype.print = function(txt)
  140. {
  141.   lrcbox.innerText = txt;
  142.   lrcbc.innerText = txt;
  143. }
  144. lrcClass.prototype.golrcoll = function(s)
  145. {
  146.   lrcoll.style.top = 25-(s++)*5;
  147.   lrcwt1.filters.alpha.opacity = 90-s*18;
  148.   lrcwt11.filters.alpha.opacity = s*18+10;
  149.   if(s<=5)
  150.     this.hailang = setTimeout(this.cnane+".golrcoll("+s+")",120);
  151. }
  152. </script>
  153. <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  154. <download id="idDownload">
  155. <div align="center" id="lrcollbox" style="overflow:hidden; height:100%; width:100%;">
  156. <table border="0" cellspacing="0" cellpadding="0" width="100%" id="lrcoll" style="position:relative; top: 20px;">
  157. <tr><td nowrap height="20" align="center" id="lrcwt1"></td></tr>
  158. <tr><td nowrap height="20" align="center" id="lrcwt2"></td></tr>
  159. <tr><td nowrap height="20" align="center" id="lrcwt3"></td></tr>
  160. <tr><td nowrap height="20" align="center" id="lrcwt4"></td></tr>
  161. <tr><td nowrap height="20" align="center" id="lrcwt5"></td></tr>
  162. <tr><td nowrap height="20" align="center" id="lrcwt6"></td></tr>
  163. <tr>
  164. <td nowrap height="20" align="center" class="kong">
  165. <table border="0" cellspacing="0" cellpadding="0">
  166. <tr><td nowrap height="20"><span id="lrcbox" style="width:0;">歌词加载中......</span></td></tr>
  167. <tr style="position:relative; top: -20px; z-index:6;"><td nowrap height="20"><span id="lrcbc" style="overflow:hidden; width:0;"></span></td></tr>
  168. </table>
  169. </td>
  170. </tr>
  171. <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt7"></td></tr>
  172. <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt8"></td></tr>
  173. <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt9"></td></tr>
  174. <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt10"></td></tr>
  175. <tr style="position:relative; top: -20px;"><td nowrap height="20" align="center" id="lrcwt11"></td></tr>
  176. </table>
  177. </div>
  178. <script language=javascript>
  179. var lrcobj;
  180. function LrcRun(m)
  181. {
  182.   lrcobj = new lrcClass(m);
  183.   lrcobj.cnane = "lrcobj";
  184.   lrcobj.haohaiplay = parent.Player1;
  185.   lrcobj.oceanx = 0; //0使用 Media Player,1使用 Real Player
  186.   setInterval("lrcobj.run();",100);
  187. }
  188. function playertime(ACT){
  189. if (ACT=='1'){
  190. lrcobj.playptr++;
  191. }else if (ACT=='2'){
  192. lrcobj.playptr--;
  193. }else{
  194. lrcobj.playptr = 0;
  195. }
  196. }
  197. try {idDownload.startDownload("<%# WordUrl%>",LrcRun);} catch(hh){}
  198. </script>