1/* 2 -------------------------------------------------------------------------- 3 (c) 2007 Lawrence Akka 4 - jquery version of the spamspan code (c) 2006 SpamSpan (www.spamspan.com) 5 6 This program is distributed under the terms of the GNU General Public 7 Licence version 2, available at http://www.gnu.org/licenses/gpl.txt 8 -------------------------------------------------------------------------- 9*/ 10 11(function ($) { //Standard drupal jQuery wrapper. See http://drupal.org/update/modules/6/7#javascript_compatibility 12// load SpamSpan 13Drupal.behaviors.spamspan = { 14 attach: function(context, settings) { 15// get each span with class spamspan 16 $("span.spamspan", context).each(function (index) { 17// for each such span, set mail to the relevant value, removing spaces 18 var _mail = ($("span.u", this).text() + 19 "@" + 20 $("span.d", this).text()) 21 .replace(/\s+/g, '') 22 .replace(/\[dot\]/g, '.'); 23// Find the header text, and remove the round brackets from the start and end 24 var _headerText = $("span.h", this).text().replace(/^ ?\((.*)\) ?$/, "$1"); 25 // split into individual headers, and return as an array of header=value pairs 26 var _headers = $.map(_headerText.split(/, /), function(n, i){ 27 return (n.replace(/: /,"=")); 28 }); 29// Find the anchor text, and remove the round brackets from the start and end 30 var _anchorText = $("span.t", this).text().replace(/^ \((.*)\)$/, "$1"); 31// Build the mailto URI 32 var _mailto = "mailto:" + encodeURIComponent(_mail); 33 var _headerstring = _headers.join('&'); 34 _mailto += _headerstring ? ("?" + _headerstring) : ''; 35// create the <a> element, and replace the original span contents 36 $(this).after( 37 $("<a></a>") 38 .attr("href", _mailto) 39 .html(_anchorText ? _anchorText : _mail) 40 .addClass("spamspan") 41 ).remove(); 42 } ); 43} 44}; 45}) (jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.