Line: 1 to 1 | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TwistyPluginA "twisty" is an interface toggle control to show and hide content. | |||||||||||||||||||||||||||||||||
Line: 12 to 12 | |||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
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.
What's new in version 1.2:
| ||||||||||||||||||||||||||||||||
> > | Twisty has a fallback mechanism in case JavaScript is not available: all content is displayed and the control buttons are hidden. | ||||||||||||||||||||||||||||||||
Line: 40 to 31 | |||||||||||||||||||||||||||||||||
my content </> <--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < |
Working Twisty | ||||||||||||||||||||||||||||||||
> > | Shorthand | ||||||||||||||||||||||||||||||||
The Twisty triad is conveniently packed into shorthand %TWISTY{some parameters}% Collapsing content %ENDTWISTY% : | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | More... Close <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | It will look like this: | ||||||||||||||||||||||||||||||||
> > | Will generate: | ||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
> > | More... Close <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > | 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" ). | ||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | %TWISTY{mode="div" showlink="Show..." hidelink="Hide" | ||||||||||||||||||||||||||||||||
> > | %TWISTY{ mode="div" showlink="Show..." hidelink="Hide" | ||||||||||||||||||||||||||||||||
showimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleopen-small.gif" | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif"}% | ||||||||||||||||||||||||||||||||
> > | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif" }% | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin-->It will look like this: | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | %TWISTY{mode="div" showlink="Show..." hidelink="Hide" | ||||||||||||||||||||||||||||||||
> > | %TWISTY{ mode="div" showlink="Show..." hidelink="Hide" | ||||||||||||||||||||||||||||||||
showimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleopen-small.gif" | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif"}% my twisty content | ||||||||||||||||||||||||||||||||
> > | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif" }% my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin-->To put icons at the right side, write | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | %TWISTY{mode="div" showlink="Show " hidelink="Hide " | ||||||||||||||||||||||||||||||||
> > | %TWISTY{ mode="div" showlink="Show " hidelink="Hide " | ||||||||||||||||||||||||||||||||
showimgright="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleopen-small.gif" | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | hideimgright="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif"}% | ||||||||||||||||||||||||||||||||
> > | hideimgright="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif" }% | ||||||||||||||||||||||||||||||||
my twisty content
</> <--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | %TWISTY{mode="div" showlink="Show " hidelink="Hide " | ||||||||||||||||||||||||||||||||
> > | %TWISTY{ mode="div" showlink="Show " hidelink="Hide " | ||||||||||||||||||||||||||||||||
showimgright="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleopen-small.gif" | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | hideimgright="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif"}% my twisty content | ||||||||||||||||||||||||||||||||
> > | hideimgright="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose-small.gif" }% my twisty content | ||||||||||||||||||||||||||||||||
</> <--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Line: 101 to 107 | |||||||||||||||||||||||||||||||||
To test this, reload the page after toggling. | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin-->If a Twisty state has been stored in a TWIKIPREF cookie before, it can be cleared by using remember="off" : | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin-->NOTE: Twisty ids are generated automatically. If you need control over exactly which Twisty should be remembered, add the parameter id : | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my customer list
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > | Note that id sets a sitewide cookie. To create a unique id, add topic or web variables:
id="%WEB%_%TOPIC%_currentCustomerList" | ||||||||||||||||||||||||||||||||
Make it obeyTo let the Twisty start with its content folded open, add parameterstart="show" . | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin-->Likewise use start="hide" to start with hidden content. | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | Show... Hide
start= <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
> > | Show... Hide
start= <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Line: 164 to 212 | |||||||||||||||||||||||||||||||||
If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting. | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
> > | Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Line: 175 to 231 | |||||||||||||||||||||||||||||||||
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--> | ||||||||||||||||||||||||||||||||
> > | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Line: 196 to 261 | |||||||||||||||||||||||||||||||||
This code will show the button when JavaScript is off: | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Line: 211 to 282 | |||||||||||||||||||||||||||||||||
Use parameter class to style the content div or class: | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
> > | <--/twistyPlugin twikiMakeVisibleInline--> | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin-->Generates: | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | <--/twistyPlugin twikiMakeVisibleInline-->
my twisty content | ||||||||||||||||||||||||||||||||
> > | <--/twistyPlugin twikiMakeVisibleInline-->
my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Line: 226 to 307 | |||||||||||||||||||||||||||||||||
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 . | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | %TWISTY{prefix="!!" link="Header" | ||||||||||||||||||||||||||||||||
> > | %TWISTY{
prefix="!!" mode="div" link="Header" | ||||||||||||||||||||||||||||||||
showimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleopen.gif" | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose.gif" suffix=""}% | ||||||||||||||||||||||||||||||||
> > | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose.gif" suffix="" }% | ||||||||||||||||||||||||||||||||
my twisty content
<--/twistyPlugin--> | |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > | Add the !! to prevent the twisty header appear in the table of contents when you use %TOC% . | ||||||||||||||||||||||||||||||||
Will create: | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | %TWISTY{prefix="!!" link="Header" | ||||||||||||||||||||||||||||||||
> > | %TWISTY{
prefix="!!" link="Header" | ||||||||||||||||||||||||||||||||
showimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleopen.gif" | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose.gif" suffix=""}% my twisty content | ||||||||||||||||||||||||||||||||
> > | hideimgleft="/wiki/twiki-6.1.0/pub/TWiki/TWikiDocGraphics/toggleclose.gif" suffix="" }% my twisty content | ||||||||||||||||||||||||||||||||
<--/twistyPlugin--> All on, all off | |||||||||||||||||||||||||||||||||
Line: 246 to 338 | |||||||||||||||||||||||||||||||||
You can toggle all Twisties on or off at once by putting a link or button on the page with class twistyExpandAll or twistyCollapseAll . | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | |||||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||||
Creates these controls: | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | |||||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||||
When you want to use links, write: | |||||||||||||||||||||||||||||||||
Line: 260 to 351 | |||||||||||||||||||||||||||||||||
#VarTOGGLE | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Expand all | ||||||||||||||||||||||||||||||||
> > | Expand all | ||||||||||||||||||||||||||||||||
Collapse all | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Expand all | ||||||||||||||||||||||||||||||||
> > | Expand all | ||||||||||||||||||||||||||||||||
Collapse all | |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > | Special syntax: format tokensIf 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:
link="%Y%"but use format tokens: link="$percntY$percnt"... to get: <--/twistyPlugin twikiMakeVisibleInline-->
my twisty content
<--/twistyPlugin-->Or a more complex example using SpreadsheetPlugin; do not write: link="Count: (%CALC{"$GET(infoCount)"}%)"but use format tokens: link="Count: ($percntCALC{$quot$dollarGET(infoCount)$quot}$percnt)" | ||||||||||||||||||||||||||||||||
Syntax | |||||||||||||||||||||||||||||||||
Line: 296 to 434 | |||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Line: 399 to 537 | |||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||||
Plugin SettingsPlugin settings are stored as preferences variables. To reference | |||||||||||||||||||||||||||||||||
Line: 420 to 559 | |||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||
> > | None | ||||||||||||||||||||||||||||||||
Plugin Info
| |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
|
Line: 1 to 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > | TwistyPluginA "twisty" is an interface toggle control to show and hide content. TwistyPlugin gives you several options to control the appearance of a twisty:
noscript="hide" is used to specifically set the content to hide.
What's new in version 1.2:
On this page:
Usage examplesTriadA Twisty consists of 3 elements:
%TWISTYSHOW{}% %TWISTYHIDE{}% (there may be other things between buttons and content) %TWISTYTOGGLE{}% my content %ENDTWISTYTOGGLE% Working TwistyThe Twisty triad is conveniently packed into shorthand%TWISTY{some parameters}% Collapsing content %ENDTWISTY% :
%TWISTY{showlink="Show..." hidelink="Hide"}% my twisty content %ENDTWISTY%It will look like this: Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content <--/twistyPlugin--> Twisty with iconsWe will usemode="div" to put the collapsing content below the button.
%TWISTY{mode="div" showlink="Show..." hidelink="Hide" showimgleft="%ICONURLPATH{toggleopen-small}%" hideimgleft="%ICONURLPATH{toggleclose-small}%"}% my twisty content %ENDTWISTY%It will look like this: <--/twistyPlugin twikiMakeVisibleInline-->
my twisty content
<--/twistyPlugin-->To put icons at the right side, write %TWISTY{mode="div" showlink="Show " hidelink="Hide " showimgright="%ICONURLPATH{toggleopen-small}%" hideimgright="%ICONURLPATH{toggleclose-small}%"}% my twisty content %ENDTWISTY% <--/twistyPlugin twikiMakeVisibleInline-->
my twisty content
<--/twistyPlugin--> Make it rememberTo store the last state in a TWIKIPREF cookie, add the parameterremember="on" .To test this, reload the page after toggling. %TWISTY{showlink="Show..." hidelink="Hide" remember="on"}% my twisty content %ENDTWISTY%Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content <--/twistyPlugin-->If a Twisty state has been stored in a TWIKIPREF cookie before, it can be cleared by using remember="off" :
%TWISTY{showlink="Show..." hidelink="Hide" remember="off"}% my twisty content %ENDTWISTY%Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content <--/twistyPlugin-->NOTE: Twisty ids are generated automatically. If you need control over exactly which Twisty should be remembered, add the parameter id :
%TWISTY{id="currentCustomerList" showlink="Show..." hidelink="Hide" remember="on"}% my customer list %ENDTWISTY% Make it obeyTo let the Twisty start with its content folded open, add parameterstart="show" .
%TWISTY{showlink="Show..." hidelink="Hide" start="show"}% my twisty content %ENDTWISTY%Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content <--/twistyPlugin-->Likewise use start="hide" to start with hidden content.
%TWISTY{showlink="Show..." hidelink="Hide" start="hide"}% my twisty content %ENDTWISTY%Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content <--/twistyPlugin--> Make it obey only the first timeTo let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameterfirststart="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%Show... Hide <--/twistyPlugin twikiMakeVisibleInline-->my twisty content <--/twistyPlugin--> Other use: hide interface parts in case of no JavaScriptYou 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. Writeshowlink="" hidelink="" to not display any default link texts.
%TWISTY{link="" noscript="hide" start="show"}% <input type="submit" class="twikiButton" value="You surely have !JavaScript" /> %ENDTWISTY% <--/twistyPlugin twikiMakeVisibleInline--> <--/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{link="" start="show"}% <input type="submit" class="twikiButton" value="You surely have !JavaScript" /> %ENDTWISTY% <--/twistyPlugin twikiMakeVisibleInline--> <--/twistyPlugin--> Styling the TwistyUse parameterclass to style the content div or class:
%TWISTY{mode="div" showlink="Show..." hidelink="Hide" class="twikiHelp"}% my twisty content %ENDTWISTY%Generates: <--/twistyPlugin twikiMakeVisibleInline-->
my twisty content
<--/twistyPlugin--> Twisty headersTo 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%Will create: !! |
Parameter | Value | Description | Remark |
---|---|---|---|
id |
Unique identifier | Used to link TWISTYBUTTON and TWISTYTOGGLE | optional |
link |
Link label | Link label for both show and hide links | optional |
hidelink |
Link label | Hide link label | optional |
showlink |
Link label | Show link label | optional |
mode |
"div" or "span" |
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. | optional, defaults to no image |
%ENDTWISTY%
noscript
and class
(only used for 'toggle' content)
mode
: button mode defaults to span
%TWISTYBUTTON{id="myid" ... }%
Parameter | Value | Description | Remark |
---|---|---|---|
mode | "div" or "span" | Specify if the Twisty button will use a <div> or a <span> tag | optional, defaults to <span> |
%TWISTYSHOW{id="myid" ... }%
Parameter | Value | Description | Remark |
---|---|---|---|
id | Unique identifier | Used to link TWISTYSHOW, TWISTYHIDE and TWISTYTOGGLE | required |
link | Link label | Show link label | optional |
mode | "div" or "span" | 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 |
%TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
%TWISTYHIDE{id="myid" ... }%
Parameter | Value | Description | Remark |
---|---|---|---|
id | Unique identifier | Used to link TWISTYSHOW, TWISTYHIDE and TWISTYTOGGLE | required |
link | Link label | Hide link label | optional |
mode | "div" or "span" | 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 |
%TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
%TWISTYTOGGLE{id="myid"}%
Parameter | Value | Description | Remark |
---|---|---|---|
id | Unique identifier | Used to link TWISTYSHOW, TWISTYHIDE and TWISTYTOGGLE. | required |
mode | "div" or "span" | 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 |
%TWISTYTOGGLE{id="demo" mode="div" remember="on"}%My content%ENDTWISTYTOGGLE%
%ENDTWISTYTOGGLE%
%ENDTWISTYTOGGLE%
%<plugin>_<setting>%
, i.e. %TWISTYPLUGIN_SHORTDESCRIPTION%
More...
Close
div
or span
; span
if nothing set
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
TwistyPlugin.zip
in your root ($TWIKI_ROOT) directory. Content: File: | Description: |
---|---|
data/TWiki/TwistyPlugin.txt | |
lib/TWiki/Plugins/TwistyPlugin.pm |
TwistyPlugin_installer
to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
Name | Version | Description |
---|---|---|
TWiki::Contrib::TwistyContrib | >=1.200 | Required. Twisty javascript library |
configure
in your TWiki installation, and enable the plugin in the {Plugins} section.
Authors: | TWiki:Main.RafaelAlvarez![]() ![]() |
||||||
Copyright ©: | 2005 Rafael Alvarez, 2006 Arthur Clemens | ||||||
License: | GPL![]() |
||||||
Dependencies: |
|
||||||
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 |
||||||
12 Sep 2005 | 1.000 First Version | ||||||
Home: | http://TWiki.org/cgi-bin/view/Plugins/TwistyPlugin![]() |
||||||
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/TwistyPluginDev![]() |
||||||
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/TwistyPluginAppraisal![]() |