change the style of navigation area

This commit is contained in:
wrmswindmill 2018-08-15 10:57:02 +08:00
parent b51202b296
commit 68a1ee88fb
1 changed files with 23 additions and 4 deletions

View File

@ -413,6 +413,8 @@ function show_navigation() {
if( navigation_map.has(project_path+file_path)){ if( navigation_map.has(project_path+file_path)){
content = navigation_map.get(project_path + file_path); content = navigation_map.get(project_path + file_path);
$("#structure-context").html(content) $("#structure-context").html(content)
// 加载navigation_tree
deal_for_navigation_tree()
return; return;
} }
@ -443,7 +445,7 @@ function show_navigation() {
for (let j = 0; j < items.length; j++) { for (let j = 0; j < items.length; j++) {
var name = items[j][0]; var name = items[j][0];
var linenum = items[j][1]; var linenum = items[j][1];
str += "<ul><li>" str += "<ul><li data-jstree='{\"icon\":\"fa fa-file-code-o color-blue\"}'>"
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>"
} }
@ -454,7 +456,9 @@ function show_navigation() {
content += "</div>" content += "</div>"
// document.getElementById("annotation").style.display="block"; // document.getElementById("annotation").style.display="block";
navigation_map.set(project_path + file_path, content) navigation_map.set(project_path + file_path, content)
$("#structure-context").html(content) $("#structure-context").html(content);
// 加载navigation_tree
deal_for_navigation_tree()
} }
else { else {
navigation_map.set(project_path + file_path, "") navigation_map.set(project_path + file_path, "")
@ -464,6 +468,14 @@ function show_navigation() {
}); });
} }
function deal_for_navigation_tree(){
$("#navigation_tree").jstree()
$("#navigation_tree").jstree().open_all()
$("#navigation_tree li").click(function(){
location.href = $(this).find("a").attr("href");
});
}
function show_currentLine(linenum) { function show_currentLine(linenum) {
// document.getElementById("code_" + linenum).style.backgroundColor = '#f1efec'; // document.getElementById("code_" + linenum).style.backgroundColor = '#f1efec';
document.getElementById("addanno_" + linenum).style.visibility = 'visible'; document.getElementById("addanno_" + linenum).style.visibility = 'visible';
@ -1301,11 +1313,18 @@ window.onload = function () {
// $('#jstree').jstree("select_node", "j1_1355554"); // $('#jstree').jstree("select_node", "j1_1355554");
// 第一个标签页对应的id保存在first_tabs_jstree_id中 // 第一个标签页对应的id保存在first_tabs_jstree_id中
var first_tabs_jstree_id = $("#first_tabs_jstree_id").text() var first_tabs_jstree_id = $("#first_tabs_jstree_id").text()
path_after = path_predeal(data.path) //需要将path处理一下因为css样式中/以及.是不行的
path_input = data.path
tmp_index = path_input.indexOf("#");
if(tmp_index != -1){
path_input = path_input.substring(0,tmp_index)
}
path_after = path_predeal(path_input)
// 加入tree_nodes中
tree_nodes[path_after] = first_tabs_jstree_id tree_nodes[path_after] = first_tabs_jstree_id
add_tab(data.project_id, data.path, data.filename) add_tab(data.project_id, data.path, data.filename)
// 特殊处理因为add_tab的逻辑会影响tree_nodes(),所以进行了处理
tree_nodes[path_after] = first_tabs_jstree_id tree_nodes[path_after] = first_tabs_jstree_id
//
} }
} }
}); });