diff --git a/views/document/default_read.tpl b/views/document/default_read.tpl index 3219cf8e..32518318 100644 --- a/views/document/default_read.tpl +++ b/views/document/default_read.tpl @@ -88,6 +88,10 @@
目录 搜索 + + + 展开 +
@@ -290,6 +294,43 @@ $(function () { return $(body).highlight(window.keyword); }); }); + + window.menuControl = true; + window.menuSetting = "open" ; + if (menuSetting == 'open' || menuSetting == 'first') { + $('#handlerMenuShow').find('span').text('收起'); + $('#handlerMenuShow').find('i').attr("class","fa fa-angle-down"); + if (menuSetting == 'open') { + window.jsTree.jstree().open_all() + } + if (menuSetting == 'first') { + window.jsTree.jstree('close_all') + var $target = $('.jstree-container-ul').children('li').filter(function(index){ + if($(this).attr('aria-expanded')==false||$(this).attr('aria-expanded')){ + return $(this) + }else{ + delete $(this) + } + }) + $target.children('i').trigger('click') + } + } else { + menuControl = false; + window.jsTree.jstree('close_all') + } + $('#handlerMenuShow').on('click', function(){ + if(menuControl){ + $(this).find('span').text('展开') + $(this).find('i').attr("class","fa fa-angle-left") + window.menuControl = false + window.jsTree.jstree('close_all') + }else{ + window.menuControl = true + $(this).find('span').text('收起') + $(this).find('i').attr("class","fa fa-angle-down") + window.jsTree.jstree().open_all() + } + }) }); {{.Scripts}} diff --git a/views/document/markdown_edit_template.tpl b/views/document/markdown_edit_template.tpl index badae2e4..58affae5 100644 --- a/views/document/markdown_edit_template.tpl +++ b/views/document/markdown_edit_template.tpl @@ -56,7 +56,8 @@
- + +