From 7b59da0b6bfbab35516a1b0a28e29fd1771e6143 Mon Sep 17 00:00:00 2001 From: Ashok Fernandez Date: Fri, 12 Jun 2015 17:53:33 +0200 Subject: [PATCH] Added comments, tidied things up a little --- angular-timezone-selector.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/angular-timezone-selector.js b/angular-timezone-selector.js index 6e53bf1..18f3745 100644 --- a/angular-timezone-selector.js +++ b/angular-timezone-selector.js @@ -1,4 +1,15 @@ /*global angular, _, moment, $*/ + +/** + * angular-timezone-selector + * + * A simple directive that allows a user to pick their timezone + * + * Author: Ashok Fernandez + * Date: 12/06/2015 + * License: MIT + */ + angular.module('angular-timezone-selector', []) .constant('_', _) .constant('moment', moment) @@ -13,7 +24,10 @@ angular.module('angular-timezone-selector', []) }) return timezoneMap }]) + + // Timezone name to country codemap .factory('zoneToCC', ['_', function (_) { + // Note: zones is populated with the data from 'data/zone.csv' when this file is built var zones = [] var zoneMap = {} _.forEach(zones, function (zone) { @@ -22,7 +36,10 @@ angular.module('angular-timezone-selector', []) return zoneMap }]) + + // Country code to country name map .factory('CCToCountryName', ['_', function (_) { + // Note: codes is populated with the data from 'data/cca2_to_country_name.csv' when this file is built var codes = [] var codeMap = {} _.forEach(codes, function (code) { @@ -30,12 +47,12 @@ angular.module('angular-timezone-selector', []) }) return codeMap }]) + .directive('timezoneSelector', ['_', 'timezones', 'zoneToCC', 'CCToCountryName', function (_, timezones, zoneToCC, CCToCountryName) { return { restrict: 'E', replace: true, template: '', - // require: 'ngModel', scope: { ngModel: '=' },