preparing to support languages that make a difference between AM and PM

This commit is contained in:
Manuel Friedli 2014-06-28 22:03:35 +02:00
parent 75568578f6
commit f93083c128
5 changed files with 52 additions and 65 deletions

View file

@ -53,18 +53,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._vor] "55,56,57,58,59": [h._5, h._vor]
}, },
"hours": { "hours": {
"1": {6:[1,2,3,4]}, "0,12": {9:[7,8,9,10,11]},
"2": {6:[8,9,10,11]}, "1,13": {6:[1,2,3,4]},
"3": {7:[1,2,3,4]}, "2,14": {6:[8,9,10,11]},
"4": {7:[8,9,10,11]}, "3,15": {7:[1,2,3,4]},
"5": {5:[8,9,10,11]}, "4,16": {7:[8,9,10,11]},
"6": {8:[1,2,3,4,5]}, "5,17": {5:[8,9,10,11]},
"7": {9:[1,2,3,4,5,6]}, "6,18": {8:[1,2,3,4,5]},
"8": {8:[8,9,10,11]}, "7,19": {9:[1,2,3,4,5,6]},
"9": {10:[4,5,6,7]}, "8,20": {8:[8,9,10,11]},
"10": {10:[1,2,3,4]}, "9,21": {10:[4,5,6,7]},
"11": {5:[6,7,8]}, "10,22": {10:[1,2,3,4]},
"12": {9:[7,8,9,10,11]} "11,23": {5:[6,7,8]}
} }
}; };
window,_uhr.register('de', layout); window,_uhr.register('de', layout);

View file

@ -78,18 +78,18 @@ var layout = {
}, },
// Die Stunden; gleiches Format wie bei den Minuten // Die Stunden; gleiches Format wie bei den Minuten
"hours": { "hours": {
"1": {5:[1,2,3]}, "0,12": {10:[1,2,3,4,5,6]},
"2": {5:[4,5,6,7]}, "1,13": {5:[1,2,3]},
"3": {5:[9,10,11]}, "2,14": {5:[4,5,6,7]},
"4": {6:[1,2,3,4,5]}, "3,15": {5:[9,10,11]},
"5": {6:[6,7,8,9]}, "4,16": {6:[1,2,3,4,5]},
"6": {7:[1,2,3,4,5,6]}, "5,17": {6:[6,7,8,9]},
"7": {7:[7,8,9,10,11]}, "6,18": {7:[1,2,3,4,5,6]},
"8": {8:[1,2,3,4,5]}, "7,19": {7:[7,8,9,10,11]},
"9": {8:[6,7,8,9]}, "8,20": {8:[1,2,3,4,5]},
"10": {9:[1,2,3,4]}, "9,21": {8:[6,7,8,9]},
"11": {9:[8,9,10,11]}, "10,22": {9:[1,2,3,4]},
"12": {10:[1,2,3,4,5,6]} "11,23": {9:[8,9,10,11]}
} }
}; };
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren. // Das Layout bei der Uhr unter dem Code "de_CH" registrieren.

View file

@ -54,18 +54,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._vor] "55,56,57,58,59": [h._5, h._vor]
}, },
"hours": { "hours": {
"1": {5:[1,2,3]}, "0,12": {10:[1,2,3,4,5,6]},
"2": {5:[4,5,6,7]}, "1,13": {5:[1,2,3]},
"3": {5:[9,10,11]}, "2,14": {5:[4,5,6,7]},
"4": {6:[1,2,3,4,5]}, "3,15": {5:[9,10,11]},
"5": {6:[6,7,8,9]}, "4,16": {6:[1,2,3,4,5]},
"6": {7:[1,2,3,4,5,6]}, "5,17": {6:[6,7,8,9]},
"7": {7:[7,8,9,10,11]}, "6,18": {7:[1,2,3,4,5,6]},
"8": {8:[1,2,3,4,5]}, "7,19": {7:[7,8,9,10,11]},
"9": {8:[6,7,8,9]}, "8,20": {8:[1,2,3,4,5]},
"10": {9:[1,2,3,4]}, "9,21": {8:[6,7,8,9]},
"11": {9:[8,9,10,11]}, "10,22": {9:[1,2,3,4]},
"12": {10:[1,2,3,4,5,6]} "11,23": {9:[8,9,10,11]}
} }
}; };
window,_uhr.register('de_CH_genau', layout); window,_uhr.register('de_CH_genau', layout);

View file

@ -55,18 +55,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._to] "55,56,57,58,59": [h._5, h._to]
}, },
"hours": { "hours": {
"1": {6:[1,2,3]}, "0,12": {9:[6,7,8,9,10,11]},
"2": {7:[9,10,11]}, "1,13": {6:[1,2,3]},
"3": {6:[7,8,9,10,11]}, "2,14": {7:[9,10,11]},
"4": {7:[1,2,3,4]}, "3,15": {6:[7,8,9,10,11]},
"5": {7:[5,6,7,8]}, "4,16": {7:[1,2,3,4]},
"6": {6:[4,5,6]}, "5,17": {7:[5,6,7,8]},
"7": {9:[1,2,3,4,5]}, "6,18": {6:[4,5,6]},
"8": {8:[1,2,3,4,5]}, "7,19": {9:[1,2,3,4,5]},
"9": {5:[8,9,10,11]}, "8,20": {8:[1,2,3,4,5]},
"10": {10:[1,2,3]}, "9,21": {5:[8,9,10,11]},
"11": {8:[6,7,8,9,10,11]}, "10,22": {10:[1,2,3]},
"12": {9:[6,7,8,9,10,11]} "11,23": {8:[6,7,8,9,10,11]}
}, },
"getHour": function(date) { "getHour": function(date) {
var hour = date.getHours(); var hour = date.getHours();

13
uhr.js
View file

@ -151,11 +151,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
this._highlight('dot' + i); this._highlight('dot' + i);
} }
this._highlight('minute' + coarseMinute); this._highlight('minute' + coarseMinute);
hour = this._normalizeHour(hour);
this._highlight('hour' + hour); this._highlight('hour' + hour);
if (coarseMinute == 0) {
this._highlight('sharphour');
}
}, },
_language: function() { _language: function() {
for (var i = 0; i < window._uhr.languages.length; i++) { for (var i = 0; i < window._uhr.languages.length; i++) {
@ -196,15 +192,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
var minutes = date.getMinutes(); var minutes = date.getMinutes();
return minutes % 5; return minutes % 5;
}, },
_normalizeHour: function(hour) {
if (hour > 12) {
hour %= 12;
}
if (hour == 0) {
return 12;
}
return hour;
},
_create: function() { _create: function() {
this._id = window._uhr.id++; this._id = window._uhr.id++;
var userTime = this.options.time; var userTime = this.options.time;