From 44e5ee7cd04af5205f91e54bc3ded70f47012a40 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Thu, 16 Jul 2015 20:33:07 +0200 Subject: [PATCH 01/74] Copy current timesheet to new timesheet-advanced. Switch logic between generating bubbles, and rendering. Next step is to create public function that will resize the bubbles on the resize of the parent container. --- Gruntfile.js | 6 +- dist/timesheet-advanced.min.js | 1 + source/index.haml | 4 +- source/javascripts/main.js | 2 +- source/javascripts/timesheet-advanced.js | 182 +++++++++++++++++++++++ 5 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 dist/timesheet-advanced.min.js create mode 100644 source/javascripts/timesheet-advanced.js diff --git a/Gruntfile.js b/Gruntfile.js index c8d6d58..691f61e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,7 +10,8 @@ module.exports = function(grunt) { }, my_target: { files: { - 'dist/timesheet.min.js': ['source/javascripts/timesheet.js'] + 'dist/timesheet.min.js': ['source/javascripts/timesheet.js'], + 'dist/timesheet-advanced.min.js': ['source/javascripts/timesheet-advanced.js'] } } }, @@ -97,7 +98,8 @@ module.exports = function(grunt) { files: [ {expand: false, src: __dirname + '/source/javascripts/lib.js', dest: __dirname + '/gh-pages/script/lib.js'}, {expand: false, src: __dirname + '/source/javascripts/main.js', dest: __dirname + '/gh-pages/script/main.js'}, - {expand: false, src: __dirname + '/dist/timesheet.min.js', dest: __dirname + '/gh-pages/script/timesheet.min.js'}, + {expand: false, src: __dirname + '/dist/timesheet.min.js', dest: __dirname + '/gh-pages/script/timesheet.min.js'}, + {expand: false, src: __dirname + '/dist/timesheet-advanced.min.js', dest: __dirname + '/gh-pages/script/timesheet-advanced.min.js'}, {expand: false, src: __dirname + '/dist/timesheet.min.css', dest: __dirname + '/gh-pages/styles/timesheet.css'}, {expand: false, src: __dirname + '/dist/timesheet-white.min.css', dest: __dirname + '/gh-pages/styles/timesheet-white.css'}, {expand: false, src: __dirname + '/dist/timesheet.min.css.map', dest: __dirname + '/gh-pages/styles/timesheet.css.map'}, diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js new file mode 100644 index 0000000..e7bfec3 --- /dev/null +++ b/dist/timesheet-advanced.min.js @@ -0,0 +1 @@ +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
"+c+"
");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
'+html.join("")+"
"},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){for(var html=[],widthYear=this.container.querySelector(".scale section").offsetWidth,n=0;n',''+bubble.getDateLabel()+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime() this.year.max) { + this.year.max = end.getFullYear(); + } else if (beg.getFullYear() > this.year.max) { + this.year.max = beg.getFullYear(); + } + + this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); + + this.bubbles.push(this.createBubble(beg, end, this.year.min, this.year.max)); + } + }; + + /** + * Parse data string + */ + Timesheet.prototype.parseDate = function(date) { + if (date.indexOf('/') === -1) { + date = new Date(parseInt(date, 10), 0, 1); + date.hasMonth = false; + } else { + date = date.split('/'); + date = new Date(parseInt(date[1], 10), parseInt(date[0], 10)-1, 1); + date.hasMonth = true; + } + + return date; + }; + + /** + * Draw section labels + */ + Timesheet.prototype.drawSections = function() { + var html = []; + + for (var c = this.year.min; c <= this.year.max; c++) { + html.push('
    ' + c + '
    '); + } + + this.container.className = 'timesheet color-scheme-default'; + this.container.innerHTML = '
    ' + html.join('') + '
    '; + }; + + /** + * Insert data into Timesheet. + */ + Timesheet.prototype.insertData = function() { + if (this.type === 'parallel') { + this.generateMarkupParallel(); + } + else if (this.type === 'serial') { + this.generateMarkupSerial(); + } + }; + + /** + * Generate parallel markup. + */ + Timesheet.prototype.generateMarkupParallel = function() { + var html = []; + var widthYear = this.container.querySelector('.scale section').offsetWidth; + + for (var n = 0; n < this.bubbles.length; n++) { + var bubble = this.bubbles[n]; + var bubbleData = this.data[n]; + + var line = [ + '', + '' + bubble.getDateLabel() + '' + ].join(''); + + html.push('
  • ' + line + '
  • '); + } + + this.container.innerHTML += '
      ' + html.join('') + '
    '; + }; + + /** + * Generate serial markup. + */ + Timesheet.prototype.generateMarkupSerial = function() { + + }; + + /** + * Wrapper for adding bubbles. + */ + Timesheet.prototype.createBubble = function(start, end, timesheetYearMin, timesheetYearMax) { + // If end isn't defined, it means that the bubble is still active, so copy min value between current date and ending year that's set up in constructor. + if (end === null) { + var currentDate = new Date(); + var maxDate = new Date(this.year.max, 12, 31); + + if (currentDate.getTime() < maxDate.getTime()) { + end = currentDate; + } + else { + end = maxDate; + } + } + return new Bubble(start, end, timesheetYearMin, timesheetYearMax); + }; + + /** + * Timesheet Bubble. + */ + var Bubble = function(start, end, timesheetYearMin, timesheetYearMax) { + this.start = start; + this.end = end; + + this.timesheetYearMin = timesheetYearMin; + this.timesheetYearMax = timesheetYearMax; + + this.monthOffsetStart = this.getStartOffset(); + this.monthOffsetEnd = this.getEndOffset(); + this.monthsLength = this.monthOffsetEnd - this.monthOffsetStart; + }; + + /** + * Calculate starting offset for bubble (in months). + */ + Bubble.prototype.getStartOffset = function() { + return (12 * (this.start.getFullYear() - this.timesheetYearMin) + this.start.getMonth()); + }; + + /** + * Calculate ending offset for bubble (in months). + */ + Bubble.prototype.getEndOffset = function() { + return (12 * (this.end.getFullYear() - this.timesheetYearMin) + this.end.getMonth()); + }; + + /** + * Get the bubble's label + */ + Bubble.prototype.getDateLabel = function() { + return [ + (this.start.hasMonth ? this.formatMonth(this.start.getMonth() + 1) + '/' : '' ) + this.start.getFullYear(), + (this.end ? '-' + ((this.end.hasMonth ? this.formatMonth(this.end.getMonth() + 1) + '/' : '' ) + this.end.getFullYear()) : '') + ].join(''); + }; + + window.Timesheet = Timesheet; +})(); \ No newline at end of file From a4e571c54b36aa2ee73e842a5aaa2d6f00988493 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 11:54:51 +0200 Subject: [PATCH 02/74] make default one work like on original plugin. (type is parallel) --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/main.js | 2 +- source/javascripts/timesheet-advanced.js | 24 +++++++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index e7bfec3..97ad1b4 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){for(var html=[],widthYear=this.container.querySelector(".scale section").offsetWidth,n=0;n',''+bubble.getDateLabel()+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()this.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubbleData.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 15a1a3d..28a4def 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -7,7 +7,7 @@ console.log('ads'); /* jshint -W031 */ - new Timesheet('timesheet-default', 'serial', 2002, 2013, [ + new Timesheet('timesheet-default', 'parallel', 2002, 2013, [ ['2002', '09/2002', 'A freaking awesome time', 'lorem'], ['06/2002', '09/2003', 'Some great memories', 'ipsum'], ['2003', 'Had very bad luck'], diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index fc72d18..250428a 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -12,6 +12,7 @@ max: max }; this.bubbles = []; + this.widthYear = 0; // Parse function fills this.bubbles as well. this.parse(data || []); @@ -96,15 +97,16 @@ */ Timesheet.prototype.generateMarkupParallel = function() { var html = []; - var widthYear = this.container.querySelector('.scale section').offsetWidth; + this.widthYear = this.container.querySelector('.scale section').offsetWidth; for (var n = 0; n < this.bubbles.length; n++) { var bubble = this.bubbles[n]; var bubbleData = this.data[n]; var line = [ - '', - '' + bubble.getDateLabel() + '' + '', + '' + bubble.getDateLabel() + '', + '' + bubbleData.label + '' ].join(''); html.push('
  • ' + line + '
  • '); @@ -168,6 +170,22 @@ return (12 * (this.end.getFullYear() - this.timesheetYearMin) + this.end.getMonth()); }; + /** + * Format month number + */ + Bubble.prototype.formatMonth = function(num) { + num = parseInt(num, 10); + + return num >= 10 ? num : '0' + num; + }; + + /** + * Get bubble's width in pixel + */ + Bubble.prototype.getWidth = function(widthYear) { + return (widthYear/12) * this.monthsLength; + }; + /** * Get the bubble's label */ From 97f261ea4205fd52a238f64451cb0fc2b60b5dfc Mon Sep 17 00:00:00 2001 From: Jelena Date: Fri, 17 Jul 2015 13:15:17 +0200 Subject: [PATCH 03/74] sass refactored --- Gruntfile.js | 1 - dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/index.haml | 3 +- source/stylesheets/timesheet-white.sass | 101 ------------------------ source/stylesheets/timesheet.sass | 84 +++++++++----------- 6 files changed, 42 insertions(+), 151 deletions(-) delete mode 100644 source/stylesheets/timesheet-white.sass diff --git a/Gruntfile.js b/Gruntfile.js index 691f61e..e2b49e1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -30,7 +30,6 @@ module.exports = function(grunt) { }, files: { 'dist/timesheet.min.css': 'source/stylesheets/timesheet.sass', - 'dist/timesheet-white.min.css': 'source/stylesheets/timesheet-white.sass' } } }, diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index ec2eb90..7303b2e 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;height:292px;margin:0 auto}.timesheet{border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet.color-scheme-default .bubble-default{background-color:RGBA(252, 70, 74, 1)}.timesheet.color-scheme-default .bubble-lorem{background-color:RGBA(154, 202, 39, 1)}.timesheet.color-scheme-default .bubble-ipsum{background-color:RGBA(60, 182, 227, 1)}.timesheet.color-scheme-default .bubble-dolor{background-color:RGBA(244, 207, 48, 1)}.timesheet.color-scheme-default .bubble-sit{background-color:RGBA(169, 105, 202, 1)}.timesheet.color-scheme-alternative .bubble-default{background-color:#f3552e}.timesheet.color-scheme-alternative .bubble-lorem{background-color:#88c33a}.timesheet.color-scheme-alternative .bubble-ipsum{background-color:#436ae0}.timesheet.color-scheme-alternative .bubble-dolor{background-color:#f4d234}.timesheet.color-scheme-alternative .bubble-sit{background-color:#707d86}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}#timesheet-alternative{background-color:RGBA(247, 247, 247, 1);border-radius:5px}#timesheet-alternative section{color:RGBA(63, 68, 72, 1);border-left:1px dashed RGBA(63, 68, 72, 0.2)}#timesheet-alternative section:first-child{border-left:1px dashed transparent}#timesheet-alternative .date{display:none}#timesheet-alternative .bubble{margin-right:7px}#timesheet-alternative .label{padding-left:0px;color:RGBA(48, 48, 48, 1)} +.timesheet{width:720px;height:292px;margin:0 auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-orange{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .date{display:none}.timesheet.timesheet--no-date .bubble{margin-right:7px}.timesheet.timesheet--no-date .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 25084fc..faaed57 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,MAAM,CAEhB,UAAU,CACR,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAGhB,+CAAe,CACb,gBAAgB,CAAE,oB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AE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAEvC,mCAAK,CACH,OAAO,CAAE,IAAI,CAEf,qCAAO,CACL,YAAY,CAAE,GAAG,CAEnB,oCAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/index.haml b/source/index.haml index c142750..c86fd12 100644 --- a/source/index.haml +++ b/source/index.haml @@ -18,8 +18,7 @@ %link{rel: 'stylesheet', type: "text/css", href: "./styles/style.css"} %link{rel: 'stylesheet', type: "text/css", href: "./styles/timesheet.css"} - %link{rel: 'stylesheet', type: "text/css", href: "./styles/timesheet-white.css"} - + %link{rel: 'stylesheet', type: "text/css", href: "https://fonts.googleapis.com/css?family=Oxygen+Mono:400,600,800"} %link{rel: 'stylesheet', type: "text/css", href: "https://fonts.googleapis.com/css?family=Open+Sans:400,600,800"} %link{rel: 'stylesheet', type: "text/css", href: "https://fonts.googleapis.com/css?family=Signika+Negative:300,400,600,700"} diff --git a/source/stylesheets/timesheet-white.sass b/source/stylesheets/timesheet-white.sass deleted file mode 100644 index 8fff4b1..0000000 --- a/source/stylesheets/timesheet-white.sass +++ /dev/null @@ -1,101 +0,0 @@ - -.white - .timesheet - width: 720px - height: 292px - margin: 0 auto - - .timesheet - border-top: 1px solid rgba(60, 60, 60, 0.3) - background-color: rgba(251, 251, 251, 1) - position: relative - - &.color-scheme-default - .bubble-default - background-color: RGBA(252, 70, 74, 1) // red - .bubble-lorem - background-color: RGBA(154, 202, 39, 1) // green - .bubble-ipsum - background-color: RGBA(60, 182, 227, 1) // blue - .bubble-dolor - background-color: RGBA(244, 207, 48, 1) // yellow - .bubble-sit - background-color: RGBA(169, 105, 202, 1) // cyan - - &.color-scheme-alternative - .bubble-default - background-color: rgba(243, 85, 46, 1) - .bubble-lorem - background-color: rgba(136, 195, 58, 1) - .bubble-ipsum - background-color: rgba(67, 106, 224, 1) - .bubble-dolor - background-color: rgba(244, 210, 52, 1) - .bubble-sit - background-color: rgba(112, 125, 134, 1) - - - .scale - height: 100% - position: absolute - top: 0 - left: 0 - float: left - - section - float: left - width: 59px - color: rgba(50, 50, 50, 0.8) - font-family: 'Signika Negative' - font-size: 13px - line-height: 24px - font-weight: 300 - border-left: 1px dashed rgba(50, 50, 50, 0.1) - height: 100% - - .data - margin: 28px 0 0 0 - padding: 0 - text-align: left - list-style-type: none - color: rgba(250, 250, 250, 0.8) - font-family: 'Signika Negative' - font-size: 13px - overflow: hidden - - li - margin: 0 0 3px 0 - line-height: 22px - height: 21px - display: block - cursor: pointer - clear: both - position: relative - white-space: nowrap - - &:hover - .bubble - opacity: 1 - - .date - color: rgba(121, 121, 121, 1) - font-size: 14px - - .label - font-weight: lighter - font-size: 14px - padding-left: 5px - line-height: 21px - color: rgba(51, 51, 50, 1) - white-space: nowrap - - .bubble - width: 24px - height: 7px - display: block - float: left - position: relative - top: 7px - border-radius: 4px - margin: 0 10px 0 0 - opacity: 0.7 diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index ae171bf..5e15a1e 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -3,35 +3,20 @@ height: 292px margin: 0 auto -.timesheet border-top: 1px solid rgba(250, 250, 250, 0.5) background-color: rgba(51, 51, 51, 1) position: relative - &.color-scheme-default - .bubble-default - background-color: RGBA(252, 70, 74, 1) // red - .bubble-lorem - background-color: RGBA(154, 202, 39, 1) // green - .bubble-ipsum - background-color: RGBA(60, 182, 227, 1) // blue - .bubble-dolor - background-color: RGBA(244, 207, 48, 1) // yellow - .bubble-sit - background-color: RGBA(169, 105, 202, 1) // cyan - - &.color-scheme-alternative - .bubble-default - background-color: rgba(243, 85, 46, 1) - .bubble-lorem - background-color: rgba(136, 195, 58, 1) - .bubble-ipsum - background-color: rgba(67, 106, 224, 1) - .bubble-dolor - background-color: rgba(244, 210, 52, 1) - .bubble-sit - background-color: rgba(112, 125, 134, 1) - + .bubble-red + background-color: rgba(252, 70, 74, 1) + .bubble-green + background-color: rgba(154, 202, 39, 1) + .bubble-blue + background-color: rgba(60, 182, 227, 1) + .bubble-orange + background-color: rgba(244, 207, 48, 1) + .bubble-purple + background-color: rgba(169, 105, 202, 1) .scale height: 100% @@ -98,23 +83,32 @@ margin: 0 10px 0 0 opacity: 0.7 -#timesheet-alternative - background-color: RGBA(247, 247, 247, 1) - border-radius: 5px - - section - color: RGBA(63, 68, 72, 1) - border-left: 1px dashed RGBA(63, 68, 72, 0.2) - - &:first-child - border-left: 1px dashed transparent - - .date - display: none - - .bubble - margin-right: 7px - - .label - padding-left: 0px - color: RGBA(48, 48, 48, 1) + &.timesheet--white + border-top: 1px solid rgba(60, 60, 60, 0.3) + background-color: rgba(251, 251, 251, 1) + + .scale + section + color: rgba(50, 50, 50, 0.8) + border-left: 1px dashed rgba(50, 50, 50, 0.1) + .data + li + .date + color: rgba(121, 121, 121, 1) + + .label + color: rgba(51, 51, 50, 1) + + &.timesheet--no-date + section + &:first-child + border-left: 1px dashed transparent + + .date + display: none + + .bubble + margin-right: 7px + + .label + padding-left: 0px From cc752f233161a49959124d384349af44d75fae07 Mon Sep 17 00:00:00 2001 From: Jelena Date: Fri, 17 Jul 2015 13:32:34 +0200 Subject: [PATCH 04/74] classes changed, added default bubble color --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/main.js | 20 ++++++++++---------- source/javascripts/timesheet-advanced.js | 4 ++-- source/stylesheets/timesheet.sass | 8 ++++++-- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 97ad1b4..5c31cf0 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubbleData.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubbleData.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 7303b2e..aa696d7 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;height:292px;margin:0 auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-orange{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .date{display:none}.timesheet.timesheet--no-date .bubble{margin-right:7px}.timesheet.timesheet--no-date .label{padding-left:0px} +.timesheet{width:720px;height:292px;margin:0 auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .date{display:none}.timesheet.timesheet--no-date .bubble{margin-right:7px}.timesheet.timesheet--no-date .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index faaed57..d95234f 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@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CAClB,OAAO,CAAE,GAAG,CAElB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAErC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAEvC,mCAAK,CACH,OAAO,CAAE,IAAI,CAEf,qCAAO,CACL,YAAY,CAAE,GAAG,CAEnB,oCAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 28a4def..b1876d6 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -8,17 +8,17 @@ /* jshint -W031 */ new Timesheet('timesheet-default', 'parallel', 2002, 2013, [ - ['2002', '09/2002', 'A freaking awesome time', 'lorem'], - ['06/2002', '09/2003', 'Some great memories', 'ipsum'], + ['2002', '09/2002', 'A freaking awesome time', 'red'], + ['06/2002', '09/2003', 'Some great memories', 'blue'], ['2003', 'Had very bad luck'], - ['10/2003', '2006', 'At least had fun', 'dolor'], - ['02/2005', '05/2006', 'Enjoyed those times as well', 'ipsum'], - ['07/2005', '09/2005', 'Bad luck again', 'default'], - ['10/2005', '2008', 'For a long time nothing happened', 'dolor'], - ['01/2008', '05/2009', 'LOST Season #4', 'lorem'], - ['01/2009', '05/2009', 'LOST Season #4', 'sit'], - ['02/2010', '05/2010', 'LOST Season #5', 'lorem'], - ['09/2008', '06/2010', 'FRINGE #1 & #2', 'ipsum'] + ['10/2003', '2006', 'At least had fun', 'yellow'], + ['02/2005', '05/2006', 'Enjoyed those times as well', 'green'], + ['07/2005', '09/2005', 'Bad luck again', 'purple'], + ['10/2005', '2008', 'For a long time nothing happened', 'red'], + ['01/2008', '05/2009', 'LOST Season #4', 'yellow'], + ['01/2009', '05/2009', 'LOST Season #4', 'red'], + ['02/2010', '05/2010', 'LOST Season #5', 'blue'], + ['09/2008', '06/2010', 'FRINGE #1 & #2', 'blue'] ]); document.querySelector('#switch-dark').addEventListener('click', function() { diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 250428a..dc7d43b 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -76,7 +76,7 @@ html.push('
    ' + c + '
    '); } - this.container.className = 'timesheet color-scheme-default'; + this.container.className = 'timesheet'; this.container.innerHTML = '
    ' + html.join('') + '
    '; }; @@ -197,4 +197,4 @@ }; window.Timesheet = Timesheet; -})(); \ No newline at end of file +})(); diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 5e15a1e..ca67f68 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -7,13 +7,15 @@ background-color: rgba(51, 51, 51, 1) position: relative + .bubble-default + background-color: white .bubble-red background-color: rgba(252, 70, 74, 1) .bubble-green background-color: rgba(154, 202, 39, 1) .bubble-blue background-color: rgba(60, 182, 227, 1) - .bubble-orange + .bubble-yellow background-color: rgba(244, 207, 48, 1) .bubble-purple background-color: rgba(169, 105, 202, 1) @@ -86,7 +88,9 @@ &.timesheet--white border-top: 1px solid rgba(60, 60, 60, 0.3) background-color: rgba(251, 251, 251, 1) - + + .bubble-default + background-color: rgba(20, 20, 20, 1) .scale section color: rgba(50, 50, 50, 0.8) From 6f5fdb756888e4c88bc25297619c340ca328310b Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 14:58:24 +0200 Subject: [PATCH 05/74] serial render js --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/main.js | 2 +- source/javascripts/timesheet-advanced.js | 119 ++++++++++++++++++++--- 3 files changed, 107 insertions(+), 16 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 97ad1b4..f78888a 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubbleData.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubble.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'',''+currentBubble.label+"","",""),html.push(line.join(""));html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 28a4def..15a1a3d 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -7,7 +7,7 @@ console.log('ads'); /* jshint -W031 */ - new Timesheet('timesheet-default', 'parallel', 2002, 2013, [ + new Timesheet('timesheet-default', 'serial', 2002, 2013, [ ['2002', '09/2002', 'A freaking awesome time', 'lorem'], ['06/2002', '09/2003', 'Some great memories', 'ipsum'], ['2003', 'Had very bad luck'], diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 250428a..3c37903 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -1,6 +1,8 @@ (function() { 'use strict'; + /* jshint onevar: false */ + /** * Initialize Timesheet object. */ @@ -46,7 +48,15 @@ this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); - this.bubbles.push(this.createBubble(beg, end, this.year.min, this.year.max)); + this.bubbles.push(this.createBubble({ + start: beg, + end: end, + type: bubbleType, + label: label, + timesheetYearMin: this.year.min, + timesheetYearMax: this.year.max + }) + ); } }; @@ -101,12 +111,11 @@ for (var n = 0; n < this.bubbles.length; n++) { var bubble = this.bubbles[n]; - var bubbleData = this.data[n]; var line = [ - '', + '', '' + bubble.getDateLabel() + '', - '' + bubbleData.label + '' + '' + bubble.label + '' ].join(''); html.push('
  • ' + line + '
  • '); @@ -119,41 +128,123 @@ * Generate serial markup. */ Timesheet.prototype.generateMarkupSerial = function() { + var html = []; + var i, j, currentList, currentBubble; + this.widthYear = this.container.querySelector('.scale section').offsetWidth; + + var lists = this.buildSerialBubbleLists(); + + html.push('
      '); + // Lists loop, for rendering markup. + for (i = 0; i < lists.length; i++) { + currentList = lists[i]; + if (currentList.bubbles.length) { + html.push('
    • '); + html.push('
        '); + var line = []; + for (j = 0; j < currentList.bubbles.length; j++) { + currentBubble = currentList.bubbles[j]; + console.log(currentBubble); + line.push( + '
      • ', + '', + '' + currentBubble.label + '', + '', + '
      • ' + ); + + html.push(line.join('')); + } + html.push('
      '); + html.push('
    • '); + } + } + html.push('
    '); + this.container.innerHTML += html.join(''); + }; + + /** + * Helper function for building bubble lists on serial timesheet view. + */ + Timesheet.prototype.buildSerialBubbleLists = function() { + var i, j; + var list; + var bubble; + + // One list element is a single row of bubbles. + var lists = [ + { + monthOffsetEnd: 0, + bubbles: [] + } + ]; + + // Bubbles loop. + for (i = 0; i < this.bubbles.length; i++) { + bubble = this.bubbles[i]; + + // Lists loop + for (j = 0; j < lists.length; j++) { + list = lists[j]; + // Check if is first element in loop (monthOffsetEnd is 0) or if bubble starts at least 1 month after list ends. + if (!list.monthOffsetEnd || list.monthOffsetEnd + 1 <= bubble.monthOffsetStart) { + lists[j].bubbles.push(bubble); + lists[j].monthOffsetEnd = bubble.monthOffsetEnd; + break; + } + + // If it's the last iteration and we haven't found a list to which we can add bubble, create a new list. + if (j === lists.length - 1) { + lists[j + 1] = { + monthOffsetEnd: bubble.monthOffsetEnd, + bubbles: [ + bubble + ] + }; + break; + } + } + } + + return lists; }; /** * Wrapper for adding bubbles. */ - Timesheet.prototype.createBubble = function(start, end, timesheetYearMin, timesheetYearMax) { + Timesheet.prototype.createBubble = function(options) { // If end isn't defined, it means that the bubble is still active, so copy min value between current date and ending year that's set up in constructor. - if (end === null) { + if (options.end === null) { var currentDate = new Date(); var maxDate = new Date(this.year.max, 12, 31); if (currentDate.getTime() < maxDate.getTime()) { - end = currentDate; + options.end = currentDate; } else { - end = maxDate; + options.end = maxDate; } } - return new Bubble(start, end, timesheetYearMin, timesheetYearMax); + return new Bubble(options); }; /** * Timesheet Bubble. */ - var Bubble = function(start, end, timesheetYearMin, timesheetYearMax) { - this.start = start; - this.end = end; + var Bubble = function(options) { + this.start = options.start; + this.end = options.end; - this.timesheetYearMin = timesheetYearMin; - this.timesheetYearMax = timesheetYearMax; + this.timesheetYearMin = options.timesheetYearMin; + this.timesheetYearMax = options.timesheetYearMax; this.monthOffsetStart = this.getStartOffset(); this.monthOffsetEnd = this.getEndOffset(); this.monthsLength = this.monthOffsetEnd - this.monthOffsetStart; + + this.type = options.type; + this.label = options.label; }; /** From b1f3e33770a682ac74938c3f9f556ec322ab934c Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 15:00:53 +0200 Subject: [PATCH 06/74] default serial view --- source/javascripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/javascripts/main.js b/source/javascripts/main.js index b1876d6..206ca97 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -7,7 +7,7 @@ console.log('ads'); /* jshint -W031 */ - new Timesheet('timesheet-default', 'parallel', 2002, 2013, [ + new Timesheet('timesheet-default', 'serial', 2002, 2013, [ ['2002', '09/2002', 'A freaking awesome time', 'red'], ['06/2002', '09/2003', 'Some great memories', 'blue'], ['2003', 'Had very bad luck'], From 4fd1052b9454828c0690db03183080a36172dec0 Mon Sep 17 00:00:00 2001 From: Jelena Date: Fri, 17 Jul 2015 15:09:38 +0200 Subject: [PATCH 07/74] Bubble constructor changed - 5 parameters required, some of them can be emty; Added parameter "link"; --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/main.js | 26 +++++----- source/javascripts/timesheet-advanced.js | 63 +++++++++++++++--------- source/stylesheets/timesheet.sass | 31 ++++++------ 6 files changed, 70 insertions(+), 56 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 5c31cf0..e877f19 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubbleData.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble(beg,end,this.year.min,this.year.max,link))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n'+(""!==bubble.link?'>>':"")+''+bubble.getDateLabel()+"",''+bubbleData.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){},Timesheet.prototype.createBubble=function(start,end,timesheetYearMin,timesheetYearMax,link){if(null===end){var currentDate=new Date,maxDate=new Date(this.year.max,12,31);end=currentDate.getTime()=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index aa696d7..c42360a 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;height:292px;margin:0 auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .date{display:none}.timesheet.timesheet--no-date .bubble{margin-right:7px}.timesheet.timesheet--no-date .label{padding-left:0px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index d95234f..a1c6eeb 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,MAAM,CAEd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,KAAK,CAAE,IAAI,CACX,KAAK,CAAE,IAAI,CACX,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEhB,gBAAK,CACH,MAAM,CAAE,UAAU,CAClB,OAAO,CAAE,CAAC,CACV,UAAU,CAAE,IAAI,CAChB,eAAe,CAAE,IAAI,CACrB,KAAK,CAAE,qBAAwB,CAC/B,W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S,CAAE,IAAI,CACf,YAAY,CAAE,GAAG,CACjB,WAAW,CAAE,IAAI,CACjB,KAAK,CAAE,OAAsB,CAC7B,WAAW,CAAE,MAAM,CAErB,2BAAO,CACL,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,GAAG,CACX,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,GAAG,CACR,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,GAAG,CAElB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAErC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/main.js b/source/javascripts/main.js index b1876d6..89b60b3 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -4,21 +4,21 @@ 'use strict'; Lib.ready(function() { - console.log('ads'); - /* jshint -W031 */ new Timesheet('timesheet-default', 'parallel', 2002, 2013, [ - ['2002', '09/2002', 'A freaking awesome time', 'red'], - ['06/2002', '09/2003', 'Some great memories', 'blue'], - ['2003', 'Had very bad luck'], - ['10/2003', '2006', 'At least had fun', 'yellow'], - ['02/2005', '05/2006', 'Enjoyed those times as well', 'green'], - ['07/2005', '09/2005', 'Bad luck again', 'purple'], - ['10/2005', '2008', 'For a long time nothing happened', 'red'], - ['01/2008', '05/2009', 'LOST Season #4', 'yellow'], - ['01/2009', '05/2009', 'LOST Season #4', 'red'], - ['02/2010', '05/2010', 'LOST Season #5', 'blue'], - ['09/2008', '06/2010', 'FRINGE #1 & #2', 'blue'] + // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] + // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory + ['2002', '09/2002', 'A freaking awesome time', 'red', ''], + ['06/2002', '09/2003', 'Some great memories', 'blue', ''], + ['2003', '', 'Had very bad luck', '', ''], + ['10/2003', '2006', 'At least had fun', 'yellow', ''], + ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], + ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], + ['10/2005', '2008', 'For a long time nothing happened', 'red', 'www.google.com'], + ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], + ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], + ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], + ['09/2008', '06/2010', 'FRINGE #1 & #2', 'blue', ''] ]); document.querySelector('#switch-dark').addEventListener('click', function() { diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index dc7d43b..d73d572 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -28,25 +28,35 @@ * Parse timesheet data. */ Timesheet.prototype.parse = function(data) { - for (var n = 0; n < data.length; n++) { - var beg = this.parseDate(data[n][0]); - var end = data[n].length === 4 ? this.parseDate(data[n][1]) : null; - var label = data[n].length === 4 ? data[n][2] : data[n][1]; - var bubbleType = data[n].length === 4 ? data[n][3] : data[n].length === 3 ? data[n][2] : 'default'; - - if (beg.getFullYear() < this.year.min) { - this.year.min = beg.getFullYear(); + try { + for (var n = 0; n < data.length; n++) { + if (data[n].length !== 5) { + throw 'Not enough input parameters for bubble ' + (n + 1); + } + var beg = this.parseDate(data[n][0]); + var end = (data[n][1] !== '' ? this.parseDate(data[n][1]) : null); + var label = data[n][2]; + var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); + var link = (data[n][4] !== '' ? data[n][4] : ''); + + if (beg.getFullYear() < this.year.min) { + this.year.min = beg.getFullYear(); + } + + if (end && end.getFullYear() > this.year.max) { + this.year.max = end.getFullYear(); + } + else if (beg.getFullYear() > this.year.max) { + this.year.max = beg.getFullYear(); + } + + this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); + + this.bubbles.push(this.createBubble(beg, end, this.year.min, this.year.max, link)); } - - if (end && end.getFullYear() > this.year.max) { - this.year.max = end.getFullYear(); - } else if (beg.getFullYear() > this.year.max) { - this.year.max = beg.getFullYear(); - } - - this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); - - this.bubbles.push(this.createBubble(beg, end, this.year.min, this.year.max)); + } + catch (err) { + console.error(err); } }; @@ -57,7 +67,8 @@ if (date.indexOf('/') === -1) { date = new Date(parseInt(date, 10), 0, 1); date.hasMonth = false; - } else { + } + else { date = date.split('/'); date = new Date(parseInt(date[1], 10), parseInt(date[0], 10)-1, 1); date.hasMonth = true; @@ -104,9 +115,11 @@ var bubbleData = this.data[n]; var line = [ - '', + '' + + (bubble.link !== '' ? '>>' : '') + + '' + '' + bubble.getDateLabel() + '', - '' + bubbleData.label + '' + '' + bubbleData.label + '' + '' ].join(''); html.push('
  • ' + line + '
  • '); @@ -125,7 +138,7 @@ /** * Wrapper for adding bubbles. */ - Timesheet.prototype.createBubble = function(start, end, timesheetYearMin, timesheetYearMax) { + Timesheet.prototype.createBubble = function(start, end, timesheetYearMin, timesheetYearMax, link) { // If end isn't defined, it means that the bubble is still active, so copy min value between current date and ending year that's set up in constructor. if (end === null) { var currentDate = new Date(); @@ -138,13 +151,13 @@ end = maxDate; } } - return new Bubble(start, end, timesheetYearMin, timesheetYearMax); + return new Bubble(start, end, timesheetYearMin, timesheetYearMax, link); }; /** * Timesheet Bubble. */ - var Bubble = function(start, end, timesheetYearMin, timesheetYearMax) { + var Bubble = function(start, end, timesheetYearMin, timesheetYearMax, link) { this.start = start; this.end = end; @@ -154,6 +167,8 @@ this.monthOffsetStart = this.getStartOffset(); this.monthOffsetEnd = this.getEndOffset(); this.monthsLength = this.monthOffsetEnd - this.monthOffsetStart; + + this.link = link; }; /** diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index ca67f68..ce4dc2d 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -1,8 +1,8 @@ .timesheet width: 720px - height: 292px margin: 0 auto - + white-space: nowrap + overflow: auto border-top: 1px solid rgba(250, 250, 250, 0.5) background-color: rgba(51, 51, 51, 1) position: relative @@ -28,7 +28,7 @@ float: left section - float: left + display: inline-block width: 59px text-align: center color: rgba(250, 250, 250, 0.8) @@ -51,8 +51,6 @@ li margin: 0 0 3px 0 - line-height: 22px - height: 21px display: block clear: both position: relative @@ -78,11 +76,10 @@ width: 24px height: 7px display: block - float: left position: relative top: 7px border-radius: 4px - margin: 0 10px 0 0 + margin: 0 10px 6px 0 opacity: 0.7 &.timesheet--white @@ -107,12 +104,14 @@ section &:first-child border-left: 1px dashed transparent - - .date - display: none - - .bubble - margin-right: 7px - - .label - padding-left: 0px + + .data + li + .date + display: none + + .bubble + margin-right: 7px + + .label + padding-left: 0px From e4139cfd35469a2a4ea618e16b0df8f861b66bf5 Mon Sep 17 00:00:00 2001 From: Jelena Date: Fri, 17 Jul 2015 15:49:05 +0200 Subject: [PATCH 08/74] link styled differently --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 17 +++++++++++++---- source/stylesheets/timesheet.sass | 9 ++++++++- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 755b639..bbce5af 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n'+(""!==bubble.link?'>>':"")+''+bubble.getDateLabel()+"",''+bubble.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'',''+currentBubble.label+"","",""),html.push(line.join(""));html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'',''+currentBubble.label+"","",""),html.push(line.join(""));html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index c42360a..920be2f 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index a1c6eeb..ada8ee4 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,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B,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,QAAQ,CAAE,MAAM,CAEhB,mBAAE,CACA,MAAM,CAAE,SAAS,CACjB,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CACX,QAAQ,CAAE,QAAQ,CAClB,WAAW,CAAE,MAAM,CAGjB,iCAAO,CACL,OAAO,CAAE,CAAC,CAEd,yBAAK,CACH,KAAK,CAAE,OAAsB,CAC7B,SAAS,CAAE,IAAI,CAEjB,0BAAM,CACJ,WAAW,CAAE,OAAO,CACpB,SAAS,CAAE,IAAI,CACf,YAAY,CAAE,GAAG,CACjB,WAAW,CAAE,IAAI,CACjB,KAAK,CAAE,OAAsB,CAC7B,WAAW,CAAE,MAAM,CAErB,2BAAO,CACL,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,GAAG,CACX,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,GAAG,CACR,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,GAAG,CAElB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,wCAAY,CACV,aAAa,CAAE,kBAA8B,CAE/C,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAErC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 03a4c20..9e24645 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -119,16 +119,25 @@ Timesheet.prototype.generateMarkupParallel = function() { var html = []; this.widthYear = this.container.querySelector('.scale section').offsetWidth; + var startTag = ''; + var endTag = ''; for (var n = 0; n < this.bubbles.length; n++) { var bubble = this.bubbles[n]; + if (bubble.link !== '') { + startTag =''; + endTag = ''; + } + else { + startTag = ''; + endTag = ''; + } var line = [ - '' + - (bubble.link !== '' ? '>>' : '') + - '' + + '' + + startTag + '' + bubble.getDateLabel() + '', - '' + bubble.label + '' + '' + '' + bubble.label + '' + endTag ].join(''); html.push('
  • ' + line + '
  • '); diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index ce4dc2d..5aa28fd 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -7,6 +7,9 @@ background-color: rgba(51, 51, 51, 1) position: relative + .bubble-link + border-bottom: 1px dotted rgba(151, 151, 150, 1) + .bubble-default background-color: white .bubble-red @@ -86,9 +89,13 @@ border-top: 1px solid rgba(60, 60, 60, 0.3) background-color: rgba(251, 251, 251, 1) + .bubble-link + border-bottom: 1px dotted rgba(51, 51, 50, 1) + .bubble-default background-color: rgba(20, 20, 20, 1) - .scale + + .scale section color: rgba(50, 50, 50, 0.8) border-left: 1px dashed rgba(50, 50, 50, 0.1) From 64ddc26f27f62922b7201ec51db2d8ed0e375ca2 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 16:04:41 +0200 Subject: [PATCH 09/74] bug fixes serial view --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 9 ++++----- source/stylesheets/timesheet.sass | 15 ++++++++++++++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 3e9fd03..859b73e 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubble.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'',''+currentBubble.label+"","",""),html.push(line.join(""));html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var n=0;n',''+bubble.getDateLabel()+"",''+bubble.label+""].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index aa696d7..a638ba7 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;height:292px;margin:0 auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .date{display:none}.timesheet.timesheet--no-date .bubble{margin-right:7px}.timesheet.timesheet--no-date .label{padding-left:0px} +.timesheet{width:720px;height:292px;margin:0 auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data>li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}.timesheet .data>li>ul{position:relative}.timesheet .data>li>ul>li{display:block}.timesheet .data>li>ul>li .label{display:none}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .date{display:none}.timesheet.timesheet--no-date .bubble{margin-right:7px}.timesheet.timesheet--no-date .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index d95234f..8e8a0c7 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,MAAM,CAEd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,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,CAEvC,mCAAK,CACH,OAAO,CAAE,IAAI,CAEf,qCAAO,CACL,YAAY,CAAE,GAAG,CAEnB,oCAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 7a7c57d..6dbe00d 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -144,17 +144,16 @@ var line = []; for (j = 0; j < currentList.bubbles.length; j++) { currentBubble = currentList.bubbles[j]; - console.log(currentBubble); line.push( '
  • ', - '', - '' + currentBubble.label + '', + '', + '' + currentBubble.getDateLabel() + '', + '' + currentBubble.label + '', '', '
  • ' ); - - html.push(line.join('')); } + html.push(line.join('')); html.push(''); html.push(''); } diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index ca67f68..ee6b1f5 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -49,7 +49,7 @@ font-size: 13px overflow: hidden - li + > li margin: 0 0 3px 0 line-height: 22px height: 21px @@ -85,6 +85,19 @@ margin: 0 10px 0 0 opacity: 0.7 + > ul + position: relative + + > li + display: block + + .label + display: none + + .bubble + margin-right: 0 + + &.timesheet--white border-top: 1px solid rgba(60, 60, 60, 0.3) background-color: rgba(251, 251, 251, 1) From 7e880ec452f0e2ceb8139aed1326a3e95a48a0f3 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 16:14:36 +0200 Subject: [PATCH 10/74] make serial view usable --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/main.js | 2 +- source/javascripts/timesheet-advanced.js | 3 ++- source/stylesheets/timesheet.sass | 6 +++++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 2645504..79eda28 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 53f24e0..e4c02f3 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative}.timesheet .data>li>ul>li{display:block}.timesheet .data>li>ul>li .label{display:none}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;overflow:hidden}.timesheet .data>li>ul>li{display:block;float:left;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index b4290db..b70e3c2 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ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,CAErB,2BAAO,CACL,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,GAAG,CACX,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,GAAG,CACR,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,GAAG,CAEd,sBAAI,CACF,QAAQ,CAAE,QAAQ,CAClB,QAAQ,CAAE,MAAM,CAEhB,yBAAI,CACF,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CACX,aAAa,CAAE,IAAI,CAEnB,uCAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iCAAO,CACL,YAAY,CAAE,CAAC,CAGzB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,wCAAY,CACV,aAAa,CAAE,kBAA8B,CAE/C,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAGrC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 89b60b3..15eaea1 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -5,7 +5,7 @@ Lib.ready(function() { /* jshint -W031 */ - new Timesheet('timesheet-default', 'parallel', 2002, 2013, [ + new Timesheet('timesheet-default', 'serial', 2002, 2013, [ // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory ['2002', '09/2002', 'A freaking awesome time', 'red', ''], diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 13af507..17d9c39 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -168,7 +168,8 @@ currentBubble = currentList.bubbles[j]; line.push( '
  • ', - '', + '', + '', '' + currentBubble.getDateLabel() + '', '' + currentBubble.label + '', '', diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 9832f54..f445727 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -87,12 +87,16 @@ > ul position: relative + overflow: hidden > li display: block + float: left + margin-bottom: 20px - .label + .info-wrapper display: none + position: absolute .bubble margin-right: 0 From 8838a8edd5acc783beb2ad32b2ccbbe4606efb18 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 16:18:06 +0200 Subject: [PATCH 11/74] position bubbles --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 2 +- source/stylesheets/timesheet.sass | 4 +++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 79eda28..1987ef4 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index e4c02f3..0e11c3f 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;overflow:hidden}.timesheet .data>li>ul>li{display:block;float:left;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;height:30px;overflow:hidden}.timesheet .data>li>ul>li{display:block;position:absolute;top:0;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index b70e3c2..090962b 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,C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QAAQ,CAClB,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,MAAM,CAEhB,yBAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,aAAa,CAAE,IAAI,CAEnB,uCAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iCAAO,CACL,YAAY,CAAE,CAAC,CAGzB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,wCAAY,CACV,aAAa,CAAE,kBAA8B,CAE/C,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAGrC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 17d9c39..6b6f42f 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -168,7 +168,7 @@ currentBubble = currentList.bubbles[j]; line.push( '
  • ', - '', + '', '', '' + currentBubble.getDateLabel() + '', '' + currentBubble.label + '', diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index f445727..6ccc5ab 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -87,11 +87,13 @@ > ul position: relative + height: 30px overflow: hidden > li display: block - float: left + position: absolute + top: 0 margin-bottom: 20px .info-wrapper From db784ba6323cf02cd39b9781feeab87e01fbe450 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Fri, 17 Jul 2015 16:42:32 +0200 Subject: [PATCH 12/74] More samples --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/index.haml | 2 ++ source/javascripts/main.js | 8 ++++++++ source/stylesheets/timesheet.sass | 4 +--- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 0e11c3f..70880bf 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;height:30px;overflow:hidden}.timesheet .data>li>ul>li{display:block;position:absolute;top:0;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;height:30px}.timesheet .data>li>ul>li{display:block;position:absolute;top:0;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 090962b..e84eaea 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAA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,CAClB,GAAG,CAAE,CAAC,CACN,aAAa,CAAE,IAAI,CAEnB,uCAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iCAAO,CACL,YAAY,CAAE,CAAC,CAGzB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,wCAAY,CACV,aAAa,CAAE,kBAA8B,CAE/C,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAGrC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/index.haml b/source/index.haml index c86fd12..9e1d50e 100644 --- a/source/index.haml +++ b/source/index.haml @@ -31,6 +31,8 @@ %p Visualize your data and events with sexy HTML5 and CSS3. Create simple time sheets with sneaky JavaScript. Style them with CSS and have mobile fun as well … #timesheet-default %p Just include Timesheet.js and configure your data. No external dependencies, no jQuery needed and of course no Angular.JS! Just a few lines JavaScript to generate a beautiful HTML5 layout and some really delicious CSS to be customized by almighty you. + %p Projects timeline + #timesheet-projects %code %pre!='<script src="/javascripts/timesheet-advanced.js" type="text/javascript" />' %p Create a simple time sheet based on a JS array of events: diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 15eaea1..7906532 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -21,6 +21,14 @@ ['09/2008', '06/2010', 'FRINGE #1 & #2', 'blue', ''] ]); + new Timesheet('timesheet-projects', 'serial', 2010, 2015, [ + // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] + // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory + ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], + ['2011', '', 'Wikiarms', 'blue', 'www.wikairms.com'], + ['03/2012', '', 'Lorem ipsum', 'yellow', ''] + ]); + document.querySelector('#switch-dark').addEventListener('click', function() { document.querySelector('body').className = 'index black'; }); diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 6ccc5ab..52bae20 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -32,7 +32,7 @@ section display: inline-block - width: 59px + width: 119px text-align: center color: rgba(250, 250, 250, 0.8) font-family: 'Signika Negative' @@ -50,7 +50,6 @@ color: rgba(250, 250, 250, 0.8) font-family: 'Signika Negative' font-size: 13px - overflow: hidden > li margin: 0 0 3px 0 @@ -88,7 +87,6 @@ > ul position: relative height: 30px - overflow: hidden > li display: block From 12714552d2ee19ca20565d8d286a1dc83d5c83c8 Mon Sep 17 00:00:00 2001 From: Jelena Date: Fri, 17 Jul 2015 16:47:00 +0200 Subject: [PATCH 13/74] content changes --- dist/timesheet.min.css.map | 2 +- source/index.haml | 2 +- source/javascripts/main.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index ada8ee4..8b8a39e 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAA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WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/index.haml b/source/index.haml index c86fd12..0663831 100644 --- a/source/index.haml +++ b/source/index.haml @@ -39,6 +39,6 @@ %p It's that simple to use Timesheet.js. So, have a nice day, thank you for smoking and maybe try using Timesheet.js with custom styles … %p.footer Timesheet.js is licensed under MIT License
    Cheers to Cheeaun and Ilya




    dark | light - + %span Fork Timesheet.js on GitHub %script{type: 'text/javascript'} var _gauges = _gauges || []; (function() { var t = document.createElement('script'); t.type = 'text/javascript'; t.async = true; t.id = 'gauges-tracker'; t.setAttribute('data-site-id', '538272a38bfdf705f50037c3'); t.src = '//secure.gaug.es/track.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(t, s); })(); diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 89b60b3..1921e7d 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -14,11 +14,11 @@ ['10/2003', '2006', 'At least had fun', 'yellow', ''], ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], - ['10/2005', '2008', 'For a long time nothing happened', 'red', 'www.google.com'], + ['10/2005', '2008', 'For a long time nothing happened', 'red', 'http://www.google.com'], ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], - ['09/2008', '06/2010', 'FRINGE #1 & #2', 'blue', ''] + ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] ]); document.querySelector('#switch-dark').addEventListener('click', function() { From f4ab40c7060d7e0d0d5526489b356ef61494be68 Mon Sep 17 00:00:00 2001 From: Jelena Date: Sun, 19 Jul 2015 21:54:23 +0200 Subject: [PATCH 14/74] only test page changed - displays parallel and serial examples --- source/index.haml | 27 +++++++++++++-------------- source/javascripts/main.js | 12 +++--------- source/snippets/example-date.js | 26 +++++++++++++------------- source/stylesheets/style.sass | 1 - 4 files changed, 29 insertions(+), 37 deletions(-) diff --git a/source/index.haml b/source/index.haml index c984098..f38976e 100644 --- a/source/index.haml +++ b/source/index.haml @@ -1,14 +1,14 @@ !!! 5 %html %head - %title Timesheet.js - Beautiful time tables with HTML, JavaScript and CSS … + %title timesheet-advanced.js - Beautiful time tables with HTML, JavaScript and CSS … %meta{charset: 'utf-8'} %meta{content: 'IE=edge,chrome=1', 'http-equiv': 'X-UA-Compatible'} - %meta{property: 'og:title', content: 'Timesheet.js - Beautiful time tables with HTML, JavaScript and CSS …'} - %meta{property: 'og:description', content: 'With Timesheet.js you can easily create simple time and data sheets or timelines using HTML5, JavaScript and CSS3. Yep, it\'s a Vanilla JS library!'} - %meta{property: 'og:url', content: 'https://sbstjn.github.io/timesheet.js/'} + %meta{property: 'og:title', content: 'timesheet-advanced.js - Beautiful time tables with HTML, JavaScript and CSS …'} + %meta{property: 'og:description', content: 'With timesheet-advanced.js you can easily create simple time and data sheets or timelines using HTML5, JavaScript and CSS3. Yep, it\'s a Vanilla JS library!'} + %meta{property: 'og:url', content: 'https://github.com/ntucakovic/timesheet.js'} %meta{property: 'og:image', content: 'https://raw.githubusercontent.com/sbstjn/timesheet.js/master/screen.png'} %meta{property: 'fb:admins', content: '669118929'} @@ -27,20 +27,19 @@ #box #box-inner %h1 - Timesheet.js - %p Visualize your data and events with sexy HTML5 and CSS3. Create simple time sheets with sneaky JavaScript. Style them with CSS and have mobile fun as well … - #timesheet-default - %p Just include Timesheet.js and configure your data. No external dependencies, no jQuery needed and of course no Angular.JS! Just a few lines JavaScript to generate a beautiful HTML5 layout and some really delicious CSS to be customized by almighty you. - %p Projects timeline - #timesheet-projects + timesheet-advanced.js + %p Visualize your data and events with HTML5 and CSS3. + %p Just include timesheet-advanced.js and configure your data. No external dependencies, no jQuery needed and of course no Angular.JS! Just a few lines JavaScript to generate a beautiful HTML5 layout and some really delicious CSS to be customized by almighty you. %code %pre!='<script src="/javascripts/timesheet-advanced.js" type="text/javascript" />' %p Create a simple time sheet based on a JS array of events: %code %pre!=code - %p It's that simple to use Timesheet.js. So, have a nice day, thank you for smoking and maybe try using Timesheet.js with custom styles … - - %p.footer Timesheet.js is licensed under MIT License
    Cheers to Cheeaun and Ilya




    dark | light + %p Parallel mode example + #timesheet-default + %p Projects timeline - serial mode example + #timesheet-projects + %p - %span Fork Timesheet.js on GitHub + %span Fork Timesheet.js on GitHub %script{type: 'text/javascript'} var _gauges = _gauges || []; (function() { var t = document.createElement('script'); t.type = 'text/javascript'; t.async = true; t.id = 'gauges-tracker'; t.setAttribute('data-site-id', '538272a38bfdf705f50037c3'); t.src = '//secure.gaug.es/track.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(t, s); })(); diff --git a/source/javascripts/main.js b/source/javascripts/main.js index a5292b3..8ac2a50 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -5,7 +5,7 @@ Lib.ready(function() { /* jshint -W031 */ - new Timesheet('timesheet-default', 'serial', 2002, 2013, [ + new Timesheet('timesheet-default', 'parallel', 2002, 2011, [ // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory ['2002', '09/2002', 'A freaking awesome time', 'red', ''], @@ -26,15 +26,9 @@ // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], ['2011', '', 'Wikiarms', 'blue', 'www.wikairms.com'], + ['09/2014', '03/2015', 'Gateway15', '', ''], + ['05/2015', '06/2015', 'Feedback collect', 'green', ''], ['03/2012', '', 'Lorem ipsum', 'yellow', ''] ]); - - document.querySelector('#switch-dark').addEventListener('click', function() { - document.querySelector('body').className = 'index black'; - }); - - document.querySelector('#switch-light').addEventListener('click', function() { - document.querySelector('body').className = 'index white'; - }); }); })(); diff --git a/source/snippets/example-date.js b/source/snippets/example-date.js index 9b75581..111782f 100644 --- a/source/snippets/example-date.js +++ b/source/snippets/example-date.js @@ -1,13 +1,13 @@ -new Timesheet('timesheet-default', 2002, 2013, [ - ['2002', '09/2002', 'A freaking awesome time', 'lorem'], - ['06/2002', '09/2003', 'Some great memories', 'ipsum'], - ['2003', 'Had very bad luck'], - ['10/2003', '2006', 'At least had fun', 'dolor'], - ['02/2005', '05/2006', 'Enjoyed those times as well', 'ipsum'], - ['07/2005', '09/2005', 'Bad luck again', 'default'], - ['10/2005', '2008', 'For a long time nothing happened', 'dolor'], - ['01/2008', '05/2009', 'LOST Season #4', 'lorem'], - ['01/2009', '05/2009', 'LOST Season #4', 'lorem'], - ['02/2010', '05/2010', 'LOST Season #5', 'lorem'], - ['09/2008', '06/2010', 'FRINGE #1 & #2', 'ipsum'] -]); \ No newline at end of file +new Timesheet('timesheet-default', 'parallel', 2002, 2011, [ + ['2002', '09/2002', 'A freaking awesome time', 'red', ''], + ['06/2002', '09/2003', 'Some great memories', 'blue', ''], + ['2003', '', 'Had very bad luck', '', ''], + ['10/2003', '2006', 'At least had fun', 'yellow', ''], + ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], + ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], + ['10/2005', '2008', 'For a long time nothing happened', 'red', 'http://www.google.com'], + ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], + ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], + ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], + ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] +]); diff --git a/source/stylesheets/style.sass b/source/stylesheets/style.sass index 57b0452..257c5b1 100644 --- a/source/stylesheets/style.sass +++ b/source/stylesheets/style.sass @@ -4,7 +4,6 @@ html, body margin: 0 padding: 0 width: 100% - height: 100% * transition: all 0.5s ease From 4e4ebdb25a65654acf918f0ac4bfdd666f290400 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 10:16:23 +0200 Subject: [PATCH 15/74] Display current month line if applicable (only if last month on X axis is after current month) --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 18 ++++++++++++++++++ source/stylesheets/timesheet.sass | 8 +++++++- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 1987ef4..05c52ef 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
    '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 70880bf..20c1453 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;height:30px}.timesheet .data>li>ul>li{display:block;position:absolute;top:0;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;height:30px}.timesheet .data>li>ul>li{display:block;position:absolute;top:0;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index e84eaea..b774eee 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,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CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,aAAa,CAAE,IAAI,CAEnB,uCAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iCAAO,CACL,YAAY,CAAE,CAAC,CAGzB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,wCAAY,CACV,aAAa,CAAE,kBAA8B,CAE/C,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAGrC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 6b6f42f..d2270f6 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -20,6 +20,7 @@ if (typeof document !== 'undefined') { this.container = (typeof container === 'string') ? document.querySelector('#' + container) : container; this.drawSections(); + this.drawCurrentMonth(); this.insertData(); } }; @@ -101,6 +102,23 @@ this.container.innerHTML = '
    ' + html.join('') + '
    '; }; + /** + * Adds vertical line which represents current month on X axis (if applicable). + */ + Timesheet.prototype.drawCurrentMonth = function() { + var date = new Date(); + + // If max year on X axis is after or is the current year. + if (this.year.max >= date.getFullYear()) { + if (this.year.max === date.getFullYear() && date.getMonth() < 12) { + this.widthYear = this.container.querySelector('.scale section').offsetWidth; + + var currentMonthOffset = (this.year.max - this.year.min) * 12 + date.getMonth(); + this.container.innerHTML += '
    '; + } + } + }; + /** * Insert data into Timesheet. */ diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 52bae20..20f9611 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -138,4 +138,10 @@ margin-right: 7px .label - padding-left: 0px + padding-left: 0 + + .ts-vertical-line + position: absolute + width: 0 + height: 100% + border-right: 1px solid #2E7791 From 653289beadca50996087a6d13cc310f69b2c390e Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 10:34:32 +0200 Subject: [PATCH 16/74] Add timesheet type to wrapper --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 05c52ef..68fd345 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet",this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
    '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
    '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index d2270f6..40a3820 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -98,7 +98,7 @@ html.push('
    ' + c + '
    '); } - this.container.className = 'timesheet'; + this.container.className = 'timesheet ' + 'timesheet--' + this.type; this.container.innerHTML = '
    ' + html.join('') + '
    '; }; From bb8f1a406d4b588c4a6f2ca3f2d2784214009715 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 10:34:45 +0200 Subject: [PATCH 17/74] Fix specificity, no need to go so deep --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/timesheet.sass | 55 +++++++++++++++++-------------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 20c1453..136798f 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin:0 0 3px 0;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li .date{color:#b5b5b5;font-size:14px}.timesheet .data>li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data>li .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data>li>ul{position:relative;height:30px}.timesheet .data>li>ul>li{display:block;position:absolute;top:0;margin-bottom:20px}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li>ul{position:relative;height:25px}.timesheet .data>li>ul>li{display:block;position:absolute;top:0}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index b774eee..f56b1c7 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE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B,CAGrC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAG7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 20f9611..7fc2be1 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -42,6 +42,28 @@ border-left: 1px dashed rgba(250, 250, 250, 0.2) height: 100% + .date + color: rgba(181, 181, 181, 1) + font-size: 14px + + .label + font-weight: lighter + font-size: 14px + padding-left: 5px + line-height: 21px + color: rgba(151, 151, 150, 1) + white-space: nowrap + + .bubble + width: 24px + height: 7px + display: block + position: relative + top: 7px + border-radius: 4px + margin: 0 10px 6px 0 + opacity: 0.7 + .data margin: 28px 0 0 0 padding: 0 @@ -52,7 +74,7 @@ font-size: 13px > li - margin: 0 0 3px 0 + margin-bottom: 3px display: block clear: both position: relative @@ -62,37 +84,14 @@ .bubble opacity: 1 - .date - color: rgba(181, 181, 181, 1) - font-size: 14px - - .label - font-weight: lighter - font-size: 14px - padding-left: 5px - line-height: 21px - color: rgba(151, 151, 150, 1) - white-space: nowrap - - .bubble - width: 24px - height: 7px - display: block - position: relative - top: 7px - border-radius: 4px - margin: 0 10px 6px 0 - opacity: 0.7 - > ul position: relative - height: 30px + height: 25px > li display: block position: absolute top: 0 - margin-bottom: 20px .info-wrapper display: none @@ -145,3 +144,9 @@ width: 0 height: 100% border-right: 1px solid #2E7791 + +.timesheet--serial + .bubble + top: 0 + height: 16px + margin-bottom: 0 \ No newline at end of file From 2421c4465af3a22fc85b79ba141666411e13c73d Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 10:37:37 +0200 Subject: [PATCH 18/74] add ts-bubble-wrapper class to ul element on serial view --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 68fd345..b90b98d 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
    '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push("
        ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
    "+c+"
    ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
    '+html.join("")+"
    "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
    '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
  • "+line+"
  • ")}this.container.innerHTML+='
      '+html.join("")+"
    "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
      '),i=0;i"),html.push('
        ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
      "),html.push("")}html.push("
    "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 40a3820..9bb3b9d 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -180,7 +180,7 @@ currentList = lists[i]; if (currentList.bubbles.length) { html.push('
  • '); - html.push('
      '); + html.push('
        '); var line = []; for (j = 0; j < currentList.bubbles.length; j++) { currentBubble = currentList.bubbles[j]; From a0078eb6c84ec622dd2b0fa41977abeae3f77035 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 10:37:59 +0200 Subject: [PATCH 19/74] Improve sass specificity, use new class for ul wrapper --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/timesheet.sass | 36 +++++++++++++++---------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 136798f..a9fef8e 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet .data>li>ul{position:relative;height:25px}.timesheet .data>li>ul>li{display:block;position:absolute;top:0}.timesheet .data>li>ul>li .info-wrapper{display:none;position:absolute}.timesheet .data>li>ul>li .bubble{margin-right:0}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index f56b1c7..1fd7980 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEhB,gBAAK,CACH,KAAK,CAAE,OAAs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,CAEnB,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 7fc2be1..63f5ebb 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -84,23 +84,6 @@ .bubble opacity: 1 - > ul - position: relative - height: 25px - - > li - display: block - position: absolute - top: 0 - - .info-wrapper - display: none - position: absolute - - .bubble - margin-right: 0 - - &.timesheet--white border-top: 1px solid rgba(60, 60, 60, 0.3) background-color: rgba(251, 251, 251, 1) @@ -115,6 +98,7 @@ section color: rgba(50, 50, 50, 0.8) border-left: 1px dashed rgba(50, 50, 50, 0.1) + .data li .date @@ -149,4 +133,20 @@ .bubble top: 0 height: 16px - margin-bottom: 0 \ No newline at end of file + margin-bottom: 0 + + .ts-bubbles-wrapper + position: relative + height: 25px + + > li + display: block + position: absolute + top: 0 + + .info-wrapper + display: none + position: absolute + + .bubble + margin-right: 0 \ No newline at end of file From 7ada695602d69050af9acb8da23e2b25043f2181 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 10:45:06 +0200 Subject: [PATCH 20/74] change border radius on serial view --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/timesheet.sass | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index a9fef8e..72ec060 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 1fd7980..9547be8 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE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,CAAE,QAAQ,CAClB,WAAW,CAAE,MAAM,CAGjB,iCAAO,CACL,OAAO,CAAE,CAAC,CAElB,2BAAkB,CAChB,UAAU,CAAE,4BAA+B,CAC3C,gBAAgB,CAAE,OAAsB,CAExC,wCAAY,CACV,aAAa,CAAE,kBAA8B,CAE/C,2CAAe,CACb,gBAAgB,CAAE,OAAmB,CAGrC,0CAAO,CACL,KAAK,CAAE,kBAAqB,CAC5B,WAAW,CAAE,6BAAgC,CAI7C,0CAAK,CACH,KAAK,CAAE,OAAsB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAI9B,iDAAa,CACX,WAAW,CAAE,sBAAsB,CAInC,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,8CAAO,CACL,YAAY,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 63f5ebb..849f49c 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -149,4 +149,5 @@ position: absolute .bubble - margin-right: 0 \ No newline at end of file + margin-right: 0 + border-radius: 8px \ No newline at end of file From e6ce25cfc21d1e9fad832e19e2d768f29d44bce0 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 12:10:18 +0200 Subject: [PATCH 21/74] removed try-catch --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/main.js | 2 - source/javascripts/timesheet-advanced.js | 66 +++++++++++------------- 3 files changed, 31 insertions(+), 39 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 1987ef4..3c35cd2 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet",this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push("
            ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet",this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push("
            ");var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 8ac2a50..31728f6 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -22,8 +22,6 @@ ]); new Timesheet('timesheet-projects', 'serial', 2010, 2015, [ - // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] - // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], ['2011', '', 'Wikiarms', 'blue', 'www.wikairms.com'], ['09/2014', '03/2015', 'Gateway15', '', ''], diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 6b6f42f..6c7e0b8 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -28,45 +28,39 @@ * Parse timesheet data. */ Timesheet.prototype.parse = function(data) { - try { - for (var n = 0; n < data.length; n++) { - if (data[n].length !== 5) { - throw 'Not enough input parameters for bubble ' + (n + 1); - } - var beg = this.parseDate(data[n][0]); - var end = (data[n][1] !== '' ? this.parseDate(data[n][1]) : null); - var label = data[n][2]; - var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); - var link = (data[n][4] !== '' ? data[n][4] : ''); - - if (beg.getFullYear() < this.year.min) { - this.year.min = beg.getFullYear(); - } - - if (end && end.getFullYear() > this.year.max) { - this.year.max = end.getFullYear(); - } - else if (beg.getFullYear() > this.year.max) { - this.year.max = beg.getFullYear(); - } + for (var n = 0; n < data.length; n++) { + if (data[n].length !== 5) { + throw 'Not enough input parameters for bubble ' + (n + 1); + } + var beg = this.parseDate(data[n][0]); + var end = (data[n][1] !== '' ? this.parseDate(data[n][1]) : null); + var label = data[n][2]; + var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); + var link = (data[n][4] !== '' ? data[n][4] : ''); + + if (beg.getFullYear() < this.year.min) { + this.year.min = beg.getFullYear(); + } - this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); - - this.bubbles.push(this.createBubble({ - start: beg, - end: end, - type: bubbleType, - label: label, - timesheetYearMin: this.year.min, - timesheetYearMax: this.year.max, - link: link - }) - ); + if (end && end.getFullYear() > this.year.max) { + this.year.max = end.getFullYear(); + } + else if (beg.getFullYear() > this.year.max) { + this.year.max = beg.getFullYear(); } - } - catch (err) { - console.error(err); + this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); + + this.bubbles.push(this.createBubble({ + start: beg, + end: end, + type: bubbleType, + label: label, + timesheetYearMin: this.year.min, + timesheetYearMax: this.year.max, + link: link + }) + ); } }; From fdce75501c75bec5ded7527ed3fee72d4135d979 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 12:35:37 +0200 Subject: [PATCH 22/74] Constructor options refactor --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/main.js | 21 ++++-- source/javascripts/timesheet-advanced.js | 86 +++++++++++++++++------- 3 files changed, 81 insertions(+), 28 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index b90b98d..e780154 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=end.getFullYear():beg.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 8ac2a50..cb11c92 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -5,7 +5,8 @@ Lib.ready(function() { /* jshint -W031 */ - new Timesheet('timesheet-default', 'parallel', 2002, 2011, [ + new Timesheet( + [ // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory ['2002', '09/2002', 'A freaking awesome time', 'red', ''], @@ -19,9 +20,15 @@ ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] - ]); + ], + { + container: 'timesheet-default', + type: 'parallel', + timesheetYearMin: 2002, + timesheetYearMax: 2011 + }); - new Timesheet('timesheet-projects', 'serial', 2010, 2015, [ + new Timesheet([ // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], @@ -29,6 +36,12 @@ ['09/2014', '03/2015', 'Gateway15', '', ''], ['05/2015', '06/2015', 'Feedback collect', 'green', ''], ['03/2012', '', 'Lorem ipsum', 'yellow', ''] - ]); + ], + { + container: 'timesheet-projects', + type: 'serial', + timesheetYearMin: 2010, + timesheetYearMax: 2015 + }); }); })(); diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 9bb3b9d..bce0fe4 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -1,16 +1,39 @@ (function() { 'use strict'; + function merge(target, source) { + /* Merges two (or more) objects, + giving the last one precedence */ + if ( typeof target !== 'object' ) { + target = {}; + } + + for (var property in source) { + if (source.hasOwnProperty(property)) { + var sourceProperty = source[property]; + + if (typeof sourceProperty === 'object') { + target[property] = merge(target[property], sourceProperty); + continue; + } + + target[property] = sourceProperty; + } + } + + for (var a = 2, l = arguments.length; a < l; a++) { + merge(target, arguments[a]); + } + + return target; + } + /** * Initialize Timesheet object. */ - var Timesheet = function(container, type, min, max, data) { - this.type = (type === 'serial' || type === 'parallel') ? type : 'parallel'; + var Timesheet = function(data, options) { + this.options = this.mergeWithDefault(options); this.data = []; - this.year = { - min: min, - max: max - }; this.bubbles = []; this.widthYear = 0; @@ -18,13 +41,30 @@ this.parse(data || []); if (typeof document !== 'undefined') { - this.container = (typeof container === 'string') ? document.querySelector('#' + container) : container; + this.container = (typeof this.options.container === 'string') ? document.querySelector('#' + this.options.container) : this.options.container; this.drawSections(); this.drawCurrentMonth(); this.insertData(); } }; + /** + * Set default options and merge them with passed ones. + */ + Timesheet.prototype.mergeWithDefault = function(options) { + var defaults = { + container: 'timesheet', + type: 'parallel', + theme: 'dark', + extraClass: '', + showDate: true, + timesheetYearMin: null, + timesheetYearMax: null + }; + + return merge(defaults, options); + }; + /** * Parse timesheet data. */ @@ -40,15 +80,15 @@ var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); var link = (data[n][4] !== '' ? data[n][4] : ''); - if (beg.getFullYear() < this.year.min) { - this.year.min = beg.getFullYear(); + if (beg.getFullYear() < this.options.timesheetYearMin) { + this.options.timesheetYearMin = beg.getFullYear(); } - if (end && end.getFullYear() > this.year.max) { - this.year.max = end.getFullYear(); + if (end && end.getFullYear() > this.options.timesheetYearMax) { + this.options.timesheetYearMax = end.getFullYear(); } - else if (beg.getFullYear() > this.year.max) { - this.year.max = beg.getFullYear(); + else if (beg.getFullYear() > this.options.timesheetYearMax) { + this.options.timesheetYearMax = beg.getFullYear(); } this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); @@ -58,8 +98,8 @@ end: end, type: bubbleType, label: label, - timesheetYearMin: this.year.min, - timesheetYearMax: this.year.max, + timesheetYearMin: this.options.timesheetYearMin, + timesheetYearMax: this.options.timesheetYearMax, link: link }) ); @@ -94,11 +134,11 @@ Timesheet.prototype.drawSections = function() { var html = []; - for (var c = this.year.min; c <= this.year.max; c++) { + for (var c = this.options.timesheetYearMin; c <= this.options.timesheetYearMax; c++) { html.push('
        ' + c + '
        '); } - this.container.className = 'timesheet ' + 'timesheet--' + this.type; + this.container.className = 'timesheet ' + 'timesheet--' + this.options.type; this.container.innerHTML = '
        ' + html.join('') + '
        '; }; @@ -109,11 +149,11 @@ var date = new Date(); // If max year on X axis is after or is the current year. - if (this.year.max >= date.getFullYear()) { - if (this.year.max === date.getFullYear() && date.getMonth() < 12) { + if (this.options.timesheetYearMax >= date.getFullYear()) { + if (this.options.timesheetYearMax === date.getFullYear() && date.getMonth() < 12) { this.widthYear = this.container.querySelector('.scale section').offsetWidth; - var currentMonthOffset = (this.year.max - this.year.min) * 12 + date.getMonth(); + var currentMonthOffset = (this.options.timesheetYearMax - this.options.timesheetYearMin) * 12 + date.getMonth(); this.container.innerHTML += '
        '; } } @@ -123,10 +163,10 @@ * Insert data into Timesheet. */ Timesheet.prototype.insertData = function() { - if (this.type === 'parallel') { + if (this.options.type === 'parallel') { this.generateMarkupParallel(); } - else if (this.type === 'serial') { + else if (this.options.type === 'serial') { this.generateMarkupSerial(); } }; @@ -257,7 +297,7 @@ // If end isn't defined, it means that the bubble is still active, so copy min value between current date and ending year that's set up in constructor. if (options.end === null) { var currentDate = new Date(); - var maxDate = new Date(this.year.max, 12, 31); + var maxDate = new Date(this.options.timesheetYearMax, 12, 31); if (currentDate.getTime() < maxDate.getTime()) { options.end = currentDate; From 8933880e1ffda17dba03076172818c06373a0d71 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 12:37:23 +0200 Subject: [PATCH 23/74] use extra class parameter --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/main.js | 3 ++- source/javascripts/timesheet-advanced.js | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index e780154..d0cdf67 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=end.getFullYear():beg.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){try{for(var n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=end.getFullYear():beg.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}}catch(err){console.error(err)}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/main.js b/source/javascripts/main.js index cb11c92..173cf59 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -41,7 +41,8 @@ container: 'timesheet-projects', type: 'serial', timesheetYearMin: 2010, - timesheetYearMax: 2015 + timesheetYearMax: 2015, + extraClass: 'test' }); }); })(); diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index bce0fe4..8cb9bb8 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -139,6 +139,11 @@ } this.container.className = 'timesheet ' + 'timesheet--' + this.options.type; + + if (this.options.extraClass.length) { + this.container.className += ' ' + this.options.extraClass; + } + this.container.innerHTML = '
        ' + html.join('') + '
        '; }; From b08532aae5b5de15db0dc62de61e40ead43a9a55 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 12:46:01 +0200 Subject: [PATCH 24/74] Fix merge problems --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/main.js | 58 +++++++++++++++--------- source/javascripts/timesheet-advanced.js | 16 +++---- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index efd4124..3aa9be1 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=end.getFullYear():beg.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 31728f6..d1b4671 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -2,31 +2,47 @@ (function(){ 'use strict'; - + Lib.ready(function() { /* jshint -W031 */ - new Timesheet('timesheet-default', 'parallel', 2002, 2011, [ + new Timesheet( + [ // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory - ['2002', '09/2002', 'A freaking awesome time', 'red', ''], - ['06/2002', '09/2003', 'Some great memories', 'blue', ''], - ['2003', '', 'Had very bad luck', '', ''], - ['10/2003', '2006', 'At least had fun', 'yellow', ''], - ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], - ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], - ['10/2005', '2008', 'For a long time nothing happened', 'red', 'http://www.google.com'], - ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], - ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], - ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], - ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] - ]); + ['2002', '09/2002', 'A freaking awesome time', 'red', ''], + ['06/2002', '09/2003', 'Some great memories', 'blue', ''], + ['2003', '', 'Had very bad luck', '', ''], + ['10/2003', '2006', 'At least had fun', 'yellow', ''], + ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], + ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], + ['10/2005', '2008', 'For a long time nothing happened', 'red', 'http://www.google.com'], + ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], + ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], + ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], + ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] + ], + { + container: 'timesheet-default', + type: 'parallel', + timesheetYearMin: 2002, + timesheetYearMax: 2011 + }); - new Timesheet('timesheet-projects', 'serial', 2010, 2015, [ - ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], - ['2011', '', 'Wikiarms', 'blue', 'www.wikairms.com'], - ['09/2014', '03/2015', 'Gateway15', '', ''], - ['05/2015', '06/2015', 'Feedback collect', 'green', ''], - ['03/2012', '', 'Lorem ipsum', 'yellow', ''] - ]); + new Timesheet([ + // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] + // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory + ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], + ['2011', '', 'Wikiarms', 'blue', 'www.wikairms.com'], + ['09/2014', '03/2015', 'Gateway15', '', ''], + ['05/2015', '06/2015', 'Feedback collect', 'green', ''], + ['03/2012', '', 'Lorem ipsum', 'yellow', ''] + ], + { + container: 'timesheet-projects', + type: 'serial', + timesheetYearMin: 2010, + timesheetYearMax: 2015, + extraClass: 'test' + }); }); })(); diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index a830718..e3836d6 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -79,15 +79,15 @@ var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); var link = (data[n][4] !== '' ? data[n][4] : ''); - if (beg.getFullYear() < this.year.min) { - this.year.min = beg.getFullYear(); + if (beg.getFullYear() < this.options.timesheetYearMin) { + this.options.timesheetYearMin = beg.getFullYear(); } - if (end && end.getFullYear() > this.year.max) { - this.year.max = end.getFullYear(); + if (end && end.getFullYear() > this.options.timesheetYearMax) { + this.options.timesheetYearMax = end.getFullYear(); } - else if (beg.getFullYear() > this.year.max) { - this.year.max = beg.getFullYear(); + else if (beg.getFullYear() > this.options.timesheetYearMax) { + this.options.timesheetYearMax = beg.getFullYear(); } this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); @@ -97,8 +97,8 @@ end: end, type: bubbleType, label: label, - timesheetYearMin: this.year.min, - timesheetYearMax: this.year.max, + timesheetYearMin: this.options.timesheetYearMin, + timesheetYearMax: this.options.timesheetYearMax, link: link }) ); From 20260224857985d0fa34793abb4b16b2706bca99 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 13:45:10 +0200 Subject: [PATCH 25/74] removed unused styles --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/timesheet.sass | 11 ++--------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 72ec060..f610cee 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 9547be8..2c83e1f 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEhB,gBAAK,CACH,KAAK,CAAE,OAAsB,CAC7B,SAAS,CAAE,IAAI,CAEjB,iBAAM,CACJ,WAAW,CAAE,OAAO,CACpB,SAAS,CAAE,IAAI,CACf,YAAY,CAAE,GAA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BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 849f49c..9e351d0 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -107,19 +107,12 @@ .label color: rgba(51, 51, 50, 1) - &.timesheet--no-date - section - &:first-child - border-left: 1px dashed transparent - + &.timesheet--no-date .data li .date display: none - .bubble - margin-right: 7px - .label padding-left: 0 @@ -150,4 +143,4 @@ .bubble margin-right: 0 - border-radius: 8px \ No newline at end of file + border-radius: 8px From 37bedf9c3b6eb3491098f66afdc62e6b85aee3bd Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 13:45:23 +0200 Subject: [PATCH 26/74] added event listener on bubbles --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 78b2b9b..b5a6ecf 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return elem.classList&&elem.classList.contains("bubble")},bubbleHandler=function(e){console.log(e)};this.container.addEventListener("click",delegate(bubbleFilter,bubbleHandler))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index c0b82b7..abebcc2 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -123,6 +123,27 @@ else if (this.type === 'serial') { this.generateMarkupSerial(); } + + var bubbleFilter = function(elem) {return elem.classList && elem.classList.contains('bubble');}; + var bubbleHandler = function(e) { + //var bubble = e.delegateTarget; + console.log(e); + }; + this.container.addEventListener('click', delegate(bubbleFilter, bubbleHandler)); + }; + + var delegate = function(criteria, listener) { + return function(e) { + var el = e.target; + do { + if (!criteria(el)) { + continue; + } + e.delegateTarget = el; + listener.apply(this, arguments); + return; + } while((el = el.parentNode)); + }; }; /** From 8048166e5765196909750477d6ca182c039ae7e1 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 15:26:23 +0200 Subject: [PATCH 27/74] override min/max logic --- source/javascripts/timesheet-advanced.js | 32 +++++++++++++++--------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index e3836d6..4d91405 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -69,32 +69,40 @@ * Parse timesheet data. */ Timesheet.prototype.parse = function(data) { + var overrideTimesheetMin = this.options.timesheetYearMin === null; + var overrideTimesheetMax = this.options.timesheetYearMax === null; + for (var n = 0; n < data.length; n++) { if (data[n].length !== 5) { throw 'Not enough input parameters for bubble ' + (n + 1); } - var beg = this.parseDate(data[n][0]); - var end = (data[n][1] !== '' ? this.parseDate(data[n][1]) : null); + var bubbleStart = this.parseDate(data[n][0]); + var bubbleEnd = (data[n][1] !== '' ? this.parseDate(data[n][1]) : null); var label = data[n][2]; var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); var link = (data[n][4] !== '' ? data[n][4] : ''); - if (beg.getFullYear() < this.options.timesheetYearMin) { - this.options.timesheetYearMin = beg.getFullYear(); + // Check if timesheet year min/max wasn't set and use minimum/maximum bubble value for setting up the year sections. + if (overrideTimesheetMin) { + if (bubbleStart.getFullYear() < this.options.timesheetYearMin) { + this.options.timesheetYearMin = bubbleStart.getFullYear(); + } } - if (end && end.getFullYear() > this.options.timesheetYearMax) { - this.options.timesheetYearMax = end.getFullYear(); - } - else if (beg.getFullYear() > this.options.timesheetYearMax) { - this.options.timesheetYearMax = beg.getFullYear(); + if (overrideTimesheetMax) { + if (bubbleEnd && bubbleEnd.getFullYear() > this.options.timesheetYearMax) { + this.options.timesheetYearMax = bubbleEnd.getFullYear(); + } + else if (bubbleStart.getFullYear() > this.options.timesheetYearMax) { + this.options.timesheetYearMax = bubbleStart.getFullYear(); + } } - this.data.push({start: beg, end: end, label: label, bubbleType: bubbleType}); + this.data.push({start: bubbleStart, end: bubbleEnd, label: label, bubbleType: bubbleType}); this.bubbles.push(this.createBubble({ - start: beg, - end: end, + start: bubbleStart, + end: bubbleEnd, type: bubbleType, label: label, timesheetYearMin: this.options.timesheetYearMin, From 785689b152d0165aa37ec59eec30a1f63b2856b8 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 15:41:45 +0200 Subject: [PATCH 28/74] style --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/style.sass | 2 +- source/stylesheets/timesheet.sass | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index f610cee..bc77a73 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.bubble-tooltip{position:absolute;top:1091px;left:200px;background-color:#b99f30;width:200px;display:inline-block;color:#333;text-align:center;padding:6px}.bubble-tooltip-date{color:#000;font-size:14px;font-weight:bold}.bubble-tooltip-label{width:auto;color:#000;margin:0 5px;text-align:center;font-size:14px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 2c83e1f..7631683 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEhB,gBAAK,CACH,KAAK,CAAE,OAAsB,CAC7B,SAAS,CAAE,IAAI,CAEjB,iBAAM,CACJ,WAAW,CAAE,OAAO,CACpB,SAAS,CAAE,IAAI,CACf,Y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a,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG,CAE1B,eAAe,CACb,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,MAAM,CACX,IAAI,CAAE,KAAK,CACX,gBAAgB,CAAE,OAAiB,CACnC,KAAK,CAAE,KAAK,CACZ,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,IAAe,CACtB,UAAU,CAAE,MAAM,CAClB,OAAO,CAAE,GAAG,CAEd,oBAAoB,CAClB,KAAK,CAAE,IAAK,CACZ,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CAEnB,qBAAqB,CACnB,KAAK,CAAE,IAAI,CACX,KAAK,CAAE,IAAK,CAEZ,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAClB,SAAS,CAAE,IAAI", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/style.sass b/source/stylesheets/style.sass index 257c5b1..49a6e98 100644 --- a/source/stylesheets/style.sass +++ b/source/stylesheets/style.sass @@ -27,7 +27,6 @@ h1 font-family: 'Open Sans' font-size: 60pt font-weight: 800 - line-height: 240px p width: 680px @@ -154,3 +153,4 @@ a, a:hover, a:visited, a:active span color: rgba(255, 145, 18, 1) font-weight: 600 + diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 9e351d0..4ca9bb4 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -144,3 +144,27 @@ .bubble margin-right: 0 border-radius: 8px + +.bubble-tooltip + position: absolute + top: 1091px + left: 200px + background-color: rgb(185, 159, 48) + width: 200px + display: inline-block + color: rgb(51, 51, 51) + text-align: center + padding: 6px + +.bubble-tooltip-date + color: black + font-size: 14px + font-weight: bold + +.bubble-tooltip-label + width: auto + color: black + /* text-decoration: underline; cursor: pointer */ + margin: 0 5px + text-align: center + font-size: 14px From 428e9ae0033339215698417fe4fd876c685cd660 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 15:42:01 +0200 Subject: [PATCH 29/74] get attributes - initial --- dist/timesheet-advanced.min.js | 2 +- source/index.haml | 3 +- source/javascripts/timesheet-advanced.js | 58 ++++++++++++++++++------ 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index b5a6ecf..02d1ed5 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return elem.classList&&elem.classList.contains("bubble")},bubbleHandler=function(e){console.log(e)};this.container.addEventListener("click",delegate(bubbleFilter,bubbleHandler))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i');var line=[];line.push(''+content.dateLabel+""),line.push('

        '+content.label+"

        "),html.push(line.join("")),html.push(""),console.log(line)},Bubble=function(options){this.start=options.start,this.end=options.end,this.timesheetYearMin=options.timesheetYearMin,this.timesheetYearMax=options.timesheetYearMax,this.monthOffsetStart=this.getStartOffset(),this.monthOffsetEnd=this.getEndOffset(),this.monthsLength=this.monthOffsetEnd-this.monthOffsetStart,this.link=options.link,this.type=options.type,this.label=options.label,this.present=options.present};Bubble.prototype.getStartOffset=function(){return 12*(this.start.getFullYear()-this.timesheetYearMin)+this.start.getMonth()},Bubble.prototype.getEndOffset=function(){return 12*(this.end.getFullYear()-this.timesheetYearMin)+this.end.getMonth()},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/index.haml b/source/index.haml index f38976e..a2f788c 100644 --- a/source/index.haml +++ b/source/index.haml @@ -29,9 +29,10 @@ %h1 timesheet-advanced.js %p Visualize your data and events with HTML5 and CSS3. - %p Just include timesheet-advanced.js and configure your data. No external dependencies, no jQuery needed and of course no Angular.JS! Just a few lines JavaScript to generate a beautiful HTML5 layout and some really delicious CSS to be customized by almighty you. + %p Just include timesheet-advanced.js and timesheet.css and configure your data. No external dependencies, no jQuery needed and of course no Angular.JS! Just a few lines JavaScript to generate a beautiful HTML5 layout. %code %pre!='<script src="/javascripts/timesheet-advanced.js" type="text/javascript" />' + %pre!='<link rel="stylesheet" type="text/css" href="/styles/timesheet.css" />' %p Create a simple time sheet based on a JS array of events: %code %pre!=code diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index abebcc2..2d29453 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -124,14 +124,14 @@ this.generateMarkupSerial(); } - var bubbleFilter = function(elem) {return elem.classList && elem.classList.contains('bubble');}; - var bubbleHandler = function(e) { - //var bubble = e.delegateTarget; - console.log(e); - }; - this.container.addEventListener('click', delegate(bubbleFilter, bubbleHandler)); + // Elements on which to detect click event. + var bubbleFilter = function(elem) {return hasClass(elem, 'bubble');}; + this.container.addEventListener('click', delegate(bubbleFilter, drawTooltip)); }; + /** + * Helper function for setting event handler to elements that satisfy criteria. + */ var delegate = function(criteria, listener) { return function(e) { var el = e.target; @@ -146,6 +146,13 @@ }; }; + /** + * Helper function for checking if element has class. + */ + var hasClass = function(element, cls) { + return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1; + }; + /** * Generate parallel markup. */ @@ -167,7 +174,7 @@ } var line = [ - '' + + '' + startTag + '' + bubble.getDateLabel() + '', '' + bubble.label + '' + endTag @@ -201,11 +208,7 @@ currentBubble = currentList.bubbles[j]; line.push( '
      • ', - '', - '', - '' + currentBubble.getDateLabel() + '', - '' + currentBubble.label + '', - '', + '', '
      • ' ); } @@ -280,11 +283,39 @@ else { options.end = maxDate; } + options.present = true; + } + else { + options.present = false; } return new Bubble(options); }; + /** + * Show tooltip for given mouse event. + */ + var drawTooltip = function(e) { + var readAttributes = function(element) { + return { + dateLabel:element.getAttribute('data-bubble-date'), + label:element.getAttribute('data-bubble-label') + }; + }; + + var content = readAttributes(e.delegateTarget); + var html = []; + html.push('
        '); + var line = []; + line.push('' + content.dateLabel + ''); + line.push('

        ' + content.label + '

        '); + html.push(line.join('')); + html.push('
        '); + + //document.body.innerHTML += html.join(''); + console.log(line); + }; + /** * Timesheet Bubble. */ @@ -302,6 +333,7 @@ this.link = options.link; this.type = options.type; this.label = options.label; + this.present = options.present; }; /** @@ -340,7 +372,7 @@ Bubble.prototype.getDateLabel = function() { return [ (this.start.hasMonth ? this.formatMonth(this.start.getMonth() + 1) + '/' : '' ) + this.start.getFullYear(), - (this.end ? '-' + ((this.end.hasMonth ? this.formatMonth(this.end.getMonth() + 1) + '/' : '' ) + this.end.getFullYear()) : '') + (this.present ? ' - present' : ' - ' + ((this.end.hasMonth ? this.formatMonth(this.end.getMonth() + 1) + '/' : '' ) + this.end.getFullYear())) ].join(''); }; From 1be02471b703b81b1e414f0038a29912ea69cece Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 16:44:59 +0200 Subject: [PATCH 30/74] Alter offsets depending on min and max width of timesheet --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 62 ++++++++++++++++-------- source/stylesheets/timesheet.sass | 1 - 5 files changed, 46 insertions(+), 23 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 3aa9be1..c335dba 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=end.getFullYear():beg.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial()},Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'','',''+currentBubble.getDateLabel()+"",''+currentBubble.label+"","","")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 72ec060..eeafd81 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date section:first-child{border-left:1px dashed transparent}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .bubble{margin-right:7px}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 9547be8..83a2464 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEhB,gBAAK,CACH,KAAK,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,CAAE,GAAG,CAEnB,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 4d91405..b65e046 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -82,11 +82,11 @@ var bubbleType = (data[n][3] !== '' ? data[n][3] : 'default'); var link = (data[n][4] !== '' ? data[n][4] : ''); + // todo: if start before beginning, if end after end don't add to list of bubbles. + // Check if timesheet year min/max wasn't set and use minimum/maximum bubble value for setting up the year sections. - if (overrideTimesheetMin) { - if (bubbleStart.getFullYear() < this.options.timesheetYearMin) { - this.options.timesheetYearMin = bubbleStart.getFullYear(); - } + if (overrideTimesheetMin && bubbleStart.getFullYear() < this.options.timesheetYearMin) { + this.options.timesheetYearMin = bubbleStart.getFullYear(); } if (overrideTimesheetMax) { @@ -189,17 +189,18 @@ for (var n = 0; n < this.bubbles.length; n++) { var bubble = this.bubbles[n]; + var position = bubble.getPosition(this); if (bubble.link !== '') { - startTag =''; + startTag =''; endTag = ''; } else { - startTag = ''; + startTag = ''; endTag = ''; } var line = [ - '' + + '' + startTag + '' + bubble.getDateLabel() + '', '' + bubble.label + '' + endTag @@ -231,9 +232,10 @@ var line = []; for (j = 0; j < currentList.bubbles.length; j++) { currentBubble = currentList.bubbles[j]; + var position = currentBubble.getPosition(this); line.push( '
      • ', - '', + '', '', '' + currentBubble.getDateLabel() + '', '' + currentBubble.label + '', @@ -327,8 +329,10 @@ this.timesheetYearMin = options.timesheetYearMin; this.timesheetYearMax = options.timesheetYearMax; - this.monthOffsetStart = this.getStartOffset(); - this.monthOffsetEnd = this.getEndOffset(); + var offsets = this.getMonthOffsets(); + this.monthOffsetStart = offsets.monthStart; + this.monthOffsetEnd = offsets.monthEnd; + this.monthsLength = this.monthOffsetEnd - this.monthOffsetStart; this.link = options.link; @@ -337,17 +341,25 @@ }; /** - * Calculate starting offset for bubble (in months). + * Get month offsets for start and end of bubbles. */ - Bubble.prototype.getStartOffset = function() { - return (12 * (this.start.getFullYear() - this.timesheetYearMin) + this.start.getMonth()); - }; + Bubble.prototype.getMonthOffsets = function() { + var offsets = {}; - /** - * Calculate ending offset for bubble (in months). - */ - Bubble.prototype.getEndOffset = function() { - return (12 * (this.end.getFullYear() - this.timesheetYearMin) + this.end.getMonth()); + offsets.monthStart = Math.abs(12 * (this.start.getFullYear() - this.timesheetYearMin) + this.start.getMonth()); + offsets.monthEnd = Math.abs(12 * (this.end.getFullYear() - this.timesheetYearMin) + this.end.getMonth()); + + if (this.start.getFullYear() < this.timesheetYearMin) { + // Remove the years of difference from start. + offsets.monthStart -= ((this.timesheetYearMin - this.start.getFullYear()) * 12); + } + + if (this.end.getFullYear() > this.timesheetYearMax) { + // Round it to the end of the year by removing 1 year from offset. + offsets.monthEnd -= ((this.end.getFullYear() - this.timesheetYearMax - 1) * 12); + } + + return offsets; }; /** @@ -366,6 +378,18 @@ return (widthYear/12) * this.monthsLength; }; + /** + * Returns bubble pixel dimensions and left offset. + */ + Bubble.prototype.getPosition = function(timesheet) { + var position = {}; + + position.offset = this.monthOffsetStart * timesheet.widthYear / 12 + 'px'; + position.width = this.getWidth(timesheet.widthYear) + 'px'; + + return position; + }; + /** * Get the bubble's label */ diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 849f49c..8419e91 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -55,7 +55,6 @@ white-space: nowrap .bubble - width: 24px height: 7px display: block position: relative From dc67414a8eceff793d956e10fbfe2f49e9841f18 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 16:48:18 +0200 Subject: [PATCH 31/74] tooltips --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 52 +++++++++++++++++------- source/stylesheets/timesheet.sass | 22 ++++++---- 5 files changed, 53 insertions(+), 27 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 02d1ed5..1b9a121 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i');var line=[];line.push(''+content.dateLabel+""),line.push('

        '+content.label+"

        "),html.push(line.join("")),html.push(""),console.log(line)},Bubble=function(options){this.start=options.start,this.end=options.end,this.timesheetYearMin=options.timesheetYearMin,this.timesheetYearMax=options.timesheetYearMax,this.monthOffsetStart=this.getStartOffset(),this.monthOffsetEnd=this.getEndOffset(),this.monthsLength=this.monthOffsetEnd-this.monthOffsetStart,this.link=options.link,this.type=options.type,this.label=options.label,this.present=options.present};Bubble.prototype.getStartOffset=function(){return 12*(this.start.getFullYear()-this.timesheetYearMin)+this.start.getMonth()},Bubble.prototype.getEndOffset=function(){return 12*(this.end.getFullYear()-this.timesheetYearMin)+this.end.getMonth()},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,type,min,max,data){this.type="serial"===type||"parallel"===type?type:"parallel",this.data=[],this.year={min:min,max:max},this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.parse=function(data){for(var n=0;nthis.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:beg,end:end,type:bubbleType,label:label,timesheetYearMin:this.year.min,timesheetYearMax:this.year.max,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.type,this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.year.max>=date.getFullYear()&&this.year.max===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.year.max-this.year.min)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.type?this.generateMarkupParallel():"serial"===this.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"");html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index bc77a73..48da0d1 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.bubble-tooltip{position:absolute;top:1091px;left:200px;background-color:#b99f30;width:200px;display:inline-block;color:#333;text-align:center;padding:6px}.bubble-tooltip-date{color:#000;font-size:14px;font-weight:bold}.bubble-tooltip-label{width:auto;color:#000;margin:0 5px;text-align:center;font-size:14px} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{width:24px;height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;max-width:200px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 7631683..e0dd691 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,k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AE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG,CAE1B,kBAAkB,CAChB,QAAQ,CAAE,QAAQ,CAClB,gBAAgB,CAAE,IAAK,CACvB,SAAS,CAAE,KAAK,CAChB,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,IAAe,CACtB,UAAU,CAAE,MAAM,CAClB,OAAO,CAAE,IAAI,CAEf,uBAAuB,CACrB,KAAK,CAAE,IAAK,CACZ,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,KAAK,CACd,aAAa,CAAE,iBAA4B,CAC3C,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,GAAG,CAEpB,wBAAwB,CACtB,KAAK,CAAE,IAAI,CAEX,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAClB,SAAS,CAAE,IAAI,CAEjB,yBAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 2d29453..1246a87 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -174,7 +174,7 @@ } var line = [ - '' + + '' + startTag + '' + bubble.getDateLabel() + '', '' + bubble.label + '' + endTag @@ -208,7 +208,7 @@ currentBubble = currentList.bubbles[j]; line.push( '
      • ', - '', + '', '
      • ' ); } @@ -298,22 +298,44 @@ var drawTooltip = function(e) { var readAttributes = function(element) { return { - dateLabel:element.getAttribute('data-bubble-date'), - label:element.getAttribute('data-bubble-label') + dateLabel: element.getAttribute('data-bubble-date'), + label: element.getAttribute('data-bubble-label'), + link: element.getAttribute('data-bubble-link') }; }; - var content = readAttributes(e.delegateTarget); - var html = []; - html.push('
        '); - var line = []; - line.push('' + content.dateLabel + ''); - line.push('

        ' + content.label + '

        '); - html.push(line.join('')); - html.push('
        '); - - //document.body.innerHTML += html.join(''); - console.log(line); + var content = readAttributes(e.delegateTarget), + tooltip = document.createElement('div'), + dateLabel = document.createElement('span'), + textLabel, + dateLabelValue = document.createTextNode(content.dateLabel), + labelValue = document.createTextNode(content.label); + + tooltip.className = 'timesheet-tooltip'; + tooltip.id = 'timesheet-tooltip'; + + dateLabel.appendChild(dateLabelValue); + dateLabel.className = 'timesheet-tooltip-date'; + tooltip.appendChild(dateLabel); + + if (content.link) { + textLabel = document.createElement('a'); + textLabel.appendChild(labelValue); + textLabel.title = content.label; + textLabel.href = content.link; + } + else { + textLabel = document.createElement('p'); + textLabel.appendChild(labelValue); + } + + textLabel.className = 'timesheet-tooltip-label'; + tooltip.appendChild(textLabel); + + tooltip.style.left = e.pageX + 'px'; + tooltip.style.top = e.pageY + 'px'; + + document.body.appendChild(tooltip); }; /** diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 4ca9bb4..7f70382 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -145,26 +145,30 @@ margin-right: 0 border-radius: 8px -.bubble-tooltip +.timesheet-tooltip position: absolute - top: 1091px - left: 200px - background-color: rgb(185, 159, 48) - width: 200px + background-color: white + max-width: 200px display: inline-block color: rgb(51, 51, 51) text-align: center - padding: 6px + padding: 10px -.bubble-tooltip-date +.timesheet-tooltip-date color: black font-size: 14px font-weight: bold + display: block + border-bottom: 1px solid rgb(242, 242, 242) + padding-bottom: 5px + margin-bottom: 5px -.bubble-tooltip-label +.timesheet-tooltip-label width: auto - color: black /* text-decoration: underline; cursor: pointer */ margin: 0 5px text-align: center font-size: 14px + +p.timesheet-tooltip-label + color: black From 8384d5f0caa49abcc1ca11196188f3c95f24a9ab Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 17:26:22 +0200 Subject: [PATCH 32/74] don't draw bubble if it doesn't fit within timesheet --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 56 +++++++++++++++++------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 09e5299..25e05c1 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 1a36063..0474a75 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -115,6 +115,26 @@ } }; + /** + * Function for checking whether bubble fits timesheet. + */ + Timesheet.prototype.bubbleFits = function(bubbleStart, bubbleEnd) { + var dateTimesheetStart = new Date('01/01/' + this.options.timesheetYearMin); + var dateTimesheetEnd = new Date('12/31/' + this.options.timesheetYearMax); + + var fits = false; + + if (dateTimesheetStart < bubbleStart && bubbleStart < dateTimesheetEnd) { + fits = true; + } + + if (dateTimesheetEnd > bubbleStart && bubbleEnd > dateTimesheetStart) { + fits = true; + } + + return fits; + }; + /** * Parse data string */ @@ -219,24 +239,26 @@ for (var n = 0; n < this.bubbles.length; n++) { var bubble = this.bubbles[n]; - var position = bubble.getPosition(this); - if (bubble.link !== '') { - startTag =''; - endTag = ''; - } - else { - startTag = ''; - endTag = ''; - } + if (this.bubbleFits(bubble.start, bubble.end)) { + var position = bubble.getPosition(this); + if (bubble.link !== '') { + startTag =''; + endTag = ''; + } + else { + startTag = ''; + endTag = ''; + } - var line = [ - '' + - startTag + - '' + bubble.getDateLabel() + '', - '' + bubble.label + '' + endTag - ].join(''); + var line = [ + '' + + startTag + + '' + bubble.getDateLabel() + '', + '' + bubble.label + '' + endTag + ].join(''); - html.push('
      • ' + line + '
      • '); + html.push('
      • ' + line + '
      • '); + } } this.container.innerHTML += '
          ' + html.join('') + '
        '; @@ -428,7 +450,7 @@ if (this.start.getFullYear() < this.timesheetYearMin) { // Remove the years of difference from start. - offsets.monthStart -= ((this.timesheetYearMin - this.start.getFullYear()) * 12); + offsets.monthStart -= ((this.timesheetYearMin - this.start.getFullYear()) * 12) - this.start.getMonth(); } if (this.end.getFullYear() > this.timesheetYearMax) { From 6cc9e4f35cf011162a3613386bb6918d90936d5d Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 17:41:12 +0200 Subject: [PATCH 33/74] fix timesheet max --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 25e05c1..926416b 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 0474a75..6b503f5 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -455,7 +455,7 @@ if (this.end.getFullYear() > this.timesheetYearMax) { // Round it to the end of the year by removing 1 year from offset. - offsets.monthEnd -= ((this.end.getFullYear() - this.timesheetYearMax - 1) * 12); + offsets.monthEnd -= ((this.end.getFullYear() - this.timesheetYearMax - 1) * 12) + this.end.getMonth(); } return offsets; From 9ac908b8888ddd5bc6ed95d2d833efde4449641f Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 17:45:20 +0200 Subject: [PATCH 34/74] x position improved --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 2 +- source/stylesheets/timesheet.sass | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 09e5299..476e6f6 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",tooltip.style.top=e.pageY+"px",document.body.appendChild(tooltip)},Bubble=function(options){this.start=options.start,this.end=options.end,this.timesheetYearMin=options.timesheetYearMin,this.timesheetYearMax=options.timesheetYearMax;var offsets=this.getMonthOffsets();this.monthOffsetStart=offsets.monthStart,this.monthOffsetEnd=offsets.monthEnd,this.monthsLength=this.monthOffsetEnd-this.monthOffsetStart,this.link=options.link,this.type=options.type,this.label=options.label,this.present=options.present};Bubble.prototype.getMonthOffsets=function(){var offsets={};return offsets.monthStart=Math.abs(12*(this.start.getFullYear()-this.timesheetYearMin)+this.start.getMonth()),offsets.monthEnd=Math.abs(12*(this.end.getFullYear()-this.timesheetYearMin)+this.end.getMonth()),this.start.getFullYear()this.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 1eef5ea..f9e22bd 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;max-width:200px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 38f7909..817c7cf 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,I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CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG,CAE1B,kBAAkB,CAChB,QAAQ,CAAE,QAAQ,CAClB,gBAAgB,CAAE,IAAK,CACvB,KAAK,CAAE,KAAK,CACZ,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,IAAe,CACtB,UAAU,CAAE,MAAM,CAClB,OAAO,CAAE,IAAI,CAEf,uBAAuB,CACrB,KAAK,CAAE,IAAK,CACZ,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,KAAK,CACd,aAAa,CAAE,iBAA4B,CAC3C,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,GAAG,CAEpB,wBAAwB,CACtB,KAAK,CAAE,IAAI,CAEX,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAClB,SAAS,CAAE,IAAI,CAEjB,yBAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 1a36063..4e37119 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -389,7 +389,7 @@ textLabel.className = 'timesheet-tooltip-label'; tooltip.appendChild(textLabel); - tooltip.style.left = e.pageX + 'px'; + tooltip.style.left = ((e.pageX + 90 >= document.body.clientWidth) ? (document.body.clientWidth - 181) : ((e.pageX - 90 < 0) ? 0 : (e.pageX - 90))) + 'px'; tooltip.style.top = e.pageY + 'px'; document.body.appendChild(tooltip); diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 76f8e45..dd1a7cd 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -147,7 +147,7 @@ .timesheet-tooltip position: absolute background-color: white - max-width: 200px + width: 160px display: inline-block color: rgb(51, 51, 51) text-align: center From 8767bdf77569324fac2338ba942cc5b58d7f4c4a Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 17:59:44 +0200 Subject: [PATCH 35/74] y position --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 476e6f6..1c9d9d5 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",tooltip.style.top=e.pageY+"px",document.body.appendChild(tooltip)},Bubble=function(options){this.start=options.start,this.end=options.end,this.timesheetYearMin=options.timesheetYearMin,this.timesheetYearMax=options.timesheetYearMax;var offsets=this.getMonthOffsets();this.monthOffsetStart=offsets.monthStart,this.monthOffsetEnd=offsets.monthEnd,this.monthsLength=this.monthOffsetEnd-this.monthOffsetStart,this.link=options.link,this.type=options.type,this.label=options.label,this.present=options.present};Bubble.prototype.getMonthOffsets=function(){var offsets={};return offsets.monthStart=Math.abs(12*(this.start.getFullYear()-this.timesheetYearMin)+this.start.getMonth()),offsets.monthEnd=Math.abs(12*(this.end.getFullYear()-this.timesheetYearMin)+this.end.getMonth()),this.start.getFullYear()this.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 4e37119..694ecf2 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -390,9 +390,14 @@ tooltip.appendChild(textLabel); tooltip.style.left = ((e.pageX + 90 >= document.body.clientWidth) ? (document.body.clientWidth - 181) : ((e.pageX - 90 < 0) ? 0 : (e.pageX - 90))) + 'px'; - tooltip.style.top = e.pageY + 'px'; document.body.appendChild(tooltip); + if (document.body.clientHeight < e.pageY + tooltip.offsetHeight) { + tooltip.style.top = (e.pageY - tooltip.offsetHeight - 5) + 'px'; + } + else { + tooltip.style.top = e.pageY + 'px'; + } }; /** From d57964e7c0c2d4df10cf053664884ec2055e1c38 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 18:03:06 +0200 Subject: [PATCH 36/74] cut off bubbles and increase height on parallel --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/timesheet-advanced.js | 27 ++++++++++++++++++++++-- source/stylesheets/timesheet.sass | 18 ++++++++++++++-- 5 files changed, 44 insertions(+), 7 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 926416b..263ce48 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index 1eef5ea..a681718 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;max-width:200px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .scale section:last-child{border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;max-width:200px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 38f7909..d4ec1fa 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,C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AE,OAAmB,CAK5B,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG,CAE1B,kBAAkB,CAChB,QAAQ,CAAE,QAAQ,CAClB,gBAAgB,CAAE,IAAK,CACvB,SAAS,CAAE,KAAK,CAChB,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,IAAe,CACtB,UAAU,CAAE,MAAM,CAClB,OAAO,CAAE,IAAI,CAEf,uBAAuB,CACrB,KAAK,CAAE,IAAK,CACZ,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,KAAK,CACd,aAAa,CAAE,iBAA4B,CAC3C,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,GAAG,CAEpB,wBAAwB,CACtB,KAAK,CAAE,IAAI,CAEX,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAClB,SAAS,CAAE,IAAI,CAEjB,yBAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 6b503f5..14f2667 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -250,8 +250,17 @@ endTag = '
        '; } + var bubbleClasses = ['bubble', 'bubble-' + bubble.type]; + if (bubble.startedBeforeTimesheet) { + bubbleClasses.push('bubble--started-before'); + } + + if (bubble.endedAfterTimesheet) { + bubbleClasses.push('bubble--ended-after'); + } + var line = [ - '' + + '' + startTag + '' + bubble.getDateLabel() + '', '' + bubble.label + '' + endTag @@ -285,9 +294,18 @@ for (j = 0; j < currentList.bubbles.length; j++) { currentBubble = currentList.bubbles[j]; var position = currentBubble.getPosition(this); + var bubbleClasses = ['bubble', 'bubble-' + currentBubble.type]; + if (currentBubble.startedBeforeTimesheet) { + bubbleClasses.push('bubble--started-before'); + } + + if (currentBubble.endedAfterTimesheet) { + bubbleClasses.push('bubble--ended-after'); + } + line.push( '
      • ', - '', + '', '
      • ' ); } @@ -427,6 +445,9 @@ this.timesheetYearMin = options.timesheetYearMin; this.timesheetYearMax = options.timesheetYearMax; + this.startedBeforeTimesheet = false; + this.endedAfterTimesheet = false; + var offsets = this.getMonthOffsets(); this.monthOffsetStart = offsets.monthStart; this.monthOffsetEnd = offsets.monthEnd; @@ -450,11 +471,13 @@ if (this.start.getFullYear() < this.timesheetYearMin) { // Remove the years of difference from start. + this.startedBeforeTimesheet = true; offsets.monthStart -= ((this.timesheetYearMin - this.start.getFullYear()) * 12) - this.start.getMonth(); } if (this.end.getFullYear() > this.timesheetYearMax) { // Round it to the end of the year by removing 1 year from offset. + this.endedAfterTimesheet = true; offsets.monthEnd -= ((this.end.getFullYear() - this.timesheetYearMax - 1) * 12) + this.end.getMonth(); } diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 76f8e45..f205380 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -42,6 +42,9 @@ border-left: 1px dashed rgba(250, 250, 250, 0.2) height: 100% + &:last-child + border-right: 1px dashed rgba(250, 250, 250, 0.2) + .date color: rgba(181, 181, 181, 1) font-size: 14px @@ -55,14 +58,22 @@ white-space: nowrap .bubble - height: 7px + height: 10px display: block position: relative top: 7px - border-radius: 4px + border-radius: 5px margin: 0 10px 6px 0 opacity: 0.7 + &.bubble--started-before + border-top-left-radius: 0 !important + border-bottom-left-radius: 0 !important + + &.bubble--ended-after + border-top-right-radius: 0 !important + border-bottom-right-radius: 0 !important + .data margin: 28px 0 0 0 padding: 0 @@ -98,6 +109,9 @@ color: rgba(50, 50, 50, 0.8) border-left: 1px dashed rgba(50, 50, 50, 0.1) + &:last-child + border-right: 1px dashed rgba(50, 50, 50, 0.1) + .data li .date From 8e5876ced993fc7f7c9949c87c0663ca435f8df1 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Tue, 21 Jul 2015 18:05:13 +0200 Subject: [PATCH 37/74] fix width (scrollbar appears) because of right border on section --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/timesheet.sass | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index a681718..9f8ac33 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .scale section:last-child{border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;max-width:200px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .scale section:last-child{width:118px;border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;max-width:200px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index d4ec1fa..080a3cc 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CAC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sB,CAE/B,2CAAM,CACJ,KAAK,CAAE,OAAmB,CAK5B,4CAAK,CACH,OAAO,CAAE,IAAI,CAEf,6CAAM,CACJ,YAAY,CAAE,CAAC,CAEvB,4BAAiB,CACf,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,iBAAiB,CAGjC,0BAAO,CACL,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CAEN,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG,CAE1B,kBAAkB,CAChB,QAAQ,CAAE,QAAQ,CAClB,gBAAgB,CAAE,IAAK,CACvB,SAAS,CAAE,KAAK,CAChB,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,IAAe,CACtB,UAAU,CAAE,MAAM,CAClB,OAAO,CAAE,IAAI,CAEf,uBAAuB,CACrB,KAAK,CAAE,IAAK,CACZ,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,KAAK,CACd,aAAa,CAAE,iBAA4B,CAC3C,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,GAAG,CAEpB,wBAAwB,CACtB,KAAK,CAAE,IAAI,CAEX,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAClB,SAAS,CAAE,IAAI,CAEjB,yBAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index f205380..d1b620a 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -43,6 +43,7 @@ height: 100% &:last-child + width: 118px border-right: 1px dashed rgba(250, 250, 250, 0.2) .date From e98bcfa4b815f3c616e4bd16c478ef1b7531b015 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 18:22:17 +0200 Subject: [PATCH 38/74] styles improved --- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/stylesheets/style.sass | 2 +- source/stylesheets/timesheet.sass | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index f9e22bd..e1ea46e 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#000;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#000} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.timesheet--white .timesheet-tooltip{background-color:#333;color:#fff}.timesheet--white .timesheet-tooltip-date{color:#fff}.timesheet--white p.timesheet-tooltip-label{color:#fff} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 817c7cf..8f81d48 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEhB,gBAAK,CACH,KAAK,CAAE,OAAsB,CAC7B,SAAS,CAAE,IAAI,CAEjB,iBAAM,CACJ,WAAW,CAAE,OAAO,CACpB,SAAS,CAAE,IAAI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AClB,SAAS,CAAE,IAAI,CAEjB,yBAAyB,CACvB,KAAK,CAAE,IAAe,CAGtB,oCAAkB,CAChB,gBAAgB,CAAE,IAAe,CACjC,KAAK,CAAE,IAAK,CAEd,yCAAuB,CACrB,KAAK,CAAE,IAAK,CAEd,2CAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/stylesheets/style.sass b/source/stylesheets/style.sass index 49a6e98..440ed2f 100644 --- a/source/stylesheets/style.sass +++ b/source/stylesheets/style.sass @@ -2,7 +2,7 @@ html, body margin: 0 - padding: 0 + padding: 10px width: 100% * diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index dd1a7cd..62c7450 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -154,7 +154,7 @@ padding: 10px .timesheet-tooltip-date - color: black + color: rgb(51, 51, 51) font-size: 14px font-weight: bold display: block @@ -164,7 +164,6 @@ .timesheet-tooltip-label width: auto - /* text-decoration: underline; cursor: pointer */ margin: 0 5px text-align: center font-size: 14px From 69fca86f6d24b817376e47afddd9d7296fffe33b Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 18:22:28 +0200 Subject: [PATCH 39/74] changed examples --- source/index.haml | 4 ++- source/javascripts/main.js | 59 +++++++++++++++++++-------------- source/snippets/example-date.js | 29 ++++++++-------- 3 files changed, 53 insertions(+), 39 deletions(-) diff --git a/source/index.haml b/source/index.haml index a2f788c..f22e8db 100644 --- a/source/index.haml +++ b/source/index.haml @@ -38,8 +38,10 @@ %pre!=code %p Parallel mode example #timesheet-default - %p Projects timeline - serial mode example + %p Serial mode example #timesheet-projects + %p Light mode example + #timesheet-white %p %span Fork Timesheet.js on GitHub diff --git a/source/javascripts/main.js b/source/javascripts/main.js index d1b4671..4a29ec1 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -7,42 +7,51 @@ /* jshint -W031 */ new Timesheet( [ - // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] - // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory - ['2002', '09/2002', 'A freaking awesome time', 'red', ''], - ['06/2002', '09/2003', 'Some great memories', 'blue', ''], - ['2003', '', 'Had very bad luck', '', ''], - ['10/2003', '2006', 'At least had fun', 'yellow', ''], - ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], - ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], - ['10/2005', '2008', 'For a long time nothing happened', 'red', 'http://www.google.com'], - ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], - ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], - ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], - ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] + ['2002', '09/2002', 'First project', 'red', ''], + ['06/2002', '09/2003', 'Second project', 'blue', ''], + ['2003', '', 'Still working on', '', ''], + ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['02/2005', '05/2006', 'Green project', 'green', '#'], + ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] ], { container: 'timesheet-default', type: 'parallel', timesheetYearMin: 2002, - timesheetYearMax: 2011 + timesheetYearMax: 2008 }); - new Timesheet([ - // example 1: ['2002', '09/2002', 'A freaking awesome time', 'red', 'www.example.com'] - // example 2: ['2002', '', 'A freaking awesome time', '', ''] - 5 parameters required, start and label are obligatory - ['2010', '', 'Slickguns', 'red', 'www.slickguns.com'], - ['2011', '', 'Wikiarms', 'blue', 'www.wikairms.com'], - ['09/2014', '03/2015', 'Gateway15', '', ''], - ['05/2015', '06/2015', 'Feedback collect', 'green', ''], - ['03/2012', '', 'Lorem ipsum', 'yellow', ''] + new Timesheet( + [ + ['2002', '09/2002', 'First project', 'red', ''], + ['06/2002', '09/2003', 'Second project', 'blue', ''], + ['2003', '', 'Still working on', '', ''], + ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['02/2005', '05/2006', 'Green project', 'green', '#'], + ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] ], { container: 'timesheet-projects', type: 'serial', - timesheetYearMin: 2010, - timesheetYearMax: 2015, - extraClass: 'test' + timesheetYearMin: 2002, + timesheetYearMax: 2008 + }); + + new Timesheet( + [ + ['2002', '09/2002', 'First project', 'red', ''], + ['06/2002', '09/2003', 'Second project', 'blue', ''], + ['2003', '', 'Still working on', '', ''], + ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['02/2005', '05/2006', 'Green project', 'green', '#'], + ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] + ], + { + container: 'timesheet-white', + type: 'serial', + timesheetYearMin: 2002, + timesheetYearMax: 2008, + extraClass: 'timesheet--white' }); }); })(); diff --git a/source/snippets/example-date.js b/source/snippets/example-date.js index 111782f..676e3b3 100644 --- a/source/snippets/example-date.js +++ b/source/snippets/example-date.js @@ -1,13 +1,16 @@ -new Timesheet('timesheet-default', 'parallel', 2002, 2011, [ - ['2002', '09/2002', 'A freaking awesome time', 'red', ''], - ['06/2002', '09/2003', 'Some great memories', 'blue', ''], - ['2003', '', 'Had very bad luck', '', ''], - ['10/2003', '2006', 'At least had fun', 'yellow', ''], - ['02/2005', '05/2006', 'Enjoyed those times as well', 'green', '#'], - ['07/2005', '09/2005', 'Bad luck again', 'purple', '#'], - ['10/2005', '2008', 'For a long time nothing happened', 'red', 'http://www.google.com'], - ['01/2008', '05/2009', 'LOST Season #4', 'yellow', ''], - ['01/2009', '05/2009', 'LOST Season #4', 'red', ''], - ['02/2010', '05/2010', 'LOST Season #5', 'blue', ''], - ['09/2008', '06/2010', 'Just include Timesheet.js and configure your data. No external dependencies, no jQuery ', 'blue', ''] -]); +new Timesheet( + [ + ['2002', '09/2002', 'First project', 'red', ''], + ['06/2002', '09/2003', 'Second project', 'blue', ''], + ['2003', '', 'Still working on', '', ''], + ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['02/2005', '05/2006', 'Green project', 'green', '#'], + ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] + ], + { + container: 'timesheet-default', // container ID + type: 'parallel', // can also be 'serial' + timesheetYearMin: 2002, + timesheetYearMax: 2011 + // extraClass: try 'timesheet--white' or 'timesheet--no-date' + }); From f4d946869c1d565035e8a0926eb24c8d68ecd462 Mon Sep 17 00:00:00 2001 From: Jelena Date: Tue, 21 Jul 2015 18:22:40 +0200 Subject: [PATCH 40/74] white mode --- source/stylesheets/timesheet.sass | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 62c7450..0927b33 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -169,4 +169,15 @@ font-size: 14px p.timesheet-tooltip-label - color: black + color: rgb(51, 51, 51) + +.timesheet--white + .timesheet-tooltip + background-color: rgb(51, 51, 51) + color: white + + .timesheet-tooltip-date + color: white + + p.timesheet-tooltip-label + color: white From 9b0a6984b325393031996ad2f226888e2e5588cd Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Wed, 22 Jul 2015 11:05:44 +0200 Subject: [PATCH 41/74] X axis scroll mousewheel --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 27 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 263ce48..219f421 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip)),this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1)):(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip)))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 14f2667..d6270f9 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -201,7 +201,18 @@ // Elements on which to detect click event. var bubbleFilter = function(elem) {return hasClass(elem, 'bubble');}; - this.container.addEventListener('click', delegate(bubbleFilter, drawTooltip)); + + if (this.container.addEventListener) { + this.container.addEventListener('click', delegate(bubbleFilter, drawTooltip)); + // IE9, Chrome, Safari, Opera + this.container.addEventListener('mousewheel', timesheetScrollbar, false); + // Firefox + this.container.addEventListener('DOMMouseScroll', timesheetScrollbar, false); + } else { + // IE 6/7/8 + this.container.attachEvent('onmousewheel', timesheetScrollbar); + this.container.attachEvent('click', delegate(bubbleFilter, drawTooltip)); + } }; /** @@ -228,6 +239,20 @@ return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1; }; + /** + * Scroll timesheet on X axis if it doesn't fit. + */ + var timesheetScrollbar = function(e) { + e = window.event || e; + var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); + this.scrollLeft -= (delta * 40); // Multiplied by 40 + + // Prevent body scroll only if scrollLeft is between the content (scrollLeft is not at the start or end). + if (this.scrollLeft > 0 && (this.scrollWidth - this.scrollLeft !== this.offsetWidth)) { + e.preventDefault(); + } + }; + /** * Generate parallel markup. */ From ed5a7748969d4435112c0c2fa1d2a38331fc9504 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Wed, 22 Jul 2015 11:10:07 +0200 Subject: [PATCH 42/74] Param to prevent binding scroll on X axis --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 219f421..84d8969 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip)),this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1)):(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip)))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip)))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;ithis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index d6270f9..0675016 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -61,7 +61,8 @@ extraClass: '', showDate: true, timesheetYearMin: null, - timesheetYearMax: null + timesheetYearMax: null, + scrollX: true }; return merge(defaults, options); @@ -204,14 +205,19 @@ if (this.container.addEventListener) { this.container.addEventListener('click', delegate(bubbleFilter, drawTooltip)); - // IE9, Chrome, Safari, Opera - this.container.addEventListener('mousewheel', timesheetScrollbar, false); - // Firefox - this.container.addEventListener('DOMMouseScroll', timesheetScrollbar, false); + + if (this.options.scrollX) { + // IE9, Chrome, Safari, Opera + this.container.addEventListener('mousewheel', timesheetScrollbar, false); + // Firefox + this.container.addEventListener('DOMMouseScroll', timesheetScrollbar, false); + } } else { - // IE 6/7/8 - this.container.attachEvent('onmousewheel', timesheetScrollbar); - this.container.attachEvent('click', delegate(bubbleFilter, drawTooltip)); + if (this.options.scrollX) { + // IE 6/7/8 + this.container.attachEvent('onmousewheel', timesheetScrollbar); + this.container.attachEvent('click', delegate(bubbleFilter, drawTooltip)); + } } }; From cf2d1fdd4085ca4e959583b123b6edcaad05c54d Mon Sep 17 00:00:00 2001 From: Jelena Date: Wed, 22 Jul 2015 11:23:14 +0200 Subject: [PATCH 43/74] dark tooltips --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- source/javascripts/main.js | 2 +- source/javascripts/timesheet-advanced.js | 8 ++++++-- source/snippets/example-date.js | 4 +++- source/stylesheets/timesheet.sass | 7 ++++++- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 1c9d9d5..53d50b9 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip))};var delegate=function(criteria,listener){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index e1ea46e..542b8fa 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.timesheet--white .timesheet-tooltip{background-color:#333;color:#fff}.timesheet--white .timesheet-tooltip-date{color:#fff}.timesheet--white p.timesheet-tooltip-label{color:#fff} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:7px;display:block;position:relative;top:7px;border-radius:4px;margin:0 10px 6px 0;opacity:0.7}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0;width:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip.theme--dark{background-color:#333;color:#fff}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.theme--dark .timesheet-tooltip{background-color:#333;color:#fff}.theme--dark .timesheet-tooltip-date{color:#fff}.theme--dark p.timesheet-tooltip-label{color:#fff} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 8f81d48..bd6af00 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAA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kB,CAChB,gBAAgB,CAAE,IAAe,CACjC,KAAK,CAAE,IAAK,CAEd,oCAAuB,CACrB,KAAK,CAAE,IAAK,CAEd,sCAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 4a29ec1..8e0b56c 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -51,7 +51,7 @@ type: 'serial', timesheetYearMin: 2002, timesheetYearMax: 2008, - extraClass: 'timesheet--white' + theme: 'light' }); }); })(); diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 694ecf2..b139409 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -181,13 +181,13 @@ // Elements on which to detect click event. var bubbleFilter = function(elem) {return hasClass(elem, 'bubble');}; - this.container.addEventListener('click', delegate(bubbleFilter, drawTooltip)); + this.container.addEventListener('click', delegate(bubbleFilter, drawTooltip, this.options.theme)); }; /** * Helper function for setting event handler to elements that satisfy criteria. */ - var delegate = function(criteria, listener) { + var delegate = function(criteria, listener, theme) { return function(e) { var el = e.target; do { @@ -195,6 +195,7 @@ continue; } e.delegateTarget = el; + e.theme = theme; listener.apply(this, arguments); return; } while((el = el.parentNode)); @@ -369,6 +370,9 @@ labelValue = document.createTextNode(content.label); tooltip.className = 'timesheet-tooltip'; + if (e.theme === 'light') { + tooltip.className += ' theme--dark'; + } tooltip.id = 'timesheet-tooltip'; dateLabel.appendChild(dateLabelValue); diff --git a/source/snippets/example-date.js b/source/snippets/example-date.js index 676e3b3..2f7f341 100644 --- a/source/snippets/example-date.js +++ b/source/snippets/example-date.js @@ -12,5 +12,7 @@ new Timesheet( type: 'parallel', // can also be 'serial' timesheetYearMin: 2002, timesheetYearMax: 2011 - // extraClass: try 'timesheet--white' or 'timesheet--no-date' + // extraClass: add extra classes + // theme: 'dark' or 'light' + // showDate: true - show date in label }); diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 0927b33..f5112e6 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -135,6 +135,7 @@ display: block position: absolute top: 0 + width: 0 .info-wrapper display: none @@ -153,6 +154,10 @@ text-align: center padding: 10px + &.theme--dark + background-color: rgb(51, 51, 51) + color: white + .timesheet-tooltip-date color: rgb(51, 51, 51) font-size: 14px @@ -171,7 +176,7 @@ p.timesheet-tooltip-label color: rgb(51, 51, 51) -.timesheet--white +.theme--dark .timesheet-tooltip background-color: rgb(51, 51, 51) color: white From a2a589e584808c2a1a4a931f8bb01c020e24f4c1 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Wed, 22 Jul 2015 11:41:08 +0200 Subject: [PATCH 44/74] Introduce light parameter to constructor and change classes' names --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- source/javascripts/timesheet-advanced.js | 4 ++++ source/stylesheets/timesheet.sass | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 47dcd6a..83eeba0 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.theme.length&&(this.container.className+=" timesheet--"+this.options.theme),this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index b5a3d90..ca6ded7 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .scale section:last-child{width:118px;border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--white{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--white .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--white .bubble-default{background-color:#141414}.timesheet.timesheet--white .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--white .data li .date{color:#797979}.timesheet.timesheet--white .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0;width:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip.theme--dark{background-color:#333;color:#fff}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.theme--dark .timesheet-tooltip{background-color:#333;color:#fff}.theme--dark .timesheet-tooltip-date{color:#fff}.theme--dark p.timesheet-tooltip-label{color:#fff} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .scale section:last-child{width:118px;border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--light{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--light .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--light .bubble-default{background-color:#141414}.timesheet.timesheet--light .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--light .scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--light .data li .date{color:#797979}.timesheet.timesheet--light .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0;width:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip.theme--dark{background-color:#333;color:#fff}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.theme--dark .timesheet-tooltip{background-color:#333;color:#fff}.theme--dark .timesheet-tooltip-date{color:#fff}.theme--dark p.timesheet-tooltip-label{color:#fff} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index e684d51..fef6018 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -165,6 +165,10 @@ this.container.className = 'timesheet ' + 'timesheet--' + this.options.type; + if (this.options.theme.length) { + this.container.className += ' timesheet--' + this.options.theme; + } + if (this.options.extraClass.length) { this.container.className += ' ' + this.options.extraClass; } diff --git a/source/stylesheets/timesheet.sass b/source/stylesheets/timesheet.sass index 830f010..5b91131 100644 --- a/source/stylesheets/timesheet.sass +++ b/source/stylesheets/timesheet.sass @@ -95,7 +95,7 @@ .bubble opacity: 1 - &.timesheet--white + &.timesheet--light border-top: 1px solid rgba(60, 60, 60, 0.3) background-color: rgba(251, 251, 251, 1) From 32c03aba3be1c11f6eb64fedffd32664b8edaa91 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Wed, 22 Jul 2015 11:49:42 +0200 Subject: [PATCH 45/74] bower.json update --- bower.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 2bdc9ee..e4e79b6 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,11 @@ { - "name": "timesheet.js", - "homepage": "https://sbstjn.github.io/timesheet.js/", + "name": "timesheet-advanced.js", + "homepage": "https://github.com/ntucakovic/timesheet-advanced.js", "authors": [ - "sbstjn " + "Jelena ", + "Nikola " ], - "description": "With Timesheet.js you can easily create simple time and data sheets or timelines using HTML5, JavaScript and CSS3. Yep, it's a Vanilla JS library!", + "description": "Timesheet-advanced.js is improved version of timesheet.js plugin with more functionality and more customization options.", "main": ["dist/timesheet.min.js", "dist/timesheet.min.css"], "moduleType": [ "amd" @@ -12,6 +13,7 @@ "keywords": [ "timeline", "timesheet", + "timesheet-advanced", "timebar", "line", "bar", From 291c81a6b1eaecc4d9ce8dedd43ff953ff3fd838 Mon Sep 17 00:00:00 2001 From: Jelena Date: Wed, 22 Jul 2015 12:05:16 +0200 Subject: [PATCH 46/74] api docs --- dist/timesheet-advanced.min.js | 2 +- source/javascripts/timesheet-advanced.js | 67 ++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index 47dcd6a..2d921bf 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip,this.options.theme)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index e684d51..bd14e05 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -3,9 +3,15 @@ (function() { 'use strict'; + /** + * Merges two (or more) objects, giving the last one precedence. + * + * @param {Object} target Target object. + * @param {Object} source Source object. + * + * @return {Object} target Combined object. + */ function merge(target, source) { - /* Merges two (or more) objects, - giving the last one precedence */ if ( typeof target !== 'object' ) { target = {}; } @@ -32,6 +38,10 @@ /** * Initialize Timesheet object. + * @constructor + * + * @param {Array} data List of inputs. + * @param {Object} options Configuration options. */ var Timesheet = function(data, options) { this.options = this.mergeWithDefault(options); @@ -52,6 +62,10 @@ /** * Set default options and merge them with passed ones. + * + * @param {Object} options Configuration options given. + * + * @return {Object} options Combination of given and default options. */ Timesheet.prototype.mergeWithDefault = function(options) { var defaults = { @@ -70,6 +84,8 @@ /** * Parse timesheet data. + * + * @param {Array} data List of data for generating bubbles. */ Timesheet.prototype.parse = function(data) { var overrideTimesheetMin = this.options.timesheetYearMin === null; @@ -118,6 +134,11 @@ /** * Function for checking whether bubble fits timesheet. + * + * @param {date} bubbleStart Beginning date for a bubble. + * @param {date} bubbleEnd Ending date for a bubble. + * + * @return {boolean} fits. */ Timesheet.prototype.bubbleFits = function(bubbleStart, bubbleEnd) { var dateTimesheetStart = new Date('01/01/' + this.options.timesheetYearMin); @@ -137,7 +158,7 @@ }; /** - * Parse data string + * Parse date string */ Timesheet.prototype.parseDate = function(date) { if (date.indexOf('/') === -1) { @@ -217,13 +238,17 @@ if (this.options.scrollX) { // IE 6/7/8 this.container.attachEvent('onmousewheel', timesheetScrollbar); - this.container.attachEvent('click', delegate(bubbleFilter, drawTooltip)); + this.container.attachEvent('click', delegate(bubbleFilter, drawTooltip, this.options.theme)); } } }; /** * Helper function for setting event handler to elements that satisfy criteria. + * + * @param {function} criteria Function that selects elements for which to register click event. + * @param {function} listener Function that responds to click event. + * @param {string} theme Color theme for the tooltip. */ var delegate = function(criteria, listener, theme) { return function(e) { @@ -242,6 +267,11 @@ /** * Helper function for checking if element has class. + * + * @param {Object} element + * @param {string} cls Class name. + * + * @return {boolean} True if element has given class. */ var hasClass = function(element, cls) { return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1; @@ -249,6 +279,8 @@ /** * Scroll timesheet on X axis if it doesn't fit. + * + * @param {Object} e Scroll event. */ var timesheetScrollbar = function(e) { e = window.event || e; @@ -354,6 +386,8 @@ /** * Helper function for building bubble lists on serial timesheet view. + * + * @return {Array} Lists of bubbles. */ Timesheet.prototype.buildSerialBubbleLists = function() { var i, j; @@ -400,6 +434,10 @@ /** * Wrapper for adding bubbles. + * + * @param {Object} options Bubble options. + * + * @return {Object} New bubble. */ Timesheet.prototype.createBubble = function(options) { // If end isn't defined, it means that the bubble is still active, so copy min value between current date and ending year that's set up in constructor. @@ -424,6 +462,8 @@ /** * Show tooltip for given mouse event. + * + * @param {Object} e Mouse event. */ var drawTooltip = function(e) { var readAttributes = function(element) { @@ -478,6 +518,9 @@ /** * Timesheet Bubble. + * @constructor + * + * @param {Object} options Bubble options. */ var Bubble = function(options) { this.start = options.start; @@ -503,6 +546,8 @@ /** * Get month offsets for start and end of bubbles. + * + * @return {Object} offsets Month offsets. */ Bubble.prototype.getMonthOffsets = function() { var offsets = {}; @@ -527,6 +572,10 @@ /** * Format month number + * + * @param {int} num + * + * @return {string} num. */ Bubble.prototype.formatMonth = function(num) { num = parseInt(num, 10); @@ -536,6 +585,10 @@ /** * Get bubble's width in pixel + * + * @param {int} widthYear + * + * @return {number} Bubble width. */ Bubble.prototype.getWidth = function(widthYear) { return (widthYear/12) * this.monthsLength; @@ -543,6 +596,10 @@ /** * Returns bubble pixel dimensions and left offset. + * + * @param {Object} timesheet Timesheet object. + * + * @return {Object} position Width and offset of a bubble. */ Bubble.prototype.getPosition = function(timesheet) { var position = {}; @@ -555,6 +612,8 @@ /** * Get the bubble's label + * + * @return {string} Bubble label. */ Bubble.prototype.getDateLabel = function() { return [ From f5e226ace88c992fea6065b9172b444f1975be68 Mon Sep 17 00:00:00 2001 From: Jelena Date: Wed, 22 Jul 2015 12:11:08 +0200 Subject: [PATCH 47/74] examples --- source/javascripts/main.js | 12 ++++++------ source/snippets/example-date.js | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/source/javascripts/main.js b/source/javascripts/main.js index 8e0b56c..5314e10 100644 --- a/source/javascripts/main.js +++ b/source/javascripts/main.js @@ -10,9 +10,9 @@ ['2002', '09/2002', 'First project', 'red', ''], ['06/2002', '09/2003', 'Second project', 'blue', ''], ['2003', '', 'Still working on', '', ''], - ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['10/2003', '2006', 'Yellow project', 'yellow', 'http://www.example.com'], ['02/2005', '05/2006', 'Green project', 'green', '#'], - ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] + ['07/2005', '09/2005', 'The shortest project', 'purple', '#'] ], { container: 'timesheet-default', @@ -26,9 +26,9 @@ ['2002', '09/2002', 'First project', 'red', ''], ['06/2002', '09/2003', 'Second project', 'blue', ''], ['2003', '', 'Still working on', '', ''], - ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['10/2003', '2006', 'Yellow project', 'yellow', 'http://www.example.com'], ['02/2005', '05/2006', 'Green project', 'green', '#'], - ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] + ['07/2005', '09/2005', 'The shortest project', 'purple', '#'] ], { container: 'timesheet-projects', @@ -42,9 +42,9 @@ ['2002', '09/2002', 'First project', 'red', ''], ['06/2002', '09/2003', 'Second project', 'blue', ''], ['2003', '', 'Still working on', '', ''], - ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['10/2003', '2006', 'Yellow project', 'yellow', 'http://www.example.com'], ['02/2005', '05/2006', 'Green project', 'green', '#'], - ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] + ['07/2005', '09/2005', 'The shortest project', 'purple', '#'] ], { container: 'timesheet-white', diff --git a/source/snippets/example-date.js b/source/snippets/example-date.js index 2f7f341..b20b129 100644 --- a/source/snippets/example-date.js +++ b/source/snippets/example-date.js @@ -3,16 +3,17 @@ new Timesheet( ['2002', '09/2002', 'First project', 'red', ''], ['06/2002', '09/2003', 'Second project', 'blue', ''], ['2003', '', 'Still working on', '', ''], - ['10/2003', '2006', 'Example project', 'yellow', 'http://www.example.com'], + ['10/2003', '2006', 'Yellow project', 'yellow', 'http://www.example.com'], ['02/2005', '05/2006', 'Green project', 'green', '#'], - ['07/2005', '09/2005', 'Most recent project', 'purple', '#'] + ['07/2005', '09/2005', 'The shortest project', 'purple', '#'] ], { container: 'timesheet-default', // container ID type: 'parallel', // can also be 'serial' timesheetYearMin: 2002, - timesheetYearMax: 2011 - // extraClass: add extra classes + timesheetYearMax: 2008 + // extraClass: add custom classes // theme: 'dark' or 'light' - // showDate: true - show date in label + // showDate: true or false - show or hide date in label + // scrollX: true or false - allow or prevent horizontal scroll of timesheet on mouse wheel }); From 018fe3adba8b172d7dfee235ce8702611520933b Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Wed, 22 Jul 2015 13:06:24 +0200 Subject: [PATCH 48/74] Remove timesheet.js and disable test for the time being --- Gruntfile.js | 28 ++-- dist/timesheet-advanced.min.js | 2 +- source/index.haml | 4 +- source/javascripts/timesheet-advanced.js | 6 +- source/javascripts/timesheet.js | 181 ----------------------- test/timesheet.js | 2 +- 6 files changed, 20 insertions(+), 203 deletions(-) delete mode 100644 source/javascripts/timesheet.js diff --git a/Gruntfile.js b/Gruntfile.js index e2b49e1..b84a370 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,7 +10,6 @@ module.exports = function(grunt) { }, my_target: { files: { - 'dist/timesheet.min.js': ['source/javascripts/timesheet.js'], 'dist/timesheet-advanced.min.js': ['source/javascripts/timesheet-advanced.js'] } } @@ -43,17 +42,17 @@ module.exports = function(grunt) { } } }, - simplemocha: { - options: { - globals: ['should'], - timeout: 3000, - ignoreLeaks: false, - grep: '', - ui: 'tdd', - reporter: 'spec' - }, - all: { src: ['test/**/*.js'] } - }, + //simplemocha: { + // options: { + // globals: ['should'], + // timeout: 3000, + // ignoreLeaks: false, + // grep: '', + // ui: 'tdd', + // reporter: 'spec' + // }, + // all: { src: ['test/**/*.js'] } + //}, express: { options: { port: 8080 @@ -123,8 +122,9 @@ module.exports = function(grunt) { // Default task grunt.registerTask('default', ['build']); - grunt.registerTask('build', ['simplemocha', 'jshint', 'uglify', 'sass']); - grunt.registerTask('server', ['express:dev', 'watch' ]) + //grunt.registerTask('build', ['simplemocha', 'jshint', 'uglify', 'sass']); + grunt.registerTask('build', ['jshint', 'uglify', 'sass']); + grunt.registerTask('server', ['express:dev', 'watch' ]); grunt.registerTask('gh', ['build', 'haml:gh', 'sass:gh', 'copy:gh']); }; diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index eaf371d..e48483b 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.theme.length&&(this.container.className+=" timesheet--"+this.options.theme),this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip,this.options.theme)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link,present:!1}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.theme.length&&(this.container.className+=" timesheet--"+this.options.theme),this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip,this.options.theme)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/index.haml b/source/index.haml index f22e8db..4b97230 100644 --- a/source/index.haml +++ b/source/index.haml @@ -8,7 +8,7 @@ %meta{property: 'og:title', content: 'timesheet-advanced.js - Beautiful time tables with HTML, JavaScript and CSS …'} %meta{property: 'og:description', content: 'With timesheet-advanced.js you can easily create simple time and data sheets or timelines using HTML5, JavaScript and CSS3. Yep, it\'s a Vanilla JS library!'} - %meta{property: 'og:url', content: 'https://github.com/ntucakovic/timesheet.js'} + %meta{property: 'og:url', content: 'https://github.com/ntucakovic/timesheet-advanced.js'} %meta{property: 'og:image', content: 'https://raw.githubusercontent.com/sbstjn/timesheet.js/master/screen.png'} %meta{property: 'fb:admins', content: '669118929'} @@ -44,5 +44,5 @@ #timesheet-white %p - %span Fork Timesheet.js on GitHub + %span Fork Timesheet.js on GitHub %script{type: 'text/javascript'} var _gauges = _gauges || []; (function() { var t = document.createElement('script'); t.type = 'text/javascript'; t.async = true; t.id = 'gauges-tracker'; t.setAttribute('data-site-id', '538272a38bfdf705f50037c3'); t.src = '//secure.gaug.es/track.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(t, s); })(); diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index be1d6f2..94e02e6 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -126,7 +126,8 @@ label: label, timesheetYearMin: this.options.timesheetYearMin, timesheetYearMax: this.options.timesheetYearMax, - link: link + link: link, + present: false }) ); } @@ -457,9 +458,6 @@ } options.present = true; } - else { - options.present = false; - } return new Bubble(options); }; diff --git a/source/javascripts/timesheet.js b/source/javascripts/timesheet.js deleted file mode 100644 index 5302331..0000000 --- a/source/javascripts/timesheet.js +++ /dev/null @@ -1,181 +0,0 @@ -(function() { - 'use strict'; - - /** - * Initialize a Timesheet - */ - var Timesheet = function(container, min, max, data) { - this.data = []; - this.year = { - min: min, - max: max - }; - - this.parse(data || []); - - if (typeof document !== 'undefined') { - this.container = (typeof container === 'string') ? document.querySelector('#'+container) : container; - this.drawSections(); - this.insertData(); - } - }; - - /** - * Insert data into Timesheet - */ - Timesheet.prototype.insertData = function() { - var html = []; - var widthMonth = this.container.querySelector('.scale section').offsetWidth; - - for (var n = 0, m = this.data.length; n < m; n++) { - var cur = this.data[n]; - var bubble = this.createBubble(widthMonth, this.year.min, cur.start, cur.end); - - var line = [ - '', - '' + bubble.getDateLabel() + ' ', - '' + cur.label + '' - ].join(''); - - html.push('
      • ' + line + '
      • '); - } - - this.container.innerHTML += '
          ' + html.join('') + '
        '; - }; - - /** - * Draw section labels - */ - Timesheet.prototype.drawSections = function() { - var html = []; - - for (var c = this.year.min; c <= this.year.max; c++) { - html.push('
        ' + c + '
        '); - } - - this.container.className = 'timesheet color-scheme-default'; - this.container.innerHTML = '
        ' + html.join('') + '
        '; - }; - - /** - * Parse data string - */ - Timesheet.prototype.parseDate = function(date) { - if (date.indexOf('/') === -1) { - date = new Date(parseInt(date, 10), 0, 1); - date.hasMonth = false; - } else { - date = date.split('/'); - date = new Date(parseInt(date[1], 10), parseInt(date[0], 10)-1, 1); - date.hasMonth = true; - } - - return date; - }; - - /** - * Parse passed data - */ - Timesheet.prototype.parse = function(data) { - for (var n = 0, m = data.length; n this.year.max) { - this.year.max = end.getFullYear(); - } else if (beg.getFullYear() > this.year.max) { - this.year.max = beg.getFullYear(); - } - - this.data.push({start: beg, end: end, label: lbl, type: cat}); - } - }; - - /** - * Wrapper for adding bubbles - */ - Timesheet.prototype.createBubble = function(wMonth, min, start, end) { - return new Bubble(wMonth, min, start, end); - }; - - /** - * Timesheet Bubble - */ - var Bubble = function(wMonth, min, start, end) { - this.min = min; - this.start = start; - this.end = end; - this.widthMonth = wMonth; - }; - - /** - * Format month number - */ - Bubble.prototype.formatMonth = function(num) { - num = parseInt(num, 10); - - return num >= 10 ? num : '0' + num; - }; - - /** - * Calculate starting offset for bubble - */ - Bubble.prototype.getStartOffset = function() { - return (this.widthMonth/12) * (12 * (this.start.getFullYear() - this.min) + this.start.getMonth()); - }; - - /** - * Get count of full years from start to end - */ - Bubble.prototype.getFullYears = function() { - return ((this.end && this.end.getFullYear()) || this.start.getFullYear()) - this.start.getFullYear(); - }; - - /** - * Get count of all months in Timesheet Bubble - */ - Bubble.prototype.getMonths = function() { - var fullYears = this.getFullYears(); - var months = 0; - - if (!this.end) { - months += !this.start.hasMonth ? 12 : 1; - } else { - if (!this.end.hasMonth) { - months += 12 - (this.start.hasMonth ? this.start.getMonth() : 0); - months += 12 * (fullYears-1 > 0 ? fullYears-1 : 0); - } else { - months += this.end.getMonth() + 1; - months += 12 - (this.start.hasMonth ? this.start.getMonth() : 0); - months += 12 * (fullYears-1); - } - } - - return months; - }; - - /** - * Get bubble's width in pixel - */ - Bubble.prototype.getWidth = function() { - return (this.widthMonth/12) * this.getMonths(); - }; - - /** - * Get the bubble's label - */ - Bubble.prototype.getDateLabel = function() { - return [ - (this.start.hasMonth ? this.formatMonth(this.start.getMonth() + 1) + '/' : '' ) + this.start.getFullYear(), - (this.end ? '-' + ((this.end.hasMonth ? this.formatMonth(this.end.getMonth() + 1) + '/' : '' ) + this.end.getFullYear()) : '') - ].join(''); - }; - - window.Timesheet = Timesheet; -})(); \ No newline at end of file diff --git a/test/timesheet.js b/test/timesheet.js index 311fd19..cb87947 100644 --- a/test/timesheet.js +++ b/test/timesheet.js @@ -2,7 +2,7 @@ * Load Timesheet lib and fake a window object … */ window = {}; -require(__dirname + '/../source/javascripts/timesheet.js'); +require(__dirname + '/../source/javascripts/timesheet-advanced.js'); var assert = require('assert'); suite('Timesheet', function() { From 2df0a2229dba100c1f4236d2bd139474971ef8a1 Mon Sep 17 00:00:00 2001 From: Nikola Tucakovic Date: Wed, 22 Jul 2015 13:08:48 +0200 Subject: [PATCH 49/74] rename scale and data --- dist/timesheet-advanced.min.js | 2 +- dist/timesheet.min.css | 2 +- dist/timesheet.min.css.map | 2 +- dist/timesheet.min.js | 2 +- source/javascripts/timesheet-advanced.js | 12 ++++++------ source/stylesheets/timesheet.sass | 10 +++++----- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dist/timesheet-advanced.min.js b/dist/timesheet-advanced.min.js index e48483b..43a03a3 100644 --- a/dist/timesheet-advanced.min.js +++ b/dist/timesheet-advanced.min.js @@ -1 +1 @@ -!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link,present:!1}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.theme.length&&(this.container.className+=" timesheet--"+this.options.theme),this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip,this.options.theme)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";function merge(target,source){"object"!=typeof target&&(target={});for(var property in source)if(source.hasOwnProperty(property)){var sourceProperty=source[property];if("object"==typeof sourceProperty){target[property]=merge(target[property],sourceProperty);continue}target[property]=sourceProperty}for(var a=2,l=arguments.length;l>a;a++)merge(target,arguments[a]);return target}var Timesheet=function(data,options){this.options=this.mergeWithDefault(options),this.data=[],this.bubbles=[],this.widthYear=0,this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof this.options.container?document.querySelector("#"+this.options.container):this.options.container,this.drawSections(),this.drawCurrentMonth(),this.insertData())};Timesheet.prototype.mergeWithDefault=function(options){var defaults={container:"timesheet",type:"parallel",theme:"dark",extraClass:"",showDate:!0,timesheetYearMin:null,timesheetYearMax:null,scrollX:!0};return merge(defaults,options)},Timesheet.prototype.parse=function(data){for(var overrideTimesheetMin=null===this.options.timesheetYearMin,overrideTimesheetMax=null===this.options.timesheetYearMax,n=0;nthis.options.timesheetYearMax?this.options.timesheetYearMax=bubbleEnd.getFullYear():bubbleStart.getFullYear()>this.options.timesheetYearMax&&(this.options.timesheetYearMax=bubbleStart.getFullYear())),this.data.push({start:bubbleStart,end:bubbleEnd,label:label,bubbleType:bubbleType}),this.bubbles.push(this.createBubble({start:bubbleStart,end:bubbleEnd,type:bubbleType,label:label,timesheetYearMin:this.options.timesheetYearMin,timesheetYearMax:this.options.timesheetYearMax,link:link,present:!1}))}},Timesheet.prototype.bubbleFits=function(bubbleStart,bubbleEnd){var dateTimesheetStart=new Date("01/01/"+this.options.timesheetYearMin),dateTimesheetEnd=new Date("12/31/"+this.options.timesheetYearMax),fits=!1;return bubbleStart>dateTimesheetStart&&dateTimesheetEnd>bubbleStart&&(fits=!0),dateTimesheetEnd>bubbleStart&&bubbleEnd>dateTimesheetStart&&(fits=!0),fits},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.options.timesheetYearMin;c<=this.options.timesheetYearMax;c++)html.push("
        "+c+"
        ");this.container.className="timesheet timesheet--"+this.options.type,this.options.theme.length&&(this.container.className+=" timesheet--"+this.options.theme),this.options.extraClass.length&&(this.container.className+=" "+this.options.extraClass),this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.drawCurrentMonth=function(){var date=new Date;if(this.options.timesheetYearMax>=date.getFullYear()&&this.options.timesheetYearMax===date.getFullYear()&&date.getMonth()<12){this.widthYear=this.container.querySelector(".tsa-scale section").offsetWidth;var currentMonthOffset=12*(this.options.timesheetYearMax-this.options.timesheetYearMin)+date.getMonth();this.container.innerHTML+='
        '}},Timesheet.prototype.insertData=function(){"parallel"===this.options.type?this.generateMarkupParallel():"serial"===this.options.type&&this.generateMarkupSerial();var bubbleFilter=function(elem){return hasClass(elem,"bubble")};this.container.addEventListener?(this.container.addEventListener("click",delegate(bubbleFilter,drawTooltip,this.options.theme)),this.options.scrollX&&(this.container.addEventListener("mousewheel",timesheetScrollbar,!1),this.container.addEventListener("DOMMouseScroll",timesheetScrollbar,!1))):this.options.scrollX&&(this.container.attachEvent("onmousewheel",timesheetScrollbar),this.container.attachEvent("click",delegate(bubbleFilter,drawTooltip,this.options.theme)))};var delegate=function(criteria,listener,theme){return function(e){var el=e.target;do if(criteria(el))return e.delegateTarget=el,e.theme=theme,void listener.apply(this,arguments);while(el=el.parentNode)}},hasClass=function(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1},timesheetScrollbar=function(e){e=window.event||e;var delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.scrollLeft-=40*delta,this.scrollLeft>0&&this.scrollWidth-this.scrollLeft!==this.offsetWidth&&e.preventDefault()};Timesheet.prototype.generateMarkupParallel=function(){var html=[];this.widthYear=this.container.querySelector(".tsa-scale section").offsetWidth;for(var startTag="",endTag="",n=0;n',endTag=""):(startTag='',endTag="");var bubbleClasses=["bubble","bubble-"+bubble.type];bubble.startedBeforeTimesheet&&bubbleClasses.push("bubble--started-before"),bubble.endedAfterTimesheet&&bubbleClasses.push("bubble--ended-after");var line=[''+startTag+''+bubble.getDateLabel()+"",''+bubble.label+""+endTag].join("");html.push("
      • "+line+"
      • ")}}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.generateMarkupSerial=function(){var i,j,currentList,currentBubble,html=[];this.widthYear=this.container.querySelector(".tsa-scale section").offsetWidth;var lists=this.buildSerialBubbleLists();for(html.push('
          '),i=0;i"),html.push('
            ');var line=[];for(j=0;j",'',"")}html.push(line.join("")),html.push("
          "),html.push("")}html.push("
        "),this.container.innerHTML+=html.join("")},Timesheet.prototype.buildSerialBubbleLists=function(){var i,j,list,bubble,lists=[{monthOffsetEnd:0,bubbles:[]}];for(i=0;i=document.body.clientWidth?document.body.clientWidth-181:e.pageX-90<0?0:e.pageX-90)+"px",document.body.appendChild(tooltip),document.body.clientHeightthis.timesheetYearMax&&(this.endedAfterTimesheet=!0,offsets.monthEnd-=12*(this.end.getFullYear()-this.timesheetYearMax-1)+this.end.getMonth()),offsets},Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getWidth=function(widthYear){return widthYear/12*this.monthsLength},Bubble.prototype.getPosition=function(timesheet){var position={};return position.offset=this.monthOffsetStart*timesheet.widthYear/12+"px",position.width=this.getWidth(timesheet.widthYear)+"px",position},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.present?" - present":" - "+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear())].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/dist/timesheet.min.css b/dist/timesheet.min.css index ca6ded7..ac06952 100644 --- a/dist/timesheet.min.css +++ b/dist/timesheet.min.css @@ -1,2 +1,2 @@ -.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .scale section:last-child{width:118px;border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data>li:hover .bubble{opacity:1}.timesheet.timesheet--light{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--light .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--light .bubble-default{background-color:#141414}.timesheet.timesheet--light .scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--light .scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--light .data li .date{color:#797979}.timesheet.timesheet--light .data li .label{color:#333332}.timesheet.timesheet--no-date .data li .date{display:none}.timesheet.timesheet--no-date .data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0;width:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip.theme--dark{background-color:#333;color:#fff}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.theme--dark .timesheet-tooltip{background-color:#333;color:#fff}.theme--dark .timesheet-tooltip-date{color:#fff}.theme--dark p.timesheet-tooltip-label{color:#fff} +.timesheet{width:720px;margin:0 auto;white-space:nowrap;overflow:auto;border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet .bubble-link{border-bottom:1px dotted #979796}.timesheet .bubble-default{background-color:#fff}.timesheet .bubble-red{background-color:#fc464a}.timesheet .bubble-green{background-color:#9aca27}.timesheet .bubble-blue{background-color:#3cb6e3}.timesheet .bubble-yellow{background-color:#f4cf30}.timesheet .bubble-purple{background-color:#a969ca}.timesheet .tsa-scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .tsa-scale section{display:inline-block;width:119px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .tsa-scale section:last-child{width:118px;border-right:1px dashed rgba(250,250,250,0.2)}.timesheet .date{color:#b5b5b5;font-size:14px}.timesheet .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .bubble{height:10px;display:block;position:relative;top:7px;border-radius:5px;margin:0 10px 6px 0;opacity:0.7}.timesheet .bubble.bubble--started-before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.timesheet .bubble.bubble--ended-after{border-top-right-radius:0 !important;border-bottom-right-radius:0 !important}.timesheet .tsa-data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px}.timesheet .tsa-data>li{margin-bottom:3px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .tsa-data>li:hover .bubble{opacity:1}.timesheet.timesheet--light{border-top:1px solid rgba(60,60,60,0.3);background-color:#fbfbfb}.timesheet.timesheet--light .bubble-link{border-bottom:1px dotted #333332}.timesheet.timesheet--light .bubble-default{background-color:#141414}.timesheet.timesheet--light .tsa-scale section{color:rgba(50,50,50,0.8);border-left:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--light .tsa-scale section:last-child{border-right:1px dashed rgba(50,50,50,0.1)}.timesheet.timesheet--light .tsa-data li .date{color:#797979}.timesheet.timesheet--light .tsa-data li .label{color:#333332}.timesheet.timesheet--no-date .tsa-data li .date{display:none}.timesheet.timesheet--no-date .tsa-data li .label{padding-left:0}.timesheet .ts-vertical-line{position:absolute;width:0;height:100%;border-right:1px solid #2E7791}.timesheet--serial .bubble{top:0;height:16px;margin-bottom:0}.timesheet--serial .ts-bubbles-wrapper{position:relative;height:25px}.timesheet--serial .ts-bubbles-wrapper>li{display:block;position:absolute;top:0;width:0}.timesheet--serial .ts-bubbles-wrapper>li .info-wrapper{display:none;position:absolute}.timesheet--serial .ts-bubbles-wrapper>li .bubble{margin-right:0;border-radius:8px}.timesheet-tooltip{position:absolute;background-color:#fff;width:160px;display:inline-block;color:#333;text-align:center;padding:10px}.timesheet-tooltip.theme--dark{background-color:#333;color:#fff}.timesheet-tooltip-date{color:#333;font-size:14px;font-weight:bold;display:block;border-bottom:1px solid #f2f2f2;padding-bottom:5px;margin-bottom:5px}.timesheet-tooltip-label{width:auto;margin:0 5px;text-align:center;font-size:14px}p.timesheet-tooltip-label{color:#333}.theme--dark .timesheet-tooltip{background-color:#333;color:#fff}.theme--dark .timesheet-tooltip-date{color:#fff}.theme--dark p.timesheet-tooltip-label{color:#fff} /*# sourceMappingURL=timesheet.min.css.map */ diff --git a/dist/timesheet.min.css.map b/dist/timesheet.min.css.map index 034dd80..a908c5c 100644 --- a/dist/timesheet.min.css.map +++ b/dist/timesheet.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAU,CACR,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,MAAM,CACd,WAAW,CAAE,MAAM,CACnB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,+BAAkC,CAC9C,gBAAgB,CAAE,IAAmB,CACrC,QAAQ,CAAE,QAAQ,CAElB,uBAAY,CACV,aAAa,CAAE,kBAAiC,CAElD,0BAAe,CACb,gBAAgB,CAAE,IAAK,CACzB,sBAAW,CACT,gBAAgB,CAAE,OAAoB,CACxC,wBAAa,CACX,gBAAgB,CAAE,OAAqB,CACzC,uBAAY,CACV,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAqB,CACzC,yBAAc,CACZ,gBAAgB,CAAE,OAAsB,CAE1C,iBAAM,CACJ,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CAEX,yBAAO,CACL,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,qBAAwB,CAC/B,WAAW,CAAE,kBAAkB,CAC/B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,gCAAmC,CAChD,MAAM,CAAE,IAAI,CAEZ,oCAAY,CACV,KAAK,CAAE,KAAK,CACZ,YAAY,CAAE,gCAAmC,CAEvD,g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E,IAAI,CACZ,aAAa,CAAE,CAAC,CAElB,sCAAmB,CACjB,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CAEZ,yCAAI,CACF,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,KAAK,CAAE,CAAC,CAER,uDAAa,CACX,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAEpB,iDAAO,CACL,YAAY,CAAE,CAAC,CACf,aAAa,CAAE,GAAG,CAE1B,kBAAkB,CAChB,QAAQ,CAAE,QAAQ,CAClB,gBAAgB,CAAE,IAAK,CACvB,KAAK,CAAE,KAAK,CACZ,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,IAAe,CACtB,UAAU,CAAE,MAAM,CAClB,OAAO,CAAE,IAAI,CAEb,8BAAa,CACX,gBAAgB,CAAE,IAAe,CACjC,KAAK,CAAE,IAAK,CAEhB,uBAAuB,CACrB,KAAK,CAAE,IAAe,CACtB,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,KAAK,CACd,aAAa,CAAE,iBAA4B,CAC3C,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,GAAG,CAEpB,wBAAwB,CACtB,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAClB,SAAS,CAAE,IAAI,CAEjB,yBAAyB,CACvB,KAAK,CAAE,IAAe,CAGtB,+BAAkB,CAChB,gBAAgB,CAAE,IAAe,CACjC,KAAK,CAAE,IAAK,CAEd,oCAAuB,CACrB,KAAK,CAAE,IAAK,CAEd,sCAAyB,CACvB,KAAK,CAAE,IAAK", "sources": ["../source/stylesheets/timesheet.sass"], "names": [], "file": "timesheet.min.css" diff --git a/dist/timesheet.min.js b/dist/timesheet.min.js index 8c498e0..d33b02b 100644 --- a/dist/timesheet.min.js +++ b/dist/timesheet.min.js @@ -1 +1 @@ -!function(){"use strict";var Timesheet=function(container,min,max,data){this.data=[],this.year={min:min,max:max},this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.insertData=function(){for(var html=[],widthMonth=this.container.querySelector(".scale section").offsetWidth,n=0,m=this.data.length;m>n;n++){var cur=this.data[n],bubble=this.createBubble(widthMonth,this.year.min,cur.start,cur.end),line=['',''+bubble.getDateLabel()+" ",''+cur.label+""].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.parse=function(data){for(var n=0,m=data.length;m>n;n++){var beg=this.parseDate(data[n][0]),end=4===data[n].length?this.parseDate(data[n][1]):null,lbl=4===data[n].length?data[n][2]:data[n][1],cat=4===data[n].length?data[n][3]:3===data[n].length?data[n][2]:"default";beg.getFullYear()this.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:lbl,type:cat})}},Timesheet.prototype.createBubble=function(wMonth,min,start,end){return new Bubble(wMonth,min,start,end)};var Bubble=function(wMonth,min,start,end){this.min=min,this.start=start,this.end=end,this.widthMonth=wMonth};Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getStartOffset=function(){return this.widthMonth/12*(12*(this.start.getFullYear()-this.min)+this.start.getMonth())},Bubble.prototype.getFullYears=function(){return(this.end&&this.end.getFullYear()||this.start.getFullYear())-this.start.getFullYear()},Bubble.prototype.getMonths=function(){var fullYears=this.getFullYears(),months=0;return this.end?this.end.hasMonth?(months+=this.end.getMonth()+1,months+=12-(this.start.hasMonth?this.start.getMonth():0),months+=12*(fullYears-1)):(months+=12-(this.start.hasMonth?this.start.getMonth():0),months+=12*(fullYears-1>0?fullYears-1:0)):months+=this.start.hasMonth?1:12,months},Bubble.prototype.getWidth=function(){return this.widthMonth/12*this.getMonths()},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file +!function(){"use strict";var Timesheet=function(container,min,max,data){this.data=[],this.year={min:min,max:max},this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.insertData=function(){for(var html=[],widthMonth=this.container.querySelector(".scale section").offsetWidth,n=0,m=this.data.length;m>n;n++){var cur=this.data[n],bubble=this.createBubble(widthMonth,this.year.min,cur.start,cur.end),line=['',''+bubble.getDateLabel()+" ",''+cur.label+""].join("");html.push("
      • "+line+"
      • ")}this.container.innerHTML+='
          '+html.join("")+"
        "},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("
        "+c+"
        ");this.container.className="timesheet color-scheme-default",this.container.innerHTML='
        '+html.join("")+"
        "},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.parse=function(data){for(var n=0,m=data.length;m>n;n++){var beg=this.parseDate(data[n][0]),end=4===data[n].length?this.parseDate(data[n][1]):null,lbl=4===data[n].length?data[n][2]:data[n][1],cat=4===data[n].length?data[n][3]:3===data[n].length?data[n][2]:"default";beg.getFullYear()this.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:lbl,type:cat})}},Timesheet.prototype.createBubble=function(wMonth,min,start,end){return new Bubble(wMonth,min,start,end)};var Bubble=function(wMonth,min,start,end){this.min=min,this.start=start,this.end=end,this.widthMonth=wMonth};Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getStartOffset=function(){return this.widthMonth/12*(12*(this.start.getFullYear()-this.min)+this.start.getMonth())},Bubble.prototype.getFullYears=function(){return(this.end&&this.end.getFullYear()||this.start.getFullYear())-this.start.getFullYear()},Bubble.prototype.getMonths=function(){var fullYears=this.getFullYears(),months=0;return this.end?this.end.hasMonth?(months+=this.end.getMonth()+1,months+=12-(this.start.hasMonth?this.start.getMonth():0),months+=12*(fullYears-1)):(months+=12-(this.start.hasMonth?this.start.getMonth():0),months+=12*(fullYears-1>0?fullYears-1:0)):months+=this.start.hasMonth?1:12,months},Bubble.prototype.getWidth=function(){return this.widthMonth/12*this.getMonths()},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}(); \ No newline at end of file diff --git a/source/javascripts/timesheet-advanced.js b/source/javascripts/timesheet-advanced.js index 94e02e6..4fd89e4 100644 --- a/source/javascripts/timesheet-advanced.js +++ b/source/javascripts/timesheet-advanced.js @@ -195,7 +195,7 @@ this.container.className += ' ' + this.options.extraClass; } - this.container.innerHTML = '
        ' + html.join('') + '
        '; + this.container.innerHTML = '
        ' + html.join('') + '
        '; }; /** @@ -207,7 +207,7 @@ // If max year on X axis is after or is the current year. if (this.options.timesheetYearMax >= date.getFullYear()) { if (this.options.timesheetYearMax === date.getFullYear() && date.getMonth() < 12) { - this.widthYear = this.container.querySelector('.scale section').offsetWidth; + this.widthYear = this.container.querySelector('.tsa-scale section').offsetWidth; var currentMonthOffset = (this.options.timesheetYearMax - this.options.timesheetYearMin) * 12 + date.getMonth(); this.container.innerHTML += '
        '; @@ -303,7 +303,7 @@ */ Timesheet.prototype.generateMarkupParallel = function() { var html = []; - this.widthYear = this.container.querySelector('.scale section').offsetWidth; + this.widthYear = this.container.querySelector('.tsa-scale section').offsetWidth; var startTag = ''; var endTag = ''; @@ -340,7 +340,7 @@ } } - this.container.innerHTML += '
          ' + html.join('') + '
        '; + this.container.innerHTML += '
          ' + html.join('') + '
        '; }; /** @@ -349,11 +349,11 @@ Timesheet.prototype.generateMarkupSerial = function() { var html = []; var i, j, currentList, currentBubble; - this.widthYear = this.container.querySelector('.scale section').offsetWidth; + this.widthYear = this.container.querySelector('.tsa-scale section').offsetWidth; var lists = this.buildSerialBubbleLists(); - html.push('