From 66b76b3be910e0f5dc5a26384c4cfce20579a70d Mon Sep 17 00:00:00 2001 From: Cambell Date: Sat, 22 Nov 2014 11:54:52 +0100 Subject: [PATCH] Further fixes to javascript multiple class handling. --- js/inserts.js | 8 ++++---- js/utils.js | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/js/inserts.js b/js/inserts.js index 0c991a86..0dd14165 100644 --- a/js/inserts.js +++ b/js/inserts.js @@ -162,7 +162,7 @@ function _set_combo_select(e) { event.returnValue = false; return false; } - if (box && (key == 32) && (this.className == 'combo2')) { + if (box && (key == 32) && (string_contains(this.className, 'combo2'))) { this.style.display = 'none'; box.style.display = 'inline'; box.value=''; @@ -275,12 +275,12 @@ var inserts = { 'input': function(e) { if(e.onfocus==undefined) { e.onfocus = function() { - save_focus(this); - if (this.className == 'combo' || this.className == 'combo3') + save_focus(this); + if (string_contains(this.className, 'combo') || string_contains(this.className, 'combo3')) this.select(); }; } - if (e.className == 'combo' || e.className == 'combo2' || e.className == 'combo3') { + if (string_contains(e.className, 'combo') || string_contains(e.className, 'combo2') || string_contains(e.className, 'combo3')) { _set_combo_input(e); } else diff --git a/js/utils.js b/js/utils.js index 478cd158..c0df0b85 100644 --- a/js/utils.js +++ b/js/utils.js @@ -356,5 +356,6 @@ function element_pos(e) { } function string_contains(haystack, needle) { - return haystack.indexOf(needle) > -1; + var words = haystack.split(' '); + return words.indexOf(needle) > -1; } -- 2.30.2