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 50 kB

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