| @@ -65,39 +65,35 @@ socket.onmessage = function (e) { | |||
| for(var i = messageQueue.length -1; i >=0; i--){ | |||
| var record = messageQueue[i]; | |||
| html += "<div class=\"swiper-slide item\">"; | |||
| html += " <img class=\"ui avatar image\" src=\"/user/avatar/" + record.ActUser.Name + "/-1\" alt=\"\">" | |||
| html += " <div class=\"middle aligned content\">" | |||
| html += " <a href=\"/" + record.ActUser.Name + "\" title=\"\">" + record.ActUser.Name + "</a>" | |||
| var recordPrefix = getMsg(record); | |||
| var actionName = getAction(record.OpType,isZh); | |||
| if(record.OpType == "6" || record.OpType == "10" || record.OpType == "12" || record.OpType == "13"){ | |||
| html += actionName; | |||
| html += recordPrefix + actionName; | |||
| html += " <a href=\"" + getIssueLink(record) + "\" rel=\"nofollow\">" + getIssueText(record) + "</a>" | |||
| } | |||
| else if(record.OpType == "7" || record.OpType == "11" || record.OpType == "14" || record.OpType == "15" || record.OpType == "22" | |||
| || record.OpType == "23"){ | |||
| html += actionName; | |||
| html += recordPrefix + actionName; | |||
| html += " <a href=\"" + getPRLink(record) + "\" rel=\"nofollow\">" + getPRText(record) + "</a>" | |||
| } | |||
| else if(record.OpType == "1"){ | |||
| html += actionName; | |||
| html += recordPrefix + actionName; | |||
| html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepoLink(record) + "</a>" | |||
| } | |||
| else if(record.OpType == "9"){ | |||
| else if(record.OpType == "9" || record.OpType == "5"){ | |||
| actionName = actionName.replace("{branch}",record.RefName); | |||
| html += actionName; | |||
| html += recordPrefix + actionName; | |||
| html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepoLink(record) + "</a>" | |||
| }else if(record.OpType == "17"){ | |||
| actionName = actionName.replace("{deleteBranchName}",record.RefName); | |||
| var repoLink = "<a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepoLink(record) + "</a>" | |||
| actionName = actionName.replace("{repoName}",repoLink); | |||
| html += actionName; | |||
| html += recordPrefix + actionName; | |||
| } | |||
| else if(record.OpType == "2"){ | |||
| actionName = actionName.replace("{oldRepoName}",record.Content); | |||
| html += actionName; | |||
| html += recordPrefix + actionName; | |||
| html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepoLink(record) + "</a>" | |||
| } | |||
| else{ | |||
| @@ -127,6 +123,15 @@ socket.onmessage = function (e) { | |||
| swiperNewMessage.updateProgress(); | |||
| }; | |||
| function getMsg(record){ | |||
| var html =""; | |||
| html += "<div class=\"swiper-slide item\">"; | |||
| html += " <img class=\"ui avatar image\" src=\"/user/avatar/" + record.ActUser.Name + "/-1\" alt=\"\">" | |||
| html += " <div class=\"middle aligned content\">" | |||
| html += " <a href=\"/" + record.ActUser.Name + "\" title=\"\">" + record.ActUser.Name + "</a>" | |||
| return html; | |||
| } | |||
| function getRepoLink(record){ | |||
| return "/" + record.Repo.OwnerName + "/" + record.Repo.Name; | |||
| } | |||
| @@ -223,6 +228,7 @@ function getIssueText(record){ | |||
| var actionNameZH={ | |||
| "1":"创建了项目", | |||
| "2":"重命名项目 {oldRepoName} 为", | |||
| "5":"推送了 {branch} 分支的代码到", | |||
| "6":"创建了任务", | |||
| "7":"创建了合并请求", | |||
| "9":"推送了 {branch} 分支的代码到", | |||
| @@ -240,6 +246,7 @@ var actionNameZH={ | |||
| var actionNameEN={ | |||
| "1":"created repository", | |||
| "2":"renamed repository from {oldRepoName} to ", | |||
| "5":"pushed to {branch} at", | |||
| "6":"opened issue", | |||
| "7":"created pull request", | |||
| "9":"pushed to {branch} at", | |||