New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-timer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-timer - npm Package Compare versions

Comparing version 1.2.0 to 1.3.3

app/js/_timer.js

11

bower_components/angular-mocks/.bower.json
{
"name": "angular-mocks",
"version": "1.2.0-rc.2",
"version": "1.3.14",
"main": "./angular-mocks.js",
"ignore": [],
"dependencies": {
"angular": "1.2.0-rc.2"
"angular": "1.3.14"
},
"homepage": "https://github.com/angular/bower-angular-mocks",
"_release": "1.2.0-rc.2",
"_release": "1.3.14",
"_resolution": {
"type": "version",
"tag": "v1.2.0-rc.2",
"commit": "9bdf39463a7e59c35f4f6163853c8da4fbf81ea3"
"tag": "v1.3.14",
"commit": "b33962810730adca9a0f7165ecd4835b6bf40abb"
},

@@ -15,0 +16,0 @@ "_source": "git://github.com/angular/bower-angular-mocks.git",

{
"name": "angular-mocks",
"version": "1.2.0-rc.2",
"version": "1.3.14",
"main": "./angular-mocks.js",
"ignore": [],
"dependencies": {
"angular": "1.2.0-rc.2"
"angular": "1.3.14"
}
}

@@ -1,4 +0,63 @@

bower-angular-mocks
===================
# packaged angular-mocks
angular-mocks.js bower repo
This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngMock).
Please file issues and pull requests against that repo.
## Install
You can install this package either with `npm` or with `bower`.
### npm
```shell
npm install angular-mocks
```
You can `require` ngMock modules:
```js
var angular = require('angular');
angular.module('myMod', [
require('angular-animate'),
require('angular-mocks/ngMock')
require('angular-mocks/ngAnimateMock')
]);
```
### bower
```shell
bower install angular-mocks
```
The mocks are then available at `bower_components/angular-mocks/angular-mocks.js`.
## Documentation
Documentation is available on the
[AngularJS docs site](https://docs.angularjs.org/guide/unit-testing).
## License
The MIT License
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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.
{
"name": "angular-scenario",
"version": "1.2.0-rc.2",
"version": "1.3.14",
"main": "./angular-scenario.js",
"ignore": [],
"dependencies": {
"angular": "1.2.0-rc.2"
"angular": "1.3.14"
},
"homepage": "https://github.com/angular/bower-angular-scenario",
"_release": "1.2.0-rc.2",
"_release": "1.3.14",
"_resolution": {
"type": "version",
"tag": "v1.2.0-rc.2",
"commit": "d60fe144f474acf3ce6939f2d5939ecc2bfeaf1d"
"tag": "v1.3.14",
"commit": "99606da40bcee15be4698104affaa3d2d26588e9"
},

@@ -15,0 +16,0 @@ "_source": "git://github.com/angular/bower-angular-scenario.git",

{
"name": "angular-scenario",
"version": "1.2.0-rc.2",
"version": "1.3.14",
"main": "./angular-scenario.js",
"ignore": [],
"dependencies": {
"angular": "1.2.0-rc.2"
"angular": "1.3.14"
}
}

@@ -1,4 +0,61 @@

bower-angular-scenario
======================
# packaged angular-scenario
bower repo for angular-scenario.js
This tool is now in maintenance mode. If you are starting a new project, please use
[Protractor](https://github.com/angular/protractor). Existing projects using scenario runner are
advised to migrate to protractor, as this tool is unlikely to receive updates.
This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngScenario).
Please file issues and pull requests against that repo.
## Install
You can install this package either with `npm` or with `bower`.
### npm
```shell
npm install angular-scenario
```
The files are then available at `node_modules/angular-scenario/`.
Note that this package is not in CommonJS format, so doing `require('angular-scenario')` will
return `undefined`.
### bower
```shell
bower install angular-scenario
```
The files are then available at `bower_components/angular-scenario/`.
## Documentation
Documentation is available on the
[AngularJS docs site](http://docs.angularjs.org/).
## License
The MIT License
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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.
{
"name": "angular",
"version": "1.2.0-rc.2",
"version": "1.3.14",
"main": "./angular.js",
"ignore": [],
"dependencies": {},
"homepage": "https://github.com/angular/bower-angular",
"_release": "1.2.0-rc.2",
"_release": "1.3.14",
"_resolution": {
"type": "version",
"tag": "v1.2.0-rc.2",
"commit": "53fbc69eae679b7a57fb3d1a413e768ba92696b5"
"tag": "v1.3.14",
"commit": "bdd91e1331b48ae89adfb8444998e290b774cc6d"
},

@@ -13,0 +14,0 @@ "_source": "git://github.com/angular/bower-angular.git",

{
"name": "angular",
"version": "1.2.0-rc.2",
"version": "1.3.14",
"main": "./angular.js",
"ignore": [],
"dependencies": {
}
}

@@ -11,3 +11,3 @@ {

"license": "MIT",
"homepage": "https://github.com/components/jquery",
"homepage": "https://github.com/jquery/jquery",
"_release": "2.0.3",

@@ -17,7 +17,7 @@ "_resolution": {

"tag": "2.0.3",
"commit": "452a56b52b8f4a032256cdb8b6838f25f0bdb3d2"
"commit": "f852e631ba85af7da4ad7594785e122504e7b233"
},
"_source": "git://github.com/components/jquery.git",
"_source": "git://github.com/jquery/jquery.git",
"_target": ">=1.8.0 <2.1.0",
"_originalSource": "jquery"
}
{
"name": "components-jquery",
"version": "2.0.3",
"description": "jQuery component",
"keywords": ["jquery"],
"main": "./jquery.js"
"name": "jquery",
"title": "jQuery",
"description": "JavaScript library for DOM operations",
"version": "2.0.3",
"homepage": "http://jquery.com",
"author": {
"name": "jQuery Foundation and other contributors",
"url": "https://github.com/jquery/jquery/blob/master/AUTHORS.txt"
},
"repository": {
"type": "git",
"url": "https://github.com/jquery/jquery.git"
},
"bugs": {
"url": "http://bugs.jquery.com"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt"
}
],
"dependencies": {},
"devDependencies": {
"grunt-compare-size": "~0.4.0",
"grunt-git-authors": "1.2.0",
"grunt-update-submodules": "0.2.0",
"grunt-contrib-watch": "0.3.1",
"grunt-contrib-jshint": "0.3.0",
"grunt-contrib-uglify": "0.2.0",
"grunt": "0.4.1",
"gzip-js": "0.3.1",
"testswarm": "~1.1.0",
"archiver": "~0.4.2"
},
"keywords": []
}

@@ -1,11 +0,399 @@

jQuery Component
================
[jQuery](http://jquery.com/) - New Wave JavaScript
==================================================
Shim repository for the [jQuery](http://jquery.com).
Contribution Guides
--------------------------------------
Package Managers
----------------
In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:
* [Bower](http://bower.io/): `jquery`
* [Component](https://github.com/component/component): `components/jquery`
* [Composer](http://packagist.org/packages/components/jquery): `components/jquery`
1. [Getting Involved](http://docs.jquery.com/Getting_Involved)
2. [Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
3. [Tips For Bug Patching](http://docs.jquery.com/Tips_for_jQuery_Bug_Patching)
What you need to build your own jQuery
--------------------------------------
In order to build jQuery, you need to have Node.js/npm latest and git 1.7 or later.
(Earlier versions might work OK, but are not tested.)
Windows users have two options:
1. Install [msysgit](https://code.google.com/p/msysgit/) (Full installer for official Git) and a
[binary version of Node.js](http://nodejs.org). Make sure all two packages are installed to the same
location (by default, this is C:\Program Files\Git).
2. Install [Cygwin](http://cygwin.com/) (make sure you install the git and which packages), and
a [binary version of Node.js](http://nodejs.org/).
Mac OS users should install Xcode (comes on your Mac OS install DVD, or downloadable from
[Apple's Xcode site](http://developer.apple.com/technologies/xcode.html)) and
[Homebrew](http://mxcl.github.com/homebrew/). Once Homebrew is installed, run `brew install git` to install git,
and `brew install node` to install Node.js.
Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source
if you swing that way. Easy-peasy.
How to build your own jQuery
----------------------------
First, clone a copy of the main jQuery git repo by running:
```bash
git clone git://github.com/jquery/jquery.git
```
Install the grunt-cli package so that you will have the correct version of grunt available from any project that needs it. This should be done as a global install:
```bash
npm install -g grunt-cli
```
Enter the jquery directory and install the Node dependencies, this time *without* specifying a global install:
```bash
cd jquery && npm install
```
Make sure you have `grunt` installed by testing:
```bash
grunt -version
```
Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of jQuery, type the following:
```bash
grunt
```
The built version of jQuery will be put in the `dist/` subdirectory, along with the minified copy and associated map file.
### Modules
Special builds can be created that exclude subsets of jQuery functionality.
This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used.
For example, an app that only used JSONP for `$.ajax()` and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules. The current modules that can be excluded are:
- **ajax**: All AJAX functionality: `$.ajax()`, `$.get()`, `$.post()`, `$.ajaxSetup()`, `.load()`, transports, and ajax event shorthands such as `.ajaxStart()`.
- **ajax/xhr**: The XMLHTTPRequest AJAX transport only.
- **ajax/script**: The `<script>` AJAX transport only; used to retrieve scripts.
- **ajax/jsonp**: The JSONP AJAX transport only; depends on the ajax/script transport.
- **css**: The `.css()` method plus non-animated `.show()`, `.hide()` and `.toggle()`.
- **deprecated**: Methods documented as deprecated but not yet removed; currently only `.andSelf()`.
- **dimensions**: The `.width()` and `.height()` methods, including `inner-` and `outer-` variations.
- **effects**: The `.animate()` method and its shorthands such as `.slideUp()` or `.hide("slow")`.
- **event-alias**: All event attaching/triggering shorthands like `.click()` or `.mouseover()`.
- **offset**: The `.offset()`, `.position()`, `.offsetParent()`, `.scrollLeft()`, and `.scrollTop()` methods.
- **wrap**: The `.wrap()`, `.wrapAll()`, `.wrapInner()`, and `.unwrap()` methods.
- **sizzle**: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's `querySelectorAll` method that does not support jQuery selector extensions or enhanced semantics. See the selector-native.js file for details.
The grunt build process is aware of dependencies across modules. If you explicitly remove a module, its dependent modules will be removed as well. For example, excluding the css module also excludes effects, since the effects module uses `.css()` to animate CSS properties. These dependencies are listed in Gruntfile.js and the build process shows a message for each dependent module it excludes.
To create a custom build of the latest stable version, first check out the version:
```bash
git pull; git checkout $(git describe --abbrev=0 --tags)
```
Then, make sure all Node dependencies are installed and all Git submodules are checked out:
```bash
npm install && grunt
```
Create the custom build, use the `grunt custom` option, listing the modules to be excluded. Examples:
Exclude all **ajax** functionality:
```bash
grunt custom:-ajax
```
Exclude **css**, **effects**, **offset**, **dimensions**, and **position**. Excluding **css** automatically excludes its dependent modules:
```bash
grunt custom:-css,-position
```
Exclude **all** optional modules and use the `querySelectorAll`-based selector engine:
```bash
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event-alias,-offset,-wrap,-sizzle
```
For questions or requests regarding custom builds, please start a thread on the [Developing jQuery Core](https://forum.jquery.com/developing-jquery-core) section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.
Running the Unit Tests
--------------------------------------
Start grunt to auto-build jQuery as you work:
```bash
cd jquery && grunt watch
```
Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the "test" directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
- Windows: [WAMP download](http://www.wampserver.com/en/)
- Mac: [MAMP download](http://www.mamp.info/en/index.html)
- Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation)
- [Mongoose (most platforms)](http://code.google.com/p/mongoose/)
Building to a different directory
---------------------------------
To copy the built jQuery files from `/dist` to another directory:
```bash
grunt && grunt dist:/path/to/special/location/
```
With this example, the output files would be:
```bash
/path/to/special/location/jquery.js
/path/to/special/location/jquery.min.js
```
To add a permanent copy destination, create a file in `dist/` called ".destination.json". Inside the file, paste and customize the following:
```json
{
"/Absolute/path/to/other/destination": true
}
```
Additionally, both methods can be combined.
Updating Submodules
-------------------
Update the submodules to what is probably the latest upstream code.
```bash
grunt update_submodules
```
Note: This task will also be run any time the default `grunt` command is used.
Essential Git
-------------
As the source code is handled by the version control system Git, it's useful to know some features used.
### Submodules ###
The repository uses submodules, which normally are handled directly by the `grunt update_submodules` command, but sometimes you want to
be able to work with them manually.
Following are the steps to manually get the submodules:
```bash
git clone https://github.com/jquery/jquery.git
cd jquery
git submodule init
git submodule update
```
Or:
```bash
git clone https://github.com/jquery/jquery.git
cd jquery
git submodule update --init
```
Or:
```bash
git clone --recursive https://github.com/jquery/jquery.git
cd jquery
```
If you want to work inside a submodule, it is possible, but first you need to checkout a branch:
```bash
cd src/sizzle
git checkout master
```
After you've committed your changes to the submodule, you'll update the jquery project to point to the new commit,
but remember to push the submodule changes before pushing the new jquery commit:
```bash
cd src/sizzle
git push origin master
cd ..
git add src/sizzle
git commit
```
### cleaning ###
If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):
```bash
git reset --hard upstream/master
git clean -fdx
```
### rebasing ###
For feature/topic branches, you should always used the `--rebase` flag to `git pull`, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:
```bash
git config branch.autosetuprebase local
```
(see `man git-config` for more information)
### handling merge conflicts ###
If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
`git mergetool`. Even though the default tool `xxdiff` looks awful/old, it's rather useful.
Following are some commands that can be used there:
* `Ctrl + Alt + M` - automerge as much as possible
* `b` - jump to next merge conflict
* `s` - change the order of the conflicted lines
* `u` - undo an merge
* `left mouse button` - mark a block to be the winner
* `middle mouse button` - mark a line to be the winner
* `Ctrl + S` - save
* `Ctrl + Q` - quit
[QUnit](http://docs.jquery.com/QUnit) Reference
-----------------
### Test methods ###
```js
expect( numAssertions );
stop();
start();
```
note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters
### Test assertions ###
```js
ok( value, [message] );
equal( actual, expected, [message] );
notEqual( actual, expected, [message] );
deepEqual( actual, expected, [message] );
notDeepEqual( actual, expected, [message] );
strictEqual( actual, expected, [message] );
notStrictEqual( actual, expected, [message] );
raises( block, [expected], [message] );
```
Test Suite Convenience Methods Reference (See [test/data/testinit.js](https://github.com/jquery/jquery/blob/master/test/data/testinit.js))
------------------------------
### Returns an array of elements with the given IDs ###
```js
q( ... );
```
Example:
```js
q("main", "foo", "bar");
=> [ div#main, span#foo, input#bar ]
```
### Asserts that a selection matches the given IDs ###
```js
t( testName, selector, [ "array", "of", "ids" ] );
```
Example:
```js
t("Check for something", "//[a]", ["foo", "baar"]);
```
### Fires a native DOM event without going through jQuery ###
```js
fireNative( node, eventType )
```
Example:
```js
fireNative( jQuery("#elem")[0], "click" );
```
### Add random number to url to stop caching ###
```js
url( "some/url.php" );
```
Example:
```js
url("data/test.html");
=> "data/test.html?10538358428943"
url("data/test.php?foo=bar");
=> "data/test.php?foo=bar&10538358345554"
```
### Load tests in an iframe ###
Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"`
and fires the given callback on jQuery ready (using the jQuery loading from that page)
and passes the iFrame's jQuery to the callback.
```js
testIframe( fileName, testName, callback );
```
Callback arguments:
```js
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );
```
### Load tests in an iframe (window.iframeCallback) ###
Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"`
The given callback is fired when window.iframeCallback is called by the page
The arguments passed to the callback are the same as the
arguments passed to window.iframeCallback, whatever that may be
```js
testIframeWithCallback( testName, fileName, callback );
```
Questions?
----------
If you have any questions, please feel free to ask on the
[Developing jQuery Core forum](http://forum.jquery.com/developing-jquery-core) or in #jquery on irc.freenode.net.
{
"author": "Siddique Hameed",
"name": "angular-timer",
"version": "1.2.0",
"version": "1.3.3",
"homepage": "https://github.com/siddii/angular-timer",

@@ -12,8 +12,10 @@ "description": "Angular-Timer : A simple AngularJS directive demonstrating re-usability & interoperability",

"dependencies": {
"angular": ">= 1.0.7"
"angular": ">= 1.0.7",
"momentjs": "~2.9.0",
"humanize-duration": "~2.8.0"
},
"devDependencies": {
"bootstrap": "2.3.2",
"angular-scenario": ">= 1.0.7",
"angular-mocks": ">= 1.0.7"
"bootstrap": "2.3.2",
"angular-scenario": ">= 1.0.7",
"angular-mocks": ">= 1.0.7"
},

@@ -20,0 +22,0 @@ "main": "./dist/angular-timer.js",

@@ -8,5 +8,7 @@ module.exports = function(config){

files : [
'bower_components/humanize-duration/humanize-duration.js',
'bower_components/momentjs/min/moment-with-locales.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'app/js/timer.js',
'app/js/*.js',
'test/unit/**/*.js'

@@ -13,0 +15,0 @@ ],

/**
* angular-timer - v1.2.0 - 2014-12-15 6:34 PM
* angular-timer - v1.3.3 - 2015-06-15 3:07 PM
* https://github.com/siddii/angular-timer
*
* Copyright (c) 2014 Siddique Hameed
* Copyright (c) 2015 Siddique Hameed
* Licensed MIT <https://github.com/siddii/angular-timer/blob/master/LICENSE.txt>

@@ -20,5 +20,7 @@ */

autoStart: '&autoStart',
language: '@?',
fallback: '@?',
maxTimeUnit: '='
},
controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) {
controller: ['$scope', '$element', '$attrs', '$timeout', 'I18nService', '$interpolate', 'progressBarService', function ($scope, $element, $attrs, $timeout, I18nService, $interpolate, progressBarService) {

@@ -38,4 +40,23 @@ // Checking for trim function since IE8 doesn't have it

$scope.language = $scope.language || 'en';
$scope.fallback = $scope.fallback || 'en';
//allow to change the language of the directive while already launched
$scope.$watch('language', function(newVal, oldVal) {
if(newVal !== undefined) {
i18nService.init(newVal, $scope.fallback);
}
});
//init momentJS i18n, default english
var i18nService = new I18nService();
i18nService.init($scope.language, $scope.fallback);
//progress bar
$scope.displayProgressBar = 0;
$scope.displayProgressActive = 'active'; //Bootstrap active effect for progress bar
if ($element.html().trim().length === 0) {
$element.append($compile('<span>{{millis}}</span>')($scope));
$element.append($compile('<span>' + $interpolate.startSymbol() + 'millis' + $interpolate.endSymbol() + '</span>')($scope));
} else {

@@ -66,7 +87,7 @@ $element.append($compile($element.contents())($scope));

});
$scope.$on('timer-reset', function () {
$scope.reset();
});
$scope.$on('timer-set-countdown', function (e, countdown) {

@@ -82,5 +103,17 @@ $scope.countdown = countdown;

$scope.$watch('startTimeAttr', function(newValue, oldValue) {
if (newValue !== oldValue && $scope.isRunning) {
$scope.start();
}
});
$scope.$watch('endTimeAttr', function(newValue, oldValue) {
if (newValue !== oldValue && $scope.isRunning) {
$scope.start();
}
});
$scope.start = $element[0].start = function () {
$scope.startTime = $scope.startTimeAttr ? new Date($scope.startTimeAttr) : new Date();
$scope.endTime = $scope.endTimeAttr ? new Date($scope.endTimeAttr) : null;
$scope.startTime = $scope.startTimeAttr ? moment($scope.startTimeAttr) : moment();
$scope.endTime = $scope.endTimeAttr ? moment($scope.endTimeAttr) : null;
if (!$scope.countdown) {

@@ -99,3 +132,3 @@ $scope.countdown = $scope.countdownattr && parseInt($scope.countdownattr, 10) > 0 ? parseInt($scope.countdownattr, 10) : undefined;

}
$scope.startTime = new Date() - ($scope.stoppedTime - $scope.startTime);
$scope.startTime = moment().diff((moment($scope.stoppedTime).diff(moment($scope.startTime))));
tick();

@@ -113,3 +146,3 @@ $scope.isRunning = true;

// same as stop but without the event being triggered
$scope.stoppedTime = new Date();
$scope.stoppedTime = moment();
resetTimeout();

@@ -121,4 +154,4 @@ $scope.timeoutId = null;

$scope.reset = $element[0].reset = function () {
$scope.startTime = $scope.startTimeAttr ? new Date($scope.startTimeAttr) : new Date();
$scope.endTime = $scope.endTimeAttr ? new Date($scope.endTimeAttr) : null;
$scope.startTime = $scope.startTimeAttr ? moment($scope.startTimeAttr) : moment();
$scope.endTime = $scope.endTimeAttr ? moment($scope.endTimeAttr) : null;
$scope.countdown = $scope.countdownattr && parseInt($scope.countdownattr, 10) > 0 ? parseInt($scope.countdownattr, 10) : undefined;

@@ -130,3 +163,3 @@ resetTimeout();

};
$element.bind('$destroy', function () {

@@ -137,6 +170,12 @@ resetTimeout();

function calculateTimeUnits() {
var timeUnits = {}; //will contains time with units
if ($attrs.startTime !== undefined){
$scope.millis = new Date() - new Date($scope.startTimeAttr);
$scope.millis = moment().diff(moment($scope.startTimeAttr));
}
timeUnits = i18nService.getTimeUnits($scope.millis);
// compute time values based on maxTimeUnit specification

@@ -193,9 +232,12 @@ if (!$scope.maxTimeUnit || $scope.maxTimeUnit === 'day') {

$scope.yearsS = ($scope.years === 1)? '' : 's';
// new plural-singular unit decision functions (for custom units and multilingual support)
$scope.secondUnit = function(singleSecond, pluralSecond){if($scope.seconds === 1){if(singleSecond){return singleSecond;} return 'second';} if(pluralSecond){return pluralSecond;} return 'seconds';};
$scope.minuteUnit = function(singleMinute, pluralMinute){if($scope.minutes === 1){if(singleMinute){return singleMinute;} return 'minute';} if(pluralMinute){return pluralMinute;} return 'minutes';};
$scope.hourUnit = function(singleHour, pluralHour){if($scope.hours === 1){if(singleHour){return singleHour;} return 'hour';} if(pluralHour){return pluralHour;} return 'hours';};
$scope.dayUnit = function(singleDay, pluralDay){if($scope.days === 1){if(singleDay){return singleDay;} return 'day';} if(pluralDay){return pluralDay;} return 'days';};
$scope.monthUnit = function(singleMonth, pluralMonth){if($scope.months === 1){if(singleMonth){return singleMonth;} return 'month';} if(pluralMonth){return pluralMonth;} return 'months';};
$scope.yearUnit = function(singleYear, pluralYear){if($scope.years === 1){if(singleYear){return singleYear;} return 'year';} if(pluralYear){return pluralYear;} return 'years';};
$scope.secondUnit = timeUnits.seconds;
$scope.minuteUnit = timeUnits.minutes;
$scope.hourUnit = timeUnits.hours;
$scope.dayUnit = timeUnits.days;
$scope.monthUnit = timeUnits.months;
$scope.yearUnit = timeUnits.years;
//add leading zero if number is smaller than 10

@@ -243,14 +285,15 @@ $scope.sseconds = $scope.seconds < 10 ? '0' + $scope.seconds : $scope.seconds;

var tick = function () {
$scope.millis = new Date() - $scope.startTime;
var tick = function tick() {
var typeTimer = null; // countdown or endTimeAttr
$scope.millis = moment().diff($scope.startTime);
var adjustment = $scope.millis % 1000;
if ($scope.endTimeAttr) {
$scope.millis = $scope.endTime - new Date();
typeTimer = $scope.endTimeAttr;
$scope.millis = moment($scope.endTime).diff(moment());
adjustment = $scope.interval - $scope.millis % 1000;
}
if ($scope.countdownattr) {
typeTimer = $scope.countdownattr;
$scope.millis = $scope.countdown * 1000;

@@ -287,2 +330,11 @@ }

}
if(typeTimer !== null){
//calculate progress bar
$scope.progressBar = progressBarService.calculateProgressBar($scope.startTime, $scope.millis, $scope.endTime, $scope.countdownattr);
if($scope.progressBar === 100){
$scope.displayProgressActive = ''; //No more Bootstrap active effect
}
}
};

@@ -295,3 +347,3 @@

};
}]);
}]);

@@ -302,1 +354,113 @@ /* commonjs package manager support (eg componentjs) */

}
var app = angular.module('timer');
app.factory('I18nService', function() {
var I18nService = function() {};
I18nService.prototype.language = 'en';
I18nService.prototype.fallback = 'en';
I18nService.prototype.timeHumanizer = {};
I18nService.prototype.init = function init(lang, fallback) {
var supported_languages = humanizeDuration.getSupportedLanguages();
this.fallback = (fallback !== undefined) ? fallback : 'en';
if (supported_languages.indexOf(fallback) === -1) {
this.fallback = 'en';
}
this.language = lang;
if (supported_languages.indexOf(lang) === -1) {
this.language = this.fallback;
}
//moment init
moment.locale(this.language); //@TODO maybe to remove, it should be handle by the user's application itself, and not inside the directive
//human duration init, using it because momentjs does not allow accurate time (
// momentJS: a few moment ago, human duration : 4 seconds ago
this.timeHumanizer = humanizeDuration.humanizer({
language: this.language,
halfUnit:false
});
};
/**
* get time with units from momentJS i18n
* @param {int} millis
* @returns {{millis: string, seconds: string, minutes: string, hours: string, days: string, months: string, years: string}}
*/
I18nService.prototype.getTimeUnits = function getTimeUnits(millis) {
var diffFromAlarm = Math.round(millis/1000) * 1000; //time in milliseconds, get rid of the last 3 ms value to avoid 2.12 seconds display
var time = {};
if (typeof this.timeHumanizer != 'undefined'){
time = {
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["milliseconds"] }),
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["seconds"] }),
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["minutes", "seconds"] }) ,
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["hours", "minutes", "seconds"] }) ,
'days' : this.timeHumanizer(diffFromAlarm, { units: ["days", "hours", "minutes", "seconds"] }) ,
'months' : this.timeHumanizer(diffFromAlarm, { units: ["months", "days", "hours", "minutes", "seconds"] }) ,
'years' : this.timeHumanizer(diffFromAlarm, { units: ["years", "months", "days", "hours", "minutes", "seconds"] })
};
}
else {
console.error('i18nService has not been initialized. You must call i18nService.init("en") for example');
}
return time;
};
return I18nService;
});
var app = angular.module('timer');
app.factory('progressBarService', function() {
var ProgressBarService = function() {};
/**
* calculate the remaining time in a progress bar in percentage
* @param {momentjs} startValue in seconds
* @param {integer} currentCountdown, where are we in the countdown
* @param {integer} remainingTime, remaining milliseconds
* @param {integer} endTime, end time, can be undefined
* @param {integer} coutdown, original coutdown value, can be undefined
*
* joke : https://www.youtube.com/watch?v=gENVB6tjq_M
* @return {float} 0 --> 100
*/
ProgressBarService.prototype.calculateProgressBar = function calculateProgressBar(startValue, remainingTime, endTimeAttr, coutdown) {
var displayProgressBar = 0,
endTimeValue,
initialCountdown;
remainingTime = remainingTime / 1000; //seconds
if(endTimeAttr !== null){
endTimeValue = moment(endTimeAttr);
initialCountdown = endTimeValue.diff(startValue, 'seconds');
displayProgressBar = remainingTime * 100 / initialCountdown;
}
else {
displayProgressBar = remainingTime * 100 / coutdown;
}
displayProgressBar = 100 - displayProgressBar; //To have 0 to 100 and not 100 to 0
displayProgressBar = Math.round(displayProgressBar * 10) / 10; //learn more why : http://stackoverflow.com/questions/588004/is-floating-point-math-broken
if(displayProgressBar > 100){ //security
displayProgressBar = 100;
}
return displayProgressBar;
};
return new ProgressBarService();
});
/**
* angular-timer - v1.2.0 - 2014-12-15 6:34 PM
* angular-timer - v1.3.3 - 2015-06-15 3:07 PM
* https://github.com/siddii/angular-timer
*
* Copyright (c) 2014 Siddique Hameed
* Copyright (c) 2015 Siddique Hameed
* Licensed MIT <https://github.com/siddii/angular-timer/blob/master/LICENSE.txt>
*/
var timerModule=angular.module("timer",[]).directive("timer",["$compile",function(a){return{restrict:"EA",replace:!1,scope:{interval:"=interval",startTimeAttr:"=startTime",endTimeAttr:"=endTime",countdownattr:"=countdown",finishCallback:"&finishCallback",autoStart:"&autoStart",maxTimeUnit:"="},controller:["$scope","$element","$attrs","$timeout",function(b,c,d,e){function f(){b.timeoutId&&clearTimeout(b.timeoutId)}function g(){void 0!==d.startTime&&(b.millis=new Date-new Date(b.startTimeAttr)),b.maxTimeUnit&&"day"!==b.maxTimeUnit?"second"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3),b.minutes=0,b.hours=0,b.days=0,b.months=0,b.years=0):"minute"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4),b.hours=0,b.days=0,b.months=0,b.years=0):"hour"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5),b.days=0,b.months=0,b.years=0):"month"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24%30),b.months=Math.floor(b.millis/36e5/24/30),b.years=0):"year"===b.maxTimeUnit&&(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24%30),b.months=Math.floor(b.millis/36e5/24/30%12),b.years=Math.floor(b.millis/36e5/24/365)):(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24),b.months=0,b.years=0),b.secondsS=1===b.seconds?"":"s",b.minutesS=1===b.minutes?"":"s",b.hoursS=1===b.hours?"":"s",b.daysS=1===b.days?"":"s",b.monthsS=1===b.months?"":"s",b.yearsS=1===b.years?"":"s",b.secondUnit=function(a,c){return 1===b.seconds?a?a:"second":c?c:"seconds"},b.minuteUnit=function(a,c){return 1===b.minutes?a?a:"minute":c?c:"minutes"},b.hourUnit=function(a,c){return 1===b.hours?a?a:"hour":c?c:"hours"},b.dayUnit=function(a,c){return 1===b.days?a?a:"day":c?c:"days"},b.monthUnit=function(a,c){return 1===b.months?a?a:"month":c?c:"months"},b.yearUnit=function(a,c){return 1===b.years?a?a:"year":c?c:"years"},b.sseconds=b.seconds<10?"0"+b.seconds:b.seconds,b.mminutes=b.minutes<10?"0"+b.minutes:b.minutes,b.hhours=b.hours<10?"0"+b.hours:b.hours,b.ddays=b.days<10?"0"+b.days:b.days,b.mmonths=b.months<10?"0"+b.months:b.months,b.yyears=b.years<10?"0"+b.years:b.years}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),b.autoStart=d.autoStart||d.autostart,c.append(0===c.html().trim().length?a("<span>{{millis}}</span>")(b):a(c.contents())(b)),b.startTime=null,b.endTime=null,b.timeoutId=null,b.countdown=b.countdownattr&&parseInt(b.countdownattr,10)>=0?parseInt(b.countdownattr,10):void 0,b.isRunning=!1,b.$on("timer-start",function(){b.start()}),b.$on("timer-resume",function(){b.resume()}),b.$on("timer-stop",function(){b.stop()}),b.$on("timer-clear",function(){b.clear()}),b.$on("timer-reset",function(){b.reset()}),b.$on("timer-set-countdown",function(a,c){b.countdown=c}),b.start=c[0].start=function(){b.startTime=b.startTimeAttr?new Date(b.startTimeAttr):new Date,b.endTime=b.endTimeAttr?new Date(b.endTimeAttr):null,b.countdown||(b.countdown=b.countdownattr&&parseInt(b.countdownattr,10)>0?parseInt(b.countdownattr,10):void 0),f(),h(),b.isRunning=!0},b.resume=c[0].resume=function(){f(),b.countdownattr&&(b.countdown+=1),b.startTime=new Date-(b.stoppedTime-b.startTime),h(),b.isRunning=!0},b.stop=b.pause=c[0].stop=c[0].pause=function(){var a=b.timeoutId;b.clear(),b.$emit("timer-stopped",{timeoutId:a,millis:b.millis,seconds:b.seconds,minutes:b.minutes,hours:b.hours,days:b.days})},b.clear=c[0].clear=function(){b.stoppedTime=new Date,f(),b.timeoutId=null,b.isRunning=!1},b.reset=c[0].reset=function(){b.startTime=b.startTimeAttr?new Date(b.startTimeAttr):new Date,b.endTime=b.endTimeAttr?new Date(b.endTimeAttr):null,b.countdown=b.countdownattr&&parseInt(b.countdownattr,10)>0?parseInt(b.countdownattr,10):void 0,f(),h(),b.isRunning=!1,b.clear()},c.bind("$destroy",function(){f(),b.isRunning=!1}),b.countdownattr?(b.millis=1e3*b.countdownattr,b.addCDSeconds=c[0].addCDSeconds=function(a){b.countdown+=a,b.$digest(),b.isRunning||b.start()},b.$on("timer-add-cd-seconds",function(a,c){e(function(){b.addCDSeconds(c)})}),b.$on("timer-set-countdown-seconds",function(a,c){b.isRunning||b.clear(),b.countdown=c,b.millis=1e3*c,g()})):b.millis=0,g();var h=function(){b.millis=new Date-b.startTime;var a=b.millis%1e3;return b.endTimeAttr&&(b.millis=b.endTime-new Date,a=b.interval-b.millis%1e3),b.countdownattr&&(b.millis=1e3*b.countdown),b.millis<0?(b.stop(),b.millis=0,g(),void(b.finishCallback&&b.$eval(b.finishCallback))):(g(),b.timeoutId=setTimeout(function(){h(),b.$digest()},b.interval-a),b.$emit("timer-tick",{timeoutId:b.timeoutId,millis:b.millis}),void(b.countdown>0?b.countdown--:b.countdown<=0&&(b.stop(),b.finishCallback&&b.$eval(b.finishCallback))))};(void 0===b.autoStart||b.autoStart===!0)&&b.start()}]}}]);"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports=timerModule);
var timerModule=angular.module("timer",[]).directive("timer",["$compile",function(a){return{restrict:"EA",replace:!1,scope:{interval:"=interval",startTimeAttr:"=startTime",endTimeAttr:"=endTime",countdownattr:"=countdown",finishCallback:"&finishCallback",autoStart:"&autoStart",language:"@?",fallback:"@?",maxTimeUnit:"="},controller:["$scope","$element","$attrs","$timeout","I18nService","$interpolate","progressBarService",function(b,c,d,e,f,g,h){function i(){b.timeoutId&&clearTimeout(b.timeoutId)}function j(){var a={};void 0!==d.startTime&&(b.millis=moment().diff(moment(b.startTimeAttr))),a=k.getTimeUnits(b.millis),b.maxTimeUnit&&"day"!==b.maxTimeUnit?"second"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3),b.minutes=0,b.hours=0,b.days=0,b.months=0,b.years=0):"minute"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4),b.hours=0,b.days=0,b.months=0,b.years=0):"hour"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5),b.days=0,b.months=0,b.years=0):"month"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24%30),b.months=Math.floor(b.millis/36e5/24/30),b.years=0):"year"===b.maxTimeUnit&&(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24%30),b.months=Math.floor(b.millis/36e5/24/30%12),b.years=Math.floor(b.millis/36e5/24/365)):(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24),b.months=0,b.years=0),b.secondsS=1===b.seconds?"":"s",b.minutesS=1===b.minutes?"":"s",b.hoursS=1===b.hours?"":"s",b.daysS=1===b.days?"":"s",b.monthsS=1===b.months?"":"s",b.yearsS=1===b.years?"":"s",b.secondUnit=a.seconds,b.minuteUnit=a.minutes,b.hourUnit=a.hours,b.dayUnit=a.days,b.monthUnit=a.months,b.yearUnit=a.years,b.sseconds=b.seconds<10?"0"+b.seconds:b.seconds,b.mminutes=b.minutes<10?"0"+b.minutes:b.minutes,b.hhours=b.hours<10?"0"+b.hours:b.hours,b.ddays=b.days<10?"0"+b.days:b.days,b.mmonths=b.months<10?"0"+b.months:b.months,b.yyears=b.years<10?"0"+b.years:b.years}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),b.autoStart=d.autoStart||d.autostart,b.language=b.language||"en",b.fallback=b.fallback||"en",b.$watch("language",function(a){void 0!==a&&k.init(a,b.fallback)});var k=new f;k.init(b.language,b.fallback),b.displayProgressBar=0,b.displayProgressActive="active",c.append(0===c.html().trim().length?a("<span>"+g.startSymbol()+"millis"+g.endSymbol()+"</span>")(b):a(c.contents())(b)),b.startTime=null,b.endTime=null,b.timeoutId=null,b.countdown=b.countdownattr&&parseInt(b.countdownattr,10)>=0?parseInt(b.countdownattr,10):void 0,b.isRunning=!1,b.$on("timer-start",function(){b.start()}),b.$on("timer-resume",function(){b.resume()}),b.$on("timer-stop",function(){b.stop()}),b.$on("timer-clear",function(){b.clear()}),b.$on("timer-reset",function(){b.reset()}),b.$on("timer-set-countdown",function(a,c){b.countdown=c}),b.$watch("startTimeAttr",function(a,c){a!==c&&b.isRunning&&b.start()}),b.$watch("endTimeAttr",function(a,c){a!==c&&b.isRunning&&b.start()}),b.start=c[0].start=function(){b.startTime=b.startTimeAttr?moment(b.startTimeAttr):moment(),b.endTime=b.endTimeAttr?moment(b.endTimeAttr):null,b.countdown||(b.countdown=b.countdownattr&&parseInt(b.countdownattr,10)>0?parseInt(b.countdownattr,10):void 0),i(),l(),b.isRunning=!0},b.resume=c[0].resume=function(){i(),b.countdownattr&&(b.countdown+=1),b.startTime=moment().diff(moment(b.stoppedTime).diff(moment(b.startTime))),l(),b.isRunning=!0},b.stop=b.pause=c[0].stop=c[0].pause=function(){var a=b.timeoutId;b.clear(),b.$emit("timer-stopped",{timeoutId:a,millis:b.millis,seconds:b.seconds,minutes:b.minutes,hours:b.hours,days:b.days})},b.clear=c[0].clear=function(){b.stoppedTime=moment(),i(),b.timeoutId=null,b.isRunning=!1},b.reset=c[0].reset=function(){b.startTime=b.startTimeAttr?moment(b.startTimeAttr):moment(),b.endTime=b.endTimeAttr?moment(b.endTimeAttr):null,b.countdown=b.countdownattr&&parseInt(b.countdownattr,10)>0?parseInt(b.countdownattr,10):void 0,i(),l(),b.isRunning=!1,b.clear()},c.bind("$destroy",function(){i(),b.isRunning=!1}),b.countdownattr?(b.millis=1e3*b.countdownattr,b.addCDSeconds=c[0].addCDSeconds=function(a){b.countdown+=a,b.$digest(),b.isRunning||b.start()},b.$on("timer-add-cd-seconds",function(a,c){e(function(){b.addCDSeconds(c)})}),b.$on("timer-set-countdown-seconds",function(a,c){b.isRunning||b.clear(),b.countdown=c,b.millis=1e3*c,j()})):b.millis=0,j();var l=function m(){var a=null;b.millis=moment().diff(b.startTime);var c=b.millis%1e3;return b.endTimeAttr&&(a=b.endTimeAttr,b.millis=moment(b.endTime).diff(moment()),c=b.interval-b.millis%1e3),b.countdownattr&&(a=b.countdownattr,b.millis=1e3*b.countdown),b.millis<0?(b.stop(),b.millis=0,j(),void(b.finishCallback&&b.$eval(b.finishCallback))):(j(),b.timeoutId=setTimeout(function(){m(),b.$digest()},b.interval-c),b.$emit("timer-tick",{timeoutId:b.timeoutId,millis:b.millis}),b.countdown>0?b.countdown--:b.countdown<=0&&(b.stop(),b.finishCallback&&b.$eval(b.finishCallback)),void(null!==a&&(b.progressBar=h.calculateProgressBar(b.startTime,b.millis,b.endTime,b.countdownattr),100===b.progressBar&&(b.displayProgressActive=""))))};(void 0===b.autoStart||b.autoStart===!0)&&b.start()}]}}]);"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports=timerModule);var app=angular.module("timer");app.factory("I18nService",function(){var a=function(){};return a.prototype.language="en",a.prototype.fallback="en",a.prototype.timeHumanizer={},a.prototype.init=function(a,b){var c=humanizeDuration.getSupportedLanguages();this.fallback=void 0!==b?b:"en",-1===c.indexOf(b)&&(this.fallback="en"),this.language=a,-1===c.indexOf(a)&&(this.language=this.fallback),moment.locale(this.language),this.timeHumanizer=humanizeDuration.humanizer({language:this.language,halfUnit:!1})},a.prototype.getTimeUnits=function(a){var b=1e3*Math.round(a/1e3),c={};return"undefined"!=typeof this.timeHumanizer?c={millis:this.timeHumanizer(b,{units:["milliseconds"]}),seconds:this.timeHumanizer(b,{units:["seconds"]}),minutes:this.timeHumanizer(b,{units:["minutes","seconds"]}),hours:this.timeHumanizer(b,{units:["hours","minutes","seconds"]}),days:this.timeHumanizer(b,{units:["days","hours","minutes","seconds"]}),months:this.timeHumanizer(b,{units:["months","days","hours","minutes","seconds"]}),years:this.timeHumanizer(b,{units:["years","months","days","hours","minutes","seconds"]})}:console.error('i18nService has not been initialized. You must call i18nService.init("en") for example'),c},a});var app=angular.module("timer");app.factory("progressBarService",function(){var a=function(){};return a.prototype.calculateProgressBar=function(a,b,c,d){var e,f,g=0;return b/=1e3,null!==c?(e=moment(c),f=e.diff(a,"seconds"),g=100*b/f):g=100*b/d,g=100-g,g=Math.round(10*g)/10,g>100&&(g=100),g},new a});

@@ -11,2 +11,3 @@ module.exports = function (grunt) {

grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-gh-pages');

@@ -34,2 +35,25 @@ var userConfig = {

/**
* The directories to delete when `grunt clean` is executed.
*/
clean: [
'<%= dist_dir %>'
],
/* Copy all example into dist/examples */
copy: {
examples: {
src: 'examples/*',
dest: 'dist/'
},
nav: {
src: 'navbar.html',
dest: 'dist/'
},
example: {
src: 'examples.html',
dest: 'dist/'
}
},
concat: {

@@ -41,5 +65,33 @@ compile_js: {

src: [
'app/**/*.js'
'app/**/*.js'
],
dest: '<%= dist_dir %>/<%= pkg.name %>.js'
},
compile_all_js: {
src: [
'<%= dist_dir %>/<%= pkg.name %>.min.js',
'bower_components/momentjs/min/moment-with-locales.min.js',
'bower_components/humanize-duration/humanize-duration.js'
],
dest: '<%= dist_dir %>/assets/js/<%= pkg.name %>-all.min.js'
},
compile_bower_js: {
src: [
'bower_components/angular/angular.min.js',
'bower_components/jquery/jquery.min.js',
'bower_components/bootstrap/docs/assets/js/bootstrap.min.js',
'docs/docs.js',
'docs/prettify.js',
'docs/application.js'
],
dest: '<%= dist_dir %>/assets/js/<%= pkg.name %>-bower.js'
},
compile_bower_css: {
src: [
'bower_components/bootstrap/docs/assets/css/bootstrap.css',
'bower_components/bootstrap/docs/assets/css/bootstrap-responsive.css',
'docs/css/docs.css',
'docs/css/prettify.css'
],
dest: '<%= dist_dir %>/assets/css/<%= pkg.name %>-bower.css'
}

@@ -76,2 +128,10 @@ },

'gh-pages': {
options: {
base: 'dist',
message: 'Update gh-pages'
},
src: ['**']
},
connect: {

@@ -90,3 +150,3 @@ server: {

port: 3030,
base: '.'
base: 'dist'
}

@@ -127,5 +187,50 @@ }

grunt.registerTask('build', [
'jshint', 'concat', 'uglify'
'clean', 'jshint', 'concat:compile_js', 'uglify', 'concat:compile_all_js', 'concat:compile_bower_js', 'concat:compile_bower_css','copy:examples','copy:nav','copy:example'
]);
/**
* A utility function to get all app JavaScript sources.
*/
function filterForJS ( files ) {
return files.filter( function ( file ) {
return file.match( /\.js$/ );
});
}
/**
* A utility function to get all app CSS sources.
*/
function filterForCSS ( files ) {
return files.filter( function ( file ) {
return file.match( /\.css$/ );
});
}
/**
* The index.html template includes the stylesheet and javascript sources
* based on dynamic names calculated in this Gruntfile. This task assembles
* the list into variables for the template to use and then runs the
* compilation.
*/
grunt.registerMultiTask( 'index', 'Process index.html template', function () {
var dirRE = new RegExp( '^('+grunt.config('build_dir')+'|'+grunt.config('dist_dir')+')\/', 'g' );
var jsFiles = filterForJS( this.filesSrc ).map( function ( file ) {
return file.replace( dirRE, '' );
});
var cssFiles = filterForCSS( this.filesSrc ).map( function ( file ) {
return file.replace( dirRE, '' );
});
grunt.file.copy('index.tpl.html', this.data.dir + 'index.html', {
process: function ( contents, path ) {
return grunt.template.process( contents, {
data: {
scripts: jsFiles,
styles: cssFiles,
version: grunt.config( 'pkg.version' )
}
});
}
});
});
};
{
"author": "Siddique Hameed",
"name": "angular-timer",
"version": "1.2.0",
"version": "1.3.3",
"homepage": "https://github.com/siddii/angular-timer",
"main":"dist/angular-timer.js",
"main": "dist/angular-timer.js",
"licenses": {

@@ -18,28 +18,29 @@ "type": "MIT",

"devDependencies": {
"browserstack-runner": "~0.0.11",
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-qunit": "~0.2.2",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-qunit": "~0.2.2",
"grunt-contrib-watch": "~0.5.1",
"grunt-gh-pages": "^0.10.0",
"grunt-html-validation": "git://github.com/praveenvijayan/grunt-html-validation.git",
"grunt-jekyll": "~0.3.8",
"grunt-karma": "~0.6.2",
"grunt-recess": "~0.3.3",
"browserstack-runner": "~0.0.11",
"karma-script-launcher": "~0.1.0",
"karma": "~0.10.8",
"karma-chrome-launcher": "~0.1.1",
"karma-coffee-preprocessor": "~0.1.1",
"karma-firefox-launcher": "~0.1.2",
"karma-html2js-preprocessor": "~0.1.0",
"karma-firefox-launcher": "~0.1.2",
"karma-jasmine": "~0.1.4",
"requirejs": "~2.1.9",
"karma-ng-scenario": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.1",
"karma-requirejs": "~0.2.0",
"karma-coffee-preprocessor": "~0.1.1",
"karma-phantomjs-launcher": "~0.1.1",
"karma": "~0.10.8",
"grunt-karma": "~0.6.2",
"karma-ng-scenario": "~0.1.0"
"karma-script-launcher": "~0.1.0",
"requirejs": "~2.1.9"
}
}

@@ -10,3 +10,15 @@ ## angular-timer — A simple, re-usable, inter-operable timer directive [![Build Status](https://travis-ci.org/siddii/angular-timer.png)](https://travis-ci.org/siddii/angular-timer)

### Requirements
With Bower install :
* Install humanize-duration using [Bower](http://bower.io) - `bower install humanize-duration`
* Install momentjs using [Bower](http://bower.io) - `bower install momentjs`
And include these scripts in your webpage :
* bower_components/momentjs/min/moment.min.js
* bower_components/momentjs/min/locales.min.js
* bower_components/humanize-duration/humanize-duration.js
### Running locally
Install all bower components - `bower install`
Using [Grunt](http://gruntjs.com/) type `grunt` from command line, the default task will open index.html page in your

@@ -13,0 +25,0 @@ default browser

@@ -188,2 +188,13 @@ 'use strict';

it('i18n Countdown Timer - Spanish and French', function () {
sleep(1);
expect(element('#clock-timer-i18n #spanish timer').html()).toMatch(/segundo/);
expect(element('#clock-timer-i18n #french timer').html()).toMatch(/seconde/);
});
it('Progress bar display', function () {
sleep(1);
expect(element('#progressbar-timer timer#countdown').html()).toMatch(/3.3%/);
});
});

@@ -16,3 +16,3 @@ 'use strict';

$timeout(function() {
expect(element.html()).toMatch(/^<span class="ng-scope ng-binding">/);
expect(element.html()).toMatch(/^<span class="ng-binding ng-scope">/);
expect(element.html().indexOf('</span>')).toBeGreaterThan(-1);

@@ -22,3 +22,3 @@ $rootScope.$broadcast('timer-stop');

$timeout.flush();
expect($exceptionHandler.errors).toEqual(undefined);
expect($exceptionHandler.errors).toEqual([]);
});

@@ -25,0 +25,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc