-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathvimeowrap.infobox.js
1 lines (1 loc) · 2.15 KB
/
vimeowrap.infobox.js
1
!function(e,t){vimeowrap.infobox=function(e,i){function o(e){div.innerHTML=i.template.populate(e,{truncate:function(e,t){return e.length>t&&(e=e.slice(0,t)+"..."),e},timesince:function(e){for(var t=new Date(e.replace(/-/g,"/")).getTime(),i={second:((new Date).getTime()-t)/1e3},o=["second","minute","hour","day","week","month","year"],r=[1,60,60,24,7,4.34812,12],n=1;n<o.length;n++)if(i[o[n]]=i[o[n-1]]/r[n],i[o[n-1]]<r[n])return e=Math.floor(i[o[n-1]]),e+" "+o[n-1]+(1===e?"":"s");return e=Math.floor(i[o[n-1]]),e+" "+o[n-1]+(1===e?"":"s")}})}var r={position:"bottom",size:130,template:'<a href="{{user_url}}"><img class="portrait" src="{{user_portrait_medium}}"/></a><div class="title"><a href="{{url}}" title="{{title}}">{{title|truncate:20}}</a></div><div class="byline">from <a href="{{user_url}}">{{user_name}}</a> <time datetime="{{upload_date}}">{{upload_date|timesince}} ago</time></div><p class="desc">{{description|truncate:100}}</p>',style:""};i=vimeowrap.utils.extend(r,i),this.config=i,this.setup=function(){var r="#{{id}} { box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; background-color:#F4F5F7; border:1px solid #E9EBEF; font:normal 14px helvetica,arial,sans-serif; padding:10px; overflow:hidden; }#{{id}} a { color: #{{color}}; text-decoration:none; }#{{id}} a:hover { color:#F75342; }#{{id}} .portrait { border:1px solid #E1E2E3; background-color:#fff; float:left; padding:2px; margin:0 10px 13px 0; width:52px; height:52px; }#{{id}} .title { font-size:30px; font-weight:700; }#{{id}} .byline a { color:#000; font-weight:700; }#{{id}} .byline time { color:#9DA2A8; font-size:11px; }#{{id}} .desc { clear:both; color:#71767A; font-size:16px; margin:0; }";r+=i.style;var n=t.createTextNode(r.populate({id:e.id+"_infobox",color:e.config.color})),a=t.createElement("style");a.type="text/css",vimeowrap.utils.prepend(a,t.getElementsByTagName("head")[0]),a.styleSheet?a.styleSheet.cssText=n.nodeValue:a.appendChild(n),div=t.createElement("div"),div.id=e.id+"_infobox",e.container.appendChild(div),vimeowrap.utils.css(div,{width:this.width,height:this.height,position:"absolute",left:this.x,top:this.y}),e.events.playlistItem.add(o)}}}(window,document);