layouts global registrieren, nicht pro uhr
This commit is contained in:
parent
1c06b7248a
commit
2fa23c2f07
5 changed files with 17 additions and 16 deletions
|
@ -59,13 +59,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
var theme = $.cookie('theme');
|
var theme = $.cookie('theme');
|
||||||
var layout = $.cookie('layout');
|
var layout = $.cookie('layout');
|
||||||
var status = $.cookie('status');
|
var status = $.cookie('status');
|
||||||
if (theme == undefined) {
|
if (theme === undefined || theme == 'undefined') {
|
||||||
theme = 'black';
|
theme = 'black';
|
||||||
}
|
}
|
||||||
if(layout == undefined) {
|
if(layout === undefined || layout == 'undefined') {
|
||||||
layout = 'de_CH';
|
layout = 'de_CH';
|
||||||
}
|
}
|
||||||
if (status == undefined) {
|
if (status === undefined || status == 'undefined') {
|
||||||
status = 'on';
|
status = 'on';
|
||||||
}
|
}
|
||||||
$('#themeswitcher').val(theme);
|
$('#themeswitcher').val(theme);
|
||||||
|
|
|
@ -27,4 +27,4 @@ var layout = {
|
||||||
[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')]
|
[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')]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
uhr.register('de', layout);
|
Uhr.register('de', layout);
|
||||||
|
|
|
@ -27,4 +27,4 @@ var layout = {
|
||||||
[h('Z', 12), h('W', 12),h('Ö', 12),h('U', 12),h('F', 12),h('I', 12),l('N'),l('A'),l('U'),l('H'),l('R')]
|
[h('Z', 12), h('W', 12),h('Ö', 12),h('U', 12),h('F', 12),h('I', 12),l('N'),l('A'),l('U'),l('H'),l('R')]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
uhr.register('de_CH', layout);
|
Uhr.register('de_CH', layout);
|
||||||
|
|
|
@ -34,4 +34,4 @@ var layout = {
|
||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
uhr.register('en', layout);
|
Uhr.register('en', layout);
|
||||||
|
|
21
uhr.js
21
uhr.js
|
@ -31,14 +31,13 @@ function Uhr(clockarea, themeElement) {
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.currentTheme = null;
|
this.currentTheme = null;
|
||||||
this.currentLayout = null;
|
this.currentLayout = null;
|
||||||
this.layouts = new Array();
|
|
||||||
this.currentMinute = -1;
|
this.currentMinute = -1;
|
||||||
this.register('undefined', {
|
this.setLayout('undefined');
|
||||||
language: 'Undefined',
|
}
|
||||||
values: []
|
Uhr.layouts = new Array();
|
||||||
});
|
Uhr.register = function (locale, layout) {
|
||||||
|
Uhr.layouts[locale] = layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uhr.prototype.toggle = function() {
|
Uhr.prototype.toggle = function() {
|
||||||
if (this.isOn()) {
|
if (this.isOn()) {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
@ -65,11 +64,8 @@ Uhr.prototype.stop = function() {
|
||||||
Uhr.prototype.isOn = function() {
|
Uhr.prototype.isOn = function() {
|
||||||
return this.timer != null;
|
return this.timer != null;
|
||||||
}
|
}
|
||||||
Uhr.prototype.register = function(key, layout) {
|
|
||||||
this.layouts[key] = layout;
|
|
||||||
}
|
|
||||||
Uhr.prototype.setLayout = function(locale) {
|
Uhr.prototype.setLayout = function(locale) {
|
||||||
var newLayout = this.layouts[locale];
|
var newLayout = Uhr.layouts[locale];
|
||||||
if (newLayout !== undefined && newLayout != this.currentLayout) {
|
if (newLayout !== undefined && newLayout != this.currentLayout) {
|
||||||
this.currentLayout = newLayout;
|
this.currentLayout = newLayout;
|
||||||
var renderer = new UhrRenderer(this.currentLayout, this.letterarea);
|
var renderer = new UhrRenderer(this.currentLayout, this.letterarea);
|
||||||
|
@ -150,6 +146,11 @@ Uhr.prototype.normalizeHour = function(hour) {
|
||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uhr.register('undefined', {
|
||||||
|
language: 'Undefined',
|
||||||
|
values: []
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hilfsklasse zum Rendern der Uhr.
|
* Hilfsklasse zum Rendern der Uhr.
|
||||||
* @param layout Layout-Objekt, das gerendert werden soll.
|
* @param layout Layout-Objekt, das gerendert werden soll.
|
||||||
|
|
Loading…
Reference in a new issue