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

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