es funzt! nun muss ich aufräumen und das ganze noch RICHTIG machen.
This commit is contained in:
parent
9db6473085
commit
fc2c8ac38a
5 changed files with 33 additions and 11 deletions
|
@ -30,6 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<body style="padding:0;margin:0;">
|
<body style="padding:0;margin:0;">
|
||||||
<div id="uhr"></div>
|
<div id="uhr"></div>
|
||||||
<div id="test"></div>
|
<div id="test"></div>
|
||||||
|
<div class="u"></div>
|
||||||
|
<div class="u"></div>
|
||||||
|
<div class="u"></div>
|
||||||
<p id="disclaimer">Created by fritteli, inspired by <a href="http://www.qlocktwo.com/">QLOCKTWO</a>.
|
<p id="disclaimer">Created by fritteli, inspired by <a href="http://www.qlocktwo.com/">QLOCKTWO</a>.
|
||||||
<script type="text/javascript" src="uhr-de_CH.js"></script>
|
<script type="text/javascript" src="uhr-de_CH.js"></script>
|
||||||
<script type="text/javascript" src="uhr-de.js"></script>
|
<script type="text/javascript" src="uhr-de.js"></script>
|
||||||
|
@ -46,7 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
width: size + 'px'
|
width: size + 'px'
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
$('#test').uhr({width:'10em'});
|
$('div.u').uhr({width:'10em'});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -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.registerLanguage('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.registerLanguage('de_CH', layout);
|
||||||
|
|
|
@ -34,4 +34,4 @@ var layout = {
|
||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//Uhr.register('en', layout);
|
Uhr.registerLanguage('en', layout);
|
||||||
|
|
33
uhr.js
33
uhr.js
|
@ -43,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.data('currentMinute', now.getMinutes());
|
e.data('currentMinute', now.getMinutes());
|
||||||
//FIXME
|
|
||||||
var dotMinute = Uhr.getDotMinute(e, now);
|
var dotMinute = Uhr.getDotMinute(e, now);
|
||||||
var hour = Uhr.getHour(e, now);
|
var hour = Uhr.getHour(e, now);
|
||||||
var coarseMinute = this.getCoarseMinute(e, now);
|
var coarseMinute = this.getCoarseMinute(e, now);
|
||||||
|
@ -74,6 +73,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
e.find('.item').removeClass('active');
|
e.find('.item').removeClass('active');
|
||||||
},
|
},
|
||||||
setLanguage: function(e, language) {
|
setLanguage: function(e, language) {
|
||||||
|
var newLanguage = Uhr.layouts[language];
|
||||||
|
if (newLanguage !== undefined && newLanguage != e.data('currentLanguage')) {
|
||||||
|
e.data('currentLanguage', newLanguage);
|
||||||
|
var renderer = new UhrRenderer(newLanguage, e.find('.letterarea'));
|
||||||
|
renderer.render(e);
|
||||||
|
jQuery.cookie('language' + e.data('id'), language, {expires: 365, path: '/'});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setTheme: function(e, theme) {
|
setTheme: function(e, theme) {
|
||||||
var currentTheme = e.data('currentTheme');
|
var currentTheme = e.data('currentTheme');
|
||||||
|
@ -91,9 +97,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
e.find('.item.' + itemClass).addClass('active');
|
e.find('.item.' + itemClass).addClass('active');
|
||||||
},
|
},
|
||||||
getHour: function(e, date) {
|
getHour: function(e, date) {
|
||||||
|
//FIXME
|
||||||
|
/*
|
||||||
if (typeof e.data('currentLayout').getHour === 'function') {
|
if (typeof e.data('currentLayout').getHour === 'function') {
|
||||||
return e.data('currentLayout').getHour(date);
|
return e.data('currentLayout').getHour(date);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
var hour = date.getHours();
|
var hour = date.getHours();
|
||||||
if (date.getMinutes() >= 25) {
|
if (date.getMinutes() >= 25) {
|
||||||
return hour + 1;
|
return hour + 1;
|
||||||
|
@ -101,16 +110,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
return hour;
|
return hour;
|
||||||
},
|
},
|
||||||
getCoarseMinute: function(e, date) {
|
getCoarseMinute: function(e, date) {
|
||||||
|
//FIXME
|
||||||
|
/*
|
||||||
if (typeof e.data('currentLayout').getCoarseMinute === 'function') {
|
if (typeof e.data('currentLayout').getCoarseMinute === 'function') {
|
||||||
return e.data('currentLayout').getCoarseMinute(date);
|
return e.data('currentLayout').getCoarseMinute(date);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
var minutes = date.getMinutes();
|
var minutes = date.getMinutes();
|
||||||
return minutes - Uhr.getDotMinute(e, date);
|
return minutes - Uhr.getDotMinute(e, date);
|
||||||
},
|
},
|
||||||
getDotMinute: function(e, date) {
|
getDotMinute: function(e, date) {
|
||||||
|
//FIXME
|
||||||
|
/*
|
||||||
if (typeof e.data('currentLayout').getDotMinute === 'function') {
|
if (typeof e.data('currentLayout').getDotMinute === 'function') {
|
||||||
return e.data('currentLayout').getDotMinute(date);
|
return e.data('currentLayout').getDotMinute(date);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
var minutes = date.getMinutes();
|
var minutes = date.getMinutes();
|
||||||
return minutes % 5;
|
return minutes % 5;
|
||||||
},
|
},
|
||||||
|
@ -122,7 +137,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
return hour;
|
return hour;
|
||||||
}
|
},
|
||||||
|
registerLanguage: function(languageKey, layout) {
|
||||||
|
this.layouts[languageKey] = layout;
|
||||||
|
},
|
||||||
|
layouts: new Array()
|
||||||
}
|
}
|
||||||
$.fn.uhr = function(options) {
|
$.fn.uhr = function(options) {
|
||||||
var settings = $.extend({
|
var settings = $.extend({
|
||||||
|
@ -470,6 +489,9 @@ Uhr.prototype.initThemeSwitch = function(defaultValue, overrideCookie) {
|
||||||
this.setTheme(selectedTheme);
|
this.setTheme(selectedTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//}
|
||||||
|
})(jQuery);
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -492,14 +514,11 @@ UhrRenderer.prototype.render = function(uhr) {
|
||||||
renderer.renderarea.append('<br/>');
|
renderer.renderarea.append('<br/>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uhr.currentMinute = -1;
|
uhr.data('currentMinute', -1);
|
||||||
uhr.update();
|
Uhr.update(uhr);
|
||||||
renderer.renderarea.fadeIn('fast');
|
renderer.renderarea.fadeIn('fast');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
|
||||||
})(jQuery);
|
|
||||||
/**
|
/**
|
||||||
* Ein Buchstabe. Hilfsklasse für den Renderer und Inhalt der Layout-Arrays.
|
* Ein Buchstabe. Hilfsklasse für den Renderer und Inhalt der Layout-Arrays.
|
||||||
* @param value Der Buchstabe, der Dargestellt werden soll.
|
* @param value Der Buchstabe, der Dargestellt werden soll.
|
||||||
|
|
Loading…
Reference in a new issue