diff options
Diffstat (limited to 'search')
-rw-r--r-- | search/css/results.css | 1 | ||||
-rw-r--r-- | search/js/result.js | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/search/css/results.css b/search/css/results.css index 61b7cf541c5..e61bf419b35 100644 --- a/search/css/results.css +++ b/search/css/results.css @@ -6,3 +6,4 @@ #searchresults td.result{width:30em;} #searchresults td.result *{cursor:pointer} #searchresults td.type{width:7em;text-align:right; border-right:1px solid #aaa;border-bottom:none} +#searchresults tr.current{background-color:#ddd} diff --git a/search/js/result.js b/search/js/result.js index 5ccc42252bf..1087f9684b2 100644 --- a/search/js/result.js +++ b/search/js/result.js @@ -30,12 +30,14 @@ OC.search.showResults=function(results){ $(window).click(function(event){ OC.search.hide(); }); + OC.search.lastResults=results; OC.search.showResults(results); }); }else{ var types=OC.search.catagorizeResults(results); $('#searchresults').show(); $('#searchresults tr.result').remove(); + var index=0; for(var name in types){ var type=types[name]; if(type.length>0){ @@ -46,6 +48,8 @@ OC.search.showResults=function(results){ row.find('td.result a').attr('href',type[0].link); row.find('td.result div.name').text(type[0].name); row.find('td.result div.text').text(type[0].text); + row.data('index',index); + index++; if(OC.search.customResults[name]){//give plugins the ability to customize the entries in here OC.search.customResults[name](row,type[0]); } @@ -57,6 +61,8 @@ OC.search.showResults=function(results){ row.find('td.result a').attr('href',type[i].link); row.find('td.result div.name').text(type[i].name); row.find('td.result div.text').text(type[i].text); + row.data('index',index); + index++; if(OC.search.customResults[name]){//give plugins the ability to customize the entries in here OC.search.customResults[name](row,type[i]); } @@ -67,3 +73,11 @@ OC.search.showResults=function(results){ } } OC.search.showResults.loaded=false; + +OC.search.renderCurrent=function(){ + if($('#searchresults tr.result')[OC.search.currentResult]){ + var result=$('#searchresults tr.result')[OC.search.currentResult]; + $('#searchresults tr.result').removeClass('current'); + $(result).addClass('current'); + } +} |