(function(Icinga) {
Icinga.UI = function(icinga) {
this.icinga = icinga;
};
Icinga.UI.prototype = {
initialize: function()
{
this.icinga.timer.register(this.refreshDebug, this, 1000);
this.refreshDebug();
},
prepareContainers: function ()
{
var icinga = this.icinga;
$('.container').each(function(idx, el) {
icinga.events.applyHandlers($(el));
icinga.ui.initializeControls($(el));
});
/*
$('#icinga-main').attr(
'icingaurl',
window.location.pathname + window.location.search
);
*/
},
refreshDebug: function()
{
var size = this.icinga.ui.getDefaultFontSize().toString();
var winWidth = $( window ).width();
var winHeight = $( window ).height();
$('#responsive-debug').html(
'Time: ' +
this.icinga.ui.formatHHiiss(new Date) +
'
1em: ' +
size +
'px
Win: ' +
winWidth +
'x'+
winHeight +
'px
'
).css({display: 'block'});
},
formatHHiiss: function(date)
{
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
if (hours < 10) hours = '0' + hours;
if (minutes < 10) minutes = '0' + minutes;
if (seconds < 10) seconds = '0' + seconds;
return hours + ':' + minutes + ':' + seconds;
},
createFontSizeCalculator: function()
{
var $el = $('