1ting的歌词同步,所用到的代码

时间:2021-05-28

复制代码 代码如下:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://";
$=function(a,g){
varo=newArray();
varc=newArray();
varr;
varu;
vara=a.split(';');

vare=
"keydowns,resize,load,dblclick,click,mouseout,mouseover,
mousemove,mouseup,mousedown,inputchange,inputfocus,input
blur".split(",");
for(vari=0;i<e.length;i++){
eval(e[i]+"=function(s){eval($event
('on"+e[i].replace("input","")+"'))}")
}

after=function(t,d,s){
$after=function(){
var$n=document.createElement
(t);
if(d!=null){
$n.id=d;
}

u.insertBefore($n,null)
r=$n;
u=$n;
}
$for(s,"$after")
}

show=function(s){
$show=function(){
u.style.display!="none"?style
("display:none"):style("display:block");
}
$for(s,"$show")
}

check=function(t,s){
$check=function(){
if(t=="2"){
if(u.checked){
u.checked=
false;
}else{
u.checked=
true;
}
}else{
u.checked=t*1;
}
}
$for(s,"$check")
}

style=function(v,s){
$style=function(){
var$n=v.split(",")
for(vari=0;i<$n.length;i++){
var$m=$n[i].split
(":")
eval("u.style."+$m[0]
+"='"+$m[1]+"'");
}
}
$for(s,"$style")
}

value=function(v,s){
var$n=$this(v);
$value=function(){
u.value=$n
}
$for(s,"$value")
}

text=function(v,s){
var$n=$this(v);
$text=function(){

u.text=$n
}
$for(s,"$text")
}

innerhtml=function(v,s){
var$n=$this(v);
$innerhtml=function(){
u.innerHTML=$n
}
$for(s,"$innerhtml")
}

removechild=function(s){
$removechild=function(){

u.parentNode.removeChild(u)
}
$for(s,"$removechild")
}

$this=function(v){
if(v.indexOf("this")==0){
returneval(v.replace
("this","u"))
}
returnv;
}

$event=function(s){
var$n="u."+s+"=function(){$work
(this,s);}"
return$n;
}

$replace=function(s){

}

$for=function(s,c){
var$n="this."+c+"()";
if(s!=null){
var$m=$test(s);
for(vari=0;i<$m.length;i++){
u=$m[i];
eval($n);
}
}
else{
eval($n);
}
}

$test=function(a){
varo=newArray();$o(a.split(';'),o);
returno;
}

$format=function(s){
while(s.indexOf("'")>0){
s=s.replace("'","\"");
}
while(s.indexOf("][")>0){
s=s.replace("][","','")
}
while(s.indexOf("[")>0){
s=s.replace("[","'").replace
("]","'")
}
returns;
}

$work=function(w,s){
u=w;eval(s)
}

$id=function(s){
returndocument.getElementById(s);
}

$name=function(s){
returndocument.getElementsByName(s);
}

$tagname=function(s){
returndocument.getElementsByTagName(s);
}

$o=function(a,o,c){
$push=function(n){
for(vari=0;i<n.length;i++){
o.push(n[i]);
}
}
for(vari=0;i<a.length;i++){
if(a[i].indexOf("(")>=0){
c.push(a[i]);
}
if(a[i].indexOf("~")>0){
try{
$push(eval(a
[i].replace("#","document.getElementById('").replace("~
@","').getElementsByTagName('")+"')"));
}catch(e)
{}
}
else{
if(a[i].indexOf("#")
==0){
o.push
($id(a[i].replace("#","")));
}
if(a[i].indexOf(".")
==0){
$push
($name(a[i].replace(".","")));
}
if(a[i].indexOf("@")==0
){
$push
($tagname(a[i].replace("@","")));
}
if(a[i].indexOf("*")
==0){
$p=a
[i];
if
($p.indexOf(".")<0){

$p=$p.replace("parent","parentNode")
}
var$p
="u."+$p.replace("*","");
while
($p.indexOf("parent.")>0){

$p=$p.replace("parent.","parentNode.")
}
while
($p.indexOf("child{")>0){

$p=$p.replace("child{","childNodes[").replace("}","]")
}
o.push
(eval($p));
}
if(a[i].indexOf
("document")==0||a[i].indexOf("window")==0){
o.push
(eval(a[i]));
}
}
if(g!=null){
o.push(g);g=null
}
}
}

$o(a,o,c);

for(vari=0;i<o.length;i++){
for(varj=0;j<c.length;j++){
u=o[i];eval($format(c[j]));
}
}

if(o.length==0){
for(vari=0;i<c.length;i++){
eval($format(c[i]));
}
}

if(r!=null){
returnr;
}

if(o.length==1){
returno[0];
}
else{
returno
}

}
varlrc=$("#lrc;show()").innerHTML.split("[");
if(lrc.length>5){
vararray=newArray();
for(vari=0;i<lrc.length;i++)
{
varg=newObject();
t=lrc[i].split("]");
g.time=getTime(t[0]);
if(isNaN(g.time))
continue;
g.c=t[1];
if(g.c=="")
g.c=getNext(i);
array.push(g);
}
array.sort(function(x,y){
if(x.time>y.time)
return1;
elseif(x.time<y.time)
return-1;
else
return0;
}
);
for(vari=0;i<array.length;i++)
{
varg=array[i];
if(!g.c){
g.c="";
}
$("#list").innerHTML+="<div
id=lrc"+i+">"+g.c+"</div>";
}
vartime=setInterval("lrcList()",500);
}else{
$("#list").innerHTML=$("#lrc").innerHTML;
}
functiongetNext(i)
{
varresult="";
vari=i+1;
t=lrc[i].split("]");
if(t[1]=="")
result=getNext(i);
else
result=t[1]
returnresult;
}

functiongetTime(str)
{
vartime=0;
varta=str.split(":");
if(ta.length<2)
returntime;

if(ta[1].indexOf(".")>0){
vartb=ta[1].split(".");
time=ta[0]*60*1000+tb[0]*1000+tb[1]
*10;
}
else
time=ta[0]*60*1000+ta[1]*1000;
returntime;
}
varpreTime=0;
varnextTime=0;
varcurrIndex=0;
functionlrcList(){
vars=parent.document.getElementById
("MediaPlayer").controls.currentPosition;
s=s*1000;
if(s==0){
currIndex=0;
$("#list").scrollTop=
$("#lrc"+currIndex).offsetTop-30;
for(vari=0;i<array.length;i++){
document.getElementById
("lrc"+i).style.color='#000000';
}
return;
}
if(s>0&&currIndex<array.length-1)
{
preTime=array[currIndex].time;

nextTime=array[currIndex+1].time;

if(s>=preTime&&s<nextTime){
}
elseif(s>=nextTime)
{
document.getElementById
("lrc"+currIndex).style.color='#ccc';
currIndex++;
$("#list").scrollTop=
$("#lrc"+currIndex).offsetTop-30;
document.getElementById
("lrc"+currIndex).style.color='#ff9900';
lrcList();
}
else{
document.getElementById
("lrc"+currIndex).style.color='#000';
currIndex--;
$("#list").scrollTop=
$("#lrc"+currIndex).offsetTop-30;
document.getElementById
("lrc"+currIndex).style.color='#ff9900';
lrcList();
}
}
else
{
if(s<array[array.length-1].time){
currIndex=0;
$("#list").scrollTop=
$("#lrc"+currIndex).offsetTop-30;
for(vari=0;i<array.length;i++){
document.getElementById
("lrc"+i).style.color='#000000';
}
lrcList();
}
}
}
</script>
</BODY>
</HTML>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章