PageSourceSearch

https://www.sca-aware.org/modules/contrib/spamspan/js/spamspan.js?v=8.7.10

js sca-aware.org collected 2026-09-24 08:54:54 UTC 2,408 bytes, 67 lines download raw bytes

1/*
2--------------------------------------------------------------------------
3(c) 2007 Lawrence Akka
4 - jquery version of the spamspan code (c) 2006 SpamSpan (www.spamspan.com)
5
6This program is distributed under the terms of the GNU General Public
7Licence version 2, available at http://www.gnu.org/licenses/gpl.txt
8--------------------------------------------------------------------------
9*/
10
11(function ($) {
12  'use strict';
13  // load SpamSpan
14  Drupal.behaviors.spamspan = {
15    attach: function (context) {
16      // get each span with class spamspan
17      $("span.spamspan", context).each(function (index) {
18        // Replace each <span class="o"></span> with .
19        if ($('span.o', this).length) {
20          $('span.o', this).replaceWith('.');
21        }
22
23        // For each selected span, set mail to the relevant value, removing spaces
24        var _mail = ($("span.u", this).text() +
25        "@" +
26        $("span.d", this).text())
27        .replace(/\s+/g, '');
28
29        // Build the mailto URI
30        var _mailto = "mailto:" + _mail;
31        if ($('span.h', this).length) {
32          // Find the header text, and remove the round brackets from the start and end
33          var _headerText = $("span.h", this).text().replace(/^ ?\((.*)\) ?$/, "$1");
34          // split into individual headers, and return as an array of header=value pairs
35          var _headers = $.map(_headerText.split(/, /), function (n, i) {
36            return (n.replace(/: /, "="));
37          });
38
39          var _headerstring = _headers.join('&');
40          _mailto += _headerstring ? ("?" + _headerstring) : '';
41        }
42
43        // Find the anchor content, and remove the round brackets from the start and end
44        var _anchorContent = $("span.t", this).html();
45        if (_anchorContent) {
46          _anchorContent = _anchorContent.replace(/^ ?\((.*)\) ?$/, "$1");
47        }
48
49        // create the <a> element, and replace the original span contents
50
51        // check for extra <a> attributes
52        var _attributes = $("span.e", this).html();
53        var _tag = "<a></a>";
54        if (_attributes) {
55          _tag = "<a " + _attributes.replace("<!--", "").replace("-->", "") + "></a>";
56        }
57
58        $(this).after(
59          $(_tag)
60          .attr("href", _mailto)
61          .html(_anchorContent ? _anchorContent : _mail)
62          .addClass("spamspan")
63        ).remove();
64      });
65    }
66  };
67}) (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.