├── .gitignore ├── LICENSE.md ├── README.md ├── README.ru.md ├── app └── js │ └── time-tracker.js ├── build ├── time-tracker-min.js └── time-tracker.js ├── dist ├── time-tracker-min.js └── time-tracker.js ├── example ├── first_start.html ├── start_button.html ├── timetracker_buttons.html ├── timetracker_countdown_buttons.html └── timetracker_event.html ├── gulp.config.js ├── gulpfile.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea* 2 | /.idea/ 3 | /node_modules* 4 | /node_modules/ 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017 by Agilie Team 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/agilie/Web-Time-Tracker) 2 | 3 | # Web Time Tracker 4 | Plugin named **Timetracker** is a time counter that works in both increase and decrease directions. It can be embedded in websites and used as a timer, tracker, counting down tool and in any other situation where you need to control elapsed time (for example, during online testing). 5 | **Timetracker** plugin can be adapted to any web resource and designed in accordance with the website style. 6 | For initialization, use the command: 7 | ```sh 8 | $('.timetracker').timetracker(); 9 | ``` 10 | 11 | # Timetracker format 12 | The default interval is 1 second, the display format is in minutes and seconds. 13 | To customize time format use "format" field during initialization: 14 | ```sh 15 | $('.timetracker').timetracker({'format': 'i:s'}); 16 | ``` 17 | 18 | # How to use plugin 19 | To specify when you want to stop the countdown, use the setting timestop (in seconds): 20 | ```sh 21 | $('.timetracker').timetracker({'timestop': 15}) 22 | ``` 23 | The parameter "countdown" allows you to specify the counting direction, and the parameter "timestop", in seconds, specifies the moment when the count should be stopped or resumed. 24 | ```sh 25 | $('.timetracker').timetracker({'countdown': true, 'timestop': 60}); 26 | ``` 27 | To guide the tracker, there are a number of events that allow you to start or stop counting and return to the original state. 28 | ```sh 29 | $('.timetracker').timetracker('start'); 30 | $('.timetracker').timetracker('stop'); 31 | $('.timetracker').timetracker('reset'); 32 | ``` 33 | 34 | You can assign your handler to process the timer stop event: 35 | ```sh 36 | $('.timetracker').timetracker({ 37 | 'timestop': 5, 38 | 'format': 'i:s', 39 | 'stop': function() { 40 | alert('The timer stopped'); 41 | } 42 | }); 43 | ``` 44 | 45 | # Example of tracker usage 46 | Here we can show you an example of tracker usage: 47 | ```sh 48 | 49 | 50 | 51 | 52 | Title 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 64 | 65 | 66 | ``` 67 | 68 | ## Troubleshooting 69 | Problems? Check the [Issues](https://github.com/agilie/Web-Time-Tracker/issues) block 70 | to find the solution or create an new issue that we will fix asap. Feel free to contribute. 71 | 72 | ## Author 73 | This jQuery plugin is open-sourced by [Agilie Team](https://www.agilie.com) ([info@agilie.com](mailto:info@agilie.com)) 74 | 75 | ## Contributor 76 | [Petr Simanko](https://github.com/PetrSimanko) 77 | 78 | ## Contact us 79 | If you have any questions, suggestions or just need a help with web or mobile development, please email us at . You can ask us anything from basic to complex questions. 80 | 81 | We will continue publishing new open-source projects. Stay with us, more updates will follow! 82 | 83 | ## License 84 | The [MIT](https://github.com/agilie/Web-Time-Tracker/blob/master/LICENSE.md) License (MIT) Copyright © 2017 [Agilie Team](https://www.agilie.com) 85 | -------------------------------------------------------------------------------- /README.ru.md: -------------------------------------------------------------------------------- 1 | Плагин **Timetracker** представляет собой счетчик времени, который встраивается в веб-сайты. Он может использоваться в качестве таймера, трекера, а также для обратного отсчета и в любых других ситуациях, когда требуется контролировать затраченное время (например, при проведении онлайн-тестирования). 2 | Плагин **Timetracker** можно адаптировать под любой веб-ресурс, оформив счетчик времени в стиле самого сайта. 3 | 4 | Инициализация счетчика выполняется командой: 5 | ```sh 6 | $('.timetracker').timetracker(); 7 | ``` 8 | 9 | # Формат Timetracker 10 | По умолчанию интервал ставится в 1 секунду, формат отображения - в минутах и секундах. Отсчет времени будет отображаться в указанном элементе. 11 | Установить формат времени при инициализации необходимо в поле “format”: 12 | ```sh 13 | $('.timetracker').timetracker({'format': 'i:s'}); 14 | ``` 15 | 16 | # Управление плагином 17 | Чтобы указать, когда требуется остановить отсчет времени, нужно использовать настройку timestop, время - в секундах: 18 | ```sh 19 | $('.timetracker').timetracker({'timestop': 15}) 20 | ``` 21 | С помощью параметра countdown можно определить направление отсчета, а параметр timestop в секундах укажет, когда следует остановить отсчет, или с какого момента его начать. 22 | ```sh 23 | $('.timetracker').timetracker({'countdown': true, 'timestop': 60}); 24 | ``` 25 | Для руководства трекером существует ряд событий, которые позволяют начать или остановить отчет, а также вернуться к первоначальному состоянию. 26 | ```sh 27 | $('.timetracker').timetracker('start'); 28 | $('.timetracker').timetracker('stop'); 29 | $('.timetracker').timetracker('reset'); 30 | ``` 31 | 32 | Для обработки остановки счетчика можно назначить свой обработчик: 33 | ```sh 34 | $('.timetracker').timetracker({ 35 | 'timestop': 5, 36 | 'format': 'i:s', 37 | 'stop': function() { 38 | alert('The timer stopped'); 39 | } 40 | }); 41 | ``` 42 | 43 | # Пример работы плагина 44 | Пример работы трекера: 45 | ```sh 46 | 47 | 48 | 49 | 50 | Title 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | ``` 65 | -------------------------------------------------------------------------------- /app/js/time-tracker.js: -------------------------------------------------------------------------------- 1 | ;(function($){ 2 | var defaultSetting = { 3 | format: 'H:i:s', 4 | countdown: false, 5 | passed: 0, 6 | passedStop: -1, 7 | timestart: 0, 8 | timestop: 0, 9 | delayInterval: 1000, 10 | stop: null 11 | }; 12 | var setting; 13 | var idTimeout = null; 14 | var thisTimeTracker = null; 15 | 16 | function methodInit(options) { 17 | console.log('method: ', 'init'); 18 | thisTimeTracker = this; 19 | setting = $.extend({}, defaultSetting, options); 20 | if (setting.timestop) { 21 | setting.passedStop = setting.timestop * 1000; 22 | } 23 | if (setting.countdown && setting.passedStop === 0) { 24 | setting.countdown = false; 25 | } 26 | if (setting.passed !== 0) { 27 | setting.passed = setting.passed * 1000; 28 | } 29 | methods.display.apply(); 30 | methods.stop.apply(); 31 | } 32 | 33 | function methodStart() { 34 | console.log('method: ', 'start'); 35 | setting.timestart = Date.now(); // time start 36 | idTimeout = setTimeout(methods.make, setting.delayInterval); 37 | } 38 | 39 | function methodStop() { 40 | console.log('method: ', 'stop'); 41 | if (idTimeout) { 42 | clearTimeout(idTimeout); 43 | } 44 | } 45 | 46 | function methodMake() { 47 | console.log('method: ', 'make'); 48 | var now = Date.now(); 49 | setting.passed += now - setting.timestart; 50 | setting.timestart = now; 51 | methods.display.apply(); 52 | if (setting.passed <= setting.passedStop || setting.passedStop < 0) { 53 | idTimeout = setTimeout(methods.make, setting.delayInterval); 54 | } else { 55 | setting.passed = setting.passedStop; 56 | if (setting.stop) { 57 | setting.stop.apply(); 58 | } 59 | } 60 | } 61 | 62 | function methodDisplay() { 63 | console.log('method: ', 'disp'); 64 | var hour = 0, min = 0, sec = 0; 65 | var text = setting.format; 66 | var passed = setting.passed; 67 | var fnRound = Math.floor; 68 | if (setting.countdown) { 69 | passed = setting.passedStop - passed; 70 | fnRound = Math.ceil; 71 | } 72 | sec = fnRound(passed / 1000) % 60; 73 | min = Math.floor(passed / (60 * 1000)) % 60; 74 | hour = Math.floor(passed / (60 * 60 * 1000)); 75 | 76 | min = min < 10 ? '0' + min : min; 77 | sec = sec < 10 ? '0' + sec : sec; 78 | hour = hour < 10 ? '0' + hour : hour; 79 | text = text.replace('H', hour).replace('i', min).replace('s', sec); 80 | thisTimeTracker.text(text); 81 | } 82 | 83 | function methodReset() { 84 | console.log('method: ', 'reset'); 85 | setting.passed = 0; 86 | if (setting.timestop) { 87 | setting.passedStop = setting.timestop * 1000; 88 | } 89 | if (setting.countdown && setting.passedStop === 0) { 90 | setting.countdown = false; 91 | } 92 | methods.display.apply(); 93 | } 94 | 95 | var methods = { 96 | init: methodInit, 97 | start: methodStart, 98 | stop: methodStop, 99 | make: methodMake, 100 | display: methodDisplay, 101 | reset: methodReset 102 | }; 103 | 104 | $.fn.timetracker = function(method){ 105 | if (methods[method]) { 106 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 107 | } else if (typeof method === 'object' || !method) { 108 | return methods.init.apply( this, arguments ); 109 | } else { 110 | $.error(method + ' don\'t exists'); 111 | } 112 | }; 113 | })(jQuery); -------------------------------------------------------------------------------- /build/time-tracker-min.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(e){r=this,i=t.extend({},d,e),i.timestop&&(i.passedStop=1e3*i.timestop),i.countdown&&0===i.passedStop&&(i.countdown=!1),0!==i.passed&&(i.passed=1e3*i.passed),c.display.apply(),c.stop.apply()}function s(){i.timestart=Date.now(),l=setTimeout(c.make,i.delayInterval)}function a(){l&&clearTimeout(l)}function p(){var t=Date.now();i.passed+=t-i.timestart,i.timestart=t,c.display.apply(),i.passed<=i.passedStop||i.passedStop<0?l=setTimeout(c.make,i.delayInterval):(i.passed=i.passedStop,i.stop&&i.stop.apply())}function o(){var t=0,e=0,s=0,a=i.format,p=i.passed,o=Math.floor;i.countdown&&(p=i.passedStop-p,o=Math.ceil),s=o(p/1e3)%60,e=Math.floor(p/6e4)%60,t=Math.floor(p/36e5),e=e<10?"0"+e:e,s=s<10?"0"+s:s,t=t<10?"0"+t:t,a=a.replace("H",t).replace("i",e).replace("s",s),r.text(a)}function n(){i.passed=0,i.timestop&&(i.passedStop=1e3*i.timestop),i.countdown&&0===i.passedStop&&(i.countdown=!1),c.display.apply()}var i,d={format:"H:i:s",countdown:!1,passed:0,passedStop:-1,timestart:0,timestop:0,delayInterval:1e3,stop:null},l=null,r=null,c={init:e,start:s,stop:a,make:p,display:o,reset:n};t.fn.timetracker=function(e){return c[e]?c[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void t.error(e+" don't exists"):c.init.apply(this,arguments)}}(jQuery); -------------------------------------------------------------------------------- /build/time-tracker.js: -------------------------------------------------------------------------------- 1 | ;(function($){ 2 | var defaultSetting = { 3 | format: 'H:i:s', 4 | countdown: false, 5 | passed: 0, 6 | passedStop: -1, 7 | timestart: 0, 8 | timestop: 0, 9 | delayInterval: 1000, 10 | stop: null 11 | }; 12 | var setting; 13 | var idTimeout = null; 14 | var thisTimeTracker = null; 15 | 16 | function methodInit(options) { 17 | 18 | thisTimeTracker = this; 19 | setting = $.extend({}, defaultSetting, options); 20 | if (setting.timestop) { 21 | setting.passedStop = setting.timestop * 1000; 22 | } 23 | if (setting.countdown && setting.passedStop === 0) { 24 | setting.countdown = false; 25 | } 26 | if (setting.passed !== 0) { 27 | setting.passed = setting.passed * 1000; 28 | } 29 | methods.display.apply(); 30 | methods.stop.apply(); 31 | } 32 | 33 | function methodStart() { 34 | 35 | setting.timestart = Date.now(); // time start 36 | idTimeout = setTimeout(methods.make, setting.delayInterval); 37 | } 38 | 39 | function methodStop() { 40 | 41 | if (idTimeout) { 42 | clearTimeout(idTimeout); 43 | } 44 | } 45 | 46 | function methodMake() { 47 | 48 | var now = Date.now(); 49 | setting.passed += now - setting.timestart; 50 | setting.timestart = now; 51 | methods.display.apply(); 52 | if (setting.passed <= setting.passedStop || setting.passedStop < 0) { 53 | idTimeout = setTimeout(methods.make, setting.delayInterval); 54 | } else { 55 | setting.passed = setting.passedStop; 56 | if (setting.stop) { 57 | setting.stop.apply(); 58 | } 59 | } 60 | } 61 | 62 | function methodDisplay() { 63 | 64 | var hour = 0, min = 0, sec = 0; 65 | var text = setting.format; 66 | var passed = setting.passed; 67 | var fnRound = Math.floor; 68 | if (setting.countdown) { 69 | passed = setting.passedStop - passed; 70 | fnRound = Math.ceil; 71 | } 72 | sec = fnRound(passed / 1000) % 60; 73 | min = Math.floor(passed / (60 * 1000)) % 60; 74 | hour = Math.floor(passed / (60 * 60 * 1000)); 75 | 76 | min = min < 10 ? '0' + min : min; 77 | sec = sec < 10 ? '0' + sec : sec; 78 | hour = hour < 10 ? '0' + hour : hour; 79 | text = text.replace('H', hour).replace('i', min).replace('s', sec); 80 | thisTimeTracker.text(text); 81 | } 82 | 83 | function methodReset() { 84 | 85 | setting.passed = 0; 86 | if (setting.timestop) { 87 | setting.passedStop = setting.timestop * 1000; 88 | } 89 | if (setting.countdown && setting.passedStop === 0) { 90 | setting.countdown = false; 91 | } 92 | methods.display.apply(); 93 | } 94 | 95 | var methods = { 96 | init: methodInit, 97 | start: methodStart, 98 | stop: methodStop, 99 | make: methodMake, 100 | display: methodDisplay, 101 | reset: methodReset 102 | }; 103 | 104 | $.fn.timetracker = function(method){ 105 | if (methods[method]) { 106 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 107 | } else if (typeof method === 'object' || !method) { 108 | return methods.init.apply( this, arguments ); 109 | } else { 110 | $.error(method + ' don\'t exists'); 111 | } 112 | }; 113 | })(jQuery); -------------------------------------------------------------------------------- /dist/time-tracker-min.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(e){r=this,i=t.extend({},d,e),i.timestop&&(i.passedStop=1e3*i.timestop),i.countdown&&0===i.passedStop&&(i.countdown=!1),0!==i.passed&&(i.passed=1e3*i.passed),c.display.apply(),c.stop.apply()}function s(){i.timestart=Date.now(),l=setTimeout(c.make,i.delayInterval)}function a(){l&&clearTimeout(l)}function p(){var t=Date.now();i.passed+=t-i.timestart,i.timestart=t,c.display.apply(),i.passed<=i.passedStop||i.passedStop<0?l=setTimeout(c.make,i.delayInterval):(i.passed=i.passedStop,i.stop&&i.stop.apply())}function o(){var t=0,e=0,s=0,a=i.format,p=i.passed,o=Math.floor;i.countdown&&(p=i.passedStop-p,o=Math.ceil),s=o(p/1e3)%60,e=Math.floor(p/6e4)%60,t=Math.floor(p/36e5),e=e<10?"0"+e:e,s=s<10?"0"+s:s,t=t<10?"0"+t:t,a=a.replace("H",t).replace("i",e).replace("s",s),r.text(a)}function n(){i.passed=0,i.timestop&&(i.passedStop=1e3*i.timestop),i.countdown&&0===i.passedStop&&(i.countdown=!1),c.display.apply()}var i,d={format:"H:i:s",countdown:!1,passed:0,passedStop:-1,timestart:0,timestop:0,delayInterval:1e3,stop:null},l=null,r=null,c={init:e,start:s,stop:a,make:p,display:o,reset:n};t.fn.timetracker=function(e){return c[e]?c[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void t.error(e+" don't exists"):c.init.apply(this,arguments)}}(jQuery); -------------------------------------------------------------------------------- /dist/time-tracker.js: -------------------------------------------------------------------------------- 1 | ;(function($){ 2 | var defaultSetting = { 3 | format: 'H:i:s', 4 | countdown: false, 5 | passed: 0, 6 | passedStop: -1, 7 | timestart: 0, 8 | timestop: 0, 9 | delayInterval: 1000, 10 | stop: null 11 | }; 12 | var setting; 13 | var idTimeout = null; 14 | var thisTimeTracker = null; 15 | 16 | function methodInit(options) { 17 | 18 | thisTimeTracker = this; 19 | setting = $.extend({}, defaultSetting, options); 20 | if (setting.timestop) { 21 | setting.passedStop = setting.timestop * 1000; 22 | } 23 | if (setting.countdown && setting.passedStop === 0) { 24 | setting.countdown = false; 25 | } 26 | if (setting.passed !== 0) { 27 | setting.passed = setting.passed * 1000; 28 | } 29 | methods.display.apply(); 30 | methods.stop.apply(); 31 | } 32 | 33 | function methodStart() { 34 | 35 | setting.timestart = Date.now(); // time start 36 | idTimeout = setTimeout(methods.make, setting.delayInterval); 37 | } 38 | 39 | function methodStop() { 40 | 41 | if (idTimeout) { 42 | clearTimeout(idTimeout); 43 | } 44 | } 45 | 46 | function methodMake() { 47 | 48 | var now = Date.now(); 49 | setting.passed += now - setting.timestart; 50 | setting.timestart = now; 51 | methods.display.apply(); 52 | if (setting.passed <= setting.passedStop || setting.passedStop < 0) { 53 | idTimeout = setTimeout(methods.make, setting.delayInterval); 54 | } else { 55 | setting.passed = setting.passedStop; 56 | if (setting.stop) { 57 | setting.stop.apply(); 58 | } 59 | } 60 | } 61 | 62 | function methodDisplay() { 63 | 64 | var hour = 0, min = 0, sec = 0; 65 | var text = setting.format; 66 | var passed = setting.passed; 67 | var fnRound = Math.floor; 68 | if (setting.countdown) { 69 | passed = setting.passedStop - passed; 70 | fnRound = Math.ceil; 71 | } 72 | sec = fnRound(passed / 1000) % 60; 73 | min = Math.floor(passed / (60 * 1000)) % 60; 74 | hour = Math.floor(passed / (60 * 60 * 1000)); 75 | 76 | min = min < 10 ? '0' + min : min; 77 | sec = sec < 10 ? '0' + sec : sec; 78 | hour = hour < 10 ? '0' + hour : hour; 79 | text = text.replace('H', hour).replace('i', min).replace('s', sec); 80 | thisTimeTracker.text(text); 81 | } 82 | 83 | function methodReset() { 84 | 85 | setting.passed = 0; 86 | if (setting.timestop) { 87 | setting.passedStop = setting.timestop * 1000; 88 | } 89 | if (setting.countdown && setting.passedStop === 0) { 90 | setting.countdown = false; 91 | } 92 | methods.display.apply(); 93 | } 94 | 95 | var methods = { 96 | init: methodInit, 97 | start: methodStart, 98 | stop: methodStop, 99 | make: methodMake, 100 | display: methodDisplay, 101 | reset: methodReset 102 | }; 103 | 104 | $.fn.timetracker = function(method){ 105 | if (methods[method]) { 106 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 107 | } else if (typeof method === 'object' || !method) { 108 | return methods.init.apply( this, arguments ); 109 | } else { 110 | $.error(method + ' don\'t exists'); 111 | } 112 | }; 113 | })(jQuery); -------------------------------------------------------------------------------- /example/first_start.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /example/start_button.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /example/timetracker_buttons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | -------------------------------------------------------------------------------- /example/timetracker_countdown_buttons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /example/timetracker_event.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /gulp.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | var config = { 3 | /** 4 | * File paths 5 | */ 6 | // all javascript that we want to vet 7 | alljs: [ 8 | './app/**/*.js' 9 | ] 10 | }; 11 | return config; 12 | }; 13 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var jshint = require('gulp-jshint'); 4 | var gulp = require('gulp'); 5 | var open = require('gulp-open'); 6 | var config = require('./gulp.config')(); 7 | var $ = require('gulp-load-plugins')({ lazy: true }); 8 | var minify = require('gulp-minify'); 9 | var gulp_remove_logging = require("gulp-remove-logging"); 10 | var rseq = require('gulp-run-sequence'); 11 | var clean = require('gulp-clean'); 12 | 13 | gulp.task('start', function(){ 14 | gulp.src('app/first_start.html') 15 | .pipe(open()); 16 | }); 17 | 18 | gulp.task('vet', function() { 19 | console.log('Analyzing source with JSHint and JSCS'); 20 | return gulp 21 | .src(config.alljs) 22 | .pipe(jshint()) 23 | .pipe(jshint.reporter('default')); 24 | }); 25 | 26 | gulp.task('dist', function(cb) { 27 | // return rseq('min', ['remove_logging'], cb); 28 | return rseq('clean', ['min'], cb); 29 | }); 30 | 31 | gulp.task('clean', function() { 32 | gulp.src('dist/*.js') 33 | .pipe(clean({force: true})) 34 | }); 35 | 36 | gulp.task('min', function() { 37 | gulp.src('app/js/*.js') 38 | .pipe(gulp_remove_logging({namespace: ['console', 'window.console']})) 39 | .pipe(minify({ 40 | ext:{ 41 | src:'.js', 42 | min:'-min.js' 43 | }, 44 | exclude: ['tasks'], 45 | ignoreFiles: ['.combo.js', '-min.js'] 46 | })) 47 | .pipe(gulp.dest('dist')) 48 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-plugin-time-tracker", 3 | "version": "1.0.1", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "author": "Agilie Team (https://agilie.com)", 9 | "contributors": [ 10 | "Petr Simanko (https://github.com/PetrSimanko)" 11 | ], 12 | "license": "MIT", 13 | "devDependencies": { 14 | "gulp": "^3.9.1", 15 | "gulp-jshint": "^2.0.4", 16 | "gulp-minify": "0.0.15", 17 | "gulp-remove-logging": "^1.2.0", 18 | "gulp-run-sequence": "^0.3.2", 19 | "jshint": "^2.9.4", 20 | "yargs": "^3.15.0" 21 | }, 22 | "dependencies": { 23 | "gulp": "^3.9.1" 24 | }, 25 | "description": "Plugin named Timetracker is a time counter that works in both increase and decrease directions." 26 | } 27 | --------------------------------------------------------------------------------