hochdeutsche version
This commit is contained in:
parent
6aee61de90
commit
5b051230c9
3 changed files with 60 additions and 25 deletions
17
uhr-de.js
Normal file
17
uhr-de.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
layout = {
|
||||
language: "Deutsch",
|
||||
locale: "de",
|
||||
values: [
|
||||
[l('E', 'on'), l('S', 'on'),l('K'),l('I', 'on'),l('S', 'on'),l('T', 'on'),l('A'),m('F', 5, 25, 35, 55),m('Ü', 5, 25, 35, 55),m('N', 5, 25, 35, 55),m('F', 5, 25, 35, 55)],
|
||||
[m('Z', 10, 50), m('E', 10, 50),m('H', 10, 50),m('N', 10, 50),m('Z', 20, 40),m('W', 20, 40),m('A', 20, 40),m('N', 20, 40),m('Z', 20, 40),m('I', 20, 40),m('G', 20, 40)],
|
||||
[m('D', 45), m('R', 45),m('E', 45),m('I', 45),m('V', 15, 45),m('I', 15, 45),m('E', 15, 45),m('R', 15, 45),m('T', 15, 45),m('E', 15, 45),m('L', 15, 45)],
|
||||
[m('V', 25, 40, 50, 55), m('O', 25, 40, 50, 55),m('R', 25, 40, 50, 55),l('F'),l('U'),l('N'),l('K'),m('N', 5, 10, 15, 20, 35),m('A', 5, 10, 15, 20, 35),m('C', 5, 10, 15, 20, 35),m('H', 5, 10, 15, 20, 35)],
|
||||
[m('H', 25, 30, 35),m('A', 25, 30, 35),m('L', 25, 30, 35),m('B', 25, 30, 35),l('A'),h('E', 11),h('L', 11),h('F', 5, 11),h('Ü', 5),h('N', 5),h('F', 5)],
|
||||
[h('E', 1), h('I', 1),h('N', 1),h('S', 1),l('X'),l('A'),l('M'),h('Z', 2),h('W', 2),h('E', 2),h('I', 2)],
|
||||
[h('D', 3), h('R', 3),h('E', 3),h('I', 3),l('P'),l('M'),l('J'),h('V', 4),h('I', 4),h('E', 4),h('R', 4)],
|
||||
[h('S', 6), h('E', 6),h('C', 6),h('H', 6),h('S', 6),l('N'),l('L'),h('A', 8),h('C', 8),h('H', 8),h('T', 8)],
|
||||
[h('S', 7), h('I', 7),h('E', 7),h('B', 7),h('E', 7),h('N', 7),h('Z', 12),h('W', 12),h('Ö', 12),h('L', 12),h('F', 12)],
|
||||
[h('Z', 10), h('E', 10),h('H', 10),h('N', 9, 10),h('E', 9),h('U', 9),h('N', 9),l('K'),l('U'),l('H'),l('R')]
|
||||
]
|
||||
};
|
||||
|
|
@ -2,7 +2,7 @@ var layout = {
|
|||
language: "Bärndütsch",
|
||||
locale: "de_CH",
|
||||
values: [
|
||||
[l('E', 'alwayson'), l('S', 'alwayson'),l('K'),l('I', 'alwayson'),l('S', 'alwayson'),l('C', 'alwayson'),l('H', 'alwayson'),l('A'),m('F', 5, 25, 35, 55),m('Ü', 5, 25, 35, 55),m('F', 5, 25, 35, 55)],
|
||||
[l('E', 'on'), l('S', 'on'),l('K'),l('I', 'on'),l('S', 'on'),l('C', 'on'),l('H', 'on'),l('A'),m('F', 5, 25, 35, 55),m('Ü', 5, 25, 35, 55),m('F', 5, 25, 35, 55)],
|
||||
[m('V', 15, 45), m('I', 15, 45),m('E', 15, 45),m('R', 15, 45),m('T', 15, 45),m('U', 15, 45),l('B'),l('F'),m('Z', 10, 50),m('Ä', 10, 50),m('Ä', 10, 50)],
|
||||
[m('Z', 20, 40), m('W', 20, 40),m('Ä', 20, 40),m('N', 20, 40),m('Z', 20, 40),m('G', 20, 40),l('S'),l('I'),m('V', 25, 40, 45, 50, 55),m('O', 25, 40, 45, 50, 55),m('R', 25, 40, 45, 50, 55)],
|
||||
[m('A', 5, 10, 15, 20, 35), m('B', 5, 10, 15, 20, 35),l('O'),m('H', 25, 30, 35),m('A', 25, 30, 35),m('U', 25, 30, 35),m('B', 25, 30, 35),m('I', 25, 30, 35),l('E'),l('G'),l('E')],
|
||||
|
|
66
uhr.js
66
uhr.js
|
@ -1,40 +1,58 @@
|
|||
var clock = null;
|
||||
var currentMinute = -1;
|
||||
var layout = layout || {};
|
||||
|
||||
function highlightCurrentTime() {
|
||||
var now = new Date();
|
||||
var hour = now.getHours();
|
||||
var minute = now.getMinutes();
|
||||
if (minute == currentMinute) {
|
||||
var dotMinute = getDotMinute(now);
|
||||
if (dotMinute == currentMinute) {
|
||||
return;
|
||||
}
|
||||
currentMinute = minute;
|
||||
currentMinute = dotMinute;
|
||||
var hour = getHour(now);
|
||||
var coarseMinute = getCoarseMinute(now);
|
||||
resetItems();
|
||||
var dotMinute = minute % 5;
|
||||
var coarseMinute = minute - dotMinute;
|
||||
for (var i = 1; i <= dotMinute; i++) {
|
||||
highlight('dot' + i);
|
||||
}
|
||||
highlight('minute' + coarseMinute);
|
||||
if (coarseMinute >= 25) {
|
||||
hour++;
|
||||
}
|
||||
hour = normalizeHour(hour);
|
||||
highlight('hour' + hour);
|
||||
}
|
||||
|
||||
function getHour(date) {
|
||||
if (typeof layout.getHour === 'function') {
|
||||
return layout.getHour(date);
|
||||
}
|
||||
var hour = date.getHours();
|
||||
if (date.getMinutes() >= 25) {
|
||||
return hour + 1;
|
||||
}
|
||||
return hour;
|
||||
}
|
||||
function getCoarseMinute(date) {
|
||||
if (typeof layout.getCoarseMinute === 'function') {
|
||||
return layout.getCoarseMinute(date);
|
||||
}
|
||||
var minutes = date.getMinutes();
|
||||
return minutes - getDotMinute(date);
|
||||
}
|
||||
function getDotMinute(date) {
|
||||
if (typeof layout.getDotMinute === 'function') {
|
||||
return layout.getDotMinute(date);
|
||||
}
|
||||
var minutes = date.getMinutes();
|
||||
return minutes % 5;
|
||||
}
|
||||
function clearDisplay() {
|
||||
$('.item').removeClass('active');
|
||||
}
|
||||
function resetItems() {
|
||||
clearDisplay()
|
||||
highlight('alwayson');
|
||||
highlight('on');
|
||||
}
|
||||
|
||||
function highlight(itemClass) {
|
||||
$('.item.' + itemClass).addClass('active');
|
||||
}
|
||||
|
||||
function normalizeHour(hour) {
|
||||
if (hour > 12) {
|
||||
hour %= 12;
|
||||
|
@ -44,13 +62,12 @@ function normalizeHour(hour) {
|
|||
}
|
||||
return hour;
|
||||
}
|
||||
|
||||
function startClock() {
|
||||
if (clock == null) {
|
||||
highlightCurrentTime();
|
||||
clock = window.setInterval(highlightCurrentTime, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function stopClock() {
|
||||
if (clock != null) {
|
||||
window.clearInterval(clock);
|
||||
|
@ -59,7 +76,6 @@ function stopClock() {
|
|||
clearDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
function updateClockState() {
|
||||
if ($('#onoffswitch').is(':checked')) {
|
||||
startClock();
|
||||
|
@ -71,7 +87,6 @@ function switchTheme(element) {
|
|||
var theme = $(element).val()
|
||||
$('#theme').attr('href', 'uhr-' + theme + '.css');
|
||||
}
|
||||
|
||||
function render(layout) {
|
||||
var container = $('#renderarea');
|
||||
for (var y = 0; y < layout.values.length; y++) {
|
||||
|
@ -84,7 +99,6 @@ function render(layout) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Letter(value, style = '') {
|
||||
this.value = value;
|
||||
this.style = style;
|
||||
|
@ -110,18 +124,22 @@ function l(letter, style) {
|
|||
/**
|
||||
* Hilfsfunktion, um einen Buchstaben zu erzeugen, der zu einem Stunden-Wort gehört.
|
||||
*
|
||||
* @param letter string: Der Buchstabe, der angezeigt werden soll
|
||||
* @param hour integer: Die Stunde, zu der der Buchstabe gehört (Ganzzahl zwischen 1 und 12)
|
||||
* @example h('Z', 2) erzeugt den Buchstaben 'Z', der um 2:xx und 14:xx aktiv angezeigt wird
|
||||
* @param letter string: Der Buchstabe, der angezeigt werden soll
|
||||
* @param hours... integer: Eine Aufzählung von Stundenwerten, zu welchen der Buchstabe als aktiv angezeigt werden soll
|
||||
* @example h('Z', 2), 11 erzeugt den Buchstaben 'Z', der um 2:xx, 11:xx, 14:xx und 23:xx aktiv angezeigt wird
|
||||
*/
|
||||
function h(letter, hour) {
|
||||
return l(letter, 'hour' + hour);
|
||||
function h(letter) {
|
||||
var style = '';
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
style += ' hour' + arguments[i];
|
||||
}
|
||||
return l(letter, style);
|
||||
}
|
||||
/**
|
||||
* Hilfsfunktion, um einen Buchstaben zu erzeugen, der zu einem Minuten-Wort gehört.
|
||||
*
|
||||
* @param letter string: Der Buchstabe, der angezeigt werden soll
|
||||
* @param minutes... integer: Eine AUfzählung von Minutenwerten, zu welchen der Buchstabe als aktiv angezeigt werden soll
|
||||
* @param minutes... integer: Eine Aufzählung von Minutenwerten, zu welchen der Buchstabe als aktiv angezeigt werden soll
|
||||
* @example m('A', 5, 10, 15, 20, 35) erzeugt den Buchstaben 'A' der um :05, :10, :15, :20 und :35 aktiv angezeigt wird
|
||||
*/
|
||||
function m(letter) {
|
||||
|
|
Loading…
Reference in a new issue