!function(a,t,e,i){"use strict";function n(n,s){function r(){k("onInit"),o(),s.hideBlankYears===!1&&l(),f(),u(),d(),y(),m(),v(),p(),h(),c()}function o(){C.detach().sort(function(t,e){return"asc"===s.order?a(t).data("year")-a(e).data("year"):a(e).data("year")-a(t).data("year")}),x.append(C)}function c(){x.addClass("loaded");var a=x.find("."+s.className+"-timeblock.active").first().attr("data-year");k("afterLoad",[a])}function l(){var a=parseInt(C.first().attr("data-year")),t=parseInt(C.last().attr("data-year"));if("asc"===s.order)for(var e=a-s.boundaries;ea-s.boundaries?C.parent().find("[data-year="+(e-1)+"]").after('
'):C.first().before('
'));else for(var e=a+s.boundaries;e>=t-s.boundaries;e--)C.parent().find("[data-year="+e+"]").length<=0&&(e'):C.first().before('
'));C=x.children()}function f(){return x.addClass(s.className).children().wrapAll(s.wrapper).wrapAll('
')}function d(){var a=.8*x.css("padding-top").replace("px","");x.find("."+s.className+"-timeline").css("width",""+C.length*a+"px"),x.find("."+s.className+"-timeliny-timeblock").css("width",""+a+"px")}function u(){C.each(function(t){var e=a(this).html(),i=a(this).attr("data-year"),n='';a(this).addClass(""+s.className+"-timeblock").html(n)})}function m(){x.append('
')}function v(a){var t,e=x.find("."+s.className+"-vertical-line").position().left,i=x.find("."+s.className+"-timeblock.active").position().left,n=x.find("."+s.className+"-timeblock.active ."+s.className+"-dot").width()/2,r=i-e;t=r>0?"-"+(Math.abs(r)+n+1):"+"+(Math.abs(r)-n-1),x.find("."+s.className+"-timeline").animate({left:t},s.animationSpeed,function(){if("undefined"!=typeof a)if("click"===a){var t=x.find("."+s.className+"-timeblock.active").first().attr("data-year");k("afterChange",[t])}else"resize"===a&&k("afterResize")})}function y(){C.parent().find("."+s.className+"-timeblock:not(.inactive) ."+s.className+"-dot").on("click",function(t){t.preventDefault();var e=a(this).parent().parent().find("."+s.className+"-timeblock.active").attr("data-year"),i=a(this).attr("data-year");return e!=i&&(k("onLeave",[e,i]),C.removeClass("active"),a(this).closest("."+s.className+"-timeblock").addClass("active")),v("click"),!1})}function p(){function e(a,t){var e;return function(){var i=arguments,n=this;clearTimeout(e),e=setTimeout(function(){a.apply(n,i)},t)}}a(t).on("resize.timeliny",e(function(){v("resize")},350))}function h(){function i(a){o=a,l=c-o.offsetLeft}function n(a){c=e.all?t.event.clientX:a.pageX,null!==o&&(o.style.left=c-l+"px")}function r(){if(o){var t=x.find("."+s.className+"-vertical-line").offset().left,e=null,i=1e23;C.parent().find("."+s.className+"-timeblock:not(.inactive) ."+s.className+"-dot").each(function(n){var s=a(this).offset().left,r=Math.abs(s-t);r0&&t.trigger("click")}function b(a,t){return t?void(s[a]=t):s[a]}function g(){x.each(function(){var i=a(this);a(t).off("resize.timeliny"),i.find("."+s.className+"-timeblock:not(.inactive) ."+s.className+"-dot").off("click"),a(e).off("mousemove.timeliny"),a(e).off("mouseup.timeliny"),i.first().off("mousedown"),i.remove(),k("onDestroy"),i.removeData("plugin_timeliny")})}function k(a,t){s[a]!==i&&s[a].apply(w,t)}var w=n,x=a(n),C=x.children();return s=a.extend({},a.fn.timeliny.defaults,s),r(),{option:b,destroy:g,goToYear:N}}a.fn.timeliny=function(t){if(console.log(t),"string"==typeof arguments[0]){var e,s=arguments[0],r=Array.prototype.slice.call(arguments,1);return this.each(function(){if(!a.data(this,"plugin_timeliny")||"function"!=typeof a.data(this,"plugin_timeliny")[s])throw new Error("Method "+s+" does not exist on jQuery.timeliny");e=a.data(this,"plugin_timeliny")[s].apply(this,r)}),e!==i?e:this}if("object"==typeof t||!t)return this.each(function(){a.data(this,"plugin_timeliny")||a.data(this,"plugin_timeliny",new n(this,t))})},a.fn.timeliny.defaults={order:"asc",className:"timeliny",wrapper:'
',boundaries:2,animationSpeed:250,hideBlankYears:!1,onInit:function(){},onDestroy:function(){},afterLoad:function(a){},onLeave:function(a,t){},afterChange:function(a){},afterResize:function(){}}}(jQuery,window,document);