text: (function(g){g.fn.timeline=function(x){var y=this.data("data-oo-timeline");if(typeof timeline==="undefined"){y=g.extend({parentContainerId:"",startTime:null,endTime:null,dateFormat:"%d.%m.%y",dateLabel:"Date",status:{draft:"Draft",published:"Published",inRevision:"In revision",closed:"Closed",deleted:"Deleted"},values:[]},x);this.data("data-oo-timeline",y);i(this,y);q(this,y);C(this,y);o(this,y)}return this};var v;var c=10;var p,m,k,b;var s,A,u;var h,z,w,a;var D;var t,f;var H,F;var r=(183*24*60*60*1000);var B=false;function i(I,x){B=false;var y=jQuery("#"+x.parentContainerId);y.prepend("<div class='o_timeline_up'><a href='javascript:;' onclick=''><i class='o_icon o_icon-lg o_icon o_icon_slide_up'> </i></a></div>");y.append("<div class='o_timeline_down'><a href='javascript:;' onclick=''><i class='o_icon o_icon-lg o_icon o_icon_slide_down'> </i></a></div>")}function q(N,J){var M=jQuery("#"+J.parentContainerId);var L=M.width();N.width(L);var K=N.height();if(M.height()<500){K=500}N.height(K);H=J.values;f=J.endTime;t=J.startTime;F=J.status;s={top:10,right:60,bottom:40,left:80};A=L-s.left-s.right;u=K-s.top-s.bottom;var I=d3.timeFormat(J.dateFormat);D=function(O){return I(new Date(O))};p=d3.scaleLinear().domain([0,1]).range([0,A]);k=d3.axisBottom(p).ticks(0);var x=J.startTime==null?d3.min(H,function(O){return O.time}):J.startTime;var y=J.endTime==null?d3.max(H,function(O){return O.time}):J.endTime;m=d3.scaleLinear().domain([x,y]).range([u,0]);b=d3.axisLeft(m).ticks(5).tickFormat(D).tickSize(-A,5);v=d3.select("#"+N.attr("id")).append("svg").attr("width",A+s.left+s.right).attr("height",u+s.top+s.bottom).append("g").attr("transform","translate("+s.left+","+s.top+")");z=d3.scaleLinear().domain([0,1]).range([0,A]);w=d3.scaleLinear().domain([0,c]).range([u,0]);a=d3.scaleLinear().domain([x,y]).range([0,c]);h=d3.line().x(function(O){return z(n(O.y))}).y(function(O){return w(O.y)}).curve(d3.curveLinear)}function o(y,x){jQuery("#"+x.parentContainerId+" .o_timeline_up a").on("click",function(){E()});jQuery("#"+x.parentContainerId+" .o_timeline_down a").on("click",function(){e()})}function E(){if(B){return}B=true;f=f+r;t=t+r;j(true)}function e(){if(B){return}B=true;f=f-r;t=t-r;j(false)}function j(x){try{a.domain([t,f]);m.domain([t,f]);d();l(x)}catch(y){if(window.console){console.log(y)}}}function d(){v.select(".y").call(b)}function l(x){var y=v.selectAll(".dot").data(H,G);y.transition().duration(1000).ease(d3.easeLinear).attrTween("cx",function(I){return function(J){var L=(1-J)*r;var K=x?(I.time+L):(I.time-L);return z(n(a(K)))}}).attr("cy",function(I){return m(I.time)}).on("end",function(){B=false})}function C(L,I){v.append("g").attr("class","x axis").attr("transform","translate(0,"+u+")").call(k);v.append("g").attr("class","y axis").call(b).append("text").attr("class","label").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").attr("dx","-.71em").style("text-anchor","end").text("Date");var K=[];for(var y=0;y<(c*20);y++){K.push({y:(y==0?0:y/20)})}var x=v.append("path").data([K]).attr("d",h).attr("class","o_timeline_curve");var J=v.selectAll(".dot").data(H,G);J.enter().append("g").append("circle").attr("r",function(M){return(7+Math.floor(Math.random()*5))}).attr("id",G).attr("class",function(M){return"dot o_pf_status_"+M.status}).attr("cx",function(M){return z(n(a(M.time)))}).attr("cy",function(M){return m(M.time)});jQuery("g .dot").tooltip({html:true,container:"body",title:function(){var P=jQuery(this).attr("id");var O;for(var N=H.length;N-->0;){if(P==H[N].id){O=H[N]}}var M=F[O.status];return"<p>"+O.title+"<br>Status: "+M+"</p>"}});J.exit()}function G(x){return x.id}function n(x){return(1.5+Math.sin(x*1.1))/3}}(jQuery));