HighlightTermsURL.js: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
//The vaniquotes link was modified to include these url_terms in order to highlight them in the current page in Vanisource | //The vaniquotes link was modified to include these url_terms in order to highlight them in the current page in Vanisource | ||
document.write('<script type="text/javascript" src="'+$jquery_dir+'/Jquery.highlight_sanskrit.js | document.write('<script type="text/javascript" src="'+$jquery_dir+'/Jquery.highlight_sanskrit.js'+$raw_mode+'"></script>'); | ||
document.write('<script type="text/javascript" src="'+$jquery_dir+'/Jquery.getParams.js'+$raw_mode+'"></script>'); | document.write('<script type="text/javascript" src="'+$jquery_dir+'/Jquery.getParams.js'+$raw_mode+'"></script>'); | ||
Revision as of 09:43, 11 July 2008
//jQuery function to parse url_terms from url when current page was linked from Vaniquotes //The vaniquotes link was modified to include these url_terms in order to highlight them in the current page in Vanisource document.write('<script type="text/javascript" src="'+$jquery_dir+'/Jquery.highlight_sanskrit.js'+$raw_mode+'"></script>'); document.write('<script type="text/javascript" src="'+$jquery_dir+'/Jquery.getParams.js'+$raw_mode+'"></script>'); $(document).ready(function() { //First check if the current page is an Article if (wgIsArticle && location.search && wgAction == "view") { if (this.location.search) { var url_string = $.getURLParam('terms'); var url_terms = decodeURI(url_string).split('+'); if (url_terms.length > 0 ) { for (var i = 0, len = url_terms.length; i < len; ++i) { //sanitize text for search if (url_terms[i] != "") { url_term = url_terms[i]; $('#bodyContent').highlight_sanskrit(url_term); } } } $.scrollTo('span.highlight_terms', '1500', {offset:-100}); } } });