-
Notifications
You must be signed in to change notification settings - Fork 3
/
searchgoogle.php
148 lines (138 loc) · 3.74 KB
/
searchgoogle.php
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/*
Template Name:google自定义搜索
*/
?>
<?php get_header(); ?>
<?php $options = get_option('loper_options'); ?>
<div id="content">
<section class="layout">
<article class="index">
<h1 class="searchicon"><?php the_title();?></h1>
<div class="indexsearch">
<div id="cse">正在搜索...</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'zh-CN', style : google.loader.themes.MINIMALIST});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl
('000541308798378468038:d7g1pdu2oqa');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
var match = location.search.match(/q=([^&]*)(&|$)/);
if(match && match[1]){
var search = decodeURIComponent(match[1]);
customSearchControl.execute(search);
}
}, true);
</script>
<style type="text/css">
.gsc-control-cse {
font-family: 'Century Gothic',"Microsoft YaHei", Trebuchet MS ,sans-serif;
border-color: #F0F0F0;
background-color:transparent;
}
input.gsc-input {
border-color: #777777;
}
input.gsc-search-button {
border-color: #333333;
background-color: #333333;
}
.gsc-tabHeader.gsc-tabhInactive {
border-color: #777777;
background-color: #c0c0c0;
}
.gsc-tabHeader.gsc-tabhActive {
border-color: #333333;
background-color: #333333;
}
.gsc-tabsArea {
border-color: #333333;
}
.gsc-webResult.gsc-result {
border-color: #F0F0F0;
background-color: #F0F0F0;
}
.gsc-webResult.gsc-result:hover {
border-color: #F0F0F0;
background-color: #F0F0F0;
}
.gs-webResult.gs-result a.gs-title:link,
.gs-webResult.gs-result a.gs-title:link b {
color: #444444; font-size:14px
}
.gs-webResult.gs-result a.gs-title:visited,
.gs-webResult.gs-result a.gs-title:visited b {
color: #444444;
}
.gs-webResult.gs-result a.gs-title:hover,
.gs-webResult.gs-result a.gs-title:hover b {
color: #444444;
}
.gs-webResult.gs-result a.gs-title:active,
.gs-webResult.gs-result a.gs-title:active b {
color: #777777;
}
.gsc-cursor-page {
color: #444444;
}
a.gsc-trailing-more-results:link {
color: #444444;
}
.gs-webResult.gs-result .gs-snippet {
color: #333333;
}
.gs-webResult.gs-result .gs-visibleUrl {
color: #ccc;
}
.gs-webResult.gs-result .gs-visibleUrl-short {
color: #ccc;
}
.gs-webResult.gs-result .gs-visibleUrl-short {
display: block;
}
.gs-webResult.gs-result .gs-visibleUrl-long {
display: none;
}
.gsc-cursor-box {
border-color: #F0F0F0;
}
.gsc-results .gsc-cursor-page {
border-color: #777777;
background-color: #F0F0F0;
}
.gsc-results .gsc-cursor-page.gsc-cursor-current-page {
border-color: #333333;
background-color: #333333;
}
.gs-promotion.gs-result {
border-color: #CCCCCC;
background-color: #E6E6E6;
}
.gs-promotion.gs-result a.gs-title:link {
color: #666666;
}
.gs-promotion.gs-result a.gs-title:visited {
color: #333333;
}
.gs-promotion.gs-result a.gs-title:hover {
color: #444444;
}
.gs-promotion.gs-result a.gs-title:active {
color: #00CC00;
}
.gs-promotion.gs-result .gs-snippet {
color: #333333;
}
.gs-promotion.gs-result .gs-visibleUrl,
.gs-promotion.gs-result .gs-visibleUrl-short {
color: #ccc;
}
</style>
</div>
</article>
</section>
<?php get_sidebar(); ?>
</div><!--#content-->
<?php get_footer(); ?>