Skip to content

Commit 255ff61

Browse files
committed
fixed
1 parent f3ad172 commit 255ff61

1 file changed

Lines changed: 1 addition & 66 deletions

File tree

dist/angular-timer.js

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var timerModule = angular.module('timer', [])
3333
monthsS: '=?',
3434
yearsS: '=?'
3535
},
36-
controller: ['$scope', '$element', '$attrs', '$timeout', 'I18nService', '$interpolate', 'progressBarService', function ($scope, $element, $attrs, $timeout, I18nService, $interpolate, progressBarService) {
36+
controller: ['$scope', '$element', '$attrs', '$timeout', '$interpolate', 'progressBarService', function ($scope, $element, $attrs, $timeout, $interpolate, progressBarService) {
3737

3838
// Checking for trim function since IE8 doesn't have it
3939
// If not a function, create tirm with RegEx to mimic native trim
@@ -338,71 +338,6 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
338338

339339
var app = angular.module('timer');
340340

341-
app.factory('I18nService', function() {
342-
343-
var I18nService = function() {};
344-
345-
I18nService.prototype.language = 'en';
346-
I18nService.prototype.fallback = 'en';
347-
I18nService.prototype.timeHumanizer = {};
348-
349-
I18nService.prototype.init = function init(lang, fallback) {
350-
var supported_languages = humanizeDuration.getSupportedLanguages();
351-
352-
this.fallback = (fallback !== undefined) ? fallback : 'en';
353-
if (supported_languages.indexOf(fallback) === -1) {
354-
this.fallback = 'en';
355-
}
356-
357-
this.language = lang;
358-
if (supported_languages.indexOf(lang) === -1) {
359-
this.language = this.fallback;
360-
}
361-
362-
//moment init
363-
moment.locale(this.language); //@TODO maybe to remove, it should be handle by the user's application itself, and not inside the directive
364-
365-
//human duration init, using it because momentjs does not allow accurate time (
366-
// momentJS: a few moment ago, human duration : 4 seconds ago
367-
this.timeHumanizer = humanizeDuration.humanizer({
368-
language: this.language,
369-
halfUnit:false
370-
});
371-
};
372-
373-
/**
374-
* get time with units from momentJS i18n
375-
* @param {int} millis
376-
* @returns {{millis: string, seconds: string, minutes: string, hours: string, days: string, months: string, years: string}}
377-
*/
378-
I18nService.prototype.getTimeUnits = function getTimeUnits(millis) {
379-
var diffFromAlarm = Math.round(millis/1000) * 1000; //time in milliseconds, get rid of the last 3 ms value to avoid 2.12 seconds display
380-
381-
var time = {};
382-
383-
if (typeof this.timeHumanizer != 'undefined'){
384-
time = {
385-
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["milliseconds"] }),
386-
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["seconds"] }),
387-
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["minutes", "seconds"] }) ,
388-
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["hours", "minutes", "seconds"] }) ,
389-
'days' : this.timeHumanizer(diffFromAlarm, { units: ["days", "hours", "minutes", "seconds"] }) ,
390-
'months' : this.timeHumanizer(diffFromAlarm, { units: ["months", "days", "hours", "minutes", "seconds"] }) ,
391-
'years' : this.timeHumanizer(diffFromAlarm, { units: ["years", "months", "days", "hours", "minutes", "seconds"] })
392-
};
393-
}
394-
else {
395-
console.error('i18nService has not been initialized. You must call i18nService.init("en") for example');
396-
}
397-
398-
return time;
399-
};
400-
401-
return I18nService;
402-
});
403-
404-
var app = angular.module('timer');
405-
406341
app.factory('progressBarService', function() {
407342

408343
var ProgressBarService = function() {};

0 commit comments

Comments
 (0)