Зміни в документі Show Hide Macro

Остання зміна 2026/01/15 12:29 автором superadmin

Від версії 2.1
редаговано Павло Заїченко
дата 2022/08/30 00:42
Змінити коментар: Migrated property [defaultCategories] from class [XWiki.WikiMacroClass]
До версії 7.1
редаговано superadmin
дата 2026/01/15 12:29
Змінити коментар: Migrated property [executionIsolated] from class [XWiki.WikiMacroClass]

Підсумок

Подробиці

Властивості сторінки
Автор
... ... @@ -1,1 +1,1 @@
1 -XWiki.zpf
1 +XWiki.superadmin
Синтаксис
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
XWiki.JavaScriptExtension[0]
Код
... ... @@ -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]
Код макросу
... ... @@ -1,6 +1,9 @@
1 1  {{velocity}}
2 -$xwiki.jsx.use("Macros.ShowHideMacro")
3 -#set($mparams = $xcontext.macro.params)
2 +#set($discard = $xwiki.jsx.use("Macros.ShowHideMacro"))
3 +#set($mparams = $wikimacro.parameters)
4 +#if(!$mparams)
5 + #set($mparams = $xcontext.macro.params)
6 +#end
4 4  #if($mparams.id)
5 5   #set($id = $util.convertToAlphaNumeric($mparams.id))
6 6  #end
... ... @@ -22,10 +22,10 @@
22 22  <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>
23 23  {{/html}}
24 24  )))
25 -(% 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 %)
26 26  (((
27 27  (((
28 -$context.macro.content
31 +{{wikimacrocontent /}}
29 29  )))
30 30  )))
31 31  )))
Категорія за умовчанням
... ... @@ -1,1 +1,1 @@
1 -content
1 +Content
Кешовано
... ... @@ -1,0 +1,1 @@
1 +Ні
Опис макросу
... ... @@ -1,1 +1,1 @@
1 -Show Hide Macro
1 +Show/hide content with animations.
Асинхронна візуалізація
... ... @@ -1,0 +1,1 @@
1 +Ні
Тип контенту макросу
... ... @@ -1,0 +1,1 @@
1 +Wiki