diff --git a/js/jquery.fn.gantt.js b/js/jquery.fn.gantt.js index 4629ffc..3517123 100644 --- a/js/jquery.fn.gantt.js +++ b/js/jquery.fn.gantt.js @@ -931,7 +931,7 @@ // **Progress Bar** // Return an element representing a progress of position within // the entire chart - createProgressBar: function (days, cls, desc, label, dataObj) { + createProgressBar: function (days, cls, clsh, desc, label, dataObj) { var cellWidth = tools.getCellSize(); var barMarg = tools.getProgressBarMargin() || 0; var bar = $('
' + label + '
') @@ -944,7 +944,7 @@ if (desc) { bar .mouseover(function (e) { - var hint = $('
').html(desc); + var hint = $('
').addClass(clsh).html(desc); $("body").append(hint); hint.css("left", e.pageX); hint.css("top", e.pageY); @@ -1024,6 +1024,7 @@ _bar = core.createProgressBar( dl, day.customClass ? day.customClass : "", + day.customHintClass ? day.customHintClass : "", day.desc ? day.desc : "", day.label ? day.label : "", day.dataObj ? day.dataObj : null @@ -1067,6 +1068,7 @@ _bar = core.createProgressBar( dl, day.customClass ? day.customClass : "", + day.customHintClass ? day.customHintClass : "", day.desc ? day.desc : "", day.label ? day.label : "", day.dataObj ? day.dataObj : null @@ -1107,6 +1109,7 @@ _bar = core.createProgressBar( dl, day.customClass ? day.customClass : "", + day.customHintClass ? day.customHintClass : "", day.desc ? day.desc : "", day.label ? day.label : "", day.dataObj ? day.dataObj : null @@ -1133,6 +1136,7 @@ _bar = core.createProgressBar( dl, day.customClass ? day.customClass : "", + day.customHintClass ? day.customHintClass : "", day.desc ? day.desc : "", day.label ? day.label : "", day.dataObj ? day.dataObj : null diff --git a/js/jquery.fn.gantt.min.js b/js/jquery.fn.gantt.min.js index 6964536..6a8cbad 100644 --- a/js/jquery.fn.gantt.min.js +++ b/js/jquery.fn.gantt.min.js @@ -17,4 +17,4 @@ // } // }); // -/*jshint shadow:true, laxbreak:true, jquery:true, strict:true, trailing:true */(function(a,b){"use strict",a.fn.gantt=function(c){function g(a,b){for(var c=1;;c++){var d=new Date(a);d.setHours(a.getHours()+b*c);if(d.getTime()!==a.getTime())return d}}var d="jquery.fn.gantt",e=["hours","days","weeks","months"],f={source:[],itemsPerPage:7,months:["January","February","March","April","May","June","July","August","September","October","November","December"],dow:["S","M","T","W","T","F","S"],navigate:"buttons",scale:"days",useCookie:!1,maxScale:"months",minScale:"hours",waitText:"Please wait...",onItemClick:function(a){return},onAddClick:function(a){return},onRender:function(){return},scrollToToday:!0};c&&a.extend(f,c),f.useCookie=f.useCookie&&a.isFunction(a.cookie),a.extend(a.expr[":"],{findday:function(b,c,d){var e=new Date(parseInt(d[3],10)),f=a(b).attr("id");f=f?f:"";var g=f.indexOf("-")+1,h=new Date(parseInt(f.substring(g,f.length),10));return e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),h=new Date(h.getFullYear(),h.getMonth(),h.getDate()),e.getTime()===h.getTime()}}),a.extend(a.expr[":"],{findweek:function(b,c,d){var e=new Date(parseInt(d[3],10)),f=a(b).attr("id");f=f?f:"";var g=f.indexOf("-")+1;e=e.getFullYear()+"-"+e.getDayForWeek().getWeekOfYear();var h=f.substring(g,f.length);return e===h}}),a.extend(a.expr[":"],{findmonth:function(b,c,d){var e=new Date(parseInt(d[3],10));e=e.getFullYear()+"-"+e.getMonth();var f=a(b).attr("id");f=f?f:"";var g=f.indexOf("-")+1,h=f.substring(g,f.length);return e===h}}),Date.prototype.getWeekId=function(){var a=this.getFullYear(),b=this.getDayForWeek().getWeekOfYear(),c=this.getMonth();return c===11&&b===1&&a++,"dh-"+a+"-"+b},Date.prototype.getRepDate=function(){switch(f.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),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),b=new Date(this.getFullYear(),this.getMonth(),this.getDate());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());return b.setDate(b.getDate()+(6-b.getDay())),a.getMonth()===b.getMonth()?!0: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());return b.setDate(b.getDate()+(6-b.getDay())),a.getMonth()===b.getMonth()||a.getMonth()!==b.getMonth()&&b.getDate()>=4?new Date(b.setDate(b.getDate()-3)):new Date(a.setDate(a.getDate()+3))};var h={elementFromPoint:function(){return document.compatMode==="CSS1Compat"?function(a,b){return a-=window.pageXOffset,b-=window.pageYOffset,document.elementFromPoint(a,b)}:function(b,c){return b-=a(document).scrollLeft(),c-=a(document).scrollTop(),document.elementFromPoint(b,c)}}(),create:function(b){typeof f.source!="string"?(b.data=f.source,h.init(b)):a.getJSON(f.source,function(a){b.data=a,h.init(b)})},init:function(a){a.rowsNum=a.data.length,a.pageCount=Math.ceil(a.rowsNum/f.itemsPerPage),a.rowsOnLastPage=a.rowsNum-Math.floor(a.rowsNum/f.itemsPerPage)*f.itemsPerPage,a.dateStart=i.getMinDate(a),a.dateEnd=i.getMaxDate(a),h.waitToggle(a,!0,function(){h.render(a)})},render:function(b){var c=a('
'),d=h.leftPanel(b);c.append(d);var e=h.rightPanel(b,d),g,i;c.append(e),c.append(h.navigation(b));var j=e.find(".dataPanel");b.gantt=a('
').append(c),a(b).empty().append(b.gantt),b.scrollNavigation.panelMargin=parseInt(j.css("margin-left").replace("px",""),10),b.scrollNavigation.panelMaxPos=j.width()-e.width(),b.scrollNavigation.canScroll=j.width()>e.width(),h.markNow(b),h.fillData(b,j,d);if(f.useCookie){var k=a.cookie(this.cookieKey+"ScrollPos");k&&(b.hPosition=k)}f.scrollToToday?(h.navigateTo(b,"now"),h.scrollPanel(b,0)):(b.hPosition!==0&&(b.scaleOldWidth?(g=j.width()-e.width(),i=g*b.hPosition/b.scaleOldWidth,i=i>0?0:i,j.css({"margin-left":i+"px"}),b.scrollNavigation.panelMargin=i,b.hPosition=i,b.scaleOldWidth=null):(j.css({"margin-left":b.hPosition+"px"}),b.scrollNavigation.panelMargin=b.hPosition)),h.repositionLabel(b)),j.css({height:d.height()}),h.waitToggle(b,!1),f.onRender()},leftPanel:function(b){var c=a('
').append(a('
').css("height",i.getCellSize()*b.headerRows+"px").css("width","100%")),d=[];return a.each(b.data,function(a,c){a>=b.pageNum*f.itemsPerPage&&a'),d.push(''+(c.name||"")+""),d.push("
"),c.desc&&(d.push('
'),d.push(''+c.desc+""),d.push("
")))}),c.append(d.join("")),c},dataPanel:function(c,d){var e=a('
'),g="onwheel"in c?"wheel":document.onmousewheel!==b?"mousewheel":"DOMMouseScroll";return a(c).on(g,function(a){h.wheelScroll(c,a)}),e.click(function(b){b.stopPropagation();var d,e,g=a(c).find(".fn-gantt .leftPanel"),j=a(c).find(".fn-gantt .dataPanel");switch(f.scale){case"weeks":e=i.getCellSize()*2;break;case"months":e=i.getCellSize();break;case"hours":e=i.getCellSize()*4;break;case"days":e=i.getCellSize()*3;break;default:e=i.getCellSize()*2}var k=h.elementFromPoint(b.pageX,j.offset().top+e);k.className==="fn-label"?k=a(k.parentNode):k=a(k);var l=k.attr("repdate"),m=h.elementFromPoint(g.offset().left+g.width()-10,b.pageY);m.className.indexOf("fn-label")===0?m=a(m.parentNode):m=a(m);var n=m.data().id;f.onAddClick(l,n)}),e},rightPanel:function(b,c){var d=null,e=["sn","wd","wd","wd","wd","wd","sa"],j=['
'],k=0,l=['
'],m=0,n=[],o=0,p=[],q=[],r=new Date;r=new Date(r.getFullYear(),r.getMonth(),r.getDate());switch(f.scale){case"hours":d=i.parseTimeRange(b.dateStart,b.dateEnd,b.scaleStep);var s=d[0].getFullYear(),t=d[0].getMonth(),u=d[0];for(var v=0,w=d.length;v
'+s+"
"),s=y,k=0),k++;var z=x.getMonth();z!==t&&(l.push('
'+f.months[t]+"
"),t=z,m=0),m++;var A=x.getDay(),B=u.getDay(),C=e[A];i.isHoliday(x)&&(C="holiday");if(A!==B){var D=r-u===0?"today":i.isHoliday(u.getTime())?"holiday":e[B];n.push('
'+'
'+u.getDate()+"
"),p.push('
'+'
'+f.dow[B]+"
"),u=x,o=0}o++,q.push('
'+x.getHours()+"
")}j.push('
'+s+"
"),l.push('
'+f.months[t]+"
");var C=e[u.getDay()];i.isHoliday(u)&&(C="holiday"),n.push('
'+'
'+u.getDate()+"
"),p.push('
'+'
'+f.dow[u.getDay()]+"
");var E=h.dataPanel(b,d.length*i.getCellSize());E.append(j.join("")),E.append(l.join("")),E.append(a('
').html(n.join(""))),E.append(a('
').html(p.join(""))),E.append(a('
').html(q.join("")));break;case"weeks":d=i.parseWeeksRange(b.dateStart,b.dateEnd),j=['
'],l=['
'];var s=d[0].getFullYear(),t=d[0].getMonth(),u=d[0];for(var v=0,w=d.length;v
'+s+"
"),s=x.getFullYear(),k=0),k++,x.getMonth()!==t&&(l.push('
'+f.months[t]+"
"),t=x.getMonth(),m=0),m++,n.push('
'+'
'+x.getWeekOfYear()+"
")}j.push('
'+s+"
"),l.push('
'+f.months[t]+"
");var E=h.dataPanel(b,d.length*i.getCellSize());E.append(j.join("")+l.join("")+n.join("")+p.join(""));break;case"months":d=i.parseMonthsRange(b.dateStart,b.dateEnd);var s=d[0].getFullYear(),t=d[0].getMonth(),u=d[0];for(var v=0,w=d.length;v
'+s+"
"),s=x.getFullYear(),k=0),k++,l.push('
'+(1+x.getMonth())+"
")}j.push('
'+s+"
"),l.push('
'+f.months[t]+"
");var E=h.dataPanel(b,d.length*i.getCellSize());E.append(j.join("")),E.append(l.join("")),E.append(a('
').html(n.join(""))),E.append(a('
').html(p.join("")));break;default:d=i.parseDateRange(b.dateStart,b.dateEnd);var F=g(d[0],-1),s=F.getFullYear(),t=F.getMonth(),u=F;for(var v=0,w=d.length;v
'+s+"
"),s=x.getFullYear(),k=0),k++,x.getMonth()!==t&&(l.push('
'+f.months[t]+"
"),t=x.getMonth(),m=0),m++;var B=x.getDay(),C=e[B];i.isHoliday(x)&&(C="holiday"),n.push('
'+'
'+x.getDate()+"
"),p.push('
'+'
'+f.dow[B]+"
")}j.push('
'+s+"
"),l.push('
'+f.months[t]+"
");var E=h.dataPanel(b,d.length*i.getCellSize());E.append(j.join("")),E.append(l.join("")),E.append(a('
').html(n.join(""))),E.append(a('
').html(p.join("")))}return a('
').append(E)},navigation:function(b){var c=null;return f.navigate==="scroll"?(c=a('