From 2768c21f0cae7eb22051c9a1823260d7a51aca69 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Wed, 12 Oct 2011 23:50:18 +0100 Subject: [PATCH] Escape chars not allowed in CSS IDs. Fix for issue #41 --- client/js/front.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/js/front.js b/client/js/front.js index dc4e68e..ce8f869 100644 --- a/client/js/front.js +++ b/client/js/front.js @@ -1073,12 +1073,14 @@ var Tabview = function (v_name) { var re, htmlsafe_name, tmp_divname, tmp_userlistname, tmp_tabname, tmp_tab, userlist_enabled = true; if (v_name.charAt(0) === kiwi.gateway.channel_prefix) { - //if (v_name[0] === kiwi.gateway.channel_prefix) { - re = new RegExp(kiwi.gateway.channel_prefix, "g"); - htmlsafe_name = v_name.replace(re, 'pre'); - htmlsafe_name = "chan_" + htmlsafe_name; + htmlsafe_name = v_name.replace(kiwi.gateway.channel_prefix, 'pre'); + htmlsafe_name = htmlsafe_name.replace(/[^_a-z0-9\u0240-\u0337-]/, 'esc'); + htmlsafe_name += randomString(3); + htmlsafe_name = 'chan_' + htmlsafe_name; } else { - htmlsafe_name = 'query_' + v_name; + htmlsafe_name = v_name.replace(/[^_a-z0-9\u0240-\u0337-]/, 'esc'); + htmlsafe_name += randomString(3); + htmlsafe_name = 'query_' + htmlsafe_name; userlist_enabled = false; } -- 2.25.1