-
Notifications
You must be signed in to change notification settings - Fork 1
/
test1.txt
52 lines (42 loc) · 1.49 KB
/
test1.txt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
old code
(
function ()
{
var searchElement = document.createElement('gcse:search');
var threadSearchElement = document.getElementsByClassName('right-column panel-panel sidebar');
if(threadSearchElement.length > 0){
threadSearchElement[0].appendChild(searchElement);
}
var mainSearchElement = document.getElementById('second-header');
if(mainSearchElement != null){
if(mainSearchElement.firstElementChild.firstElementChild.className == "grid-6"){
var mainSearchElementChild = mainSearchElement.firstElementChild.firstElementChild;
var rightAlignedContainer = document.createElement('div');
rightAlignedContainer.style.width = "300px";
rightAlignedContainer.style.float = "right";
rightAlignedContainer.appendChild(searchElement);
mainSearchElementChild.appendChild(rightAlignedContainer);
}
}
InitializeSearch();
}
)();
function InitializeSearch() {
var cx = '003127763848949150573:j-nc4htca_e';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
gcse.addEventListener('load', ReStyleButton(), false);
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
}
function ReStyleButton(){
setTimeout(DoReStyleButton, 1000);
}
function DoReStyleButton(){
var searchElements = document.getElementsByClassName('gsc-search-button gsc-search-button-v2');
if(searchElements.length > 0){
searchElements[0].style.display = 'none';
}
}