From 87ef728908898c260cd574e2a247a311b2574abf Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 27 May 2022 10:46:02 +0800 Subject: [PATCH 1/3] * Fix bug #23012. --- module/execution/js/tree.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/module/execution/js/tree.js b/module/execution/js/tree.js index 85a1a70f6c..5f56c95067 100644 --- a/module/execution/js/tree.js +++ b/module/execution/js/tree.js @@ -1,3 +1,35 @@ +/* Expand or collapse text */ +function limitText() +{ + var fullText; + var limitText; + var $text = $(this); + var options = $.extend({limitSize: 40, suffix: '…'}, $text.data()); + var text = $text.text(); + if(text.length > options.limitSize) + { + fullText = $text.html(); + limitText = text.substring(0, options.limitSize) + options.suffix; + $text.text(limitText).addClass('limit-text-on'); + + var $toggleBtn = options.toggleBtn ? $(options.toggleBtn) : $text.next('.text-limit-toggle'); + $toggleBtn.text($toggleBtn.data('textExpand')); + $toggleBtn.on('click', function() + { + var isLimitOn = $text.toggleClass('limit-text-on').hasClass('limit-text-on'); + if(isLimitOn) $text.text(limitText); + else $text.html(fullText); + $toggleBtn.text($toggleBtn.data(isLimitOn ? 'textExpand' : 'textCollapse')); + }); + } + else + { + (options.toggleBtn ? $(options.toggleBtn) : $text.next('.text-limit-toggle')).hide(); + } + $text.removeClass('hidden'); +}; +$.fn.textLimit = function(){return this.each(limitText);}; + $(function() { var $taskTree = $('#taskTree').tree( @@ -157,8 +189,9 @@ $(function() $itemContent.on('click', function(event) { - if(!$(event.target).closest('a[data-app]').length) event.stopPropagation(); + if(!$(event.target).closest('a[data-app]').length || $(event.target).closest('a').hasClass('iframe')) event.stopPropagation(); }); + $taskTree.on('click', stopPropagation); $(window).on('resize scroll', adjustSidePosition); From f889692b4063acfa8f85b770e8330a64b9d80183 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 27 May 2022 10:47:19 +0800 Subject: [PATCH 2/3] * Remove empty line. --- module/execution/js/tree.js | 1 - 1 file changed, 1 deletion(-) diff --git a/module/execution/js/tree.js b/module/execution/js/tree.js index 5f56c95067..d72f3aa672 100644 --- a/module/execution/js/tree.js +++ b/module/execution/js/tree.js @@ -191,7 +191,6 @@ $(function() { if(!$(event.target).closest('a[data-app]').length || $(event.target).closest('a').hasClass('iframe')) event.stopPropagation(); }); - $taskTree.on('click', stopPropagation); $(window).on('resize scroll', adjustSidePosition); From 62445ea7b0720d67c336177ea26cbc43215bf455 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 27 May 2022 10:59:23 +0800 Subject: [PATCH 3/3] * Code format. --- module/execution/js/tree.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module/execution/js/tree.js b/module/execution/js/tree.js index d72f3aa672..3e0513c76b 100644 --- a/module/execution/js/tree.js +++ b/module/execution/js/tree.js @@ -1,4 +1,9 @@ -/* Expand or collapse text */ +/** + * Expand or collapse text. + * + * @access public + * @return void + */ function limitText() { var fullText;