jQuery Plugin: Highlight Search Terms - version 0.2
Highlight search terms in referrer URL from Google, Yahoo!, Bing and custom site.
Highlight all contents of body element:
$("body").highlightSearchTerms();
Highlight with custom class name:
$("body").highlightSearchTerms({
className: "keyword"
});
Support custom referrer pattern:
$("body").highlightSearchTerms({
referrerPatterns: [
"^http://example\.com.+[&?]query=([^&]+).*$"
]
});
Display a welcome message to searchers:
$("body").highlightSearchTerms({
titleContainer: ".welcome-searchers"
});
<style>
div.welcome-searchers {
display:none;
border:1px solid #ccc;
background-color:#ffc;
padding:10px;
font-weight:700;
}
</style>
<div class="welcome-searchers">
Thanks for visiting! We've highlighted your search terms: "<span class="referring-search-terms"></span>"
</div>
Copyright (c) 2009 Kyo Nagashima kyo@hail2u.net
This library licensed under MIT license:
http://opensource.org/licenses/mit-license.php