bugfix for update in relation to fixed time; slight change in format of

layout definition.
This commit is contained in:
Manuel Friedli 2014-06-26 14:41:56 +02:00
parent f9b6acf8b6
commit 6d588aa08b
2 changed files with 31 additions and 24 deletions

View File

@ -41,18 +41,18 @@ var layout = {
"permanent": h._es_isch,
"minutes": {
"0": h._genau,
"1": {},
"5": [h._5, h._ab],
"10": [h._10, h._ab],
"15": [h._15, h._ab],
"20": [h._20, h._ab],
"25": [h._5, h._vor, h._haubi],
"30": [h._haubi],
"35": [h._5, h._ab, h._haubi],
"40": [h._20, h._vor],
"45": [h._15, h._vor],
"50": [h._10, h._vor],
"55": [h._5, h._vor]
"1,2,3,4": {},
"5,6,7,8,9": [h._5, h._ab],
"10,11,12,13,14": [h._10, h._ab],
"15,16,17,18,19": [h._15, h._ab],
"20,21,22,23,24": [h._20, h._ab],
"25,26,27,28,29": [h._5, h._vor, h._haubi],
"30,31,32,33,34": [h._haubi],
"35,36,37,38,39": [h._5, h._ab, h._haubi],
"40,41,42,43,44": [h._20, h._vor],
"45,46,47,48,48": [h._15, h._vor],
"50,51,52,53,54": [h._10, h._vor],
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"1": {5:[1,2,3]},

31
uhr.js
View File

@ -30,8 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
language: 'de_CH',
theme: 'black',
force: false,
controls: true,
time: new Date()
controls: true
},
start: function() {
if (!this._isOn()) {
@ -153,8 +152,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
if (typeof this._language().getCoarseMinute === 'function') {
return this._language().getCoarseMinute(date);
}
var minutes = date.getMinutes();
return minutes - this._getDotMinute(date);
return date.getMinutes();
},
_getDotMinute: function(date) {
if (typeof this._language().getDotMinute === 'function') {
@ -174,10 +172,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
},
_create: function() {
this._id = window._uhr.id++;
var userTime = this.options.time;
if (this.options.time === undefined) {
this.options.time = new Date();
}
this._setupHTML();
this._wireFunctionality();
if (this.options.time !== undefined) {
this.time(this.options.time);
if (userTime !== undefined) {
this.time(userTime);
}
},
_setupHTML: function() {
@ -302,16 +304,21 @@ function UhrRenderer(layout, renderarea) {
} else {
this._parseObject(letters, 'on', permanent);
}
var minutes = this.layout.minutes;
for (minute in minutes) {
if (minutes.hasOwnProperty(minute)) {
var highlightLetters = minutes[minute];
var minuteDefinitions = this.layout.minutes;
for (minutes in minuteDefinitions) {
if (minuteDefinitions.hasOwnProperty(minutes)) {
var highlightLetters = minuteDefinitions[minutes];
var minuteArray = minutes.split(',');
if (Array.isArray(highlightLetters)) {
for (var i = 0; i < highlightLetters.length; i++) {
this._parseObject(letters, 'minute' + minute, highlightLetters[i]);
for (var j = 0; j < minuteArray.length; j++) {
this._parseObject(letters, 'minute' + minuteArray[j], highlightLetters[i]);
}
}
} else {
this._parseObject(letters, 'minute' + minute, highlightLetters);
for (var i = 0; i < minuteArray.length; i++) {
this._parseObject(letters, 'minute' + minuteArray[i], highlightLetters);
}
}
}
}