=====Highlight Searched-for Text=====
The following code implements a feature that will highlight the search word in the pages that where found by TextSearch or by Google, Yahoo and many other search engines. The core of this feature is a JavaScript library by the name of [[http://www.kryogenix.org/code/browser/searchhi/ | searchhi]].
From the searchhi website:
//The searchhi JavaScript library is a way of automatically highlighting words on a page when that page was reached by a search engine. In essence, if you search, for example, Google for some words, and then follow a link from the search results to a searchhi enabled page, the words you searched for will be highlighted on that page.//
First I had to make a few minor changes to this JavaScript libary. This to make it aware of the TextSearch activity.
The resulting file (searchhi.js) is then copied in the //3rdparty/plugins/searchhi// directory. Also make sure that your create a **.htaccess** file in the same directory with the following content:
%%
RewriteEngine off
%%
Then copy the **searchhi.js** file into the //3rdparty/plugins/searchhi// directory.
%%(javascript)
/* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
function highlightWord(node,word) {
// Iterate into this nodes childNodes
if (node.hasChildNodes) {
var hi_cn;
for (hi_cn=0;hi_cn** tag:
%%(html4strict)
%%
It is installed on [[http://stens.ca/kb | my Wikka]] so you can see for yourself how it works.
----
CategoryUserContributions