From 94df4e07c72eb4ef3532bfe38d44ccbca7568cec Mon Sep 17 00:00:00 2001 From: x2001corpet Date: Sat, 30 Sep 2006 09:21:53 +0000 Subject: [PATCH] fix signaler un bug sur IE git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.11@929 839d8a87-29fc-0310-9880-83ba4fa771e5 --- htdocs/javascript/flyspray.js | 31 +++++++++++++++++++++++++++++++ templates/skin/common.bug.tpl | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/javascript/flyspray.js b/htdocs/javascript/flyspray.js index 337e0aa..3cd41d1 100644 --- a/htdocs/javascript/flyspray.js +++ b/htdocs/javascript/flyspray.js @@ -19,10 +19,41 @@ ***************************************************************************/ function send_bug() { + var h = windowHeight(); + var y = getScrollY(); + y += (h - 470) /2; document.getElementById('flyspray_report').style.display = 'block'; + document.getElementById('flyspray_report').style.top = y+'px'; return false; } +function getScrollY() { + var scrOfX = 0, scrOfY = 0; + if( typeof( window.pageYOffset ) == 'number' ) { + //Netscape compliant + scrOfY = window.pageYOffset; + } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { + //DOM compliant + scrOfY = document.body.scrollTop; + } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { + //IE6 standards compliant mode + scrOfY = document.documentElement.scrollTop; + } + return scrOfY; +} +function windowHeight() { + if( typeof( window.innerWidth ) == 'number' ) { + //Non-IE + return window.innerHeight; + } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { + return document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { + //IE 4 compatible + return document.body.clientHeight; + } + return 0; +} + function close_bug(f,send) { var detail = document.getElementById('flyspray_detail'); detail.value = utf8(detail.value); diff --git a/templates/skin/common.bug.tpl b/templates/skin/common.bug.tpl index 07442ab..dfae734 100644 --- a/templates/skin/common.bug.tpl +++ b/templates/skin/common.bug.tpl @@ -1,6 +1,6 @@ -