added new layout and first handling of it in the parser
This commit is contained in:
parent
dc098233fe
commit
d7c461f39a
2 changed files with 80 additions and 4 deletions
56
uhr-de_CH.js
56
uhr-de_CH.js
|
@ -28,3 +28,59 @@ var layout = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
window._uhr.languages['de_CH'] = layout;
|
window._uhr.languages['de_CH'] = layout;
|
||||||
|
var newLayout = {
|
||||||
|
version: 2,
|
||||||
|
_es_isch: {1:[1,2,4,5,6,7]},
|
||||||
|
_genau: {3:[7,8,9,10,11]},
|
||||||
|
_ab: {4:[4,5]},
|
||||||
|
_vor: {4:[1,2,3]},
|
||||||
|
_haubi: {4:[7,8,9,10,11]},
|
||||||
|
_5: {1:[9,10,11]},
|
||||||
|
_10: {2:[9,10,11]},
|
||||||
|
_15: {2:[1,2,3,4,5,6]},
|
||||||
|
_20: {3:[1,2,3,4,5,6]},
|
||||||
|
language: 'Bärndütsch (nöi)',
|
||||||
|
letters: [
|
||||||
|
'ESKISCHAFÜF',
|
||||||
|
'VIERTUBFZÄÄ',
|
||||||
|
'ZWÄNZGGENAU',
|
||||||
|
'VORABOHAUBI',
|
||||||
|
'EISZWÖISFRÜ',
|
||||||
|
'VIERIFÜFIQT',
|
||||||
|
'SÄCHSISIBNI',
|
||||||
|
'ACHTINÜNIEL',
|
||||||
|
'ZÄNIERBEUFI',
|
||||||
|
'ZWÜUFINAUHR'
|
||||||
|
],
|
||||||
|
permanent: this._es_isch,
|
||||||
|
minutes: {
|
||||||
|
0: this._genau,
|
||||||
|
1: {},
|
||||||
|
5: [this._5, this._ab],
|
||||||
|
10: [this._10, this._ab],
|
||||||
|
15: [this._15, this._ab],
|
||||||
|
20: [this._20, this._ab],
|
||||||
|
25: [this._5, this._vor, this._haubi],
|
||||||
|
30: [this._haubi],
|
||||||
|
35: [this._5, this._ab, this._haubi],
|
||||||
|
40: [this._20, this._vor],
|
||||||
|
45: [this._15, this._vor],
|
||||||
|
50: [this._10, this._vor],
|
||||||
|
55: [this._5, this._vor]
|
||||||
|
},
|
||||||
|
hours: {
|
||||||
|
0: {10:[1,2,3,4,5,6]},
|
||||||
|
1: {5:[1,2,3]},
|
||||||
|
2: {5:[4,5,6,7]},
|
||||||
|
3: {5:[9,10,11]},
|
||||||
|
4: {6:[1,2,3,4,5]},
|
||||||
|
5: {6:[6,7,8,9]},
|
||||||
|
6: {7:[1,2,3,4,5,6]},
|
||||||
|
7: {7:[7,8,9,10,11]},
|
||||||
|
8: {8:[1,2,3,4,5]},
|
||||||
|
9: {8:[6,7,8,9]},
|
||||||
|
10: {9:[1,2,3,4]},
|
||||||
|
11: {9:[8,9,10,11]}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window._uhr.languages['de_CH2'] = newLayout;
|
||||||
|
|
28
uhr.js
28
uhr.js
|
@ -286,17 +286,37 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
function UhrRenderer(layout, renderarea) {
|
function UhrRenderer(layout, renderarea) {
|
||||||
this.layout = layout;
|
this.layout = layout;
|
||||||
this.renderarea = renderarea;
|
this.renderarea = renderarea;
|
||||||
|
this._parseLayoutV2 = function() {
|
||||||
|
console.log("attempting to parse layout v2");
|
||||||
|
var letters = [['a'], ['b', 'c',]];
|
||||||
|
return letters;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UhrRenderer.prototype.render = function(uhr, beforeshow) {
|
UhrRenderer.prototype.render = function(uhr, beforeshow) {
|
||||||
var renderer = this;
|
var renderer = this;
|
||||||
|
var letters;
|
||||||
|
if (this.layout.version !== undefined) {
|
||||||
|
switch (this.layout.version) {
|
||||||
|
case 2:
|
||||||
|
letters = this._parseLayoutV2();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (console !== undefined && typeof console.log == 'function') {
|
||||||
|
console.log("Unknown layout version: " + this.layout.version);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
letters = renderer.layout.values;
|
||||||
|
}
|
||||||
this.renderarea.fadeOut('fast', function() {
|
this.renderarea.fadeOut('fast', function() {
|
||||||
renderer.renderarea.empty();
|
renderer.renderarea.empty();
|
||||||
for (var y = 0; y < renderer.layout.values.length; y++) {
|
for (var y = 0; y < letters.length; y++) {
|
||||||
for (var x = 0; x < renderer.layout.values[y].length; x++) {
|
for (var x = 0; x < letters[y].length; x++) {
|
||||||
var letter = renderer.layout.values[y][x];
|
var letter = letters[y][x];
|
||||||
renderer.renderarea.append(letter.toString());
|
renderer.renderarea.append(letter.toString());
|
||||||
}
|
}
|
||||||
if (y < renderer.layout.values.length - 1) {
|
if (y < letters.length - 1) {
|
||||||
renderer.renderarea.append('<br/>');
|
renderer.renderarea.append('<br/>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue