#2329 项目内默认头像的更改

Merged
zouap merged 3 commits from fix-2227 into V20220630 1 year ago
  1. +624
    -601
      public/home/search.js
  2. +1
    -1
      routers/search.go
  3. +54
    -25
      templates/explore/repo_list.tmpl

+ 624
- 601
public/home/search.js View File

@@ -1,118 +1,114 @@
var token;
if(isEmpty(token)){
if (isEmpty(token)) {
var meta = $("meta[name=_uid]");
if(!isEmpty(meta)){
if (!isEmpty(meta)) {
token = meta.attr("content");
console.log("token is uid:" + token);
}
}

var html =document.documentElement;
var html = document.documentElement;
var lang = html.attributes["lang"]
var isZh = true;
if(lang != null && lang.nodeValue =="en-US" ){
console.log("the language is " + lang.nodeValue);
isZh=false;
}else{
console.log("default lang=zh");
if (lang != null && lang.nodeValue == "en-US") {
isZh = false;
} else {
}
function isEmpty(str){
if(typeof str == "undefined" || str == null || str == ""){
function isEmpty(str) {
if (typeof str == "undefined" || str == null || str == "") {
return true;
}
return false;
}

var itemType={
"1":"repository",
"2":"issue",
"3":"user",
"4":"org",
"5":"dataset",
"6":"pr"
var itemType = {
"1": "repository",
"2": "issue",
"3": "user",
"4": "org",
"5": "dataset",
"6": "pr"
};

var sortBy={
"10":"default",
"11":"updated_unix.keyword",
"12":"num_watches",
"13":"num_stars",
"14":"num_forks",
"20":"default",
"21":"updated_unix.keyword",
"30":"default",
"31":"name.keyword",
"32":"name.keyword",
"33":"created_unix.keyword",
"34":"created_unix.keyword",
"40":"default",
"41":"name.keyword",
"42":"name.keyword",
"43":"created_unix.keyword",
"44":"created_unix.keyword",
"50":"default",
"51":"download_times",
"60":"default",
"61":"updated_unix.keyword"
var sortBy = {
"10": "default",
"11": "updated_unix.keyword",
"12": "num_watches",
"13": "num_stars",
"14": "num_forks",
"20": "default",
"21": "updated_unix.keyword",
"30": "default",
"31": "name.keyword",
"32": "name.keyword",
"33": "created_unix.keyword",
"34": "created_unix.keyword",
"40": "default",
"41": "name.keyword",
"42": "name.keyword",
"43": "created_unix.keyword",
"44": "created_unix.keyword",
"50": "default",
"51": "download_times",
"60": "default",
"61": "updated_unix.keyword"
};

var sortAscending={
"10":"false",
"11":"false",
"12":"false",
"13":"false",
"14":"false",
"20":"false",
"21":"false",
"30":"false",
"31":"true",
"32":"false",
"33":"false",
"34":"true",
"40":"false",
"41":"true",
"42":"false",
"43":"false",
"44":"true",
"50":"false",
"51":"false",
"60":"false",
"61":"false"
var sortAscending = {
"10": "false",
"11": "false",
"12": "false",
"13": "false",
"14": "false",
"20": "false",
"21": "false",
"30": "false",
"31": "true",
"32": "false",
"33": "false",
"34": "true",
"40": "false",
"41": "true",
"42": "false",
"43": "false",
"44": "true",
"50": "false",
"51": "false",
"60": "false",
"61": "false"
};

var currentPage = 1;
var pageSize = 15;
var currentSearchTableName ="repository";
var currentSearchKeyword="";
var currentSearchSortBy="";
var currentSearchAscending="false";
var OnlySearchLabel=false;
var startIndex =1;
var currentSearchTableName = "repository";
var currentSearchKeyword = "";
var currentSearchSortBy = "";
var currentSearchAscending = "false";
var OnlySearchLabel = false;
var startIndex = 1;
var endIndex = 5;
var totalPage = 1;
var totalNum = 0;
var privateTotal = 0;

function initPageInfo(){
function initPageInfo() {
currentPage = 1;
startIndex =1;
startIndex = 1;
endIndex = 5;
}

function searchItem(type,sortType){
console.log("enter item 2.");
if(OnlySearchLabel){
doSearchLabel(currentSearchTableName,currentSearchKeyword,sortBy[sortType],sortAscending[sortType])
}else{
function searchItem(type, sortType) {
if (OnlySearchLabel) {
doSearchLabel(currentSearchTableName, currentSearchKeyword, sortBy[sortType], sortAscending[sortType])
} else {
currentSearchKeyword = document.getElementById("keyword_input").value;
if(!isEmpty(currentSearchKeyword)){
if (!isEmpty(currentSearchKeyword)) {
initPageInfo();
currentSearchTableName = itemType[type];
currentSearchSortBy = sortBy[sortType];
currentSearchAscending = sortAscending[sortType];
OnlySearchLabel =false;
OnlySearchLabel = false;
page(currentPage);
}else{
} else {
emptySearch();
}
}
@@ -120,28 +116,27 @@ function searchItem(type,sortType){



function search(){
console.log("enter here 1.");
function search() {
currentSearchKeyword = document.getElementById("keyword_input").value;
if(!isEmpty(currentSearchKeyword)){
if (!isEmpty(currentSearchKeyword)) {
currentSearchKeyword = currentSearchKeyword.trim();
}
if(!isEmpty(currentSearchKeyword)){
doSpcifySearch(currentSearchTableName,currentSearchKeyword,sortBy[10],"false");
}else{
if (!isEmpty(currentSearchKeyword)) {
doSpcifySearch(currentSearchTableName, currentSearchKeyword, sortBy[10], "false");
} else {
emptySearch();
}
}

function emptySearch(){
function emptySearch() {
initDiv(false);
initPageInfo();
$('#searchForm').addClass("hiddenSearch");
document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty");
document.getElementById("find_id").innerHTML = getLabel(isZh, "search_empty");
$('#find_title').html("");
document.getElementById("sort_type").innerHTML="";
document.getElementById("child_search_item").innerHTML="";
document.getElementById("page_menu").innerHTML="";
document.getElementById("sort_type").innerHTML = "";
document.getElementById("child_search_item").innerHTML = "";
document.getElementById("page_menu").innerHTML = "";
$('#repo_total').text("");
$('#pr_total').text("");
$('#issue_total').text("");
@@ -151,142 +146,137 @@ function emptySearch(){
setActivate(null);
}

function initDiv(isSearchLabel=false){
if(isSearchLabel){
document.getElementById("search_div").style.display="none";
document.getElementById("search_label_div").style.display="block";
document.getElementById("dataset_item").style.display="none";
document.getElementById("issue_item").style.display="none";
document.getElementById("pr_item").style.display="none";
document.getElementById("user_item").style.display="none";
document.getElementById("org_item").style.display="none";
document.getElementById("find_id").innerHTML="";
}else{
document.getElementById("search_div").style.display="block";
document.getElementById("search_label_div").style.display="none";
document.getElementById("dataset_item").style.display="block";
document.getElementById("issue_item").style.display="block";
document.getElementById("pr_item").style.display="block";
document.getElementById("user_item").style.display="block";
document.getElementById("org_item").style.display="block";
document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded");
function initDiv(isSearchLabel = false) {
if (isSearchLabel) {
document.getElementById("search_div").style.display = "none";
document.getElementById("search_label_div").style.display = "block";
document.getElementById("dataset_item").style.display = "none";
document.getElementById("issue_item").style.display = "none";
document.getElementById("pr_item").style.display = "none";
document.getElementById("user_item").style.display = "none";
document.getElementById("org_item").style.display = "none";
document.getElementById("find_id").innerHTML = "";
} else {
document.getElementById("search_div").style.display = "block";
document.getElementById("search_label_div").style.display = "none";
document.getElementById("dataset_item").style.display = "block";
document.getElementById("issue_item").style.display = "block";
document.getElementById("pr_item").style.display = "block";
document.getElementById("user_item").style.display = "block";
document.getElementById("org_item").style.display = "block";
document.getElementById("find_id").innerHTML = getLabel(isZh, "search_finded");
}
}

function doSpcifySearch(tableName,keyword,sortBy="",ascending="false"){
function doSpcifySearch(tableName, keyword, sortBy = "", ascending = "false") {
initDiv(false);
$('#searchForm').addClass("hiddenSearch");
document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded");
document.getElementById("find_id").innerHTML = getLabel(isZh, "search_finded");
currentSearchKeyword = keyword;
initPageInfo();
currentSearchTableName = tableName;
currentSearchSortBy = sortBy;
currentSearchAscending = ascending;
OnlySearchLabel =false;
OnlySearchLabel = false;

page(currentPage);

if(currentSearchTableName != "repository"){
doSearch("repository",currentSearchKeyword,1,pageSize,true,"",false);
if (currentSearchTableName != "repository") {
doSearch("repository", currentSearchKeyword, 1, pageSize, true, "", false);
}
if(currentSearchTableName != "issue"){
doSearch("issue",currentSearchKeyword,1,pageSize,true,"",false);
if (currentSearchTableName != "issue") {
doSearch("issue", currentSearchKeyword, 1, pageSize, true, "", false);
}
if(currentSearchTableName != "user"){
doSearch("user",currentSearchKeyword,1,pageSize,true,"",false);
if (currentSearchTableName != "user") {
doSearch("user", currentSearchKeyword, 1, pageSize, true, "", false);
}
if(currentSearchTableName != "org"){
doSearch("org",currentSearchKeyword,1,pageSize,true,"",false);
if (currentSearchTableName != "org") {
doSearch("org", currentSearchKeyword, 1, pageSize, true, "", false);
}
if(currentSearchTableName != "dataset"){
doSearch("dataset",currentSearchKeyword,1,pageSize,true,"",false);
if (currentSearchTableName != "dataset") {
doSearch("dataset", currentSearchKeyword, 1, pageSize, true, "", false);
}
if(currentSearchTableName != "pr"){
doSearch("pr",currentSearchKeyword,1,pageSize,true,"",false);
if (currentSearchTableName != "pr") {
doSearch("pr", currentSearchKeyword, 1, pageSize, true, "", false);
}
}

function doSearchLabel(tableName,keyword,sortBy="",ascending="false"){
function doSearchLabel(tableName, keyword, sortBy = "", ascending = "false") {
initDiv(true);
//document.getElementById("search_div").style.display="none";
//document.getElementById("search_label_div").style.display="block";
document.getElementById("search_label_div").innerHTML="<p class=\"searchlabel\">#" + keyword + "</p>";
document.getElementById("search_label_div").innerHTML = "<p class=\"searchlabel\">#" + keyword + "</p>";

currentSearchKeyword = keyword;
initPageInfo();
currentSearchTableName = tableName;
currentSearchSortBy = sortBy;
currentSearchAscending = ascending;
OnlySearchLabel =true;
OnlySearchLabel = true;

page(currentPage);
}

function searchLabel(tableName,keyword,sortBy="",ascending="false"){
function searchLabel(tableName, keyword, sortBy = "", ascending = "false") {

sessionStorage.setItem("keyword",keyword);
sessionStorage.setItem("tableName",tableName);
sessionStorage.setItem("searchLabel",true);
sessionStorage.setItem("sortBy",sortBy);
sessionStorage.setItem("ascending",ascending);
console.log("enter label search.");
sessionStorage.setItem("keyword", keyword);
sessionStorage.setItem("tableName", tableName);
sessionStorage.setItem("searchLabel", true);
sessionStorage.setItem("sortBy", sortBy);
sessionStorage.setItem("ascending", ascending);
window.open("/all/search/");
}

function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){
function doSearch(tableName, keyword, page, pageSize = 15, onlyReturnNum = true, sortBy = "", OnlySearchLabel = false) {
var language = "zh-CN";
if(!isZh){
language="en-US";
if (!isZh) {
language = "en-US";
}
$.ajax({
type:"GET",
url:"/all/dosearch/",
type: "GET",
url: "/all/dosearch/",
headers: {
authorization:token,
authorization: token,
},
dataType:"json",
data:{
dataType: "json",
data: {
'TableName': tableName,
'Key': keyword,
'Page': page,
'PageSize': pageSize,
'OnlyReturnNum':onlyReturnNum,
'SortBy':sortBy,
'OnlySearchLabel':OnlySearchLabel,
'Ascending':currentSearchAscending,
'WebTotal':totalNum,
'PrivateTotal':privateTotal,
'language':language
'OnlyReturnNum': onlyReturnNum,
'SortBy': sortBy,
'OnlySearchLabel': OnlySearchLabel,
'Ascending': currentSearchAscending,
'WebTotal': totalNum,
'PrivateTotal': privateTotal,
'language': language
},
async:true,
success:function(json){
console.log("tableName=" + tableName);
console.log(json);
displayResult(tableName,page,json,onlyReturnNum,keyword);
async: true,
success: function (json) {
displayResult(tableName, page, json, onlyReturnNum, keyword);
},
error:function(response) {
console.log(response);
error: function (response) {
}
});
}

function displayResult(tableName,page,jsonResult,onlyReturnNum,keyword){
if(tableName == "repository") {
displayRepoResult(page,jsonResult,onlyReturnNum,keyword);
function displayResult(tableName, page, jsonResult, onlyReturnNum, keyword) {
if (tableName == "repository") {
displayRepoResult(page, jsonResult, onlyReturnNum, keyword);
} else if (tableName == "issue") {
displayIssueResult(page,jsonResult,onlyReturnNum,keyword);
displayIssueResult(page, jsonResult, onlyReturnNum, keyword);
} else if (tableName == "user") {
displayUserResult(page,jsonResult,onlyReturnNum,keyword);
displayUserResult(page, jsonResult, onlyReturnNum, keyword);
} else if (tableName == "org") {
displayOrgResult(page,jsonResult,onlyReturnNum,keyword);
displayOrgResult(page, jsonResult, onlyReturnNum, keyword);
} else if (tableName == "dataset") {
displayDataSetResult(page,jsonResult,onlyReturnNum,keyword);
displayDataSetResult(page, jsonResult, onlyReturnNum, keyword);
} else if (tableName == "pr") {
displayPrResult(page,jsonResult,onlyReturnNum,keyword);
displayPrResult(page, jsonResult, onlyReturnNum, keyword);
}
if(!onlyReturnNum){
console.log("set total num." + tableName);
totalPage =Math.ceil(jsonResult.Total/pageSize);
if (!onlyReturnNum) {
totalPage = Math.ceil(jsonResult.Total / pageSize);
totalNum = jsonResult.Total;
privateTotal = jsonResult.PrivateTotal;
setPage(page);
@@ -294,647 +284,684 @@ function displayResult(tableName,page,jsonResult,onlyReturnNum,keyword){

}

function displayPrResult(page,jsonResult,onlyReturnNum,keyword){
function displayPrResult(page, jsonResult, onlyReturnNum, keyword) {
var data = jsonResult.Result;
var total = jsonResult.Total;
$('#pr_total').text(total);
if(!onlyReturnNum){
if (!onlyReturnNum) {
setActivate("pr_item");
//$('#keyword_desc').text(keyword);
//$('#obj_desc').text(getLabel(isZh,"search_pr"));
//$('#child_total').text(total);
$('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_pr")).replace('{total}',total));
$('#find_title').html(getLabel(isZh, "find_title").replace('{keyword}', keyword).replace('{tablename}', getLabel(isZh, "search_pr")).replace('{total}', total));

setIssueOrPrInnerHtml(data,"pulls");
setIssueOrPrInnerHtml(data, "pulls");
}
}

var categoryDesc={
"computer_vision":"计算机视觉",
"natural_language_processing":"自然语言处理",
"speech_processing":"语音处理",
"computer_vision_natural_language_processing":"计算机视觉、自然语言处理"
var categoryDesc = {
"computer_vision": "计算机视觉",
"natural_language_processing": "自然语言处理",
"speech_processing": "语音处理",
"computer_vision_natural_language_processing": "计算机视觉、自然语言处理"
};

var categoryENDesc={
"computer_vision":"computer vision",
"natural_language_processing":"natural language processing",
"speech_processing":"speech processing",
"computer_vision_natural_language_processing":"computer vision and natural language processing"
var categoryENDesc = {
"computer_vision": "computer vision",
"natural_language_processing": "natural language processing",
"speech_processing": "speech processing",
"computer_vision_natural_language_processing": "computer vision and natural language processing"
};

var taskDesc={
"machine_translation":"机器翻译",
"question_answering_system":"问答系统",
"information_retrieval":"信息检索",
"knowledge_graph":"知识图谱",
"text_annotation":"文本标注",
"text_categorization":"文本分类",
"emotion_analysis":"情感分析",
"language_modeling":"语言建模",
"speech_recognition":"语音识别",
"automatic_digest":"自动文摘",
"information_extraction":"信息抽取",
"description_generation":"说明生成",
"image_classification":"图像分类",
"face_recognition":"人脸识别",
"image_search":"图像搜索",
"target_detection":"目标检测",
"image_description_generation":"图像描述生成",
"vehicle_license_plate_recognition":"车辆车牌识别",
"medical_image_analysis":"医学图像分析",
"unmanned":"无人驾驶",
"unmanned_security":"无人安防",
"drone":"无人机",
"vr_ar":"VR/AR",
"2_d_vision":"2-D视觉",
"2_5_d_vision":"2.5-D视觉",
"3_d_reconstruction":"3D重构",
"image_processing":"图像处理",
"video_processing":"视频处理",
"visual_input_system":"视觉输入系统",
"speech_coding":"语音编码",
"speech_enhancement":"语音增强",
"speech_recognition":"语音识别",
"speech_synthesis":"语音合成"
var taskDesc = {
"machine_translation": "机器翻译",
"question_answering_system": "问答系统",
"information_retrieval": "信息检索",
"knowledge_graph": "知识图谱",
"text_annotation": "文本标注",
"text_categorization": "文本分类",
"emotion_analysis": "情感分析",
"language_modeling": "语言建模",
"speech_recognition": "语音识别",
"automatic_digest": "自动文摘",
"information_extraction": "信息抽取",
"description_generation": "说明生成",
"image_classification": "图像分类",
"face_recognition": "人脸识别",
"image_search": "图像搜索",
"target_detection": "目标检测",
"image_description_generation": "图像描述生成",
"vehicle_license_plate_recognition": "车辆车牌识别",
"medical_image_analysis": "医学图像分析",
"unmanned": "无人驾驶",
"unmanned_security": "无人安防",
"drone": "无人机",
"vr_ar": "VR/AR",
"2_d_vision": "2-D视觉",
"2_5_d_vision": "2.5-D视觉",
"3_d_reconstruction": "3D重构",
"image_processing": "图像处理",
"video_processing": "视频处理",
"visual_input_system": "视觉输入系统",
"speech_coding": "语音编码",
"speech_enhancement": "语音增强",
"speech_recognition": "语音识别",
"speech_synthesis": "语音合成"
};

var taskENDesc={
"machine_translation":"machine translation",
"question_answering_system":"question answering system",
"information_retrieval":"information retrieval",
"knowledge_graph":"knowledge graph",
"text_annotation":"text annotation",
"text_categorization":"text categorization",
"emotion_analysis":"emotion analysis",
"language_modeling":"language modeling",
"speech_recognition":"speech recognition",
"automatic_digest":"automatic digest",
"information_extraction":"information extraction",
"description_generation":"description generation",
"image_classification":"image classification",
"face_recognition":"face recognition",
"image_search":"image search",
"target_detection":"target detection",
"image_description_generation":"image description generation",
"vehicle_license_plate_recognition":"vehicle license plate recognition",
"medical_image_analysis":"medical image analysis",
"unmanned":"unmanned",
"unmanned_security":"unmanned security",
"drone":"drone",
"vr_ar":"VR/AR",
"2_d_vision":"2.D vision",
"2.5_d_vision":"2.5D vision",
"3_d_reconstruction":"3Dreconstruction",
"image_processing":"image processing",
"video_processing":"video processing",
"visual_input_system":"visual input system",
"speech_coding":"speech coding",
"speech_enhancement":"speech enhancement",
"speech_recognition":"speech recognition",
"speech_synthesis":"speech synthesis"
var taskENDesc = {
"machine_translation": "machine translation",
"question_answering_system": "question answering system",
"information_retrieval": "information retrieval",
"knowledge_graph": "knowledge graph",
"text_annotation": "text annotation",
"text_categorization": "text categorization",
"emotion_analysis": "emotion analysis",
"language_modeling": "language modeling",
"speech_recognition": "speech recognition",
"automatic_digest": "automatic digest",
"information_extraction": "information extraction",
"description_generation": "description generation",
"image_classification": "image classification",
"face_recognition": "face recognition",
"image_search": "image search",
"target_detection": "target detection",
"image_description_generation": "image description generation",
"vehicle_license_plate_recognition": "vehicle license plate recognition",
"medical_image_analysis": "medical image analysis",
"unmanned": "unmanned",
"unmanned_security": "unmanned security",
"drone": "drone",
"vr_ar": "VR/AR",
"2_d_vision": "2.D vision",
"2.5_d_vision": "2.5D vision",
"3_d_reconstruction": "3Dreconstruction",
"image_processing": "image processing",
"video_processing": "video processing",
"visual_input_system": "visual input system",
"speech_coding": "speech coding",
"speech_enhancement": "speech enhancement",
"speech_recognition": "speech recognition",
"speech_synthesis": "speech synthesis"
};

function getCategoryDesc(isZh,key){
function getCategoryDesc(isZh, key) {
var re = key;
if(isZh){
if (isZh) {
re = categoryDesc[key];
}else{
} else {
re = categoryENDesc[key];
}
if(isEmpty(re)){
if (isEmpty(re)) {
return key;
}
return re;
}

function getTaskDesc(isZh,key){
function getTaskDesc(isZh, key) {
var re = key;
if(isZh){
if (isZh) {
re = taskDesc[key];
}else{
} else {
re = taskENDesc[key];
}
if(isEmpty(re)){
if (isEmpty(re)) {
return key;
}
return re;
}

function getActiveItem(sort_type){
console.log("currentSearchSortBy=" + currentSearchSortBy + " sort_type=" + sortBy[sort_type]);
if(currentSearchSortBy == sortBy[sort_type] && currentSearchAscending == sortAscending[sort_type]){
function getActiveItem(sort_type) {
if (currentSearchSortBy == sortBy[sort_type] && currentSearchAscending == sortAscending[sort_type]) {
return "active ";
}else{
} else {
return "";
}
}

function displayDataSetResult(page,jsonResult,onlyReturnNum,keyword){
function displayDataSetResult(page, jsonResult, onlyReturnNum, keyword) {
var data = jsonResult.Result;
var total = jsonResult.Total;
$('#dataset_total').text(total);
if(!onlyReturnNum){
if (!onlyReturnNum) {
setActivate("dataset_item");
//$('#keyword_desc').text(keyword);
//$('#obj_desc').text(getLabel(isZh,"search_dataset"));
//$('#child_total').text(total);
$('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_dataset")).replace('{total}',total));
$('#find_title').html(getLabel(isZh, "find_title").replace('{keyword}', keyword).replace('{tablename}', getLabel(isZh, "search_dataset")).replace('{total}', total));

var sortHtml = "";
sortHtml +="<a class=\"" + getActiveItem(50) + "item\" href=\"javascript:searchItem(5,50);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(51) + "item\" href=\"javascript:searchItem(5,51);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched_download") + "</a>";
document.getElementById("sort_type").innerHTML=sortHtml;
sortHtml += "<a class=\"" + getActiveItem(50) + "item\" href=\"javascript:searchItem(5,50);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(51) + "item\" href=\"javascript:searchItem(5,51);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched_download") + "</a>";
document.getElementById("sort_type").innerHTML = sortHtml;

var html = "";
var currentTime = new Date().getTime();
for(var i = 0; i < data.length;i++){
for (var i = 0; i < data.length; i++) {
var recordMap = data[i];
html += "<div class=\"item\">";
html += " <div class=\"content\">";
html += " <div class=\"ui right metas\">" ;
if(!isEmpty(recordMap["category"])){
html += " <span class=\"text grey\"><svg class=\"svg octicon-tasklist\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-tasklist\" /></svg> " + getCategoryDesc(isZh,recordMap["category"]) + "</span>";
html += " <div class=\"ui right metas\">";
if (!isEmpty(recordMap["category"])) {
html += " <span class=\"text grey\"><svg class=\"svg octicon-tasklist\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-tasklist\" /></svg> " + getCategoryDesc(isZh, recordMap["category"]) + "</span>";
}
if(!isEmpty(recordMap["task"])){
html += " <span class=\"text grey\"><svg class=\"svg octicon-tag\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-tag\" /></svg>" + getTaskDesc(isZh,recordMap["task"]) + "</span>";
if (!isEmpty(recordMap["task"])) {
html += " <span class=\"text grey\"><svg class=\"svg octicon-tag\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-tag\" /></svg>" + getTaskDesc(isZh, recordMap["task"]) + "</span>";
}
html += " <span class=\"text grey\"><i class=\"ri-fire-line\"></i> " +recordMap["download_times"] + "</span> ";
html +=" </div>";
html += " <span class=\"text grey\"><i class=\"ri-fire-line\"></i> " + recordMap["download_times"] + "</span> ";
html += " </div>";
html += " <div class=\"ui header\">";
html += " <a class=\"name\" href=\"/" +recordMap["repoUrl"] +"/datasets\" target=\"_blank\">" + recordMap["title"] + "</a>";
html +=" <span class=\"middle\"><svg class=\"svg octicon-repo-clone\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-repo-clone\"></use></svg></span>";
html +=" </div>";
html += " <a class=\"name\" href=\"/" + recordMap["repoUrl"] + "/datasets\" target=\"_blank\">" + recordMap["title"] + "</a>";
html += " <span class=\"middle\"><svg class=\"svg octicon-repo-clone\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-repo-clone\"></use></svg></span>";
html += " </div>";
html += " <div class=\"description\">";
html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
if(!isEmpty(recordMap["file_name"])){
if (!isEmpty(recordMap["file_name"])) {
html += " <p class=\"has-emoji\"> " + recordMap["file_name"] + "</p>";
}
html +=" <p class=\"time\">";
html +=" <span class=\"am-ml-10\"></span> "+ getLabel(isZh,"search_lasted_update") + " " + recordMap["updated_html"];
html +=" </p>";
html +=" </div>";
html +=" </div>";
html +="</div>";
html += " <p class=\"time\">";
html += " <span class=\"am-ml-10\"></span> " + getLabel(isZh, "search_lasted_update") + " " + recordMap["updated_html"];
html += " </p>";
html += " </div>";
html += " </div>";
html += "</div>";
}
document.getElementById("child_search_item").innerHTML=html;
document.getElementById("child_search_item").innerHTML = html;
}
}

function displayOrgResult(page,jsonResult,onlyReturnNum,keyword){
function displayOrgResult(page, jsonResult, onlyReturnNum, keyword) {
var data = jsonResult.Result;
var total = jsonResult.Total;
$('#org_total').text(total);
if(!onlyReturnNum){
if (!onlyReturnNum) {
setActivate("org_item");
//$('#keyword_desc').text(keyword);
//$('#obj_desc').text(getLabel(isZh,"search_org"));
//$('#child_total').text(total);
$('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_org")).replace('{total}',total));
$('#find_title').html(getLabel(isZh, "find_title").replace('{keyword}', keyword).replace('{tablename}', getLabel(isZh, "search_org")).replace('{total}', total));

var sortHtml = "";
sortHtml +="<a class=\"" + getActiveItem(40) + "item\" href=\"javascript:searchItem(4,40);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(41) + "item\" href=\"javascript:searchItem(4,41);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_letter_asc") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(42) + "item\" href=\"javascript:searchItem(4,42);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_letter_desc") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(43) + "item\" href=\"javascript:searchItem(4,43);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_lasted_create") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(44) + "item\" href=\"javascript:searchItem(4,44);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_early_create") + "</a>";
document.getElementById("sort_type").innerHTML=sortHtml;
sortHtml += "<a class=\"" + getActiveItem(40) + "item\" href=\"javascript:searchItem(4,40);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(41) + "item\" href=\"javascript:searchItem(4,41);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_letter_asc") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(42) + "item\" href=\"javascript:searchItem(4,42);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">" + getLabel(isZh, "search_letter_desc") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(43) + "item\" href=\"javascript:searchItem(4,43);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">" + getLabel(isZh, "search_lasted_create") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(44) + "item\" href=\"javascript:searchItem(4,44);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">" + getLabel(isZh, "search_early_create") + "</a>";
document.getElementById("sort_type").innerHTML = sortHtml;

var html = "";
var currentTime = new Date().getTime();
for(var i = 0; i < data.length;i++){
for (var i = 0; i < data.length; i++) {
var recordMap = data[i];
html += "<div class=\"item members\">";
html += "<img class=\"ui avatar image\" src=\"" + recordMap["avatar"] + "\"></img>";
html += " <div class=\"content\">";
html += " <div class=\"ui header\">";
html += " <a class=\"name\" href=\"/" + recordMap["real_name"] +"\" target=\"_blank\">" + recordMap["name"] + "&nbsp;&nbsp;" + recordMap["full_name"] + "</a>";
html +=" </div>";
html += " <a class=\"name\" href=\"/" + recordMap["real_name"] + "\" target=\"_blank\">" + recordMap["name"] + "&nbsp;&nbsp;" + recordMap["full_name"] + "</a>";
html += " </div>";
html += " <div class=\"description\">";
html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
html +=" <p class=\"has-emoji\">";
if(!isEmpty(recordMap["location"]) && recordMap["location"] != "null"){
html +=" <i class=\"ri-map-pin-2-line\"></i> " + recordMap["location"];
html += " <p class=\"has-emoji\">";
if (!isEmpty(recordMap["location"]) && recordMap["location"] != "null") {
html += " <i class=\"ri-map-pin-2-line\"></i> " + recordMap["location"];
}
html +=" <span class=\"am-ml-10\"></span>";
if(!isEmpty(recordMap["website"]) && recordMap["website"] != "null"){
html +=" <i class=\"ri-links-line\"></i>" + "<a href=\""+ recordMap["website"] + "\" target=\"_blank\">" + recordMap["website"] + "</a>";
html += " <span class=\"am-ml-10\"></span>";
if (!isEmpty(recordMap["website"]) && recordMap["website"] != "null") {
html += " <i class=\"ri-links-line\"></i>" + "<a href=\"" + recordMap["website"] + "\" target=\"_blank\">" + recordMap["website"] + "</a>";
}
html +=" <i class=\"ri-time-line am-ml-10\"></i> "+ getLabel(isZh,"search_add_by") + " ";
html += " <i class=\"ri-time-line am-ml-10\"></i> " + getLabel(isZh, "search_add_by") + " ";
html += recordMap["add_time"]
html +=" </p>";
html +=" </div>";
html +=" </div>";
html +="</div>";
html += " </p>";
html += " </div>";
html += " </div>";
html += "</div>";
}
document.getElementById("child_search_item").innerHTML=html;
document.getElementById("child_search_item").innerHTML = html;
}
}
var monthDisplay=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec");
function displayUserResult(page,jsonResult,onlyReturnNum,keyword){
var monthDisplay = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Spt", "Oct", "Nov", "Dec");
function displayUserResult(page, jsonResult, onlyReturnNum, keyword) {
var data = jsonResult.Result;
var total = jsonResult.Total;
$('#user_total').text(total);
if(!onlyReturnNum){
if (!onlyReturnNum) {
setActivate("user_item");
//$('#keyword_desc').text(keyword);
//$('#obj_desc').text(getLabel(isZh,"search_user"));
//$('#child_total').text(total);

$('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_user")).replace('{total}',total));
$('#find_title').html(getLabel(isZh, "find_title").replace('{keyword}', keyword).replace('{tablename}', getLabel(isZh, "search_user")).replace('{total}', total));

var sortHtml = "";//equal user sort by
sortHtml +="<a class=\"" + getActiveItem(30) + "item\" href=\"javascript:searchItem(3,30);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(31) + "item\" href=\"javascript:searchItem(3,31);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_letter_asc") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(32) + "item\" href=\"javascript:searchItem(3,32);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_letter_desc") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(33) + "item\" href=\"javascript:searchItem(3,33);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_lasted_create") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(34) + "item\" href=\"javascript:searchItem(3,34);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_early_create") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(30) + "item\" href=\"javascript:searchItem(3,30);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(31) + "item\" href=\"javascript:searchItem(3,31);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_letter_asc") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(32) + "item\" href=\"javascript:searchItem(3,32);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">" + getLabel(isZh, "search_letter_desc") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(33) + "item\" href=\"javascript:searchItem(3,33);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">" + getLabel(isZh, "search_lasted_create") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(34) + "item\" href=\"javascript:searchItem(3,34);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">" + getLabel(isZh, "search_early_create") + "</a>";

document.getElementById("sort_type").innerHTML=sortHtml;
document.getElementById("sort_type").innerHTML = sortHtml;

var html = "";
var currentTime = new Date().getTime();
for(var i = 0; i < data.length;i++){
for (var i = 0; i < data.length; i++) {
var recordMap = data[i];
html += "<div class=\"item members\">";
html += "<img class=\"ui avatar image\" src=\"" + recordMap["avatar"] + "\"></img>";
html += " <div class=\"content\">";
html += " <div class=\"ui header\">";
html += " <a class=\"name\" href=\"/" + recordMap["real_name"] +"\" target=\"_blank\">" + recordMap["name"] + "&nbsp;&nbsp;" + recordMap["full_name"] + "</a>";
html +=" </div>";
html += " <a class=\"name\" href=\"/" + recordMap["real_name"] + "\" target=\"_blank\">" + recordMap["name"] + "&nbsp;&nbsp;" + recordMap["full_name"] + "</a>";
html += " </div>";
html += " <div class=\"description\">";
html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
html +=" <p class=\"has-emoji\">";
if(!isEmpty(recordMap["email"]) && recordMap["email"] != "null"){
html +=" <i class=\"ri-mail-line\"></i>&nbsp;<a href=\"mailto:" + recordMap["email"] + "\" rel=\"nofollow\">" + recordMap["email"] + "</a>";
html += " <p class=\"has-emoji\">";
if (!isEmpty(recordMap["email"]) && recordMap["email"] != "null") {
html += " <i class=\"ri-mail-line\"></i>&nbsp;<a href=\"mailto:" + recordMap["email"] + "\" rel=\"nofollow\">" + recordMap["email"] + "</a>";
}
html +=" <i class=\"ri-time-line am-ml-10\"></i> "+ getLabel(isZh,"search_add_by") + " ";
html += " <i class=\"ri-time-line am-ml-10\"></i> " + getLabel(isZh, "search_add_by") + " ";
html += recordMap["add_time"]
html +=" </p>";
html +=" </div>";
html +=" </div>";
html +="</div>";
html += " </p>";
html += " </div>";
html += " </div>";
html += "</div>";
}
document.getElementById("child_search_item").innerHTML=html;
document.getElementById("child_search_item").innerHTML = html;
}
}

function setIssueOrPrInnerHtml(data,path){
function setIssueOrPrInnerHtml(data, path) {
var sortHtml = "";
if(path =="issues"){
sortHtml +="<a class=\"" + getActiveItem(20) + "item\" href=\"javascript:searchItem(2,20);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(21) + "item\" href=\"javascript:searchItem(2,21);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_lasted") + "</a>";
}else{
sortHtml +="<a class=\"" + getActiveItem(60) + "item\" href=\"javascript:searchItem(6,60);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(61) + "item\" href=\"javascript:searchItem(6,61);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_lasted") + "</a>";
if (path == "issues") {
sortHtml += "<a class=\"" + getActiveItem(20) + "item\" href=\"javascript:searchItem(2,20);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(21) + "item\" href=\"javascript:searchItem(2,21);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_lasted") + "</a>";
} else {
sortHtml += "<a class=\"" + getActiveItem(60) + "item\" href=\"javascript:searchItem(6,60);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(61) + "item\" href=\"javascript:searchItem(6,61);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_lasted") + "</a>";
}

document.getElementById("sort_type").innerHTML=sortHtml;
document.getElementById("sort_type").innerHTML = sortHtml;

var html = "";
var currentTime = new Date().getTime();
for(var i = 0; i < data.length;i++){
for (var i = 0; i < data.length; i++) {
var recordMap = data[i];
html += "<div class=\"item\">";
html += " <div class=\"content\">";
html += " <div class=\"ui header\">";
html += " <a class=\"name\" href=\"/" + recordMap["repoUrl"] +"/" + path + "/" + recordMap["index"] + "\" target=\"_blank\">" + recordMap["name"] + "</a>";
html +=" </div>";
html += " <a class=\"name\" href=\"/" + recordMap["repoUrl"] + "/" + path + "/" + recordMap["index"] + "\" target=\"_blank\">" + recordMap["name"] + "</a>";
html += " </div>";
html += " <div class=\"description\">";
html += " <p class=\"has-emoji\"> " + recordMap["content"] + "</p>";
html +=" <p class=\"time\">";
html +=" <i class=\"ri-code-box-line\"></i>";
html +=" <a class=\"am-text grey\" href=\"/" + recordMap["repoUrl"] +"/" + path + "/" + recordMap["index"] + "\" target=\"_blank\"> " + addBlank(recordMap["repoUrl"]) +" #" + recordMap["index"] + "</a>&nbsp;&nbsp;&nbsp;&nbsp;";
html +=" <i class=\"ri-information-line am-ml-10\"></i>&nbsp;";
if(recordMap["is_closed"] != null && (!(recordMap["is_closed"]) || recordMap["is_closed"]=="f")){
html += getLabel(isZh,"search_open");
}else{
html += getLabel(isZh,"search_closed");
html += " <p class=\"time\">";
html += " <i class=\"ri-code-box-line\"></i>";
html += " <a class=\"am-text grey\" href=\"/" + recordMap["repoUrl"] + "/" + path + "/" + recordMap["index"] + "\" target=\"_blank\"> " + addBlank(recordMap["repoUrl"]) + " #" + recordMap["index"] + "</a>&nbsp;&nbsp;&nbsp;&nbsp;";
html += " <i class=\"ri-information-line am-ml-10\"></i>&nbsp;";
if (recordMap["is_closed"] != null && (!(recordMap["is_closed"]) || recordMap["is_closed"] == "f")) {
html += getLabel(isZh, "search_open");
} else {
html += getLabel(isZh, "search_closed");
}
html +=" &nbsp;&nbsp;&nbsp;&nbsp;<i class=\"ri-message-2-line am-ml-10\"></i>&nbsp;" + recordMap["num_comments"];
html += " &nbsp;&nbsp;&nbsp;&nbsp;<i class=\"ri-message-2-line am-ml-10\"></i>&nbsp;" + recordMap["num_comments"];

html +=" <span class=\"am-ml-10\">&nbsp;&nbsp;</span>&nbsp;&nbsp;"+ getLabel(isZh,"search_lasted_update") + " "+ recordMap["updated_html"];
html += " <span class=\"am-ml-10\">&nbsp;&nbsp;</span>&nbsp;&nbsp;" + getLabel(isZh, "search_lasted_update") + " " + recordMap["updated_html"];

html +=" </p>";
html +=" </div>";
html +=" </div>";
html +="</div>";
html += " </p>";
html += " </div>";
html += " </div>";
html += "</div>";
}
document.getElementById("child_search_item").innerHTML=html;
document.getElementById("child_search_item").innerHTML = html;
}

function addBlank(url){
if(url == null){
function addBlank(url) {
if (url == null) {
return url;
}
var tmps = url.split("/");
if(tmps.length == 2){
if (tmps.length == 2) {
return tmps[0] + " / " + tmps[1];
}
return url;
}

function displayIssueResult(page,jsonResult,onlyReturnNum,keyword){
function displayIssueResult(page, jsonResult, onlyReturnNum, keyword) {
var data = jsonResult.Result;
var total = jsonResult.Total;
$('#issue_total').text(total);
if(!onlyReturnNum){
if (!onlyReturnNum) {
setActivate("issue_item");
//$('#keyword_desc').text(keyword);
//$('#obj_desc').text(getLabel(isZh,"search_issue"));
//$('#child_total').text(total);
$('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_issue")).replace('{total}',total));
$('#find_title').html(getLabel(isZh, "find_title").replace('{keyword}', keyword).replace('{tablename}', getLabel(isZh, "search_issue")).replace('{total}', total));

setIssueOrPrInnerHtml(data,"issues");
setIssueOrPrInnerHtml(data, "issues");
}
}

function setActivate(name){
function setActivate(name) {
$('#repo_item').removeClass("active");
$('#user_item').removeClass("active");
$('#issue_item').removeClass("active");
$('#dataset_item').removeClass("active");
$('#org_item').removeClass("active");
$('#pr_item').removeClass("active");
if(name==null){
if (name == null) {
return;
}
var tmp = "#" + name;
$(tmp).addClass("active");
}

function displayRepoResult(page,jsonResult,onlyReturnNum,keyword){

function LetterAvatar(name, size, color) {
name = name || '';
size = size || 60;
var colours = [
"#1abc9c", "#2ecc71", "#3498db", "#9b59b6", "#34495e", "#16a085", "#27ae60", "#2980b9", "#8e44ad", "#2c3e50",
"#f1c40f", "#e67e22", "#e74c3c", "#00bcd4", "#95a5a6", "#f39c12", "#d35400", "#c0392b", "#bdc3c7", "#7f8c8d"
],
nameSplit = String(name).split(' '),
initials, charIndex, colourIndex, canvas, context, dataURI;
if (nameSplit.length == 1) {
initials = nameSplit[0] ? nameSplit[0].charAt(0) : '?';
} else {
initials = nameSplit[0].charAt(0) + nameSplit[1].charAt(0);
}
if (w.devicePixelRatio) {
size = (size * w.devicePixelRatio);
}

charIndex = (initials == '?' ? 72 : initials.charCodeAt(0)) - 64;
colourIndex = charIndex % 20;
canvas = d.createElement('canvas');
canvas.width = size;
canvas.height = size;
context = canvas.getContext("2d");

context.fillStyle = color ? color : colours[colourIndex - 1];
context.fillRect(0, 0, canvas.width, canvas.height);
context.font = Math.round(canvas.width / 2) + "px 'Microsoft Yahei'";
context.textAlign = "center";
context.fillStyle = "#FFF";
context.fillText(initials, size / 2, size / 1.5);
dataURI = canvas.toDataURL();
canvas = null;
return dataURI;
}
LetterAvatar.transform = function () {
Array.prototype.forEach.call(d.querySelectorAll('img[avatar]'), function (img, name, color) {
name = img.getAttribute('avatar');
color = img.getAttribute('color');
img.src = LetterAvatar(name, img.getAttribute('width'), color);
img.removeAttribute('avatar');
img.setAttribute('alt', name);
});
};

function displayRepoResult(page, jsonResult, onlyReturnNum, keyword) {
var data = jsonResult.Result;
var total = jsonResult.Total;
$('#repo_total').text(total);

if(!onlyReturnNum){
if (!onlyReturnNum) {
setActivate("repo_item");
// $('#keyword_desc').text(keyword);
//$('#obj_desc').text(getLabel(isZh,"search_repo"));
//$('#child_total').text(total);
$('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_repo")).replace('{total}',total));
$('#find_title').html(getLabel(isZh, "find_title").replace('{keyword}', keyword).replace('{tablename}', getLabel(isZh, "search_repo")).replace('{total}', total));

var sortHtml = "";
sortHtml +="<a class=\"" + getActiveItem(10) + "item\" href=\"javascript:searchItem(1,10);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(11) + "item\" href=\"javascript:searchItem(1,11);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_lasted") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(12) + "item\" href=\"javascript:searchItem(1,12);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_watched") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(13) + "item\" href=\"javascript:searchItem(1,13);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_star") + "</a>";
sortHtml +="<a class=\"" + getActiveItem(14) + "item\" href=\"javascript:searchItem(1,14);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_fork") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(10) + "item\" href=\"javascript:searchItem(1,10);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_matched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(11) + "item\" href=\"javascript:searchItem(1,11);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_lasted") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(12) + "item\" href=\"javascript:searchItem(1,12);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_watched") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(13) + "item\" href=\"javascript:searchItem(1,13);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_star") + "</a>";
sortHtml += "<a class=\"" + getActiveItem(14) + "item\" href=\"javascript:searchItem(1,14);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">" + getLabel(isZh, "search_fork") + "</a>";

document.getElementById("sort_type").innerHTML=sortHtml;
document.getElementById("sort_type").innerHTML = sortHtml;

var html = "";
var currentTime = new Date().getTime();
for(var i = 0; i < data.length;i++){
for (var i = 0; i < data.length; i++) {
var recordMap = data[i];
html += "<div class=\"item\">";
if(!isEmpty(recordMap['avatar'])){
html += "<img class=\"ui avatar image\" src=\"" + recordMap['avatar'] + "\">";
if (recordMap['avatar']) {
html += `<img class="ui avatar image" src="${recordMap["avatar"]}">`
} else {
html += `<img class="ui avatar image" avatar="${recordMap["owner_name"]}">`
}

html += " <div class=\"content\">";
html += " <div class=\"ui header\">";
html += " <a class=\"name\" href=\"/" + recordMap["owner_name"] + "/" + recordMap["real_name"] +"\" target=\"_blank\"> <span>" + recordMap["owner_name"] +"</span> <span>/</span> <strong>" + recordMap["alias"] + "</strong></a>";
if(recordMap["is_private"]){
html +=" <span class=\"middle text gold\"><svg class=\"svg octicon-lock\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-lock\" /></svg></span>";
html += " <a class=\"name\" href=\"/" + recordMap["owner_name"] + "/" + recordMap["real_name"] + "\" target=\"_blank\"> <span>" + recordMap["owner_name"] + "</span> <span>/</span> <strong>" + recordMap["alias"] + "</strong></a>";
if (recordMap["is_private"]) {
html += " <span class=\"middle text gold\"><svg class=\"svg octicon-lock\" width=\"16\" height=\"16\" aria-hidden=\"true\"><use xlink:href=\"#octicon-lock\" /></svg></span>";
}
html +=" </div>";
html += " </div>";
html += " <div class=\"description\">";
html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
html += " <div class=\"ui tags\">";
if(!isEmpty(recordMap["topics"]) && recordMap["topics"] !="null"){
for(var j = 0; j < recordMap["topics"].length;j++){
if (!isEmpty(recordMap["topics"]) && recordMap["topics"] != "null") {
for (var j = 0; j < recordMap["topics"].length; j++) {
//function searchLabel(tableName,keyword,sortBy="",ascending=false)
html +=" <a href=\"javascript:searchLabel('repository','" + recordMap["topics"][j] + "','updated_unix.keyword',false);\" ><div class=\"ui small label topic\">"+ recordMap["hightTopics"][j] + "</div></a>";
html += " <a href=\"javascript:searchLabel('repository','" + recordMap["topics"][j] + "','updated_unix.keyword',false);\" ><div class=\"ui small label topic\">" + recordMap["hightTopics"][j] + "</div></a>";
}
}
html +=" </div>";
html +=" <p class=\"time\">";
html +=" <i class=\"icon fa-eye outline\"></i>&nbsp;" + recordMap["num_watches"] + "&nbsp;&nbsp;<i class=\"icon star outline\"></i>&nbsp;" + recordMap["num_stars"] + "&nbsp;&nbsp;<i class=\"icon code branch\"></i>&nbsp;" + recordMap["num_forks"] +"&nbsp;&nbsp;";
html +="&nbsp;&nbsp;&nbsp;&nbsp;"+ getLabel(isZh,"search_lasted_update") + " " + recordMap["updated_html"];
if(!isEmpty(recordMap["lang"])){
html += " </div>";
html += " <p class=\"time\">";
html += " <i class=\"icon fa-eye outline\"></i>&nbsp;" + recordMap["num_watches"] + "&nbsp;&nbsp;<i class=\"icon star outline\"></i>&nbsp;" + recordMap["num_stars"] + "&nbsp;&nbsp;<i class=\"icon code branch\"></i>&nbsp;" + recordMap["num_forks"] + "&nbsp;&nbsp;";
html += "&nbsp;&nbsp;&nbsp;&nbsp;" + getLabel(isZh, "search_lasted_update") + " " + recordMap["updated_html"];
if (!isEmpty(recordMap["lang"])) {
var lang = recordMap["lang"]
var tmpLang = recordMap["lang"].split(",");
if(tmpLang.length>0){
if (tmpLang.length > 0) {
lang = tmpLang[0]
}
var backColor = "#3572A5";
if(LanguagesColor[lang] != null){
if (LanguagesColor[lang] != null) {
backColor = LanguagesColor[lang];
}
html +=" <span class=\"text grey am-ml-10\"><i class=\"color-icon\" style=\"background-color: "+ backColor + "\"></i>&nbsp;" + lang + "</span>";
html += " <span class=\"text grey am-ml-10\"><i class=\"color-icon\" style=\"background-color: " + backColor + "\"></i>&nbsp;" + lang + "</span>";
}
html +=" </p>";
html +=" </div>";
html +=" </div>";
html +="</div>";
html += " </p>";
html += " </div>";
html += " </div>";
html += "</div>";
}

document.getElementById("child_search_item").innerHTML=html;
document.getElementById("child_search_item").innerHTML = html;
LetterAvatar.transform()
}
}

function getTime(UpdatedUnix,currentTime){
function getTime(UpdatedUnix, currentTime) {
UpdatedUnix = UpdatedUnix;
currentTime = currentTime / 1000;
var timeEscSecond = currentTime - UpdatedUnix;
if( timeEscSecond < 0){
if (timeEscSecond < 0) {
timeEscSecond = 1;
}
console.log("currentTime=" + currentTime + " updateUnix=" + UpdatedUnix);

var hours= Math.floor(timeEscSecond / 3600);
var hours = Math.floor(timeEscSecond / 3600);
//计算相差分钟数
var leave2 = Math.floor(timeEscSecond % (3600)); //计算小时数后剩余的秒数
var minutes= Math.floor(leave2 / 60);//计算相差分钟数
var minutes = Math.floor(leave2 / 60);//计算相差分钟数

var leave3=Math.floor(leave2 % 60); //计算分钟数后剩余的秒数
var seconds= leave3;
var leave3 = Math.floor(leave2 % 60); //计算分钟数后剩余的秒数
var seconds = leave3;

if(hours == 0 && minutes == 0){
return seconds + getRepoOrOrg(6,isZh);
}else{
if(hours > 0){
if(hours >= 24){
var days = Math.ceil(hours/24)
if (days >= 30 && days <365){
return Math.ceil(days/30) + getRepoOrOrg(8,isZh);
}else if(days >= 365){
return Math.ceil(days/365) + getRepoOrOrg(9,isZh);
if (hours == 0 && minutes == 0) {
return seconds + getRepoOrOrg(6, isZh);
} else {
if (hours > 0) {
if (hours >= 24) {
var days = Math.ceil(hours / 24)
if (days >= 30 && days < 365) {
return Math.ceil(days / 30) + getRepoOrOrg(8, isZh);
} else if (days >= 365) {
return Math.ceil(days / 365) + getRepoOrOrg(9, isZh);
}
return Math.ceil(hours/24) + getRepoOrOrg(7,isZh);
}else{
return hours + getRepoOrOrg(4,isZh);
return Math.ceil(hours / 24) + getRepoOrOrg(7, isZh);
} else {
return hours + getRepoOrOrg(4, isZh);
}
}else{
return minutes + getRepoOrOrg(5,isZh);
} else {
return minutes + getRepoOrOrg(5, isZh);
}
}
}

function getRepoOrOrg(key,isZhLang){
if(isZhLang){
function getRepoOrOrg(key, isZhLang) {
if (isZhLang) {
return repoAndOrgZH[key];
}else{
} else {
return repoAndOrgEN[key];
}
}

var repoAndOrgZH={
"1":"项目",
"2":"成员",
"3":"团队",
"4":"小时前",
"5":"分钟前",
"6":"秒前",
"7":"天前",
"8":"个月前",
"9":"年前"
var repoAndOrgZH = {
"1": "项目",
"2": "成员",
"3": "团队",
"4": "小时前",
"5": "分钟前",
"6": "秒前",
"7": "天前",
"8": "个月前",
"9": "年前"
};

var repoAndOrgEN={
"1":"repository",
"2":"Members ",
"3":"Teams",
"4":" hours ago",
"5":" minutes ago",
"6":" seconds ago",
"7":" day ago",
"8":" month ago",
"9":" year ago"
var repoAndOrgEN = {
"1": "repository",
"2": "Members ",
"3": "Teams",
"4": " hours ago",
"5": " minutes ago",
"6": " seconds ago",
"7": " day ago",
"8": " month ago",
"9": " year ago"
};




function page(current){
function page(current) {

currentPage=current;
currentPage = current;

doSearch(currentSearchTableName,currentSearchKeyword,current,pageSize,false,currentSearchSortBy,OnlySearchLabel);
}
function nextPage(){
currentPage = currentPage+1;
console.log("currentPage=" + currentPage);
doSearch(currentSearchTableName, currentSearchKeyword, current, pageSize, false, currentSearchSortBy, OnlySearchLabel);
}

function nextPage() {
currentPage = currentPage + 1;
page(currentPage);
}
}

function prePage(){
console.log("currentPage=" + currentPage);
if(currentPage > 1){
currentPage = currentPage-1;
console.log("currentPage=" + (currentPage));
function prePage() {
if (currentPage > 1) {
currentPage = currentPage - 1;
page(currentPage);
}
}
}

function getXPosition(e){
var x=e.offsetLeft;
while(e=e.offsetParent)
{
x+=e.offsetLeft;
function getXPosition(e) {
var x = e.offsetLeft;
while (e = e.offsetParent) {
x += e.offsetLeft;
}
return x+20;//-260防止屏幕超出
return x + 20;//-260防止屏幕超出
}
//获取y坐标
function getYPosition(e){
var y=e.offsetTop;
while(e=e.offsetParent)
{
y+=e.offsetTop;
function getYPosition(e) {
var y = e.offsetTop;
while (e = e.offsetParent) {
y += e.offsetTop;
}
return y+20;//80为input高度
return y + 20;//80为input高度
}


function goPage(event){
function goPage(event) {

var inputpage = document.getElementById("inputpage_div")
var left = getXPosition(event.target);
var top = getYPosition(event.target);
var goNum = $('#inputpage').val();
if (goNum<=0){
showTip(getLabel(isZh,"search_input_large_0"),"warning",left+5,top);
if (goNum <= 0) {
showTip(getLabel(isZh, "search_input_large_0"), "warning", left + 5, top);
}
else if(goNum<=totalPage){
page(parseInt(goNum,10));
}
else{
showTip(getLabel(isZh,"search_input_maxed"),"warning",left+5,top);
else if (goNum <= totalPage) {
page(parseInt(goNum, 10));
}
else {
showTip(getLabel(isZh, "search_input_maxed"), "warning", left + 5, top);
}
}

function showTip(tip, type,left,top) {
function showTip(tip, type, left, top) {
var $tip = $('#tipmsg');
var tipmsg = document.getElementById("tipmsg")
var style="z-index:10024;top:" + top + "px;left:" + left + "px;position:absolute;width:200px;height:60px;vertical-align:middle;";
console.log(style);
var style = "z-index:10024;top:" + top + "px;left:" + left + "px;position:absolute;width:200px;height:60px;vertical-align:middle;";
tipmsg.style = style;
var html ="<p>" + tip + "</p>"
var html = "<p>" + tip + "</p>"
$tip.stop(true).prop('class', 'alert alert-' + type).html(html).fadeIn(500).delay(2000).fadeOut(500);
}
}

function setPage(currentPage){
console.log("totalPage=" + totalPage);
var html ="";
console.log("currentPage=" + currentPage);
console.log("privateTotal=" + privateTotal);
startIndex = currentPage -1;
if(startIndex < 1){
function setPage(currentPage) {
var html = "";
startIndex = currentPage - 1;
if (startIndex < 1) {
startIndex = 1;
}
endIndex = currentPage + 2;
if(endIndex >= totalPage){
if (endIndex >= totalPage) {
endIndex = totalPage;
}
html += "<span class=\"item\">" + getLabel(isZh,"search_input_total") + " " + totalNum + " " + getLabel(isZh,"search_srtip") + "</span>"
if(currentPage > 1){
html += "<a class=\"item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">" + getLabel(isZh,"search_home_page") + "</span></a>";
html += "<span class=\"item\">" + getLabel(isZh, "search_input_total") + " " + totalNum + " " + getLabel(isZh, "search_srtip") + "</span>"
if (currentPage > 1) {
html += "<a class=\"item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">" + getLabel(isZh, "search_home_page") + "</span></a>";
html += "<a class=\"item navigation\" href=\"javascript:prePage()\"><i class=\"left arrow icon\"></i></a>";
}else{
html += "<a class=\"disabled item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">" + getLabel(isZh,"search_home_page") + "</span></a>";
} else {
html += "<a class=\"disabled item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">" + getLabel(isZh, "search_home_page") + "</span></a>";
html += "<a class=\"disabled item navigation\" href=\"javascript:prePage()\"><i class=\"left arrow icon\"></i></a>";
}

for(var i=startIndex; i <= endIndex; i++){
for (var i = startIndex; i <= endIndex; i++) {
var page_i = i;
if(page_i > totalPage){
if (page_i > totalPage) {
break;
}
if( page_i == currentPage){
html += "<a id=\"page_" + page_i+ "\" class=\"active item\" href=\"javascript:page(" + page_i +")\">" + page_i + "</a>";
}else{
html += "<a id=\"page_" + page_i+ "\" class=\"item\" href=\"javascript:page(" + page_i +")\">" + page_i + "</a>";
if (page_i == currentPage) {
html += "<a id=\"page_" + page_i + "\" class=\"active item\" href=\"javascript:page(" + page_i + ")\">" + page_i + "</a>";
} else {
html += "<a id=\"page_" + page_i + "\" class=\"item\" href=\"javascript:page(" + page_i + ")\">" + page_i + "</a>";
}
}

if (endIndex < totalPage-1){
if (endIndex < totalPage - 1) {
html += "...";
html += "<a id=\"page_" + totalPage+ "\" class=\"item\" href=\"javascript:page(" + totalPage +")\">" + totalPage + "</a>";
html += "<a id=\"page_" + totalPage + "\" class=\"item\" href=\"javascript:page(" + totalPage + ")\">" + totalPage + "</a>";
}

if(currentPage >=totalPage){
if (currentPage >= totalPage) {
html += "<a class=\"disabled item navigation\" href=\"javascript:nextPage()\"><i class=\"icon right arrow\"></i></a>";
html += "<a class=\"disabled item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">" + getLabel(isZh,"search_last_page") + "</span></a>";
}else{
html += "<a class=\"disabled item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">" + getLabel(isZh, "search_last_page") + "</span></a>";
} else {
html += "<a class=\"item navigation\" href=\"javascript:nextPage()\"><i class=\"icon right arrow\"></i></a>";
html += "<a class=\"item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">" + getLabel(isZh,"search_last_page") + "</span></a>";
html += "<a class=\"item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">" + getLabel(isZh, "search_last_page") + "</span></a>";
}

html +="<div class=\"item\"> " + getLabel(isZh,"search_go_to") + "<div id=\"inputpage_div\" class=\"ui input\"><input id=\"inputpage\" type=\"text\"></div>" + getLabel(isZh,"search_go_page") + "</div>";
console.log("html=" + html)
document.getElementById("page_menu").innerHTML=html;
$('#inputpage').on('keypress',function(event){
if(event.keyCode == 13){
html += "<div class=\"item\"> " + getLabel(isZh, "search_go_to") + "<div id=\"inputpage_div\" class=\"ui input\"><input id=\"inputpage\" type=\"text\"></div>" + getLabel(isZh, "search_go_page") + "</div>";
document.getElementById("page_menu").innerHTML = html;
$('#inputpage').on('keypress', function (event) {
if (event.keyCode == 13) {
goPage(event);
}
});
}
}

$('#keyword_input').on('keypress',function(event){
if(event.keyCode == 13){
$('#keyword_input').on('keypress', function (event) {
if (event.keyCode == 13) {
search();
}
});
@@ -1207,106 +1234,102 @@ var LanguagesColor = {
"xBase": "#403a40",
}

function getLabel(isZh,key){
if(isZh){
function getLabel(isZh, key) {
if (isZh) {
return zhCN[key]
}else{
} else {
return esUN[key]
}
}

var zhCN={
"search":"搜索",
"search_repo":"项目",
"search_dataset":"数据集",
"search_issue":"任务",
"search_pr":"合并请求",
"search_user":"用户",
"search_org":"组织",
"search_finded":"找到",
"search_matched":"最佳匹配",
"search_matched_download":"下载次数",
"search_lasted_update":"最后更新于",
"search_letter_asc":"字母顺序排序",
"search_letter_desc":"字母逆序排序",
"search_lasted_create":"最近创建",
"search_early_create":"最早创建",
"search_add_by":"加入于",
"search_lasted":"最近更新",
"search_open":"开启中",
"search_closed":"已关闭",
"search_watched":"关注数",
"search_star":"点赞数",
"search_fork":"Fork数",
"search_input_large_0":"请输入大于0的数值。",
"search_input_maxed":"不能超出总页数。",
"search_input_total":"共",
"search_srtip":"条",
"search_home_page":"首页",
"search_last_page":"末页",
"search_go_to":"前往",
"search_go_page":"页",
"find_title":"“<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>”相关{tablename}约为{total}个",
"search_empty":"<strong>请输入任意关键字开始搜索。</strong>"
}
var esUN={
"search":"Search",
"search_repo":"Repository",
"search_dataset":"DataSet",
"search_issue":"Issue",
"search_pr":"Pull Request",
"search_user":"User",
"search_org":"Organization",
"search_finded":"Find",
"search_matched":"Best Match",
"search_matched_download":"Most downloads",
"search_lasted_update":"Updated ",
"search_letter_asc":"Alphabetically",
"search_letter_desc":"Reverse alphabetically",
"search_lasted_create":"Recently created",
"search_early_create":"First created",
"search_add_by":"Joined on",
"search_lasted":"Recently updated",
"search_open":"Open",
"search_closed":"Closed",
"search_watched":"Watches",
"search_star":"Stars",
"search_fork":"Forks",
"search_input_large_0":"Please enter a value greater than 0.",
"search_input_maxed":"Cannot exceed total pages.",
"search_input_total":"Total",
"search_srtip":"",
"search_home_page":"First",
"search_last_page":"Last",
"search_go_to":"Go",
"search_go_page":"Page",
"find_title":" {total} \"<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>\" related {tablename}",
"search_empty":"<strong>Please enter any keyword to start the search.</strong>"
}
initDiv(false);
document.onreadystatechange = function() {
var zhCN = {
"search": "搜索",
"search_repo": "项目",
"search_dataset": "数据集",
"search_issue": "任务",
"search_pr": "合并请求",
"search_user": "用户",
"search_org": "组织",
"search_finded": "找到",
"search_matched": "最佳匹配",
"search_matched_download": "下载次数",
"search_lasted_update": "最后更新于",
"search_letter_asc": "字母顺序排序",
"search_letter_desc": "字母逆序排序",
"search_lasted_create": "最近创建",
"search_early_create": "最早创建",
"search_add_by": "加入于",
"search_lasted": "最近更新",
"search_open": "开启中",
"search_closed": "已关闭",
"search_watched": "关注数",
"search_star": "点赞数",
"search_fork": "Fork数",
"search_input_large_0": "请输入大于0的数值。",
"search_input_maxed": "不能超出总页数。",
"search_input_total": "共",
"search_srtip": "条",
"search_home_page": "首页",
"search_last_page": "末页",
"search_go_to": "前往",
"search_go_page": "页",
"find_title": "“<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>”相关{tablename}约为{total}个",
"search_empty": "<strong>请输入任意关键字开始搜索。</strong>"
}
var esUN = {
"search": "Search",
"search_repo": "Repository",
"search_dataset": "DataSet",
"search_issue": "Issue",
"search_pr": "Pull Request",
"search_user": "User",
"search_org": "Organization",
"search_finded": "Find",
"search_matched": "Best Match",
"search_matched_download": "Most downloads",
"search_lasted_update": "Updated ",
"search_letter_asc": "Alphabetically",
"search_letter_desc": "Reverse alphabetically",
"search_lasted_create": "Recently created",
"search_early_create": "First created",
"search_add_by": "Joined on",
"search_lasted": "Recently updated",
"search_open": "Open",
"search_closed": "Closed",
"search_watched": "Watches",
"search_star": "Stars",
"search_fork": "Forks",
"search_input_large_0": "Please enter a value greater than 0.",
"search_input_maxed": "Cannot exceed total pages.",
"search_input_total": "Total",
"search_srtip": "",
"search_home_page": "First",
"search_last_page": "Last",
"search_go_to": "Go",
"search_go_page": "Page",
"find_title": " {total} \"<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>\" related {tablename}",
"search_empty": "<strong>Please enter any keyword to start the search.</strong>"
}
initDiv(false);
document.onreadystatechange = function () {
if (document.readyState === "complete") {
var tmpSearchLabel = sessionStorage.getItem("searchLabel");
console.log("tmpSearchLabel=" + tmpSearchLabel);
if(tmpSearchLabel){
console.log("search label....");
if (tmpSearchLabel) {
sessionStorage.removeItem("searchLabel");
doSearchLabel(sessionStorage.getItem("tableName"),sessionStorage.getItem("keyword"),sessionStorage.getItem("sortBy"),sessionStorage.getItem("ascending"));
}else{
doSearchLabel(sessionStorage.getItem("tableName"), sessionStorage.getItem("keyword"), sessionStorage.getItem("sortBy"), sessionStorage.getItem("ascending"));
} else {
var specifySearch = sessionStorage.getItem("specifySearch");
if(specifySearch){
if (specifySearch) {
sessionStorage.removeItem("specifySearch");
console.log("search sepcial keyword=...." + sessionStorage.getItem("keyword"));
document.getElementById("keyword_input").value = sessionStorage.getItem("keyword");
doSpcifySearch(sessionStorage.getItem("tableName"),sessionStorage.getItem("keyword"),sessionStorage.getItem("sortBy"),sessionStorage.getItem("ascending"));
}else{
console.log("normal search....");
doSpcifySearch(sessionStorage.getItem("tableName"), sessionStorage.getItem("keyword"), sessionStorage.getItem("sortBy"), sessionStorage.getItem("ascending"));
} else {
search();
}

}
}
}
}



+ 1
- 1
routers/search.go View File

@@ -489,7 +489,7 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool,
if recordSource["avatar"] != nil {
avatarstr := recordSource["avatar"].(string)
if len(avatarstr) == 0 {
record["avatar"] = setting.RepositoryAvatarFallbackImage
// record["avatar"] = setting.RepositoryAvatarFallbackImage
} else {
record["avatar"] = setting.AppSubURL + "/repo-avatars/" + avatarstr
}


+ 54
- 25
templates/explore/repo_list.tmpl View File

@@ -1,23 +1,28 @@
<style>
.ui.repository.list>.item{
.ui.repository.list>.item {
position: relative;
border: 1px solid #E1E3E6;
border-radius: 0.8rem;
margin-bottom: 1.0rem;
padding: 1.0rem !important;
}

.ui.repository.list>.item .header {
font-size: 1.4rem !important;
font-weight: 200;
}
.ui.list>.item>.content{

.ui.list>.item>.content {
margin-left: 36px;
}
.ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content{
width:calc(100% - 30px);

.ui.list .list>.item>img.image+.content,
.ui.list>.item>img.image+.content {
width: calc(100% - 30px);
margin-left: 0;
}
.ui.repository.list>.item::before{

.ui.repository.list>.item::before {
position: absolute;
left: 0;
right: 0;
@@ -26,13 +31,16 @@
background-color: #E1E3E6;
bottom: 2.8rem;
}
.repository .ui.mini.menu{

.repository .ui.mini.menu {
font-size: .6rem;
}
.repository .ui.right.compact .item{

.repository .ui.right.compact .item {
padding-top: 0;
padding-bottom: 0;
}

.ui.repository.list .item .time {
margin-top: 1.5rem;
}
@@ -40,20 +48,23 @@

<div class="ui secondary pointing tabular top attached borderless menu navbar">
{{if .PageIsExplore}}
<a class="{{if eq .SortType "hot"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=hot&tab={{$.TabName}}">
<a class="{{if eq .SortType "hot"}}active{{end}} item"
href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=hot&tab={{$.TabName}}">
<svg class="svg octicon-repo" width="16" height="16" aria-hidden="true">
<use xlink:href="#octicon-repo" />
</svg>
{{.i18n.Tr "explore.hot_repo"}}
</a>
<a class="{{if eq .SortType "active"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=active&tab={{$.TabName}}">
<a class="{{if eq .SortType "active"}}active{{end}} item"
href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=active&tab={{$.TabName}}">
<svg class="svg octicon-inbox" width="16" height="16" aria-hidden="true">
<use xlink:href="#octicon-inbox" />
</svg>
{{.i18n.Tr "explore.active_repo"}}
</a>
{{end}}
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=recentupdate&tab={{$.TabName}}">
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item"
href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=recentupdate&tab={{$.TabName}}">
<svg class="svg octicon-organization" width="16" height="16" aria-hidden="true">
<use xlink:href="#octicon-organization" />
</svg> {{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}
@@ -67,16 +78,26 @@
<i class="dropdown icon"></i>
</span>
<div class="menu">
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
<a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
<a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
<a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
<a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
<a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a>
<a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
<a class="{{if eq .SortType "newest"}}active{{end}} item"
href="{{$.Link}}?sort=newest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
<a class="{{if eq .SortType "oldest"}}active{{end}} item"
href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
<a class="{{if eq .SortType "alphabetically"}}active{{end}} item"
href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
<a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item"
href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item"
href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item"
href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
<a class="{{if eq .SortType "moststars"}}active{{end}} item"
href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
<a class="{{if eq .SortType "feweststars"}}active{{end}} item"
href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
<a class="{{if eq .SortType "mostforks"}}active{{end}} item"
href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a>
<a class="{{if eq .SortType "fewestforks"}}active{{end}} item"
href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
</div>
</div>
</div>
@@ -87,13 +108,16 @@
<div class="item">
{{if .RelAvatarLink}}
<img class="ui avatar image" src="{{.RelAvatarLink}}">
{{else}}
<img class="ui avatar image" avatar="{{.Owner.Name}}">
{{end}}
<div class="content">
<div class="ui header">
<div class="ui grid">
<div class="ui sixteen wide mobile ten wide tablet twelve wide computer column">
<a class="name" href="{{.Link}}">
{{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} <span>/</span> {{end}}{{end}}<strong>{{.DisplayName}}</strong>
{{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}}
<span>/</span> {{end}}{{end}}<strong>{{.DisplayName}}</strong>
{{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
</a>
{{if .IsPrivate}}
@@ -113,14 +137,16 @@
{{if eq $.SortType "hot"}}
<a class="item">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z" />
<path fill="currentColor"
d="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z" />
</svg>
{{.Hot}}
</a>
{{else if eq $.SortType "active"}}
<a class="item">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z" />
<path fill="currentColor"
d="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z" />
</svg> {{.Active}}
</a>
{{else}}
@@ -143,14 +169,17 @@
{{if .Topics }}
<div class="ui tags">
{{range .Topics}}
{{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}"><div class="ui small label topic">{{.}}</div></a>{{end}}
{{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}">
<div class="ui small label topic">{{.}}</div>
</a>{{end}}
{{end}}
</div>
{{end}}
<p class="time">
{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
{{if .PrimaryLanguage }}
<span class="text grey"><i class="color-icon" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
<span class="text grey"><i class="color-icon"
style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
{{end}}
</p>
</div>


Loading…
Cancel
Save