From 75b0d7d774db08c5d30315a3924d91d98731a16c Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 28 Sep 2011 19:49:07 +0530 Subject: [PATCH] change font size of titles acc to no of chars --- itf/static/js/insidepage.js | 63 +++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index 1865d6e..4811c8c 100644 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -12,8 +12,14 @@ $('#listLeft ul li a').live("click", function() { 'tab_id': tabId, 'object_id': objId }, function(data) { - $('#textRight').text(data.title); - $('#bottomRight').html(data.html); + $('#textRight').text(data.title).formatTitle(); + var searchTerm = $('.searchListField').val(); + var html = data.html; + if (searchTerm != '') { + html = highlightWordsNoCase(html, searchTerm); +// html = html.replace(searchTerm, "" + searchTerm + ""); + } + $('#bottomRight').html(html); // console.log(data); }); return false; @@ -29,6 +35,11 @@ $('.toggleNext').live("click", function(e) { } }); +function highlightWordsNoCase(data, word) +{ + var regex = new RegExp("(" + word + ")", "gi"); + return data.replace(regex, "$1"); +} /* Get a jquery