-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle_cse.js
33 lines (31 loc) · 1.12 KB
/
google_cse.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(function ($) {
$(function () {
var googleCSEWatermark = function (id) {
var f = $(id)[0];
if (f && (f.query || f['edit-search-block-form--2'] || f['edit-keys'])) {
var q = f.query ? f.query : (f['edit-search-block-form--2'] ? f['edit-search-block-form--2'] : f['edit-keys']);
var n = navigator;
var l = location;
if (n.platform == 'Win32') {
q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;';
}
var b = function () {
if (q.value == '') {
q.style.background = '#FFFFFF url(https://www.google.com/cse/intl/' + Drupal.settings.googleCSE.language + '/images/google_custom_search_watermark.gif) left no-repeat';
}
};
var f = function () {
q.style.background = '#ffffff';
};
q.onfocus = f;
q.onblur = b;
// if (!/[&?]query=[^&]/.test(l.search)) {
b();
// }
}
};
googleCSEWatermark('#search-block-form.google-cse');
googleCSEWatermark('#search-form.google-cse');
googleCSEWatermark('#google-cse-results-searchbox-form');
});
})(jQuery);