Changes for page Show Hide Macro
Last modified by ztx lyghters on 2025/10/19 00:52
From version 2.1
edited by ztx lyghters
on 2025/05/09 14:41
on 2025/05/09 14:41
Change comment:
Migrated property [featureMandatory] from class [XWiki.WikiMacroParameterClass]
To version 6.1
edited by ztx lyghters
on 2025/10/19 00:52
on 2025/10/19 00:52
Change comment:
Migrated property [order] from class [XWiki.WikiMacroParameterClass]
Summary
-
Objects (2 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -1,16 +1,16 @@ 1 1 require(['jquery'], function($) { 2 - function onClick () {3 - var button = $(this),4 - content = button.parent().next(),5 - effect = button.attr('data-show-effect'),6 - data = button.data();7 - if($.inArray(effect,['toggle','fadeToggle','slideToggle']) == -1) effect = 'toggle';8 - data.showHideState = !(('showHideState' in data) ? data.showHideState : content.is(':visible'));9 - button.html(button.attr(data.showHideState ? 'data-hide-message' : 'data-show-message'));10 - content.stop()[effect](parseInt(button.attr('data-show-duration')));11 - return false;12 - }13 - $(document).ready(function() {14 - $('.showhidebutton').children('a').click(onClick);15 - });2 + function onClick () { 3 + var button = $(this), 4 + content = button.parent().next(), 5 + effect = button.attr('data-show-effect'), 6 + data = button.data(); 7 + if($.inArray(effect,['toggle','fadeToggle','slideToggle']) == -1) effect = 'toggle'; 8 + data.showHideState = !(('showHideState' in data) ? data.showHideState : content.is(':visible')); 9 + button.html(button.attr(data.showHideState ? 'data-hide-message' : 'data-show-message')); 10 + content.stop()[effect](parseInt(button.attr('data-show-duration'))); 11 + return false; 12 + } 13 + $(document).ready(function() { 14 + $('.showhidebutton').children('a').on('click', onClick); 15 + }); 16 16 });
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -25,10 +25,10 @@ 25 25 <a href="javascript:void(0)" #if($id && $id!="")id="showhidebuttontext${id}" #end data-show-duration="$effectduration" data-show-effect="$effect" data-show-message="$showmessage" data-hide-message="$hidemessage">$mparams.showmessage</a> 26 26 {{/html}} 27 27 ))) 28 -(% class="showhidecontent" #if($id && $id!="")id="showhidecontent${id}" #end style="display: none;" %) 28 +(% class="showhidecontent" #if($id && $id!="")id="showhidecontent${id}" #end#if($xcontext.action != 'edit') style="display: none;"#end %) 29 29 ((( 30 30 ((( 31 - $xcontext.macro.content31 +{{wikimacrocontent /}} 32 32 ))) 33 33 ))) 34 34 ))) - defaultCategory
-
... ... @@ -1,0 +1,1 @@ 1 +Content - Cached
-
... ... @@ -1,0 +1,1 @@ 1 +No - Macro description
-
... ... @@ -1,1 +1,1 @@ 1 -Show HideMacro1 +Show/hide content with animations. - Asynchronous rendering
-
... ... @@ -1,0 +1,1 @@ 1 +No - Macro content type
-
... ... @@ -1,0 +1,1 @@ 1 +Wiki