From 98c38cd86474cbba0152acbc9addf74ec989d7e0 Mon Sep 17 00:00:00 2001 From: Zaran Date: Mon, 17 Jan 2011 15:55:42 +0100 Subject: Add field to filter the roster. --- webclient/basic.html | 3 ++- webclient/lib/basic.js | 10 ++++++++++ webclient/style.css | 40 +++++++++++++++++++++++++--------------- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/webclient/basic.html b/webclient/basic.html index 02990fb..587e5b7 100644 --- a/webclient/basic.html +++ b/webclient/basic.html @@ -2,7 +2,7 @@ Alias - + @@ -20,6 +20,7 @@

Contacts

+
diff --git a/webclient/lib/basic.js b/webclient/lib/basic.js index 84e6ff4..f8b24e7 100644 --- a/webclient/lib/basic.js +++ b/webclient/lib/basic.js @@ -1,6 +1,10 @@ var BOSH_SERVICE = 'http://alias.fr.nf/http-bind'; var connection = null; +jQuery.expr[':'].Contains = function(a,i,m){ + return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0; +}; + function log(msg, color) { $('#log').append($('
').css('background-color', color).text(msg)); @@ -169,4 +173,10 @@ $(document).ready(function(){ $('#bottomup').click(function(){ $(this).next().slideToggle(); }); + + $('#rosterfilter').keyup(function() { + var filter = $(this).val(); + $('#roster ul li div.roster-name:not(:Contains("' + filter + '"))').parent().hide(); + $('#roster ul li div.roster-name:Contains("' + filter + '")').parent().show(); + }); }); \ No newline at end of file diff --git a/webclient/style.css b/webclient/style.css index e568584..d152af7 100644 --- a/webclient/style.css +++ b/webclient/style.css @@ -11,14 +11,6 @@ div padding:0px; } -#roster -{ - float:left; - width:250px; - height:100%; - font-size:0.8em; -} - #bottom { position:fixed; @@ -51,6 +43,31 @@ div border-top:1px solid black; } +#roster +{ + float:left; + width:250px; + height:100%; + font-size:0.8em; + padding:5px; +} + +#rosterfilter +{ + border: 1px solid black; +} + +#rosterfilter:before +{ + content:'x'; +} + +#roster > ul +{ + list-style-type: none; + padding: 0px; +} + .roster-contact { border-bottom : 1px dotted black; @@ -62,18 +79,11 @@ div background-color: #E5E9EE; } - .roster-name { font-weight:bold; } -#roster > ul -{ - list-style-type: none; - padding: 0px; -} - .online { background-color: #DBFFDC; -- cgit v1.2.3-70-g09d2