1(function ($) { 2 3 /** 4 * Google CSE utility functions. 5 */ 6 Drupal.googleCSE = Drupal.googleCSE || {}; 7 8 Drupal.behaviors.googleCSE = { 9 attach: function (context, settings) { 10 // Show watermark, if not disabled in module settings. 11 if (Drupal.settings.googleCSE.showWaterMark) { 12 Drupal.googleCSE.googleCSEWatermark('#search-block-form.google-cse', context); 13 Drupal.googleCSE.googleCSEWatermark('#search-form.google-cse', context); 14 Drupal.googleCSE.googleCSEWatermark('#google-cse-results-searchbox-form', context); 15 } 16 } 17 }; 18 19 /** 20 * Show google CSE watermark. 21 */ 22 Drupal.googleCSE.googleCSEWatermark = function(id, context) { 23 var f = $(id, context)[0]; 24 if (f && (f.query || f['edit-search-block-form--2'] || f['edit-keys'])) { 25 var q = f.query ? f.query : (f['edit-search-block-form--2'] ? f['edit-search-block-form--2'] : f['edit-keys']); 26 var n = navigator; 27 var l = location; 28 if (n.platform == 'Win32') { 29 q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;'; 30 } 31 var b = function () { 32 if (q.value == '') { 33 q.style.background = '#FFFFFF url(https://www.google.com/cse/intl/' + Drupal.settings.googleCSE.language + '/images/google_custom_search_watermark.gif) left no-repeat'; 34 } 35 }; 36 var f = function () { 37 q.style.background = '#ffffff'; 38 }; 39 q.onfocus = f; 40 q.onblur = b; 41// if (!/[&?]query=[^&]/.test(l.search)) { 42 b(); 43// } 44 } 45 }; 46 47})(jQuery); 48; 49/* 50-------------------------------------------------------------------------- 51(c) 2007 Lawrence Akka 52 - jquery version of the spamspan code (c) 2006 SpamSpan (www.spamspan.com) 53 54This program is distributed under the terms of the GNU General Public 55Licence version 2, available at http://www.gnu.org/licenses/gpl.txt 56-------------------------------------------------------------------------- 57*/ 58 59(function ($) { //Standard drupal jQuery wrapper. See http://drupal.org/update/modules/6/7#javascript_compatibility 60// load SpamSpan 61Drupal.behaviors.spamspan = { 62 attach: function(context, settings) { 63 // get each span with class spamspan 64 $("span.spamspan", context).each(function (index) { 65 // Replace each <spam class="t"></spam> with . 66 if ($('span.t', this).length) { 67 $('span.t', this).replaceWith('.'); 68 } 69 70 // For each selected span, set mail to the relevant value, removing spaces 71 var _mail = ($("span.u", this).text() + 72 "@" + 73 $("span.d", this).text()) 74 .replace(/\s+/g, ''); 75 76 // Build the mailto URI 77 var _mailto = "mailto:" + _mail; 78 if ($('span.h', this).length) { 79 // Find the header text, and remove the round brackets from the start and end 80 var _headerText = $("span.h", this).text().replace(/^ ?\((.*)\) ?$/, "$1"); 81 // split into individual headers, and return as an array of header=value pairs 82 var _headers = $.map(_headerText.split(/, /), function (n, i) { 83 return (n.replace(/: /, "=")); 84 }); 85 86 var _headerstring = _headers.join('&'); 87 _mailto += _headerstring ? ("?" + _headerstring) : ''; 88 } 89 90 // Find the anchor content, and remove the round brackets from the start and end 91 var _anchorContent = $("span.a", this).html(); 92 if (_anchorContent) { 93 _anchorContent = _anchorContent.replace(/^ ?\((.*)\) ?$/, "$1"); 94 } 95 96 // create the <a> element, and replace the original span contents 97 98 //check for extra <a> attributes 99 var _attributes = $("span.e", this).html(); 100 var _tag = "<a></a>"; 101 if (_attributes) { 102 _tag = "<a " + _attributes.replace("<!--", "").replace("-->", "") + "></a>"; 103 } 104 105 $(this).after( 106 $(_tag) 107 .attr("href", _mailto) 108 .html(_anchorContent ? _anchorContent : _mail) 109 .addClass("spamspan") 110 ).remove(); 111 }); 112 } 113}; 114}) (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.