diff --git a/public/home/search.js b/public/home/search.js index 6980ee359..3f3137f03 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -35,8 +35,8 @@ var itemType={ var sortBy={ "11":"updated_unix.keyword", "12":"num_watches", - "13":"num_stars.keyword", - "14":"num_forks.keyword", + "13":"num_stars", + "14":"num_forks", "21":"updated_unix.keyword", "31":"created_unix.keyword", "32":"name.keyword", @@ -79,7 +79,7 @@ function initPageInfo(){ } function searchItem(type,sortType){ - console.log("enter here 2."); + console.log("enter item 2."); currentSearchKeyword = document.getElementById("keyword_input").value; if(!isEmpty(currentSearchKeyword)){ initPageInfo(); @@ -113,8 +113,16 @@ function search(){ } } -function searchLabel(){ - +function searchLabel(tableName,keyword,sortBy="",ascending=false){ + console.log("enter label search."); + currentSearchKeyword = keyword; + initPageInfo(); + currentSearchTableName = tableName; + currentSearchSortBy = sortBy; + currentSearchAscending = ascending; + OnlySearchLabel =true; + + page(currentPage); } function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){ @@ -459,8 +467,8 @@ function displayRepoResult(page,jsonResult,onlyReturnNum,keyword){ html += "
"; if(!isEmpty(recordMap["topics"]) && recordMap["topics"] !="null"){ for(var j = 0; j < recordMap["topics"].length;j++){ - //function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy){ - html +="
"+ recordMap["topics"][j] + "
"; + //function searchLabel(tableName,keyword,sortBy="",ascending=false) + html +="
"+ recordMap["topics"][j] + "
"; } } html +="
"; @@ -631,4 +639,14 @@ function page(current){ goPage(); } }); - } \ No newline at end of file + } + + +document.onreadystatechange = function() { + if (document.readyState === "complete") { + var keyword = $('#keyword_input').val(); + if(!isEmpty(keyword)){ + search(); + } + } +} \ No newline at end of file diff --git a/templates/base/head_navbar_fluid.tmpl b/templates/base/head_navbar_fluid.tmpl index f364518cc..ffbcc4418 100644 --- a/templates/base/head_navbar_fluid.tmpl +++ b/templates/base/head_navbar_fluid.tmpl @@ -93,7 +93,7 @@ {{if .IsSigned}}