Module: check_mk
Branch: master
Commit: 36bbe48992dda960fafc50b7388b152eb55312a8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=36bbe48992dda9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 25 18:18:46 2012 +0100
Prevent selection of text in view option dials
---
web/htdocs/js/checkmk.js | 10 ++++++++++
web/htdocs/views.css | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index c6744ce..015a91c 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -1686,6 +1686,8 @@ function view_toggle_form(oButton, idForm) {
// used for refresh und num_columns
function view_dial_option(oDiv, viewname, option, choices) {
+ // prevent double click from select text
+ make_unselectable(oDiv);
var new_choice = choices[0]; // in case not contained in choices
for (var c=0; c<choices.length; c++) {
choice = choices[c];
@@ -1724,6 +1726,14 @@ function turn_dial(option, text, way) {
oDiv.style.top = (way * 1.3) + "px";
}
+
+function make_unselectable(elem) {
+ elem.onselectstart = function() { return false; };
+ elem.style.MozUserSelect = "none";
+ elem.style.KhtmlUserSelect = "none";
+ elem.unselectable = "on";
+}
+
/* Switch number of view columns, refresh and checkboxes. If the
choices are missing, we do a binary toggle. */
gColumnSwitchTimeout = null;
diff --git a/web/htdocs/views.css b/web/htdocs/views.css
index 60ce869..728da06 100644
--- a/web/htdocs/views.css
+++ b/web/htdocs/views.css
@@ -200,6 +200,7 @@ div.optiondial div {
text-align: center;
}
+
div.optiondial.num_columns {
width: 21px;
margin-right: 6px;