PageSourceSearch

https://itforchange.net/modules/google_cse/js/google_cse.js?tjc4ab

js itforchange.net collected 2026-10-01 11:30:39 UTC 1,809 bytes, 44 lines download raw bytes

1/**
2 * @file
3 * Adds Google Custom Search Watermark.
4 */
5
6(function ($, Drupal, drupalSettings) {
7  'use strict';
8
9  Drupal.behaviors.googleCSECustomSearch = {
10    attach: function (context, settings) {
11      var getWatermarkBackground = function (value) {
12        var googleCSEBaseUrl = 'https://www.google.com/cse/intl/';
13        var googleCSEImageUrl = 'images/google_custom_search_watermark.gif';
14        var language = drupalSettings.googleCSE.language + '/';
15        return value ? '' : ' url(' + googleCSEBaseUrl + language + googleCSEImageUrl + ') left no-repeat';
16      };
17      var onFocus = function (e) {
18        $(e.target).css('background', '#ffffff');
19      };
20      var onBlur = function (e) {
21        $(e.target).css('background', '#ffffff' + getWatermarkBackground($(e.target).val()));
22      };
23      var googleCSEWatermark = function (context, query) {
24        var form = jQuery(context);
25        var searchInputs = $('[data-drupal-selector="' + query + '"]', form);
26        if (navigator.platform === 'Win32') {
27          searchInputs.css('style', 'border: 1px solid #7e9db9; padding: 2px;');
28        }
29        searchInputs.blur(onBlur);
30        searchInputs.focus(onFocus);
31        searchInputs.each(function () {
32          var event = {};
33          event.target = this;
34          onBlur(event);
35        });
36      };
37
38      googleCSEWatermark('[data-drupal-selector="search-block-form"] [data-drupal-form-fields="edit-keys--2"]', 'edit-keys');
39      googleCSEWatermark('[data-drupal-selector="search-block-form"] [data-drupal-form-fields="edit-keys"]', 'edit-keys');
40      googleCSEWatermark('[data-drupal-selector="search-form"]', 'edit-keys');
41      googleCSEWatermark('[data-drupal-selector="google-cse-search-box-form"]', 'edit-query');
42    }
43  };
44})(jQuery, Drupal, drupalSettings);

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.