在heihe项目元数据查看中增加了google ajax search实现的相关搜索功能
This commit is contained in:
parent
4b5afe8ed9
commit
b1b2419d72
|
@ -277,7 +277,17 @@ echo '【'.$r->author.'. '.$r->publisher.' '.$r->ts_issued.'】</li>';
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="gsearch">
|
||||
<p>用GOOGLE搜索本数据的关键词,有以下结果:</p>
|
||||
<ul id="searchctrl">
|
||||
<?php
|
||||
foreach($this->keys as $cg){
|
||||
echo '<li><a href="javascript:;" onclick="googlesearch(\''.$cg->keyword.'\');">'.$cg->keyword.'</a></li>'."\r\n";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<ul id="searchlist">
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="recommend">
|
||||
<p>申请了本条数据的用户,通常他们还申请了:</p>
|
||||
|
@ -300,6 +310,7 @@ echo '【'.$r->author.'. '.$r->publisher.' '.$r->ts_issued.'】</li>';
|
|||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
$(document).ready(function(){$(".colorbox").colorbox({photo:"true"});});
|
||||
$(window).bind("load", function() { var timeout = setTimeout(function() { initLoader(); }, 100);});
|
||||
//$(window).bind("load", function() { var timeout = setTimeout(function() { gmaploaded(); }, 1000);});
|
||||
|
@ -395,6 +406,31 @@ function getSubFileList(uuid,id,depth){
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function googlesearch(keyword){
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"/service/googlesearch",
|
||||
data:'q='+keyword,
|
||||
success:function(html){
|
||||
var items = [];
|
||||
var obj = jQuery.parseJSON(html);
|
||||
$.each(obj.responseData.results, function(key, val) {
|
||||
var html = '<p><a href="' +val['unescapedUrl']+'">'+val['title']+'<a/></p><p><span>'+
|
||||
val['url'].replace(/%(.*)/i,"") +'</span></p><p>'+
|
||||
val['content']
|
||||
+'</p>';
|
||||
items.push('<li>' + html + '</li>');
|
||||
});
|
||||
$('#searchlist').html(items.join(''));
|
||||
},
|
||||
beforeSend:function(){
|
||||
$('#searchlist').html('<img src="/images/11887177066.gif" />结果加载中');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function gmaploaded()
|
||||
{
|
||||
//google map
|
||||
|
|
Loading…
Reference in New Issue