-
Notifications
You must be signed in to change notification settings - Fork 1
/
timelight-0.1.min.js
1 lines (1 loc) · 1.13 KB
/
timelight-0.1.min.js
1
window.onload=function(){function f(){ids=new Array,null!=a[Math.floor(media.currentTime*e)]&&(ids=a[Math.floor(media.currentTime*e)]),aecount=c.length;for(var f=0;f<aecount;f++)ids.indexOf(c[aecount-f-1])<0&&(document.querySelectorAll('[data-tlid="'+c[aecount-f-1]+'"]')[0].style.backgroundColor=b[c[aecount-f-1]],c.splice(aecount-f-1,1));for(var f=0;f<ids.length;f++)!c.indexOf(ids[f])>=0&&(document.querySelectorAll('[data-tlid="'+ids[f]+'"]')[0].style.backgroundColor=d,c.push(ids[f]))}var a=new Array,b=new Array,c=new Array,d="rgba(228,233,245,1.0)",e=100;for(media=document.querySelectorAll('[data-tlid="media"]')[0],media.addEventListener("timeupdate",function(){f()}),hl=document.querySelectorAll("[data-tl]"),i=0;i<hl.length;i++)for(hlArr=hl[i].dataset.tl.split("-"),start=Math.round(hlArr[0]*e),end=Math.round(hlArr[1]*e),(null==start||null==end||start>end)&&alert("error in timelight"s @tl: inconsistent values."),thisID="e"+i,hl[i].dataset.tlid=thisID,tb=window.getComputedStyle(hl[i],null).getPropertyValue("background-color"),b[thisID]=null!=tb?tb:"transparent",j=start;j<=end;j++)a[j]||(a[j]=new Array),a[j].push(thisID);console.log(b)};