diff --git a/js/jquery.fn.gantt.min.js b/js/jquery.fn.gantt.min.js index 83ba3f4..9d79144 100644 --- a/js/jquery.fn.gantt.min.js +++ b/js/jquery.fn.gantt.min.js @@ -1 +1 @@ -(function($){"use strict";$.fn.gantt=function(options){var cookieKey="jquery.fn.gantt";var scales=["hours","days","weeks","months"];var settings={source:null,itemsPerPage:7,months:["January","February","March","April","May","June","July","August","September","October","November","December"],dow:["S","M","T","W","T","F","S"],startPos:new Date,navigate:"buttons",scale:"days",useCookie:false,maxScale:"months",minScale:"hours",waitText:"Please wait...",onItemClick:function(a){return},onAddClick:function(a){return},scrollToToday:true};$.extend($.expr[":"],{findday:function(a,b,c){var d=new Date(parseInt(c[3],10));var e=$(a).attr("id");e=e?e:"";var f=e.indexOf("-")+1;var g=new Date(parseInt(e.substring(f,e.length),10));d=new Date(d.getFullYear(),d.getMonth(),d.getDate());g=new Date(g.getFullYear(),g.getMonth(),g.getDate());return d.getTime()===g.getTime()}});$.extend($.expr[":"],{findweek:function(a,b,c){var d=new Date(parseInt(c[3],10));var e=$(a).attr("id");e=e?e:"";var f=e.indexOf("-")+1;d=d.getFullYear()+"-"+d.getDayForWeek().getWeekOfYear();var g=e.substring(f,e.length);return d===g}});$.extend($.expr[":"],{findmonth:function(a,b,c){var d=new Date(parseInt(c[3],10));d=d.getFullYear()+"-"+d.getMonth();var e=$(a).attr("id");e=e?e:"";var f=e.indexOf("-")+1;var g=e.substring(f,e.length);return d===g}});Date.prototype.getWeekId=function(){var a=this.getFullYear();var b=this.getDayForWeek().getWeekOfYear();var c=this.getMonth();if(c===11&&b===1){a++}return"dh-"+a+"-"+b};Date.prototype.genRepDate=function(){switch(settings.scale){case"hours":return this.getTime();case"weeks":return this.getDayForWeek().getTime();case"months":return(new Date(this.getFullYear(),this.getMonth(),1)).getTime();default:return this.getTime()}};Date.prototype.getDayOfYear=function(){var a=new Date(this.getFullYear(),0,0);var b=new Date(this.getFullYear(),this.getMonth(),this.getDate());return Math.ceil((b-a)/864e5)};Date.prototype.getWeekOfYear=function(){var a=new Date(this.getFullYear(),0,1);var b=new Date(this.getFullYear(),this.getMonth(),this.getDate());if(a.getDay()>3){a=new Date(b.getFullYear(),0,7-a.getDay())}var c=b.getDayOfYear()-a.getDayOfYear();return Math.ceil(c/7)};Date.prototype.getDaysInMonth=function(){return 32-(new Date(this.getFullYear(),this.getMonth(),32)).getDate()};Date.prototype.hasWeek=function(){var a=new Date(this.valueOf());a.setDate(a.getDate()-a.getDay());var b=new Date(this.valueOf());b.setDate(b.getDate()+(6-b.getDay()));if(a.getMonth()===b.getMonth()){return true}else{return a.getMonth()===this.getMonth()&&b.getDate()<4||a.getMonth()!==this.getMonth()&&b.getDate()>=4}};Date.prototype.getDayForWeek=function(){var a=new Date(this.valueOf());a.setDate(a.getDate()-a.getDay());var b=new Date(this.valueOf());b.setDate(b.getDate()+(6-b.getDay()));if(a.getMonth()===b.getMonth()||a.getMonth()!==b.getMonth()&&b.getDate()>=4){return new Date(b.setDate(b.getDate()-3))}else{return new Date(a.setDate(a.getDate()+3))}};var core={elementFromPoint:function(a,b){if($.browser.msie){a-=$(document).scrollLeft();b-=$(document).scrollTop()}else{a-=window.pageXOffset;b-=window.pageYOffset}return document.elementFromPoint(a,b)},create:function(a){if(typeof settings.source!=="string"){a.data=settings.source;core.init(a)}else{$.getJSON(settings.source,function(b){a.data=b;core.init(a)})}},init:function(a){a.rowsNum=a.data.length;a.pageCount=Math.ceil(a.rowsNum/settings.itemsPerPage);a.rowsOnLastPage=a.rowsNum-Math.floor(a.rowsNum/settings.itemsPerPage)*settings.itemsPerPage;a.dateStart=tools.getMinDate(a);a.dateEnd=tools.getMaxDate(a);core.waitToggle(a,true,function(){core.render(a)})},render:function(a){var b=$('
');var c=core.leftPanel(a);b.append(c);var d=core.rightPanel(a,c);var e,f;b.append(d);b.append(core.navigation(a));var g=d.find(".dataPanel");a.gantt=$('').append(b);$(a).html(a.gantt);a.scrollNavigation.panelMargin=parseInt(g.css("margin-left").replace("px",""),10);a.scrollNavigation.panelMaxPos=g.width()-d.width();a.scrollNavigation.canScroll=g.width()>d.width();core.markNow(a);core.fillData(a,g,c);if(settings.useCookie){var h=$.cookie(this.cookieKey+"ScrollPos");if(h){a.hPosition=h}}if(settings.scrollToToday){var i=Math.round((settings.startPos/1e3-a.dateStart/1e3)/86400)-2;if(i>0&&a.hPosition!==0){if(a.scaleOldWidth){e=g.width()-d.width();f=e*a.hPosition/a.scaleOldWidth;f=f>0?0:f;g.css({"margin-left":f+"px"});a.scrollNavigation.panelMargin=f;a.hPosition=f;a.scaleOldWidth=null}else{g.css({"margin-left":a.hPosition+"px"});a.scrollNavigation.panelMargin=a.hPosition}core.repositionLabel(a)}else{core.repositionLabel(a)}}else{if(a.hPosition!==0){if(a.scaleOldWidth){e=g.width()-d.width();f=e*a.hPosition/a.scaleOldWidth;f=f>0?0:f;g.css({"margin-left":f+"px"});a.scrollNavigation.panelMargin=f;a.hPosition=f;a.scaleOldWidth=null}else{g.css({"margin-left":a.hPosition+"px"});a.scrollNavigation.panelMargin=a.hPosition}core.repositionLabel(a)}else{core.repositionLabel(a)}}g.css({height:c.height()});core.waitToggle(a,false)},leftPanel:function(a){var b=$('').append($('').css("height",tools.getCellSize()*a.headerRows+"px").css("width","100%"));var c=[];$.each(a.data,function(b,d){if(b>=a.pageNum*settings.itemsPerPage&&b