You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Attention: The default mode works for content that is a single paragraph. Use the div mode in all other cases:
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
Plugin settings are stored as preferences settings. Do not change the settings here, they are here only for illustration purposes showing the default values. Define the settings in Main.TWikiPreferences. For example, to customize the TWISTYREMEMBER setting, add a * Set TWISTYPLUGIN_TWISTYREMEMBER = ... bullet in Main.TWikiPreferences.
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
<--/twistyPlugin-->
Plugin Installation Instructions
This plugin is pre-installed. TWiki administrators can upgrade the plugin as needed on the TWiki server.
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Attention: The default mode works for content that is a single paragraph. Use the div mode in all other cases:
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
Plugin settings are stored as preferences settings. Do not change the settings here, they are here only for illustration purposes showing the default values. Define the settings in Main.TWikiPreferences. For example, to customize the TWISTYREMEMBER setting, add a * Set TWISTYPLUGIN_TWISTYREMEMBER = ... bullet in Main.TWikiPreferences.
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
<--/twistyPlugin-->
Plugin Installation Instructions
This plugin is pre-installed. TWiki administrators can upgrade the plugin as needed on the TWiki server.
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Added:
> >
Attention: The default mode works for content that is a single paragraph. Use the div mode in all other cases:
Note that id sets a sitewide cookie. To create a unique id, add topic or web variables:
id="%WEB%_%TOPIC%_currentCustomerList"
Make it obey
To let the Twisty start with its content folded open, add parameter start="show".
%TWISTY{
Changed:
< <
showlink="Show..."
hidelink="Hide"
start="show"
> >
showlink="Show..."
hidelink="Hide"
start="show"
}%
my twisty content
</>
<--/twistyPlugin-->
%TWISTY{
Changed:
< <
showlink="Show..."
hidelink="Hide"
start="show"
> >
showlink="Show..."
hidelink="Hide"
start="show"
}%
my twisty content
</>
<--/twistyPlugin-->
Likewise use start="hide" to start with hidden content.
%TWISTY{
Changed:
< <
showlink="Show..."
hidelink="Hide"
start="hide"
> >
showlink="Show..."
hidelink="Hide"
start="hide"
}%
my twisty content
</>
<--/twistyPlugin-->
%TWISTY{
Changed:
< <
showlink="Show..."
hidelink="Hide"
start="hide"
> >
showlink="Show..."
hidelink="Hide"
start="hide"
}%
my twisty content
</>
<--/twistyPlugin-->
Make it obey only the first time
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
%TWISTY{
Changed:
< <
link=""
noscript="hide"
start="show"
> >
link=""
noscript="hide"
start="show"
}%
</>
<--/twistyPlugin-->
%TWISTY{
Changed:
< <
link=""
noscript="hide"
start="show"
> >
link=""
noscript="hide"
start="show"
}%
</>
<--/twistyPlugin-->
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
%TWISTY{
Changed:
< <
link=""
start="show"
> >
link=""
start="show"
}%
</>
<--/twistyPlugin-->
%TWISTY{
Changed:
< <
link=""
start="show"
> >
link=""
start="show"
}%
</>
<--/twistyPlugin-->
Styling the Twisty
Use parameter class to style the content div or class:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
> >
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
Plugin settings are stored as preferences settings. Do not change the settings here, they are here only for illustration purposes showing the default values. Define the settings in Main.TWikiPreferences. For example, to customize the TWISTYREMEMBER setting, add a * Set TWISTYPLUGIN_TWISTYREMEMBER = ... bullet in Main.TWikiPreferences.
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
<--/twistyPlugin-->
Plugin Installation Instructions
This plugin is pre-installed. TWiki administrators can upgrade the plugin as needed on the TWiki server.
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Deleted:
< <
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
class
CSS class name
Class for content div or span
optional, default none
mode
"div" or "span"
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
Plugin settings are stored as preferences settings. Do not change the settings here, they are here only for illustration purposes showing the default values. Define the settings in Main.TWikiPreferences. For example, to customize the TWISTYREMEMBER setting, add a * Set TWISTYPLUGIN_TWISTYREMEMBER = ... bullet in Main.TWikiPreferences.
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Added:
> >
</>
<--/twistyPlugin-->
Plugin Installation Instructions
Added:
> >
This plugin is pre-installed. TWiki administrators can upgrade the plugin as needed on the TWiki server.
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
Added:
> >
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show".
If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
Added:
> >
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
Other use: hide interface parts in case of no JavaScript
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
Changed:
< <
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
> >
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
Changed:
< <
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
> >
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
Changed:
< <
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
> >
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Changed:
< <
Plugin settings are stored as preferences variables. To reference
> >
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Deleted:
< <
a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Added:
> >
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
Likewise use start="hide" to start with hidden content.
%TWISTY{
showlink="Show..."
Changed:
< <
hidelink="Hide
> >
hidelink="Hide"
start="hide"
}%
my twisty content
</>
<--/twistyPlugin-->
%TWISTY{
showlink="Show..."
Changed:
< <
hidelink="Hide
> >
hidelink="Hide"
start="hide"
}%
my twisty content
</>
<--/twistyPlugin-->
Make it obey only the first time
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show".
If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
Other use: hide interface parts in case of no JavaScript
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
> >
mode
"div" or "span"
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty button will use a <div> or a <span> tag
optional, defaults to <span>
> >
mode
"div" or "span"
Specify if the Twisty button will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
Specify if the Twisty Show link will use a <div> or a <span> tag
optional, defaults to <span>
> >
mode
"div" or "span"
Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag
optional, defaults to <span>
> >
mode
"div" or "span"
Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
> >
mode
"div" or "span"
Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak.
03 Aug 2008
1.4.10 TWiki 4.2.1 release version
13 Dec 2007
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show".
If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{
showlink="Show..."
hidelink="Hide"
firststart="show"
}%
my twisty content
%ENDTWISTY%
Other use: hide interface parts in case of no JavaScript
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
The format tokens are the same as with FormattedSearch:
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty Show link will use a <div> or a <span> tag
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved. None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
1.4.9 fix to the loading order of javascript files in head
24 Nov 2007
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
A "twisty" is an interface toggle control to show and hide content.
TwistyPlugin gives you several options to control the appearance of a twisty:
use link text or buttons
position an icon left or right
remember the state at the next visit of the page
start the Twisty open or closed
start the Twisty open or closed for the first visit
use a span or div for the content
set a class for the content span or div
Changed:
< <
Twisty has a fallback mechanism in case JavaScript is not available: all content is displayed and the control buttons are hidden. Unless parameter noscript="hide" is used to specifically set the content to hide.
> >
Twisty has a fallback mechanism in case JavaScript is not available: all content is displayed and the control buttons are hidden.
Deleted:
< <
What's new in version 1.2:
New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER
Property id is no longer required as this is automatically set (still recommended in some cases with remember="on")
Property value remember="off" will clear a previously stored setting
New properties prefix and suffix
JavaScript to collapse or expand all Twisties on the page
You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.
Twisty with icons
Changed:
< <
We will use mode="div" to put the collapsing content below the button.
> >
We will use mode="div" to put the collapsing content below the button (the default mode is "span").
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show".
If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
hidelink="Hide"
firststart="show"
}%
my twisty content
<--/twistyPlugin-->
Other use: hide interface parts in case of no JavaScript
Added:
> >
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Changed:
< <
<--/twistyPlugin twikiMakeVisibleInline-->
> >
%TWISTY{
Added:
> >
link=""
noscript="hide"
start="show"
}%
<--/twistyPlugin-->
Changed:
< <
<--/twistyPlugin twikiMakeVisibleInline-->
> >
%TWISTY{
Added:
> >
link=""
noscript="hide"
start="show"
}%
<--/twistyPlugin-->
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
Changed:
< <
<--/twistyPlugin twikiMakeVisibleInline-->
> >
%TWISTY{
link=""
Added:
> >
start="show"
}%
<--/twistyPlugin-->
Changed:
< <
<--/twistyPlugin twikiMakeVisibleInline-->
> >
%TWISTY{
link=""
Added:
> >
start="show"
}%
<--/twistyPlugin-->
Styling the Twisty
Use parameter class to style the content div or class:
showlink="Show..."
hidelink="Hide"
class="twikiHelp"
}%
my twisty content
<--/twistyPlugin-->
Twisty headers
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
Changed:
< <
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
> >
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty Show link will use a <div> or a <span> tag
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Added:
> >
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved.
Changed:
< <
Name
Version
Description
TWiki::Contrib::TwistyContrib
>=1.200
Required. Twisty javascript library
> >
None
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.4.6 - 1.4.8 Arthur Clemens - Added format tokens.
07 Oct 2007
1.4.5 Arthur Clemens - Fix html tag with show/hide controls.
25 Sep 2007
1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used.
11 Jul 2007
1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used.
23 Jun 2007
1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4).
20 Jun 2007
1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.
19 Jun 2006
1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.
25 Oct 2006
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed
A "twisty" is an interface toggle control to show and hide content.
TwistyPlugin gives you several options to control the appearance of a twisty:
use link text or buttons
position an icon left or right
remember the state at the next visit of the page
start the Twisty open or closed
start the Twisty open or closed for the first visit
use a span or div for the content
set a class for the content span or div
Twisty has a fallback mechanism in case JavaScript is not available: all content is displayed and the control buttons are hidden. Unless parameter noscript="hide" is used to specifically set the content to hide.
What's new in version 1.2:
New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER
Property id is no longer required as this is automatically set (still recommended in some cases with remember="on")
Property value remember="off" will clear a previously stored setting
New properties prefix and suffix
JavaScript to collapse or expand all Twisties on the page
To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show".
If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.
%TWISTY{showlink="Show..." hidelink="Hide" firststart="show"}%
my twisty content
%ENDTWISTY%
Other use: hide interface parts in case of no JavaScript
You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.
Do not forget to set start="show" to show the Twisty content at all.
When JavaScript is off, the button should be invisible.
This code will show the button when JavaScript is off:
To be able to use header tags like <h2>, use the properties prefix and suffix. Because we have identical show and hide links we can use the shorthand property link.
%TWISTY{prefix="<h4>!!" link="Header"
showimgleft="%ICONURLPATH{toggleopen}%"
hideimgleft="%ICONURLPATH{toggleclose}%" suffix="</h4>"}%
my twisty content
%ENDTWISTY%
This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag.
Usage: %TWISTY{ ... }% Toggable contents %ENDTWISTY%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
showimgleft
Image url
Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgleft
Image url
Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
showimgright
Image url
Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
hideimgright
Image url
Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown in case JavaScript if off
class
CSS class name
Class for Twisty div or span
optional, default none
prefix
Text
Text to display before the show/hide links
optional, default none
suffix
Text
Text to display after the show/hide links
optional, default none
img
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgleft
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
imgright
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
hideimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
optional, defaults to no image
showimg
Image url
Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.
Specify if the Twisty Show link will use a <div> or a <span> tag
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgleft
Image url
Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
imgright
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
Specify if the Twisty Hide link will use a <div> or a <span> tag
optional, defaults to <span>
img
Image url
Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.
optional, defaults to no image
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
Example: %TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
Specify if the Twisty Toggle section will use a <div> or a <span> tag.
optional, defaults to <span>
class
CSS class name
Class for content div or span
optional, default none
remember
"on", "off"
If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared. Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.
optional, no default
start
"hide" or "show"
Initial state of the Twisty; this will override any setting stored in a cookie (see remember).
optional, default no initial state
firststart
"hide" or "show"
Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).
optional, default no initial state
noscript
"hide"
Make content hidden in case use does not have JavaScript on
optional, default content is shown with no JavaScript
When active, the Twisty JavaScript library is included in every topic
Provides a convenience syntax to define Twisty areas
Automatically generates ids
Automatically fills in default values
Global preference settings can be set in this topic or locally in individual topics
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write %<plugin>_<setting>%, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
Set TWISTYSHOWLINK = More...
For example: More...
Set TWISTYHIDELINK = Close
For example: Close
Set TWISTYMODE =
Either div or span; span if nothing set
Set TWISTYREMEMBER =
Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared
Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
Set DEBUG = 0
Plugin Installation Instructions
Download the ZIP file from the Plugin web (see below)
Unzip TwistyPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
Optionally, if it exists, run TwistyPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Alternatively, manually make sure the dependencies listed in the table below are resolved.
Name
Version
Description
TWiki::Contrib::TwistyContrib
>=1.200
Required. Twisty javascript library
Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.
27 Sep 2006
1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set
11 June 2006
1.100 Added parameters start, firststart, noscript and class; complete JavaScript rewrite for speed