From 6e4cd0dda837294a01d2f756110ee70bbbd82582 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 21 Mar 2023 14:04:37 +0800 Subject: [PATCH] * Modify doc module locate. --- module/doc/css/tablecontents.css | 2 +- module/doc/js/tablecontents.js | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/module/doc/css/tablecontents.css b/module/doc/css/tablecontents.css index 2c5482b3f2..585a5b4aed 100644 --- a/module/doc/css/tablecontents.css +++ b/module/doc/css/tablecontents.css @@ -27,7 +27,7 @@ span.dotted-line+a {display: block;} .doc-title ,.item{display: inline-block !important; position: relative; padding-right: 10px; max-width:80%; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;} .tree li.has-list.open:before {content: unset;} #modules i.icon-file-text {color: #D0D2D6; font-size: 14px;} -.tree li>a {max-width: 80%;} +.tree li>a {max-width: 100%;} .sortable-sorting .module-name > a {cursor: move;} .sortable-sorting li >.tree-group {opacity: .5;} diff --git a/module/doc/js/tablecontents.js b/module/doc/js/tablecontents.js index 963744c4db..4a5f907d25 100644 --- a/module/doc/js/tablecontents.js +++ b/module/doc/js/tablecontents.js @@ -98,16 +98,19 @@ $(function() $('#fileTree').tree( { + initialState: 'active', data: treeData, itemCreator: function($li, item) { + var libClass = ['lib', 'annex'].indexOf(item.type) !== -1 ? 'lib' : ''; var hasChild = item.children ? !!item.children.length : false; - var $item = ''; + var $item = ''; $item += '
' + item.name; $item += ''; $item += '
'; $item += '
'; $li.append($item); + $li.addClass(libClass); if (item.active) $li.addClass('active open in'); } @@ -120,12 +123,21 @@ $(function() }).on('mouseout', 'a', function() { $(this).find('.icon').addClass('hidden'); - }).on('click', 'a', function() + }).on('click', 'a', function(e) { - var libID = 0; + var isLib = $(this).hasClass('lib'); var moduleID = $(this).data('id'); - location.href = createLink('doc', 'tableContents', linkParams + '&libID=' + libID + '&moduleID=' + moduleID); + if(isLib) + { + linkParams += '&libID=' + moduleID; + } + else + { + var libID = $(this).closest('.lib').data('id'); + linkParams += '&libID=' + libID + '&moduleID=' + moduleID; + } + location.href = createLink('doc', 'tableContents', linkParams); }); function renderDropdown(option)