You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

search.js 51 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. var token;
  2. if(isEmpty(token)){
  3. var meta = $("meta[name=_uid]");
  4. if(!isEmpty(meta)){
  5. token = meta.attr("content");
  6. console.log("token is uid:" + token);
  7. }
  8. }
  9. var html =document.documentElement;
  10. var lang = html.attributes["lang"]
  11. var isZh = true;
  12. if(lang != null && lang.nodeValue =="en-US" ){
  13. console.log("the language is " + lang.nodeValue);
  14. isZh=false;
  15. }else{
  16. console.log("default lang=zh");
  17. }
  18. function isEmpty(str){
  19. if(typeof str == "undefined" || str == null || str == ""){
  20. return true;
  21. }
  22. return false;
  23. }
  24. var itemType={
  25. "1":"repository",
  26. "2":"issue",
  27. "3":"user",
  28. "4":"org",
  29. "5":"dataset",
  30. "6":"pr"
  31. };
  32. var sortBy={
  33. "10":"default",
  34. "11":"updated_unix.keyword",
  35. "12":"num_watches",
  36. "13":"num_stars",
  37. "14":"num_forks",
  38. "20":"default",
  39. "21":"updated_unix.keyword",
  40. "30":"default",
  41. "31":"name.keyword",
  42. "32":"name.keyword",
  43. "33":"created_unix.keyword",
  44. "34":"created_unix.keyword",
  45. "40":"default",
  46. "41":"name.keyword",
  47. "42":"name.keyword",
  48. "43":"created_unix.keyword",
  49. "44":"created_unix.keyword",
  50. "50":"default",
  51. "51":"download_times.keyword",
  52. "60":"default",
  53. "61":"updated_unix.keyword"
  54. };
  55. var sortAscending={
  56. "10":"false",
  57. "11":"false",
  58. "12":"false",
  59. "13":"false",
  60. "14":"false",
  61. "20":"false",
  62. "21":"false",
  63. "30":"false",
  64. "31":"true",
  65. "32":"false",
  66. "33":"false",
  67. "34":"true",
  68. "40":"false",
  69. "41":"true",
  70. "42":"false",
  71. "43":"false",
  72. "44":"true",
  73. "50":"false",
  74. "51":"false",
  75. "60":"false",
  76. "61":"false"
  77. };
  78. var currentPage = 1;
  79. var pageSize = 15;
  80. var currentSearchTableName ="repository";
  81. var currentSearchKeyword="";
  82. var currentSearchSortBy="";
  83. var currentSearchAscending="false";
  84. var OnlySearchLabel=false;
  85. var startIndex =1;
  86. var endIndex = 5;
  87. var totalPage = 1;
  88. var totalNum = 0;
  89. var privateTotal = 0;
  90. function initPageInfo(){
  91. currentPage = 1;
  92. startIndex =1;
  93. endIndex = 5;
  94. }
  95. function searchItem(type,sortType){
  96. console.log("enter item 2.");
  97. currentSearchKeyword = document.getElementById("keyword_input").value;
  98. if(!isEmpty(currentSearchKeyword)){
  99. initPageInfo();
  100. currentSearchTableName = itemType[type];
  101. currentSearchSortBy = sortBy[sortType];
  102. currentSearchAscending = sortAscending[sortType];
  103. OnlySearchLabel =false;
  104. page(currentPage);
  105. }
  106. }
  107. function search(){
  108. console.log("enter here 1.");
  109. currentSearchKeyword = document.getElementById("keyword_input").value;
  110. if(!isEmpty(currentSearchKeyword)){
  111. currentSearchKeyword = currentSearchKeyword.trim();
  112. }
  113. $('#searchForm').addClass("hiddenSearch");
  114. initPageInfo();
  115. if(!isEmpty(currentSearchKeyword)){
  116. document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded");
  117. currentSearchSortBy = sortBy[10];
  118. currentSearchAscending = "false";
  119. OnlySearchLabel =false;
  120. page(currentPage);
  121. if(currentSearchTableName != "repository"){
  122. doSearch("repository",currentSearchKeyword,1,pageSize,true,"",false);
  123. }
  124. if(currentSearchTableName != "issue"){
  125. doSearch("issue",currentSearchKeyword,1,pageSize,true,"",false);
  126. }
  127. if(currentSearchTableName != "user"){
  128. doSearch("user",currentSearchKeyword,1,pageSize,true,"",false);
  129. }
  130. if(currentSearchTableName != "org"){
  131. doSearch("org",currentSearchKeyword,1,pageSize,true,"",false);
  132. }
  133. if(currentSearchTableName != "dataset"){
  134. doSearch("dataset",currentSearchKeyword,1,pageSize,true,"",false);
  135. }
  136. if(currentSearchTableName != "pr"){
  137. doSearch("pr",currentSearchKeyword,1,pageSize,true,"",false);
  138. }
  139. }else{
  140. initDiv(false);
  141. document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty");
  142. $('#find_title').html("");
  143. document.getElementById("sort_type").innerHTML="";
  144. document.getElementById("child_search_item").innerHTML="";
  145. document.getElementById("page_menu").innerHTML="";
  146. $('#repo_total').text("");
  147. $('#pr_total').text("");
  148. $('#issue_total').text("");
  149. $('#dataset_total').text("");
  150. $('#user_total').text("");
  151. $('#org_total').text("");
  152. setActivate(null);
  153. }
  154. }
  155. function initDiv(isSearchLabel=false){
  156. if(isSearchLabel){
  157. document.getElementById("search_div").style.display="none";
  158. document.getElementById("search_label_div").style.display="block";
  159. document.getElementById("dataset_item").style.display="none";
  160. document.getElementById("issue_item").style.display="none";
  161. document.getElementById("pr_item").style.display="none";
  162. document.getElementById("user_item").style.display="none";
  163. document.getElementById("org_item").style.display="none";
  164. document.getElementById("find_id").innerHTML="";
  165. }else{
  166. document.getElementById("search_div").style.display="block";
  167. document.getElementById("search_label_div").style.display="none";
  168. document.getElementById("dataset_item").style.display="block";
  169. document.getElementById("issue_item").style.display="block";
  170. document.getElementById("pr_item").style.display="block";
  171. document.getElementById("user_item").style.display="block";
  172. document.getElementById("org_item").style.display="block";
  173. document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded");
  174. }
  175. }
  176. function searchLabel(tableName,keyword,sortBy="",ascending="false"){
  177. console.log("enter label search.");
  178. initDiv(true);
  179. //document.getElementById("search_div").style.display="none";
  180. //document.getElementById("search_label_div").style.display="block";
  181. document.getElementById("search_label_div").innerHTML="<p class=\"searchlabel\">#" + keyword + "</p>";
  182. currentSearchKeyword = keyword;
  183. initPageInfo();
  184. currentSearchTableName = tableName;
  185. currentSearchSortBy = sortBy;
  186. currentSearchAscending = ascending;
  187. OnlySearchLabel =true;
  188. page(currentPage);
  189. }
  190. function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){
  191. var language = "zh-CN";
  192. if(!isZh){
  193. language="en-US";
  194. }
  195. $.ajax({
  196. type:"GET",
  197. url:"/all/dosearch/",
  198. headers: {
  199. authorization:token,
  200. },
  201. dataType:"json",
  202. data:{
  203. 'TableName': tableName,
  204. 'Key': keyword,
  205. 'Page': page,
  206. 'PageSize': pageSize,
  207. 'OnlyReturnNum':onlyReturnNum,
  208. 'SortBy':sortBy,
  209. 'OnlySearchLabel':OnlySearchLabel,
  210. 'Ascending':currentSearchAscending,
  211. 'WebTotal':totalNum,
  212. 'PrivateTotal':privateTotal,
  213. 'language':language
  214. },
  215. async:true,
  216. success:function(json){
  217. console.log("tableName=" + tableName);
  218. console.log(json);
  219. displayResult(tableName,page,json,onlyReturnNum,keyword);
  220. },
  221. error:function(response) {
  222. console.log(response);
  223. }
  224. });
  225. }
  226. function displayResult(tableName,page,jsonResult,onlyReturnNum,keyword){
  227. if(tableName == "repository") {
  228. displayRepoResult(page,jsonResult,onlyReturnNum,keyword);
  229. } else if (tableName == "issue") {
  230. displayIssueResult(page,jsonResult,onlyReturnNum,keyword);
  231. } else if (tableName == "user") {
  232. displayUserResult(page,jsonResult,onlyReturnNum,keyword);
  233. } else if (tableName == "org") {
  234. displayOrgResult(page,jsonResult,onlyReturnNum,keyword);
  235. } else if (tableName == "dataset") {
  236. displayDataSetResult(page,jsonResult,onlyReturnNum,keyword);
  237. } else if (tableName == "pr") {
  238. displayPrResult(page,jsonResult,onlyReturnNum,keyword);
  239. }
  240. if(!onlyReturnNum){
  241. console.log("set total num." + tableName);
  242. totalPage =Math.ceil(jsonResult.Total/pageSize);
  243. totalNum = jsonResult.Total;
  244. privateTotal = jsonResult.PrivateTotal;
  245. setPage(page);
  246. }
  247. }
  248. function displayPrResult(page,jsonResult,onlyReturnNum,keyword){
  249. var data = jsonResult.Result;
  250. var total = jsonResult.Total;
  251. $('#pr_total').text(total);
  252. if(!onlyReturnNum){
  253. setActivate("pr_item");
  254. //$('#keyword_desc').text(keyword);
  255. //$('#obj_desc').text(getLabel(isZh,"search_pr"));
  256. //$('#child_total').text(total);
  257. $('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_pr")).replace('{total}',total));
  258. setIssueOrPrInnerHtml(data,"pulls");
  259. }
  260. }
  261. var categoryDesc={
  262. "computer_vision":"计算机视觉",
  263. "natural_language_processing":"自然语言处理",
  264. "speech_processing":"语音处理",
  265. "computer_vision_natural_language_processing":"计算机视觉、自然语言处理"
  266. };
  267. var categoryENDesc={
  268. "computer_vision":"computer vision",
  269. "natural_language_processing":"natural language processing",
  270. "speech_processing":"speech processing",
  271. "computer_vision_natural_language_processing":"computer vision and natural language processing"
  272. };
  273. var taskDesc={
  274. "machine_translation":"机器翻译",
  275. "question_answering_system":"问答系统",
  276. "information_retrieval":"信息检索",
  277. "knowledge_graph":"知识图谱",
  278. "text_annotation":"文本标注",
  279. "text_categorization":"文本分类",
  280. "emotion_analysis":"情感分析",
  281. "language_modeling":"语言建模",
  282. "speech_recognition":"语音识别",
  283. "automatic_digest":"自动文摘",
  284. "information_extraction":"信息抽取",
  285. "description_generation":"说明生成",
  286. "image_classification":"图像分类",
  287. "face_recognition":"人脸识别",
  288. "image_search":"图像搜索",
  289. "target_detection":"目标检测",
  290. "image_description_generation":"图像描述生成",
  291. "vehicle_license_plate_recognition":"车辆车牌识别",
  292. "medical_image_analysis":"医学图像分析",
  293. "unmanned":"无人驾驶",
  294. "unmanned_security":"无人安防",
  295. "drone":"无人机",
  296. "vr_ar":"VR/AR",
  297. "2_d_vision":"2-D视觉",
  298. "2_5_d_vision":"2.5-D视觉",
  299. "3_d_reconstruction":"3D重构",
  300. "image_processing":"图像处理",
  301. "video_processing":"视频处理",
  302. "visual_input_system":"视觉输入系统",
  303. "speech_coding":"语音编码",
  304. "speech_enhancement":"语音增强",
  305. "speech_recognition":"语音识别",
  306. "speech_synthesis":"语音合成"
  307. };
  308. var taskENDesc={
  309. "machine_translation":"machine translation",
  310. "question_answering_system":"question answering system",
  311. "information_retrieval":"information retrieval",
  312. "knowledge_graph":"knowledge graph",
  313. "text_annotation":"text annotation",
  314. "text_categorization":"text categorization",
  315. "emotion_analysis":"emotion analysis",
  316. "language_modeling":"language modeling",
  317. "speech_recognition":"speech recognition",
  318. "automatic_digest":"automatic digest",
  319. "information_extraction":"information extraction",
  320. "description_generation":"description generation",
  321. "image_classification":"image classification",
  322. "face_recognition":"face recognition",
  323. "image_search":"image search",
  324. "target_detection":"target detection",
  325. "image_description_generation":"image description generation",
  326. "vehicle_license_plate_recognition":"vehicle license plate recognition",
  327. "medical_image_analysis":"medical image analysis",
  328. "unmanned":"unmanned",
  329. "unmanned_security":"unmanned security",
  330. "drone":"drone",
  331. "vr_ar":"VR/AR",
  332. "2_d_vision":"2.D vision",
  333. "2.5_d_vision":"2.5D vision",
  334. "3_d_reconstruction":"3Dreconstruction",
  335. "image_processing":"image processing",
  336. "video_processing":"video processing",
  337. "visual_input_system":"visual input system",
  338. "speech_coding":"speech coding",
  339. "speech_enhancement":"speech enhancement",
  340. "speech_recognition":"speech recognition",
  341. "speech_synthesis":"speech synthesis"
  342. };
  343. function getCategoryDesc(isZh,key){
  344. var re = key;
  345. if(isZh){
  346. re = categoryDesc[key];
  347. }else{
  348. re = categoryENDesc[key];
  349. }
  350. if(isEmpty(re)){
  351. return key;
  352. }
  353. return re;
  354. }
  355. function getTaskDesc(isZh,key){
  356. var re = key;
  357. if(isZh){
  358. re = taskDesc[key];
  359. }else{
  360. re = taskENDesc[key];
  361. }
  362. if(isEmpty(re)){
  363. return key;
  364. }
  365. return re;
  366. }
  367. function getActiveItem(sort_type){
  368. console.log("currentSearchSortBy=" + currentSearchSortBy + " sort_type=" + sortBy[sort_type]);
  369. if(currentSearchSortBy == sortBy[sort_type] && currentSearchAscending == sortAscending[sort_type]){
  370. return "active ";
  371. }else{
  372. return "";
  373. }
  374. }
  375. function displayDataSetResult(page,jsonResult,onlyReturnNum,keyword){
  376. var data = jsonResult.Result;
  377. var total = jsonResult.Total;
  378. $('#dataset_total').text(total);
  379. if(!onlyReturnNum){
  380. setActivate("dataset_item");
  381. //$('#keyword_desc').text(keyword);
  382. //$('#obj_desc').text(getLabel(isZh,"search_dataset"));
  383. //$('#child_total').text(total);
  384. $('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_dataset")).replace('{total}',total));
  385. var sortHtml = "";
  386. sortHtml +="<a class=\"" + getActiveItem(50) + "item\" href=\"javascript:searchItem(5,50);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
  387. sortHtml +="<a class=\"" + getActiveItem(51) + "item\" href=\"javascript:searchItem(5,51);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched_download") + "</a>";
  388. document.getElementById("sort_type").innerHTML=sortHtml;
  389. var html = "";
  390. var currentTime = new Date().getTime();
  391. for(var i = 0; i < data.length;i++){
  392. var recordMap = data[i];
  393. html += "<div class=\"item\">";
  394. html += " <div class=\"content\">";
  395. html += " <div class=\"ui right metas\">" ;
  396. if(!isEmpty(recordMap["category"])){
  397. 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>";
  398. }
  399. if(!isEmpty(recordMap["task"])){
  400. 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>";
  401. }
  402. html += " <span class=\"text grey\"><i class=\"ri-fire-line\"></i> " +recordMap["download_times"] + "</span> ";
  403. html +=" </div>";
  404. html += " <div class=\"ui header\">";
  405. html += " <a class=\"name\" href=\"/" +recordMap["repoUrl"] +"/datasets\" target=\"_blank\">" + recordMap["title"] + "</a>";
  406. 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>";
  407. html +=" </div>";
  408. html += " <div class=\"description\">";
  409. html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
  410. if(!isEmpty(recordMap["file_name"])){
  411. html += " <p class=\"has-emoji\"> " + recordMap["file_name"] + "</p>";
  412. }
  413. html +=" <p class=\"time\">";
  414. html +=" <span class=\"am-ml-10\"></span> "+ getLabel(isZh,"search_lasted_update") + " " + recordMap["updated_html"];
  415. html +=" </p>";
  416. html +=" </div>";
  417. html +=" </div>";
  418. html +="</div>";
  419. }
  420. document.getElementById("child_search_item").innerHTML=html;
  421. }
  422. }
  423. function displayOrgResult(page,jsonResult,onlyReturnNum,keyword){
  424. var data = jsonResult.Result;
  425. var total = jsonResult.Total;
  426. $('#org_total').text(total);
  427. if(!onlyReturnNum){
  428. setActivate("org_item");
  429. //$('#keyword_desc').text(keyword);
  430. //$('#obj_desc').text(getLabel(isZh,"search_org"));
  431. //$('#child_total').text(total);
  432. $('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_org")).replace('{total}',total));
  433. var sortHtml = "";
  434. sortHtml +="<a class=\"" + getActiveItem(40) + "item\" href=\"javascript:searchItem(4,40);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
  435. sortHtml +="<a class=\"" + getActiveItem(41) + "item\" href=\"javascript:searchItem(4,41);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_letter_asc") + "</a>";
  436. sortHtml +="<a class=\"" + getActiveItem(42) + "item\" href=\"javascript:searchItem(4,42);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_letter_desc") + "</a>";
  437. sortHtml +="<a class=\"" + getActiveItem(43) + "item\" href=\"javascript:searchItem(4,43);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_lasted_create") + "</a>";
  438. sortHtml +="<a class=\"" + getActiveItem(44) + "item\" href=\"javascript:searchItem(4,44);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_early_create") + "</a>";
  439. document.getElementById("sort_type").innerHTML=sortHtml;
  440. var html = "";
  441. var currentTime = new Date().getTime();
  442. for(var i = 0; i < data.length;i++){
  443. var recordMap = data[i];
  444. html += "<div class=\"item members\">";
  445. html += "<img class=\"ui avatar image\" src=\"" + recordMap["avatar"] + "\"></img>";
  446. html += " <div class=\"content\">";
  447. html += " <div class=\"ui header\">";
  448. html += " <a class=\"name\" href=\"/" + recordMap["real_name"] +"\" target=\"_blank\">" + recordMap["name"] + "&nbsp;&nbsp;" + recordMap["full_name"] + "</a>";
  449. html +=" </div>";
  450. html += " <div class=\"description\">";
  451. html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
  452. html +=" <p class=\"has-emoji\">";
  453. if(!isEmpty(recordMap["location"]) && recordMap["location"] != "null"){
  454. html +=" <i class=\"ri-map-pin-2-line\"></i> " + recordMap["location"];
  455. }
  456. html +=" <span class=\"am-ml-10\"></span>";
  457. if(!isEmpty(recordMap["website"]) && recordMap["website"] != "null"){
  458. html +=" <i class=\"ri-links-line\"></i>" + "<a href=\""+ recordMap["website"] + "\" target=\"_blank\">" + recordMap["website"] + "</a>";
  459. }
  460. html +=" <i class=\"ri-time-line am-ml-10\"></i> "+ getLabel(isZh,"search_add_by") + " ";
  461. html += recordMap["add_time"]
  462. html +=" </p>";
  463. html +=" </div>";
  464. html +=" </div>";
  465. html +="</div>";
  466. }
  467. document.getElementById("child_search_item").innerHTML=html;
  468. }
  469. }
  470. var monthDisplay=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec");
  471. function displayUserResult(page,jsonResult,onlyReturnNum,keyword){
  472. var data = jsonResult.Result;
  473. var total = jsonResult.Total;
  474. $('#user_total').text(total);
  475. if(!onlyReturnNum){
  476. setActivate("user_item");
  477. //$('#keyword_desc').text(keyword);
  478. //$('#obj_desc').text(getLabel(isZh,"search_user"));
  479. //$('#child_total').text(total);
  480. $('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_user")).replace('{total}',total));
  481. var sortHtml = "";//equal user sort by
  482. sortHtml +="<a class=\"" + getActiveItem(30) + "item\" href=\"javascript:searchItem(3,30);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
  483. sortHtml +="<a class=\"" + getActiveItem(31) + "item\" href=\"javascript:searchItem(3,31);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_letter_asc") + "</a>";
  484. sortHtml +="<a class=\"" + getActiveItem(32) + "item\" href=\"javascript:searchItem(3,32);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_letter_desc") + "</a>";
  485. sortHtml +="<a class=\"" + getActiveItem(33) + "item\" href=\"javascript:searchItem(3,33);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_lasted_create") + "</a>";
  486. sortHtml +="<a class=\"" + getActiveItem(34) + "item\" href=\"javascript:searchItem(3,34);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_2\">"+ getLabel(isZh,"search_early_create") + "</a>";
  487. document.getElementById("sort_type").innerHTML=sortHtml;
  488. var html = "";
  489. var currentTime = new Date().getTime();
  490. for(var i = 0; i < data.length;i++){
  491. var recordMap = data[i];
  492. html += "<div class=\"item members\">";
  493. html += "<img class=\"ui avatar image\" src=\"" + recordMap["avatar"] + "\"></img>";
  494. html += " <div class=\"content\">";
  495. html += " <div class=\"ui header\">";
  496. html += " <a class=\"name\" href=\"/" + recordMap["real_name"] +"\" target=\"_blank\">" + recordMap["name"] + "&nbsp;&nbsp;" + recordMap["full_name"] + "</a>";
  497. html +=" </div>";
  498. html += " <div class=\"description\">";
  499. html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
  500. html +=" <p class=\"has-emoji\">";
  501. if(!isEmpty(recordMap["email"]) && recordMap["email"] != "null"){
  502. html +=" <i class=\"ri-mail-line\"></i>&nbsp;<a href=\"mailto:" + recordMap["email"] + "\" rel=\"nofollow\">" + recordMap["email"] + "</a>";
  503. }
  504. html +=" <i class=\"ri-time-line am-ml-10\"></i> "+ getLabel(isZh,"search_add_by") + " ";
  505. html += recordMap["add_time"]
  506. html +=" </p>";
  507. html +=" </div>";
  508. html +=" </div>";
  509. html +="</div>";
  510. }
  511. document.getElementById("child_search_item").innerHTML=html;
  512. }
  513. }
  514. function setIssueOrPrInnerHtml(data,path){
  515. var sortHtml = "";
  516. if(path =="issues"){
  517. sortHtml +="<a class=\"" + getActiveItem(20) + "item\" href=\"javascript:searchItem(2,20);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
  518. sortHtml +="<a class=\"" + getActiveItem(21) + "item\" href=\"javascript:searchItem(2,21);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_lasted") + "</a>";
  519. }else{
  520. sortHtml +="<a class=\"" + getActiveItem(60) + "item\" href=\"javascript:searchItem(6,60);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
  521. sortHtml +="<a class=\"" + getActiveItem(61) + "item\" href=\"javascript:searchItem(6,61);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_lasted") + "</a>";
  522. }
  523. document.getElementById("sort_type").innerHTML=sortHtml;
  524. var html = "";
  525. var currentTime = new Date().getTime();
  526. for(var i = 0; i < data.length;i++){
  527. var recordMap = data[i];
  528. html += "<div class=\"item\">";
  529. html += " <div class=\"content\">";
  530. html += " <div class=\"ui header\">";
  531. html += " <a class=\"name\" href=\"/" + recordMap["repoUrl"] +"/" + path + "/" + recordMap["index"] + "\" target=\"_blank\">" + recordMap["name"] + "</a>";
  532. html +=" </div>";
  533. html += " <div class=\"description\">";
  534. html += " <p class=\"has-emoji\"> " + recordMap["content"] + "</p>";
  535. html +=" <p class=\"time\">";
  536. html +=" <i class=\"ri-code-box-line\"></i>";
  537. html +=" <a class=\"am-text grey\" href=\"/" + recordMap["repoUrl"] +"/" + path + "/" + recordMap["index"] + "\" target=\"_blank\"> " + addBlank(recordMap["repoUrl"]) +" #" + recordMap["index"] + "</a>&nbsp;&nbsp;&nbsp;&nbsp;";
  538. html +=" <i class=\"ri-information-line am-ml-10\"></i>&nbsp;";
  539. if(recordMap["is_closed"] != null && (!(recordMap["is_closed"]) || recordMap["is_closed"]=="f")){
  540. html += getLabel(isZh,"search_open");
  541. }else{
  542. html += getLabel(isZh,"search_closed");
  543. }
  544. html +=" &nbsp;&nbsp;&nbsp;&nbsp;<i class=\"ri-message-2-line am-ml-10\"></i>&nbsp;" + recordMap["num_comments"];
  545. html +=" <span class=\"am-ml-10\">&nbsp;&nbsp;</span>&nbsp;&nbsp;"+ getLabel(isZh,"search_lasted_update") + " "+ recordMap["updated_html"];
  546. html +=" </p>";
  547. html +=" </div>";
  548. html +=" </div>";
  549. html +="</div>";
  550. }
  551. document.getElementById("child_search_item").innerHTML=html;
  552. }
  553. function addBlank(url){
  554. if(url == null){
  555. return url;
  556. }
  557. var tmps = url.split("/");
  558. if(tmps.length == 2){
  559. return tmps[0] + " / " + tmps[1];
  560. }
  561. return url;
  562. }
  563. function displayIssueResult(page,jsonResult,onlyReturnNum,keyword){
  564. var data = jsonResult.Result;
  565. var total = jsonResult.Total;
  566. $('#issue_total').text(total);
  567. if(!onlyReturnNum){
  568. setActivate("issue_item");
  569. //$('#keyword_desc').text(keyword);
  570. //$('#obj_desc').text(getLabel(isZh,"search_issue"));
  571. //$('#child_total').text(total);
  572. $('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_issue")).replace('{total}',total));
  573. setIssueOrPrInnerHtml(data,"issues");
  574. }
  575. }
  576. function setActivate(name){
  577. $('#repo_item').removeClass("active");
  578. $('#user_item').removeClass("active");
  579. $('#issue_item').removeClass("active");
  580. $('#dataset_item').removeClass("active");
  581. $('#org_item').removeClass("active");
  582. $('#pr_item').removeClass("active");
  583. if(name==null){
  584. return;
  585. }
  586. var tmp = "#" + name;
  587. $(tmp).addClass("active");
  588. }
  589. function displayRepoResult(page,jsonResult,onlyReturnNum,keyword){
  590. var data = jsonResult.Result;
  591. var total = jsonResult.Total;
  592. $('#repo_total').text(total);
  593. if(!onlyReturnNum){
  594. setActivate("repo_item");
  595. // $('#keyword_desc').text(keyword);
  596. //$('#obj_desc').text(getLabel(isZh,"search_repo"));
  597. //$('#child_total').text(total);
  598. $('#find_title').html(getLabel(isZh,"find_title").replace('{keyword}',keyword).replace('{tablename}',getLabel(isZh,"search_repo")).replace('{total}',total));
  599. var sortHtml = "";
  600. sortHtml +="<a class=\"" + getActiveItem(10) + "item\" href=\"javascript:searchItem(1,10);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_matched") + "</a>";
  601. sortHtml +="<a class=\"" + getActiveItem(11) + "item\" href=\"javascript:searchItem(1,11);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_lasted") + "</a>";
  602. sortHtml +="<a class=\"" + getActiveItem(12) + "item\" href=\"javascript:searchItem(1,12);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_watched") + "</a>";
  603. sortHtml +="<a class=\"" + getActiveItem(13) + "item\" href=\"javascript:searchItem(1,13);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_star") + "</a>";
  604. sortHtml +="<a class=\"" + getActiveItem(14) + "item\" href=\"javascript:searchItem(1,14);\" tabindex=\"-1\" role=\"menuitem\" id=\"menuitem_1\">"+ getLabel(isZh,"search_fork") + "</a>";
  605. document.getElementById("sort_type").innerHTML=sortHtml;
  606. var html = "";
  607. var currentTime = new Date().getTime();
  608. for(var i = 0; i < data.length;i++){
  609. var recordMap = data[i];
  610. html += "<div class=\"item\">";
  611. if(!isEmpty(recordMap['avatar'])){
  612. html += "<img class=\"ui avatar image\" src=\"" + recordMap['avatar'] + "\">";
  613. }
  614. html += " <div class=\"content\">";
  615. html += " <div class=\"ui header\">";
  616. 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>";
  617. if(recordMap["is_private"]){
  618. 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>";
  619. }
  620. html +=" </div>";
  621. html += " <div class=\"description\">";
  622. html += " <p class=\"has-emoji\"> " + recordMap["description"] + "</p>";
  623. html += " <div class=\"ui tags\">";
  624. if(!isEmpty(recordMap["topics"]) && recordMap["topics"] !="null"){
  625. for(var j = 0; j < recordMap["topics"].length;j++){
  626. //function searchLabel(tableName,keyword,sortBy="",ascending=false)
  627. html +=" <a href=\"javascript:searchLabel('repository','" + recordMap["topics"][j] + "','updated_unix.keyword',false);\" ><div class=\"ui small label topic\">"+ recordMap["hightTopics"][j] + "</div></a>";
  628. }
  629. }
  630. html +=" </div>";
  631. html +=" <p class=\"time\">";
  632. 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;";
  633. html +="&nbsp;&nbsp;&nbsp;&nbsp;"+ getLabel(isZh,"search_lasted_update") + " " + recordMap["updated_html"];
  634. if(!isEmpty(recordMap["lang"])){
  635. var lang = recordMap["lang"]
  636. var tmpLang = recordMap["lang"].split(",");
  637. if(tmpLang.length>0){
  638. lang = tmpLang[0]
  639. }
  640. var backColor = "#3572A5";
  641. if(LanguagesColor[lang] != null){
  642. backColor = LanguagesColor[lang];
  643. }
  644. html +=" <span class=\"text grey am-ml-10\"><i class=\"color-icon\" style=\"background-color: "+ backColor + "\"></i>&nbsp;" + lang + "</span>";
  645. }
  646. html +=" </p>";
  647. html +=" </div>";
  648. html +=" </div>";
  649. html +="</div>";
  650. }
  651. document.getElementById("child_search_item").innerHTML=html;
  652. }
  653. }
  654. function getTime(UpdatedUnix,currentTime){
  655. UpdatedUnix = UpdatedUnix;
  656. currentTime = currentTime / 1000;
  657. var timeEscSecond = currentTime - UpdatedUnix;
  658. if( timeEscSecond < 0){
  659. timeEscSecond = 1;
  660. }
  661. console.log("currentTime=" + currentTime + " updateUnix=" + UpdatedUnix);
  662. var hours= Math.floor(timeEscSecond / 3600);
  663. //计算相差分钟数
  664. var leave2 = Math.floor(timeEscSecond % (3600)); //计算小时数后剩余的秒数
  665. var minutes= Math.floor(leave2 / 60);//计算相差分钟数
  666. var leave3=Math.floor(leave2 % 60); //计算分钟数后剩余的秒数
  667. var seconds= leave3;
  668. if(hours == 0 && minutes == 0){
  669. return seconds + getRepoOrOrg(6,isZh);
  670. }else{
  671. if(hours > 0){
  672. if(hours >= 24){
  673. var days = Math.ceil(hours/24)
  674. if (days >= 30 && days <365){
  675. return Math.ceil(days/30) + getRepoOrOrg(8,isZh);
  676. }else if(days >= 365){
  677. return Math.ceil(days/365) + getRepoOrOrg(9,isZh);
  678. }
  679. return Math.ceil(hours/24) + getRepoOrOrg(7,isZh);
  680. }else{
  681. return hours + getRepoOrOrg(4,isZh);
  682. }
  683. }else{
  684. return minutes + getRepoOrOrg(5,isZh);
  685. }
  686. }
  687. }
  688. function getRepoOrOrg(key,isZhLang){
  689. if(isZhLang){
  690. return repoAndOrgZH[key];
  691. }else{
  692. return repoAndOrgEN[key];
  693. }
  694. }
  695. var repoAndOrgZH={
  696. "1":"项目",
  697. "2":"成员",
  698. "3":"团队",
  699. "4":"小时前",
  700. "5":"分钟前",
  701. "6":"秒前",
  702. "7":"天前",
  703. "8":"个月前",
  704. "9":"年前"
  705. };
  706. var repoAndOrgEN={
  707. "1":"repository",
  708. "2":"Members ",
  709. "3":"Teams",
  710. "4":" hours ago",
  711. "5":" minutes ago",
  712. "6":" seconds ago",
  713. "7":" day ago",
  714. "8":" month ago",
  715. "9":" year ago"
  716. };
  717. function page(current){
  718. currentPage=current;
  719. doSearch(currentSearchTableName,currentSearchKeyword,current,pageSize,false,currentSearchSortBy,OnlySearchLabel);
  720. }
  721. function nextPage(){
  722. currentPage = currentPage+1;
  723. console.log("currentPage=" + currentPage);
  724. if(currentPage >= endIndex){
  725. startIndex=startIndex+1;
  726. endIndex = endIndex +1;
  727. }
  728. page(currentPage);
  729. }
  730. function prePage(){
  731. console.log("currentPage=" + currentPage);
  732. if(currentPage > 1){
  733. currentPage = currentPage-1;
  734. if(currentPage <= startIndex && startIndex > 1){
  735. startIndex = startIndex -1;
  736. endIndex = endIndex - 1;
  737. }
  738. console.log("currentPage=" + (currentPage));
  739. page(currentPage);
  740. }
  741. }
  742. function getXPosition(e){
  743. var x=e.offsetLeft;
  744. while(e=e.offsetParent)
  745. {
  746. x+=e.offsetLeft;
  747. }
  748. return x+20;//-260防止屏幕超出
  749. }
  750. //获取y坐标
  751. function getYPosition(e){
  752. var y=e.offsetTop;
  753. while(e=e.offsetParent)
  754. {
  755. y+=e.offsetTop;
  756. }
  757. return y+20;//80为input高度
  758. }
  759. function goPage(event){
  760. var inputpage = document.getElementById("inputpage_div")
  761. var left = getXPosition(event.target);
  762. var top = getYPosition(event.target);
  763. var goNum = $('#inputpage').val();
  764. if (goNum<=0){
  765. showTip(getLabel(isZh,"search_input_large_0"),"warning",left+5,top);
  766. }
  767. else if(goNum<=totalPage){
  768. page(goNum);
  769. }
  770. else{
  771. showTip(getLabel(isZh,"search_input_maxed"),"warning",left+5,top);
  772. }
  773. }
  774. function showTip(tip, type,left,top) {
  775. var $tip = $('#tipmsg');
  776. var tipmsg = document.getElementById("tipmsg")
  777. var style="z-index:10024;top:" + top + "px;left:" + left + "px;position:absolute;width:200px;height:60px;vertical-align:middle;";
  778. console.log(style);
  779. tipmsg.style = style;
  780. var html ="<p>" + tip + "</p>"
  781. $tip.stop(true).prop('class', 'alert alert-' + type).html(html).fadeIn(500).delay(2000).fadeOut(500);
  782. }
  783. function setPage(currentPage){
  784. console.log("totalPage=" + totalPage);
  785. var html ="";
  786. console.log("currentPage=" + currentPage);
  787. console.log("privateTotal=" + privateTotal);
  788. // if(totalPage==0){
  789. // return;
  790. // }
  791. html += "<span class=\"item\">" + getLabel(isZh,"search_input_total") + " " + totalNum + " " + getLabel(isZh,"search_srtip") + "</span>"
  792. if(currentPage > 1){
  793. html += "<a class=\"item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">" + getLabel(isZh,"search_home_page") + "</span></a>";
  794. html += "<a class=\"item navigation\" href=\"javascript:prePage()\"><i class=\"left arrow icon\"></i></a>";
  795. }else{
  796. html += "<a class=\"disabled item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">" + getLabel(isZh,"search_home_page") + "</span></a>";
  797. html += "<a class=\"disabled item navigation\" href=\"javascript:prePage()\"><i class=\"left arrow icon\"></i></a>";
  798. }
  799. for(var i=startIndex; i <= endIndex; i++){
  800. var page_i = i;
  801. if(page_i > totalPage){
  802. break;
  803. }
  804. if( page_i == currentPage){
  805. html += "<a id=\"page_" + page_i+ "\" class=\"active item\" href=\"javascript:page(" + page_i +")\">" + page_i + "</a>";
  806. }else{
  807. html += "<a id=\"page_" + page_i+ "\" class=\"item\" href=\"javascript:page(" + page_i +")\">" + page_i + "</a>";
  808. }
  809. }
  810. if(currentPage >=totalPage){
  811. html += "<a class=\"disabled item navigation\" href=\"javascript:nextPage()\"><i class=\"icon right arrow\"></i></a>";
  812. html += "<a class=\"disabled item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">" + getLabel(isZh,"search_last_page") + "</span></a>";
  813. }else{
  814. html += "<a class=\"item navigation\" href=\"javascript:nextPage()\"><i class=\"icon right arrow\"></i></a>";
  815. html += "<a class=\"item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">" + getLabel(isZh,"search_last_page") + "</span></a>";
  816. }
  817. 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>";
  818. console.log("html=" + html)
  819. document.getElementById("page_menu").innerHTML=html;
  820. $('#inputpage').on('keypress',function(event){
  821. if(event.keyCode == 13){
  822. goPage(event);
  823. }
  824. });
  825. }
  826. $('#keyword_input').on('keypress',function(event){
  827. if(event.keyCode == 13){
  828. search();
  829. }
  830. });
  831. document.onreadystatechange = function() {
  832. if (document.readyState === "complete") {
  833. search();
  834. }
  835. }
  836. var LanguagesColor = {
  837. "1C Enterprise": "#814CCC",
  838. "ABAP": "#E8274B",
  839. "AGS Script": "#B9D9FF",
  840. "AMPL": "#E6EFBB",
  841. "ANTLR": "#9DC3FF",
  842. "API Blueprint": "#2ACCA8",
  843. "APL": "#5A8164",
  844. "ASP": "#6a40fd",
  845. "ATS": "#1ac620",
  846. "ActionScript": "#882B0F",
  847. "Ada": "#02f88c",
  848. "Agda": "#315665",
  849. "Alloy": "#64C800",
  850. "AngelScript": "#C7D7DC",
  851. "AppleScript": "#101F1F",
  852. "Arc": "#aa2afe",
  853. "AspectJ": "#a957b0",
  854. "Assembly": "#6E4C13",
  855. "Asymptote": "#4a0c0c",
  856. "AutoHotkey": "#6594b9",
  857. "AutoIt": "#1C3552",
  858. "Ballerina": "#FF5000",
  859. "Batchfile": "#C1F12E",
  860. "BlitzMax": "#cd6400",
  861. "Boo": "#d4bec1",
  862. "Brainfuck": "#2F2530",
  863. "C": "#555555",
  864. "C#": "#178600",
  865. "C++": "#f34b7d",
  866. "CSS": "#563d7c",
  867. "Ceylon": "#dfa535",
  868. "Chapel": "#8dc63f",
  869. "Cirru": "#ccccff",
  870. "Clarion": "#db901e",
  871. "Clean": "#3F85AF",
  872. "Click": "#E4E6F3",
  873. "Clojure": "#db5855",
  874. "CoffeeScript": "#244776",
  875. "ColdFusion": "#ed2cd6",
  876. "Common Lisp": "#3fb68b",
  877. "Common Workflow Language": "#B5314C",
  878. "Component Pascal": "#B0CE4E",
  879. "Crystal": "#000100",
  880. "Cuda": "#3A4E3A",
  881. "D": "#ba595e",
  882. "DM": "#447265",
  883. "Dart": "#00B4AB",
  884. "DataWeave": "#003a52",
  885. "Dhall": "#dfafff",
  886. "Dockerfile": "#384d54",
  887. "Dogescript": "#cca760",
  888. "Dylan": "#6c616e",
  889. "E": "#ccce35",
  890. "ECL": "#8a1267",
  891. "EQ": "#a78649",
  892. "Eiffel": "#946d57",
  893. "Elixir": "#6e4a7e",
  894. "Elm": "#60B5CC",
  895. "Emacs Lisp": "#c065db",
  896. "EmberScript": "#FFF4F3",
  897. "Erlang": "#B83998",
  898. "F#": "#b845fc",
  899. "F*": "#572e30",
  900. "FLUX": "#88ccff",
  901. "Factor": "#636746",
  902. "Fancy": "#7b9db4",
  903. "Fantom": "#14253c",
  904. "Faust": "#c37240",
  905. "Forth": "#341708",
  906. "Fortran": "#4d41b1",
  907. "FreeMarker": "#0050b2",
  908. "Frege": "#00cafe",
  909. "G-code": "#D08CF2",
  910. "GAML": "#FFC766",
  911. "GDScript": "#355570",
  912. "Game Maker Language": "#71b417",
  913. "Genie": "#fb855d",
  914. "Gherkin": "#5B2063",
  915. "Glyph": "#c1ac7f",
  916. "Gnuplot": "#f0a9f0",
  917. "Go": "#00ADD8",
  918. "Golo": "#88562A",
  919. "Gosu": "#82937f",
  920. "Grammatical Framework": "#79aa7a",
  921. "Groovy": "#e69f56",
  922. "HTML": "#e34c26",
  923. "Hack": "#878787",
  924. "Harbour": "#0e60e3",
  925. "Haskell": "#5e5086",
  926. "Haxe": "#df7900",
  927. "HiveQL": "#dce200",
  928. "HolyC": "#ffefaf",
  929. "Hy": "#7790B2",
  930. "IDL": "#a3522f",
  931. "IGOR Pro": "#0000cc",
  932. "Idris": "#b30000",
  933. "Io": "#a9188d",
  934. "Ioke": "#078193",
  935. "Isabelle": "#FEFE00",
  936. "J": "#9EEDFF",
  937. "JSONiq": "#40d47e",
  938. "Java": "#b07219",
  939. "JavaScript": "#f1e05a",
  940. "Jolie": "#843179",
  941. "Jsonnet": "#0064bd",
  942. "Julia": "#a270ba",
  943. "Jupyter Notebook": "#DA5B0B",
  944. "KRL": "#28430A",
  945. "Kotlin": "#F18E33",
  946. "LFE": "#4C3023",
  947. "LLVM": "#185619",
  948. "LOLCODE": "#cc9900",
  949. "LSL": "#3d9970",
  950. "Lasso": "#999999",
  951. "Lex": "#DBCA00",
  952. "LiveScript": "#499886",
  953. "LookML": "#652B81",
  954. "Lua": "#000080",
  955. "MATLAB": "#e16737",
  956. "MAXScript": "#00a6a6",
  957. "MLIR": "#5EC8DB",
  958. "MQL4": "#62A8D6",
  959. "MQL5": "#4A76B8",
  960. "MTML": "#b7e1f4",
  961. "Makefile": "#427819",
  962. "Mask": "#f97732",
  963. "Max": "#c4a79c",
  964. "Mercury": "#ff2b2b",
  965. "Meson": "#007800",
  966. "Metal": "#8f14e9",
  967. "Mirah": "#c7a938",
  968. "Modula-3": "#223388",
  969. "NCL": "#28431f",
  970. "Nearley": "#990000",
  971. "Nemerle": "#3d3c6e",
  972. "NetLinx": "#0aa0ff",
  973. "NetLinx+ERB": "#747faa",
  974. "NetLogo": "#ff6375",
  975. "NewLisp": "#87AED7",
  976. "Nextflow": "#3ac486",
  977. "Nim": "#37775b",
  978. "Nit": "#009917",
  979. "Nix": "#7e7eff",
  980. "Nu": "#c9df40",
  981. "OCaml": "#3be133",
  982. "ObjectScript": "#424893",
  983. "Objective-C": "#438eff",
  984. "Objective-C++": "#6866fb",
  985. "Objective-J": "#ff0c5a",
  986. "Odin": "#60AFFE",
  987. "Omgrofl": "#cabbff",
  988. "Opal": "#f7ede0",
  989. "OpenQASM": "#AA70FF",
  990. "Oxygene": "#cdd0e3",
  991. "Oz": "#fab738",
  992. "P4": "#7055b5",
  993. "PHP": "#4F5D95",
  994. "PLSQL": "#dad8d8",
  995. "Pan": "#cc0000",
  996. "Papyrus": "#6600cc",
  997. "Parrot": "#f3ca0a",
  998. "Pascal": "#E3F171",
  999. "Pawn": "#dbb284",
  1000. "Pep8": "#C76F5B",
  1001. "Perl": "#0298c3",
  1002. "PigLatin": "#fcd7de",
  1003. "Pike": "#005390",
  1004. "PogoScript": "#d80074",
  1005. "PostScript": "#da291c",
  1006. "PowerBuilder": "#8f0f8d",
  1007. "PowerShell": "#012456",
  1008. "Processing": "#0096D8",
  1009. "Prolog": "#74283c",
  1010. "Propeller Spin": "#7fa2a7",
  1011. "Puppet": "#302B6D",
  1012. "PureBasic": "#5a6986",
  1013. "PureScript": "#1D222D",
  1014. "Python": "#3572A5",
  1015. "QML": "#44a51c",
  1016. "Quake": "#882233",
  1017. "R": "#198CE7",
  1018. "RAML": "#77d9fb",
  1019. "RUNOFF": "#665a4e",
  1020. "Racket": "#3c5caa",
  1021. "Ragel": "#9d5200",
  1022. "Raku": "#0000fb",
  1023. "Rascal": "#fffaa0",
  1024. "Reason": "#ff5847",
  1025. "Rebol": "#358a5b",
  1026. "Red": "#f50000",
  1027. "Ren'Py": "#ff7f7f",
  1028. "Ring": "#2D54CB",
  1029. "Riot": "#A71E49",
  1030. "Roff": "#ecdebe",
  1031. "Rouge": "#cc0088",
  1032. "Ruby": "#701516",
  1033. "Rust": "#dea584",
  1034. "SAS": "#B34936",
  1035. "SQF": "#3F3F3F",
  1036. "SRecode Template": "#348a34",
  1037. "SaltStack": "#646464",
  1038. "Scala": "#c22d40",
  1039. "Scheme": "#1e4aec",
  1040. "Self": "#0579aa",
  1041. "Shell": "#89e051",
  1042. "Shen": "#120F14",
  1043. "Slash": "#007eff",
  1044. "Slice": "#003fa2",
  1045. "SmPL": "#c94949",
  1046. "Smalltalk": "#596706",
  1047. "Solidity": "#AA6746",
  1048. "SourcePawn": "#5c7611",
  1049. "Squirrel": "#800000",
  1050. "Stan": "#b2011d",
  1051. "Standard ML": "#dc566d",
  1052. "Starlark": "#76d275",
  1053. "SuperCollider": "#46390b",
  1054. "Swift": "#ffac45",
  1055. "SystemVerilog": "#DAE1C2",
  1056. "TI Program": "#A0AA87",
  1057. "Tcl": "#e4cc98",
  1058. "TeX": "#3D6117",
  1059. "Terra": "#00004c",
  1060. "Turing": "#cf142b",
  1061. "TypeScript": "#2b7489",
  1062. "UnrealScript": "#a54c4d",
  1063. "V": "#5d87bd",
  1064. "VBA": "#867db1",
  1065. "VBScript": "#15dcdc",
  1066. "VCL": "#148AA8",
  1067. "VHDL": "#adb2cb",
  1068. "Vala": "#fbe5cd",
  1069. "Verilog": "#b2b7f8",
  1070. "Vim script": "#199f4b",
  1071. "Visual Basic .NET": "#945db7",
  1072. "Volt": "#1F1F1F",
  1073. "Vue": "#2c3e50",
  1074. "WebAssembly": "#04133b",
  1075. "Wollok": "#a23738",
  1076. "X10": "#4B6BEF",
  1077. "XC": "#99DA07",
  1078. "XQuery": "#5232e7",
  1079. "XSLT": "#EB8CEB",
  1080. "YARA": "#220000",
  1081. "YASnippet": "#32AB90",
  1082. "Yacc": "#4B6C4B",
  1083. "ZAP": "#0d665e",
  1084. "ZIL": "#dc75e5",
  1085. "ZenScript": "#00BCD1",
  1086. "Zephir": "#118f9e",
  1087. "Zig": "#ec915c",
  1088. "eC": "#913960",
  1089. "mIRC Script": "#926059",
  1090. "mcfunction": "#E22837",
  1091. "nesC": "#94B0C7",
  1092. "ooc": "#b0b77e",
  1093. "q": "#0040cd",
  1094. "sed": "#64b970",
  1095. "wdl": "#42f1f4",
  1096. "wisp": "#7582D1",
  1097. "xBase": "#403a40",
  1098. }
  1099. function getLabel(isZh,key){
  1100. if(isZh){
  1101. return zhCN[key]
  1102. }else{
  1103. return esUN[key]
  1104. }
  1105. }
  1106. var zhCN={
  1107. "search":"搜索",
  1108. "search_repo":"项目",
  1109. "search_dataset":"数据集",
  1110. "search_issue":"任务",
  1111. "search_pr":"合并请求",
  1112. "search_user":"用户",
  1113. "search_org":"组织",
  1114. "search_finded":"找到",
  1115. "search_matched":"最佳匹配",
  1116. "search_matched_download":"下载次数",
  1117. "search_lasted_update":"最后更新于",
  1118. "search_letter_asc":"字母顺序排序",
  1119. "search_letter_desc":"字母逆序排序",
  1120. "search_lasted_create":"最近创建",
  1121. "search_early_create":"最早创建",
  1122. "search_add_by":"加入于",
  1123. "search_lasted":"最近更新",
  1124. "search_open":"开启中",
  1125. "search_closed":"已关闭",
  1126. "search_watched":"关注数",
  1127. "search_star":"点赞数",
  1128. "search_fork":"Fork数",
  1129. "search_input_large_0":"请输入大于0的数值。",
  1130. "search_input_maxed":"不能超出总页数。",
  1131. "search_input_total":"共",
  1132. "search_srtip":"条",
  1133. "search_home_page":"首页",
  1134. "search_last_page":"末页",
  1135. "search_go_to":"前往",
  1136. "search_go_page":"页",
  1137. "find_title":"“<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>”相关{tablename}约为{total}个",
  1138. "search_empty":"<strong>请输入任意关键字开始搜索。</strong>"
  1139. }
  1140. var esUN={
  1141. "search":"Search",
  1142. "search_repo":"Repository",
  1143. "search_dataset":"DataSet",
  1144. "search_issue":"Issue",
  1145. "search_pr":"Pull Request",
  1146. "search_user":"User",
  1147. "search_org":"Organization",
  1148. "search_finded":"Find",
  1149. "search_matched":"Best Match",
  1150. "search_matched_download":"Most downloads",
  1151. "search_lasted_update":"Updated ",
  1152. "search_letter_asc":"Alphabetically",
  1153. "search_letter_desc":"Reverse alphabetically",
  1154. "search_lasted_create":"Recently created",
  1155. "search_early_create":"First created",
  1156. "search_add_by":"Joined on",
  1157. "search_lasted":"Recently updated",
  1158. "search_open":"Open",
  1159. "search_closed":"Closed",
  1160. "search_watched":"Watches",
  1161. "search_star":"Stars",
  1162. "search_fork":"Forks",
  1163. "search_input_large_0":"Please enter a value greater than 0.",
  1164. "search_input_maxed":"Cannot exceed total pages.",
  1165. "search_input_total":"Total",
  1166. "search_srtip":"",
  1167. "search_home_page":"First",
  1168. "search_last_page":"Last",
  1169. "search_go_to":"Go",
  1170. "search_go_page":"Page",
  1171. "find_title":" {total} \"<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>\" related {tablename}",
  1172. "search_empty":"<strong>Please enter any keyword to start the search.</strong>"
  1173. }
  1174. initDiv(false);