From 6d321d67cd096bfe76d64914d7bf0d8f273fd9eb Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 5 Jun 2014 15:03:59 +0000 Subject: [PATCH] JS/CSS: Get IE8 working Just a bunch of JS and CSS improvements / fixes refs #6417 --- application/layouts/scripts/layout.phtml | 2 +- modules/monitoring/public/js/module.js | 2 +- public/css/icinga/menu.less | 1 + public/js/icinga/events.js | 13 +++++++------ public/js/icinga/ui.js | 4 ++-- public/js/icinga/utils.js | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index 5c91b4b48..16a245a15 100644 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -53,7 +53,7 @@ $isIframe = isset($_GET['_render']) && $_GET['_render'] === 'iframe'; diff --git a/modules/monitoring/public/js/module.js b/modules/monitoring/public/js/module.js index 2d04785b5..ea31f18d8 100644 --- a/modules/monitoring/public/js/module.js +++ b/modules/monitoring/public/js/module.js @@ -76,7 +76,7 @@ } } - }, + }; Icinga.availableModules.monitoring = Monitoring; diff --git a/public/css/icinga/menu.less b/public/css/icinga/menu.less index aa5c26ec8..bdad995fd 100644 --- a/public/css/icinga/menu.less +++ b/public/css/icinga/menu.less @@ -213,6 +213,7 @@ border: none; width: 100%; border-radius: 0; + line-height: 2.5em; height: 2.5em; display: block; outline: none; diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 2142a7c6b..1009a3cbb 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -51,8 +51,8 @@ } }); - var moduleName; - if (moduleName = el.data('icingaModule')) { + var moduleName = el.data('icingaModule'); + if (moduleName) { if (icinga.hasModule(moduleName)) { var module = icinga.module(moduleName); // NOT YET, the applyOnloadDings: module.applyEventHandlers(mod); @@ -99,7 +99,7 @@ $( window ).on('beforeunload', { self: this }, this.onUnload); // We catch scroll events in our containers - $('.container').on('scroll', this.icinga.events.onContainerScroll); + $('.container').on('scroll', { self: this }, this.icinga.events.onContainerScroll); // We want to catch each link click $(document).on('click', 'a', { self: this }, this.linkClicked); @@ -259,6 +259,7 @@ }, clickTriState: function (event) { + var self = event.data.self; var $tristate = $(this); var triState = parseInt($tristate.data('icinga-tristate'), 10); @@ -348,7 +349,7 @@ // combined with target="_blank" or target="_self" // window.open is used as return true; didn't work reliable if (linkTarget === '_blank' || linkTarget === '_self') { - window.open(href, linkTarget); + window.open($node.attr('href'), linkTarget); return true; } return false; @@ -543,7 +544,7 @@ } else if (targetId === '_main') { targetId = 'col1'; $target = $('#' + targetId); - icinga.ui.layout1col(); + self.icinga.ui.layout1col(); } else { $target = $('#' + targetId); } @@ -552,7 +553,7 @@ // Hardcoded layout switch unless columns are dynamic if ($target.attr('id') === 'col2') { - icinga.ui.layout2col(); + this.icinga.ui.layout2col(); } return $target; diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index ed68a2dd4..152c3058c 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -215,7 +215,7 @@ layout1col: function () { if (! $('#layout').hasClass('twocols')) { return; } var $col2 = $('#col2'); - icinga.logger.debug('Switching to single col'); + this.icinga.logger.debug('Switching to single col'); $('#layout').removeClass('twocols'); $col2.removeData('icingaUrl'); $col2.removeData('icingaRefresh'); @@ -228,7 +228,7 @@ layout2col: function () { if ($('#layout').hasClass('twocols')) { return; } - icinga.logger.debug('Switching to double col'); + this.icinga.logger.debug('Switching to double col'); $('#layout').addClass('twocols'); this.fixControls(); }, diff --git a/public/js/icinga/utils.js b/public/js/icinga/utils.js index bf081d016..1e037aafe 100644 --- a/public/js/icinga/utils.js +++ b/public/js/icinga/utils.js @@ -73,8 +73,8 @@ var elemTop = $element.offset().top; var elemBottom = elemTop + $element.height(); - return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) - && (elemBottom <= docViewBottom) && (elemTop >= docViewTop)); + return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) && + (elemBottom <= docViewBottom) && (elemTop >= docViewTop)); }, getUrlHelper: function () {