Module: check_mk
Branch: master
Commit: e62ff3ee2d137b3fba8890c83550ca80e47c5a51
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e62ff3ee2d137b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Mar 24 14:31:12 2015 +0100
Move browser detection to general JS code
---
web/htdocs/js/checkmk.js | 19 ++++++++++++++++---
web/htdocs/js/sidebar.js | 7 ++-----
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 9a4678e..9e6c260 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -22,9 +22,22 @@
// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301 USA.
-// ----------------------------------------------------------------------------
-// general function
-// ----------------------------------------------------------------------------
+// .--General-------------------------------------------------------------.
+// | ____ _ |
+// | / ___| ___ _ __ ___ _ __ __ _| | |
+// | | | _ / _ \ '_ \ / _ \ '__/ _` | | |
+// | | |_| | __/ | | | __/ | | (_| | | |
+// | \____|\___|_| |_|\___|_| \__,_|_| |
+// | |
+// +----------------------------------------------------------------------+
+// | General functions used in many places |
+// '----------------------------------------------------------------------'
+
+var browser = navigator.userAgent.toLowerCase();
+var weAreOpera = browser.indexOf("opera") != -1;
+var weAreFirefox = browser.indexOf("firefox") != -1 ||
browser.indexOf("namoroka") != -1;
+
+
// Make JS understand Python source code
var True = true;
diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js
index 5211cb6..358a6e8 100644
--- a/web/htdocs/js/sidebar.js
+++ b/web/htdocs/js/sidebar.js
@@ -22,10 +22,6 @@
// 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 weAreOpera = browser.indexOf("opera") != -1;
-var weAreFirefox = browser.indexOf("firefox") != -1 ||
browser.indexOf("namoroka") != -1;
var g_content_loc = null;
var sidebar_folded = false;
@@ -51,7 +47,8 @@ if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', scrollWheel, false);
else
window.addEventListener('mousewheel', scrollWheel, false);
-} else {
+}
+else {
document.documentElement.onmousemove = function(e) {
// snapin drag 'n drop
snapinDrag(e);