-
Notifications
You must be signed in to change notification settings - Fork 10
/
search.ejs
executable file
·45 lines (37 loc) · 1.45 KB
/
search.ejs
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
<span class="local-search local-search-google local-search-plugin" style="<%- wrapStyle %>">
<input type="search" placeholder="Search..." id="local-search-input" class="local-search-input-cls" style="<%- inputStyle %>">
<!--<i class="icon" aria-hidden="true" title="Search"></i>-->
<div id="local-search-result" class="local-search-result-cls"></div>
</span>
<script>
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if(isMobile.any()){
//手机端取消搜索功能
$('.local-search').css("display","none");
}
$(".local-search").on('input porpertychange',function(){
//searchFunc("/search.xml", 'local-search-input', 'local-search-result');
});
if ($('.local-search').size() && !isMobile.any()) {
searchFunc("/search.xml", 'local-search-input', 'local-search-result');
}
</script>