Module: check_mk
Branch: master
Commit: 2ec63047ae6b4e0547ad68785fdd38b570e4280e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ec63047ae6b4e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 25 11:02:00 2010 +0200
Fixed mousewheel scrolling in opera/chrome; Fixed resize bug on refresh in chrome
---
ChangeLog | 2 ++
LIESMICH.zutun | 4 ++--
web/htdocs/main.py | 1 +
web/htdocs/sidebar.js | 36 ++++++++++++++++++++++--------------
4 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dd75176..c840190 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
* Setting doctype in sidebar frame now
* Fixed invalid sidebar css height/width definition
* Fixed repositioning the sidebar scroll state after refreshing the page
+ * Fixed mousewheel scrolling in opera/chrome
+ * Fixed resize bug on refresh in chrome
1.1.8:
Core, Setup, etc.:
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index 815e2f4..3383b0e 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -42,8 +42,8 @@ Logwatch: was macht man hier bei verteilten Umgebungen?? Muss man das
wie
PNP per Proxy anfahren? Was ist aber dann, wenn man dort rumklickt? Dann hat
man rechts plötzlich ein anderes System. Lösung ist noch nicht in Sicht.
-LARS: In Opera (Version 10.6) geht in der Sidebar das Scrollen per Mausrad
-nicht. Angeblich in Chrome auch nicht.
+LARS: Bei Opera kann man kein Snapin nach ganz unten ziehen. Der Indikator
+springt dann immer nach ganz oben.
SNMP-Checks: Es wurde berichtet, dass - wenn die Community falsch ist -
der Check_MK gruen war, aber die Checks unknown. Sollte es dann nicht
diff --git a/web/htdocs/main.py b/web/htdocs/main.py
index faa7829..854d989 100644
--- a/web/htdocs/main.py
+++ b/web/htdocs/main.py
@@ -38,6 +38,7 @@ def page_index(html):
<frameset cols="280,*" frameborder="0" framespacing="0"
border="0">
<frame src="side.py" name="side" noresize>
<frame src="%s" name="main" noresize>
+</frameset>
</html>
""" % config.start_url)
diff --git a/web/htdocs/sidebar.js b/web/htdocs/sidebar.js
index e829401..a7431eb 100644
--- a/web/htdocs/sidebar.js
+++ b/web/htdocs/sidebar.js
@@ -22,8 +22,9 @@
// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301 USA.
-var browser = navigator.userAgent.toLowerCase();
-var weAreIEF__k = ((browser.indexOf("msie") != -1) &&
(browser.indexOf("opera") == -1));
+var browser = navigator.userAgent.toLowerCase();
+var weAreIEF__k = ((browser.indexOf("msie") != -1) &&
(browser.indexOf("opera") == -1));
+var weAreFirefox = browser.indexOf("firefox") != -1 ||
browser.indexOf("namoroka") != -1;
var contentLocation = parent.frames[1].document.location;
//
@@ -41,9 +42,12 @@ if (window.addEventListener) {
dragScroll(e);
return false;
}, false);
- window.addEventListener("mousedown", startDragScroll, false);
- window.addEventListener("mouseup", stopDragScroll, false);
- window.addEventListener('DOMMouseScroll', scrollWheel, false);
+ window.addEventListener("mousedown", startDragScroll, false);
+ window.addEventListener("mouseup", stopDragScroll, false);
+ if(weAreFirefox)
+ window.addEventListener('DOMMouseScroll', scrollWheel, false);
+ else
+ window.addEventListener('mousewheel', scrollWheel, false);
} else {
document.documentElement.onmousemove = function(e) {
// snapin drag 'n drop
@@ -339,13 +343,13 @@ function getSnapinTargetPos() {
}
/************************************************
- * misc sidebar styling
+ * misc sidebar stuff
*************************************************/
function pageHeight() {
var h;
- if (window.innerHeight !== null && typeof window.innerHeight !==
'undefined')
+ if (window.innerHeight !== null && typeof window.innerHeight !==
'undefined' && window.innerHeight !== 0)
h = window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
h = document.documentElement.clientHeight;
@@ -354,7 +358,7 @@ function pageHeight() {
else
h = null;
-return h;
+ return h;
}
// Set the size of the sidebar_content div to fit the whole screen
@@ -365,12 +369,19 @@ function setSidebarHeight() {
var oContent = document.getElementById('side_content');
var oFooter = document.getElementById('side_footer');
var height = pageHeight();
-
+
+ // Don't handle zero heights
+ if(height == 0)
+ return;
if (weAreIEF__k)
oContent.style.height = (height - oFooter.clientHeight + 5) + 'px';
else
oContent.style.height = (height - oHeader.clientHeight - oFooter.clientHeight - 5)
+ 'px';
+
+ oFooter = null;
+ oContent = null;
+ oHeader = null;
}
var scrolling = true;
@@ -476,13 +487,10 @@ function scrollWheel(event){
if (!event)
event = window.event;
- if (event.wheelDelta) {
+ if (event.wheelDelta)
delta = event.wheelDelta / 120;
- if (window.opera)
- delta = -delta;
- } else if (event.detail) {
+ else if (event.detail)
delta = -event.detail / 3;
- }
if (delta)
handle(delta);