From 1dc3d163ec5ea8d2f910e2c234b417cb2a1cd2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E775174143?= <775174143@qq.com> Date: Sun, 30 Sep 2018 22:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA=20=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E9=97=AE=E9=A2=98=20=E5=8F=B3=E4=BE=A7=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E6=A1=86=E6=9D=A1=EF=BC=8C=E5=A4=9A=E4=BD=99=E6=96=87?= =?UTF-8?q?=E5=AD=97=E5=8E=BB=E6=8E=89=EF=BC=8C=E6=95=B0=E5=AD=97=E9=97=B4?= =?UTF-8?q?=E8=B7=9D=E8=B7=B3=E6=95=B4=20=E4=BB=A3=E7=A0=81=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E6=9C=80=E5=90=8E=E4=B8=80=E9=A1=B5=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20=E5=87=BD=E6=95=B0=E6=89=93=E5=8B=BE?= =?UTF-8?q?=E5=92=8C=E6=89=93=C3=97=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E6=B6=88=E5=A4=B1=20=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=EF=BC=8C=E9=97=AE=E9=A2=98=20=E6=9F=A5=E7=9C=8B=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=20=E6=A1=86=E7=82=B9=E5=87=BB=E9=83=BD=E5=B1=85?= =?UTF-8?q?=E4=B8=AD=E6=98=BE=E7=A4=BA=20=E5=8E=BB=E6=8E=89=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E5=8F=AF=E8=A7=81=E5=87=A0=E5=AD=97=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=8F=90=E4=BA=A4=E6=88=90=E5=8A=9F=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E5=B0=8F=E7=BB=84=E6=A0=87=E6=B3=A8=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E6=8E=92=E5=90=8D=E7=AC=AC2=E2=80=9D=20=E5=80=99=E9=80=89?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=87=BD=E6=95=B0=EF=BC=88=E8=AF=B7=E5=B8=AE?= =?UTF-8?q?=E5=BF=99=E5=8F=8D=E9=A6=88=E6=AD=A3=E7=A1=AE=E7=9A=84=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=80=99=E9=80=89=EF=BC=8C=E5=9C=A8=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=87=BD=E6=95=B0=E5=90=8E=E9=9D=A2=E6=89=93?= =?UTF-8?q?=E9=92=A9=EF=BC=89=E2=80=9D=20=E4=B8=8B=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD=E6=94=B9=E4=B8=BA=E2=80=9C=E6=9C=AA?= =?UTF-8?q?=E6=89=BE=E5=88=B0=E5=80=99=E9=80=89=E8=B7=B3=E8=BD=AC=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E2=80=9D=20=E5=8F=B3=E4=BE=A7=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=82=B9=E5=87=BB=E6=8C=89=E9=92=AE=E9=9A=90?= =?UTF-8?q?=E8=97=8F=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=BF=9D=E7=95=99=E6=88=91?= =?UTF-8?q?=E7=9A=84=E6=B3=A8=E9=87=8A=E5=B9=B6=E8=B7=B3=E8=BD=AC=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Codepedia2/settings.py | 2 +- static/css/WebPageGuide.css | 3 + static/css/code_show.css | 27 +- static/css/common.css | 1 + static/js/source.js | 20 +- static/js/source.js.bak | 2016 ----------------- templates/projects/filesub/annotation.html | 6 +- templates/projects/filesub/file-right.html | 10 +- templates/projects/filesub/login.html | 30 +- .../projects/filesub/search-response.html | 8 +- templates/projects/source.html | 4 +- templates/shared/navbar.html | 16 +- 12 files changed, 71 insertions(+), 2072 deletions(-) delete mode 100644 static/js/source.js.bak diff --git a/Codepedia2/settings.py b/Codepedia2/settings.py index ae8e1a8..1e7ec66 100644 --- a/Codepedia2/settings.py +++ b/Codepedia2/settings.py @@ -122,7 +122,7 @@ DATABASES = { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'codepedia', 'USER': 'root', - 'PASSWORD': 'codepedia123', + 'PASSWORD': 'root', 'HOST': '127.0.0.1' } } diff --git a/static/css/WebPageGuide.css b/static/css/WebPageGuide.css index 136c713..6bc7747 100644 --- a/static/css/WebPageGuide.css +++ b/static/css/WebPageGuide.css @@ -220,4 +220,7 @@ html { .WPGstep .topWPGnext:hover{ background: none gray +} +.WPGstepTitle{ + width: 10rem; } \ No newline at end of file diff --git a/static/css/code_show.css b/static/css/code_show.css index 0349e52..948a087 100644 --- a/static/css/code_show.css +++ b/static/css/code_show.css @@ -524,7 +524,7 @@ a:hover { .panel-leftfont { display: block; float: left; - width: 90px; + /*width: 90px;*/ text-align: left; color: #EAEAEA; font-size: 13px; @@ -634,10 +634,10 @@ a:hover { /* 提交评论框 */ #ItemcommentPanel { - position: absolute; - right: 60px; - width: 4rem; - top: 19px; + position: fixed; + right: 6rem; + width: 5rem; + top: 3rem; border-radius: 4px; background-color: #fff; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3); @@ -699,14 +699,15 @@ a:hover { #ItemquestionPanel { width: 700px; - position: absolute; + position: fixed; max-height: 500px; overflow-y: auto; background-color: #fff; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3); - top: 23px; + right:5.5rem; + top: 2rem; border-radius: 4px; - right: 32px; + z-index: 3; color:black; padding: 15px 0px 3px 0px; @@ -911,14 +912,14 @@ pre.prettyprint { margin-top: 10px; } .addno-panel { - position: absolute; - width: 410px; + position: fixed; + width: 440px; border: 1px solid #ccc; border-radius: 5px; background: #fff; - z-index: 1; - right: 5px; - top: 27px; + z-index: 236; + right: 7rem; + top: 2rem; display: none; } diff --git a/static/css/common.css b/static/css/common.css index 7bd14db..a944cf5 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -1,4 +1,5 @@ /* Float & Clear */ +.none{display:none;} .clear{ zoom:1;} .clear:after {clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden} .cl{ clear:both; overflow:hidden; } diff --git a/static/js/source.js b/static/js/source.js index 240f2ac..71c3fd6 100644 --- a/static/js/source.js +++ b/static/js/source.js @@ -565,7 +565,7 @@ function submit_annotation(file_id, line_num, content) { $("#"+id).before(html); if(data.status == "success"){ if(data.rank){ - layer.msg('标注提交成功,当前小组排名为:'+data.rank); + layer.msg('提交成功,当前小组标注数量排名第:'+data.rank); } }else{ layer.msg(data.msg); @@ -664,7 +664,8 @@ function search_symbol(args,line_num,function_name) { } }); } -function onClick_FeedbackButton(answer_type,file_id,path_and_lineno,line_num,function_name) { +function onClick_FeedbackButton(answer_type,file_id,path_and_lineno,line_num,function_name,This) { + $(This).hide() // 获取到当前的答案 $.ajax({ cache: false, @@ -978,7 +979,10 @@ function open_tab(path,archor) { $('#jstree').jstree("deselect_all", true); $('#jstree').jstree("select_node", tree_nodes[path]); - + setTimeout(function timer() { + var offsettop=$("#"+tree_nodes[path]).position().top; + $("#filelist-content").scrollTop(offsettop); + },500) var tabcontent = document.getElementsByClassName("codereading"); for (var i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; @@ -1323,6 +1327,10 @@ function highlight_jstree_node(project_id,path_after){ $('#jstree').jstree("deselect_all", true); $('#jstree').jstree("select_node", tree_nodes[path]); // location.href="#"+tree_node + setTimeout(function timer() { + var offsettop=$("#"+tree_nodes[path]).position().top; + $("#filelist-content").scrollTop(offsettop); + },500) } },error:function(jqXHR, textStatus, errorThrown){ if(jqXHR.readyState===0&&jqXHR.status===0){ @@ -1484,9 +1492,9 @@ function inject_addnoPanel_html(item,file_id,linenum) { $("#ItemcommentPanel").remove(); $("#ItemquestionPanel").remove(); - + // '
'+ html_str = '
'+ - '
'+ + '
'+ '
为该行或该代码块添加注释或者提问:
'+ '

'+ @@ -1506,6 +1514,8 @@ function inject_addnoPanel_html(item,file_id,linenum) { if(file_id===oldfile_id&&linenum===oldline_num){ $("#addno-text-"+file_id+"-"+linenum).val(olditem_value); } + + $( "#addno-panelsource-addno-panel" ).draggable(); } diff --git a/static/js/source.js.bak b/static/js/source.js.bak deleted file mode 100644 index c64404a..0000000 --- a/static/js/source.js.bak +++ /dev/null @@ -1,2016 +0,0 @@ -var flag = true;//左侧默认显示 - -function hideModal(){ - $("#popupAll").remove(); -} -function pop_box_new(value, Width, Height,close){ - - if($("#popupAll").length > 0){ - $("#popupAll").remove(); - } - w = ($(window).width() - Width)/2; - h = ($(window).height() - Height)/2; - var html="

"; - if(close){ - value="" + value; - } - $(document.body).append(html); - $("#popupWrap").html(value); - $('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999","background-color":"#fff","border-radius":"10px"}); - if(close){ - $('#closeIcon').css({"top": "-26px","left": Width +"px","z-index":"100000"}); - } - - $("#popupWrap").parent().parent().show(); - $('#popupAll').find("#closeIcon").click(function(){ - $("#popupAll").hide(); - }); - $('#popupAll').find("a[class*='pop_close']").click(function(){ - $("#popupAll").hide(); - }); - - //拖拽 - function Drag(id) { - this.div = document.getElementById(id); - if (this.div) { - this.div.style.cursor = "move"; - this.div.style.position = "fixed"; - } - this.disX = 0; - this.disY = 0; - var _this = this; - this.div.onmousedown = function (evt) { - _this.getDistance(evt); - document.onmousemove = function (evt) { - _this.setPosition(evt); - }; - _this.div.onmouseup = function () { - _this.clearEvent(); - } - } - } - Drag.prototype.getDistance = function (evt) { - var oEvent = evt || event; - this.disX = oEvent.clientX - this.div.offsetLeft; - this.disY = oEvent.clientY - this.div.offsetTop; - }; - Drag.prototype.setPosition = function (evt) { - var oEvent = evt || event; - var l = oEvent.clientX - this.disX; - var t = oEvent.clientY - this.disY; - if (l <= 0) { - l = 0; - } - else if (l >= document.documentElement.clientWidth - this.div.offsetWidth) { - l = document.documentElement.clientWidth - this.div.offsetWidth; - } - if (t <= 0) { - t = 0; - } - else if (t >= document.documentElement.clientHeight - this.div.offsetHeight) { - t = document.documentElement.clientHeight - this.div.offsetHeight; - } - this.div.style.left = l + "px"; - this.div.style.top = t + "px"; - }; - Drag.prototype.clearEvent = function () { - this.div.onmouseup = null; - document.onmousemove = null; - }; - - new Drag("popupWrap"); - - $("#popupAll input, #popupAll textarea, #popupAll ul, #popupAll a,#shixun_search_form_div").mousedown(function(event){ - event.stopPropagation(); - new Drag("popupWrap"); - }); - -} -//一个“知道了”按钮,title和宽度都作为参数 -function sure_confirm_box(title,width,height,str){ - var htmlvalue = '
'+title+'
'+ - '
' + str + '
'+ - '知道了
'; - pop_box_new(htmlvalue, width, height); -} - -function suofang(){ - var html='

可能会影响某些功能的正常使用

    ' + - '
  • 1.请尝试调整浏览器缩放比例为100%(快捷键ctrl+0)
  • ' + - '
  • 2.请尝试调整系统显示比例为100%(控制面板/显示 设置)
  • ' + - '
'; - sure_confirm_box("页面缩放比例不正确",600,310,html); -} - - -$(window).resize(function() { - suofang(); -}) - -function setlocalStorage(id,value){ - var newlocalStoragevaule=localStorage.setItem(id,value); - return newlocalStoragevaule; -} -function getlocalStorage(id){ - var oldlocalStoragevaule=localStorage.getItem(id) - return oldlocalStoragevaule; -} -function deletelocalStorage(id){ - localStorage.removeItem(id); -} - - -function getCookie(name) { - var cookieValue = null; - if (document.cookie && document.cookie !== '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) === (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; -} -var csrftoken = getCookie('csrftoken'); - -function show_annotation(file_id, line_num) { - $("#modify_anno_textarea").autoHeightTextarea(); - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev) - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_annotation/', - data: { 'file_id': file_id, 'line_num': line_num }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === "success") { - //console.log("linestatus_"+line_num); - //$("#loadCommentpanel").html(data.html_str); - //$("#commentPanel").css("top", mousePos.y); - //$("#commentPanel").css("left", mousePos.x+35); - //$("#loadCommentpanel").show(); - //console.log(data.html_str); - $("#ItemcommentPanel").remove() - var html="
"+data.html_str+"
" - $("#linestatus_"+file_id+"_"+line_num).append(html); - $( "#ItemcommentPanel" ).draggable(); - }else{ - alert(data.msg) - } - - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function close_modify_anno(){ - $("#modification").show(); - $(".modify_anno_div").remove(); - $("#modify_anno_textarea").attr("readonly","readonly") - - - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); -} - -//注入html代码 -function inject_modifyAnno_html(item,file_id,linenum,anno_id) { - - - var modifyAnno_id= Number(getlocalStorage("modifyAnno_id")); - var modifyAnno_num=Number(getlocalStorage("modifyAnno_num")); - var modifyAnno_line=Number(getlocalStorage("modifyAnno_line")); - var modifyAnno_value=getlocalStorage("modifyAnno_value"); - - - $("#modification").hide(); - $(".modify_anno_div").remove(); - $("#modify_anno_textarea").removeAttr("readonly"); - $("#modify_anno_textarea").focus() - - html_str = '
'+ - '取消'+ - '提交'+ - '
'; - $(item).after(html_str) - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); - - if(file_id===modifyAnno_id&&linenum===modifyAnno_num&&anno_id===modifyAnno_line){ - $("#modify_anno_textarea").val(modifyAnno_value); -} -} - -// FIXME -function modify_anno(file_id,line_num,anno_id){ - // 获取修改后的内容 - function_name = "modify_anno("+file_id+","+line_num+","+anno_id+")" - make_button_disable($(".modify_anno_div a").last()) - - var content=$("#modify_anno_textarea").val(); - if (content == null || content == undefined || content.trim() == '') { - alert("内容不能为空"); - make_button_able($(".modify_anno_div a").last(),function_name) - return; - } - $.ajax({ - cache: false, - type: "POST", - url: '/operations/modify_anno/', - data: { 'file_id': file_id, 'line_num': line_num,'anno_id':anno_id,'content':content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === "success") { - alert(data.msg) - $("#ItemcommentPanel").remove() - $("."+file_id+line_num).text(data.anno_content) - show_annotation(file_id,line_num); - - deletelocalStorage("modifyAnno_id"); - deletelocalStorage("modifyAnno_num") - deletelocalStorage("modifyAnno_line") - deletelocalStorage("modifyAnno_value") - }else{ - alert(data.msg) - } - make_button_able($(".modify_anno_div a").last(),function_name) - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - make_button_able($(".modify_anno_div a").last(),function_name) - } - }); -} - - -// FIXME -function show_issue_question(file_id, line_num, issue_ids) { - issueid_str=issue_ids.toString() - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev) - //发送问题id,返回问题内容 - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_issue_question/', - data: { 'file_id': file_id, 'line_num': line_num, 'issue_ids': issueid_str}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if(data.status=='success'){ - var html="
"+data.html_str+"
"; - $("#linestatus_"+file_id+"_"+line_num).append(html); -// $("#loadQuestionpanel").html(data.html_str); - if (data.issueAnswers) { - //字符串转换成整型数组 - var dataStrArr = issueid_str.substring(1, issueid_str.length - 1).split(",") - var issue_ids = dataStrArr.map(function (data) { - return +data; - }); - // - issueAnswers = JSON.parse(data.issueAnswers); - issueStandardAnswers = JSON.parse(data.issueStandardAnswers); - - let count = 0; - for (let i = 0; i < issue_ids.length; i++) { - issue_id = issue_ids[i] - - if (issue_id == issueAnswers[count].fields.issue) { - var radios = document.getElementsByName("issue_" + issue_id) - user_answer = issueAnswers[0].fields.content; - standard_answer = issueStandardAnswers[0].fields.choice_position; - if (user_answer == standard_answer) { - radios[user_answer - 1].parentNode.style.color = "green"; - } else { - radios[parseInt(user_answer) - 1].parentNode.style.color = "red"; - radios[parseInt(standard_answer) - 1].parentNode.style.color = "green"; - } - document.getElementById("submit_onechoice_" + issue_id).style.display = "None"; - count = count + 1 - } - } - } - //$("#questionPanel").css("top", mousePos.y); - //$("#questionPanel").css("left", mousePos.x - 400); - //$("#loadQuestionpanel").show(); - $( "#ItemquestionPanel" ).draggable(); - }else{ - alert(data.msg) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function add_vote(type, id, num) { - // alert(1111) -} - -function submit_onechoice_issue(issue_id) { - // 获取问题的内容 - var content = $("input[name='issue_" + issue_id + "']:checked").val() - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_issue_answer/', - data: { 'content': content, 'issue_id': issue_id }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - var radios = document.getElementsByName("issue_" + issue_id) - var choose = parseInt(content) - 1 - if (content == data.standAnswer){ - radios[choose].parentNode.style.color = "green"; - }else{ - radios[choose].parentNode.style.color = "red"; - radios[parseInt(data.standAnswer)-1].parentNode.style.color = "green"; - } - document.getElementById("submit_onechoice_"+issue_id).style.display="None"; - } else { - alert(data.msg) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - - -function add_comment_action(item, id, type) { - var content = $("#writetext_" + id).val(); - if (content == "") { - confirm("请输入评论内容"); - return; - } - //发送一个ajax请求 - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_comment/', - data: { 'object_id': id, 'type': type, "content": content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - html_str = data.html_str - show_new_comment(item, html_str); - deletelocalStorage("writetext_id"); - deletelocalStorage("writetext_value"); - } else { - alert(data.msg); - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); -} - -//添加评论 -function show_new_comment(item, html_str) {onclick="add_annotation(this,199,18)" - $(item).parents(".parthalf_comment").after(html_str); - - $(item).parents(".comment-btn").find(".comment-write").addClass("none"); - $(item).parents(".comment-btn").find("#addcom").removeClass("none"); - $(item).siblings(".writetext").val(""); -} - -function add_question_answer(item,question_id) { - // 获取回答的内容 - var content = $("#responseInput_" + question_id).val(); - if (content == "") { - confirm("请输入回答内容"); - return; - } - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_question_answer/', - data: { 'question_id': question_id,"content": content}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - var username = data.username; - show_new_question_answer(item, content, username); - } else { - alert(data.msg); - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function show_new_question_answer(item, content, username) { - - var html = '
' - html += '
' - html += '
'; - html += '

' + username+'10分钟前

'; - html += '
'+content+'
'; - html += '
' - - $(item).parents(".responsePanel").before(html); - $(item).parent().siblings(".responseInput").val(""); -} - - -function add_annotation(item,file_id, line_num) { - - // 获取当前是注释还是问题 - function_name="add_annotation(this"+","+file_id+","+line_num+")" - make_button_disable($(item)) - - var selectValue = $(item).siblings(".put-select").find(".active").html().trim(); - var text_context = "#addno-text-" + file_id+"-"+line_num; - var content = $(text_context).val(); - - if (content.trim().length == 0) { - alert("内容不能为空") - $(item).attr('disabled',false); - $(item).attr("onclick","add_annotation(this"+","+file_id+","+line_num+")") - - return; - } - if (selectValue == "注释") { - // 向addAnnatation中发请求 - submit_annotation(file_id, line_num, content); - deletelocalStorage("file_id"); - deletelocalStorage("line_num"); - deletelocalStorage("item_value"); - deletelocalStorage("status_value"); - } else { - submit_question(file_id, line_num, content); - deletelocalStorage("issuefile_id"); - deletelocalStorage("issueline_num"); - deletelocalStorage("issueitem_value"); - deletelocalStorage("status_value"); - } - make_button_able($(item),function_name) -} - -function submit_annotation(file_id, line_num, content) { - // 因为可能注释或问题没有值的时候,不会为该代码块添加html代码,所以首先判断 - // 然后将注释数+1 - var codeopration_anno_div = $("#codeopration_anno_"+file_id+"_" + line_num).html() - var str = ''; - str +=''; - $("#codeopration_anno_" + +file_id + "_" + line_num).html(str); - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - // show_annotation(file_id,line_num); - //将注释添加到当前行的上一行 - var contenthtml ='
'+'
'+'
'+"//"+ content+'
'+'
'+'
'; - var html = '
'+contenthtml+'
'; - var id=file_id+'_'+"L"+line_num; - $("#"+id).before(html); - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_annotation/', - data: { 'file_id': file_id, 'linenum': line_num, 'content': content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - layer.msg('提交成功'); - }else{ - layer.msg(data.msg); - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - - - -function submit_question(file_id, line_num, content) { - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_question/', - data: { 'file_id': file_id, 'linenum': line_num, 'content': content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - var codeopration_anno_div = $("#codeopration_question_" + file_id + "_" + line_num).html() - if (codeopration_anno_div.trim().length == 0) { - var str = ''; - str += '' - $("#codeopration_question_" + file_id + "_" + line_num).html(str); - } - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - show_issue_question(file_id,line_num,[]); - // else { - // var question_before = $("#questionums_" + line_num).text(); - // $("#questionums_" + line_num).html(parseInt(question_before) + 1); - // } - }else{ - alert(data.msg); - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function closeX_search(){ - $("#search_response").hide(); -} - -function search_symbol(args,line_num,function_name) { - - // ev = window.event - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev) - - $.ajax({ - cache: true, - type: "POST", - url: '/operations/show_method_info/', - data: { 'args': args,"line_num":line_num,"function_name":function_name }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - // console.log(context); - $("#search_response").css("top", 400); - $("#search_response").css("left", mousePos.x); - $(".search-title").remove(); - $(".resultform").remove(); - $("#search_response").append(data.html_str); - $("#search_response").show(); - $( "#search_response" ).draggable(); - ev.stopPropagation(); - - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} -function onClick_FeedbackButton(answer_type,file_id,path_and_lineno,line_num,function_name) { - // 获取到当前的答案 - $.ajax({ - cache: false, - type: "POST", - url: '/operations/submit_search_answer/', - data: {'file_id':file_id,"path_and_lineno":path_and_lineno,"answer_type":answer_type,"line_num":line_num,"function_name":function_name}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - // alert("Thanks for your support for the improvement of Accuracy of search results") - layer.msg('操作成功'); - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - - -} - - - - - - -navigation_map = new Map() - -function show_navigation() { - // 首先要获取当前打开的标签页,或者也可以获取当前的路径 - // 获取当前的项目名称 - var file_path=document.getElementsByClassName("filename")[0].innerHTML; - var project_path=$("#projectName").text() - if( navigation_map.has(project_path+file_path)){ - content = navigation_map.get(project_path + file_path); - $("#structure-context").html(content) - // 加载navigation_tree - deal_for_navigation_tree() - return; - } - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_navigation/', - data: { 'project_path': project_path, 'file_path': file_path }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - - success: function (data) { - if (data.status === 'success') { - var content = "" - // document.getElementById("annotation").style.display="block"; - navigation_map.set(project_path + file_path, content) - $("#structure-context").html(content); - // 加载navigation_tree - deal_for_navigation_tree() - } - else { - navigation_map.set(project_path + file_path, "") - $("#structure-context").html("") - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - - -function deal_for_navigation_tree(){ - try{ - $("#navigation_tree").jstree(); - $("#navigation_tree").jstree().open_all(); - $("#navigation_tree li").click(function(){ - location.href = $(this).find("a").attr("href"); - }); - }catch(error){ - console.log(error) - } - -} -function show_currentLine(linenum) { - // document.getElementById("code_" + linenum).style.backgroundColor = '#f1efec'; - document.getElementById("addanno_" + linenum).style.visibility="visible"; -} - -function hide_currentLine(linenum) { - // document.getElementById("code_" + linenum).style.backgroundColor = 'white'; - document.getElementById("addanno_" + linenum).style.visibility="hidden"; -} - -$(function () { - - $("#filelist-content .item").click(function () { - if ($(this).siblings(".sub-item").length > 0 && $(this).attr("show") == "0") { - $(this).siblings(".sub-item").show(); - $(this).attr("show", "1"); - } else if ($(this).attr("show") == "1") { - $(this).siblings(".sub-item").hide(); - $(this).attr("show", "0"); - } - }) - - $(".left-tab li").click(function () { - // alert("left-tab li") - $(".left-tab li").removeClass("active"); - $(this).addClass("active"); - $(".left-rightlist").hide(); - - $(".left-rightlist").eq($(this).index()).show(); - - if (flag == false) { - $("#right_code").css("width", "80%"); - $(".left").animate({ "width": "20%" }, 1000); - } - - }) - - /*隐藏左侧部分*/ - $(".hideleft").click(function () { - var wid = $(".left").width(); - $(".left").animate({ "width": "50px" }, 800); - $(".left-tab li").removeClass("active"); - $("#right_code").width(parseInt($("#right_code").width()) + wid); - flag = false; - }) - - - //滚动codepanel隐藏搜索结果 - $("#right_code").scroll(function () { - $("#search_response").hide(); - }) - - $(".addno-panel").click(function (event) { - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); - }) - - $(".addanno").live("click",function (event) { - $(".addno-panel").hide(); - $(this).siblings(".addno-panel").show(); - $(".addanno").find("i").removeClass("color-dark-57").addClass("color-grey-c"); - $(this).find("i").removeClass("color-grey-c").addClass("color-dark-57"); - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); - }) - - $("body").click(function (event) { - //隐藏添加注释或者问题的弹框 - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - $(".addanno").find("i").removeClass("color-dark-57").addClass("color-grey-c"); - //隐藏评论弹框 - if($(event.target).parents("#ItemcommentPanel").length == 0){ - $("#ItemcommentPanel").hide(); - $("#ItemcommentPanel").remove(); - } - //隐藏问题弹框 - if($(event.target).parents("#ItemquestionPanel").length == 0){ - $("#ItemquestionPanel").hide(); - $("#ItemquestionPanel").remove(); - } - }) - - $("body").on('click', '.addno-panel', function(e) { - e.stopPropagation(); - }); - - $("#ItemcommentPanel").on('click', '#commentPanel', function (e) { - e.stopPropagation(); - }); - - $("#loadQuestionpanel").on('click', '#questionPanel', function (e) { - e.stopPropagation(); - }); - - //隐藏问题框 - $("#loadQuestionpanel").click(function (event) { - $("#loadQuestionpanel").hide(); - }) - //点击问题框里的内容,阻止冒泡 - $("#questionPanel").click(function (event) { - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); - }) -}) -function addcomments(item,annopk) { - var annopkid= Number(getlocalStorage("writetext_id")); - var writetext_value= getlocalStorage("writetext_value") - $(item).siblings(".comment-write").removeClass("none"); - $(item).addClass("none"); - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); - if(annopk===annopkid){ - $("#writetext_"+annopkid).val(writetext_value); - } -} - -function cancelcom(item) { - $(item).parents(".comment-write").siblings("#addcom").removeClass("none"); - $(item).parents(".comment-write").addClass("none"); - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); -} - -//隐藏右侧部分 -function colserightpanel() { - if (flag) { - $(".codereading").css("width", "80%"); - } else { - var rightwid = $(".right").width(); - var codewid = $(".codereading").width(); - $(".codereading").css("width", parseInt(codewid) + parseInt(rightwid)); - } - $(".right").addClass("none"); -} - -function mouseCoords(ev) { - if (ev.pageX || ev.pageY) { - return { - x: ev.pageX, - y: ev.pageY - }; - } - return { - x: ev.clientX + document.body.scrollLeft - document.body.clientLeft, - y: ev.clientY + document.body.scrollTop - document.body.clientTop - }; -} - -var tabSet = new Set(); -// var issue_map = new Map(); -var right_map = new Map(); -var tree_nodes = new Map(); - -function path_predeal(path){ - // path = path.replace('.', ''); - // path = path.replace('/', '_'); - path = path.split('.').join(''); - path = path.split('/').join('_'); - return path; -} - -function url_deal(path,archor){ - var projectName= $("#projectName").text(); - var ip=window.location.host; //端口号 - var newhtefpath = "/projects/"+projectName+path; - var stateObject = {}; - if(path==""){ - newhtefpath += "/"; - } - //修改地址栏中的地址 - history.pushState(stateObject, ip, newhtefpath); - if(archor!=null){ - location.href=archor - // history.replaceState(null,null,location.href); - } -} - -// 打开一个已经存在的标签页 -// 注意这个还得将对应的路径更改了 -function open_tab(path,archor) { - try{ - // console.log(window.location.pathname); 端口号后面的路径 - path_input=path - path = path_predeal(path) - - $('#jstree').jstree("deselect_all", true); - $('#jstree').jstree("select_node", tree_nodes[path]); - - var tabcontent = document.getElementsByClassName("codereading"); - for (var i = 0; i < tabcontent.length; i++) { - tabcontent[i].style.display = "none"; - } - - var tab_items = document.getElementsByClassName("tab_item"); - for (var i = 0; i < tab_items.length; i++) { - // debugger; - tab_items[i].className = tab_items[i].className.replace(" active", ""); - } - - document.getElementById("code_" + path).style.display = "block"; - document.getElementById("tab_" + path).style.display = "block"; - document.getElementById("tab_" + path).className += " active"; - - url_deal(path_input,archor) - - document.getElementsByClassName("filename")[0].innerHTML = path_input; - - if((path in right_map)){ - $("#right_panel").html(right_map[path]); - } - - // if(!issue_map.has(path)){ - // window.setTimeout(function () { $("#hotest_issue").html(issue_map[path]) }, 3000); - // }else{ - // $("#hotest_issue").html(issue_map[path]); - // } - show_navigation(); - }catch(error) { - console.log(error); - // expected output: SyntaxError: unterminated string literal - // Note - error messages will vary depending on browser - } - - -} - -function generate_codereading_content(lines,self_annos,fileid,annos_count,issues_count,questions_count,issues,language){ - var htmlstr = '
' - for(linenum in lines){ - line = lines[linenum] - // 如果当前行有注释,则先生成注释行 - if(linenum in self_annos){ - htmlstr += generate_codereading_anno_line(fileid,linenum,self_annos) - } - // 无论当前行是否有注释,都应该生成代码行 - htmlstr += generate_codereading_line(fileid,linenum,annos_count,issues_count,questions_count,line,issues,language) - } - htmlstr += '
' - return htmlstr -} - -function generate_codereading_anno_line(file_id,linenum,self_annos){ - var htmlstr = '' - htmlstr += '
' - htmlstr += '
' - htmlstr += '
' - htmlstr += self_annos[linenum] - htmlstr += '
' - htmlstr += '
' - htmlstr += '
' - htmlstr += '
' - return htmlstr -} - -function generate_codereading_line(fileid,linenum,annos_count,issues_count,questions_count,line,issues,language){ - var htmlstr = '
' - htmlstr += generate_codereading_linenum_and_codeline(linenum,line,language,fileid) - htmlstr += generate_codereading_linestatus(fileid,linenum,annos_count,issues_count,questions_count,issues) - htmlstr += '
' - return htmlstr -} - -function add_hrefTag_into_line(line,file_id,line_num){ - var regex = /\w+\(/g - var strs = line.match(regex) - if(strs!=null){ - for(var i=0;i'+function_name+"" - var replace_str = ''+search_symbol_str+'(' - line=line.replace(strs[i],replace_str) - } - - return line - } - return line -} - - -function generate_codereading_linenum_and_codeline(linenum,line,language,file_id){ - var line= add_hrefTag_into_line(line,file_id,linenum) - var htmlstr = '' - htmlstr += '
' - htmlstr += linenum.toString() - htmlstr += '
' - htmlstr += '
' - htmlstr += '
'
-    htmlstr +=          ''
-    htmlstr +=          line
-    htmlstr +=          ''
-    htmlstr +=      '
' - htmlstr += '
' - return htmlstr -} - - - -function newshow_currentLine(fileid,linenum){ - $("#"+fileid+"_L"+linenum+">"+".sourcecode").css("background","#323438"); -} - -function newhide_currentLine(fileid,linenum){ - $("#"+fileid+"_L"+linenum+">"+".sourcecode").css("background","#23241f"); -} -function generate_codereading_linestatus(fileid,linenum,annos_count,issues_count,questions_count,issues){ - var htmlstr = '' - - htmlstr += '
' - htmlstr += '' - if(linenum in annos_count){ - htmlstr += '' - } - htmlstr += '' - htmlstr += '' - if(linenum in questions_count){ - htmlstr += '' - } - else if(linenum in issues_count){ - htmlstr += '' - } - htmlstr += '' - htmlstr += '' - htmlstr += '' - htmlstr += '' - htmlstr += '
' - return htmlstr - - // onmouseover="show_currentLine(\''+fileid+'_'+linenum+'\')" onmouseout="hide_currentLine(\''+fileid+'_'+linenum+'\')" -} - -// 添加一个新的标签页, -// 如果标签页不存在,则创建一个新的标签页,然后调用open_tab -// 如果标签页已经存在,则打开对应的标签页 -// 并调用open_tab -function get_path_link_and_archor(path){ - tmp_index = path.indexOf("#"); - if(tmp_index != -1){ - path_after = path.substring(0,tmp_index) - archor = path.substring(tmp_index) - return [path_after,archor] - } - return [path,null] -} - -function add_tab(project_id,path,filename) { - - // var tree_node = $("#jstree").jstree("get_selected"); - var path_before = path - //需要将path处理一下,因为css样式中/以及.是不行的 - // tmp_index = path.indexOf("#"); - // if(tmp_index != -1){ - // path = path.substring(0,tmp_index) - // } - var returnValue = get_path_link_and_archor(path) - var path_after = returnValue[0] - var archor = returnValue[1] - - path = path_predeal(path_after) - if (tabSet.has(path)) { - open_tab(path_after,archor) - } else { - var tab_tag = document.getElementsByClassName("tab_head")[0]; - //添加tab - /*
  • - NoteWidgetProvider.java - × -
  • */ - var li_tab_item = document.createElement("li") - li_tab_item.className = "tab_item"; - li_tab_item.id = "tab_" + path; - - var tag_a1 = document.createElement("a"); - tag_a1.href ="javascript:void(0)"; - - // filename也要进行判断 - tmp_index = filename.indexOf("#"); - if(tmp_index != -1){ - filename = filename.substring(0,tmp_index) - } - tag_a1.textContent = filename - tag_a1.onclick = (function () { - return function () { - open_tab(path_after,null); - } - })(); - - var tag_a2 = document.createElement("a") - tag_a2.href = "javascript:void(0)"; - tag_a2.textContent = '×' - tag_a2.onclick = (function () { - return function () { - close_tab(path_after); - } - })(); - - - li_tab_item.appendChild(tag_a1) - li_tab_item.appendChild(tag_a2) - tab_tag.appendChild(li_tab_item) - - // 添加对应的code-reading的Element - var div_code = document.getElementsByClassName("code_Area")[0] - var div_codereading = document.createElement("div") - - div_codereading.id = "code_" + path; - div_codereading.className = "codereading"; - // div_codereading.style.overflowY="auto"; - div_code.appendChild(div_codereading) - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/right/', - data: { 'project_id': project_id, 'path': path_after}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - right_map[path] = data.html_str; - $("#right_panel").html(right_map[path]); - } - else { - right_map[path] = "" - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/get_codereading_content/', - data: { 'project_id': project_id, 'path': path_after }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - - success: function (data) { - if (data.status === 'success') { - // 获取code-reading的内容,并填充到对应的code-reading的Element - - if(data.is_dir=="0"){ - var content = generate_codereading_content(data.lines,data.self_annos,data.fileid,data.annos_count,data.issues_count,data.questions_count,data.issues,data.language) - div_codereading.innerHTML = content; - open_tab(path_after,archor); - - hljs.configure({useBR: false}); - // hljs.highlightBlock(div_codereading) - $('#code_'+path+' pre code').each(function(i, block) { - hljs.highlightBlock(block); - }); - // .each(function(i, block) { - // hljs.highlightBlock(block); - // }); - }else{ - var content = data.html_str - div_codereading.innerHTML = content; - open_tab(path_after,archor); - } - - // 如果包含# - // tmp_index = path_before.indexOf("#"); - // if(tmp_index != -1){ - // var hash = path_before.substring(tmp_index) - // } - // console.log(hash) - // location.hash=hash - } - else { - div_codereading.innerHTML = ""; - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - - open_tab(path_after,archor); - - // 现在Hotest Question 模块先不用了 - // // 填充hotest_question - // $.ajax({ - // cache: false, - // type: "POST", - // url: '/operations/get_hotest_issues/', - // data: { 'project_id': project_id, 'path': path_after,"question_num":5 }, - // dataType: 'json', - // async: true, - // beforeSend: function (xhr, settings) { - // xhr.setRequestHeader("X-CSRFToken", csrftoken); - // }, - // success: function (data) { - // if (data.status === 'success') { - // issue_map[path] = data.html_str; - // } - // else { - // issue_map[path] = "" - // } - // } - // }); - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/get_jstree_id/', - data: { 'project_id': project_id, 'path': path_after}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - var tree_node = data.jstree_id - tree_nodes[path]=tree_node - $('#jstree').jstree("deselect_all", true); - $('#jstree').jstree("select_node", tree_nodes[path]); - setTimeout(function timer() { - var offsettop=$("#"+tree_nodes[path]).position().top; - console.log(offsettop) - $("#filelist-content").scrollTop(offsettop); - },500) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - - tabSet.add(path); - } -} -// 这里也可以更改为item,传入this -function close_tab(path) { - // 将当前的当前Element的父节点isplay:none - // 将对应的code-reading区域设置为display:none - path = path_predeal(path) - - var element = document.getElementById("tab_" + path); - var previosuElement = element.previousElementSibling; - var nextElement = element.nextElementSibling; - - document.getElementById("code_" + path).remove() - element.remove() - tabSet.delete(path) - - // 如果该标签页有上一个标签,将此标签的上一个标签页打开 - if (previosuElement != undefined) { - var path = previosuElement.id.substr(4); - open_tab(path,null) - return; - } - // 如果该标签页有下一个兄弟标签,将此标签的下一个标签页打开 - if (nextElement != undefined) { - var path = nextElement.id.substr(4); - open_tab(path,null); - return; - } -} - -// 对应目录级别的addnoPanel -function show_next_addnoPanel(file_id){ - - var oldfile_id= Number(getlocalStorage("rightannotationid")); - var olditem_value=getlocalStorage("rightannotationvalue"); - - $("#addno-panel-"+file_id).show(); - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation() - - if(file_id===oldfile_id){ - $("#addno-text-"+file_id+"-0").val(olditem_value); - } - $("#addno-panel-"+file_id).draggable(); -} - -function Input_Content(item,file_id,line_num) { - var status_value= getlocalStorage("status_value"); - if(status_value==="注释"||!status_value){ - setlocalStorage("item_value",item.value); - setlocalStorage("file_id",file_id); - setlocalStorage("line_num",line_num); - }else if(status_value==="问题"){ - setlocalStorage("issueitem_value",item.value); - setlocalStorage("issuefile_id",file_id); - setlocalStorage("issueline_num",line_num); - } - -} - -function Input_modifyAnno(item,file_id,line_num,row){ - setlocalStorage("modifyAnno_value",item.value); - setlocalStorage("modifyAnno_id",file_id); - setlocalStorage("modifyAnno_num",line_num); - setlocalStorage("modifyAnno_line",row); - -} - -function Input_writetext(item,annopk){ - setlocalStorage("writetext_value",item.value); - setlocalStorage("writetext_id",annopk); -} - - -function addannotation(id,num){ - setlocalStorage("status_value","注释"); - var oldfile_id= Number(getlocalStorage("file_id")); - var oldline_num=Number(getlocalStorage("line_num")); - var olditem_value=getlocalStorage("item_value"); - $("#addno-text-"+id+"-"+num).val(" "); - if(oldfile_id!=null){ - if(id===oldfile_id&&num===oldline_num){ - $("#addno-text-"+oldfile_id+"-"+oldline_num).val(olditem_value); - } - } - -} -function addissue(id,num) { - setlocalStorage("status_value","问题"); - var oldline_num= Number(getlocalStorage("issueline_num")); - var oldfile_id=Number(getlocalStorage("issuefile_id")); - var olditem_value=getlocalStorage("issueitem_value"); - $("#addno-text-"+id+"-"+num).val(" "); - if(oldfile_id!=null){ - if(id===oldfile_id&&num===oldline_num){ - $("#addno-text-"+oldfile_id+"-"+oldline_num).val(olditem_value); - } - } - -} -function rightaddannotation(id,num){ - setlocalStorage("rightstatus_value","注释"); - var oldfile_id= Number(getlocalStorage("rightannotationid")); - var oldline_num=Number(getlocalStorage("rightannotationnum")); - var olditem_value=getlocalStorage("rightannotationvalue"); - $("#addno-text-"+id+"-"+num).val(" "); - if(oldfile_id!=null){ - if(id===oldfile_id&&num===oldline_num){ - $("#addno-text-"+id+"-"+num).val(olditem_value); - } - } - -} -function rightaddissue(id,num) { - setlocalStorage("rightstatus_value","问题"); - var oldline_num= Number(getlocalStorage("righissuenum")); - var oldfile_id=Number(getlocalStorage("righissuevid")); - var olditem_value=getlocalStorage("righissuevalue"); - $("#addno-text-"+id+"-"+num).val(" "); - if(oldfile_id!=null){ - if(id===oldfile_id&&num===oldline_num){ - $("#addno-text-"+id+"-"+num).val(olditem_value); - } - } - -} - -function Input_file(item,file_id,line_num){ - var status_value= getlocalStorage("rightstatus_value"); - if(status_value==="注释"||!status_value){ - setlocalStorage("rightannotationvalue",item.value); - setlocalStorage("rightannotationid",file_id); - setlocalStorage("rightannotationnum",line_num); - }else if(status_value==="问题"){ - setlocalStorage("righissuevalue",item.value); - setlocalStorage("righissuevid",file_id); - setlocalStorage("righissuenum",line_num); - } - -} -//注入html代码 -function inject_addnoPanel_html(item,file_id,linenum) { - $(".source-addno-panel").remove(); - var status_value= getlocalStorage("status_value"); - - var oldfile_id= Number(getlocalStorage("file_id")); - var oldline_num=Number(getlocalStorage("line_num")); - var olditem_value=getlocalStorage("item_value"); - - - $("#ItemcommentPanel").remove(); - $("#ItemquestionPanel").remove(); - - html_str = '
    '+ - '
    '+ - '
    '+ - '
    为该行或该代码块添加注释或者提问:
    '+ - '

    '+ - '注释'+ - '问题'+ - '

    '+ - ''+ - '提交'+ - '
    '+ - '
    '; - $(item).after(html_str) - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - ev.stopPropagation(); - if(file_id===oldfile_id&&linenum===oldline_num){ - $("#addno-text-"+file_id+"-"+linenum).val(olditem_value); - } - $( "#addno-panelsource-addno-panel" ).draggable(); -} - - - - -function add_dir_annotation(item, file_id, line_num){ - // 获取当前是注释还是问题 - var selectValue = $(item).siblings(".put-select").find(".active").html().trim(); - var text_context = "#addno-text-" + file_id + "-" + line_num; - var content = $(text_context).val(); - - if (content.trim().length == 0) { - alert("内容不能为空") - return; - } - if (selectValue == "注释") { - // 向addAnnatation中发请求 - submit_dir_annotation(file_id, line_num, content); - } else { - submit_dir_question(file_id, line_num, content); - } -} - -function show_dir_annotation(file_id){ - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev); - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_annotation/', - data: { 'file_id': file_id, 'line_num': 0 }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === "success") { - //console.log("linestatus_"+line_num); - //$("#loadCommentpanel").html(data.html_str); - //$("#commentPanel").css("top", mousePos.y); - //$("#commentPanel").css("left", mousePos.x+35); - //$("#loadCommentpanel").show(); - //console.log(data.html_str); - $("#ItemcommentPanel").remove() - var html="
    "+data.html_str+"
    " - $("#dir_anno_"+file_id).append(html); - }else{ - alert(data.msg) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function show_dir_issue_question(file_id){ - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev) - //发送问题id,返回问题内容 - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_issue_question/', - data: { 'file_id': file_id, 'line_num': 0, 'issue_ids': "[]"}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if(data.status=='success'){ - var html="
    "+data.html_str+"
    "; - $("#dir_question_"+file_id).append(html); -// $("#loadQuestionpanel").html(data.html_str); - if (data.issueAnswers) { - //字符串转换成整型数组 - var dataStrArr = issueid_str.substring(1, issueid_str.length - 1).split(",") - var issue_ids = dataStrArr.map(function (data) { - return +data; - }); - // - issueAnswers = JSON.parse(data.issueAnswers); - issueStandardAnswers = JSON.parse(data.issueStandardAnswers); - - let count = 0; - for (let i = 0; i < issue_ids.length; i++) { - issue_id = issue_ids[i] - - if (issue_id == issueAnswers[count].fields.issue) { - var radios = document.getElementsByName("issue_" + issue_id) - user_answer = issueAnswers[0].fields.content; - standard_answer = issueStandardAnswers[0].fields.choice_position; - if (user_answer == standard_answer) { - radios[user_answer - 1].parentNode.style.color = "green"; - } else { - radios[parseInt(user_answer) - 1].parentNode.style.color = "red"; - radios[parseInt(standard_answer) - 1].parentNode.style.color = "green"; - } - document.getElementById("submit_onechoice_" + issue_id).style.display = "None"; - count = count + 1 - } - } - } - //$("#questionPanel").css("top", mousePos.y); - //$("#questionPanel").css("left", mousePos.x - 400); - //$("#loadQuestionpanel").show(); - }else{ - alert(data.msg) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function submit_dir_annotation(file_id, line_num, content) { - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_annotation/', - data: { 'file_id': file_id, 'linenum': line_num, 'content': content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - var value = $("#dir_anno_" + file_id).html() - if (value.trim().length == 0) { - $("#dir_anno_" + +file_id).html(1); - }else{ - $("#dir_anno_" + +file_id).html(parseInt(value) + 1); - } - } - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - show_dir_annotation(file_id); - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - - -function submit_dir_question(file_id, line_num, content) { - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_question/', - data: { 'file_id': file_id, 'linenum': line_num, 'content': content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - var value = $("#dir_question_" + file_id).html() - if (value.trim().length == 0) { - $("#dir_question_" + +file_id).html(1); - } else { - $("#dir_question_" + +file_id).html(parseInt(value) + 1); - } - } - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - show_dir_issue_question(file_id); - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -// 这下面5个函数,与上面dir的区别就是: -// 上面的针对文件夹,margin-top是70px的, -// 下面的针对文件,margin-top是140px的,仅此而已 -function add_file_annotation(item, file_id, line_num){ - // 获取当前是注释还是问题 - var selectValue = $(item).siblings(".put-select").find(".active").html().trim(); - var text_context = "#addno-text-" + file_id + "-" + line_num; - var content = $(text_context).val(); - - if (content.trim().length == 0) { - alert("内容不能为空") - return; - } - if (selectValue == "注释") { - // 向addAnnatation中发请求 - submit_file_annotation(file_id, line_num, content); - deletelocalStorage("rightannotationid"); - deletelocalStorage("rightannotationnum"); - deletelocalStorage("rightannotationvalue"); - deletelocalStorage("rightstatus_value"); - } else { - submit_file_question(file_id, line_num, content); - alert(1) - deletelocalStorage("righissuevid"); - deletelocalStorage("righissuenum"); - deletelocalStorage("righissuevalue"); - deletelocalStorage("rightstatus_value"); - } -} - -function show_file_annotation(file_id){ - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev); - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_annotation/', - data: { 'file_id': file_id, 'line_num': 0 }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === "success") { - - $("#ItemcommentPanel").remove() - var html="
    "+data.html_str+"
    " - $("#dir_anno_"+file_id).append(html); - $( "#ItemcommentPanel" ).draggable(); - }else{ - alert(data.msg) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function show_file_issue_question(file_id){ - ev = window.event; - if(ev==undefined){ - ev=arguments.callee.caller.arguments[0]||window.event; - } - var mousePos = mouseCoords(ev) - //发送问题id,返回问题内容 - $.ajax({ - cache: false, - type: "POST", - url: '/operations/show_issue_question/', - data: { 'file_id': file_id, 'line_num': 0, 'issue_ids': "[]"}, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if(data.status=='success'){ - var html="
    "+data.html_str+"
    "; - $("#dir_question_"+file_id).append(html); -// $("#loadQuestionpanel").html(data.html_str); - if (data.issueAnswers) { - //字符串转换成整型数组 - var dataStrArr = issueid_str.substring(1, issueid_str.length - 1).split(",") - var issue_ids = dataStrArr.map(function (data) { - return +data; - }); - // - issueAnswers = JSON.parse(data.issueAnswers); - issueStandardAnswers = JSON.parse(data.issueStandardAnswers); - - let count = 0; - for (let i = 0; i < issue_ids.length; i++) { - issue_id = issue_ids[i] - - if (issue_id == issueAnswers[count].fields.issue) { - var radios = document.getElementsByName("issue_" + issue_id) - user_answer = issueAnswers[0].fields.content; - standard_answer = issueStandardAnswers[0].fields.choice_position; - if (user_answer == standard_answer) { - radios[user_answer - 1].parentNode.style.color = "green"; - } else { - radios[parseInt(user_answer) - 1].parentNode.style.color = "red"; - radios[parseInt(standard_answer) - 1].parentNode.style.color = "green"; - } - document.getElementById("submit_onechoice_" + issue_id).style.display = "None"; - count = count + 1 - } - } - } - //$("#questionPanel").css("top", mousePos.y); - //$("#questionPanel").css("left", mousePos.x - 400); - //$("#loadQuestionpanel").show(); - $( "#ItemquestionPanel" ).draggable(); - }else{ - alert(data.msg) - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - -function submit_file_annotation(file_id, line_num, content) { - - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_annotation/', - data: { 'file_id': file_id, 'linenum': line_num, 'content': content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - show_file_annotation(file_id); - }else{ - alert(data.msg) - } - - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - - -function submit_file_question(file_id, line_num, content) { - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_question/', - data: { 'file_id': file_id, 'linenum': line_num, 'content': content }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - var value = $("#dir_question_" + file_id).html() - if (value.trim().length == 0) { - $("#dir_question_" + +file_id).html(1); - } else { - $("#dir_question_" + +file_id).html(parseInt(value) + 1); - } - } - $(".addno-panel").hide(); - $(".source-addno-panel").remove(); - show_file_issue_question(file_id); - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -} - - -function make_button_disable(item){ - item.removeAttr("onclick"); - item.attr('disabled',true); -} - -function make_button_able(item,function_name){ - item.attr('disabled',false); - item.attr("onclick",function_name); -} - -function thumbsAnno(item,anno_id,vote_value) { - // 获取当前的vote - function_name = "thumbsAnno(this"+","+anno_id+","+vote_value+")" - make_button_disable($(item)) - - vote_tag = $("#annosum_"+anno_id) - vote_before = parseInt(vote_tag.text()) - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_vote/', - data: { 'vote_type': "annotation", 'object_id': anno_id, 'vote_value': vote_value }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - vote_now = vote_before + parseInt( data.value) - vote_tag.text(vote_now) - deal_votetag_color(vote_tag,data.msg,vote_value) - }else{ - alert(data.msg); - } - make_button_able($(item),function_name) - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - // 更改当前的vote,默认+1 -} - -function thumbsComment(item,comment_id,vote_value) { - function_name = "thumbsComment(this"+","+comment_id+","+vote_value+")" - make_button_disable($(item)) - // 获取当前的vote - vote_tag = $("#comment_"+comment_id) - vote_before = parseInt(vote_tag.text()) - $.ajax({ - cache: false, - type: "POST", - url: '/operations/add_vote/', - data: { 'vote_type': "annotation_comment", 'object_id': comment_id, 'vote_value': vote_value }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status == 'success') { - vote_now = vote_before + parseInt( data.value) - vote_tag.text(vote_now) - deal_votetag_color(vote_tag,data.msg,vote_value) - // } - }else{ - alert(data.msg); - } - make_button_able($(item),function_name) - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); - // 更改当前的vote,默认+1 -} - -// - -function deal_votetag_color(vote_tag,msg,vote_value){ - if(msg=='cancel success'){ - // 那么将颜色都变为正常 - vote_tag.parent().prev().children().removeClass("thumbs_active") - vote_tag.parent().next().children().removeClass("thumbs_active") - }else{ - //把一个变为正常,另一个变为红色 - if(vote_value==1){ - vote_tag.parent().prev().children().addClass("thumbs_active") - vote_tag.parent().next().children().removeClass("thumbs_active") - }else{ - vote_tag.parent().prev().children().removeClass("thumbs_active") - vote_tag.parent().next().children().addClass("thumbs_active") - } - } -} -$(function(){ - url = window.location.href; - $('#jstree').jstree(); - $("#jstree").jstree("open_node", $("#j1_1")); - $("#jstree").css("visibility","visible"); - $.ajax({ - cache: false, - type: "POST", - url: '/operations/get_addtab_paras/', - data: { 'url': url }, - dataType: 'json', - async: true, - beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-CSRFToken", csrftoken); - }, - success: function (data) { - if (data.status === 'success') { - // 展开当前标签对应的节点 - $('#jstree').jstree("deselect_all", true); - $('#jstree').jstree("select_node", "j1_1355554"); - // 第一个标签页对应的id,保存在first_tabs_jstree_id中 - - // var first_tabs_jstree_id = data.first_tabs_jstree_id - - //需要将path处理一下,因为css样式中/以及.是不行的 - // var returnValue = get_path_link_and_archor(path) - // var path_input = returnValue[0] - // var archor = returnValue[1] - - // path_after = path_predeal(path_input) - // 加入tree_nodes中 - // tree_nodes[path_after] = first_tabs_jstree_id - - project_id=data.project_id - path = data.path - filename = data.filename - - - url_deal(get_path_link_and_archor(path)[0],null) - add_tab(data.project_id, data.path, data.filename) - // 特殊处理,因为add_tab的逻辑会影响tree_nodes(),所以进行了处理 - // tree_nodes[path_after] = first_tabs_jstree_id - } - },error:function(jqXHR, textStatus, errorThrown){ - if(jqXHR.readyState===0&&jqXHR.status===0){ - alert('网络故障,提交失败!请联网后重新提交'); - } - } - }); -}) - -// window.onload=function(){ -// var a=$(".jstree-node").attr("aria-selected"); -// var b=$(".jstree-anchor"); -// for(var i = 0; i {% comment %} 您可见{{ annos|length }}个注释 {% endcomment %} - 该代码文件共有{{ annotation_length }}个注释,比赛结束后全部可见 + 该代码文件共有{{ annotation_length }}个注释

    {% endif %} {% if isdir == 1 %}

    - 该代码模块共有{{ annotation_length }}个注释,比赛结束后全部可见 + 该代码模块共有{{ annotation_length }}个注释

    {% endif %} {% else %}

    - 该行或该代码块共有{{annotation_length}}个注释,比赛结束后全部可见 + 该行或该代码块共有{{annotation_length}}个注释

    {% endif %} diff --git a/templates/projects/filesub/file-right.html b/templates/projects/filesub/file-right.html index 76067f6..7e2b251 100644 --- a/templates/projects/filesub/file-right.html +++ b/templates/projects/filesub/file-right.html @@ -4,22 +4,22 @@

    Module Summary

    - Project Url: + Project: {{project_url}}

    - Module Path: + Module: {{path}}

    {% else %}

    File Summary

    - Project Url: + Project: {{project_url}}

    - File Path: + File: {{path}}

    {% endif %} @@ -78,7 +78,7 @@
    -
    +{#
    #}
    {% if isdir %}
    为该代码模块添加注释或者提问:
    diff --git a/templates/projects/filesub/login.html b/templates/projects/filesub/login.html index 5d1650d..a7bcd3f 100644 --- a/templates/projects/filesub/login.html +++ b/templates/projects/filesub/login.html @@ -16,26 +16,26 @@ 个人记录
      -
    • - 提交代码 +
    • + 提交代码 +
    • +
    • + 我的问题 +
    • +
    • + 我的回答
    • - 我的问题 + 我的注释
    • -
    • - 我的回答 +
    • + 我的评论
    • -
    • - 我的注释 +
    • + 我的点赞
    • -
    • - 我的评论 -
    • -
    • - 我的点赞 -
    • -
    • - 我的点踩 +
    • + 我的点踩
    • 退出 diff --git a/templates/projects/filesub/search-response.html b/templates/projects/filesub/search-response.html index 2911906..329f9cf 100644 --- a/templates/projects/filesub/search-response.html +++ b/templates/projects/filesub/search-response.html @@ -1,8 +1,8 @@ -

      候选跳转函数(请在跳转确认后,在正确跳转后面打钩;点击右上角可以关闭候选函数)

      +

      候选跳转函数(请帮忙反馈正确的跳转候选,在正确跳转函数后面打钩)

      {% if results|length == 0 %} -
      +
      未找到候选跳转函数
      {% else %} {% for item in results %} @@ -10,8 +10,8 @@ {{ forloop.counter }}. {{ item.2|safe }} {{ item.3|safe }} -
      -
      +
      +
      {% endfor %} diff --git a/templates/projects/source.html b/templates/projects/source.html index a7def61..3f28bcb 100644 --- a/templates/projects/source.html +++ b/templates/projects/source.html @@ -210,7 +210,7 @@ steplist.newGuidStep("#codepanel","4.打开项目代码文件:","{% static 'css/img/4.png' %}"); steplist.newGuidStep("#codepanel","5.为代码文件添加标注:","{% static 'css/img/5.png' %}"); steplist.newGuidStep("#codepanel","6.为代码行/块添加标注:","{% static 'css/img/6.png' %}"); - steplist.newGuidStep("#codepanel","7.点击下面链接查看代码标注范例:",[{code:"C++ - TensorFlow/.../tensor_slice.cc",codepath:"http://120.132.101.149/projects/tensorflow/tensorflow/core/framework/tensor_slice.cc#"},{code:"Java - Hadoop/.../Mapper.java",codepath:"http://120.132.101.149/projects/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Mapper.java#"},{code:" Python - Nova/.../db.py",codepath:"http://120.132.101.149/projects/OpenStack-nova/nova/servicegroup/drivers/db.py#"}]); + steplist.newGuidStep("#codepanel","7.点击下面链接查看代码标注范例:(如果进入标注后项目结构等显示不正常,请Ctr+Shift+Delete 清除浏览器缓存后刷新页面即可,后续可以通过点击页面右上方的help链接可随时查看标注使用提示:",[{code:"C++ - TensorFlow/.../tensor_slice.cc",codepath:"http://120.132.101.149/projects/tensorflow/tensorflow/core/framework/tensor_slice.cc#"},{code:"Java - Hadoop/.../Mapper.java",codepath:"http://120.132.101.149/projects/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Mapper.java#"},{code:" Python - Nova/.../db.py",codepath:"http://120.132.101.149/projects/OpenStack-nova/nova/servicegroup/drivers/db.py#"}]); steplist.startGuide(); } }); @@ -254,7 +254,7 @@ steplist.newGuidStep("#codepanel","4.打开项目代码文件:","{% static 'css/img/4.png' %}"); steplist.newGuidStep("#codepanel","5.为代码文件添加标注:","{% static 'css/img/5.png' %}"); steplist.newGuidStep("#codepanel","6.为代码行/块添加标注:","{% static 'css/img/6.png' %}"); - steplist.newGuidStep("#codepanel","7.点击下面链接查看代码标注范例:",[ + steplist.newGuidStep("#codepanel","7.点击下面链接查看代码标注范例:(如果进入标注后项目结构等显示不正常,请Ctr+Shift+Delete 清除浏览器缓存后刷新页面即可,后续可以通过点击页面右上方的help链接可随时查看标注使用提示)",[ {code:"C++ - TensorFlow/.../tensor_slice.cc",codepath:"http://120.132.101.149/projects/tensorflow/tensorflow/core/framework/tensor_slice.cc#"}, {code:"Java - Hadoop/.../Mapper.java",codepath:"http://120.132.101.149/projects/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Mapper.java#"}, {code:" Python - Nova/.../db.py",codepath:"http://120.132.101.149/projects/OpenStack-nova/nova/servicegroup/drivers/db.py#"} diff --git a/templates/shared/navbar.html b/templates/shared/navbar.html index 66574bf..afc6297 100755 --- a/templates/shared/navbar.html +++ b/templates/shared/navbar.html @@ -42,14 +42,14 @@
    • {% else %}