@@ -6,10 +6,7 @@ angular.module('timer', [])
6
6
scope : {
7
7
interval : '=interval' ,
8
8
startTimeAttr : '=startTime' ,
9
- countdownattr : '=countdown' ,
10
- fullSeconds : '=fullSeconds' ,
11
- fullMinutes : '=fullMinutes' ,
12
- fullHours : '=fullHours'
9
+ countdownattr : '=countdown'
13
10
} ,
14
11
controller : function ( $scope , $element , $attrs ) {
15
12
//angular 1.2 doesn't support attributes ending in "-start", so we're
@@ -92,25 +89,15 @@ angular.module('timer', [])
92
89
} ) ;
93
90
94
91
function calculateTimeUnits ( ) {
95
- if ( $scope . fullSeconds === true ) {
96
- $scope . seconds = Math . floor ( $scope . millis / 1000 ) ;
97
- } else {
98
- $scope . seconds = Math . floor ( ( $scope . millis / 1000 ) % 60 ) ;
99
- }
100
-
101
- if ( $scope . fullMinutes === true ) {
102
- $scope . minutes = Math . floor ( $scope . millis / 60000 ) ;
103
- } else {
104
- $scope . minutes = Math . floor ( ( ( $scope . millis / ( 60000 ) ) % 60 ) ) ;
105
- }
92
+ $scope . seconds = Math . floor ( ( $scope . millis / 1000 ) % 60 ) ;
93
+ $scope . minutes = Math . floor ( ( $scope . millis / 60000 ) % 60 ) ;
94
+ $scope . hours = Math . floor ( ( $scope . millis / 3600000 ) % 24 ) ;
106
95
107
- if ( $scope . fullHours === true ) {
108
- $scope . hours = Math . floor ( $scope . millis / 3600000 ) ;
109
- } else {
110
- $scope . hours = Math . floor ( ( ( $scope . millis / ( 3600000 ) ) % 24 ) ) ;
111
- }
96
+ $scope . fullSeconds = Math . floor ( $scope . millis / 1000 ) ;
97
+ $scope . fullMinutes = Math . floor ( $scope . millis / 60000 ) ;
98
+ $scope . fullHours = Math . floor ( $scope . millis / 3600000 ) ;
112
99
113
- $scope . days = Math . floor ( ( ( $scope . millis / ( 3600000 ) ) / 24 ) ) ;
100
+ $scope . days = Math . floor ( ( $scope . millis / 3600000 ) / 24 ) ;
114
101
}
115
102
116
103
//determine initial values of time units
0 commit comments