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

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