1.目录的自动展开。

2.弹窗增加右上角的关闭按钮。
3.弹窗增加点击正确和错误的按钮
4.下划线调整与代码增加距离
This commit is contained in:
杨树明775174143 2018-09-04 15:16:57 +08:00
parent 2cf7e1ab9a
commit 90e38ad4ea
4 changed files with 86 additions and 33 deletions

View File

@ -81,20 +81,21 @@ p, input, table {
} }
a { a {
text-decoration: none; text-decoration: none !important;
color: #000; color: #000;
} }
.code_Area a{ .code_Area a{
text-decoration: underline; color: white;
color: white
} }
a:hover { a:hover {
color: #33A6D6; color: #33A6D6;
text-decoration: underline; padding-bottom: 2px;
border-bottom: 1px solid #33A6D6;
display: inline-block;
} }
.font-12 { .font-12 {
font-size: 12px!important; font-size: 12px!important;
} }
@ -1640,4 +1641,30 @@ animation: myfirst 10s;
-moz-animation: myfirst 10s; /* Firefox */ -moz-animation: myfirst 10s; /* Firefox */
-webkit-animation: myfirst 10s; /* Safari 和 Chrome */ -webkit-animation: myfirst 10s; /* Safari 和 Chrome */
-o-animation: myfirst 10s; /* Opera */ -o-animation: myfirst 10s; /* Opera */
}
.closeX{
color: #FFF;
font-size: 12px;
position: absolute;
z-index: 20000;
right: -18px;
top: -24px;
border: 1px solid #FFF;
border-radius: 50%;
width: 20px;
height: 20px;
text-align: center;
line-height: 17px;
}
.FontFatimes{
color:#000;
font-size:16px;
margin-left:10px;
cursor: pointer;
}
.FontFaCheck{
color:cornflowerblue;
font-size:16px;
margin-left:10px;
cursor: pointer;
} }

View File

@ -57,8 +57,8 @@ function close_modify_anno(){
$("#modification").show(); $("#modification").show();
$(".modify_anno_div").remove(); $(".modify_anno_div").remove();
$("#modify_anno_textarea").attr("readonly","readonly") $("#modify_anno_textarea").attr("readonly","readonly")
ev = window.event; ev = window.event;
if(ev==undefined){ if(ev==undefined){
ev=arguments.callee.caller.arguments[0]||window.event; ev=arguments.callee.caller.arguments[0]||window.event;
@ -72,7 +72,7 @@ function inject_modifyAnno_html(item,file_id,linenum,anno_id) {
$(".modify_anno_div").remove(); $(".modify_anno_div").remove();
$("#modify_anno_textarea").removeAttr("readonly"); $("#modify_anno_textarea").removeAttr("readonly");
$("#modify_anno_textarea").focus() $("#modify_anno_textarea").focus()
html_str = '<div class="modify_anno_div" style="display:block">'+ html_str = '<div class="modify_anno_div" style="display:block">'+
'<a href="javascript:void(0)" onclick="close_modify_anno()" class="btn fr mt10 mb10">取消</a>'+ '<a href="javascript:void(0)" onclick="close_modify_anno()" class="btn fr mt10 mb10">取消</a>'+
'<a href="javascript:void(0)" onclick="modify_anno('+file_id+','+linenum+','+anno_id+')" class="btn btn-blue fr mt10 mb10 mr10">提交</a>'+ '<a href="javascript:void(0)" onclick="modify_anno('+file_id+','+linenum+','+anno_id+')" class="btn btn-blue fr mt10 mb10 mr10">提交</a>'+
@ -314,7 +314,7 @@ function add_annotation(item,file_id, line_num) {
if (selectValue == "注释") { if (selectValue == "注释") {
// 向addAnnatation中发请求 // 向addAnnatation中发请求
submit_annotation(file_id, line_num, content); submit_annotation(file_id, line_num, content);
} else { } else {
submit_question(file_id, line_num, content); submit_question(file_id, line_num, content);
} }
@ -393,6 +393,10 @@ function submit_question(file_id, line_num, content) {
}); });
} }
function closeX_search(){
$("#search_response").hide();
}
function search_symbol(args) { function search_symbol(args) {
// ev = window.event // ev = window.event
@ -413,17 +417,34 @@ function search_symbol(args) {
xhr.setRequestHeader("X-CSRFToken", csrftoken); xhr.setRequestHeader("X-CSRFToken", csrftoken);
}, },
success: function (data) { success: function (data) {
console.log(data.html_str);
if (data.status === 'success') { if (data.status === 'success') {
// console.log(context); // console.log(context);
$("#search_response").css("top", mousePos.y); $("#search_response").css("top", 400);
$("#search_response").css("left", mousePos.x); $("#search_response").css("left", mousePos.x);
$("#search_response").html(data.html_str); $(".search-title").remove();
$(".resultform").remove();
$("#search_response").append(data.html_str);
$("#search_response").show(); $("#search_response").show();
ev.stopPropagation(); ev.stopPropagation();
} }
} }
}); });
} }
function onClick_FeedbackButton(key) {
if(key==1){
//key =1 正确路径
console.log(key)
}else{
//key=0 错误路径
console.log(key)
}
}
navigation_map = new Map() navigation_map = new Map()
@ -471,7 +492,7 @@ function show_navigation() {
str += "<a class='def' href='#"+file_id+"_L" + linenum + "'>" + name + "</a>"; str += "<a class='def' href='#"+file_id+"_L" + linenum + "'>" + name + "</a>";
str += "</li></ul>" str += "</li></ul>"
} }
str += "</li></ul>" str += "</li></ul>"
content += str; content += str;
} }
@ -492,8 +513,8 @@ function show_navigation() {
function deal_for_navigation_tree(){ function deal_for_navigation_tree(){
$("#navigation_tree").jstree() $("#navigation_tree").jstree();
$("#navigation_tree").jstree().open_all() $("#navigation_tree").jstree().open_all();
$("#navigation_tree li").click(function(){ $("#navigation_tree li").click(function(){
location.href = $(this).find("a").attr("href"); location.href = $(this).find("a").attr("href");
}); });
@ -756,7 +777,7 @@ function generate_codereading_line(fileid,linenum,annos_count,issues_count,quest
htmlstr += generate_codereading_linestatus(fileid,linenum,annos_count,issues_count,questions_count,issues) htmlstr += generate_codereading_linestatus(fileid,linenum,annos_count,issues_count,questions_count,issues)
htmlstr += '</div>' htmlstr += '</div>'
return htmlstr return htmlstr
} }
function add_hrefTag_into_line(line,file_id){ function add_hrefTag_into_line(line,file_id){
var regex = /\w+\(/g var regex = /\w+\(/g
@ -768,16 +789,16 @@ function add_hrefTag_into_line(line,file_id){
var replace_str = '<a href="javascript:void(0)">'+search_symbol_str+'</a>(' var replace_str = '<a href="javascript:void(0)">'+search_symbol_str+'</a>('
line=line.replace(strs[i],replace_str) line=line.replace(strs[i],replace_str)
} }
return line return line
} }
return line return line
} }
function generate_codereading_linenum_and_codeline(linenum,line,language,file_id){ function generate_codereading_linenum_and_codeline(linenum,line,language,file_id){
var line= add_hrefTag_into_line(line,file_id) var line= add_hrefTag_into_line(line,file_id)
var htmlstr = '' var htmlstr = ''
htmlstr += '<div class="linenum">' htmlstr += '<div class="linenum">'
htmlstr += linenum.toString() htmlstr += linenum.toString()
htmlstr += '</div>' htmlstr += '</div>'
@ -792,14 +813,14 @@ function generate_codereading_linenum_and_codeline(linenum,line,language,file_id
} }
function generate_codereading_linestatus(fileid,linenum,annos_count,issues_count,questions_count,issues){ function generate_codereading_linestatus(fileid,linenum,annos_count,issues_count,questions_count,issues){
var htmlstr = '' var htmlstr = ''
htmlstr += '<div id="linestatus_'+fileid+'_'+linenum+'" class="linestatus">' htmlstr += '<div id="linestatus_'+fileid+'_'+linenum+'" class="linestatus">'
htmlstr += '<span class="codeopration" id="codeopration_anno_'+fileid+'_'+linenum+'">' htmlstr += '<span class="codeopration" id="codeopration_anno_'+fileid+'_'+linenum+'">'
if(linenum in annos_count){ if(linenum in annos_count){
htmlstr += '<span class="annonums" onclick="show_annotation('+fileid+','+linenum+')"></span>' htmlstr += '<span class="annonums" onclick="show_annotation('+fileid+','+linenum+')"></span>'
} }
htmlstr += '</span>' htmlstr += '</span>'
htmlstr += '<span class="codeopration" id="codeopration_question_'+fileid+'_'+linenum+'">' htmlstr += '<span class="codeopration" id="codeopration_question_'+fileid+'_'+linenum+'">'
if(linenum in questions_count){ if(linenum in questions_count){
htmlstr += '<span class="questionnums" onclick="show_issue_question('+fileid+','+linenum+',\'[]\')"></span>' htmlstr += '<span class="questionnums" onclick="show_issue_question('+fileid+','+linenum+',\'[]\')"></span>'
@ -807,12 +828,12 @@ function generate_codereading_linestatus(fileid,linenum,annos_count,issues_count
else if(linenum in issues_count){ else if(linenum in issues_count){
htmlstr += '<span class="questionnums" onclick="show_issue_question('+fileid+','+linenum+',\'['+issues[linenum]+']\')"></span>' htmlstr += '<span class="questionnums" onclick="show_issue_question('+fileid+','+linenum+',\'['+issues[linenum]+']\')"></span>'
} }
htmlstr += '</span>' htmlstr += '</span>'
htmlstr += '<span id="addanno_'+fileid+'_'+linenum+'" class="addanno" onclick="inject_addnoPanel_html(this,'+fileid+','+linenum+')">' htmlstr += '<span id="addanno_'+fileid+'_'+linenum+'" class="addanno" onclick="inject_addnoPanel_html(this,'+fileid+','+linenum+')">'
htmlstr += '<img src="/static/image/newadd.png" class="mr3 rightimgcommentblue">' htmlstr += '<img src="/static/image/newadd.png" class="mr3 rightimgcommentblue">'
htmlstr += '</span>' htmlstr += '</span>'
htmlstr += '</div>' htmlstr += '</div>'
return htmlstr return htmlstr
} }
// 添加一个新的标签页, // 添加一个新的标签页,
@ -820,7 +841,7 @@ function generate_codereading_linestatus(fileid,linenum,annos_count,issues_count
// 如果标签页已经存在,则打开对应的标签页 // 如果标签页已经存在,则打开对应的标签页
// 并调用open_tab // 并调用open_tab
function add_tab(project_id,path,filename) { function add_tab(project_id,path,filename) {
// var tree_node = $("#jstree").jstree("get_selected"); // var tree_node = $("#jstree").jstree("get_selected");
var path_before = path var path_before = path
//需要将path处理一下因为css样式中/以及.是不行的 //需要将path处理一下因为css样式中/以及.是不行的
@ -830,7 +851,7 @@ function add_tab(project_id,path,filename) {
} }
var path_input = path; var path_input = path;
path = path_predeal(path) path = path_predeal(path)
if (tabSet.has(path)) { if (tabSet.has(path)) {
open_tab(path_input) open_tab(path_input)
@ -1367,7 +1388,7 @@ function submit_file_annotation(file_id, line_num, content) {
}else{ }else{
alert(data.msg) alert(data.msg)
} }
} }
}); });
} }
@ -1477,6 +1498,7 @@ function deal_votetag_color(vote_tag,msg,vote_value){
$(function(){ $(function(){
url = window.location.href; url = window.location.href;
$('#jstree').jstree(); $('#jstree').jstree();
$("#jstree").jstree().open_all();
$("#jstree").css("visibility","visible"); $("#jstree").css("visibility","visible");
$.ajax({ $.ajax({
@ -1511,7 +1533,7 @@ $(function(){
project_id=data.project_id project_id=data.project_id
path = data.path path = data.path
filename = data.filename filename = data.filename
add_tab(data.project_id, data.path, data.filename) add_tab(data.project_id, data.path, data.filename)
// 特殊处理因为add_tab的逻辑会影响tree_nodes(),所以进行了处理 // 特殊处理因为add_tab的逻辑会影响tree_nodes(),所以进行了处理
tree_nodes[path_after] = first_tabs_jstree_id tree_nodes[path_after] = first_tabs_jstree_id

View File

@ -7,9 +7,12 @@
{% for item in results %} {% for item in results %}
<div class="result-line"> <div class="result-line">
<span class="fl">{{ forloop.counter }}. </span> <span class="fl">{{ forloop.counter }}. </span>
<a href="javascript:void(0)" class="re-path" title="{{item.2}}" onclick='add_tab({{project_id}},"{{item.1}}","{{item.0}}")'>{{ item.2|safe }} <a class="fl" href="javascript:void(0)" class="re-path" title="{{item.2}}" onclick='add_tab({{project_id}},"{{item.1}}","{{item.0}}")'>{{ item.2|safe }}</a>
<a href="javascript:void(0)" class="path-content" title="{{item.3}}" onclick='add_tab({{project_id}},"{{item.1}}","{{item.0}}")'>{{ item.3|safe }} <a class="fl" href="javascript:void(0)" class="path-content" title="{{item.3}}" onclick='add_tab({{project_id}},"{{item.1}}","{{item.0}}")'>{{ item.3|safe }}</a>
<div class="fr FontFatimes" onclick="onClick_FeedbackButton(0);"><i class="fa fa-times" aria-hidden="true"></i></div>
<div class="fr FontFaCheck" onclick="onClick_FeedbackButton(1);"><i class="fa fa-check" aria-hidden="true"></i></div>
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@ -53,8 +53,9 @@
</ul> </ul>
</div> </div>
<div id="search_response">
<div id="search_response"></div> <div class="closeX" onclick="closeX_search()">X</div>
</div>
<!-- <hr style="margin-top: 0px;margin-bottom: 0px;border-top: 2px solid #4B4B4B;" /> --> <!-- <hr style="margin-top: 0px;margin-bottom: 0px;border-top: 2px solid #4B4B4B;" /> -->