Skip to content

Commit 85385af

Browse files
committed
Merge pull request siddii#63 from siddii/cworsley4-master
PR for merging https://github.com/cworsley4/angular-timer.git
2 parents 0711c00 + cebaecc commit 85385af

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

app/js/timer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ angular.module('timer', [])
1212
},
1313
controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) {
1414

15+
// Checking for trim function since IE8 doesn't have it
16+
// If not a function, create tirm with RegEx to mimic native trim
17+
if(typeof String.prototype.trim !== 'function') {
18+
String.prototype.trim = function() {
19+
return this.replace(/^\s+|\s+$/g, '');
20+
};
21+
}
22+
1523
//angular 1.2 doesn't support attributes ending in "-start", so we're
1624
//supporting both "autostart" and "auto-start" as a solution for
1725
//backward and forward compatibility.

dist/angular-timer.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-timer - v1.0.12 - 2014-03-18 4:02 PM
2+
* angular-timer - v1.0.12 - 2014-04-13 4:22 PM
33
* https://github.com/siddii/angular-timer
44
*
55
* Copyright (c) 2014 Siddique Hameed
@@ -19,6 +19,14 @@ angular.module('timer', [])
1919
},
2020
controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) {
2121

22+
// Checking for trim function since IE8 doesn't have it
23+
// If not a function, create tirm with RegEx to mimic native trim
24+
if(typeof String.prototype.trim !== 'function') {
25+
String.prototype.trim = function() {
26+
return this.replace(/^\s+|\s+$/g, '');
27+
};
28+
}
29+
2230
//angular 1.2 doesn't support attributes ending in "-start", so we're
2331
//supporting both "autostart" and "auto-start" as a solution for
2432
//backward and forward compatibility.
@@ -112,14 +120,12 @@ angular.module('timer', [])
112120
$scope.days = Math.floor((($scope.millis / (3600000)) / 24));
113121
$scope.daysS = $scope.days==1 ? '' : 's';
114122

115-
116123
//add leading zero if number is smaller than 10
117124
$scope.sseconds = $scope.seconds < 10 ? '0' + $scope.seconds : $scope.seconds;
118125
$scope.mminutes = $scope.minutes < 10 ? '0' + $scope.minutes : $scope.minutes;
119126
$scope.hhours = $scope.hours < 10 ? '0' + $scope.hours : $scope.hours;
120127
$scope.ddays = $scope.days < 10 ? '0' + $scope.days : $scope.days;
121128

122-
123129
}
124130
//determine initial values of time units and add AddSeconds functionality
125131
if ($scope.countdownattr) {

dist/angular-timer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)