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

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