Board logo

标题: 同步歌词代码学习贴 [打印本页]

作者: 呱叽村溪流    时间: 2011-11-2 02:23     标题: 同步歌词代码学习贴

<HTML xmlns:v>
<style>
v\:*{behavior:url(#default#VML)}
v\:textpath{font-family:楷体_gb2312;font-size:20px;v-text-align:left}
</style>
<body bgcolor="#000000" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div style="position: absolute; width: 47px; height: 21px; z-index: 1; left: 19px; top: 510px" id="layer1">
<font color="#FF0000"><a target="_self" href="http://bbs.photo5i.com/upload/txt/CR-dIj1etuOqx.txt">
<span style="text-decoration: none; font-weight:700">
<font color="#FFFFFF" size="2">重播</font></span></a></font></div>
<table border="0" width="1005" id="table1" height="550">
<tr>
<td align="center" width="1005" background="http://botu.bokee.com/photodata2/2008-2-14/010/754/879/13878203/13878203.jpg">
<EMBED
style="LEFT: 507; WIDTH: 290px; POSITION: absolute; TOP: 78; HEIGHT: 332px"
align=right src=http://imgfree.21cn.com/free/flash/22.swf
type=application/octet-stream ;; quality="high" wmode="transparent"></EMBED><EMBED
style="LEFT: 5; WIDTH: 859px; POSITION: absolute; TOP: 62; HEIGHT: 425px"
align=right src=http://forshine.net/flash/94.swf
type=application/octet-stream ;; quality="high" wmode="transparent"></EMBED></td>
</tr>
</table>
<p align="center">
<xmp id=xLyric style=display:none>
[ti:青花]
[ar:周传雄]
[al:蓝色土耳其]
[by:冠军音画]
[00:02.00]☆ ☆ 青 花 ☆ ☆
[00:11.00]演 唱: 周 传 雄
[00:20.00]音画制作:冠军音画
[00:28.00]
[00:29.00]三月走过 柳絮散落
[00:32.00]恋人们匆匆
[00:35.00]我的爱情 闻风不动
[00:41.00]翻阅昨日 仍有温度
[00:44.50]蒙尘的心事
[00:48.00]恍恍惚惚 已经隔世
[00:52.00]遗憾无法说 惊觉心一缩
[01:06.00]紧紧握着 青花信物
[01:10.00]信守着承诺
[01:12.50]离别总在 失意中度过
[01:19.00]记忆油膏 反复涂抹
[01:22.50]无法愈合的伤口
[01:25.50]你的回头 划伤了沉默
[01:31.00]☆ ☆ 青 花 ☆ ☆
[01:36.00]演 唱: 周 传 雄
[01:40.00]音画制作:冠军音画
[01:44.50]那夜重逢 停止漂泊
[01:48.00]你曾回来过
[01:51.00]相濡相忘 都是疼痛
[01:57.00]只因昨日 善良固执
[02:00.50]委屈着彼此
[02:04.00]打碎信物 取消来世
[02:08.00]* * * * * * * * *
[02:10.00]遗憾无法说 惊觉心一缩
[02:22.50]紧紧握着 青花信物
[02:26.00]信守着承诺
[02:28.50]离别总在 失意中度过
[02:35.00]记忆油膏 反复涂抹
[02:38.50]无法愈合的伤口
[02:41.50]你的回头 划伤了沉默
[02:46.00]☆ ☆ ☆ ☆ ☆ ☆
[02:48.00]紧紧握着 青花信物
[02:51.00]雕刻着寂寞
[02:54.00]就好像我 无主的魂魄
[03:00.00]纠缠过往 无端神伤
[03:03.50]摔碎谁也带不走
[03:06.50]你我一场 唤不醒的梦
[03:12.50]☆ ☆ 青 花 ☆ ☆
[03:17.50]演 唱: 周 传 雄
[03:26.00]音画制作:冠军音画
[03:38.00]紧紧握着 青花信物
[03:41.50]信守着承诺
[03:44.00]离别总在 失意中度过
[03:50.50]记忆油膏 反复涂抹
[03:54.00]无法愈合的伤口
[03:57.00]你的回头 划伤了沉默
[04:02.00]* * * * * * * * *
[04:03.50]紧紧握着 青花信物
[04:07.00]雕刻着寂寞
[04:09.50]就好像我 无主的魂魄
[04:16.00]纠缠过往 无端神伤
[04:19.50]摔碎谁也带不走
[04:22.50]你我一场 唤不醒的梦
[04:28.00]☆ ☆ 青 花 ☆ ☆
[04:34.00]演 唱: 周 传 雄
[04:40.00]音画制作冠军音画
[04:46.00]
[04:52.00]* * * 谢谢观赏 * * *

</xmp>
</body></html><script>
window.onerror=function(){return false}
start()
function start(){
browser_ini()
timer_ini()
emv_ini()
lrc.setData(oo("xLyric").innerHTML)
lrc.write("歌曲载入中,请耐心等待...","l")
emv.play("http://lylboy.cn/upload/music/青花.wma")
}
function emv_ini(){
var l
window.emv={}
lrc_ini()
l="<div id=bxEmv style=position:absolute;left:180;top:90;width:600;height:460>"
l+="<div style=position:absolute;left:0;top:0;width:600;height:460;></div>"
l+="<div id=bxEmvScreen style=position:absolute;overflow:hidden;left:20;top:30;width:560;height:360;>"
l+="</div>"
l+="</div>"
l+="<object classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 id=mplayer width=250 height=200 style=display:none></object>"
insHtm(document.body,l)
emv.play=function(url){oo("mplayer").FileName=url;oo("mplayer").Play()}
emv.time=function(){
var mPos=mplayer.CurrentPosition,n=lrc.i
var n1,o,len,w,per,n0,n1
n1=n<lrc.arr.length-1?lrc.arr[n+1].slice(0,"|")*1:9999
if(n1<mPos){
lrc.i++
n++
if(n==0)
lrc.write(lrc.arr[n].slice("|"),"l")
if(n<lrc.arr.length-1)
lrc.write(lrc.arr[n+1].slice("|"),n%2==1?"l":"r")
}
if(n>=0){
n0=lrc.arr[n].slice(0,"|")
n1=lrc.arr.length>n+1?lrc.arr[n+1].slice(0,"|"):4
o=oo("bxCaption_"+(n%2==0?"l":"r")+"_cover")
len=o.time!=""?o.time*1:n1-n0
per=(mPos-n0)/len
for(i=0.001;i<1;i+=0.001){
per1=lrc.getRealPos(o,i)
if(per1>=per)
break
}
o.style.width=o.width*i
}
}
timer.add("emv.time()")
}
function lrc_ini(){
window.lrc={}
lrc.wordPer=function(str,pos){
return str.slice(0,pos).replace(/[^\x00-\xff]/g," ").length/str.replace(/[^\x00-\xff]/g," ").length
}
lrc.setData=function(str){
var l,a,i,ad,n,j
str=str.replace(/\|/g,"").replace(/\r\n/g,"\n")
str=str.replace(/\[(\d\d)\\d\d)\.(\d\d)\]/g,function($0,$1,$2,$3){return ($1*60+$2*1+$3/100)+"|"})
a=str.split("\n")
lrc.arr=new Array()
for(i=0;i<a.length;i++){
ad=a.split("|")
for(j=1;j<ad.length;j++){
lrc.arr.add(ad[j-1]+"|"+ad[ad.length-1])
}
}
lrc.i=-1
sortIndex=0
sortDir=1
lrc.arr.sort(sortFoo)
}
lrc.getRealPos=function(obj,pos){
var a=obj.path,zoom=obj.zoom,pos1=pos*zoom
var a,i,ad
for(i=0;i<a.length;i++){
ad=a
if(pos<=ad[0])
continue
if(pos>ad[0]&&pos<=ad[1])
pos1+=(zoom*ad[2]-zoom)*(pos-ad[0])
else{
pos1+=(zoom*ad[2]-zoom)*(ad[1]-ad[0])
}

}
return pos1
}
lrc.write=function(str,pos){
var word=str,style=""
var x,y,l,w,w1,o,a,i,ad
if(/^\<.+\>/.test(str)){
word=str.slice(">")
style=str.slice(1).slice(0,">")
}
w=word.replace(/[^\x00-\xff]/g," ").length*13+2
if(pos=="l"){
x=40
y=285
}
else{
x=400-w
y=325
}
l="<div id=bxCaption_"+pos+" style='position:absolute;left:"+x+";top:"+y+";width:"+w+";height:32;overflow:hidden'>"
l+="<v:curve to=800,1 strokecolor=black strokeweight=3 style=position:absolute;top:14>"
l+="<v:path textpathok=t /><v:textpath on=t string='"+word+"' /></v:curve>"
l+="<v:curve to=800,1 strokecolor=white fillcolor=white strokeweight=1 style=position:absolute;top:14>"
l+="<v:path textpathok=t /><v:textpath on=t string='"+word+"' /></v:curve>"
l+="</div>"
l+="<div id=bxCaption_"+pos+"_cover width="+w+" style=position:absolute;left:"+x+";top:"+y+";width:0;height:32;overflow:hidden>"
l+="<v:curve to=800,1 strokecolor=white strokeweight=3 style=position:absolute;top:14>"
l+="<v:path textpathok=t /><v:textpath on=t string='"+word+"' /></v:curve>"
l+="<v:curve to=800,1 strokecolor=blue fillcolor=blue strokeweight=1 style=position:absolute;top:14>"
l+="<v:path textpathok=t /><v:textpath on=t string='"+word+"' /></v:curve>"
l+="</div>"
odel("bxCaption_"+pos)
odel("bxCaption_"+pos+"_cover")
insHtm("bxEmvScreen",l)
o=oo("bxCaption_"+pos+"_cover")
o.time=style.get("time")
o.path=new Array()
len1=1
a=style.split(";")
for(i=0;i<a.length;i++){
if(!/(\d+)\d+)/.test(a))
continue
if(/(\d+)-(\d+)\d+)/.test(a)){
ad=/(\d+)-(\d+)p\d+)/.exec(a)
ad[0]=lrc.wordPer(word,ad[1]-1)
ad[1]=lrc.wordPer(word,ad[2]*1)
ad[2]=ad[3]
}
else{
ad=/(\d+)p.+)/.exec(a)
ad[0]=lrc.wordPer(word,ad[1]-1)
ad[1]=lrc.wordPer(word,ad[1]*1)
}
len1+=(ad[1]-ad[0])*(ad[2]-1)
o.path.add(ad)
}
o.zoom=1/len1
}
}
function browser_ini(){
window.isIE=navigator.userAgent.indexOf("IE")>0
window.isIE5=navigator.userAgent.indexOf("IE 5.0")>0
String.prototype.trim=function(){return this.replace(/(^[\s]*)|([\s]*$)/g,"")}
String.prototype.inc=function(s1,s2){if(s2==null){s2=","};return (s2+this+s2).indexOf(s2+s1+s2)>-1?true:false}
String.prototype._slice="".slice
String.prototype.slice=function(n1,n2){var v,b1=typeof(n1)=="number",b2=typeof(n2)=="number";if(!b1||typeof(n2)=="string"){v=eval("this._slice("+(b1?n1:this.indexOf(n1)+(n2==null?1:0)+(this.indexOf(n1)==-1?this.length:0))+(n2==null?""pb2?n2pthis.indexOf(n2)==-1?"":","+this.indexOf(n2))))+")")}else{v=isIE5&&n1<0&&n2==null?this._slice(this.length-1):eval("this._slice(n1"+(n2==null?"":","+n2)+")")}return v}
String.prototype.get=function(str,def){if(this.inc(str,";"))return 1;var a=this.match(new RegExp("(^|;)"+str+":[^;]*"));return a==null||str==""?(def==null?"":def):a[0].replace(";","").slice(str.length+1)}
Array.prototype.add=function(key){this[this.length]=key}
window.oo=function(obj){return typeof(obj)=="string"?document.getElementById(obj)bj}
window.insHtm=function(op,html,inEnd){op=oo(op);if(isIE){op.insertAdjacentHTML(inEnd==null?"beforeend":"afterbegin",html)}else{var r=op.ownerDocument.createRange();r.setStartBefore(op);eval("op."+(inEnd==null?"appendChild":"insertBefore")+"(r.createContextualFragment(html),op.firstChild)");}}
window.odel=function(obj){if(oo(obj)!=null){oo(obj).parentNode.removeChild(oo(obj))}}
if(!isIE){
   HTMLElement.prototype.contains=function(node){if(!node)return false;do if(node==this){return true}while(node=node.parentNode){return false}}
Event.prototype.__defineGetter__("srcElement",function(){var node=this.target;while(node.nodeType!=1){node=node.parentNode}return node})
Event.prototype.__defineGetter__("toElement",function(){return this.relatedTarget})
}
}
function timer_ini(){
window.timer={}
timer.handle=null
timer.queue=""
timer.i=0
timer.add=function(key){if(!timer.queue.inc(key,";")){timer.queue+=key+";"}}
timer.del=function(key){timer.queue=move.queue.replace(key+";","")}
timer.inv=function(){
window.clearTimeout(timer.handle)
eval(timer.queue)
timer.i++
timer.handle=window.setTimeout("timer.inv()",10)
}
timer.inv()
}
function sortFoo(v1,v2){
   var s1=v1.split("|")[sortIndex],s2=v2.split("|")[sortIndex]
   if(!isNaN(s1)&&!isNaN(s2)){
s1*=1
s2*=1
   }
return (s1==s2?0ps1>s2?1:-1))*sortDir
}
</script></p>


作者: 呱叽村溪流    时间: 2011-11-2 02:27

1
作者: 呱叽村溪流    时间: 2011-11-2 02:27

2
作者: 独影孤踪    时间: 2011-11-2 20:06

呱叽版主的这个代码帖子怎么也打不开,只有脚本错误字样的显示。
作者: 呱叽村溪流    时间: 2011-11-3 00:41

呱叽版主的这个代码帖子怎么也打不开,只有脚本错误字样的显示独影孤踪 发表于 2011-11-2 20:06

 

因为得用你的图片,歌词,音乐等地址换下红色部分,

 

(原图片、歌词、音乐地址已失效)

 

才是完整的歌词同步音画贴代码!

 

呱叽准备学习,还没时间动手!






欢迎光临 湖南知青网论坛2011年度 (http://2011.hnzqw.com/) Powered by Discuz! 7.2