Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
<<importTiddlers>>
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Ces [[InterfaceOptions]] pour personnaliser ce Codex sont enregistrées dans votre navigateur

Votre nom pour signer vos papiers. Ecrire en bosses de chameau (pour facilier les liens).

<<option txtUserName>>
<<option chkSaveBackups>> [[SaveBackups]]
<<option chkAutoSave>> [[AutoSave]]
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]

----
Voir aussi [[AdvancedOptions]]
<!--{{{-->
<div class='header' role='banner' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' role='navigation' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' role='navigation' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' role='complementary' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea' role='main'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected {color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:alpha(opacity=60);}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0; top:0;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0 3px 0 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0; padding-bottom:0;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<div class='toolbar' role='navigation' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<<options>>
<<option chkUseInclude>> Include ~TiddlyWikis (IncludeList | IncludeState | [[help|http://tiddlywiki.abego-software.de/#%5B%5BIncludePlugin%20Documentation%5D%5D]])
^^(Reload this ~TiddlyWiki to make changes become effective)^^
<<option chkUseYourSearch>> Use 'Your Search' //([[more options|YourSearch Options]]) ([[help|YourSearch Help]])// 
/***

~AutoTagger ''automatically generates tag values for all newly created or edited tiddlers''
!!!!!Documentation
> see [[AutoTaggerPluginInfo]]
!!!!!Configuration
<<<
|<<option chkAutoTagAuthor>> add 'created by' author tag //(when a tiddler is first created)//||
|<<option chkAutoTagEditor>> add 'edited by' author tag //(when a tiddler is updated)//||
|<<option chkAutoTagDate>> add 'creation date' tag, using date format:|<<option txtAutoTagFormat>>|
|<<option chkAutoTagModDate>> add 'modification date' tag, using date format:|<<option txtAutoTagModFormat>>|
|<<option chkAutoTagNewTags>> add default tag(s) when creating new tiddlers:|<<option txtAutoTagNewTags>>|
|<<option chkAutoTagDefault>> add default tag(s) when saving tiddlers that are not otherwise tagged:|<<option txtAutoTagDefault>>|
|<<option chkAutoTagTrigger>> scan tiddler content for matching tags when tagged with:|<<option txtAutoTagTrigger>>|
|<<option chkAutoTagAliases>> replace 'aliased' tags using definitions contained in:|<<option txtAutoTagAliases>>|
|borderless|k
<<<
!!!!!Revisions
<<<
2010.06.30 1.8.0 in saveTiddler(), added extra checks for valid alias definitions
| Please see [[AutoTaggerPluginInfo]] for previous revision details |
2005.08.15 1.0.0 Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.AutoTaggerPlugin= {major: 1, minor: 8, revision: 0, date: new Date(2010,6,30)};

var co=config.options; // shorthand temp variable
if (co.chkAutoTagDate==undefined) co.chkAutoTagDate=false;
if (co.chkAutoTagModDate==undefined) co.chkAutoTagModDate=false;
if (co.chkAutoTagEditor==undefined) co.chkAutoTagEditor=false;
if (co.chkAutoTagAuthor==undefined) co.chkAutoTagAuthor=false;
if (co.chkAutoTagTrigger==undefined) co.chkAutoTagTrigger=false;
if (co.txtAutoTagTrigger==undefined) co.txtAutoTagTrigger="auto";
if (co.chkAutoTagDefault==undefined) co.chkAutoTagDefault=false;
if (co.txtAutoTagDefault==undefined) co.txtAutoTagDefault="untagged";
if (co.txtAutoTagFormat==undefined) co.txtAutoTagFormat="YYYY.0MM.0DD";
if (co.txtAutoTagModFormat==undefined) co.txtAutoTagModFormat="YYYY.0MM.0DD";
if (co.chkAutoTagNewTags==undefined) co.chkAutoTagNewTags=false;
if (co.txtAutoTagNewTags==undefined) co.txtAutoTagNewTags="";
if (co.chkAutoTagAliases==undefined) co.chkAutoTagAliases=true;
if (co.txtAutoTagAliases==undefined) co.txtAutoTagAliases="AutoTaggerAliases";

// hijack displayTiddler()
Story.prototype.autotagger_displayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler=function(srcElement,tiddler,template,animate,unused,customFields,toggle)
{
	var title=(tiddler instanceof Tiddler)?tiddler.title:tiddler;
        this.autotagger_displayTiddler.apply(this,arguments);
	if (!config.options.chkAutoTagNewTags) return; // IF add new tags is enabled
	if (!story.isDirty(title)) return; // AND tiddler is being edited
	if (store.tiddlerExists(title)) return; // AND tiddler doesn't exist
	var newtags=config.options.txtAutoTagNewTags.readBracketedList(); // get new tags
	for (var t=0; t<newtags.length; t++)
		story.setTiddlerTag(title,newtags[t],+1); // preload tag edit field
} 

// hijack saveTiddler()
TiddlyWiki.prototype.autotagger_SaveTiddler=TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler=function(title,newTitle,newBody,modifier,modified,tags,fields)
{
	var co=config.options; // shorthand temp variable
	var newTags = [];
	if (tags) newTags = (typeof tags == "string") ? tags.readBracketedList() : tags;
	var txt=store.getTiddlerText(config.options.txtAutoTagAliases,'')
	if (config.options.chkAutoTagAliases && txt.length) {
		// replace tag aliases with one or more other tags
		var map={};
		var list=txt.split('\n');
		for (var i=0; i<list.length; i++) {
			var parts=list[i].split('=');
			var name=parts.shift(); var val=parts.join('=');
			if (val.length) map[name]=val.readBracketedList();
		}
		for (var a in map) if (newTags.contains(a)) {
			newTags.splice(newTags.indexOf(a),1); // remove alias
			for (var i=0; i<map[a].length; i++) // add replacements
				newTags.pushUnique(map[a][i]);
		}
	}
	var now=new Date().formatString(co.txtAutoTagFormat);
	if (co.chkAutoTagDate && (store.getTiddler(title)==undefined))
		if (newTitle!=now) newTags.pushUnique(now); // created date - don't add to journals
	if (co.chkAutoTagAuthor && (store.getTiddler(title)==undefined))
		newTags.pushUnique(co.txtUserName); // creator
	if (co.chkAutoTagEditor && store.getTiddler(title))
		newTags.pushUnique(co.txtUserName); // modifier
	if (co.chkAutoTagModDate && store.getTiddler(title))
		newTags.pushUnique(new Date().formatString(co.txtAutoTagModFormat)); // modified
	var allTags = store.getTags(); // scan content for tags
	if (co.chkAutoTagTrigger && co.txtAutoTagTrigger.length	&& newTags.contains(co.txtAutoTagTrigger))
		for (var t=0; t<allTags.length; t++) {
			if (allTags[t][0]=='systemConfig') continue; // don't add 'systemConfig'
			if ((newBody.indexOf(allTags[t][0])!=-1) || (newTitle.indexOf(allTags[t][0])!=-1))
				newTags.pushUnique(allTags[t][0]); // autotag
		}
	for (var t=0; t<newTags.length; t++)
		newTags[t]=String.encodeTiddlyLink(newTags[t]); // add brackets around tags
	if (!newTags.length && co.chkAutoTagDefault && co.txtAutoTagDefault.length)
		newTags.push(co.txtAutoTagDefault); // untagged - add default tag
	arguments[5]=newTags.join(" ");
	return this.autotagger_SaveTiddler.apply(this,arguments);
}
//}}}
/%
!info

Usage:
<<<
{{{
<<tiddler CloseOtherTiddlers>>
}}}
<<<
!end
%/<<tiddler {{
	var out='CloseOtherTiddlers##info';
	if (!tiddler||tiddler.title!='CloseOtherTiddlers') {
		var here=story.findContainingTiddler(place);
		story.closeAllTiddlers(here?here.getAttribute("tiddler"):null);
		out='';
	}
out;}}>>
/***

This plugin provides commands to quickly switch a rendered tiddler between its current ViewTemplate display and a minimal display (title and toolbar) defined by a separate CollapsedTemplate.
!!!Usage
<<<
In [[ToolbarCommands::ViewToolbar|ToolbarCommands]], add:
{{{
collapseTiddler collapseOthers
}}}
you can also embed the following macros in tiddler content:
*{{{<<collapseAll>>}}} - adds 'collapse all' command that applies CollapsedTemplate to each displayed tiddler
*{{{<<expandAll>>}}} - adds 'expand all' command that re-applies ViewTemplate (or equivalent custom template) to each displayed tiddler
*{{{<<foldFirst>>}}} - immediately apply CollapsedTemplate to a given tiddler, as soon as it is displayed.
<<<
!!!Revisions
<<<
2009.05.04 [2.0.0] standardized documentation and added version #
2008.10.05 collapseAll() and expandAll(): added "return false" to button handlers to prevent IE page transition
2008.03.06 refactored all code for size reduction, readability, and I18N/L10N-readiness.  Also added 'folded' flag to tiddler elements (for use by other plugins that need to know if tiddler is folded (e.g., [[SinglePageModePlugin]]
2007.10.11 moved [[FoldFirst]] inline script and converted to {{{<<foldFirst>>}}} macro
2007.12.09 suspend/resume SinglePageMode (SPM/TPM/BPM) when folding/unfolding tiddlers
2007.05.06 add "return false" at the end of each command handler to prevent IE 'page transition' problem.
2007.03.30 add a shadow definition for CollapsedTemplate.  Tweak ViewTemplate shadow so "fold/unfold" and "focus" toolbar items automatically appear when using default templates.  Remove error check for "CollapsedTemplate" existence, since shadow version will now always work as a fallback.
2006.02.24 added fallback to "CollapsedTemplate" if "WebCollapsedTemplate" is not found
2006.02.06 added check for 'readOnly' flag to use alternative "WebCollapsedTemplate"
<<<
!!!Code
***/
//{{{
version.extensions.CollapseTiddlersPlugin= {major: 2, minor: 0, revision: 0, date: new Date(2009,5,4)};

config.shadowTiddlers.CollapsedTemplate=
	"<!--{{{-->\
	<div class='toolbar' macro='toolbar expandTiddler collapseOthers closeTiddler closeOthers +editTiddler permalink references jump'></div>\
	<div class='title' macro='view title'></div>\
	<!--}}}-->";

// automatically tweak shadow ViewTemplate to add "collapseTiddler collapseOthers" commands
config.shadowTiddlers.ViewTemplate=config.shadowTiddlers.ViewTemplate.replace(/closeTiddler/,"collapseTiddler collapseOthers closeTiddler");

config.commands.collapseTiddler = {
	text: "plier",
	tooltip: "Plier ce papier",
	collapsedTemplate: "CollapsedTemplate",
	webCollapsedTemplate: "WebCollapsedTemplate",
	handler: function(event,src,title) {
		var e = story.findContainingTiddler(src); if (!e) return false;
		// ne pas plier les papiers en édition!
		if(story.isDirty(e.getAttribute("tiddler"))) return false;
		var t=config.commands.collapseTiddler.getCollapsedTemplate();
		config.commands.collapseTiddler.saveTemplate(e);
		config.commands.collapseTiddler.display(title,t);
		e.setAttribute("folded","true");
		return false;
	},
	getCollapsedTemplate: function() {
		if (readOnly&&store.tiddlerExists(this.webCollapsedTemplate))
			return this.webCollapsedTemplate;
		else
			return this.collapsedTemplate
	},
	saveTemplate: function(e) {
		if (e.getAttribute("savedTemplate")==undefined)
			e.setAttribute("savedTemplate",e.getAttribute("template"));

	},
	// fold/unfold tiddler with suspend/resume of single/top/bottom-of-page mode
	display: function(title,t) {
		var opt=config.options;
		var saveSPM=opt.chkSinglePageMode; opt.chkSinglePageMode=false;
		var saveTPM=opt.chkTopOfPageMode; opt.chkTopOfPageMode=false;
		var saveBPM=opt.chkBottomOfPageMode; opt.chkBottomOfPageMode=false;
		story.displayTiddler(null,title,t);
		opt.chkBottomOfPageMode=saveBPM;
		opt.chkTopOfPageMode=saveTPM;
		opt.chkSinglePageMode=saveSPM;
	}
}

config.commands.expandTiddler = {
	text: "déplier",
	tooltip: "Déplier ce papier",
	handler: function(event,src,title) {
		var e = story.findContainingTiddler(src); if (!e) return false;
		var t = e.getAttribute("savedTemplate");
		config.commands.collapseTiddler.display(title,t);
		e.setAttribute("folded","false");
		return false;
	}
}

config.macros.collapseAll = {
	text: "tout plier",
	tooltip: "Plier tous les papiers",
	handler: function(place,macroName,params,wikifier,paramString,tiddler){
		createTiddlyButton(place,this.text,this.tooltip,function(){
			story.forEachTiddler(function(title,tiddler){
				if(story.isDirty(title)) return;
				var t=config.commands.collapseTiddler.getCollapsedTemplate();


				config.commands.collapseTiddler.saveTemplate(tiddler);
				config.commands.collapseTiddler.display(title,t);
				tiddler.folded=true;
			});
			return false;
		})
	}
}

config.macros.expandAll = {
	text: "tout déplier",
	tooltip: "Déplier tous les papiers",
	handler: function(place,macroName,params,wikifier,paramString,tiddler){
		createTiddlyButton(place,this.text,this.tooltip,function(){
			story.forEachTiddler(function(title,tiddler){
				var t=config.commands.collapseTiddler.getCollapsedTemplate();
				if(tiddler.getAttribute("template")!=t) return; // re-display only if collapsed
				var t=tiddler.getAttribute("savedTemplate");
				config.commands.collapseTiddler.display(title,t);
				tiddler.folded=false;
			});
			return false;
		})
	}
}

config.commands.collapseOthers = {
	text: "focus",
	tooltip: "Déplier ce papier et plier les autres",
	handler: function(event,src,title) {
		var e = story.findContainingTiddler(src); if (!e) return false;
		story.forEachTiddler(function(title,tiddler) {
			if(story.isDirty(title)) return;
			var t=config.commands.collapseTiddler.getCollapsedTemplate();
			if (e==tiddler) t=e.getAttribute("savedTemplate");
			config.commands.collapseTiddler.saveTemplate(tiddler);
			config.commands.collapseTiddler.display(title,t);
			tiddler.folded=(e!=tiddler);
		})
		return false;
	}
}

// {{{<<foldFirst>>}}} macro forces tiddler to be folded when *initially* displayed.
// Subsequent re-render does NOT re-fold tiddler, but closing/re-opening tiddler DOES cause it to fold first again.
config.macros.foldFirst = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler){
		var e=story.findContainingTiddler(place);
		if (e.getAttribute("foldedFirst")=="true") return; // already been folded once
		var title=e.getAttribute("tiddler")
		var t=config.commands.collapseTiddler.getCollapsedTemplate();
		config.commands.collapseTiddler.saveTemplate(e);
		config.commands.collapseTiddler.display(title,t);
		e.setAttribute("folded","true");
		e.setAttribute("foldedFirst","true"); // only when tiddler is first rendered
		return false;
	}
}
//}}}
<!--{{{-->	<div class='toolbar' macro='toolbar expandTiddler collapseOthers closeTiddler closeOthers +editTiddler permalink references jump'></div>	<div class='title' macro='view title'></div>	<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #3F4040
PrimaryLight: #cc0000
PrimaryMid: #cc0000
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #999
SecondaryDark: #cc0000
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
TiTre: #505050
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #cc0000
PrimaryMid: #cc0000
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #cc0000
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
TiTre: #cc0000
/***

!!!Usage
<<<
{{{<<columncalc function startrow endrow>>}}}
where:
*''function'' is a keyword that specifies the type of calculation to perform:
** ''total'' or ''sum'' or //no param//<br>adds up values for cells above it in the column
** ''count''<br>number of non-empty cells in column
** ''average'' or ''avg''<br>average of cells in column (i.e., total/count)
* ''all'' (optional)<br>normally, only cells containing numbers or timestamps (hh:mm:ss) are included in the calculations.  The ''all'' keyword allows text or empty cells to be processed as if they contained a "0".
* ''startrow'',''endrow'' (optional)<br>specifies a ONE-based range of rows for limiting the calculation.  Use negative numbers to specify an offset from the current row (e.g., {{{<<calc sum 3 5>>}}} adds up rows 3, 4 and 5, while {{{<<calc sum 1 -1>>}}} adds up all numbers in the column excluding the current row (i.e., the same as the default if no startrow/endrow params are specified)
<<<
!!!Examples
<<<
''with numeric values...''
{{{
| foo| 3.2 |
| bar| 1.1 |
| baz| 2.9 |
| gronk| 4.3 |
| snork| non-number |
| count| <<columncalc count all 1 -1>> |
| total| <<columncalc sum all 1 -2>> |
| avg| <<columncalc average all 1 -3>> |
}}}
| foo| 3.2 |
| bar| 1.1 |
| baz| 2.9 |
| gronk| 4.3 |
| snork| non-number |
| count| <<columncalc count all 1 -1>> |
| total| <<columncalc sum all 1 -2>> |
| avg| <<columncalc average all 1 -3>> |

''with time-formatted values (hh:mm:ss)...''
{{{
| foo| 00:22:15 |
| bar| 00:03:30 |
| baz| 00:01:45 |
| count| <<columncalc count 1 -1>> |
| total| <<columncalc sum 1 -2>> |
| avg| <<columncalc average 1 -3>> |
}}}
| foo| 00:22:15 |
| bar| 00:03:30 |
| baz| 00:01:45 |
| count| <<columncalc count 1 -1>> |
| total| <<columncalc sum 1 -2>> |
| avg| <<columncalc average 1 -3>> |
<<<
!!!Revisions
<<<
2009.02.05 [0.6.2] added 'all' param to include empty/text rows in calculations.
2007.10.26 [0.6.1] in handler(), using '.textContent' instead of '.innerHTML' when reading values from table cells.  This allows use of values that are transcluded from slices in other tiddlers using the {{{<<tiddler 'TiddlerName::slicename'>>}}} syntax.
2007.06.29 [0.6.0] added support for handling values in hh:mm:ss format
2007.04.02 [0.5.0] started
<<<
!!!!!Code
***/
//{{{
version.extensions.ColumnCalculatorPlugin= {major: 0, minor: 6, revision: 1, date: new Date(2007,10,26)};
config.macros.columncalc= {
	handler:
	function(place,macroName,params,wikifier,paramString,tiddler) {

		if (place.parentNode.nodeName.toLowerCase()!='tr') return false; // not in a table
		var tbody=place.parentNode.parentNode;
		var row=tbody.childNodes.length-1; // current row #
		var col=place.parentNode.childNodes.length-1; // current column #

		var fn=params.shift();
		var allCells=(params[0]&&params[0].toLowerCase()=='all');
		if (allCells) params.shift();
		var startrow=0; var endrow=row-1;
		if (params[0]) var startrow=params.shift();
		if (startrow<0) startrow=1*startrow+row; else startrow=startrow-1;
		if (params[0]) var endrow=params.shift();
		if (endrow<0) endrow=1*endrow+row; else endrow=endrow-1;

		var count=total=0;
		for (r=startrow; r<=endrow; r++) {
			var cell=tbody.childNodes[r].childNodes[col].textContent;
			if (!cell) cell=tbody.childNodes[r].childNodes[col].innerHTML; // fallback for older browsers
			var val=cell; var hms=cell.split(':');
			if (hms.length==3) { // an hh:mm:ss time value
				var val=(hms[0]||0)*3600+(hms[1]||0)*60+(hms[2]||0)*1;
				var showTime=true; // use time formatting for results...
			}
			else if (cell.length && !isNaN(cell)) // a numeric value
				var val=eval(cell);
			else if (allCells) // an non-numeric cell (when 'all' is used)
				var val=0;
			if (!isNaN(val)) { total+=val; count++; }
		}
		switch (fn) {
			case 'count':
				var result=count;
				break;
			case 'average':
			case 'avg':
				var result=Math.floor(total/count*100)/100; // truncate to two decimal places
				break;
			case 'total':
			case 'sum':
			default:
				var result=total;
				break;
		}
		if (showTime && fn!='count') {
			var h=Math.floor(result/3600);
			var m=Math.floor((result-h*3600)/60);
			var s=Math.floor((result-h*3600-m*60)*100)/100; // truncate to two decimal places
			result=(h<10?'0':'')+h+':'+(m<10?'0':'')+m+':'+(s<10?'0':'')+s;
		}
		createTiddlyText(place,result);
	}
}
//}}}
/***

!!!Usage
<<<
The plugin automatically updates the default (shadow) ToolbarCommands definitions to insert the ''copyTiddler'' command, which will appear as ''copy'' when a tiddler is rendered.  If you are already using customized toolbar definitions, you will need to manually add the ''copyTiddler'' toolbar command to your existing ToolbarCommands tiddler, e.g.:
{{{
|EditToolbar|... copyTiddler ... |
}}}
When the ''copy'' command is selected, a new tiddler is created containing an exact copy of the current text/tags/fields, using a title of "{{{TiddlerName (n)}}}", where ''(n)'' is the next available number (starting with 1, of course).  If you copy while //editing// a tiddler, the current values displayed in the editor are used (including any changes you may have already made to those values), and the new tiddler is immediately opened for editing.

The plugin also provides a macro that allows you to embed a ''copy'' command directly in specific tiddler content:
{{{
<<copyTiddler TidderName label:"..." prompt:"...">>
}}}
where
* ''TiddlerName'' (optional)<br>specifies the //source// tiddler to be copied.  If omitted, the current containing tiddler (if any) will be copied.
* ''label:"..."'' (optional)<br>specifies text to use for the embedded link (default="copy TiddlerName")
* ''prompt:"..."'' (optional)<br>specifies mouseover 'tooltip' help text for link
//Note: to use non-default label/prompt values with the current containing tiddler, use "" for the TiddlerName//
<<<
!!!Configuration
<<<
<<option chkCopyTiddlerDate>> use date/time from existing tiddler (otherwise, use current date/time)
{{{<<option chkCopyTiddlerDate>>}}}
<<<
!!!Revisions
<<<
2010.11.30 3.2.6 use story.getTiddler()
2009.06.08 3.2.5 added option to use timestamp from source tiddler
2009.03.09 3.2.4 fixed IE-specific syntax error
2009.03.02 3.2.3 refactored code (again) to restore use of config.commands.copyTiddler.* custom settings
2009.02.13 3.2.2 in click(), fix calls to displayTiddler() to use current tiddlerElem and use getTiddlerText() to permit copying of shadow tiddler content
2009.01.30 3.2.1 fixed handling for copying field values when in edit mode
2009.01.23 3.2.0 refactored code and added {{{<<copyTiddler TiddlerName>>}}} macro
2008.12.18 3.1.4 corrected code for finding next (n) value when 'sparse' handling is in effect
2008.11.14 3.1.3 added optional 'sparse' setting (avoids 'filling in' missing numbers that may have been previously deleted)
2008.11.14 3.1.2 added optional 'zeroPad' setting
2008.11.14 3.1.1 moved hard-coded '(n)' regex into 'suffixPattern' object property so it can be customized
2008.09.26 3.1.0 changed new title generation to use '(n)' suffix instead of 'Copy of' prefix
2008.05.20 3.0.3 in handler, when copying from VIEW mode, create duplicate array from existing tags array before saving new tiddler.
2007.12.19 3.0.2 in handler, when copying from VIEW mode, duplicate custom fields before saving new tiddler.
2007.09.26 3.0.1 in handler, use findContainingTiddler(src) to get tiddlerElem (and title).  Allows 'copy' command to find correct tiddler when transcluded using {{{<<tiddler>>}}} macro or enhanced toolbar inclusion (see [[CoreTweaks]])
2007.06.28 3.0.0 complete re-write to handle custom fields and alternative view/edit templates
2007.05.17 2.1.2 use store.getTiddlerText() to retrieve tiddler content, so that SHADOW tiddlers can be copied correctly when in VIEW mode
2007.04.01 2.1.1 in copyTiddler.handler(), fix check for editor fields by ensuring that found field actually has edit=='text' attribute
2007.02.05 2.1.0 in copyTiddler.handler(), if editor fields (textfield and/or tagsfield) can't be found (i.e., tiddler is in VIEW mode, not EDIT mode), then get text/tags values from stored tiddler instead of active editor fields.  Allows use of COPY toolbar directly from VIEW mode
2006.12.12 2.0.0 completely rewritten so plugin just creates a new tiddler EDITOR with a copy of the current tiddler EDITOR contents, instead of creating the new tiddler in the STORE by copying the current tiddler values from the STORE.
2005.xx.xx 1.0.0 original version by Tim Morgan
<<<
!!!Code
***/
//{{{
version.extensions.CopyTiddlerPlugin= {major: 3, minor: 2, revision: 6, date: new Date(2010,11,30)};

// automatically tweak shadow EditTemplate to add 'copyTiddler' toolbar command (following 'cancelTiddler')
config.shadowTiddlers.ToolbarCommands=config.shadowTiddlers.ToolbarCommands.replace(/cancelTiddler/,'cancelTiddler copyTiddler');

if (config.options.chkCopyTiddlerDate===undefined) config.options.chkCopyTiddlerDate=false;

config.commands.copyTiddler = {
	text: 'copier',
	hideReadOnly: true,
	tooltip: 'Copier ce papier',
	notitle: 'ce papier',
	prefix: '',
	suffixText: ' (%0)',
	suffixPattern: / \(([0-9]+)\)$/,
	zeroPad: 0,
	sparse: false,
	handler: function(event,src,title)
		{ return config.commands.copyTiddler.click(src,event); },
	click: function(here,ev) {
		var tiddlerElem=story.findContainingTiddler(here);
		var template=tiddlerElem?tiddlerElem.getAttribute('template'):null;
		var title=here.getAttribute('from');
		if (!title || !title.length) {
			if (!tiddlerElem) return false;
			else title=tiddlerElem.getAttribute('tiddler');
		}
		var root=title.replace(this.suffixPattern,''); // title without suffix
		// find last matching title
		var last=title;
		if (this.sparse) { // don't fill-in holes... really find LAST matching title
			var tids=store.getTiddlers('title','excludeLists');
			for (var t=0; t<tids.length; t++) if (tids[t].title.startsWith(root)) last=tids[t].title;
		}
		// get next number (increment from last matching title)
		var n=1; var match=this.suffixPattern.exec(last); if (match) n=parseInt(match[1])+1;
		var newTitle=this.prefix+root+this.suffixText.format([String.zeroPad(n,this.zeroPad)]);
		// if not sparse mode, find the next hole to fill in...
		while (store.tiddlerExists(newTitle)||story.getTiddler(newTitle))
			{ n++; newTitle=this.prefix+root+this.suffixText.format([String.zeroPad(n,this.zeroPad)]); }
		if (!story.isDirty(title)) { // if tiddler is not being EDITED
			// duplicate stored tiddler (if any)
			var text=store.getTiddlerText(title,'');
			var who=config.options.txtUserName;
			var when=new Date();
			var newtags=[]; var newfields={};
			var tid=store.getTiddler(title); if (tid) {
				if (config.options.chkCopyTiddlerDate) var when=tid.modified;
				for (var t=0; t<tid.tags.length; t++) newtags.push(tid.tags[t]);
				store.forEachField(tid,function(t,f,v){newfields[f]=v;},true);
			}
	                store.saveTiddler(newTitle,newTitle,text,who,when,newtags,newfields,true);
			story.displayTiddler(tiddlerElem,newTitle,template);
		} else {
			story.displayTiddler(tiddlerElem,newTitle,template);
			var fields=config.commands.copyTiddler.gatherFields(tiddlerElem); // get current editor fields
			var newTiddlerElem=story.getTiddler(newTitle);
			for (var f=0; f<fields.length; f++) {  // set fields in new editor
				if (fields[f].name=='title') fields[f].value=newTitle; // rename title in new tiddler
				var fieldElem=config.commands.copyTiddler.findField(newTiddlerElem,fields[f].name);
				if (fieldElem) {
					if (fieldElem.getAttribute('type')=='checkbox')
						fieldElem.checked=fields[f].value;
					else 
						fieldElem.value=fields[f].value;
				}
			}
		}
		story.focusTiddler(newTitle,'title');
		return false;
	},
	findField: function(tiddlerElem,field) {
		var inputs=tiddlerElem.getElementsByTagName('input');
		for (var i=0; i<inputs.length; i++) {
			if (inputs[i].getAttribute('type')=='checkbox' && inputs[i].field == field) return inputs[i];
			if (inputs[i].getAttribute('type')=='text' && inputs[i].getAttribute('edit') == field) return inputs[i];
		}
		var tas=tiddlerElem.getElementsByTagName('textarea');
		for (var i=0; i<tas.length; i++) if (tas[i].getAttribute('edit') == field) return tas[i];
		var sels=tiddlerElem.getElementsByTagName('select');
		for (var i=0; i<sels.length; i++) if (sels[i].getAttribute('edit') == field) return sels[i];
		return null;
	},
	gatherFields: function(tiddlerElem) { // get field names and values from current tiddler editor
		var fields=[];
		// get checkboxes and edit fields
		var inputs=tiddlerElem.getElementsByTagName('input');
		for (var i=0; i<inputs.length; i++) {
			if (inputs[i].getAttribute('type')=='checkbox')
				if (inputs[i].field) fields.push({name:inputs[i].field,value:inputs[i].checked});
			if (inputs[i].getAttribute('type')=='text')
				if (inputs[i].getAttribute('edit')) fields.push({name:inputs[i].getAttribute('edit'),value:inputs[i].value});
		}
		// get textareas (multi-line edit fields)
		var tas=tiddlerElem.getElementsByTagName('textarea');
		for (var i=0; i<tas.length; i++)
			if (tas[i].getAttribute('edit')) fields.push({name:tas[i].getAttribute('edit'),value:tas[i].value});
		// get selection lists (droplist or listbox)
		var sels=tiddlerElem.getElementsByTagName('select');
		for (var i=0; i<sels.length; i++)
			if (sels[i].getAttribute('edit')) fields.push({name:sels[i].getAttribute('edit'),value:sels[i].value});
		return fields;
	}
};
//}}}
// // MACRO DEFINITION
//{{{
config.macros.copyTiddler = {
	label: 'copy',
	prompt: 'Make a copy of %0',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var title=params.shift();
		params=paramString.parseParams('anon',null,true,false,false);
		var label	=getParam(params,'label',this.label+(title?' '+title:''));
		var prompt	=getParam(params,'prompt',this.prompt).format([title||this.notitle]);
		var b=createTiddlyButton(place,label,prompt,
			function(ev){return config.commands.copyTiddler.click(this,ev)});
		b.setAttribute('from',title||'');
	}
};
//}}}
[[rencontre]] [[film 1]] [[film 2]] [[film 3]] [[film 4]] [[film 5]] [[film 6]] [[film 7]] [[film 8]] [[film 9]] [[film 10]] [[film 11]] [[film 12]]
/***

This plugin allows you to disable TiddlyWiki's automatic ~WikiWord linking behavior, so that WikiWords embedded in tiddler content will be rendered as regular text, instead of being automatically converted to tiddler links.  To create a tiddler link when automatic linking is disabled, you must enclose the link text within {{{[[...]]}}}.
!!!!!Usage
<<<
You can block automatic WikiWord linking behavior for any specific tiddler by ''tagging it with<<tag excludeWikiWords>>'' (see configuration below) or, check a plugin option to disable automatic WikiWord links to non-existing tiddler titles, while still linking WikiWords that correspond to existing tiddlers titles or shadow tiddler titles.  You can also block specific selected WikiWords from being automatically linked by listing them in [[DisableWikiLinksList]] (see configuration below), separated by whitespace.  This tiddler is optional and, when present, causes the listed words to always be excluded, even if automatic linking of other WikiWords is being permitted.  

Note: WikiWords contained in default ''shadow'' tiddlers will be automatically linked unless you select an additional checkbox option lets you disable these automatic links as well, though this is not recommended, since it can make it more difficult to access some TiddlyWiki standard default content (such as AdvancedOptions or SideBarTabs)
<<<
!!!!!Configuration
<<<
<<option chkDisableWikiLinks>> Disable ALL automatic WikiWord tiddler links
<<option chkAllowLinksFromShadowTiddlers>> ... except for WikiWords //contained in// shadow tiddlers
<<option chkDisableNonExistingWikiLinks>> Disable automatic WikiWord links for non-existing tiddlers
Disable automatic WikiWord links for words listed in: <<option txtDisableWikiLinksList>>
Disable automatic WikiWord links for tiddlers tagged with: <<option txtDisableWikiLinksTag>>
<<<
!!!!!Revisions
<<<
2008.07.22 [1.6.0] hijack tiddler changed() method to filter disabled wiki words from internal links[] array (so they won't appear in the missing tiddlers list)
2007.06.09 [1.5.0] added configurable txtDisableWikiLinksTag (default value: "excludeWikiWords") to allows selective disabling of automatic WikiWord links for any tiddler tagged with that value.
2006.12.31 [1.4.0] in formatter, test for chkDisableNonExistingWikiLinks
2006.12.09 [1.3.0] in formatter, test for excluded wiki words specified in DisableWikiLinksList
2006.12.09 [1.2.2] fix logic in autoLinkWikiWords() (was allowing links TO shadow tiddlers, even when chkDisableWikiLinks is TRUE).  
2006.12.09 [1.2.1] revised logic for handling links in shadow content
2006.12.08 [1.2.0] added hijack of Tiddler.prototype.autoLinkWikiWords so regular (non-bracketed) WikiWords won't be added to the missing list
2006.05.24 [1.1.0] added option to NOT bypass automatic wikiword links when displaying default shadow content (default is to auto-link shadow content)
2006.02.05 [1.0.1] wrapped wikifier hijack in init function to eliminate globals and avoid FireFox 1.5.0.1 crash bug when referencing globals
2005.12.09 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.DisableWikiLinksPlugin= {major: 1, minor: 6, revision: 0, date: new Date(2008,7,22)};

if (config.options.chkDisableNonExistingWikiLinks==undefined) config.options.chkDisableNonExistingWikiLinks= false;
if (config.options.chkDisableWikiLinks==undefined) config.options.chkDisableWikiLinks=false;
if (config.options.txtDisableWikiLinksList==undefined) config.options.txtDisableWikiLinksList="DisableWikiLinksList";
if (config.options.chkAllowLinksFromShadowTiddlers==undefined) config.options.chkAllowLinksFromShadowTiddlers=true;
if (config.options.txtDisableWikiLinksTag==undefined) config.options.txtDisableWikiLinksTag="excludeWikiWords";

// find the formatter for wikiLink and replace handler with 'pass-thru' rendering
initDisableWikiLinksFormatter();
function initDisableWikiLinksFormatter() {
	for (var i=0; i<config.formatters.length && config.formatters[i].name!="wikiLink"; i++);
	config.formatters[i].coreHandler=config.formatters[i].handler;
	config.formatters[i].handler=function(w) {
		// supress any leading "~" (if present)
		var skip=(w.matchText.substr(0,1)==config.textPrimitives.unWikiLink)?1:0;
		var title=w.matchText.substr(skip);
		var exists=store.tiddlerExists(title);
		var inShadow=w.tiddler && store.isShadowTiddler(w.tiddler.title);
		// check for excluded Tiddler
		if (w.tiddler && w.tiddler.isTagged(config.options.txtDisableWikiLinksTag))
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// check for specific excluded wiki words
		var t=store.getTiddlerText(config.options.txtDisableWikiLinksList);
		if (t && t.length && t.indexOf(w.matchText)!=-1)
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// if not disabling links from shadows (default setting)
		if (config.options.chkAllowLinksFromShadowTiddlers && inShadow)
			return this.coreHandler(w);
		// check for non-existing non-shadow tiddler
		if (config.options.chkDisableNonExistingWikiLinks && !exists)
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// if not enabled, just do standard WikiWord link formatting
		if (!config.options.chkDisableWikiLinks)
			return this.coreHandler(w);
		// just return text without linking
		w.outputText(w.output,w.matchStart+skip,w.nextMatch)
	}
}

Tiddler.prototype.coreAutoLinkWikiWords = Tiddler.prototype.autoLinkWikiWords;
Tiddler.prototype.autoLinkWikiWords = function()
{
	// if all automatic links are not disabled, just return results from core function
	if (!config.options.chkDisableWikiLinks)
		return this.coreAutoLinkWikiWords.apply(this,arguments);
	return false;
}

Tiddler.prototype.disableWikiLinks_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	this.disableWikiLinks_changed.apply(this,arguments);
	// remove excluded wiki words from links array
	var t=store.getTiddlerText(config.options.txtDisableWikiLinksList,"").readBracketedList();
	if (t.length) for (var i=0; i<t.length; i++)
		if (this.links.contains(t[i]))
			this.links.splice(this.links.indexOf(t[i]),1);
};
//}}}
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'><span class='toolbar' macro='tiddler QuickEdit_replace'></span> <span class='toolbar' macro='tiddler QuickEdit_split'></span> <span class='toolbar' macro='tiddler QuickEdit_font'></span> <span class='toolbar' macro='tiddler QuickEdit_color'></span> <span class='toolbar' macro='tiddler QuickEdit_link'></span> <span class='toolbar' macro='tiddler QuickEdit_insert'></span> <span class='toolbar' macro='tiddler QuickEdit_custom'></span> <span class='toolbar'  
macro='tiddler QuickEdit_sort'></span></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
/***

!!!!!Usage
<<<
{{{
<<editTiddler TiddlerName label>>
}}}
*''~TiddlerName''<br>the title of the tiddler to edit (omit or use the keyword 'here' for current //containing// tiddler)
*''label''<br>command link text (default="edit")
The plugin also adds ''ctrl-enter'' as a ''keyboard shortcut to start editing'' the current //selected// tiddler (the one with an active toolbar menu)
<<<
!!!!!Revisions
<<<
2009.08.15 1.3.1 in shortcut, invoke editTiddler command handler (sets focus and custom fields)
2009.08.14 1.3.0 added CTRL-ENTER keyboard shortcut to invoke edit for 'selected' tiddlers
2007.03.22 1.2.0 added 'here' keyword and optional 2nd param to specify label text
2007.03.15 1.1.1 fixed 'get tiddler ID' logic so it actually works! D'oh! 
2007.03.11 1.1.0 changed 'get tiddler ID' logic so that macro can be used outside a tiddler (i.e., in mainMenu) by specifying the ID
2006.10.04 1.0.1 invoke findContainingTiddler() as fallback when 'tiddler' param is null
2006.04.28 1.0.0 Initial release
<<<
!!!Code
***/
//{{{
version.extensions.EditTiddlerPlugin={major:1, minor:3, revision:1, date: new Date(2009,8,15)};

config.macros.editTiddler={
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var tid=params.shift(); // use specified tiddler ID (or "here")
		if (!tid || tid=="here") {
			var here=story.findContainingTiddler(place);
			if (!here) return; // not in a tiddler, do nothing
			tid=here.getAttribute('tiddler'); // get ID from tiddler element
		}
		var label="edit"; if (params[0]) label=params.shift();
		createTiddlyButton(place,label,'edit tiddler: '+tid,this.onclick).setAttribute('which',tid);
	},
	onclick: function(e) {
		story.displayTiddler(null,this.getAttribute('which'),DEFAULT_EDIT_TEMPLATE);
	}
}
//}}}
//{{{
	addEvent(document,'keypress', function(ev) { var ev=ev||window.event;
		if (!ev.ctrlKey || ev.keyCode!=13) return; // CTRL-ENTER = edit tiddler
		story.forEachTiddler(function(title,tiddler){
			if (hasClass(tiddler,'selected') && !story.isDirty(title))
				config.commands.editTiddler.handler(ev,null,title);
		});
		return false;
	});
//}}}
<<firefoxPrivileges>>
/***


!!Usage:
*To create a footnote, just put the footnote text inside triple backticks.
*Footnotes are numbered automatically, and listed at the bottom of the tiddler.
*{{{Creating a footnote is easy. ```This is the text for my footnote```}}}
*[[Example|FootnotesDemo]]
***/
// /%
//!BEGIN-PLUGIN-CODE
config.footnotesPlugin = {
	backLabel: "R",
	prompt:"référence"
};

config.formatters.unshift( {
    name: "footnotes",
    match: "```",
    lookaheadRegExp: /```((?:.|\n)*?)```/g,
    handler: function(w)
    {
        this.lookaheadRegExp.lastIndex = w.matchStart;
        var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
        if(lookaheadMatch && lookaheadMatch.index == w.matchStart )
            {
			var tiddler = story.findContainingTiddler(w.output);
			if (!tiddler.notes)
				tiddler.notes = [];
			var title = tiddler.getAttribute("tiddler");
			tiddler.notes.pushUnique(lookaheadMatch[1]);
			var pos = tiddler.notes.indexOf(lookaheadMatch[1]) + 1;
			createTiddlyButton(w.output,pos,config.footnotesPlugin.prompt,function(){var x = document.getElementById(title+"ftn"+pos);window.scrollTo(0,ensureVisible(x)+(ensureVisible(x)<findScrollY()?(findWindowHeight()-x.offsetHeight):0));return false;},"ftnlink",title+"ftnlink"+pos);			
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
            }
    }
});

old_footnotes_refreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template,force)
{
    var tiddler = old_footnotes_refreshTiddler.apply(this,arguments);
	if (tiddler.notes && tiddler.notes.length)
	{
		var holder = createTiddlyElement(null,"div",null,"footnoteholder");
		var list = createTiddlyElement(holder,"ol",title+"footnoteholder");
		for (var i=0; i<tiddler.notes.length; i++)
		{
			var ftn = createTiddlyElement(list,"li",title+"ftn"+(i+1),"footnote");
			wikify(tiddler.notes[i]+" ",ftn);
			createTiddlyButton(ftn,"["+config.footnotesPlugin.backLabel+"]",config.footnotesPlugin.backLabel,function(){window.scrollTo(0,ensureVisible(document.getElementById(this.parentNode.id.replace("ftn","ftnlink"))));return false;},"ftnbklink");
		}
		var count = tiddler.childNodes.length;
		for (var j=0; j<count; j++){
			if(hasClass(tiddler.childNodes[j],"viewer")){
				var viewer = tiddler.childNodes[j];	
			}
		}
		viewer.appendChild(holder);
		tiddler.notes = [];
	}
    return tiddler;
};

setStylesheet(
".tiddler a.ftnlink {vertical-align: baseline; font-size: 0.7em; color:red !important; font-weight:bold;}\n"+
".tiddler a.ftnlink:hover, .tiddler .footnoteholder a.ftnbklink:hover{color:#fff;background:grey;}\n"+
".tiddler div.footnoteholder{margin:1.8em 1.0em; padding:0.1em 1.0em 0.1em 1.0em ;border-left: 1px solid #ccc;}"+
".tiddler footnoteholder ol {font-size: 0.9em; line-height: 1.2em;}\n"+
".tiddler .footnoteholder li.footnote {margin: 0 0 5px 0;}\n"+
".tiddler .footnoteholder a.ftnbklink{color:red;}\n","FootNotesStyles");
//!END-PLUGIN-CODE
// %/
A FormTemplate is used with the [[FormTiddlerPlugin]]. It is a tiddler that contains one or more HTML INPUT elements and defines the layout of a form. 

Other tiddlers can reference a FormTemplate through the [[FormTiddlerMacro]].

(See [[FormTiddler Introduction]])
/***

This plugin causes clicks on external links to be rendered as inline frames (~IFRAMEs) instead of opening new browser tabs/windows.
!!!!!Usage
<<<
Use standard TiddlyWiki external link syntax into your tiddler content. If {{{chkFramedLinks}}} is enabled or the tiddler is tagged with 'framedLinks' (see Configuration), then whenever you click the external link an IFRAME will be dynamically added to the content.  Clicking on the link again removes the IFRAME.  Hold down any modifier (shift, control, or alt) while clicking a link ''temporarily'' bypasses the IFRAME handling and use the standard link handling behavior.
<<<
!!!!!Configuration
<<<
<<option chkFramedLinks>> display inline frames for all external links
&nbsp; &nbsp; {{{<<option chkFramedLinks>>}}}
<<option chkFramedLinksTag>> display inline frames for external links in tiddlers tagged with: <<option txtFramedLinksTag>> 
&nbsp; &nbsp; {{{<<option chkFramedLinksTag>> <<option txtFramedLinksTag>>}}}
IFRAME size (CSS units: %, em, px, cm, in) - width: <<option txtFrameWidth>> height: <<option txtFrameHeight>>
&nbsp; &nbsp; {{{<<option txtFrameWidth>> <<option txtFrameHeight>>}}}
<<<
!!!!!Examples
<<<
Try these links:
*http://www.TiddlyWiki.com
*http://www.TiddlyTools.com
*http://groups.google.com/group/TiddlyWiki/topics
<<<
!!!!!Revisions
<<<
2008.11.14 [1.1.1] fixed handling for external links embedded in //shadow// tiddlers
2008.09.13 [1.1.0] added support to selectively enable embedded IFRAMEs if the containing tiddler is tagged with 'framedLinks'
2007.11.29 [1.0.5] added slider animation and improved CSS handling for IFRAME height/width to maximize display area
2007.11.29 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.FramedLinksPlugin= {major: 1, minor: 1, revision: 1, date: new Date(2008,11,14)};

var co=config.options; // abbreviation
if (co.chkFramedLinks==undefined) co.chkFramedLinks=false;
if (co.chkFramedLinksTag==undefined) co.chkFramedLinksTag=true;
if (co.txtFramedLinksTag==undefined) co.txtFramedLinksTag="framedLinks";
if (co.txtFrameWidth==undefined) co.txtFrameWidth="100%";
if (co.txtFrameHeight==undefined) co.txtFrameHeight="80%";

window.framedLinks_createExternalLink=createExternalLink;
window.createExternalLink=function(place,url)
{
	var link=this.framedLinks_createExternalLink.apply(this,arguments);
	link.onclick=function(ev) { var e=ev?ev:window.event;
		var co=config.options; // abbreviation
		var here=story.findContainingTiddler(this);
		if (here) var tid=store.getTiddler(here.getAttribute("tiddler"));
		var enabled=co.chkFramedLinks || co.chkFramedLinksTag && tid && tid.isTagged(co.txtFramedLinksTag);
		if (!enabled || e.ctrlKey || e.shiftKey || e.altKey) return; // BYPASS
		var p=this.parentNode; 
		var f=this.nextSibling?this.nextSibling.firstChild:null; // get the IFRAME... maybe...
		var w=co.txtFrameWidth; if (!w || !w.length) w="100%";
		var h=co.txtFrameHeight; if (!h || !h.length) h="80%";
		if (h.indexOf("%")) h=(findWindowHeight()*h.replace(/%/,"")/100)+"px"; // calc height as % of window
		var showing=f && f.nodeName.toUpperCase()=="IFRAME"; // does IFRAME really exist?
		var stretchCell=p.nodeName.toUpperCase()=="TD" && w.indexOf("%")!=-1 && w.replace(/%/,"")>=100;
		if (!showing) { // create an iframe
			link.style.display="block"; // force IFRAME onto line following link
			if (stretchCell) { p.setAttribute("savedWidth",p.style.width); p.style.width="100%"; } // adjust TD so IFRAME stretches
			var wrapper=createTiddlyElement(null,"span"); // wrapper for slider animation
			wrapper.setAttribute("url",this.href); // for async loading of frame after animation completes
			var f=createTiddlyElement(wrapper,"iframe"); // create IFRAME
			f.style.backgroundColor="#fff"; f.style.width=w; f.style.height=h;
			p.insertBefore(wrapper,this.nextSibling);
			function loadURL(wrapper) { var f=wrapper.firstChild; var url=wrapper.getAttribute("url");
				var d=f.contentDocument?f.contentDocument:(f.contentWindow?f.contentWindow.document:f.document);
				d.open(); d.writeln("<html>connecting to "+url+"</html>"); d.close();
				try { f.src=url; } // if the iframe can't handle the href
				catch(e) { alert(e.description?e.description:e.toString()); } // ... then report the error
				window.scrollTo(0,ensureVisible(wrapper));
			}
			if (!co.chkAnimate) loadURL(wrapper);
			else {
				var morph=new Slider(wrapper,true);
				morph.callback=loadURL;
				morph.properties.push({style: 'width', start: 0, end: 100, template: '%0%'});
				anim.startAnimating(morph);
			}
		} else { // remove iframe
			link.style.display="inline"; // restore link style
			if (stretchCell) p.style.width=p.getAttribute("savedWidth"); // restore previous width of TD
			if (!co.chkAnimate) p.removeChild(f.parentNode);
			else {
				var morph=new Slider(f.parentNode,false,false,"all");
				morph.properties.push({style: 'width', start: 100, end: 0, template: '%0%'});
				anim.startAnimating(morph);
			}
		}
		e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); return false;
	}
	return link;
}
//}}}
/***

/%***/
(function(e){var t=config.macros.get={config:"GetPluginConfig",dict:{errFunction:"Function undefined!",errFunctionInfo:"config.macros.get.get%0 is not a valid function!",errConfig:"Config not found!",errConfigInfo:"Config '%0' either does not exist or does not have a 'Tags' section!",defaultCategory:"Tiddler",tipSlider:"toggle '%0'",tipTab:"show '%0'"},identifiers:{filter:"$",fuzzy:"~",tiddler:"!"},template:{fuzzy:"%0",tiddler:"![[%1]]\n%0",section:"!%3 / [[%1]]\n%0",slice:";%3\n:%0",field:";%3\n:%0",tiddlerList:"!![[%1]]\n%0",sectionList:"!![[%1]]\n%0",sliceList:";[[%1]]\n:%0",fieldList:";[[%1]]\n:%0",tiddlerTable:"|[[%1]]|<<tiddler [[%4]]>>|",sectionTable:"|[[%1]]|<<tiddler [[%4]]>>|",sliceTable:"|[[%1]]|<<tiddler [[%4]]>>|",fieldTable:"|[[%1]]|%0|\n",tiddlerTableHead:"| !%0 | !Text |h\n",sectionTableHead:"| !%0 | !%1 |h\n",sliceTableHead:"| !%0 | !%1 |h\n",fieldTableHead:"| !%0 | !%1 |h\n",fmtSliders:'<<slider "%0" "%1" "%2" "%3">>',fmtTabs:'<<tabs "%0" %1>>',tableClass:"getTable",dateFormat:"0DD.0MM.YYYY"},handler:function(n,r,i,s,o,u){if(!o)return;var a,f,l,c="",h,p,d,v,m,g,y=story.findContainingTiddler(n),b=u&&u.tags?u.tags:[],w=o.parseParams("anon",null,true),E=getParam(w,"config",false),S=getParam(w,"filter"),x=i.contains("listfiltr"),T=i[0];if(t.identifiers.fuzzy==T){var N=true;i.shift()}title=u?u.title:y?y.getAttribute("tiddler"):"";if(t.identifiers.tiddler==T){var C=true;i.shift()}if(t.identifiers.filter==T){e(store.getTiddlerText(i[1]).split("\n")).each(function(){var t=this.split("|");e(store.filterTiddlers(t[0])).each(function(){if(title==this.title)c=t[1];return!c});return!c});if(!c)return}else if(E){refItem=getParam(w,"refItem",t.identifiers.tiddler);refTag=getParam(w,"refTag",t.identifiers.tiddler);E=E=="true"?t.config:E;d=store.getTiddlerText(E+"##Tags");if(!d){createTiddlyError(n,t.dict.errConfig,t.dict.errConfigInfo.format([E]))}else{d=d.split("\n");v=store.getTiddlerText(E+"##Template");for(y=0;y<d.length;y++){h=d[y];if([""," ","/","{"].contains(h.substr(0,1)))continue;h=d[y].split("|");f=e.trim(h[h.length>2?2:h.length-1]).parseParams("anon",null,true);if(u.title==h[h.length==1?0:1]&&(h.length==1||h[1]!="")&&refTag!="false")l=1;else if(b.contains(h[0])&&(h.length==1||h[0]!="")&&refItem!="false")l=2;if(l){wikify('<<tiddler "'+E+'##Template" with: "'+(l==1?getParam(f,"refTag",refTag):getParam(f,"refItem",refItem))+'" "'+u.title+'"'+">>",n);return}}}return}var k=0,L="",A=[],O,M,_="",D,P,H,B,j=e(n),F=j.attr("macroName")=="get",I=t[getParam(w,"exec","getValues")],q=getParam(w,"format",""),R=store.getTiddlerText(getParam(w,"template","")),U=i.contains("plain"),z=getParam(w,"sliders",i.contains("sliders")),W=getParam(w,"tabs",i.contains("tabs")),v=z?"Sliders":W?"Tabs":i.contains("table")?"Table":i.contains("list")||S?"List":"",X=v.toLowerCase(),V=["sliders","tabs"].contains(X),g=C?"":i[0],$=config.filters.get.delimiterRegExp.exec(c?"":g),J=$?$[2]:"",K=$?$[3]:"",Q=J=="##"?"section":J=="::"?"slice":J=="??"?"field":"tiddler",G=getParam(w,"valueprefix",""),Y=getParam(w,"prefix",""),Z=getParam(w,"suffix",""),et=getParam(w,"category",t.dict.defaultCategory),tt=getParam(w,"header",X!="table"?"":"|"+t.template.tableClass+" "+t.template.tableClass+Q.toUpperCase()+"|k\n"+t.template[Q+"TableHead"].format([et,K])),nt=getParam(w,"footer",""),rt=getParam(w,"separator","\n"),it=V?(new Date).formatString("YYYY0MM0DD0hh0mm0ss")+Math.random().toString().substr(6):"";if(!c){title=N||!g?title:$?$[1]?$[1]:title:g;if(V){O=t.template["fmt"+(X=="tabs"?"Tabs":"Sliders")]}else{O=U?"%0":q?q:R?R:t.template[N?"fuzzy":J=="##"?"section"+v:J=="::"?"slice"+v:J=="??"?"field"+v:"tiddler"+v]}if(I){H=I.call(t,o,N?g:(X?"":title)+J+K,title,Q,K,X,N)}else{createTiddlyError(n,t.dict.errFunction,t.dict.errFunctionInfo.format([get]));return false}do{k++;A.push(L);L=getParam(w,"$"+k,null)}while(L!=null);for(D=0;D<H.length;D++){M=H[D][0];P=G+H[D][1];P=P.indexOf("***/\n")!=0?P:P.substr(5);for(k=1;k<A.length;k++){P=P.replace(new RegExp("\\$"+k,"mg"),A[k])}B=(X?M:"")+g;O=O.replace(/\\n/mg,"\n");if(X=="tabs"){_+=" [[%0]] [[%1]] [[%2]]".format([M,t.dict.tipTab.format([B]),B])}else{c+=(Y+(X=="sliders"?C&&title==M?"":O.format(["chk"+("string"==typeof z?z:it)+M.replace(/(?!\w)[\x00-\xC0]/mg,"_"),B,M,t.dict.tipSlider.format([B])]):O.format([P,M,Q,K,B,et]))+Z).replace(/\$count/mg,String.zeroPad(D+1,H.length.toString().length))+(X&&D<H.length-1?rt:"")}}}if(X=="tabs"){c=(Y+O.format(["txt"+("string"==typeof W?W:it),_])+Z).replace(/\$count/mg,H.length)}c=(tt?tt:"")+c+(nt?nt:"");if(!F){j=e("<span />");j.appendTo(n);n=j[0];j.attr({refresh:"macro",macroName:"get",params:o})}wikify((x?"{{lf_get{\n%0\n}}}<<listfiltr>>":"%0").format([e.trim(c)]),n)},refresh:function(n,r){e(n).empty();t.handler(n,"get",r.readMacroParams(),null,r)},getValues:function(e,n,r,i,s,o,u){var a,f,l,c,h,p=[],d=e.parseParams("getval",null,true),v=getParam(d,"filter",null),m=u?config.macros.ns:false,c=o?v?store.filterTiddlers(v):store.getTiddlers("title"):[{title:r}];if(u)o="";if(m){m=m?m.defaults.separator:"";l=r+m+n;m=store.getTiddlerText(l);if(m){p.push([l,m]);r=store.getTiddler(l);i="tiddler";u=null}}if(!m){for(f=0;f<c.length;f++){h=undefined;l=c[f].title;if(u||i=="field"){h=store.getValue(l,u?n:s);if(u&&h)i="field"}if(!h){if(u){h=store.getTiddlerText(l+"::"+n);if(h)i="slice";if(!h){h=store.getTiddlerText(l+"##"+n);if(h)i="section"}if(!h){h=store.getTiddlerText(n);if(h){i="tiddler"}}}else{h=store.getTiddlerText((o?l:"")+n)}}a=h&&h.length==12?Date.convertFromYYYYMMDDHHMM(h):undefined;if(a&&!isNaN(a.getMonth))h=a.formatString(t.template.dateFormat);if(h){p.push([l,h])}}}return p}};config.filters.get=function(e,t){var n=t.index==0,r=config.filters.get.delimiterRegExp.exec(t[3]),i=r?r[1]:t[3],s=r?r[2]:"",o=r?r[3]:"",u=n?store.getTiddlers("title"):e.slice();e=[];u.map(function(t){if(i&&i==t.title||!i&&(s=="??"&&store.getValue(t.title,o)||store.getTiddlerText(t.title+s+o)))e.pushUnique(t)});return e};config.filters.get.delimiterRegExp=/(.*)?(\#\#|::|\?\?)(.*)/})(jQuery)
//%/
/***

!!!!!Documentation
>see [[GridPluginInfo]]
!!!!!Revisions
<<<
2010.03.06 2.0.7 fixed setSection()
2009.09.26 2.0.6 fixed setSlice() for existing slices with empty values
|please see [[GridPluginInfo]] for additional revision details|
2007.01.30 0.0.1 started
<<<
!!!!!Code
***/
//{{{
version.extensions.GridPlugin= {major: 2, minor: 0, revision: 7, date: new Date(2010,3,6)};

config.macros.grid= {
	sizeSliceName: 'TiddlerSize', // fake slice to show # of bytes in tiddler 
	noColsMsg: '@@display:block;border:1px solid;there are no columns to display@@',
	showHeaders:'&#x25BA;&#x25BA;&#x25BA;',
	showHeadersTip:'show column headings',
	hideHeaders:'&#x25C4;&#x25C4;&#x25C4;',
	hideHeadersTip:'hide column headings',
	slicesRE: /(?:^\|\s*[\'\/]*~?(\w+)\:?[\'\/]*\s*\|\s*(.*?)\s*\|$)/gm,
	gridStyles: '.viewer .grid thead td, .grid thead td { background:transparent; }',
	init: function() { setStylesheet(this.gridStyles,'gridStyles'); },
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var edit=params.contains('edit') && !readOnly; // no editing if readOnly
		var wiki=params.contains('wikify');
		var inline=params.contains('inline');
		if (inline) var heads=true;
		var all=params.contains('all');
		params=paramString.parseParams('name',null,true,false,true); // for NAMED VALUES
		var filter=getParam(params,'filter',''); // core or MatchTagsPlugin tag filter syntax
		if (filter.length && !filter.startsWith('[tag[')) filter='[tag['+filter+']]';
		var tags=this.getList(getParam(params,'tags'),true); // older "match at least one tag" syntax
		if (tags.length) filter='[tag['+tags.join(']][tag[')+']]'+filter;
		var names=this.getList(getParam(params,'columns')); // slices/sections/fields to use as columns
		var clip=getParam(params,'clip',0); // 0=no clipping
		var width=getParam(params,'width','auto');
		var rc=this.getRowsAndCols(filter,names,all);
		if (!rc.cols.length) wikify(this.noColsMsg,place);
		else this.renderTable(place,rc.rows,rc.cols,inline,heads,wiki,edit,clip,width);
	},
	getList: function(t,gettags) {
		var items=(t||'').readBracketedList();
		for (var i=0;i<items.length;i++) { var item=items[i];
			// replace item with list based on item prefix:
			// +name  contents of tiddler (space-separated list)
			// @name  slices/tags,
			// @!name sections
			// @=name fields
			if ('@+'.indexOf(item.substr(0,1))!=-1) {
				var title=item.substr(1); var type=title.substr(0,1);
				if ('=!'.indexOf(type)!=-1) title=title.substr(1);
				if (title=='here')
					title=story.findContainingTiddler(place).getAttribute('tiddler');
				var tid=store.getTiddler(title); if (tid) {
					var list=[];
					if (item.substr(0,1)=='+') list=tid.text.readBracketedList();  // contents
					else if (gettags) list=tid.tags; // tags
					else if (type=='!') list=this.getSections(tid.title);  // sections
					else if (type=='=') list=this.getFields(tid.title); // fields
					else for (var s in this.getSlices(tid.title)) list.push(s);  // slices
					items.splice(i,1); // remove item
					for (var j=0;j<list.length;j++,i++) items.splice(i,0,list[j]); // add list
				}
			}
		}
		return items;
	},
	getRowsAndCols: function(filter,names,all) {
		var rows=[]; var cols=[]; // get rows (tiddlers) and columns (slices)
		var tiddlers=filter&&filter.length?store.filterTiddlers(filter):store.getTiddlers();
		for (i=0; i<tiddlers.length; i++) {
			var slices=this.getSlices(tiddlers[i].title);
			var include=false; for (var s in slices) { cols.pushUnique(s); include=true; }
			if (include||all) rows.push(tiddlers[i].title);
		}
		rows=rows.sort();
		// use specified list instead of collected slice names
		if (names.length) var cols=names;
		return {rows:rows,cols:cols};
	},
	renderTable: function(place,rows,cols,inline,heads,wiki,edit,clip,width) {
		var span=createTiddlyElement(place,'span')
		span.innerHTML=this.generateTable(rows,cols,inline,heads,wiki,edit,clip,width)
		// replace TD content with wikified elements
		var tds=span.getElementsByTagName('td');
		for (var t=0; t<tds.length; t++) {
			if (hasClass(tds[t],'wiki')) {
				var txt=getPlainText(tds[t]);
				if (hasClass(tds[t],'grid_heading')) txt='[['+txt+']]';
				removeChildren(tds[t]);
				wikify(txt,tds[t]);
			}
		}
	},
	generateTable: function(rows,cols,inline,heads,wiki,edit,clip,width) {
		var out= "<html><table class='sortable grid' style='border:0;padding:0;spacing:0;"
			+"border-collapse:collapse;width:"+width+"'>";

		// column headings
		out+=	 "<thead><tr style='border:0;vertical-align:bottom'>"
			+"<td style='text-align:right;border:0'>"
			+"<a href='javascript:;' style='font-size:80%;'"
			+"	title='"+(heads?this.hideHeadersTip:this.showHeadersTip)+"'"
			+"	onclick='return config.macros.grid.toggleHeaders("
			+"		this,event,"+(heads?"true":"false")+")'>"
			+(heads?this.hideHeaders:this.showHeaders)
			+"</a>"
			+"</td>";
		for (var i=0;i<cols.length;i++) {
			out+=	 "<td style='text-align:center;cursor:pointer;"
				+"	border:0;padding-left:2px;padding-right:2px;' "
				+"<span style='display:"+(heads?"block":"none")+"'>"
				+cols[i].replace(/^[=!]/,'')
				+"</span></td>";
		}
		out+="</tr></thead>";

		// row heading format ('fake' tiddler link)
		// %0=cell width, %1=tiddler name, %2='wiki' classname (optional), %3='inline' classname (optional)
		var head="<td style='text-align:right;border:0;padding-right:2px;white-space:nowrap;%0;'>"
			+"<a href='javascript:;' tid=\"%1\" class='grid_heading %2 %3' "
			+"onclick='story.displayTiddler("
			+"	this,this.getAttribute(\"tid\"));return false'>%1</a></td>";

		// row value format
		// %0=bgcolor, %1=cellwidth, %2=cell alignment, %3=tiddler name
		// %4=slice/section/field name, %5=tooltip, %6='wiki' classname (optional),
		// %7='inline' classname (optional), %8=cell content value
		var cell="<td style='background-color:%0;border:1px solid;%1;%2;' tid=\"%3\" ";
		if (edit) cell+="onclick='return config.macros.grid.editInPlace("
			+"this,event,this.getAttribute(\"tid\"),\"%4\");' ";
		cell+="title=\"%5\" class='grid_content %6 %7'>%8</td>";

		// generate rows
		for (var i=0;i<rows.length;i++) {
			var tiddlersrc=rows[i].replace(/"/g,"&#x22;");
			out+="<tr style='border:0;vertical-align:top'>";
			out+=head.format([inline?'width:1%':'',tiddlersrc,wiki?'wiki':'',inline?'inline':'']);
			for (var j=0;j<cols.length;j++) { var c=cols[j];
				var val=this.get(rows[i],c);
				var content="&nbsp;";
				if (val.length && inline) {
					content=val.htmlEncode();
					if (c=='=text'||clip) // truncate
						content=val.substr(0,clip||500)
							+(val.length>(clip||500)?"...":"");
					if (c=='=text') // format tiddler source
						content='<html><code style="line-height:100%">'
							+content.replace(/\n/g,'<br>')
							+'</code></html>';
				}
				var title=this.showName(tiddlersrc,c)+(!inline?'='+val:'');
				out+=cell.format([
					val.length&&!inline?'#999':'transparent', !inline?'width:1em;':'',
					inline&&!isNaN(parseFloat(val))?'text-align:right !important;':'',
					tiddlersrc, c, title, wiki?'wiki':'', inline?'inline':'', content]);
			}
			out+='</tr>';
		}
		out+="</table></html>";
		return out;
	},
	showName: function(tid,name) {
		if (name==this.sizeSliceName) var fmt='%0 - size (in bytes)'; // fake slice
		var fmt=(name.substr(0,1)=='=')?'%1@%0':(name.substr(0,1)=='!')?'%1##%0':'%0::%1';
		return fmt.format([tid,name.replace(/^[=!]/,'')]);
	},
	toggleHeaders: function(here,event,defOpen) {
		if (here.expanded==undefined) here.expanded=defOpen;
		var ex=here.expanded=!here.expanded; 
		here.innerHTML=ex?this.hideHeaders:this.showHeaders;
		here.title=ex?this.hideHeadersTip:this.showHeadersTip;
		var cells=here.parentNode.parentNode.getElementsByTagName('td');
		for (i=1; i<cells.length; i++) cells[i].firstChild.style.display=ex?'inline':'none';
		event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;
	},
	editInPlace: function(here,event,tid,name) {
		if (here.editing) return false; // already editing, don't re-init
		if (name==this.sizeSliceName) return false; // read-only fake slice
		var v=this.get(tid,name); // current value
		var lines=v.split('\n').length;
		var title=this.showName(tid,name);
		var style=lines>1?'font-size:90%;width:99%;':'font-size:100%;width:95%;line-height:100%;'
		var maxlines=Math.min(lines,config.options['txtMaxEditRows']); // for textarea
		var html=lines>1?'<textarea rows='+maxlines:'<input type="text"';
		html   +=' tid="'+tid.replace(/"/g,'&#x22;')+'"'
			+' name="'+name.replace(/"/g,'&#x22;')+'"'
			+' style="margin:0px;padding:1px 0px 1px 3px;border:0;'+style+'"'
			+' title="'+title+' (ENTER=submit, ESC=cancel)"'
			+' onblur="config.macros.grid.blur(this,event)"'
			+' onkeydown="config.macros.grid.keydown(this,event)"';
		html+=lines>1?'></textarea>':'>';
		here.editing=true;
		here.setAttribute('savedWidth',here.style.width);
		here.setAttribute('savedPadding',here.style.padding);
		here.setAttribute('savedColor',here.style.backgroundColor);
		if (!hasClass(here,'inline')) here.style.width='99%';
		here.style.padding='0px'; 
		here.style.backgroundColor='#fff';
		here.innerHTML=html;
		var ta=here.firstChild; ta.value=v; ta.focus(); ta.select();
		event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;
	},
	keydown: function(here,ev) { ev=ev||window.event;
		var tid=here.getAttribute('tid');
		var name=here.getAttribute('name');
		if (ev.keyCode==27) {
			var currval=this.get(tid,name);
			if (here.value==currval) { here.blur(); return false; }
			here.asking=true; // prevents blur handling during confirm()
			var discard=confirm('OK to discard changes to '+this.showName(tid,name)+'?');
			here.asking=false;
			if (discard) { here.value=currval; here.blur(); }
			return false;
		}
		else if (ev.keyCode==13 && !ev.ctrlKey) {
			this.set(tid,name,here.value);
			here.blur();
			return false;
		}
	},
	blur: function(here,ev) { ev=ev||window.event;
		if (here.asking) return false;
		var tid=here.getAttribute('tid');
		var name=here.getAttribute('name');
		var currval=this.get(tid,name);
		var msg=this.showName(tid,name)+' has changed... OK to save changes?';
		if (here.value!=currval && confirm(msg))
			{ this.set(tid,name,here.value); currval=this.get(tid,name); }
		var target=here.parentNode;
		target.editing=false;
		target.style.backgroundColor=target.getAttribute('savedColor');
		target.style.padding=target.getAttribute('savedPadding');
		target.style.width=target.getAttribute('savedWidth');
		if (name=='=text') currval='<html><code>'+currval.substr(0,500).replace(/\\n/g,'<br>')+'</code></html>';
		if (hasClass(target,'wiki')) { removeChildren(target); wikify(currval,target); }
		else target.innerHTML=hasClass(target,'inline')?currval:'&nbsp;';
	},
	get: function(tid,name) {
		if (name.substr(0,1)=='=') var v=store.getValue(tid,name.substr(1)); // field
		else if (name.substr(0,1)=='!') var v=store.getTiddlerText(tid+'##'+name.substr(1));  // section
		else if (name==this.sizeSliceName) var v=store.getTiddlerText(tid,'').length.toString();  // fake slice
		else var v=store.getTiddlerSlice(tid,name); // real slice
		return v||'';
	},
	set: function(tid,name,val) {
		if (val==this.get(tid,name)) return false; // unchanged... do nothing
		if (name.substr(0,1)=='=') // field
			{  name=name.substr(1); store.setValue(tid,name,val); }
		else if (name.substr(0,1)=='!') // section
			{  name=name.substr(1); this.setSection(tid,name,val); }
		else // slice
			{ this.setSlice(tid,name,val); }
		displayMessage(this.showName(tid,name)+' has been updated');
		return false;
	},
	setSection: function(tid,name,newval) {
		var t=store.getTiddler(tid); if (!t) { var t=new Tiddler(); t.text=''; }
		var oldval=this.get(tid,'!'+name).escapeRegExp();
		var pattern=new RegExp('(.*!{1,6}'+name+'\\n)'+oldval+'((?:\\n!{1,6}|$).*)');
		var newText=t.text.replace(pattern,'$1'+newval+'$2');
		var who=config.options.txtUserName; var when=new Date();
		if (config.options.chkForceMinorUpdate) { var who=t.modifier; var when=t.modified; }
		store.saveTiddler(tid,tid,newText,who,when,t.tags,t.fields);
		story.refreshTiddler(tid,null,true);
	},
	setSlice: function(tid,name,newval) {
		var t=store.getTiddler(tid); if (!t) { var t=new Tiddler(); t.text=''; }
		var oldval=this.get(tid,name)||'';
		var pattern="((?:^|\\n)\\|\\s*[\\'\\/]*~?(?:"
			+name.escapeRegExp()
			+")\\:?[\\'\\/]*\\s*\\|\\s*)(?:"
			+oldval.escapeRegExp()
			+")(\\s*\\|(?:\\n|$))";
		var match=t.text.match(new RegExp(pattern));
		if (match) {
			var pos=t.text.indexOf(match[0]);
			var newText=t.text.substr(0,pos)
				+match[1]+newval+match[2]
				+t.text.substr(pos+match[0].length);
		} else { // create new slice at start of tiddler or after last existing slice (if any)
			var match=t.text.match(this.slicesRE); if (match) var last=match[match.length-1];
			var pos=last?t.text.indexOf(last)+last.length+1:0; 
			var newText=t.text.substr(0,pos)+'|'+name+'|'+newval+'|\n'+t.text.substr(pos);
		}
		var who=config.options.txtUserName; var when=new Date();
		if (config.options.chkForceMinorUpdate) { var who=t.modifier; var when=t.modified; }
		store.saveTiddler(tid,tid,newText,who,when,t.tags,t.fields);
		story.refreshTiddler(tid,null,true);
	},
	getSlices: function(tid) {
		var slices = {};
		var text = store.getTiddlerText(tid,'');
		slices[this.sizeSliceName]=text.length.toString();  // fake slice
		this.slicesRE.lastIndex = 0;
		do {
			var m = this.slicesRE.exec(text);
			if (m) { if (m[1]) slices[m[1]] = m[2]; else slices[m[3]] = m[4]; }
		} while(m);
		return slices;
	},
	getSections: function(tid) {
		var s=[];
		var t=store.getTiddlerText(tid,'');
		var p=/(?:^|\n)!{1,6}([^\n]*)\n/gm;
		do { var m=p.exec(t); if (m) { s.push(m[1]); } } while(m);
		return s;
	},
	getFields: function(tid) {
		var t=store.getTiddler(tid); if (!t) return [];
		var fields=['=created','=modified','=modifier','=text','=tags'];
		for (var f in t.fields) fields.push('='+f);
		return fields;
	}
};
//}}}
<<toggleSideBar '''' hide>><<renameButton ''>><<setIcon k/hover.gif>>
/***

!Description:
Provides a hovering menu on the edge of the screen for commonly used commands, that scrolls with the page.

!Demo:
Observe the hovering menu on the right edge of the screen.

!Installation:
Copy the contents of this tiddler to your TW, tag with systemConfig, save and reload your TW.
To customize your HoverMenu, edit the HoverMenu shadow tiddler.

To customize whether the menu sticks to the right or left edge of the screen, and its start position, edit the HoverMenu configuration settings part of the code below. It's well documented, so don't be scared!

The menu has an id of hoverMenu, in case you want to style the buttons in it using css.

!Notes:
Since the default HoverMenu contains buttons for toggling the side bar and jumping to the top of the screen and to open tiddlers, the ToggleSideBarMacro, JumpMacro and the JumpToTopMacro are included in this tiddler, so you dont need to install them separately. Having them installed separately as well could lead to complications.

If you dont intend to use these three macros at all, feel free to remove those sections of code in this tiddler.

!To Do:
* rework code to allow multiple hovering menus in different positions, horizontal etc.
* incorporate code for keyboard shortcuts that correspond to the buttons in the hovermenu

!History:
*03-08-06, ver 1.1.2: compatibility fix with SelectThemePlugin
*03-08-06,  ver 1.11: fixed error with button tooltips
*27-07-06, ver 1.1 : added JumpMacro to hoverMenu
*23-07-06

!Code
***/

/***
start HoverMenu plugin code
***/
//{{{
config.hoverMenu={};
//}}}

/***
HoverMenu configuration settings
***/
//{{{
config.hoverMenu.settings={
               align: 'right',    //align menu to right or left side of screen, possible values are 'right' and 'left'               
               x: 0,              // horizontal distance of menu from side of screen, increase to your liking.
               y: 0            //vertical distance of menu from top of screen at start, increase or decrease to your liking
               };
//}}}

//{{{
//continue HoverMenu plugin code
config.hoverMenu.handler=function()
{              
               if (!document.getElementById("hoverMenu"))
               {
               var theMenu = createTiddlyElement(document.getElementById("contentWrapper"), "div","hoverMenu");
               theMenu.setAttribute("refresh","content");
               theMenu.setAttribute("tiddler","HoverMenu");
               var menuContent = store.getTiddlerText("HoverMenu");
               wikify(menuContent,theMenu);
              }

	       var Xloc = this.settings.x;
	       Yloc =this.settings.y;
	       var ns = (navigator.appName.indexOf("Netscape") != -1);
	       function SetMenu(id)
                        {
		        var GetElements=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
		        if(document.layers)GetElements.style=GetElements;
		        GetElements.sP=function(x,y){this.style[config.hoverMenu.settings.align]=x +"px";this.style.top=y +"px";};
		        GetElements.x = Xloc;
		        GetElements.y = findScrollY();
		        GetElements.y += Yloc;
		        return GetElements;
	                }
               window.LoCate_XY=function()
                        {
		        var pY =  findScrollY();
                        ftlObj.y += (pY + Yloc - ftlObj.y)/15;
		        ftlObj.sP(ftlObj.x, ftlObj.y);
		        setTimeout("LoCate_XY()", 10);
	                }
               ftlObj = SetMenu("hoverMenu");
	       LoCate_XY();
};

window.old_lewcid_hovermenu_restart = restart;
restart = function()
{
               window.old_lewcid_hovermenu_restart();
               config.hoverMenu.handler();
};

setStylesheet(
"#hoverMenu .imgLink, #hoverMenu .imgLink:hover {border:none; padding:0px; float:right; margin-bottom:2px; margin-top:0px;}\n"+
"#hoverMenu  .button, #hoverMenu  .tiddlyLink {border:none; font-weight:bold; background-color: transparent; padding:10px 0px; float:right; margin-bottom:0px;}\n"+
"#hoverMenu .button {width:100%; text-align:center}"+
"#hoverMenu { position:absolute; width:38px;}\n"+
"\n","hoverMenuStyles");


config.macros.renameButton={};
config.macros.renameButton.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{

               if (place.lastChild.tagName!="BR")
                     {
                      place.lastChild.firstChild.data = params[0];
                      if (params[1]) {place.lastChild.title = params[1];}
                     }
};

config.shadowTiddlers["HoverMenu"]="<<top>>\n<<toggleSideBar>><<renameButton '>' >>\n<<jump j '' top>>\n<<saveChanges>><<renameButton s 'Save TiddlyWiki'>>\n<<newTiddler>><<renameButton n>>\n";
//}}}
//end HoverMenu plugin code

//Start ToggleSideBarMacro code
//{{{
config.macros.toggleSideBar={};

config.macros.toggleSideBar.settings={
         styleHide :  "#sidebar { display: none;}\n"+"#contentWrapper #displayArea { margin-right: 1em;}\n"+"",
         styleShow : " ",
         arrow1: "«",
         arrow2: "»"
};

config.macros.toggleSideBar.handler=function (place,macroName,params,wikifier,paramString,tiddler)
{
          var tooltip= params[1]||'toggle sidebar';
          var mode = (params[2] && params[2]=="hide")? "hide":"show";
          var arrow = (mode == "hide")? this.settings.arrow1:this.settings.arrow2;
          var label= (params[0]&&params[0]!='.')?params[0]+" "+arrow:arrow;
          var theBtn = createTiddlyButton(place,label,tooltip,this.onToggleSideBar,"button HideSideBarButton");
          if (mode == "hide")
             { 
             (document.getElementById("sidebar")).setAttribute("toggle","hide");
              setStylesheet(this.settings.styleHide,"ToggleSideBarStyles");
             }
};

config.macros.toggleSideBar.onToggleSideBar = function(){
          var sidebar = document.getElementById("sidebar");
          var settings = config.macros.toggleSideBar.settings;
          if (sidebar.getAttribute("toggle")=='hide')
             {
              setStylesheet(settings.styleShow,"ToggleSideBarStyles");
              sidebar.setAttribute("toggle","show");
              this.firstChild.data= (this.firstChild.data).replace(settings.arrow1,settings.arrow2);
              }
          else
              {    
               setStylesheet(settings.styleHide,"ToggleSideBarStyles");
               sidebar.setAttribute("toggle","hide");
               this.firstChild.data= (this.firstChild.data).replace(settings.arrow2,settings.arrow1);
              }

     return false;
}

setStylesheet(".HideSideBarButton .button {font-weight:bold; padding: 0 5px;}\n","ToggleSideBarButtonStyles");
//}}}
//end ToggleSideBarMacro code

//start JumpToTopMacro code
//{{{
config.macros.top={};
config.macros.top.handler=function(place,macroName)
{
               createTiddlyButton(place,"^","jump to top",this.onclick);
}
config.macros.top.onclick=function()
{
               window.scrollTo(0,0);
};

config.commands.top =
{
               text:" ^ ",
               tooltip:"jump to top"
};

config.commands.top.handler = function(event,src,title)
{
               window.scrollTo(0,0);
}
//}}}
//end JumpToStartMacro code

//start JumpMacro code
//{{{
config.macros.jump= {};
config.macros.jump.handler = function (place,macroName,params,wikifier,paramString,tiddler)
{
        var label = (params[0] && params[0]!=".")? params[0]: 'jump';
        var tooltip = (params[1] && params[1]!=".")? params[1]: 'jump to an open tiddler';
        var top = (params[2] && params[2]=='top') ? true: false;        

        var btn =createTiddlyButton(place,label,tooltip,this.onclick);
        if (top==true)
              btn.setAttribute("top","true")
}

config.macros.jump.onclick = function(e)
{
        if (!e) var e = window.event;
        var theTarget = resolveTarget(e);
        var top = theTarget.getAttribute("top");
	var popup = Popup.create(this);
	if(popup)
		{
                 if(top=="true")
                                {createTiddlyButton(createTiddlyElement(popup,"li"),'Top ↑','Top of TW',config.macros.jump.top);
                                 createTiddlyElement(popup,"hr");}
		
		story.forEachTiddler(function(title,element) {
			createTiddlyLink(createTiddlyElement(popup,"li"),title,true);
			});
                }
	Popup.show(popup,false);
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return false;
}

config.macros.jump.top = function()
{
       window.scrollTo(0,0);
}
//}}}
//end JumpMacro code

//utility functions
//{{{
Popup.show = function(unused,slowly)
{
	var curr = Popup.stack[Popup.stack.length-1];
	var rootLeft = findPosX(curr.root);
	var rootTop = findPosY(curr.root);
	var rootHeight = curr.root.offsetHeight;
	var popupLeft = rootLeft;
	var popupTop = rootTop + rootHeight;
	var popupWidth = curr.popup.offsetWidth;
	var winWidth = findWindowWidth();
        if (isChild(curr.root,'hoverMenu'))
              var x = config.hoverMenu.settings.x;
        else
              var x = 0;
	if(popupLeft + popupWidth+x > winWidth)
		popupLeft = winWidth - popupWidth -x;
        if (isChild(curr.root,'hoverMenu'))
  	        {curr.popup.style.right = x + "px";}
        else
                curr.popup.style.left = popupLeft + "px";
	curr.popup.style.top = popupTop + "px";
	curr.popup.style.display = "block";
	addClass(curr.root,"highlight");
	if(config.options.chkAnimate)
		anim.startAnimating(new Scroller(curr.popup,slowly));
	else
		window.scrollTo(0,ensureVisible(curr.popup));
}

window.isChild = function(e,parentId) {
        while (e != null) {
                var parent = document.getElementById(parentId);
                if (parent == e) return true;
                e = e.parentNode;
                }
        return false;
};
//}}}
/***

!Usage
@@{{{<<icap '[img[tooltip|filename]]'>>}}}@@
Use standard TW image markup, including [>img or [<img to float image right or left.
Enclose image markup in quotes as argument for the icap macro.

Display of the image is controlled by three CSS classes which need to be added to [[StyleSheet]] (and can of course be customized to the user's taste):

.icapr {float: right; font-size: 9px; color: black; background-color: white; border: 1px solid #ccc; padding: 5px; margin: 5px;}
.icapl {float: left; font-size: 9px; color: black; background-color: white; border: 1px solid #ccc; padding: 5px; margin: 5px;}
.icapn {display: block; font-size: 9px; color: black; background-color: white; border: 1px solid #ccc; padding: 5px; margin: 5px;}
.icapr img {border: none; padding: 0; margin: 0;}
.icapl img {border: none; padding: 0; margin: 0;}
.icapn img {border: none; padding: 0; margin: 0;}

!Code
***/
//{{{

config.macros.icap = {};
config.macros.icap.handler = function(place,macroName,params)
 { var imarkup = params[0];
   var ifloat = imarkup.substr(1,1);
   if (ifloat == ">")
    { icss = "icapr";
      imarkup = imarkup.substr(0,1) + imarkup.substr(2);
      }
   else if (ifloat == "<")
    { icss = "icapl";
      imarkup = imarkup.substr(0,1) + imarkup.substr(2);
      }
   else
    { icss = "icapn";
      }
   var icapt = imarkup.substring(imarkup.indexOf("[",1)+1,imarkup.indexOf("|",0));
   var idiv = "{{" + icss + "{" + imarkup + "<br>" + icapt + "}}}"
   wikify (idiv,place,null,null);
   return false;
   };

//}}}
/***

This plugin adds optional syntax to scale an image to a specified width and height and/or interactively resize the image with the mouse.
!!!!!Usage
<<<
The extended image syntax is:
{{{
[img(w+,h+)[...][...]]
}}}
where ''(w,h)'' indicates the desired width and height (in CSS units, e.g., px, em, cm, in, or %). Use ''auto'' (or a blank value) for either dimension to scale that dimension proportionally (i.e., maintain the aspect ratio). You can also calculate a CSS value 'on-the-fly' by using a //javascript expression// enclosed between """{{""" and """}}""". Appending a plus sign (+) to a dimension enables interactive resizing in that dimension (by dragging the mouse inside the image). Use ~SHIFT-click to show the full-sized (un-scaled) image. Use ~CTRL-click to restore the starting size (either scaled or full-sized).
<<<
!!!!!Examples
<<<
{{{
[img(100px+,75px+)[images/meow2.jpg]]
}}}
[img(100px+,75px+)[images/meow2.jpg]]
{{{
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
}}}
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
{{tagClear{
}}}
<<<
!!!!!Revisions
<<<
2011.09.03 [1.2.3] bypass addStretchHandlers() if no '+' suffix is used (i.e., not resizable)
2010.07.24 [1.2.2] moved tip/dragtip text to config.formatterHelpers.imageSize object to enable customization
2009.02.24 [1.2.1] cleanup width/height regexp, use '+' suffix for resizing
2009.02.22 [1.2.0] added stretchable images
2008.01.19 [1.1.0] added evaluated width/height values
2008.01.18 [1.0.1] regexp for "(width,height)" now passes all CSS values to browser for validation
2008.01.17 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.ImageSizePlugin= {major: 1, minor: 2, revision: 3, date: new Date(2011,9,3)};
//}}}
//{{{
var f=config.formatters[config.formatters.findByField("name","image")];
f.match="\\[[<>]?[Ii][Mm][Gg](?:\\([^,]*,[^\\)]*\\))?\\[";
f.lookaheadRegExp=/\[([<]?)(>?)[Ii][Mm][Gg](?:\(([^,]*),([^\)]*)\))?\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg;
f.handler=function(w) {
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var floatLeft=lookaheadMatch[1];
		var floatRight=lookaheadMatch[2];
		var width=lookaheadMatch[3];
		var height=lookaheadMatch[4];
		var tooltip=lookaheadMatch[5];
		var src=lookaheadMatch[6];
		var link=lookaheadMatch[7];

		// Simple bracketted link
		var e = w.output;
		if(link) { // LINKED IMAGE
			if (config.formatterHelpers.isExternalLink(link)) {
				if (config.macros.attach && config.macros.attach.isAttachment(link)) {
					// see [[AttachFilePluginFormatters]]
					e = createExternalLink(w.output,link);
					e.href=config.macros.attach.getAttachment(link);
					e.title = config.macros.attach.linkTooltip + link;
				} else
					e = createExternalLink(w.output,link);
			} else 
				e = createTiddlyLink(w.output,link,false,null,w.isStatic);
			addClass(e,"imageLink");
		}

		var img = createTiddlyElement(e,"img");
		if(floatLeft) img.align="left"; else if(floatRight) img.align="right";
		if(width||height) {
			var x=width.trim(); var y=height.trim();
			var stretchW=(x.substr(x.length-1,1)=='+'); if (stretchW) x=x.substr(0,x.length-1);
			var stretchH=(y.substr(y.length-1,1)=='+'); if (stretchH) y=y.substr(0,y.length-1);
			if (x.substr(0,2)=="{{")
				{ try{x=eval(x.substr(2,x.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			if (y.substr(0,2)=="{{")
				{ try{y=eval(y.substr(2,y.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			img.style.width=x.trim(); img.style.height=y.trim();
			if (stretchW||stretchH) config.formatterHelpers.addStretchHandlers(img,stretchW,stretchH);
		}
		if(tooltip) img.title = tooltip;

		// GET IMAGE SOURCE
		if (config.macros.attach && config.macros.attach.isAttachment(src))
			src=config.macros.attach.getAttachment(src); // see [[AttachFilePluginFormatters]]
		else if (config.formatterHelpers.resolvePath) { // see [[ImagePathPlugin]]
			if (config.browser.isIE || config.browser.isSafari) {
				img.onerror=(function(){
					this.src=config.formatterHelpers.resolvePath(this.src,false);
					return false;
				});
			} else
				src=config.formatterHelpers.resolvePath(src,true);
		}
		img.src=src;
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
}

config.formatterHelpers.imageSize={
	tip: 'maj+appui=pleine taille, ctrl+appui=taille initiale',
	dragtip: 'glisser=étirer, '
}

config.formatterHelpers.addStretchHandlers=function(e,stretchW,stretchH) {
	e.title=((stretchW||stretchH)?this.imageSize.dragtip:'')+this.imageSize.tip;
	e.statusMsg='largeur=%0, hauteur=%1';
	e.style.cursor='move';
	e.originalW=e.style.width;
	e.originalH=e.style.height;
	e.minW=Math.max(e.offsetWidth/20,10);
	e.minH=Math.max(e.offsetHeight/20,10);
	e.stretchW=stretchW;
	e.stretchH=stretchH;
	e.onmousedown=function(ev) { var ev=ev||window.event;
		this.sizing=true;
		this.startX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
		this.startY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
		this.startW=this.offsetWidth;
		this.startH=this.offsetHeight;
		return false;
	};
	e.onmousemove=function(ev) { var ev=ev||window.event;
		if (this.sizing) {
			var s=this.style;
			var currX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
			var currY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
			var newW=(currX-this.offsetLeft)/(this.startX-this.offsetLeft)*this.startW;
			var newH=(currY-this.offsetTop )/(this.startY-this.offsetTop )*this.startH;
			if (this.stretchW) s.width =Math.floor(Math.max(newW,this.minW))+'px';
			if (this.stretchH) s.height=Math.floor(Math.max(newH,this.minH))+'px';
			clearMessage(); displayMessage(this.statusMsg.format([s.width,s.height]));
		}
		return false;
	};
	e.onmouseup=function(ev) { var ev=ev||window.event;
		if (ev.shiftKey) { this.style.width=this.style.height=''; }
		if (ev.ctrlKey)  { this.style.width=this.originalW; this.style.height=this.originalH; }
		this.sizing=false;
		clearMessage();
		return false;
	};
	e.onmouseout=function(ev) { var ev=ev||window.event;
		this.sizing=false;
		clearMessage();
		return false;
	};
}
//}}}
/***

***/
//{{{

// Ensure the global abego namespace is set up.
if (!window.abego) window.abego = {};

var invokeLater = function(func, delay, priority) {
	return abego.invokeLater ? abego.invokeLater(func, delay, priority) : setTimeout(func,delay);
};

// Asynchronously load the given (local or remote) file.
// 
// @param url 		either an URL or a local file path to a file
//					Examples:
//						* http://www.abego-software.de/index.html
//						* file:///C:/abegoWebSite-Copy/index.html
//						* C:\abegoWebSite-Copy\index.html    (for Windows machines)
//							(Notice: backslashes in JavaScript string constants must be escaped, 
//							 i.e. the last example must be written as: "C:\\abegoWebSite-Copy\\index.html"
//							 when "hardcoded" in JavaScript source code)
// 
// @param callback 
//					function(content,url,params,errorMessage) 
//					called at the end of the operation. 
//					On success content holds the content of the loaded file. 
//					On error content is undefined and errorMessage holds an error message. 
//					params is the params passed into abego.loadFile.
//
// @param params 	passed through to the callback function
// 
abego.loadFile = function(url,callback,params) {

	var onLoad = function(status,params,responseText,url,xhr) {
		return status 
				? callback(responseText, url, params)
				: callback(undefined, url, params, "Error loading %0".format([url]));
	};
	
	// Make sure the URL is a real URL, with protocol prefix etc.
	if (url.search(/^((http(s)?)|(file)):/) != 0) {
		
		// no protocol specified. 
		if (url.search(/^((.\:\\)|(\\\\)|(\/))/) == 0) {
			// "url" is an "absolute" path to a local file. Prefix it with file://
			url = "file://"+url;
			
		} else {
			// "url" is a "relative" URL. Make it absolute
			
			// prefix the url with the directory containing the current document
			// (This also includes the protocol prefix)
			var documentPath = document.location.toString();
			var i = documentPath.lastIndexOf("/");
			url = documentPath.substr(0,i+1)+url;
		}
		// replace every \ by a /, to cover Windows style pathes
		url = url.replace(/\\/mg,"/");
	}
	
	loadRemoteFile(url,onLoad,params);

};

// Asynchronously load the given (local or remote) TiddlyWiki store.
// 
// @param url 		either an URL or a local file path to a TiddlyWiki file (absolute or relative)
//					Examples:
//						* http://www.abego-software.de/index.html
//						* file:///C:/abegoWebSite-Copy/index.html
//						* include/beta.html
//						* C:\abegoWebSite-Copy\index.html    (for Windows machines)
//							(Notice: backslashes in JavaScript string constants must be escaped, 
//							 i.e. the last example must be written as: "C:\\abegoWebSite-Copy\\index.html"
//							 when "hardcoded" in JavaScript source code)
// 
// @param callbackWithStore 
//					function(theStore,url,params,errorMessage) 
//					called at the end of the operation. 
//					On success theStore holds the loaded store (a TiddlyWiki object). 
//					On error theStore is undefined and errorMessage holds an error message. 
//					params is the params passed into abego.loadTiddlyWikiStore
//
// @param params 	passed through to the callbackWithStore
//
// @progress		[optional] function(message, sender, state, url, params) called in various situations during the operation,
//								typically used to show "the progress" of the operation.
//								sender: the constant "abego.loadTiddlyWikiStore"
//								state: one of these: "Started", "Processing", "Done", "Failed"
//									"Processing" means the data has been received and in now processed.
// 
abego.loadTiddlyWikiStore = function(url,callbackWithStore,params,progress) {
	
	var sendProgress = function(message, state) {
		if (progress)
			progress(message,"abego.loadTiddlyWikiStore",state,url,params);
	};
	
	// Load contents of a TiddlyWiki from a string
	//# Returns null on success, an error message otherwise.
	//# based on code from TiddlyWiki 2.2 alpha
	var importTiddlyWiki = function(store,text)
	{
		// Crack out the content - will be refactored to share code with saveChanges()
		var posOpeningDiv = text.indexOf(startSaveArea);
		var limitClosingDiv = text.indexOf("<!--POST-BODY-END--"+">");
		var posClosingDiv = text.lastIndexOf(endSaveArea,limitClosingDiv == -1 ? text.length : limitClosingDiv);
		if((posOpeningDiv == -1) || (posClosingDiv == -1))
			return config.messages.invalidFileError.format([url]);
		var content = "<html><body>" + text.substring(posOpeningDiv,posClosingDiv + endSaveArea.length) + "</body></html>";
		// Create the iframe
		var iframe = document.createElement("iframe");
		iframe.style.display = "none";
		document.body.appendChild(iframe);
		var doc = iframe.document;
		if(iframe.contentDocument)
			doc = iframe.contentDocument; // For NS6
		else if(iframe.contentWindow)
			doc = iframe.contentWindow.document; // For IE5.5 and IE6
		// Put the content in the iframe
		doc.open();
		doc.writeln(content);
		doc.close();
		// Load the content into a TiddlyWiki() object
		var storeArea = doc.getElementById("storeArea");
		store.loadFromDiv(storeArea,"store");
		// Get rid of the iframe
		iframe.parentNode.removeChild(iframe);
		return null;
	};
	
	var sendError = function(message) {
		sendProgress("Error when loading %0".format([url]),"Failed");
		callbackWithStore(undefined, url,params, message);
		return message;
	};
	
	var sendStore = function(store) {
		sendProgress("Loaded %0".format([url]),"Done");
		callbackWithStore(store, url, params);
		return null;
	};
	
	
	var callback = function(content,theURL,params,errorMessage) {
		if (content === undefined) {
			sendError(errorMessage);
			return;
		}
		
		sendProgress("Processing %0".format([url]),"Processing");
		var orig_invalidFileError = config.messages.invalidFileError;
		config.messages.invalidFileError = "The file '%0' does not appear to be a valid TiddlyWiki file";
		try {
			// Load the content into a TiddlyWiki() object
			var importStore = new TiddlyWiki();
			var errorText = importTiddlyWiki(importStore,content);
			if (errorText)
				sendError(errorText);
			else
				sendStore(importStore);

		} catch (ex) {
			sendError(exceptionText(ex));
		} finally {
			config.messages.invalidFileError = orig_invalidFileError;
		}
	};
	
	sendProgress("Start loading %0".format([url]),"Started");
	abego.loadFile(url,callback,params);
};


//==============================================================================
// Include Plugin 

(function(){

// only install once
if (abego.TiddlyWikiIncluder) return;


// --------------------------------------------------
// Constants

var WAITING = "waiting";
var LOADING = "loading";

var ANI_DURATION_HIDE_STATE = 1000;

var REFRESH_PRIORITY = -200;
var ANIMATION_PRIORITY = -100;
var UPDATE_STATE_PRIORITY = -300;

// --------------------------------------------------
// Variables

var useInclude;
var includes = []; // [] of Strings. the urls of the stores to include, in the sequence of the calls.
var includedStores = {}; // url(String) -> TiddlyWiki or String; when not (yet) loaded a status or error string.
var pendingOnLoadURLs = []; // [] of String. a list of urls that should be passed with the next "notifyListeners".
var refreshTiddlyWikiTimerID; // for delayed refresh
var listeners = [];
var progress;

// --------------------------------------------------
// Helper functions

var isIncludeEnabled = function() {
	if (useInclude === undefined)
		useInclude = config.options.chkUseInclude === undefined || config.options.chkUseInclude;
	return useInclude;
};

var getMissingIncludeMsg = function(url) {
	return "No include specified for %0".format([url])
};

// Called after one or more included TiddlyWikis are loaded
//
var notifyListeners = function() {
	var urls = pendingOnLoadURLs;
	pendingOnLoadURLs = [];
	if (urls.length) {
		for (var i= 0; i < listeners.length; i++)
			listeners[i](urls);
	}
};

var idleCount; // Reset to 0 when the system is "not idle", incremented inside refreshTiddlyWiki

var refreshTiddlyWiki = function() {
	// To avoid to much refreshing/flickering don't refresh immediately 
	// but wait until the system was idle for a certain time.
	
	if (refreshTiddlyWikiTimerID !== undefined) clearInterval(refreshTiddlyWikiTimerID);
	
	idleCount = 0;
	
	var sendDone = function() {
		abego.TiddlyWikiIncluder.sendProgress("","","Done");
	};
	
	refreshTiddlyWikiTimerID = setInterval(function() {
		idleCount++;
		if (idleCount <= 10)
			return;
			
		clearInterval(refreshTiddlyWikiTimerID);
		refreshTiddlyWikiTimerID = undefined;
			
		abego.TiddlyWikiIncluder.sendProgress("Refreshing...","","");
		refreshDisplay();
		invokeLater(sendDone,0,REFRESH_PRIORITY);
	},0);
};

// Calls callback for every loaded store and returns the first non-false/null.. value returned by callback.
//
// @param callback  function(store, url)
//
var forEachLoadedStore = function(callback) {
	var result;
	for (var i = 0; i < includes.length; i++) {
		var theStore = abego.TiddlyWikiIncluder.getStore(includes[i]);
		if (theStore && (result = callback(theStore, includes[i])))
			return result;
	}
};

var attachToStore = function() {
	if (!window.store)
		return invokeLater(attachToStore,100);
		
	var orig_fetchTiddler = store.fetchTiddler;
	
	store.fetchTiddler = function(title) {
		var t = orig_fetchTiddler.apply(this,arguments);
		if (t) return t;
		
		// When there is a shadowtiddler with that name done look for
		// any included tiddler since these would hide the shadow
		if (config.shadowTiddlers[title] !== undefined) return undefined;
		
		// Don't look for the "New Tiddler" tiddler in the included TiddlyWikis,
		// since returning such a tiddler (that is readonly) will make it impossible
		// in the Main TiddlyWiki to create new tiddlers.
		if (title == config.macros.newTiddler.title) return undefined;

		return forEachLoadedStore(
				function(theStore, url) {
					var t = theStore.fetchTiddler(title);
					if (t) 
						t.includeURL = url;
					return t;
				});
	};

	// We also refresh TiddlyWiki to reflect the new included Tiddlers (if we have any).
	if (includes.length)
		refreshTiddlyWiki();
};

var includeFromIncludeList = function() {
	if (!window.store)
		return invokeLater(includeFromIncludeList,100);
		
	var includeListText = store.getTiddlerText("IncludeList");
	if (includeListText) 
		wikify(includeListText,document.createElement("div"));
};

var getFunctionUsingForReallyEachTiddler = function(func) {
	var wrapper = function() {
		var orig_forEachTiddler = store.forEachTiddler;

		var forEachTiddlerWithIncludes = function(callback) {
			var done = {};
			var includeURL;

			var callbackWrapper = function(title, tiddler) {
				// ensure every title is only processed once
				if (done[title]) 
					return;
				done[title] = 1;
				
				// for "included tiddlers" set the includeURL;
				if (includeURL)
					tiddler.includeURL = includeURL;
				
				callback.apply(this,arguments);
			};
			
			// forEachTiddler over the original tiddlers
			orig_forEachTiddler.call(store, callbackWrapper);
			
			// add all shadowTiddler titles to done 
			// (to avoid an included store hides a shadow tiddler)
			for (var n in config.shadowTiddlers)
				done[n] = 1;

			// add all the "New Tiddler" tiddlerto done 
			// (to avoid an included store (with "New Tiddler") makes it impossible to create new tiddlers)
			done[config.macros.newTiddler.title] = 1;

			// forEachTiddler over every included store
			forEachLoadedStore(
					function(theStore, url) {
						includeURL = url;
						theStore.forEachTiddler(callbackWrapper);
					});
		};
		
		store.forEachTiddler = forEachTiddlerWithIncludes;
		try {
			return func.apply(this,arguments);
		} finally {
			store.forEachTiddler = orig_forEachTiddler;
		}
	};
	
	return wrapper;
};

var useForReallyEachTiddler = function(object,property) {
	return object[property] = getFunctionUsingForReallyEachTiddler(object[property]);
};


//================================================================================
// abego.TiddlyWikiIncluder

abego.TiddlyWikiIncluder = {};

abego.TiddlyWikiIncluder.setProgressFunction = function(func) {
	progress = func;
};

abego.TiddlyWikiIncluder.getProgressFunction = function(func) {
	return progress;
};

abego.TiddlyWikiIncluder.sendProgress = function(message, sender, state) {
	if (progress)
		progress.apply(this,arguments);
};


// Called when an included TiddlyWiki could not be loaded.
//
// By default an error message is displayed.
//
abego.TiddlyWikiIncluder.onError = function(url, errorMessage) {
	displayMessage("Error when including '%0':\n%1".format([url, errorMessage]));
};


// Returns true when there are "pending" includes, i.e. TiddlyWiki that are not yet loaded.
//
// A TiddlyWiki that failed loading is not pending.
//
abego.TiddlyWikiIncluder.hasPendingIncludes = function() {
	for (var i = 0; i < includes.length; i++) {
		var state = abego.TiddlyWikiIncluder.getState(includes[i]);
		if (state == WAITING || state == LOADING)
			return true;
	}
	return false;
};


// @return [] of Strings, the URLs of the includes
//
abego.TiddlyWikiIncluder.getIncludes = function() {
	return includes.slice();
};


// @return [may be null] a state/error text of the store with the given URL, or null when the store is already loaded
//
abego.TiddlyWikiIncluder.getState = function(url) {
	var s = includedStores[url];
	if (!s)
		return getMissingIncludeMsg(url);
	return typeof s == "string" ? s : null;
};


// @return [may be null] the (TiddlyWiki) store  with the given URL, null if not (yet) loaded.
//
abego.TiddlyWikiIncluder.getStore = function(url) {
	var s = includedStores[url];
	if (!s)
		return getMissingIncludeMsg(url);
	return s instanceof TiddlyWiki ? s : null;
};


// Includes the (local or remote) TiddlyWiki store with the given url.
// 
// stores with urls already already included are ignored.
//
// @param url	see url@abego.loadTiddlyWikiStore
// @param delayMilliSeconds [optional] if defined loading starts delayMilliSeconds later, otherwise "immediately"
//
abego.TiddlyWikiIncluder.include = function(url, delayMilliSeconds) {
	if (!isIncludeEnabled() || includedStores[url])
		return;
	var self = this;
	
	includes.push(url);
	includedStores[url] = WAITING;

	var loadStoreCallback = function(theStore,urlInCallback,params,errorMessage) {
		if (theStore === undefined) {
			includedStores[url] = errorMessage;
			self.onError(url, errorMessage);
			return;
		}
		includedStores[url] = theStore;
		pendingOnLoadURLs.push(url);
		invokeLater(notifyListeners);
	};
	
	var loadStore = function() {
		includedStores[url] = LOADING;
		abego.loadTiddlyWikiStore(url,loadStoreCallback,null,progress);
	};
	
	if (delayMilliSeconds)
		invokeLater(loadStore, delayMilliSeconds);
	else
		loadStore();
};


// iterates over all tiddlers of "the store" and all tiddlers of included (and loaded) stores
//
abego.TiddlyWikiIncluder.forReallyEachTiddler = function(callback) {
	var caller = function() {
		store.forEachTiddler(callback);
	};
	
	getFunctionUsingForReallyEachTiddler(caller).call(store);
};


// function abego.TiddlyWikiIncluder.getFunctionUsingForReallyEachTiddler(func)
//
// Returns a function that behaves as func, but every call to store.forEachTiddler will actually 
// be a call to forReallyEachTiddler, i.e. iterate over the tiddlers the main store and of the 
// included TiddlyWikis
//
// @return the patched function
//
abego.TiddlyWikiIncluder.getFunctionUsingForReallyEachTiddler = getFunctionUsingForReallyEachTiddler;


// function abego.TiddlyWikiIncluder.useForReallyEachTiddler(object,property)
//
// Patches the function hold in the given property of the object in such a way that every call
// to store.forEachTiddler will actually be a call to forReallyEachTiddler, i.e. iterate over the
// tiddlers the main staire and of the included TiddlyWikis
//
// @param object
// @param property the name of the property of the object containing the function to be patched.
// @return the patched function
//
abego.TiddlyWikiIncluder.useForReallyEachTiddler = useForReallyEachTiddler;


// Add a listener function to the TiddlyWikiIncluder.
//
// @param listener function(urls)
//							url: [] of Strings, containing the urls of the TiddlyWiki just included
//									(see url@abego.TiddlyWikiIncluder.include)
//						called whenever one or more TiddlyWiki store are successfully included.
//
abego.TiddlyWikiIncluder.addListener = function(listener) {
	listeners.push(listener);
};

// -------------------------------------------------------------------------------
// TiddlyWikiIncluder initialization code

abego.TiddlyWikiIncluder.addListener(refreshTiddlyWiki);

//----------------------------------------------------------------------------
// Options Support

if (config.options.chkUseInclude === undefined) config.options.chkUseInclude = true;

config.shadowTiddlers.AdvancedOptions += "\n<<option chkUseInclude>> Include ~TiddlyWikis (IncludeList | IncludeState | [[help|http://tiddlywiki.abego-software.de/#%5B%5BIncludePlugin%20Documentation%5D%5D]])\n^^(Reload this ~TiddlyWiki to make changes become effective)^^";
config.shadowTiddlers.IncludeState = "<<includeState>>";

//================================================================================
// Default Progress Handling for abego.TiddlyWikiIncluder

var showAnimated = function(e, showing, duration) {
	if (!anim || !abego.ShowAnimation) {
		e.style.display = showing ? "block" : "none";
		return;
	}
	
	anim.startAnimating(new abego.ShowAnimation(e,showing,duration));
};

abego.TiddlyWikiIncluder.getDefaultProgressFunction = function() {

	setStylesheet(
		".includeProgressState{\n"+
		"background-color:#FFCC00;\n"+
		"position:absolute;\n"+
		"right:0.2em;\n"+
		"top:0.2em;\n"+
		"width:7em;\n"+
		"padding-left:0.2em;\n"+
		"padding-right:0.2em\n"+
		"}\n",
		"abegoInclude");

	var createStateElem = function() {
		var e = document.createElement("div");
		e.className = "includeProgressState";
		e.style.display = "none";
		document.body.appendChild(e);
		return e;
	};
	
	var stateElem = createStateElem();


	var showState = function(message) {
		removeChildren(stateElem);
		createTiddlyText(stateElem,message);
		showAnimated(stateElem,true,0);
	};

	var hideState = function() {
		// hide the state the next idle time 
		invokeLater(function() {
			showAnimated(stateElem,false,ANI_DURATION_HIDE_STATE);
		},100,ANIMATION_PRIORITY);
	};
	
	var myProgressFunction = function(message, sender, state, url, params) {
		
		if (state == "Done" || state == "Failed") {
			hideState();
			return;
		}
		
		if (sender == "abego.loadTiddlyWikiStore") {
			idleCount = 0;
			if (state == "Processing")
				showState("Including...");
		} else {
			showState(message);
		}
	};
	return myProgressFunction;
};

abego.TiddlyWikiIncluder.setProgressFunction(abego.TiddlyWikiIncluder.getDefaultProgressFunction());


//================================================================================
// The "include" macro
//
// Syntax: <<include {url}* [delay: {milliSeconds}] [hide: true] >>
//

config.macros.include = {};
config.macros.include.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
    params = paramString.parseParams("url",null,true,false,true); // allowEval, cascadeDefaults, names allowed
	var delay = parseInt(getParam(params,"delay","0"));
	var urls = params[0]["url"];
	var hide = getFlag(params, "hide", false);
	if (!hide)
		createTiddlyText(createTiddlyElement(place,"code"),wikifier.source.substring(wikifier.matchStart, wikifier.nextMatch));
	for (var i = 0; urls && i < urls.length; i++)
		abego.TiddlyWikiIncluder.include(urls[i],delay);
};


//================================================================================
// The "includeState" macro
//
// Syntax: <<includeState>>

config.macros.includeState = {};
config.macros.includeState.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	var getFullState = function () {
		var s = "";
		var includes = abego.TiddlyWikiIncluder.getIncludes();
		if (!includes.length)
			return "{{noIncludes{\nNo includes or 'include' is disabled (see AdvancedOptions)\n}}}\n";
			
		s += "|!Address|!State|\n";
		for (var i = 0; i < includes.length; i++) {
			var inc = includes[i];
			s += "|{{{"+inc+"}}}|";
			var t = abego.TiddlyWikiIncluder.getState(inc);
			s += t ? "{{{"+t+"}}}" : "included";
			s += "|\n"
		}
		s += "|includeState|k\n";
		return s;
	};
	
	var updateState = function(){
		removeChildren(div);
		wikify(getFullState(),div);
		if (abego.TiddlyWikiIncluder.hasPendingIncludes())
			invokeLater(updateState,500,UPDATE_STATE_PRIORITY);
	};

	var div = createTiddlyElement(place,"div");
	
	invokeLater(updateState,0,UPDATE_STATE_PRIORITY);
};

//================================================================================
// Tiddler extension/modification

var orig_Tiddler_isReadOnly = Tiddler.prototype.isReadOnly;

// Includes tiddlers are readonly.
Tiddler.prototype.isReadOnly = function() {
	return orig_Tiddler_isReadOnly.apply(this,arguments) || this.isIncluded();
}

Tiddler.prototype.isIncluded = function() {
	return this.includeURL != undefined;
};

Tiddler.prototype.getIncludeURL = function() {
	return this.includeURL;
};


//================================================================================
// TiddlyWiki modifications

// In some TiddlyWiki functions the "forEachTiddler" should work on all tiddlers, also those from 
// included store. (E.g. TiddlyWiki.prototype.getTags)
//
// But not for all (e.g. TiddlyWiki.prototype.getTiddlers is used for saving, but only the "own" tiddlers should be saved)
//
// Therefore explicitly list the functions that should be "wrapped" to use the "forReallyEachTiddler".
//
var tiddlyWikiFunctionsUsingForReallyEachTiddler = {
	getMissingLinks: 1, getOrphans: 1,getTags:1, reverseLookup: 1, updateTiddlers: 1};
	
for (var n in tiddlyWikiFunctionsUsingForReallyEachTiddler)
	useForReallyEachTiddler(TiddlyWiki.prototype,n);


//================================================================================
// Make IntelliTagger "Include-aware"

var patchIntelliTagger = function() {
	if (abego.IntelliTagger)
		useForReallyEachTiddler(abego.IntelliTagger,"assistTagging");
};

//================================================================================
// Perform plugin startup tasks

attachToStore();
invokeLater(includeFromIncludeList,100);
invokeLater(patchIntelliTagger,100);

})();

//}}}
/***

''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Documentation
>see [[InlineJavascriptPluginInfo]]
!!!!!Revisions
<<<
2009.04.11 [1.9.5] pass current tiddler object into wrapper code so it can be referenced from within 'onclick' scripts
2009.02.26 [1.9.4] in $(), handle leading '#' on ID for compatibility with JQuery syntax
|please see [[InlineJavascriptPluginInfo]] for additional revision details|
2005.11.08 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.InlineJavascriptPlugin= {major: 1, minor: 9, revision: 5, date: new Date(2009,4,11)};

config.formatters.push( {
	name: "inlineJavascript",
	match: "\\<script",
	lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?(?: key=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",

	handler: function(w) {
		var lookaheadRegExp = new RegExp(this.lookahead,"mg");
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source)
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var src=lookaheadMatch[1];
			var label=lookaheadMatch[2];
			var tip=lookaheadMatch[3];
			var key=lookaheadMatch[4];
			var show=lookaheadMatch[5];
			var code=lookaheadMatch[6];
			if (src) { // external script library
				var script = document.createElement("script"); script.src = src;
				document.body.appendChild(script); document.body.removeChild(script);
			}
			if (code) { // inline code
				if (show) // display source in tiddler
					wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
				if (label) { // create 'onclick' command link
					var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",wikifyPlainText(label));
					var fixup=code.replace(/document.write\s*\(/gi,'place.bufferedHTML+=(');
					link.code="function _out(place,tiddler){"+fixup+"\n};_out(this,this.tiddler);"
					link.tiddler=w.tiddler;
					link.onclick=function(){
						this.bufferedHTML="";
						try{ var r=eval(this.code);
							if(this.bufferedHTML.length || (typeof(r)==="string")&&r.length)
								var s=this.parentNode.insertBefore(document.createElement("span"),this.nextSibling);
							if(this.bufferedHTML.length)
								s.innerHTML=this.bufferedHTML;
							if((typeof(r)==="string")&&r.length) {
								wikify(r,s,null,this.tiddler);
								return false;
							} else return r!==undefined?r:false;
						} catch(e){alert(e.description||e.toString());return false;}
					};
					link.setAttribute("title",tip||"");
					var URIcode='javascript:void(eval(decodeURIComponent(%22(function(){try{';
					URIcode+=encodeURIComponent(encodeURIComponent(code.replace(/\n/g,' ')));
					URIcode+='}catch(e){alert(e.description||e.toString())}})()%22)))';
					link.setAttribute("href",URIcode);
					link.style.cursor="pointer";
					if (key) link.accessKey=key.substr(0,1); // single character only
				}
				else { // run script immediately
					var fixup=code.replace(/document.write\s*\(/gi,'place.innerHTML+=(');
					var c="function _out(place,tiddler){"+fixup+"\n};_out(w.output,w.tiddler);";
					try	 { var out=eval(c); }
					catch(e) { out=e.description?e.description:e.toString(); }
					if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
				}
			}
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
	}
} )
//}}}

// // Backward-compatibility for TW2.1.x and earlier
//{{{
if (typeof(wikifyPlainText)=="undefined") window.wikifyPlainText=function(text,limit,tiddler) {
	if(limit > 0) text = text.substr(0,limit);
	var wikifier = new Wikifier(text,formatter,null,tiddler);
	return wikifier.wikifyPlain();
}
//}}}

// // GLOBAL FUNCTION: $(...) -- 'shorthand' convenience syntax for document.getElementById()
//{{{
if (typeof($)=='undefined') { function $(id) { return document.getElementById(id.replace(/^#/,'')); } }
//}}}
/***

***/
/***
!Version History
* 1.0.2 (2007-07-25): 
** Feature: "Return" key may be used to accept first tag suggestion (beside "Alt-1")
** Bugfix: Keyboard shortcuts (Alt+3 etc.) shifted
* 1.0.1 (2007-05-18): Improvement: Speedup when using TiddlyWikis with many tags
* 1.0.0 (2006-04-26): Initial release

***/
// /%
if(!version.extensions.IntelliTaggerPlugin){if(!window.abego){window.abego={};}if(!abego.internal){abego.internal={};}abego.alertAndThrow=function(s){alert(s);throw s;};if(version.major<2){abego.alertAndThrow("Use TiddlyWiki 2.0.8 or better to run the IntelliTagger Plugin.");}version.extensions.IntelliTaggerPlugin={major:1,minor:0,revision:2,date:new Date(2007,6,25),type:"plugin",source:"http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin",documentation:"[[IntelliTaggerPlugin Documentation]]",sourcecode:"[[IntelliTaggerPlugin SourceCode]]",author:"Udo Borkowski (ub [at] abego-software [dot] de)",licence:"[[BSD open source license (abego Software)]]",tiddlywiki:"Version 2.0.8 or better",browser:"Firefox 1.5.0.2 or better"};abego.createEllipsis=function(_2){var e=createTiddlyElement(_2,"span");e.innerHTML="&hellip;";};abego.isPopupOpen=function(_4){return _4&&_4.parentNode==document.body;};abego.openAsPopup=function(_5){if(_5.parentNode!=document.body){document.body.appendChild(_5);}};abego.closePopup=function(_6){if(abego.isPopupOpen(_6)){document.body.removeChild(_6);}};abego.getWindowRect=function(){return {left:findScrollX(),top:findScrollY(),height:findWindowHeight(),width:findWindowWidth()};};abego.moveElement=function(_7,_8,_9){_7.style.left=_8+"px";_7.style.top=_9+"px";};abego.centerOnWindow=function(_a){if(_a.style.position!="absolute"){throw "abego.centerOnWindow: element must have absolute position";}var _b=abego.getWindowRect();abego.moveElement(_a,_b.left+(_b.width-_a.offsetWidth)/2,_b.top+(_b.height-_a.offsetHeight)/2);};abego.isDescendantOrSelf=function(_c,e){while(e){if(_c==e){return true;}e=e.parentNode;}return false;};abego.toSet=function(_e){var _f={};for(var i=0;i<_e.length;i++){_f[_e[i]]=true;}return _f;};abego.filterStrings=function(_11,_12,_13){var _14=[];for(var i=0;i<_11.length&&(_13===undefined||_14.length<_13);i++){var s=_11[i];if(s.match(_12)){_14.push(s);}}return _14;};abego.arraysAreEqual=function(a,b){if(!a){return !b;}if(!b){return false;}var n=a.length;if(n!=b.length){return false;}for(var i=0;i<n;i++){if(a[i]!=b[i]){return false;}}return true;};abego.moveBelowAndClip=function(_1b,_1c){if(!_1c){return;}var _1d=findPosX(_1c);var _1e=findPosY(_1c);var _1f=_1c.offsetHeight;var _20=_1d;var _21=_1e+_1f;var _22=findWindowWidth();if(_22<_1b.offsetWidth){_1b.style.width=(_22-100)+"px";}var _23=_1b.offsetWidth;if(_20+_23>_22){_20=_22-_23-30;}if(_20<0){_20=0;}_1b.style.left=_20+"px";_1b.style.top=_21+"px";_1b.style.display="block";};abego.compareStrings=function(a,b){return (a==b)?0:(a<b)?-1:1;};abego.sortIgnoreCase=function(arr){var _27=[];var n=arr.length;for(var i=0;i<n;i++){var s=arr[i];_27.push([s.toString().toLowerCase(),s]);}_27.sort(function(a,b){return (a[0]==b[0])?0:(a[0]<b[0])?-1:1;});for(i=0;i<n;i++){arr[i]=_27[i][1];}};abego.getTiddlerField=function(_2d,_2e,_2f){var _30=document.getElementById(_2d.idPrefix+_2e);var e=null;if(_30!=null){var _32=_30.getElementsByTagName("*");for(var t=0;t<_32.length;t++){var c=_32[t];if(c.tagName.toLowerCase()=="input"||c.tagName.toLowerCase()=="textarea"){if(!e){e=c;}if(c.getAttribute("edit")==_2f){e=c;}}}}return e;};abego.setRange=function(_35,_36,end){if(_35.setSelectionRange){_35.setSelectionRange(_36,end);var max=0+_35.scrollHeight;var len=_35.textLength;var top=max*_36/len,bot=max*end/len;_35.scrollTop=Math.min(top,(bot+top-_35.clientHeight)/2);}else{if(_35.createTextRange!=undefined){var _3b=_35.createTextRange();_3b.collapse();_3b.moveEnd("character",end);_3b.moveStart("character",_36);_3b.select();}else{_35.select();}}};abego.internal.TagManager=function(){var _3c=null;var _3d=function(){if(_3c){return;}_3c={};store.forEachTiddler(function(_3e,_3f){for(var i=0;i<_3f.tags.length;i++){var tag=_3f.tags[i];var _42=_3c[tag];if(!_42){_42=_3c[tag]={count:0,tiddlers:{}};}_42.tiddlers[_3f.title]=true;_42.count+=1;}});};var _43=TiddlyWiki.prototype.saveTiddler;TiddlyWiki.prototype.saveTiddler=function(_44,_45,_46,_47,_48,_49){var _4a=this.fetchTiddler(_44);var _4b=_4a?_4a.tags:[];var _4c=(typeof _49=="string")?_49.readBracketedList():_49;_43.apply(this,arguments);if(!abego.arraysAreEqual(_4b,_4c)){abego.internal.getTagManager().reset();}};var _4d=TiddlyWiki.prototype.removeTiddler;TiddlyWiki.prototype.removeTiddler=function(_4e){var _4f=this.fetchTiddler(_4e);var _50=_4f&&_4f.tags.length>0;_4d.apply(this,arguments);if(_50){abego.internal.getTagManager().reset();}};this.reset=function(){_3c=null;};this.getTiddlersWithTag=function(tag){_3d();var _52=_3c[tag];return _52?_52.tiddlers:null;};this.getAllTags=function(_53){_3d();var _54=[];for(var i in _3c){_54.push(i);}for(i=0;_53&&i<_53.length;i++){_54.pushUnique(_53[i],true);}abego.sortIgnoreCase(_54);return _54;};this.getTagInfos=function(){_3d();var _56=[];for(var _57 in _3c){_56.push([_57,_3c[_57]]);}return _56;};var _58=function(a,b){var a1=a[1];var b1=b[1];var d=b[1].count-a[1].count;return d!=0?d:abego.compareStrings(a[0].toLowerCase(),b[0].toLowerCase());};this.getSortedTagInfos=function(){_3d();var _5e=this.getTagInfos();_5e.sort(_58);return _5e;};this.getPartnerRankedTags=function(_5f){var _60={};for(var i=0;i<_5f.length;i++){var _62=this.getTiddlersWithTag(_5f[i]);for(var _63 in _62){var _64=store.getTiddler(_63);if(!(_64 instanceof Tiddler)){continue;}for(var j=0;j<_64.tags.length;j++){var tag=_64.tags[j];var c=_60[tag];_60[tag]=c?c+1:1;}}}var _68=abego.toSet(_5f);var _69=[];for(var n in _60){if(!_68[n]){_69.push(n);}}_69.sort(function(a,b){var d=_60[b]-_60[a];return d!=0?d:abego.compareStrings(a.toLowerCase(),b.toLowerCase());});return _69;};};abego.internal.getTagManager=function(){if(!abego.internal.gTagManager){abego.internal.gTagManager=new abego.internal.TagManager();}return abego.internal.gTagManager;};(function(){var _6e=2;var _6f=1;var _70=30;var _71;var _72;var _73;var _74;var _75;var _76;if(!abego.IntelliTagger){abego.IntelliTagger={};}var _77=function(){return _72;};var _78=function(tag){return _75[tag];};var _7a=function(s){var i=s.lastIndexOf(" ");return (i>=0)?s.substr(0,i):"";};var _7d=function(_7e){var s=_7e.value;var len=s.length;return (len>0&&s[len-1]!=" ");};var _81=function(_82){var s=_82.value;var len=s.length;if(len>0&&s[len-1]!=" "){_82.value+=" ";}};var _85=function(tag,_87,_88){if(_7d(_87)){_87.value=_7a(_87.value);}story.setTiddlerTag(_88.title,tag,0);_81(_87);abego.IntelliTagger.assistTagging(_87,_88);};var _89=function(n){if(_76&&_76.length>n){return _76[n];}return (_74&&_74.length>n)?_74[n]:null;};var _8b=function(n,_8d,_8e){var _8f=_89(n);if(_8f){_85(_8f,_8d,_8e);}};var _90=function(_91){var pos=_91.value.lastIndexOf(" ");var _93=(pos>=0)?_91.value.substr(++pos,_91.value.length):_91.value;return new RegExp(_93.escapeRegExp(),"i");};var _94=function(_95,_96){var _97=0;for(var i=0;i<_95.length;i++){if(_96[_95[i]]){_97++;}}return _97;};var _99=function(_9a,_9b,_9c){var _9d=1;var c=_9a[_9b];for(var i=_9b+1;i<_9a.length;i++){if(_9a[i][1].count==c){if(_9a[i][0].match(_9c)){_9d++;}}else{break;}}return _9d;};var _a0=function(_a1,_a2){var _a3=abego.internal.getTagManager().getSortedTagInfos();var _a4=[];var _a5=0;for(var i=0;i<_a3.length;i++){var c=_a3[i][1].count;if(c!=_a5){if(_a2&&(_a4.length+_99(_a3,i,_a1)>_a2)){break;}_a5=c;}if(c==1){break;}var s=_a3[i][0];if(s.match(_a1)){_a4.push(s);}}return _a4;};var _a9=function(_aa,_ab){return abego.filterStrings(abego.internal.getTagManager().getAllTags(_ab),_aa);};var _ac=function(){if(!_71){return;}var _ad=store.getTiddlerText("IntelliTaggerMainTemplate");if(!_ad){_ad="<b>Tiddler IntelliTaggerMainTemplate not found</b>";}_71.innerHTML=_ad;applyHtmlMacros(_71,null);refreshElements(_71,null);};var _ae=function(e){if(!e){var e=window.event;}var tag=this.getAttribute("tag");if(_73){_73.call(this,tag,e);}return false;};var _b2=function(_b3){createTiddlyElement(_b3,"span",null,"tagSeparator"," | ");};var _b4=function(_b5,_b6,_b7,_b8,_b9){if(!_b6){return;}var _ba=_b8?abego.toSet(_b8):{};var n=_b6.length;var c=0;for(var i=0;i<n;i++){var tag=_b6[i];if(_ba[tag]){continue;}if(c>0){_b2(_b5);}if(_b9&&c>=_b9){abego.createEllipsis(_b5);break;}c++;var _bf="";var _c0=_b5;if(_b7<10){_c0=createTiddlyElement(_b5,"span",null,"numberedSuggestion");_b7++;var key=_b7<10?""+(_b7):"0";createTiddlyElement(_c0,"span",null,"suggestionNumber",key+") ");var _c2=_b7==1?"Return or ":"";_bf=" (Shortcut: %1Alt-%0)".format([key,_c2]);}var _c3=config.views.wikified.tag.tooltip.format([tag]);var _c4=(_78(tag)?"Remove tag '%0'%1":"Add tag '%0'%1").format([tag,_bf]);var _c5="%0; Shift-Click: %1".format([_c4,_c3]);var btn=createTiddlyButton(_c0,tag,_c5,_ae,_78(tag)?"currentTag":null);btn.setAttribute("tag",tag);}};var _c7=function(){if(_71){window.scrollTo(0,ensureVisible(_71));}if(_77()){window.scrollTo(0,ensureVisible(_77()));}};var _c8=function(e){if(!e){var e=window.event;}if(!_71){return;}var _cb=resolveTarget(e);if(_cb==_77()){return;}if(abego.isDescendantOrSelf(_71,_cb)){return;}abego.IntelliTagger.close();};addEvent(document,"click",_c8);var _cc=Story.prototype.gatherSaveFields;Story.prototype.gatherSaveFields=function(e,_ce){_cc.apply(this,arguments);var _cf=_ce.tags;if(_cf){_ce.tags=_cf.trim();}};var _d0=function(_d1){story.focusTiddler(_d1,"tags");var _d2=abego.getTiddlerField(story,_d1,"tags");if(_d2){var len=_d2.value.length;abego.setRange(_d2,len,len);window.scrollTo(0,ensureVisible(_d2));}};var _d4=config.macros.edit.handler;config.macros.edit.handler=function(_d5,_d6,_d7,_d8,_d9,_da){_d4.apply(this,arguments);var _db=_d7[0];if((_da instanceof Tiddler)&&_db=="tags"){var _dc=_d5.lastChild;_dc.onfocus=function(e){abego.IntelliTagger.assistTagging(_dc,_da);setTimeout(function(){_d0(_da.title);},100);};_dc.onkeyup=function(e){if(!e){var e=window.event;}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.keyCode>=48&&e.keyCode<=57)){_8b(e.keyCode==48?9:e.keyCode-49,_dc,_da);}else{if(e.ctrlKey&&e.keyCode==32){_8b(0,_dc,_da);}}if(!e.ctrlKey&&(e.keyCode==13||e.keyCode==10)){_8b(0,_dc,_da);}setTimeout(function(){abego.IntelliTagger.assistTagging(_dc,_da);},100);return false;};_81(_dc);}};var _e0=function(e){if(!e){var e=window.event;}var _e3=resolveTarget(e);var _e4=_e3.getAttribute("tiddler");if(_e4){story.displayTiddler(_e3,_e4,"IntelliTaggerEditTagsTemplate",false);_d0(_e4);}return false;};var _e5=config.macros.tags.handler;config.macros.tags.handler=function(_e6,_e7,_e8,_e9,_ea,_eb){_e5.apply(this,arguments);abego.IntelliTagger.createEditTagsButton(_eb,createTiddlyElement(_e6.lastChild,"li"));};var _ec=function(){if(_71&&_72&&!abego.isDescendantOrSelf(document,_72)){abego.IntelliTagger.close();}};setInterval(_ec,100);abego.IntelliTagger.displayTagSuggestions=function(_ed,_ee,_ef,_f0,_f1){_74=_ed;_75=abego.toSet(_ee);_76=_ef;_72=_f0;_73=_f1;if(!_71){_71=createTiddlyElement(document.body,"div",null,"intelliTaggerSuggestions");_71.style.position="absolute";}_ac();abego.openAsPopup(_71);if(_77()){var w=_77().offsetWidth;if(_71.offsetWidth<w){_71.style.width=(w-2*(_6e+_6f))+"px";}abego.moveBelowAndClip(_71,_77());}else{abego.centerOnWindow(_71);}_c7();};abego.IntelliTagger.assistTagging=function(_f3,_f4){var _f5=_90(_f3);var s=_f3.value;if(_7d(_f3)){s=_7a(s);}var _f7=s.readBracketedList();var _f8=_f7.length>0?abego.filterStrings(abego.internal.getTagManager().getPartnerRankedTags(_f7),_f5,_70):_a0(_f5,_70);abego.IntelliTagger.displayTagSuggestions(_a9(_f5,_f7),_f7,_f8,_f3,function(tag,e){if(e.shiftKey){onClickTag.call(this,e);}else{_85(tag,_f3,_f4);}});};abego.IntelliTagger.close=function(){abego.closePopup(_71);_71=null;return false;};abego.IntelliTagger.createEditTagsButton=function(_fb,_fc,_fd,_fe,_ff,id,_101){if(!_fd){_fd="[éditer]";}if(!_fe){_fe="Editer les étiquettes";}if(!_ff){_ff="editTags";}var _102=createTiddlyButton(_fc,_fd,_fe,_e0,_ff,id,_101);_102.setAttribute("tiddler",(_fb instanceof Tiddler)?_fb.title:String(_fb));return _102;};abego.IntelliTagger.getSuggestionTagsMaxCount=function(){return 100;};config.macros.intelliTagger={label:"intelliTagger",handler:function(_103,_104,_105,_106,_107,_108){var _109=_107.parseParams("list",null,true);var _10a=_109[0]["action"];for(var i=0;_10a&&i<_10a.length;i++){var _10c=_10a[i];var _10d=config.macros.intelliTagger.subhandlers[_10c];if(!_10d){abego.alertAndThrow("Unsupported action '%0'".format([_10c]));}_10d(_103,_104,_105,_106,_107,_108);}},subhandlers:{showTags:function(_10e,_10f,_110,_111,_112,_113){_b4(_10e,_74,_76?_76.length:0,_76,abego.IntelliTagger.getSuggestionTagsMaxCount());},showFavorites:function(_114,_115,_116,_117,_118,_119){_b4(_114,_76,0);},closeButton:function(_11a,_11b,_11c,_11d,_11e,_11f){var _120=createTiddlyButton(_11a,"fermer","Fermer les suggestions",abego.IntelliTagger.close);},version:function(_121){var t="IntelliTagger %0.%1.%2".format([version.extensions.IntelliTaggerPlugin.major,version.extensions.IntelliTaggerPlugin.minor,version.extensions.IntelliTaggerPlugin.revision]);var e=createTiddlyElement(_121,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin");e.innerHTML="<font color=\"black\" face=\"Arial, Helvetica, sans-serif\">"+t+"<font>";},copyright:function(_124){var e=createTiddlyElement(_124,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de");e.innerHTML="<font color=\"black\" face=\"Arial, Helvetica, sans-serif\">&copy; 2006-2007 <b><font color=\"red\">abego</font></b> Software<font>";}}};})();config.shadowTiddlers["IntelliTaggerStyleSheet"]="/***\n"+"!~IntelliTagger Stylesheet\n"+"***/\n"+"/*{{{*/\n"+".intelliTaggerSuggestions {\n"+"\tposition: absolute;\n"+"\twidth: 600px;\n"+"\n"+"\tpadding: 2px;\n"+"\tlist-style: none;\n"+"\tmargin: 0;\n"+"\n"+"\tbackground: #eeeeee;\n"+"\tborder: 1px solid DarkGray;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .currentTag   {\n"+"\tfont-weight: bold;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .suggestionNumber {\n"+"\tcolor: #808080;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .numberedSuggestion{\n"+"\twhite-space: nowrap;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .intelliTaggerFooter {\n"+"\tmargin-top: 4px;\n"+"\tborder-top-width: thin;\n"+"\tborder-top-style: solid;\n"+"\tborder-top-color: #999999;\n"+"}\n"+".intelliTaggerSuggestions .favorites {\n"+"\tborder-bottom-width: thin;\n"+"\tborder-bottom-style: solid;\n"+"\tborder-bottom-color: #999999;\n"+"\tpadding-bottom: 2px;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .normalTags {\n"+"\tpadding-top: 2px;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .intelliTaggerFooter .button {\n"+"\tfont-size: 10px;\n"+"\n"+"\tpadding-left: 0.3em;\n"+"\tpadding-right: 0.3em;\n"+"}\n"+"\n"+"/*}}}*/\n";config.shadowTiddlers["IntelliTaggerMainTemplate"]="<!--\n"+"{{{\n"+"-->\n"+"<div class=\"favorites\" macro=\"intelliTagger action: showFavorites\"></div>\n"+"<div class=\"normalTags\" macro=\"intelliTagger action: showTags\"></div>\n"+"<!-- The Footer (with the Navigation) ============================================ -->\n"+"<table class=\"intelliTaggerFooter\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tbody>\n"+"  <tr>\n"+"\t<td align=\"left\">\n"+"\t\t<span macro=\"intelliTagger action: closeButton\"></span>\n"+"\t</td>\n"+"\t<td align=\"right\">\n"+"\t\t<\n"+"\t</td>\n"+"  </tr>\n"+"</tbody></table>\n"+"<!--\n"+"}}}\n"+"-->\n";config.shadowTiddlers["IntelliTaggerEditTagsTemplate"]="<!--\n"+"{{{\n"+"-->\n"+"<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler'></div>\n"+"<div class='title' macro='view title'></div>\n"+"<div class='tagged' macro='tags'></div>\n"+"<div class='viewer' macro='view text wikified'></div>\n"+"<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler'></div>\n"+"<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>\n"+"<!--\n"+"}}}\n"+"-->\n";config.shadowTiddlers["BSD open source license (abego Software)"]="See [[Licence|http://tiddlywiki.abego-software.de/#%5B%5BBSD%20open%20source%20license%5D%5D]].";config.shadowTiddlers["IntelliTaggerPlugin Documentation"]="[[Documentation on abego Software website|http://tiddlywiki.abego-software.de/doc/IntelliTagger.pdf]].";config.shadowTiddlers["IntelliTaggerPlugin SourceCode"]="[[Plugin source code on abego Software website|http://tiddlywiki.abego-software.de/archive/IntelliTaggerPlugin/Plugin-IntelliTagger-src.1.0.2.js]]\n";(function(){var _126=restart;restart=function(){setStylesheet(store.getTiddlerText("IntelliTaggerStyleSheet"),"IntelliTaggerStyleSheet");_126.apply(this,arguments);};})();}
// %/
/***

***/
/***
!Using the "IntelliTagsEditCommandPlugin"
Add the command {{{intelliTagsEdit}}} into the 'macro' attribute of the 'toolbar' {{{<div...>}}} in your ViewTemplate.

''Example:''
{{{
<div class='toolbar' 
        macro='toolbar -closeTiddler closeOthers +editTiddler intelliTagsEdit permalink references jump'>
</div>
}}}

This adds a "tags" button to the toolbar of the tiddlers (next to the ''edit'' button). Pressing the "tags" button will open the input field for the tiddler's tags and let you edit the tags with all the [[IntelliTaggerPlugin|http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin]] features.
***/
/***
!Source Code
***/
//{{{
(function(){

if (!version.extensions.IntelliTaggerPlugin)
    throw Error("IntelliTagsEditCommandPlugin requires the IntelliTaggerPlugin (http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin)");

if (config.commands.intelliTagsEdit) 
    return;

config.commands.intelliTagsEdit = {
	text: "étiquettes",
	tooltip: "éditer les étiquettes"
};

config.commands.intelliTagsEdit.handler = function(event,src,title) {
	var button = abego.IntelliTagger.createEditTagsButton(title, null, "étiquettes", "éditer les étiquettes");
	button.onclick(event);
	return false;
};

})();
//}}}
{{{
<<forEachTiddler
 where
 'tiddler.tags && tiddler.tags.length'
 sortBy 
 'getSortedTagsText(tiddler)+"###"+tiddler.title'
 script
 'function getSortedTagsText(tiddler) {var tags = tiddler.tags; if (!tags) return ""; tags.sort(); var result = ""; for (var i = 0; i < tags.length;i++) {result += tags[i]+ " ";} return result;} function getGroupTitle(tiddler, context) {if (!context.lastGroup || context.lastGroup != getSortedTagsText(tiddler)) { context.lastGroup = getSortedTagsText(tiddler); return "* {{{"+(context.lastGroup?context.lastGroup:"no tags")+"}}}\n";} else return "";} '
 write
 'getGroupTitle(tiddler, context)+"** [[" + tiddler.title+"]]\n"'
>>
}}}
<<forEachTiddler
 where
 'tiddler.tags && tiddler.tags.length'
 sortBy 
 'getSortedTagsText(tiddler)+"###"+tiddler.title'
 script
 'function getSortedTagsText(tiddler) {var tags = tiddler.tags; if (!tags) return ""; tags.sort(); var result = ""; for (var i = 0; i < tags.length;i++) {result += tags[i]+ " ";} return result;} function getGroupTitle(tiddler, context) {if (!context.lastGroup || context.lastGroup != getSortedTagsText(tiddler)) { context.lastGroup = getSortedTagsText(tiddler); return "* {{{"+(context.lastGroup?context.lastGroup:"no tags")+"}}}\n";} else return "";} '
 write
 'getGroupTitle(tiddler, context)+"** [[" + tiddler.title+"]]\n"'
>>
//(Tiddlers without tags are not included)//
/***

***/
// /%
function placeholderIsSupported(){var e=document.createElement("input");return"placeholder"in e}(function(e){var t=config.macros.listfiltr={InputPlaceholder:"filtre",InputLabel:"Filter list:",InputTooltip:"filtrage",defaultPreserve:".st-bullet, .annotation",wait:500,minInput:2,or:" ",h:"h1,h2,h3,h4,h5,h6",index:"li,dd,dt,td,th,div",remove:"lf-h lf-hide lf-found lf-keep lf-section",ignore:".lf-found,br,.pseudo-ol-li,.linkified",keepOuter:"b,em,strong,blockquote",keep:[".lf-keep.lf-h",".lf-found.lf-h",".lf-found .lf-h:not(%0)",".lf-section.lf-h",".lf-section .lf-h","thead:not(.lf-h) .lf-h","tr.lf-keep td.lf-h","tr.lf-keep th.lf-h","tr.lf-keep td > .lf-h","tr.lf-keep th > .lf-h","dt.lf-keep .lf-h","dd.lf-keep .lf-h"].join(","),dontKeepInsideFound:["tr.lf-h","div.lf-found li.lf-h:not(div.lf-found li.lf-found li.lf-h)","td.lf-found tr.lf-h","td.lf-found li.lf-h","td.lf-found dt.lf-h","td.lf-found dd.lf-h",".sliderPanel.lf-found li.lf-h",".sliderPanel.lf-found ul.lf-h"].join(","),showOnFilter:[".sliderPanel"].join(","),hideOnEmpty:[".sliderPanel"].join(","),timer:0,handler:function(n,r,i,s,o,u){var a,f,l,c,h=[],p,d=o.parseParams("anon",null,true),v=getParam(d,"appendTo",this.appendTo),m=getParam(d,"preserve",this.defaultPreserve);if(v){c=e(n).closest(".tiddler");n=e(v,c).first()[0]||n}c=e(n).children().last();while(c.is("br"))c=c.prev();if(c.is("span, div"))c=c.contents();c.wrapAll('<div class="lf-list"/>');c=c.closest(".lf-list");if(e.fn.outline)e("ol:not(ol li > ol)",c).outline();t.finalKeep=t.keep;t.keepOuter.split(",").map(function(e){h.push("> "+e);t.finalKeep+=", > "+e+".lf-preserve.lf-h"});e(m+(h.length?","+h.join(","):""),c).addClass("lf-preserve");t.textToParagraph(c);f=e("<div class=lf-search/>").insertBefore(c);p=placeholderIsSupported()?t.InputPlaceholder:"";if(!p){e("<span class=lf-label/>").html(t.InputLabel).appendTo(f)}a=e('<input type="search"/>').attr({title:t.InputTooltip,placeholder:p}).appendTo(f);a.bind("keyup search",function(){var n=e(this);clearTimeout(t.timer);t.timer=setTimeout(function(){t.filter(n);return true},t.wait)})},filter:function(n){var r,i,s,o,u,a=t.index+",span,"+t.h,f=n.val(),l=n.closest(".lf-search").next(),c=n.closest(".st-tree"),h=config.macros.simpletree;if(f.length>t.minInput){l.addClass("lf-filtered");if(h&&c.length&&!c.is(".st-all")){h.toggleAll(c);c.addClass("lf-tree")}}else{l.removeClass("lf-filtered");if(h&&c.length&&c.is(".st-all.lf-tree")){h.toggleAll(c)}c.removeClass("lf-tree")}e("*",l).removeClass(t.remove);e(".highlight",l).each(function(){var t=e(this),n=t.parent();if(t.is("pre, code")){t.removeClass("highlight")}else{t.contents().unwrap();n[0].normalize()}});if(f.length<t.minInput){e(t.hideOnEmpty,l).hide()}else{e(t.showOnFilter,l).show();t.highlight(e.trim(f.toLowerCase()),l);e(a,l).not(t.ignore).each(function(){var n=1,r,o,u,a,f,l,c,h,p,d,v=e(this);i=v.is(".highlight");if(!i)i=v.is("li, dt, dd")?t.checkLi(v):e(".highlight",v).length;if(i){t.mark(v,true);d=v.parentsUntil(".lf-list").last();if(d.is(t.keepOuter)){t.mark(d,true);s=t.keepHeading(d,true)}d=v.closest(t.h);if(d.length)d.nextUntil(t.h).addClass("lf-keep lf-section");else t.keepHeading(v);d=v.closest("dt");if(d.length){t.mark(d);t.mark(d.nextUntil("dt","dd"))}d=v.closest("dd");if(d.length){t.mark(d.prevAll("dt:first"))}d=v.closest("td, th");if(d.length){h=t.mark(v.closest("table"));u=d.is("th")&&!d.prev().length;p=d.closest("tr");t.mark(p,u);a=t.maxCols(h);r=t.numCols(p);if(r<a){l=p.prev("tr");do{t.mark(l,u);l=t.numCols(l)<=r?l.prev("tr"):0}while(l.length)}f=p.next("tr");while(f.length){if(r==a&&t.numCols(f)<r||r<a&&t.numCols(f)<=r){t.mark(f,u);f=f.next("tr")}else{f=0}}if(d.closest("thead").length){v.prevAll().each(function(){o=e(this).attr("colspan");n+=o?parseInt(o):1});h.find("tbody tr").each(function(){var r=0;e("td, th",this).each(function(){var i=e(this);o=i.attr("colspan");r+=o?parseInt(o):1;if(r>=n){t.mark(i,true);t.mark(i.closest("tr"));return false}})})}}if(v.is(".listTitle")&&v.parent().hasClass("timeline"))t.mark(e("> li",v.parent()));t.mark(v.closest("li").parent().find("> .listTitle"))}else{v.addClass("lf-h");if(v.is("td, th")&&v.closest("tbody").length){v.closest("tr").not(".lf-found, .lf-keep").addClass("lf-h")}}});e(".highlight",l).parentsUntil(l).removeClass("lf-h");e("ol, ul, dl, table, .lf-preserve",l).each(function(){var n=e(this);if(e(".highlight",n).length)t.mark(n);else n.addClass("lf-h")});e(t.h,l).not(".lf-found").each(function(){var n=e(this),r=true,i=n.nextUntil(t.h);i.each(function(){el=e(this);if(el.is(".lf-keep, .lf-found, .lf-section")){r=false;return r}});if(r)i.removeClass("lf-keep lf-preserve").addClass("lf-h")});e(t.finalKeep.format(t.dontKeepInsideFound),l).removeClass("lf-h");e(".lf-h:not(.lf-preserve .lf-h)",l).addClass("lf-hide")}return true},highlight:function(n,r){e("*",r).highlight(n);e(".externalLink, .tiddlyLink",r).each(function(){var r=e(this),i=(r.attr("tiddlyLink")||r.attr("href")).replace(/\/\/\:/mg,"_").toLowerCase();n.split(t.or).map(function(t){if(t&&i.indexOf(t)>-1&&!e(".highlight",r).length){r.contents().wrap('<span class="highlight"/>')}})})},keepHeading:function(e,n){n=n?e:e.parentsUntil(".lf-list").last();h=n.prev();if(!h.is(t.h))h=n.prevUntil(t.h).last().prev();if(h.is(t.h)){t.mark(h)}},mark:function(e,n){e.not(t.ignore).removeClass("lf-keep lf-h").not(".highlight").addClass(n?"lf-found":"lf-keep");return e},textToParagraph:function(n){n.find(":not(iframe)").addBack().contents().filter(function(){var t=e(this);return this.nodeType==3&&(t.next().length||t.prev().length)&&!t.closest(".lf-preserve").length&&!t.prevAll(".pseudo-ol-li").length}).wrap('<span class="lf-text"/>');e(".lf-text",n).each(function(){var n,r=e(this),i=false;if(r.closest(".lf-p").length)return true;n=r.prevUntil(t.block).add(r).add(r.nextUntil(t.block));n.each(function(){var n=e(this);i=n.next().is(t.block)||n.prev().is(t.block);return!i});if(i)n.wrapAll('<span class="lf-p lf-preserve"/>')})},maxCols:function(t){var n=0;e("> thead > tr, > tbody > tr",t).each(function(){n=Math.max(n,e("> td, > th",this).length)});return n},numCols:function(t){var n=0;e("> td, > th",t).each(function(){var t=e(this).attr("colspan");n+=t?parseInt(t):1});return n},checkLi:function(n,r){var i=false;n.children(":not(ol, ul, dl)").each(function(){var n=e(this),s=n.is(".highlight")||e(".highlight",n).length;if(r)t.mark(n);i=i||s});if(i||r){x=n.parent("ol, ul, dl").parent("li, dd, dt");if(x.length)t.checkLi(x,true)}return i}};t.block=t.h+","+t.index+",br,blockquote,ol,ul,dt,p,pre,form";e.fn.highlight=function(n){var r=[],i='<span class="highlight">%0</span>',s=n.split(t.or);s.map(function(e){if(e)r.push("(\\b\\w*"+e+"\\w*\\b)")});r=new RegExp(r.join("|"),"gi");this.each(function(){var t=e(this);e(this).contents().each(function(){if(this.nodeType===3&&r.test(this.nodeValue)){var o=t.closest("pre, code");if(o.length){o.addClass("highlight")}else{e(this).replaceWith(this.nodeValue.replace(r,function(e,t){var n;s.map(function(t){if(e.toLowerCase().indexOf(t)>=0){n=i.format(e)}return!n});return n}))}}else if(!e(this).hasClass("highlight")){e(this).highlight(n)}})});return this};config.shadowTiddlers["StyleSheetListFiltr"]="/*{{{*/\n"+".lf-search {padding:5px;background:#E1DEDE;}\n"+".lf-hide {display: none !important;}\n"+".lf-found {background:#F5F5DC;}\n"+".lf-list + br {display:none;}\n"+".lf-label {margin-right:5px;font-weight:bold;}\n"+".lf-filtered .lf-p {display:block;}\n"+".lf-filtered dd .lf-p {display:inline-block;}\n"+".lf-filtered br {display: none;}\n"+".lf-filtered .lf-preserve br {display: block;}\n"+".lf-preserve.lf-found br {display: block;}\n"+"/*}}}*/";store.addNotification("StyleSheetListFiltr",refreshStyles)})(jQuery)
//%/

<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<link rel="shortcut icon" href="k/favicon.ico" type="image/x-icon"> 
<!--}}}-->
/***

!!!!!Documentation
> see [[MatchTagsPluginInfo]]
!!!!!Revisions
<<<
2011.10.28 2.0.6 added .matchTags CSS class to popups to enable custom styling via StyleSheet
2011.01.23 2.0.5 fix core tweak for TW262+: adjust code in config.filters['tag'] instead of filterTiddlers()
2010.08.11 2.0.4 in getMatchingTiddlers(), fixed sorting for descending order (e.g, "-created")
| please see [[MatchTagsPluginInfo]] for additional revision details |
2008.02.28 1.0.0 initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.MatchTagsPlugin= {major: 2, minor: 0, revision: 6, date: new Date(2011,10,28)};

// store.getMatchingTiddlers() processes boolean expressions for tag matching
//    sortfield (optional) sets sort order for tiddlers - default=title
//    tiddlers (optional) use alternative set of tiddlers (instead of current store)
TiddlyWiki.prototype.getMatchingTiddlers = function(tagexpr,sortfield,tiddlers) {

	var debug=config.options.chkDebug; // abbreviation
	var cmm=config.macros.matchTags; // abbreviation
	var r=[]; // results are an array of tiddlers
	var tids=tiddlers||store.getTiddlers();
	if (tids && sortfield) tids=store.sortTiddlers(tids,sortfield);
	if (debug) displayMessage(cmm.msg1.format([tids.length]));

	// try simple lookup to quickly find single tags or tags that
	// contain boolean operators as literals, e.g. "foo and bar"
	for (var t=0; t<tids.length; t++)
		if (tids[t].isTagged(tagexpr)) r.pushUnique(tids[t]);
	if (r.length) {
		if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
		return r;
	}
	
	// convert expression into javascript code with regexp tests,
	// so that "tag1 AND ( tag2 OR NOT tag3 )" becomes
	// "/\~tag1\~/.test(...) && ( /\~tag2\~/.test(...) || ! /\~tag3\~/.test(...) )"

	// normalize whitespace, tokenize operators, delimit with "~"
	var c=tagexpr.trim(); // remove leading/trailing spaces
	c = c.replace(/\s+/ig," "); // reduce multiple spaces to single spaces
	c = c.replace(/\(\s?/ig,"~(~"); // open parens
	c = c.replace(/\s?\)/ig,"~)~"); // close parens
	c = c.replace(/(\s|~)?&&(\s|~)?/ig,"~&&~"); // &&
	c = c.replace(/(\s|~)AND(\s|~)/ig,"~&&~"); // AND
	c = c.replace(/(\s|~)?\|\|(\s|~)?/ig,"~||~"); // ||
	c = c.replace(/(\s|~)OR(\s|~)/ig,"~||~"); // OR
	c = c.replace(/(\s|~)?!(\s|~)?/ig,"~!~"); // !
	c = c.replace(/(^|~|\s)NOT(\s|~)/ig,"~!~"); // NOT
	c = c.replace(/(^|~|\s)NOT~\(/ig,"~!~("); // NOT(
	// change tag terms to regexp tests
	var terms=c.split("~"); for (var i=0; i<terms.length; i++) { var t=terms[i];
		if (/(&&)|(\|\|)|[!\(\)]/.test(t) || t=="") continue; // skip operators/parens/spaces
		if (t==config.macros.matchTags.untaggedKeyword)
			terms[i]="tiddlertags=='~~'"; // 'untagged' tiddlers
		else
			terms[i]="/\\~"+t+"\\~/.test(tiddlertags)";
	}
	c=terms.join(" ");
	if (debug) { displayMessage(cmm.msg2.format([tagexpr])); displayMessage(cmm.msg3.format([c])); }

	// scan tiddlers for matches
	for (var t=0; t<tids.length; t++) {
	 	// assemble tags from tiddler into string "~tag1~tag2~tag3~"
		var tiddlertags = "~"+tids[t].tags.join("~")+"~";
		try { if(eval(c)) r.push(tids[t]); } // test tags
		catch(e) { // error in test
			displayMessage(cmm.msg2.format([tagexpr]));
			displayMessage(cmm.msg3.format([c]));
			displayMessage(e.toString());
			break; // skip remaining tiddlers
		}
	}
	if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
	return r;
}
//}}}
//{{{
config.macros.matchTags = {
	msg1: "scan %0 papiers",
	msg2: "recherche de '%0'",
	msg3: "sur: '%0'",
	msg4: "trouvé %0 papiers correspondant à '%1'",
	noMatch: "no matching tiddlers",
	untaggedKeyword: "-",
	untaggedLabel: "no tags",
	untaggedPrompt: "show tiddlers with no tags",
	defTiddler: "RapportSurEtiquettes",
	defTags: "",
	defFormat: "[[%0]]",
	defSeparator: "\n",
	reportHeading: "Trouvé %0 papiers étiquetés: '{{{%1}}}'\n----\n",
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var mode=params[0]?params[0].toLowerCase():'';
		if (mode=="inline")
			params.shift();
		if (mode=="report" || mode=="panel") {
			params.shift();
			var target=params.shift()||this.defTiddler;
		}
		if (mode=="popup") {
			params.shift();
			if (params[0]&&params[0].substr(0,6)=="label:") var label=params.shift().substr(6);
			if (params[0]&&params[0].substr(0,7)=="prompt:") var prompt=params.shift().substr(7);
		} else {
			var fmt=(params.shift()||this.defFormat).unescapeLineBreaks();
			var sep=(params.shift()||this.defSeparator).unescapeLineBreaks();
		}
		var sortBy="+title";
		if (params[0]&&params[0].substr(0,5)=="sort:") sortBy=params.shift().substr(5);
		var expr = params.join(" ");
		if (mode!="panel" && (!expr||!expr.trim().length)) return;
		if (expr==this.untaggedKeyword)
			{ var label=this.untaggedLabel; var prompt=this.untaggedPrompt };
		switch (mode) {
			case "popup": this.createPopup(place,label,expr,prompt,sortBy); break;
			case "panel": this.createPanel(place,expr,fmt,sep,sortBy,target); break;
			case "report": this.createReport(target,this.defTags,expr,fmt,sep,sortBy); break;
			case "inline": default: this.createInline(place,expr,fmt,sep,sortBy); break;
		}
	},
	formatList: function(tids,fmt,sep) {
		var out=[];
		for (var i=0; i<tids.length; i++) { var t=tids[i];
			var title=t.title;
			var who=t.modifier;
			var when=t.modified.toLocaleString();
			var text=t.text;
			var first=t.text.split("\n")[0];
			var desc=store.getTiddlerSlice(t.title,"description");
			desc=desc||store.getTiddlerSlice(t.title,"Description");
			desc=desc||store.getTiddlerText(t.title+"##description");
			desc=desc||store.getTiddlerText(t.title+"##Description");
			var tags=t.tags.length?'[['+t.tags.join(']] [[')+']]':'';
			out.push(fmt.format([title,who,when,text,first,desc,tags]));
		}
		return out.join(sep);
	},
	createInline: function(place,expr,fmt,sep,sortBy) {
		wikify(this.formatList(store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy),fmt,sep),place);
	},
	createPopup: function(place,label,expr,prompt,sortBy) {
		var btn=createTiddlyButton(place,
			(label||expr).format([expr]),
			(prompt||config.views.wikified.tag.tooltip).format([expr]),
			function(ev){ return config.macros.matchTags.showPopup(this,ev||window.event); });
		btn.setAttribute("sortBy",sortBy);
		btn.setAttribute("expr",expr);
	},
	showPopup: function(here,ev) {
		var p=Popup.create(here,null,"matchTags popup"); if (!p) return false;
		var tids=store.getMatchingTiddlers(here.getAttribute("expr"));
		store.sortTiddlers(tids,here.getAttribute("sortBy"));
		var list=[]; for (var t=0; t<tids.length; t++) list.push(tids[t].title);
		if (!list.length) createTiddlyText(p,this.noMatch);
		else {
			var b=createTiddlyButton(createTiddlyElement(p,"li"),
				config.views.wikified.tag.openAllText,
				config.views.wikified.tag.openAllTooltip,
				function() {
					var list=this.getAttribute("list").readBracketedList();
					story.displayTiddlers(null,tids);
				});
			b.setAttribute("list","[["+list.join("]] [[")+"]]");
			createTiddlyElement(p,"hr");
		}
		var out=this.formatList(tids," &nbsp;[[%0]]&nbsp; ","\n"); wikify(out,p);
		Popup.show();
		ev.cancelBubble=true;
		if(ev.stopPropagation) ev.stopPropagation();
		return false;
	},
	createReport: function(target,tags,expr,fmt,sep,sortBy) {
		var tids=store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy);
		if (!tids.length) { displayMessage('no matches for: '+expr); return false; }
		var msg=config.messages.overwriteWarning.format([target]);
		if (store.tiddlerExists(target) && !confirm(msg)) return false;
		var out=this.reportHeading.format([tids.length,expr])
		out+=this.formatList(tids,fmt,sep);
		store.saveTiddler(target,target,out,config.options.txtUserName,new Date(),tags,{});
		story.closeTiddler(target); story.displayTiddler(null,target);
	},
	createPanel: function(place,expr,fmt,sep,sortBy,tid) {
		var s=createTiddlyElement(place,"span"); s.innerHTML=store.getTiddlerText("MatchTagsPlugin##html");
		var f=s.getElementsByTagName("form")[0];
		f.expr.value=expr; f.fmt.value=fmt; f.sep.value=sep.escapeLineBreaks();
		f.tid.value=tid; f.tags.value=this.defTags;
	}
};
//}}}
/***
//{{{
!html
<form style='display:inline;white-space:nowrap'>
<input type='text'    name='expr' style='width:50%' title='tag expression'><!--
--><input type='text'    name='fmt'  style='width:10%' title='list item format'><!--
--><input type='text'    name='sep'  style='width:5%'  title='list item separator'><!--
--><input type='text'    name='tid'  style='width:12%' title='target tiddler title'><!--
--><input type='text'    name='tags' style='width:10%' title='target tiddler tags'><!--
--><input type='button'  name='go'   style='width:8%'  value='go' onclick="
	var expr=this.form.expr.value;
	if (!expr.length) { alert('Enter a boolean tag expression'); return false; }
	var fmt=this.form.fmt.value;
	if (!fmt.length) { alert('Enter the list item output format'); return false; }
	var sep=this.form.sep.value.unescapeLineBreaks();
	var tid=this.form.tid.value;
	if (!tid.length) { alert('Enter a target tiddler title'); return false; }
	var tags=this.form.tags.value;
	config.macros.matchTags.createReport(tid,tags,expr,fmt,sep,'title');
	return false;">
</form>
!end
//}}}
***/
//{{{
// SHADOW TIDDLER for displaying default panel input form
config.shadowTiddlers.MatchTags="<<matchTags panel>>";
//}}}
//{{{
// TWEAK core filterTiddlers() or config.filters['tag'] (in TW262+)
// to use getMatchingTiddlers instead getTaggedTiddlers
// for enhanced boolean matching in [tag[...]] syntax
var TW262=config.filters && config.filters['tag']; // detect TW262+
var fname=TW262?"config.filters['tag']":"TiddlyWiki.prototype.filterTiddlers";
var code=eval(fname).toString().replace(/getTaggedTiddlers/g,'getMatchingTiddlers');
eval(fname+'='+code);
//}}}
//{{{
// REDEFINE core handler for enhanced boolean matching in tag:"..." paramifier
// use filterTiddlers() instead of getTaggedTiddlers() to get list of tiddlers.
config.paramifiers.tag = {
	onstart: function(v) {
		var tagged = store.filterTiddlers("[tag["+v+"]]");
		story.displayTiddlers(null,tagged,null,false,null);
	}
};
//}}}
config.options.txtFadeTimer = 2000; // ms ... 2 seconds 

function displayMessage(text,linkText,fadeTimer) { 
        var e = getMessageDiv(); 
        if(!e) { 
                alert(text); 
                return; 
        } 
        if(linkText) { 
                var link = createTiddlyElement(e,"a",null,null,text); 
                link.href = linkText; 
                link.target = "_blank"; 
        } else { 
                e.appendChild(document.createTextNode(text)); 
        } 
        if(config.options.txtFadeTimer > 0) { 
                setTimeout(clearMessage, config.options.txtFadeTimer); 
        } 
}
/***

!!!!!Documentation
>see [[NestedSlidersPluginInfo]]
!!!!!Configuration
<<<
<<option chkFloatingSlidersAnimate>> allow floating sliders to animate when opening/closing
>Note: This setting can cause 'clipping' problems in some versions of InternetExplorer.
>In addition, for floating slider animation to occur you must also allow animation in general (see [[AdvancedOptions]]).
<<<
!!!!!Revisions
<<<
2008.11.15 - 2.4.9 in adjustNestedSlider(), don't make adjustments if panel is marked as 'undocked' (CSS class).  In onClickNestedSlider(), SHIFT-CLICK docks panel (see [[MoveablePanelPlugin]])
|please see [[NestedSlidersPluginInfo]] for additional revision details|
2005.11.03 - 1.0.0 initial public release.  Thanks to RodneyGomes, GeoffSlocock, and PaulPetterson for suggestions and experiments.
<<<
!!!!!Code
***/
//{{{
version.extensions.NestedSlidersPlugin= {major: 2, minor: 4, revision: 9, date: new Date(2008,11,15)};

// options for deferred rendering of sliders that are not initially displayed
if (config.options.chkFloatingSlidersAnimate===undefined)
	config.options.chkFloatingSlidersAnimate=false; // avoid clipping problems in IE

// default styles for 'floating' class
setStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \
	background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

config.formatters.push( {
	name: "nestedSliders",
	match: "\\n?\\+{3}",
	terminator: "\\s*\\={3}\\n?",
	lookahead: "\\n?\\+{3}(\\+)?(\\([^\\)]*\\))?(\\!*)?(\\^(?:[^\\^\\*\\@\\[\\>]*\\^)?)?(\\*)?(\\@)?(?:\\{\\{([\\w]+[\\s\\w]*)\\{)?(\\[[^\\]]*\\])?(\\[[^\\]]*\\])?(?:\\}{3})?(\\#[^:]*\\:)?(\\>)?(\\.\\.\\.)?\\s*",
	handler: function(w)
		{
			lookaheadRegExp = new RegExp(this.lookahead,"mg");
			lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = lookaheadRegExp.exec(w.source)
			if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
			{
				var defopen=lookaheadMatch[1];
				var cookiename=lookaheadMatch[2];
				var header=lookaheadMatch[3];
				var panelwidth=lookaheadMatch[4];
				var transient=lookaheadMatch[5];
				var hover=lookaheadMatch[6];
				var buttonClass=lookaheadMatch[7];
				var label=lookaheadMatch[8];
				var openlabel=lookaheadMatch[9];
				var panelID=lookaheadMatch[10];
				var blockquote=lookaheadMatch[11];
				var deferred=lookaheadMatch[12];

				// location for rendering button and panel
				var place=w.output;

				// default to closed, no cookie, no accesskey, no alternate text/tip
				var show="none"; var cookie=""; var key="";
				var closedtext=">"; var closedtip="";
				var openedtext="<"; var openedtip="";

				// extra "+", default to open
				if (defopen) show="block";

				// cookie, use saved open/closed state
				if (cookiename) {
					cookie=cookiename.trim().slice(1,-1);
					cookie="chkSlider"+cookie;
					if (config.options[cookie]==undefined)
						{ config.options[cookie] = (show=="block") }
					show=config.options[cookie]?"block":"none";
				}

				// parse label/tooltip/accesskey: [label=X|tooltip]
				if (label) {
					var parts=label.trim().slice(1,-1).split("|");
					closedtext=parts.shift();
					if (closedtext.substr(closedtext.length-2,1)=="=")	
						{ key=closedtext.substr(closedtext.length-1,1); closedtext=closedtext.slice(0,-2); }
					openedtext=closedtext;
					if (parts.length) closedtip=openedtip=parts.join("|");
					else { closedtip="show "+closedtext; openedtip="hide "+closedtext; }
				}

				// parse alternate label/tooltip: [label|tooltip]
				if (openlabel) {
					var parts=openlabel.trim().slice(1,-1).split("|");
					openedtext=parts.shift();
					if (parts.length) openedtip=parts.join("|");
					else openedtip="hide "+openedtext;
				}

				var title=show=='block'?openedtext:closedtext;
				var tooltip=show=='block'?openedtip:closedtip;

				// create the button
				if (header) { // use "Hn" header format instead of button/link
					var lvl=(header.length>5)?5:header.length;
					var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,buttonClass,title);
					btn.onclick=onClickNestedSlider;
					btn.setAttribute("href","javascript:;");
					btn.setAttribute("title",tooltip);
				}
				else
					var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,buttonClass);
				btn.innerHTML=title; // enables use of HTML entities in label

				// set extra button attributes
				btn.setAttribute("closedtext",closedtext);
				btn.setAttribute("closedtip",closedtip);
				btn.setAttribute("openedtext",openedtext);
				btn.setAttribute("openedtip",openedtip);
				btn.sliderCookie = cookie; // save the cookiename (if any) in the button object
				btn.defOpen=defopen!=null; // save default open/closed state (boolean)
				btn.keyparam=key; // save the access key letter ("" if none)
				if (key.length) {
					btn.setAttribute("accessKey",key); // init access key
					btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus
				}
				btn.setAttribute("hover",hover?"true":"false");
				btn.onmouseover=function(ev) {
					// optional 'open on hover' handling
					if (this.getAttribute("hover")=="true" && this.sliderPanel.style.display=='none') {
						document.onclick.call(document,ev); // close transients
						onClickNestedSlider(ev); // open this slider
					}
					// mouseover on button aligns floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this,this.sliderPanel);
				}

				// create slider panel
				var panelClass=panelwidth?"floatingPanel":"sliderPanel";
				if (panelID) panelID=panelID.slice(1,-1); // trim off delimiters
				var panel=createTiddlyElement(place,"div",panelID,panelClass,null);
				panel.button = btn; // so the slider panel know which button it belongs to
				btn.sliderPanel=panel; // so the button knows which slider panel it belongs to
				panel.defaultPanelWidth=(panelwidth && panelwidth.length>2)?panelwidth.slice(1,-1):"";
				panel.setAttribute("transient",transient=="*"?"true":"false");
				panel.style.display = show;
				panel.style.width=panel.defaultPanelWidth;
				panel.onmouseover=function(event) // mouseover on panel aligns floater position with button
					{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this.button,this); }

				// render slider (or defer until shown) 
				w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
				if ((show=="block")||!deferred) {
					// render now if panel is supposed to be shown or NOT deferred rendering
					w.subWikify(blockquote?createTiddlyElement(panel,"blockquote"):panel,this.terminator);
					// align floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(place,btn,panel);
				}
				else {
					var src = w.source.substr(w.nextMatch);
					var endpos=findMatchingDelimiter(src,"+++","===");
					panel.setAttribute("raw",src.substr(0,endpos));
					panel.setAttribute("blockquote",blockquote?"true":"false");
					panel.setAttribute("rendered","false");
					w.nextMatch += endpos+3;
					if (w.source.substr(w.nextMatch,1)=="\n") w.nextMatch++;
				}
			}
		}
	}
)

function findMatchingDelimiter(src,starttext,endtext) {
	var startpos = 0;
	var endpos = src.indexOf(endtext);
	// check for nested delimiters
	while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {
		// count number of nested 'starts'
		var startcount=0;
		var temp = src.substring(startpos,endpos-1);
		var pos=temp.indexOf(starttext);
		while (pos!=-1)  { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }
		// set up to check for additional 'starts' after adjusting endpos
		startpos=endpos+endtext.length;
		// find endpos for corresponding number of matching 'ends'
		while (startcount && endpos!=-1) {
			endpos = src.indexOf(endtext,endpos+endtext.length);
			startcount--;
		}
	}
	return (endpos==-1)?src.length:endpos;
}
//}}}
//{{{
window.onClickNestedSlider=function(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	while (theTarget && theTarget.sliderPanel==undefined) theTarget=theTarget.parentNode;
	if (!theTarget) return false;
	var theSlider = theTarget.sliderPanel;
	var isOpen = theSlider.style.display!="none";

	// if SHIFT-CLICK, dock panel first (see [[MoveablePanelPlugin]])
	if (e.shiftKey && config.macros.moveablePanel) config.macros.moveablePanel.dock(theSlider,e);

	// toggle label
	theTarget.innerHTML=isOpen?theTarget.getAttribute("closedText"):theTarget.getAttribute("openedText");
	// toggle tooltip
	theTarget.setAttribute("title",isOpen?theTarget.getAttribute("closedTip"):theTarget.getAttribute("openedTip"));

	// deferred rendering (if needed)
	if (theSlider.getAttribute("rendered")=="false") {
		var place=theSlider;
		if (theSlider.getAttribute("blockquote")=="true")
			place=createTiddlyElement(place,"blockquote");
		wikify(theSlider.getAttribute("raw"),place);
		theSlider.setAttribute("rendered","true");
	}

	// show/hide the slider
	if(config.options.chkAnimate && (!hasClass(theSlider,'floatingPanel') || config.options.chkFloatingSlidersAnimate))
		anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));
	else
		theSlider.style.display = isOpen ? "none" : "block";

	// reset to default width (might have been changed via plugin code)
	theSlider.style.width=theSlider.defaultPanelWidth;

	// align floater panel position with target button
	if (!isOpen && window.adjustSliderPos) window.adjustSliderPos(theSlider.parentNode,theTarget,theSlider);

	// if showing panel, set focus to first 'focus-able' element in panel
	if (theSlider.style.display!="none") {
		var ctrls=theSlider.getElementsByTagName("*");
		for (var c=0; c<ctrls.length; c++) {
			var t=ctrls[c].tagName.toLowerCase();
			if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")
				{ try{ ctrls[c].focus(); } catch(err){;} break; }
		}
	}
	var cookie=theTarget.sliderCookie;
	if (cookie && cookie.length) {
		config.options[cookie]=!isOpen;
		if (config.options[cookie]!=theTarget.defOpen) window.saveOptionCookie(cookie);
		else window.removeCookie(cookie); // remove cookie if slider is in default display state
	}

	// prevent SHIFT-CLICK from being processed by browser (opens blank window... yuck!)
	// prevent clicks *within* a slider button from being processed by browser
	// but allow plain click to bubble up to page background (to close transients, if any)
	if (e.shiftKey || theTarget!=resolveTarget(e))
		{ e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); }
	Popup.remove(); // close open popup (if any)
	return false;
}
//}}}
//{{{
// click in document background closes transient panels 
document.nestedSliders_savedOnClick=document.onclick;
document.onclick=function(ev) { if (!ev) var ev=window.event; var target=resolveTarget(ev);

	if (document.nestedSliders_savedOnClick)
		var retval=document.nestedSliders_savedOnClick.apply(this,arguments);
	// if click was inside a popup... leave transient panels alone
	var p=target; while (p) if (hasClass(p,"popup")) break; else p=p.parentNode;
	if (p) return retval;
	// if click was inside transient panel (or something contained by a transient panel), leave it alone
	var p=target; while (p) {
		if ((hasClass(p,"floatingPanel")||hasClass(p,"sliderPanel"))&&p.getAttribute("transient")=="true") break;
		p=p.parentNode;
	}
	if (p) return retval;
	// otherwise, find and close all transient panels...
	var all=document.all?document.all:document.getElementsByTagName("DIV");
	for (var i=0; i<all.length; i++) {
		 // if it is not a transient panel, or the click was on the button that opened this panel, don't close it.
		if (all[i].getAttribute("transient")!="true" || all[i].button==target) continue;
		// otherwise, if the panel is currently visible, close it by clicking it's button
		if (all[i].style.display!="none") window.onClickNestedSlider({target:all[i].button})
		if (!hasClass(all[i],"floatingPanel")&&!hasClass(all[i],"sliderPanel")) all[i].style.display="none";
	}
	return retval;
};
//}}}
//{{{
// adjust floating panel position based on button position
if (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel) {
	if (hasClass(panel,"floatingPanel") && !hasClass(panel,"undocked")) {
		// see [[MoveablePanelPlugin]] for use of 'undocked'
		var rightEdge=document.body.offsetWidth-1;
		var panelWidth=panel.offsetWidth;
		var left=0;
		var top=btn.offsetHeight; 
		if (place.style.position=="relative" && findPosX(btn)+panelWidth>rightEdge) {
			left-=findPosX(btn)+panelWidth-rightEdge; // shift panel relative to button
			if (findPosX(btn)+left<0) left=-findPosX(btn); // stay within left edge
		}
		if (place.style.position!="relative") {
			var left=findPosX(btn);
			var top=findPosY(btn)+btn.offsetHeight;
			var p=place; while (p && !hasClass(p,'floatingPanel')) p=p.parentNode;
			if (p) { left-=findPosX(p); top-=findPosY(p); }
			if (left+panelWidth>rightEdge) left=rightEdge-panelWidth;
			if (left<0) left=0;
		}
		panel.style.left=left+"px"; panel.style.top=top+"px";
	}
}
//}}}
//{{{
// TW2.1 and earlier:
// hijack Slider stop handler so overflow is visible after animation has completed
Slider.prototype.coreStop = Slider.prototype.stop;
Slider.prototype.stop = function()
	{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }

// TW2.2+
// hijack Morpher stop handler so sliderPanel/floatingPanel overflow is visible after animation has completed
if (version.major+.1*version.minor+.01*version.revision>=2.2) {
	Morpher.prototype.coreStop = Morpher.prototype.stop;
	Morpher.prototype.stop = function() {
		this.coreStop.apply(this,arguments);
		var e=this.element;
		if (hasClass(e,"sliderPanel")||hasClass(e,"floatingPanel")) {
			// adjust panel overflow and position after animation
			e.style.overflow = "visible";
			if (window.adjustSliderPos) window.adjustSliderPos(e.parentNode,e.button,e);
		}
	};
}
//}}}
FootnotesPlugin allows you to quickly and easily create footnotes for tiddlers. Great if you are writing academic content.
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::TiTre]] [[ColorPalette::TiTre]]'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>

<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/***
|<html><a name="Top"/></html>''Name:''|PartTiddlerPlugin|
|''Version:''|1.0.10 (2011-05-23)|
|''Source:''|http://tiddlywiki.abego-software.de/#PartTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license]]|
|''CoreVersion:''|2.1.3|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
!Table of Content<html><a name="TOC"/></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Description',null, event)">Description, Syntax</a></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Applications',null, event)">Applications</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('LongTiddler',null, event)">Refering to Paragraphs of a Longer Tiddler</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Citation',null, event)">Citation Index</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('TableCells',null, event)">Creating "multi-line" Table Cells</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Tabs',null, event)">Creating Tabs</a></html>
** <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Sliders',null, event)">Using Sliders</a></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Revisions',null, event)">Revision History</a></html>
* <html><a href="javascript:;" onclick="window.scrollAnchorVisible('Code',null, event)">Code</a></html>
!Description<html><a name="Description"/></html>
With the {{{<part aPartName> ... </part>}}} feature you can structure your tiddler text into separate (named) parts. 
Each part can be referenced as a "normal" tiddler, using the "//tiddlerName//''/''//partName//" syntax (e.g. "About/Features").  E.g. you may create links to the parts (e.g. {{{[[Quotes/BAX95]]}}} or {{{[[Hobbies|AboutMe/Hobbies]]}}}), use it in {{{<<tiddler...>>}}} or {{{<<tabs...>>}}} macros etc.


''Syntax:'' 
|>|''<part'' //partName// [''hidden''] ''>'' //any tiddler content// ''</part>''|
|//partName//|The name of the part. You may reference a part tiddler with the combined tiddler name "//nameOfContainerTidder//''/''//partName//. <<br>>If you use a partName containing spaces you need to quote it (e.g. {{{"Major Overview"}}} or {{{[[Shortcut List]]}}}).|
|''hidden''|When defined the content of the part is not displayed in the container tiddler. But when the part is explicitly referenced (e.g. in a {{{<<tiddler...>>}}} macro or in a link) the part's content is displayed.|
|<html><i>any&nbsp;tiddler&nbsp;content</i></html>|<html>The content of the part.<br>A part can have any content that a "normal" tiddler may have, e.g. you may use all the formattings and macros defined.</html>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Applications<html><a name="Applications"/></html>
!!Refering to Paragraphs of a Longer Tiddler<html><a name="LongTiddler"/></html>
Assume you have written a long description in a tiddler and now you want to refer to the content of a certain paragraph in that tiddler (e.g. some definition.) Just wrap the text with a ''part'' block, give it a nice name, create a "pretty link" (like {{{[[Discussion Groups|Introduction/DiscussionGroups]]}}}) and you are done.

Notice this complements the approach to first writing a lot of small tiddlers and combine these tiddlers to one larger tiddler in a second step (e.g. using the {{{<<tiddler...>>}}} macro). Using the ''part'' feature you can first write a "classic" (longer) text that can be read "from top to bottom" and later "reuse" parts of this text for some more "non-linear" reading.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Citation Index<html><a name="Citation"/></html>
Create a tiddler "Citations" that contains your "citations". 
Wrap every citation with a part and a proper name. 

''Example''
{{{
<part BAX98>Baxter, Ira D. et al: //Clone Detection Using Abstract Syntax Trees.// 
in //Proc. ICSM//, 1998.</part>

<part BEL02>Bellon, Stefan: //Vergleich von Techniken zur Erkennung duplizierten Quellcodes.// 
Thesis, Uni Stuttgart, 2002.</part>

<part DUC99>Ducasse, St�fane et al: //A Language Independent Approach for Detecting Duplicated Code.// 
in //Proc. ICSM//, 1999.</part>
}}}

You may now "cite" them just by using a pretty link like {{{[[Citations/BAX98]]}}} or even more pretty, like this {{{[[BAX98|Citations/BAX98]]}}}.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Creating "multi-line" Table Cells<html><a name="TableCells"/></html>
You may have noticed that it is hard to create table cells with "multi-line" content. E.g. if you want to create a bullet list inside a table cell you cannot just write the bullet list
{{{
* Item 1
* Item 2
* Item 3
}}}
into a table cell (i.e. between the | ... | bars) because every bullet item must start in a new line but all cells of a table row must be in one line.

Using the ''part'' feature this problem can be solved. Just create a hidden part that contains the cells content and use a {{{<<tiddler >>}}} macro to include its content in the table's cell.

''Example''
{{{
|!Subject|!Items|
|subject1|<<tiddler ./Cell1>>|
|subject2|<<tiddler ./Cell2>>|

<part Cell1 hidden>
* Item 1
* Item 2
* Item 3
</part>
...
}}}

Notice that inside the {{{<<tiddler ...>>}}} macro you may refer to the "current tiddler" using the ".".

BTW: The same approach can be used to create bullet lists with items that contain more than one line.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Creating Tabs<html><a name="Tabs"/></html>
The build-in {{{<<tabs ...>>}}} macro requires that you defined an additional tiddler for every tab it displays. When you want to have "nested" tabs you need to define a tiddler for the "main tab" and one for every tab it contains. I.e. the definition of a set of tabs that is visually displayed at one place is distributed across multiple tiddlers.

With the ''part'' feature you can put the complete definition in one tiddler, making it easier to keep an overview and maintain the tab sets.

''Example''
The standard tabs at the sidebar are defined by the following eight tiddlers:
* SideBarTabs
* TabAll
* TabMore
* TabMoreMissing
* TabMoreOrphans
* TabMoreShadowed
* TabTags
* TabTimeline

Instead of these eight tiddlers one could define the following SideBarTabs tiddler that uses the ''part'' feature:
{{{
<<tabs txtMainTab 
    Timeline Timeline SideBarTabs/Timeline 
    All 'All tiddlers' SideBarTabs/All 
    Tags 'All tags' SideBarTabs/Tags 
    More 'More lists' SideBarTabs/More>>
<part Timeline hidden><<timeline>></part>
<part All hidden><<list all>></part>
<part Tags hidden><<allTags>></part>
<part More hidden><<tabs txtMoreTab 
    Missing 'Missing tiddlers' SideBarTabs/Missing 
    Orphans 'Orphaned tiddlers' SideBarTabs/Orphans 
    Shadowed 'Shadowed tiddlers' SideBarTabs/Shadowed>></part>
<part Missing hidden><<list missing>></part>
<part Orphans hidden><<list orphans>></part>
<part Shadowed hidden><<list shadowed>></part>
}}}

Notice that you can easily "overwrite" individual parts in separate tiddlers that have the full name of the part.

E.g. if you don't like the classic timeline tab but only want to see the 100 most recent tiddlers you could create a tiddler "~SideBarTabs/Timeline" with the following content:
{{{
<<forEachTiddler 
		sortBy 'tiddler.modified' descending 
		write '(index < 100) ? "* [["+tiddler.title+"]]\n":""'>>
}}}
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!!Using Sliders<html><a name="Sliders"/></html>
Very similar to the build-in {{{<<tabs ...>>}}} macro (see above) the {{{<<slider ...>>}}} macro requires that you defined an additional tiddler that holds the content "to be slid". You can avoid creating this extra tiddler by using the ''part'' feature

''Example''
In a tiddler "About" we may use the slider to show some details that are documented in the tiddler's "Details" part.
{{{
...
<<slider chkAboutDetails About/Details details "Click here to see more details">>
<part Details hidden>
To give you a better overview ...
</part>
...
}}}

Notice that putting the content of the slider into the slider's tiddler also has an extra benefit: When you decide you need to edit the content of the slider you can just doubleclick the content, the tiddler opens for editing and you can directly start editing the content (in the part section). In the "old" approach you would doubleclick the tiddler, see that the slider is using tiddler X, have to look for the tiddler X and can finally open it for editing. So using the ''part'' approach results in a much short workflow.

<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Revision history<html><a name="Revisions"/></html>
* v1.0.10 (2011-05-23)
** Adapt to TW 2.6.2 default behaviour when existing tiddlers are opened (don't select text) and fixed Firefox 4 issue. Thanks to dave for reporting the issue.
* v1.0.9 (2007-07-14)
** Bugfix: Error when using the SideBarTabs example and switching between "More" and "Shadow". Thanks to cmari for reporting the issue.
* v1.0.8 (2007-06-16)
** Speeding up display of tiddlers containing multiple pard definitions. Thanks to Paco Rivi�re for reporting the issue.
** Support "./partName" syntax inside {{{<<tabs ...>>}}} macro
* v1.0.7 (2007-03-07)
** Bugfix: <<tiddler "./partName">> does not always render correctly after a refresh (e.g. like it happens when using the "Include" plugin). Thanks to Morris Gray for reporting the bug.
* v1.0.6 (2006-11-07)
** Bugfix: cannot edit tiddler when UploadPlugin by Bidix is installed. Thanks to Jos� Luis Gonz�lez Castro for reporting the bug.
* v1.0.5 (2006-03-02)
** Bugfix: Example with multi-line table cells does not work in IE6. Thanks to Paulo Soares for reporting the bug.
* v1.0.4 (2006-02-28)
** Bugfix: Shadow tiddlers cannot be edited (in TW 2.0.6). Thanks to Torsten Vanek for reporting the bug.
* v1.0.3 (2006-02-26)
** Adapt code to newly introduced Tiddler.prototype.isReadOnly() function (in TW 2.0.6). Thanks to Paulo Soares for reporting the problem.
* v1.0.2 (2006-02-05)
** Also allow other macros than the "tiddler" macro use the "." in the part reference (to refer to "this" tiddler)
* v1.0.1 (2006-01-27)
** Added Table of Content for plugin documentation. Thanks to RichCarrillo for suggesting.
** Bugfix: newReminder plugin does not work when PartTiddler is installed. Thanks to PauloSoares for reporting.
* v1.0.0 (2006-01-25)
** initial version
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>

!Code<html><a name="Code"/></html>
<html><sub><a href="javascript:;" onclick="window.scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>
***/
//{{{
//============================================================================
//                           PartTiddlerPlugin

// Ensure that the PartTiddler Plugin is only installed once.
//
if (!version.extensions.PartTiddlerPlugin) {



version.extensions.PartTiddlerPlugin = {
    major: 1, minor: 0, revision: 10,
    date: new Date(2011, 4, 23), 
    type: 'plugin',
    source: "http://tiddlywiki.abego-software.de/#PartTiddlerPlugin"
};

if (!window.abego) window.abego = {};
if (version.major < 2) alertAndThrow("PartTiddlerPlugin requires TiddlyWiki 2.0 or newer.");

//============================================================================
// Common Helpers

// Looks for the next newline, starting at the index-th char of text. 
//
// If there are only whitespaces between index and the newline 
// the index behind the newline is returned, 
// otherwise (or when no newline is found) index is returned.
//
var skipEmptyEndOfLine = function(text, index) {
	var re = /(\n|[^\s])/g;
	re.lastIndex = index;
	var result = re.exec(text);
	return (result && text.charAt(result.index) == '\n') 
			? result.index+1
			: index;
}


//============================================================================
// Constants

var partEndOrStartTagRE = /(<\/part>)|(<part(?:\s+)((?:[^>])+)>)/mg;
var partEndTagREString = "<\\/part>";
var partEndTagString = "</part>";

//============================================================================
// Plugin Specific Helpers

// Parse the parameters inside a <part ...> tag and return the result.
//
// @return [may be null] {partName: ..., isHidden: ...}
//
var parseStartTagParams = function(paramText) {
	var params = paramText.readMacroParams();
	if (params.length == 0 || params[0].length == 0) return null;
	
	var name = params[0];
	var paramsIndex = 1;
	var hidden = false;
	if (paramsIndex < params.length) {
		hidden = params[paramsIndex] == "hidden";
		paramsIndex++;
	}
	
	return {
		partName: name, 
		isHidden: hidden
	};
}

// Returns the match to the next (end or start) part tag in the text, 
// starting the search at startIndex.
// 
// When no such tag is found null is returned, otherwise a "Match" is returned:
// [0]: full match
// [1]: matched "end" tag (or null when no end tag match)
// [2]: matched "start" tag (or null when no start tag match)
// [3]: content of start tag (or null if no start tag match)
//
var findNextPartEndOrStartTagMatch = function(text, startIndex) {
	var re = new RegExp(partEndOrStartTagRE);
	re.lastIndex = startIndex;
	var match = re.exec(text);
	return match;
}

//============================================================================
// Formatter

// Process the <part ...> ... </part> starting at (w.source, w.matchStart) for formatting.
//
// @return true if a complete part section (including the end tag) could be processed, false otherwise.
//
var handlePartSection = function(w) {
	var tagMatch = findNextPartEndOrStartTagMatch(w.source, w.matchStart);
	if (!tagMatch) return false;
	if (tagMatch.index != w.matchStart || !tagMatch[2]) return false;

	// Parse the start tag parameters
	var arguments = parseStartTagParams(tagMatch[3]);
	if (!arguments) return false;
	
	// Continue processing
	var startTagEndIndex = skipEmptyEndOfLine(w.source, tagMatch.index + tagMatch[0].length);
	var endMatch = findNextPartEndOrStartTagMatch(w.source, startTagEndIndex);
	if (endMatch && endMatch[1]) {
		if (!arguments.isHidden) {
			w.nextMatch = startTagEndIndex;
			w.subWikify(w.output,partEndTagREString);
		}
		w.nextMatch = skipEmptyEndOfLine(w.source, endMatch.index + endMatch[0].length);
		
		return true;
	}
	return false;
}

config.formatters.push( {
    name: "part",
    match: "<part\\s+[^>]+>",
	
	handler: function(w) {
		if (!handlePartSection(w)) {
			w.outputText(w.output,w.matchStart,w.matchStart+w.matchLength);
		}
	}
} )

//============================================================================
// Extend "fetchTiddler" functionality to also recognize "part"s of tiddlers 
// as tiddlers.

var currentParent = null; // used for the "." parent (e.g. in the "tiddler" macro)

// Return the match to the first <part ...> tag of the text that has the
// requrest partName.
//
// @return [may be null]
//
var findPartStartTagByName = function(text, partName) {
	var i = 0;
	
	while (true) {
		var tagMatch = findNextPartEndOrStartTagMatch(text, i);
		if (!tagMatch) return null;

		if (tagMatch[2]) {
			// Is start tag
	
			// Check the name
			var arguments = parseStartTagParams(tagMatch[3]);
			if (arguments && arguments.partName == partName) {
				return tagMatch;
			}
		}
		i = tagMatch.index+tagMatch[0].length;
	}
}

// Return the part "partName" of the given parentTiddler as a "readOnly" Tiddler 
// object, using fullName as the Tiddler's title. 
//
// All remaining properties of the new Tiddler (tags etc.) are inherited from 
// the parentTiddler.
// 
// @return [may be null]
//
var getPart = function(parentTiddler, partName, fullName) {
	var text = parentTiddler.text;
	var startTag = findPartStartTagByName(text, partName);
	if (!startTag) return null;
	
	var endIndexOfStartTag = skipEmptyEndOfLine(text, startTag.index+startTag[0].length);
	var indexOfEndTag = text.indexOf(partEndTagString, endIndexOfStartTag);

	if (indexOfEndTag >= 0) {
		var partTiddlerText = text.substring(endIndexOfStartTag,indexOfEndTag);
		var partTiddler = new Tiddler();
		partTiddler.set(
						fullName,
						partTiddlerText,
						parentTiddler.modifier,
						parentTiddler.modified,
						parentTiddler.tags,
						parentTiddler.created);
		partTiddler.abegoIsPartTiddler = true;
		return partTiddler;
	}
	
	return null;
}

// Hijack the store.fetchTiddler to recognize the "part" addresses.
//
var hijackFetchTiddler = function() {
	var oldFetchTiddler = store.fetchTiddler ;
	store.fetchTiddler = function(title) {
		var result = oldFetchTiddler.apply(this, arguments);
		if (!result && title) {
			var i = title.lastIndexOf('/');
			if (i > 0) {
				var parentName = title.substring(0, i);
				var partName = title.substring(i+1);
				var parent = (parentName == ".") 
						? store.resolveTiddler(currentParent)
						: oldFetchTiddler.apply(this, [parentName]);
				if (parent) {
					return getPart(parent, partName, parent.title+"/"+partName);
				}
			}
		}
		return result;	
	};
};

// for debugging the plugin is not loaded through the systemConfig mechanism but via a script tag. 
// At that point in the "store" is not yet defined. In that case hijackFetchTiddler through the restart function.
// Otherwise hijack now.
if (!store) {
	var oldRestartFunc = restart;
	window.restart = function() {
		hijackFetchTiddler();
		oldRestartFunc.apply(this,arguments);
	};
} else
	hijackFetchTiddler();




// The user must not edit a readOnly/partTiddler
//

config.commands.editTiddler.oldIsReadOnlyFunction = Tiddler.prototype.isReadOnly;

Tiddler.prototype.isReadOnly = function() {
	// Tiddler.isReadOnly was introduced with TW 2.0.6.
	// For older version we explicitly check the global readOnly flag
	if (config.commands.editTiddler.oldIsReadOnlyFunction) {
		if (config.commands.editTiddler.oldIsReadOnlyFunction.apply(this, arguments)) return true;
	} else {
		if (readOnly) return true;
	}

	return this.abegoIsPartTiddler;
}

config.commands.editTiddler.handler_PartTiddlerPlugin = config.commands.editTiddler.handler;

config.commands.editTiddler.handler = function(event,src,title)
{
	var t = store.getTiddler(title);
	// Edit the tiddler if it either is not a tiddler (but a shadowTiddler)
	// or the tiddler is not readOnly
	if(!t || !t.abegoIsPartTiddler)
		{
		return config.commands.editTiddler.handler_PartTiddlerPlugin(event,src,title);
		}
	return false;
}

// To allow the "./partName" syntax in macros we need to hijack 
// the invokeMacro to define the "currentParent" while it is running.
// 
var oldInvokeMacro = window.invokeMacro;
function myInvokeMacro(place,macro,params,wikifier,tiddler) {
	var oldCurrentParent = currentParent;
	if (tiddler) currentParent = tiddler;
	try {
		oldInvokeMacro.apply(this, arguments);
	} finally {
		currentParent = oldCurrentParent;
	}
}
window.invokeMacro = myInvokeMacro;

// To correctly support the "./partName" syntax while refreshing we need to hijack 
// the config.refreshers.tiddlers to define the "currentParent" while it is running.
// 
(function() {
	var oldTiddlerRefresher= config.refreshers.tiddler;
	config.refreshers.tiddler = function(e,changeList) {
		var oldCurrentParent = currentParent;
		try {
			currentParent = e.getAttribute("tiddler");
			return oldTiddlerRefresher.apply(this,arguments);
		} finally {
			currentParent = oldCurrentParent;
		}
	};
})();

// Support "./partName" syntax inside <<tabs ...>> macro
(function() {
	var extendRelativeNames = function(e, title) {
		var nodes = e.getElementsByTagName("a");
		for(var i=0; i<nodes.length; i++) {
			var node = nodes[i];
			var s = node.getAttribute("content");
			if (s && s.indexOf("./") == 0)
				node.setAttribute("content",title+s.substr(1));
		}
	};
	var oldHandler = config.macros.tabs.handler;
	config.macros.tabs.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
		var result = oldHandler.apply(this,arguments);
		if (tiddler)
			extendRelativeNames(place, tiddler.title);
		return result;
	};
})();

// Scroll the anchor anchorName in the viewer of the given tiddler visible.
// When no tiddler is defined use the tiddler of the target given event is used.
window.scrollAnchorVisible = function(anchorName, tiddler, evt) {
	var tiddlerElem = null;
	if (tiddler) {
		tiddlerElem = document.getElementById(story.idPrefix + tiddler);
	}
	if (!tiddlerElem && evt) {
		var target = resolveTarget(evt);
		tiddlerElem = story.findContainingTiddler(target);
	}
	if (!tiddlerElem) return;

	var children = tiddlerElem.getElementsByTagName("a");
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		var name = child.getAttribute("name");
		if (name == anchorName) {
			var y = findPosY(child);
			window.scrollTo(0,y);
			return;
		}
	}
}

} // of "install only once"
//}}}

/***
<html><sub><a href="javascript:;" onclick="scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>



<html><sub><a href="javascript:;" onclick="scrollAnchorVisible('Top',null, event)">[Top]</sub></a></html>
***/
/***

!!!Documentation
> see [[PasteUpPluginInfo]]
!!!Example/Test
<<<
{{{<<tiddler PasteUpPlugin##test style:"border:1px solid blue;color:black;background:white;" edit adjust x:115px y:18px w:190px h:75px>>}}}
<<tiddler PasteUpPlugin##test style:"border:1px solid blue;color:black;background:white;" edit adjust x:115px y:18px w:190px h:75px>>/%
!test
test this content
line 2
line 3
line 4
!end
%/
<<<
!!!Configuration
<<<
<<option chkPasteUpConfirmRemove>>confirmation avant de retirer une section de la page
{{{<<option chkPasteUpConfirmRemove>>}}}
<<option chkPasteUpBoundaryWarning>>avertissement lorsqu'un élément est déplacé / étendu hors de la page
{{{<<option chkPasteUpBoundaryWarning>>}}}
<<option chkPasteUpEditAll>>édition automatique pour les contenus (à moins de ''noedit'' spécifié)
{{{<<option chkPasteUpEditAll>>}}}

Also see:
*[[PasteUpConfig]] and related shadows:
**[[DefaultPage]], [[DefaultPart]], [[PasteUpStyleSheet]]
*[[EditSectionPlugin]] (optional, recommended) and related shadows:
**[[EditSectionTemplate]]
*[[PasteUpHelperPlugin]] (optional, recommended) and related shadows:
**[[PasteUpHelperTemplate]], [[PasteUpStyleList]], [[PasteUpFontList]], [[PasteUpImageList]]
<<<
!!!Revisions
<<<
2012.01.29 1.3.2 invoke autoSaveChanges() whenver tiddlers are modified.  Also, when moving a part, calls to displayMessage() to show current position now uses 'noLog' flag (see [[MessageLogPlugin]])
2012.01.08 1.3.1 re-factored clickAction()/dblClickAction() for easier customization and fallback handling when EditSectionPlugin is not installed
2011.12.27 1.3.0 in dragSave(), addPart() and removePart(), handle {{{[[partnames with spaces]]}}} when generating/matching embedded part syntax
2011.09.15 1.2.9 in dragSave(), fixed called to story.refreshTiddler(title...)
2011.09.06 1.2.8 in removePart(), added 'force' param (for use by PasteUpHelperPlugin)
2011.09.04 1.2.7 in dragSave(), support setting of non-default z-Index (default index is "1")
2011.09.03 1.2.6 in setCursor() and isStretch(), only resize if inside pasteup element (i.e, not within an overflow child element)
2011.08.05 1.2.5 in addPasteUpPart(), use "window.readOnly" for IE compatibility
2011.08.02 1.2.4 refactored click() handler and added clickAction(). Moved createMenu() and renderMenu() to [[PasteUpHelperPlugin]]
2011.08.02 1.2.3 in click(), check for existing popup and close it instead (i.e., 'toggle popup display')
2011.08.01 1.2.2 refactored form handling (see [[EditSectionPlugin]]) to support type-specific forms by [[PasteUpHelperPlugin]]
2011.07.23 1.2.1 added chkPasteUpNoMenuLink option and misc code cleanup
2011.07.23 1.2.0 Use edge/corner detect for resize.  Added popup menu.  Cleanup cursor handling.  Fix getMX/getMY for Safari/Webkit
2011.06.19 1.1.3 internal CSS shadow renamed to PasteUpPluginStyles
2011.06.13 1.1.2 in mousedown(), use removeAllPanels instead of Popup.remove
2011.06.10 1.1.1 in dragsave(), skip 'outofbounds' check if message text is blank
2011.06.08 1.1.0 added removePart() handler
2011.06.05 1.0.14 added TiddlySpace cloneFields() to save handlers so editing content automatically copies/owns an included tiddler
2011.05.17 1.0.13 in dragsave(), don't check for out of bounds if container is a pasteUp part itself
2011.05.05 1.0.12 in dragsave(), added custom undo messages (requires UndoPlugin)
2011.05.01 1.0.11 in dragsave(), added "out of bounds" confirmation
2011.02.23 1.0.10 mousetracking: in capture(), invoke release() first (fix for Chrome 'sticky drag' problem?)
2011.02.08 1.0.9 when saving new tiddlers, use config.defaultCustomFields for TiddlySpace compatibility
2011.01.30 1.0.8 in addPart(), retain existing tags when adding part to current tiddler
2011.01.12 1.0.7 in handler(), make sure tiddler element was actually rendered
| Please see [[PasteUpPluginInfo]] for previous revision details |
2010.07.21 0.7.5 alpha prototype (for review - do not distribute)
<<<
!!!Code
***/
// // PLUGIN VERSION
//{{{
version.extensions.PasteUpPlugin= {major: 1, minor: 3, revision: 2, date: new Date(2012,1,29)};
//}}}
// // OPTIONS
//{{{
if (config.options.chkPasteUpEditAll===undefined)		config.options.chkPasteUpEditAll=false;
if (config.options.chkPasteUpConfirmRemove===undefined)		config.options.chkPasteUpConfirmRemove=true;
if (config.options.chkPasteUpBoundaryWarning===undefined)	config.options.chkPasteUpBoundaryWarning=false;

//}}}
// // MACRO DEFINITION
//{{{
config.macros.pasteUp = {
	editMenuTxt:	'modifier section...',
	editMenuTip:	'Modifier le contenu de la section',
	removeMenuTxt:	'retirer le saction...',
	removeMenuTip:	'Retirer cette section de la page courante',
	outofboundsmsg: 'Elément hors de la zone visible.  OK pour valider.',
	confirmremovemsg: 'Confirmez-vous la suppression de la section "%0" de la page "%1"?',
	edgeDetect:	10,	// PIXELS FOR CORNER/BORDER DETECT
	quiet:		false,	// TRUE = SHOW POS/SIZE DURING DRAG
	debug:		false,	// TRUE = SHOW POS/SIZE AFTER DRAG
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var cmp=config.macros.pasteUp; // abbrev

		// UNPACK PARAMS
		var edit=params.contains('edit')||macroName=='pasteUp'||config.options.chkPasteUpEditAll;
		var noedit=params.contains('noedit');
		var adjust=params.contains('adjust')||macroName=='pasteUp';
		var noadjust=params.contains('noadjust');
		var nopopup=params.contains('nopopup');
		var p=paramString.parseParams('name',null,true,false,true);
		var style=getParam(p,'style');
		var CSSclass=getParam(p,'class');
		var x=getParam(p,'x');
		var y=getParam(p,'y');
		var z=getParam(p,'z');
		var w=getParam(p,'w');
		var h=getParam(p,'h');

		// FIXUP for '##section' references (use current tiddler, if any)
		var sep='##'; var parts=params[0].split(sep);
		var tid=parts[0]; var sec=parts[1];
		var pasteupParams=paramString; // save unmodified params
		if (!tid && sec) {
			var here=story.findContainingTiddler(place)
			var tid=here?here.getAttribute('tiddler'):tiddler?tiddler.title:'';
			arguments[2][0]=tid+sep+sec;
			arguments[4]=paramString.replace(new RegExp(sep+sec),tid+sep+sec);
		}

		// RENDER CONTENT (CORE HANDLER) and GET RESULTING OBJECTS
		cmp.core_handler.apply(config.macros.tiddler,arguments);
		var e=place.lastChild; // rendered tiddler element
		if (!e || !e.getAttribute) return; // element not rendered!
		var t=e.getAttribute('tiddler'); // source title
		if (!t) return; // not a tiddler element!
		var s=e.style; // CSS styles
		e.setAttribute('tid',t); // needed by EditSectionPlugin

		// SET optional CUSTOM CLASS, STYLES, and/or DIRECT POS/SIZE
		if (CSSclass) addClass(e,CSSclass);
		if (style) {
			var parts=style.split(';');
			for (var i=0; i<parts.length; i++) {
				var name=(parts[i].split(':')[0]||'').trim();
				var val =(parts[i].split(':')[1]||'').trim();
				if (name.length && val.length) jQuery(e).css(name,val);
			}
		}
		s.left=x||s.left; s.top=y||s.top; s.zIndex=z||s.zIndex||1;
		s.width=w||s.width; s.height=h||s.height;

		// PASTEUP or NON-DEFAULT POSITION
		function def(e,a) { return (['auto','0px',''].contains(jQuery(e).css(a))); }
		if (macroName=='pasteUp' || !def(e,'left') || !def(e,'top')) {
			e.style.position='absolute'; // ALLOW ELEMENT TO BE POSITIONED
			if (e.parentNode.style.position!='absolute') // FIXUP PARENT FOR RELATIVE OFFSETS
				e.parentNode.style.position='relative';
		}

		// PASTEUP = ALLOW EDIT/ADJUST BY DEFAULT
		if (macroName=='pasteUp') { edit=true; adjust=true; }

		e.editable=edit&&!noedit;
		e.adjustable=adjust&&!noadjust;
		if (readOnly) return; // READONLY = DONE

		// TOOLTIP, CURSOR DEFAULT CONTENT, OUTLINE on hover, add PASTEUP CLASS
		if (e.editable||e.adjustable) {
			e.title=cmp.tooltip(e);				// TOOLTIP = source name
			e.style.cursor='pointer';			// DEFAULT CURSOR = pointer
			if (e.innerHTML=='') wikify('[['+t+']]',e);	// DEFAULT CONTENT = [[source]]
			e.onmouseover=cmp.mouseover;			// SHOW OUTLINE
			e.onmousemove=cmp.mousemove;			// SET CURSOR
			e.onmouseout =cmp.mouseout;			// HIDE OUTLINE
			addClass(e,'pasteUp');
		}

		// EDITABLE = CLICK/DOUBLE-CLICK
		e.helptext='';
		if (e.editable) {
			e.nopopup=nopopup||!config.macros.editSection;
			e.onclick    =cmp.click;
			e.ondblclick =cmp.dblclick;
			if (config.options.chkPasteUpHelper) // PasteUpHelperPlugin
				e.helptext+=', APPUI=menu, MAJ-APPUI=modifier';
			else // EditSectionPlugin (w/o helper) or standard tiddler editor
				e.helptext+=', APPUI=modifier';
		}

		// ADJUSTABLE = DRAG/SHIFT-DRAG
		if (e.adjustable) {
			e.pasteupParams=pasteupParams; // used in dragsave() to find matching macro
			e.onmousedown=cmp.mousedown;	// DRAG = MOVE/STRETCH
			e.helptext+=', GLISSER=déplacer, COIN BAS-DROIT ou MAJ-GLISSER=dimensionner';
		}
		e.title+=e.helptext;
	},
//}}}
// // GENERAL UTILITIES
//{{{
	tooltip: function(e) { // tooltip for embedded elements shows source name
		return e.getAttribute('tiddler'); // source title
	},
	getCSS: function(e,px,css) { // CONVERT element px values into CSS units
		var u=css.replace(/[0-9\.-]*/,''); if (u=='auto'||u=='') u='px'; // get CSS units
		var t=createTiddlyElement(e.parentNode,'div');
		t.style.width='1'+u;
		var r=Math.round(px/t.offsetWidth*10)/10; // round to one decimal place
		t.parentNode.removeChild(t);
		return r+u;
	},
	getMX: function(ev) { ev=ev||window.event; // GET MOUSE X
		if (config.browser.isIE)	return ev.clientX+findScrollX();// IE
		if (config.browser.isSafari) 	return ev.pageX+findScrollX(); 	// Webkit
		else				return ev.pageX;		// Firefox/other
	},
	getMY: function(ev) { ev=ev||window.event; // GET MOUSE Y
		if (config.browser.isIE)	return ev.clientY+findScrollY();// IE
		if (config.browser.isSafari) 	return ev.pageY+findScrollY();	// Webkit
		else				return ev.pageY;		// Firefox/other
	},
	ok: function(ev) { ev=ev||window.event; // HANDLE EVENT
		ev.cancelBubble=true; if(ev.stopPropagation) ev.stopPropagation(); return false;
	},
	getTrack: function(here) { // GET DRAG ELEMENT
		var track=here; // if 'capture' not supported, track in element only
		if (document.body.setCapture) var track=document.body; // IE
		if (window.captureEvents) var track=window; // moz
		return track;
	},
	capture: function () { // CAPTURE MOUSE
		this.release(); // make sure we aren't already tracking
		if (document.body.setCapture) document.body.setCapture(); // IE
		if (window.captureEvents) window.captureEvents(Event.MouseMove|Event.MouseUp,true); // moz
	},
	release: function () { // RELEASE MOUSE
		if (document.body.releaseCapture) document.body.releaseCapture(); // IE
		if (window.releaseEvents) window.releaseEvents(Event.MouseMove|Event.MouseUp); // moz
	},
	setCursor: function(here,ev) { ev=ev||window.event; // SET CURSOR FOR ELEMENT
		var x=this.getMX(ev); var y=this.getMY(ev);
		var left=findPosX(here); var top=findPosY(here);
		var width=here.offsetWidth; var height=here.offsetHeight; var size=this.edgeDetect;
		var isB=(top+height-y>0 && top+height-y<size);
		var isR=(left+width-x>0 && left+width-x<size);
		var c=((isB&&isR)||ev.shiftKey)?'se-resize':isB?'s-resize':isR?'e-resize':'pointer';
		here.style.cursor=c;
	},
	isStretch: function(here,ev) { ev=ev||window.event; // LOWER-RIGHT CORNER FOR STRETCH
		var x=this.getMX(ev); var y=this.getMY(ev);
		var left=findPosX(here); var top=findPosY(here);
		var width=here.offsetWidth; var height=here.offsetHeight; var size=this.edgeDetect;
		var isB=(top+height-y>0 && top+height-y<size);
		var isR=(left+width-x>0 && left+width-x<size);
		return isB||isR||ev.shiftKey;
	},
//}}}
// // MOUSE HANDLERS (click/dblclick,mouseover/mousemove/mouseout)
//{{{
	click: function(ev) { ev=ev||window.event;
		var cmp=config.macros.pasteUp; // abbrev
		cmp.release(); // stop tracking mousemove
		if (Popup.stack.length) { Popup.remove(); return cmp.ok(ev); } // close popup (if any)
		if (!this.changed) cmp.clickAction(this,ev); // ignore click if after move/stretch
		this.changed=false;
		return cmp.ok(ev);
	},
	clickAction: function(here,ev) { // EDIT IN POPUP (use EditSectionPlugin)
		if (here.nopopup || ev.shiftKey) 
			config.macros.pasteUp.dblClickAction(here,ev); // FALLBACK TO NORMAL EDIT
		else
			config.macros.editSection.click.call(here,ev,'all');
	},
	dblclick: function(ev) { ev=ev||window.event;
		var cmp=config.macros.pasteUp; // abbrev
		cmp.dblClickAction(this,ev);
		return cmp.ok(ev);
	},
	dblClickAction: function(here,ev) { // EDIT IN TIDDLER (normal edit)
		var t=here.getAttribute('tiddler').split('##')[0];
		story.displayTiddler(story.findContainingTiddler(this),t,DEFAULT_EDIT_TEMPLATE);
	},
	mouseover: function(ev) { ev=ev||window.event; // SHOW OUTLINE
		addClass(this,'pasteUpBorder');
		return config.macros.pasteUp.ok(ev);
	},
	mousemove: function(ev) { ev=ev||window.event; // SET CURSOR
		config.macros.pasteUp.setCursor(this,ev);
		return true; // NOTE: ALLOW EVENT TO BUBBLE
	},
	mouseout: function(ev) { ev=ev||window.event; // HIDE OUTLINE
		removeClass(this,'pasteUpBorder');
		return config.macros.pasteUp.ok(ev);
	},
//}}}
// // MOUSE DRAG HANDLERS (down,move,up,keyup)
//{{{
	mousedown: function(ev) { ev=ev||window.event; // MOVE/STRETCH
		var cmp=config.macros.pasteUp; // abbrev

		// if popup is showing, close popup and ignore click 
		if (jQuery('.editSectionPanel').length)
			{ config.macros.editSection.removeAllPanels(); return cmp.ok(ev); }

		// ADD DRAG HANDLERS
		var track=cmp.getTrack(this);
		if (!track.save_onmousemove) track.save_onmousemove=track.onmousemove;
		if (!track.save_onkeyup)     track.save_onkeyup    =track.onkeyup;
		if (!track.save_onmouseup)   track.save_onmouseup  =track.onmouseup;
		track.onmousemove=cmp.dragmove;
		track.onkeyup  =cmp.dragkeyup;
		track.onmouseup=cmp.dragup;

		if (this.parentNode.style.position!='absolute') // fixup parent so OFFSETS ARE RELATIVE
			this.parentNode.style.position='relative';

		// INITIAL STATE
		this.changed=false;		// set true when moved/stretched
		track.elem=this;		// tiddler element
		track.stretch=cmp.isStretch(this,ev);
		track.start={
			X: cmp.getMX(ev),	// mouse position
			Y: cmp.getMY(ev),
			T: this.offsetTop,	// element position/size (pixels)
			L: this.offsetLeft,
			W: jQuery(this).width(),
			H: jQuery(this).height(),
			css: {			// original element css values
				T: this.style.top,
				L: this.style.left,
				W: this.style.width,
				H: this.style.height
			}
		}
		return cmp.ok(ev);
	},
	dragmove: function(ev) { ev=ev||window.event; // DRAG: MOVE/STRETCH
		var cmp=config.macros.pasteUp; // abbrev
		cmp.capture(); // capture mouse events during drag
		var e=this.elem; var s=e.style;
		var dX=cmp.getMX(ev)-this.start.X;
		var dY=cmp.getMY(ev)-this.start.Y;
		e.changed=e.changed||(Math.abs(dX)>1)||(Math.abs(dY)>1); // MINIMUM 2px MOVEMENT
		if (!e.changed) return cmp.ok(ev);
		e.style.position='absolute'; // ensure element is MOVEABLE
		if (this.stretch||ev.shiftKey) { // resize
			s.width =cmp.getCSS(e,this.start.W+dX,this.start.css.W);
			s.height=cmp.getCSS(e,this.start.H+dY,this.start.css.H);
		} else { // move
			s.top =cmp.getCSS(e,this.start.T+dY,this.start.css.T);
			s.left=cmp.getCSS(e,this.start.L+dX,this.start.css.L);
		}
		if (!cmp.quiet) {
			var a='auto';
			var msg='[[%0]] x:%1 y:%2 w:%3 h:%4'.format(
				[e.getAttribute('tiddler'),s.left||a,s.top||a,s.width||a,s.height||a]);
			clearMessage(); displayMessage(msg,null,true);
		}
		return cmp.ok(ev);
	},
	dragkeyup: function(ev) { ev=ev||window.event; // DRAG: CANCEL (ESC key)
		var cmp=config.macros.pasteUp; // abbrev
		cmp.setCursor(this.elem,ev);
		if (ev.keyCode==27) {
			cmp.dragcancel(this.elem);
			return this.onmouseup(ev);
		}
		return cmp.ok(ev);
	},
	dragup: function(ev) { ev=ev||window.event; // DRAG: END
		var cmp=config.macros.pasteUp; // abbrev
		cmp.release(); // stop tracking mouse
		this.onmousemove=this.save_onmousemove;
		this.onkeyup    =this.save_onkeyup;
		this.onmouseup  =this.save_onmouseup;
		clearMessage();
		var e=this.elem; var s=e.style;
		cmp.setCursor(e,ev);
		if (e.changed) cmp.dragsave(e,s.left,s.top,s.width,s.height,s.zIndex);
		return cmp.ok(ev);
	},
	dragcancel: function(elem) {
		var orig=config.macros.pasteUp.getTrack(elem).start.css;
		elem.style.top   =orig.T;
		elem.style.left  =orig.L;
		elem.style.width =orig.W;
		elem.style.height=orig.H;
		elem.changed     =false;
		displayMessage('move/size cancelled',null,true);
		cmp.setCursor(e,ev);
	},
//}}}
// // DRAGSAVE -  Update embedded {{{<<pasteUp>>}}} or {{{<<tiddler>>}}} macro
//{{{
	cloneFields: function(fields) { // for TIDDLYSPACE compatibility
		var f=merge({},fields); // copy object
		if (f["server.workspace"]!=config.defaultCustomFields["server.workspace"]) {
			f=merge(f,config.defaultCustomFields); // overwrite with defaults
			f["server.permissions"] = "read, write, create, delete";
			delete f["server.page.revision"];
			delete f["server.title"];
			delete f["server.etag"];
		}
		return f;
	},
	dragsave: function(elem,left,top,width,height,zIndex) {
		var cmp=config.macros.pasteUp; // abbrev

		// FIND CONTAINER (the tiddler/section that transcludes this one)
		var c=elem.parentNode;
		while(c && c.getAttribute('tiddler')==undefined) c=c.parentNode;
		if (!c) return;
		var target=c.getAttribute('tiddler');	
		var txt=store.getTiddlerText(target,'');
		var parts=target.split('##');
		var title=parts[0];
		var section=parts[1];

		// CHECK FOR 'OUT OF BOUNDS'
		if (!hasClass(c,'pasteUp') && cmp.outofboundsmsg.length && config.options.chkPasteUpBoundaryWarning) {
			var w=jQuery(c).width(); var h=jQuery(c).height();
			var l=jQuery(elem).position().left; var r=l+jQuery(elem).width();
			var t=jQuery(elem).position().top;  var b=t+jQuery(elem).height();
			if (l<0 || t<0 || r>w || b>h) if (!confirm(cmp.outofboundsmsg)) {
				cmp.dragcancel(elem); elem.changed=true; // ignore following click
				return;
			}
		}
	
		// FIND <<pasteUp>> or <<tiddler>> MACRO and UPDATE PARAMS
		if (cmp.debug) displayMessage('updating '+target);
		var a='auto'; var fmt=' x:%0 y:%1 w:%2 h:%3';
		if (zIndex!==undefined && zIndex!=1) fmt=' x:%0 y:%1 z:%4 w:%2 h:%3';
		var newparams=fmt.format([left||a,top||a,width||a,height||a,zIndex]);
		var newtxt=''; var pos=0; var t=elem.pasteupParams.escapeRegExp();
		var re=new RegExp('<<(pasteUp|tiddler)\\s+'+t+'>>','mg');
		var matches=re.exec(txt);
		if (!matches) { // NO MATCH = POSSIBLE TIDDLER NAME FIXUP (i.e, '##section')
			var here=story.findContainingTiddler(elem);
			var tid=here?here.getAttribute('tiddler'):'';
			var t=elem.pasteupParams.escapeRegExp().replace(new Regexp(tid),''); // REMOVE FIXUP TIDDLER NAME
			var re=new RegExp('<<(pasteUp|tiddler)\\s+'+t+'>>','mg'); // TRY AGAIN
			var matches=re.exec(txt);
		}
		while (matches) { var m=matches[0];
			newtxt+=txt.substr(pos,re.lastIndex-m.length-pos); // before match
			var parts=m.substr(0,m.length-2).split(' with: ');
			parts[0]=parts[0].replace(/\s+[xyzwh]\:[^\s>]*/g,''); // remove old x,y,z,w,h params
			parts[1]=parts[1]?' with: '+parts[1]+'>>':'>>';
			m=parts[0]+newparams+parts[1];
			if (cmp.debug) displayMessage(m);
			newtxt+=m; pos=re.lastIndex; matches=re.exec(txt);
		}
		newtxt+=txt.substr(pos,txt.length); // remainder 

		// SAVE TIDDLER
		var t=store.getTiddler(title); if (!t) {
			t=new Tiddler();
			t.text=store.getTiddlerText(title,'');
			t.fields=config.defaultCustomFields;
		}
		if (section) { // revise section text
			var oldval=store.getTiddlerText(target).escapeRegExp();
			var pattern=new RegExp('(.*!{1,6}'+section+'\\n)'+oldval+'((?:\\n!{1,6}|$).*)');
			newtxt=t.text.replace(pattern,'$1'+newtxt+'$2');
		}
		var who=config.options.txtUserName; var when=new Date();
		if (config.options.chkForceMinorUpdate) { who=t.modifier||who; when=t.modified||when; }
		store.saveTiddler(title,title,newtxt,who,when,t.tags,cmp.cloneFields(t.fields));
		if (config.macros.undo) {
			var partname=elem.pasteupParams.readBracketedList()[0];
			config.macros.undo.setmsg('move/resize '+partname);
		}
		story.refreshTiddler(title,null,true);
		autoSaveChanges();
},
//}}}
// // ADDPART - Add an embedded {{{<<pasteUp>>}}} part to a tiddler
//{{{
	addPart: function(tid,partname) {
		var cmp=config.macros.pasteUp; // abbrev
		// GET PART TiddlerTitle OR TiddlerTitle##sectionname
		var title=partname.split('##')[0]||tid;
		var section=partname.split('##')[1];
		var part=title+(section?'##'+section:'');
		// GET CONTAINING TIDDLER
		var t=store.getTiddler(tid); if (!t) {
			t=new Tiddler();
			t.text=store.getTiddlerText(tid,'');
			t.fields=config.defaultCustomFields;
		}
		// APPEND PART PASTEUP
		var y=store.getTiddlerText('PasteUpConfig::PartTop',   '0px');
		var x=store.getTiddlerText('PasteUpConfig::PartLeft',  '0px');
		var w=store.getTiddlerText('PasteUpConfig::PartWidth', 'auto');
		var h=store.getTiddlerText('PasteUpConfig::PartHeight','auto');
		var fmt='%0<<pasteUp [[%1]] x:%2 y:%3 w:%4 h:%5>>';
		var txt=t.text+fmt.format([t.text.length?'\n':'',part,x,y,w,h]);
		// SAVE CONTAINER
		var who=config.options.txtUserName; var when=new Date();
		if (config.options.chkForceMinorUpdate)
			{ who=t.modifier||who; when=t.modified||when; }
		store.saveTiddler(tid,tid,txt,who,when,t.tags,cmp.cloneFields(t.fields));
		if (config.macros.undo) config.macros.undo.setmsg('remove '+part+' from '+tid);
		story.refreshTiddler(tid,null,true);
		// CREATE PART IF NEEDED
		if (!store.getTiddlerText(part)) {
			var t=store.getTiddler(title); if(!t) {
				t=new Tiddler();
				t.text=store.getTiddlerText(title,'');
				t.fields=config.defaultCustomFields;
			}
			var txt=store.getTiddlerText('DefaultPart',part).replace(/DefaultPart/g,part);
			if (section) txt='{{hidden{\n!'+section+'\n'+txt+'\n!end '+section+'\n}}}';
			if (!section) t.tags.pushUnique('part');
			store.saveTiddler(title,title,t.text+txt,who,when,t.tags,cmp.cloneFields(t.fields));
			story.refreshTiddler(title,null,true);
			displayMessage('created new part: '+part);
		}
		displayMessage(part+' added to '+tid);
		autoSaveChanges();
		return false;
	},
	removePart: function(elem,force) {
		var cmp=config.macros.pasteUp; // abbrev
		// FIND CONTAINER (the tiddler/section that transcludes this one)
		var c=elem.parentNode;
		while(c && c.getAttribute('tiddler')==undefined) c=c.parentNode;
		if (!c) return false; // NOTHING REMOVED
		var target=c.getAttribute('tiddler');	
		var txt=store.getTiddlerText(target,'');
		var parts=target.split('##');
		var title=parts[0];
		var section=parts[1];

		// ASK FOR CONFIRMATION (if not FORCE)
		var msg=cmp.confirmremovemsg.format([elem.getAttribute('tid'),target]);
		if (!force && config.options.chkPasteUpConfirmRemove && !confirm(msg)) return false;

		// FIND <<pasteUp>> or <<tiddler>> MACRO 
		if (cmp.debug) displayMessage('updating '+target);
		var newtxt=''; var pos=0; var t=elem.pasteupParams.escapeRegExp();
		var re=new RegExp('<<(pasteUp|tiddler)\\s+'+t+'>>','mg');
		var matches=re.exec(txt);
		if (!matches) { // NO MATCH = POSSIBLE TIDDLER NAME FIXUP (i.e, '##section')
			var here=story.findContainingTiddler(elem);
			var tid=here?here.getAttribute('tiddler'):'';
			var t=elem.pasteupParams.escapeRegExp().replace(new Regexp(tid),''); // REMOVE FIXUP TIDDLER NAME
			var re=new RegExp('<<(pasteUp|tiddler)\\s+'+t+'>>','mg'); // TRY AGAIN
			var matches=re.exec(txt);
		}

		// REMOVE MACROS
		while (matches) { var m=matches[0];
			newtxt+=txt.substr(pos,re.lastIndex-m.length-pos); // before match
			if (cmp.debug) displayMessage('removing '+m);
			pos=re.lastIndex; matches=re.exec(txt);
		}
		newtxt+=txt.substr(pos,txt.length); // remainder 

		// SAVE TIDDLER
		var t=store.getTiddler(title); if (!t) return;
		if (section) { // revise section text
			var oldval=store.getTiddlerText(target).escapeRegExp();
			var pattern=new RegExp('(.*!{1,6}'+section+'\\n)'+oldval+'((?:\\n!{1,6}|$).*)');
			newtxt=t.text.replace(pattern,'$1'+newtxt+'$2');
		}
		var who=config.options.txtUserName; var when=new Date();
		if (config.options.chkForceMinorUpdate)
			{ who=t.modifier||who; when=t.modified||when; }
		store.saveTiddler(title,title,newtxt,who,when,t.tags,cmp.cloneFields(t.fields));
		if (config.macros.undo) {
			var partname=elem.pasteupParams.readBracketedList()[0];
			config.macros.undo.setmsg('restore part '+partname+' in '+title);
		}
		story.refreshTiddler(title,null,true);
		displayMessage(partname+' removed from '+title);
		autoSaveChanges();
		return true; // PART REMOVED SUCCESSFULLY
	}
}
//}}}
// // HIJACK {{{<<tiddler>>}}} handler
//{{{
config.macros.pasteUp.core_handler=config.macros.tiddler.handler;
config.macros.tiddler.handler=config.macros.pasteUp.handler;
//}}}
// // MACRO: addPasteUpPart
//{{{
config.macros.addPasteUpPart = {
	label: 'add part',
	prompt: 'add a part to this page',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if (window.readOnly) return;
		var label=params[0]||this.label;
		var prompt=params[1]||this.prompt;
		createTiddlyButton(place,label,prompt,this.click);
	},
	click: function(ev) {
		var tid=story.findContainingTiddler(this).getAttribute('tiddler');
		var partname=prompt('Please enter a part name:','NewPart');
		if (partname) config.macros.pasteUp.addPart(tid,partname);
		return config.macros.pasteUp.ok(ev);
	}
};
//}}}
// // TOOLBAR COMMAND: addPasteUpPart
//{{{
config.commands.addPasteUpPart = {
	text: 'ajouter une section',
	hideReadOnly: true,
	tooltip: 'ajoute une section à la page',
	handler: function(ev,src,title) {
		return config.macros.addPasteUpPart.click(ev);
	}
};
//}}}
// // DELIVER INTERNAL PLUGIN STYLES TO PasteUpPluginStyles SHADOW
//{{{
var tid='PasteUpPluginStyles';
config.shadowTiddlers[tid]='/*{{{*/\n'+store.getTiddlerText(tiddler.title+'##css','')+'\n/*}}}*/';;
config.annotations[tid]='Définitions CSS internes au greffon.  Ne pas modifier sans connaissances préalables!';
store.addNotification(tid,refreshStyles);
//}}}
/***
{{{
!css
.hidden
	{ display:none; }
.pasteUp
	{ border:1px solid transparent; z-index:1; }
.pasteUpBorder
	{ border:1px dotted black !important; }
div[tags~="pasteup"].tiddler div.viewer,
div[tags~="part"].tiddler div.viewer,
div[tiddler="DefaultPage"] div.viewer,
div[tiddler="DefaultPageHeader"] div.viewer,
div[tiddler="DefaultPageFooter"] div.viewer,
div[tiddler="DefaultPart"] div.viewer {
	width:[[PasteUpConfig::Width]];
	height:[[PasteUpConfig::Height]];
	padding:0em;
	border:1px solid;
}
!end
}}}
***/
// // REFRESH DISPLAY WHEN PasteUpConfig IS CHANGED (applies user settings)
//{{{
store.addNotification('PasteUpConfig', function(title){ refreshAll(); });
//}}}
// // DELIVER SHADOW CONTENT FOR DefaultPage (for use with {{{<<newTiddler>>}}})
//{{{
config.shadowTiddlers['DefaultPage']=store.getTiddlerText(tiddler.title+'##defaultpage','');
config.annotations['DefaultPage']='This content is used to create new pasteup pages';
//}}}
/***
{{{
!defaultpage
<<pasteUp [[DefaultPageHeader]] x:0px y:0%  w:100% h:10%>>
<<pasteUp [[DefaultPageFooter]] x:0px y:90% w:100% h:10%>>
!end
}}}
***/
// // DELIVER SHADOW CONTENT FOR DefaultPart (used by addPasteUpPart)
//{{{
config.shadowTiddlers['DefaultPart']=store.getTiddlerText(tiddler.title+'##defaultpart','');
config.annotations['DefaultPart']='Contenu utilisé pour créer de nouvelles sections sur la page';
//}}}
/***
{{{
!defaultpart
Ceci est "DefaultPart"
Appuyer pour modifier.
!end
}}}
***/
 
/***

This plugin adds a custom 'shift-click' or mouseover handler to all tiddler links (or images with tiddler links) to display a popup with a fully-formatted preview of the linked tiddler's content.
!!!!!Usage
<<<
SHIFT-click to display a popup containing the fully-formatted content of the linked tiddler, in a fixed size, scrolling area.  Click anywhere to dismiss the popup.  Clicking on the link will open the tiddler in the normal manner.  If the linked tiddler contains a section named "preview", the popup displays that section content rather than the entire tiddler.  You can hide the "preview" section by enclosing it within comment markers ({{{/%...%/}}}) or a CSS wrapper ({{{@@display:none;...@@}}} or <html><nowiki><code>{{hidden{...}}}</code></html>) so that you can display alternative "summary" content in the popup preview while still showing the entire content when viewing the tiddler directly.
<<<
!!!!!Configuration
<<<
<<option chkPopupPreviews>> enable popup previews (shift-click)
{{{usage: <<option chkPopupPreviews>>}}}
<<option chkPopupPreviewMouseover>> show previews on mouseover (no click needed)
{{{usage: <<option chkPopupPreviewMouseover>>}}}
width of popup: <<option txtPopupPreviewWidth>> height of popup: <<option txtPopupPreviewHeight>>
//(width and height may be specified using any valid CSS units, e.g., "px", "em", "in", "cm", "%")//
{{{usage: <<option txtPopupPreviewWidth>> <<option txtPopupPreviewHeight>>}}}
preview section name: <<option txtPopupPreviewSection>>
{{{usage: <<option txtPopupPreviewSection>>}}}
<<<
!!!!!Preview
<<<
The contents of this section are displayed when SHIFT-clicking on a link to [[PopupPreviewPlugin]].  This section can be hidden using comment markers or a CSS wrapper so that alternative, "summary" content can be displayed in the popup.
<<<
!!!!!Revisions
<<<
2012.05.23 1.2.0 added chkPopupPreviewSection (for showing summary content in popup)
2011.09.22 1.1.1 fixed default setting for chkPopupPreviewMouseover
2009.09.22 1.1.0 added chkPopupPreviewMouseover option
2007.11.19 1.0.0 fixed handling for imageLinks ('tiddlylink' attrib is on the *parentNode* of target image element)
2007.11.10 0.5.0 alpha development - use with care
<<<
!!!!!Code
***/
//{{{
version.extensions.PopupPreviewPlugin= {major: 1, minor: 2, revision: 0, date: new Date(2012,5,23)};

var co=config.options; // abbrev
if (co.chkPopupPreviews===undefined) co.chkPopupPreviews=true;
if (co.txtPopupPreviewWidth==undefined) co.txtPopupPreviewWidth="50%";
if (co.txtPopupPreviewHeight==undefined) co.txtPopupPreviewHeight="10em";
if (co.chkPopupPreviewMouseover===undefined) co.chkPopupPreviewMouseover=false;
if (co.txtPopupPreviewSection===undefined) co.txtPopupPreviewSection="Preview";


if (window.popupPreview_createTiddlyLink===undefined) { // only once
window.popupPreview_createTiddlyLink=window.createTiddlyLink;
window.createTiddlyLink=function()
{
	var btn=this.popupPreview_createTiddlyLink.apply(this,arguments);
	var handler=config.options.chkPopupPreviewMouseover?'onmouseover':'onclick';
	btn.savedHandler=btn[handler];
	btn[handler]=function(e) {
		var co=config.options; // abbrev
		if (!e) var e=window.event; var theTarget=resolveTarget(e);
		if (!e.shiftKey&&!co.chkPopupPreviewMouseover || !co.chkPopupPreviews) 
			return this.savedHandler?this.savedHandler.apply(this,arguments):false;
		else { // show tiddler preview if enabled and SHIFT is pressed
			var tid=theTarget.getAttribute("tiddlylink");
			if (!tid) tid=theTarget.parentNode.getAttribute("tiddlylink"); // for "imageLink"
			var text=store.getTiddlerText(tid+"##"+co.txtPopupPreviewSection,store.getTiddlerText(tid));
			if (text && text.length) {
				var popup = Popup.create(this,null,"sticky popup");
				popup.style.width=co.txtPopupPreviewWidth;
				popup.style.padding=".5em";
				var msg="%0 %1".format([tid,config.views.wikified.shadowModifier]);
				var tiddler=store.getTiddler(tid); if (tiddler) msg=tiddler.getSubtitle();
				wikify("@@display:block;font-size:80%;line-height:110%;"+msg+"@@",popup);
				var div=createTiddlyElement(popup,"DIV",null,"popupPreview viewer");
				div.style.overflow="auto"; 
				div.style.whiteSpace="normal";
				div.style[config.browser.isIE?'height':'maxHeight']=co.txtPopupPreviewHeight;
				wikify(text,div);
				Popup.show('bottom','left');
			}
			e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); return false;
		}
	}
	return btn;
}
}
//}}}
[[des cycles de la vampirique]]
<script label="impression" title="ouvre tous les titres du document pour impression">var tids=store.getTiddler("FuniculaireDuLivre").links; 
  if (!tids || !tids.length) return;
   story.closeAllTiddlers();
   story.displayTiddlers(null,tids);
   window.print();
</script>

This package provides a toolbar of interactive 'power tools' that you can use while editing a tiddler to quickly insert TiddlyWiki tiddler links, images, macros, etc. or common formatting sequences directly into tiddler content, as well as perform other functions (such as find/replace, sort, split, convert, etc.) that can be used to modify the current tiddler's source content in a variety of ways.

<<tiddler QuickEditToolbar with: show>>
!!!!!Installation:
<<<
Individual ~QuickEdit buttons are defined in separate tiddlers (e.g., [[QuickEdit_replace]]) that have also been //transcluded// into a single toolbar definition named [[QuickEditToolbar]].  You can edit this definition to add, remove, or rearrange the toolbar buttons to best suit your needs, and then embed the [[QuickEditToolbar]] tiddler into your document's [[EditTemplate]], like this:
{{{
<div macro='tiddler QuickEditToolbar'></div>
}}}
Next, in order to support some of the formatting 'shortcuts' provided by the toolbar, add a reference to the shortcuts CSS class definitions in your [[StyleSheet]]:
{{{
[[StyleSheetShortcuts]]
}}}
By default, the QuickEdit toolbar is hidden until you enable it by using the ''toggleQuickEdit'' command, which you can add to the ~EditToolbar definition in [[ToolbarCommands]]:
{{{
|EditToolbar|... toggleQuickEdit ...|
}}}
You can also toggle the ~QuickEdit toolbar display via a single checkbox option that can be added to [[SideBarOptions]] (or any other desired location):
{{{
<<option chkShowQuickEdit>> show QuickEdit toolbar
}}}
Note: You can 'hard-code' the ''chkShowQuickEdit'' setting, so that the toolbar will be //initially// displayed, by creating a tiddler (e.g., ConfigTweaks), tagged with <<tag systemConfig>>, containing:
{{{
config.options.chkShowQuickEdit=true;
}}}
Alternatively, if you want the toolbar to //always// be displayed, regardless of the option setting, you can add a special keyword, ''show'', to the [[EditTemplate]] syntax, like this:
{{{
<div macro='tiddler QuickEditToolbar with: show'></div>
}}}
<<<
/***

!!!!!Revisions
<<<
2009.06.11 [2.4.3] added keyup() function to abbreviate listbox handling for CR and ESC
2009.05.07 [2.4.2] added processed() function to abbreviate event handler code
2008.09.07 [2.4.1] added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.17 [2.4.0] copied code from StickyPopupPlugin to remove dependency
2008.05.12 [2.3.0] added "toggleQuickEdit" command handler (replaces inline script command)
2008.01.11 [2.2.0] converted from inline script
2007.03.29 [1.0.0] initial release (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.QuickEditPlugin= {major: 2, minor: 4, revision: 3, date: new Date(2009,6,11)};

// SET STYLESHEET
setStylesheet("\
.quickEdit a { border:2px outset ButtonFace; padding:0px 3px !important; \
	-moz-border-radius:.5em; -webkit-border-radius:.5em; \
	-moz-appearance:button !important; -webkit-appearance:push-button !important; \
	background-color:ButtonFace; color:ButtonText !important;  \
	line-height:200%; font-weight:normal; } \
.quickEdit a:hover { border: 2px inset ButtonFace; background-color:ButtonFace; }\
", "quickEditStyles");

// REMOVE COOKIE
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

// UTILITY FUNCTIONS
config.quickEdit = {
	processed: function(ev) { ev=ev||window.event;
		ev.cancelBubble=true;
		if(ev.stopPropagation) ev.stopPropagation();
		return false;
	},
	keyup: function(ev){ var k=(ev||window.event).keyCode;
		if (k==13) this.onclick();
		if (k==27) Popup.remove();
	},
	getField: function(where) {
		var here=story.findContainingTiddler(where); if (!here) return null;
		var e=story.getTiddlerField(here.getAttribute("tiddler"),"text");
		if (e&&e.getAttribute("edit")=="text") return e;
		return null;
	},
	setSelection: function(where,newtext) {
		var e=this.getField(where); if (!e) return false;
		e.focus(); replaceSelection(e,newtext);
		return false;
	},
	wrapSelection: function(where,before,after) {
		var e=this.getField(where); if (!e) return false;
		e.focus(); replaceSelection(e,before+config.quickEdit.getSelection(e)+after);
		return false;
	},
	getSelection: function(e) {
		var seltext="";
		if (e&&e.setSelectionRange)
			seltext=e.value.substr(e.selectionStart,e.selectionEnd-e.selectionStart);
		else if (document.selection) {
			var range = document.selection.createRange();
			if (range.parentElement()==e) seltext=range.text
		}
		return seltext;
	},
	promptForFilename: function(msg,path,file) {
		if(window.Components) { // moz
			try {
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
				var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
				var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
				picker.init(window, msg, nsIFilePicker.modeOpen);
				var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
				thispath.initWithPath(path);
				picker.displayDirectory=thispath;
				picker.defaultExtension='jpg';
				picker.defaultString=file;
				picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterImages);
				if (picker.show()!=nsIFilePicker.returnCancel)
					var result="file:///"+picker.file.persistentDescriptor.replace(/\\/g,'/');
			}
			catch(e) { alert('error during local file access: '+e.toString()) }
		}
		else { // IE
			try { // XP only
				var s = new ActiveXObject('UserAccounts.CommonDialog');
				s.Filter='All files|*.*|JPG files|*.jpg|GIF files|*.gif|PNG files|*.png|';
				s.FilterIndex=1; // default to JPG
				s.InitialDir=path;
				s.FileName=file;
				if (s.showOpen()) var result=s.FileName;
			}
			catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
		}
		return result;
	}
}
//}}}

//{{{
if (config.options.chkShowQuickEdit===undefined) config.options.chkShowQuickEdit=false;
config.commands.toggleQuickEdit = {
	hideReadOnly: true,
	getText: function() { return config.options.chkShowQuickEdit?'\u221Aquickedit':'quickedit'; },

	tooltip: 'show QuickEdit toolbar buttons',
	handler: function(event,src,title) {
		var opt='chkShowQuickEdit';
		config.options[opt]=!config.options[opt];
		config.macros.option.propagateOption(opt,"checked", config.options[opt],"input");
		if (config.options[opt]) saveOptionCookie(opt);	else removeCookie(opt);
		src.innerHTML=config.commands.toggleQuickEdit.getText();
		story.forEachTiddler(function(t,e){if (story.isDirty(t)) refreshElements(e);});
		return false;
	}
};
//}}}

// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
	// if click is in a sticky popup, ignore it so popup will remain visible
	var e = ev ? ev : window.event; var target = resolveTarget(e);
	var p=target; while (p) {
		if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
		else p=p.parentNode;
	}
	if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
		Popup.onDocumentClick(ev);
	return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/%


Usage:
* install [[QuickEditPlugin]] (runtime support functions)

* add the toolbar to [[EditTemplate]]:
	<div macro='tiddler QuickEditToolbar with: show'></div>

* 'show' (optional) forces the toolbar to always be displayed or,
  omit keyword and use <<option chkShowQuickEdit>> setting

* selected QuickEdit buttons can also be added individually to the
  regular tiddler toolbar by adding references directly in [[EditTemplate]]:
	<span class='toolbar' macro='tiddler QuickEdit_...'></span>

* see [[QuickEditPackage]] for additional installation options

%/{{hidden fine center quickEdit{
<<tiddler {{ // show/hide toolbar
	var here=story.findContainingTiddler(place); if (here) var tid=here.getAttribute('tiddler');
	var show='$1'!='$'+'1'||config.options.chkShowQuickEdit||tid=='QuickEditToolbar'; 
	place.style.display=show?'block':'none';
'';}}>>/%

TOOLBAR DEFINITION - add, remove, or re-order items as desired:
= = = = = = = = = =
%/<<tiddler QuickEdit_replace>>/%
%/<<tiddler QuickEdit_split>>/%
%/<<tiddler QuickEdit_sort>>/%
%/<<tiddler QuickEdit_convert>>/%
%/ &nbsp;/% (SPACER)
%/<<tiddler QuickEdit_link>>/%
%/<<tiddler QuickEdit_insert>>/%
%/<<tiddler QuickEdit_macro>>/%
%/<<tiddler QuickEdit_image>>/%
%/ &nbsp;/% (SPACER)
%/<<tiddler QuickEdit_format>>/%
%/<<tiddler QuickEdit_align>>/%
%/<<tiddler QuickEdit_color>>/%
%/<<tiddler QuickEdit_font>>/%
%/ &nbsp;/% (SPACER)
%/<<tiddler QuickEdit_custom>>/%
%/}}}
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="aligner un texte"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('choisir un alignement...','');
	s.options[s.length]=new Option('gauche','left');
	s.options[s.length-1].title='{{left{...}}}';
	s.options[s.length]=new Option('centre','center');
	s.options[s.length-1].title='{{center{...}}}';
	s.options[s.length]=new Option('droite','right');
	s.options[s.length-1].title='{{right{...}}}';
	s.options[s.length]=new Option('justifié','justify');
	s.options[s.length-1].title='{{justify{...}}}';
	s.options[s.length]=new Option('flottant gauche','floatleft');
	s.options[s.length-1].title='{{floatleft{...}}}';
	s.options[s.length]=new Option('flottant droite','floatright');
	s.options[s.length-1].title='{{floatright{...}}}';
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
		config.quickEdit.wrapSelection(this.button,'{{'+this.value+'{','}}}');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>aligner</a></html>
/%
Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="texte/couleur de fond - @@color:#RGB;background-color:#RGB;...@@"
onclick="var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
 	p.style.padding='2px';
	function hex(d) { return '0123456789ABCDEF'.substr(d,1); }
	var fg=createTiddlyElement(p,'select'); fg.button=this;
	fg.style.width='12em';
	fg.options[0]=new Option('couleur de texte...','');
	fg.options[1]=new Option('\xa0 ou entrer une valeur','_ask');
	fg.options[2]=new Option('\xa0 ou couleur par défaut','');
	for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
		var label=hex(r)+hex(g)+hex(b);
		fg.options[fg.length]=new Option(label,'#'+label);
		fg.options[fg.length-1].style.color='#'+label;
	}
	fg.onchange=function(){ var val=this.value;
		if (val=='_ask') { val=prompt('Entrer un code couleur css');
		if (!val||!val.length) return false; }
		this.options[0].value=val; this.options[0].text=val.length?'text: '+val:'couleur de texte...';
		var bg=this.nextSibling;
		for (var i=3;i<bg.options.length;i++) bg.options[i].style.color=val;
		var preview=this.nextSibling.nextSibling.nextSibling;
		var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
		if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
		var fg=this.value; if (fg.length) fg='color:'+fg+';';
		var bg=this.nextSibling.value; if (bg.length) bg='background-color:'+bg+';';
		if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
		removeChildren(preview); wikify(t,preview);
		this.selectedIndex=0; return false;
	};
	var bg=createTiddlyElement(p,'select'); bg.button=this;
	bg.style.width='12em';
	bg.options[0]=new Option('couleur de fond...','');
	bg.options[1]=new Option('\xa0 ou entrer une valeur','_ask');
	bg.options[2]=new Option('\xa0 ou couleur par défaut','');
	for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
		var label=hex(15-r)+hex(15-g)+hex(15-b);
		bg.options[bg.length]=new Option(label,'#'+label);
		bg.options[bg.length-1].style.backgroundColor='#'+label;
	}
	bg.onchange=function(){ var val=this.value;
		if (val=='_ask') { val=prompt('Entrer un code couleur css');
		if (!val||!val.length) return false; }
		this.options[0].value=val;
		this.options[0].text=val.length?'background: '+val:'background color...';
		var fg=this.previousSibling;
		for (var i=3;i<fg.options.length;i++) fg.options[i].style.backgroundColor=val;
		var preview=this.nextSibling.nextSibling;
		var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
		if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
		var fg=this.previousSibling.value; if (fg.length) fg='color:'+fg+';';
		var bg=this.value; if (bg.length) bg='background-color:'+bg+';';
		if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
		removeChildren(preview); wikify(t,preview);
		this.selectedIndex=0; return false;
	};
	var b=createTiddlyElement(p,'input',null,null,null,{type:'button'}); b.button=this;
	b.value='ok'; b.style.width='4em';
	b.onclick=function() {
		var fg=this.previousSibling.previousSibling.value; if (fg.length) fg='color:'+fg+';';
		var bg=this.previousSibling.value; if (bg.length) bg='background-color:'+bg+';';
		var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
		if (fg.length||bg.length) config.quickEdit.setSelection(this.button,'@@'+fg+bg+t+'@@');
		Popup.remove(); return false;
	};
	var preview=createTiddlyElement(p,'div',null,'viewer'); var s=preview.style;
	s.border='1px solid'; s.margin='2px'; s.width='24em'; s.padding='3px'; s.MozBorderRadius='3px';
	s.overflow='hidden'; s.textAlign='center'; s.whiteSpace='normal';
	var t=config.quickEdit.getSelection(config.quickEdit.getField(this));
	wikify(t.length?t:'~AaBbCcDdEeFfGgHhIiJj 1234567890',preview);
	Popup.show();
	event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>couleur</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="convert between comma/tab-separated and TW table format"
onclick="var e=config.quickEdit.getField(this);
	if (e) e.focus(); var txt=config.quickEdit.getSelection(e);
	if (txt.indexOf(',')+txt.indexOf('\t')+txt.indexOf('|')==-3) {
		alert('Please select text containing tabs, commas, or TiddlyWiki table syntax.');
		return false;
	}
	var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select a converter...','');
	if (txt.indexOf(',')!=-1) {
		s.options[s.length]=new Option('commas -> table','commasToTable');
		s.options[s.length]=new Option('commas -> tabs','commasToTabs');
	}
	if (txt.indexOf('\t')!=-1) {
		s.options[s.length]=new Option('tabs -> table','tabsToTable');
		s.options[s.length]=new Option('tabs -> commas','tabsToCommas');
	}
	if (txt.indexOf('|')!=-1) {
		s.options[s.length]=new Option('table -> tabs','tableToTabs');
		s.options[s.length]=new Option('table -> commas','tableToCommas');
	}
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
	        var e=config.quickEdit.getField(this.button); if (!e) return false;
		e.focus(); var txt=config.quickEdit.getSelection(e);
		switch(this.value) {
			case 'tabsToTable':
				txt=txt.replace(/\t/g,'|').replace(/^|$/g,'|');
				txt=txt.replace(/\n/g,'|\n|').replace(/^\|$/g,'');
				break;
			case 'tableToTabs':
				txt=txt.replace(/\t/g,' ').replace(/\|/g,'\t');
				txt=txt.replace(/^\t/g,'').replace(/\t$/g,'');
				txt=txt.replace(/\n\t/g,'\n').replace(/\t\n/g,'\n');
				break;
			case 'commasToTable':
				txt=txt.replace(/,/g,'|').replace(/^|$/g,'|');
				txt=txt.replace(/\n/g,'|\n|').replace(/^\|$/g,''); 
				break;
			case 'tableToCommas':
				txt=txt.replace(/,/g,' ').replace(/\|/g,',');
				txt=txt.replace(/^,/g,'').replace(/,$/g,''); 
				txt=txt.replace(/\n,/g,'\n').replace(/,\n/g,'\n'); 
				break;
			case 'tabsToCommas':
				txt=txt.replace(/\t/g,',');
				break;
			case 'commasToTabs':
				txt=txt.replace(/,/g,'\t');
				break;
		}
		replaceSelection(e,txt);
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>convert</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

!help
Rappels :

Les formats sont écrits dans [[QuickEdit_customList]], où la première ligne de chaque liste est le titre de liste de choix, suivie par une ou plusieurs lignes de contenu "wiki" à insérer dans le papier cible.

Dans //liste déroulante//, l'on peut placer par exemple, en place d'un simple contenu, la commande {{{
<<tiddler [[papier##paragraphe]]>>
}}}

Des jalons de subtitution peuvent être utilisés pour insérer des valeurs dynamiquement dans le format de sortie: $1 insère le texte sélectionné du papier de l'éditeur. $[[message|valeur par défaut]] invite à insérer une valeur. $[[message|$1]] utilise le texte sélectionné comme valeur par défaut. $[[message|{{javascript}}]] calcule la valeur par défaut en utilisant du code javascript.
!end help

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" title="formats prédéfinis"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('choisir un format...','');
	var items=store.getTiddlerText('QuickEdit_customList','').split('\n----\n');
	for (var i=0; i<items.length; i++) {
		if (!items[i].length) continue; var lines=items[i].split('\n');
		var label=lines.shift(); var val=lines.join('\n');
		s.options[s.length]=new Option(label,val); s.options[s.length-1].title=val;
	}
	s.options[s.length]=new Option('[Editer un format...]','_edit');
	s.options[s.length-1].title='ajouter ou changer des définitions de format...';
	s.size=Math.min(s.length,15);
	s.onclick=function(){ if (!this.value.length) return;
		if (this.value=='_edit') {
			alert(store.getTiddlerText('QuickEdit_custom##help'));
			story.displayTiddler(story.findContainingTiddler(this.button),
				'QuickEdit_customList',DEFAULT_EDIT_TEMPLATE);
		} else {
		        var e=config.quickEdit.getField(this.button); if (!e) return false;
			e.focus(); var txt=config.quickEdit.getSelection(e);
			replaceSelection(e, this.value.replace(/\$\x31/g,txt)
				.replace(/\$\[\[[^\]]+\]\]/g, function(t){
					x=t.substr(3,t.length-5).split('|');
					var msg=x[0]; var def=x[1]||'';
					if (def.startsWith('{{')) {
						try{def=eval(def.substr(2,def.length-4))} catch(ex){showException(ex)}
					}
					return prompt(msg,def)||'';
				})
			);
		}
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>format</a></html>
Révélation 1
<<slider "" [[papier]] [[papier]] [[papier]]>>
----
Révélation 2
+++[bouton]<<tiddler [[papier]]>>===
----
Révélation 3
+++<<tiddler [[papier##chapitre]]>>===
----
Note de bas
```Note```
----
Image légendée
<<icap '[img[légende|chemin/image.png]]'>>
----
Image
[img(100%,auto)[chemin/image.png]]
----
Date
$[[entrer une date|{{new Date().formatString('DDD MM MMM YYYY à hh:0mm')}}]]
----
Bloc 10x20
@@display:block;height:10em;width:20em;overflow:auto;background-image:url(k/fond4.gif);background-repeat: repeat;padding:5px;$[[entrer le contenu|$1]]@@
----
Grand rouge
@@font-size:36pt;color:red;$[[entrer le texte|$1]]@@
----
Blocs en ordre avec liste
/%+245 en x et remplacer noadjust par adjust pour changer manuellement le classement.%/
<<tiddler [[xx1]] style:"overflow:
scroll; border:1px solid black; background:#ffe; color:blue; padding:
1em;" noadjust edit z:auto x:0px y:100px w:4in h:2in>>
<<tiddler [[xx2]] style:"overflow:
scroll; border:1px solid black; background:#ffe; color:blue; padding:
1em;" noadjust edit z:auto x:0px y:345px w:4in h:2in>>
----
Blocs déplaçables
/%
!g1
[img(100%,)[001.jpg]]
!g2
[img(100%,)[002.jpg]]
!
%/
<<tiddler xx##g1 "" adjust noedit x:346px y:237px w:100px h:autopx>>
<<tiddler xx##g2 "" adjust noedit x:-2px y:9px w:100px h:auto>>
----
Etiquettes alpha
d-bleu p1 m1 a22
----
Bouton étiquette
<<tag p1>>
----
Nuage
<<cloud +IdStat>>
----
Rapport sur étiquettes
<<matchTags {{'<<tiddlerIcons "=%0">\> [[%0]]'}} "\n"so AND NOT (x OR journal)>>
----
Table étiquettes
<<tagGrid 'p2 p3''d-bleu d-rouge'"filter:[tag[*]]"open FFFFFF 000000>>
----
Invocation par étiquettes bool et limite
<<list filter "[tag[* AND NOT (infra OR systemConfig OR transclusion OR excludeLists)]][sort[-modified]][limit[6]]">>
----
Agenda
<<reminder day:d month:m year:yyyy recurdays:30 title:"//voici le rappel des __bleus__//" hidden>>
/%
offsetdayofweek:CHIFFREDUJOURDELASEMAINE - 
Ex. : 
day:1 offsetdayofweek:4 pour le prochain premier jeudi du mois ; 
day:8 offsetdayofweek4 pour le prochain second jeudi du mois ; 
month:8 day:31 offsetdayofweek:-4 pour le dernier jeudi d'août.
recurdays:SEQUENCE - Ex. : year:2005 month:8 day:16 recurdays:2 pour invoquer un jour sur deux à partir du 16 août 2005 (16, 18, 20, etc.)
%/
----
Rapport agenda
<<showReminders tag:"d-bleu" leadtime:-7...+7>>
----
Synthèse onglets
<<tabs id onglet1 1 'papier1' onglet2 2 'papier2'>>
----
Table des matières
{{sectionTOC{}}}

<<sectionTOC>>
----
Tableau ordonnable
|sortable|k
|a|b|c<<autosort>>|h
|1|2|3|
|4|5|6|
----
Tableau calculé
||!a|
||2|
||4|
|moy|!<<columncalc avg 2 3>>|
|total|<<columncalc sum 2 3>>|
|nbre|<<columncalc count 2 3>>|
----
Tableau compartimenté
|!a|>|>|
|b|c|d|
|~|e|>|
----
Partie invocable dans le même papier
<part 01 hidden>
*Ceci
*Cela
</part>

|texte1|<<tiddler ./01>>|
----
Invocation d'une partie
<<tiddler [[Papier/ref]]>>
----
Lien d'une partie
[[Description|Papier/ref]]
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="établit un code css pour une famille de fonte - @@font-family:nom;...@@"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('choisir une famille de fonte...','');
	var fonts=store.getTiddlerText('QuickEdit_fontList','').split('\n');
	for (var i=0; i<fonts.length; i++) {
		if (!fonts[i].length) continue;
		s.options[s.length]=new Option(fonts[i],fonts[i]);
		s.options[s.length-1].style.fontFamily=fonts[i];
	}
	s.options[s.length]=new Option('[Editer la liste de fontes...]','_edit');
	s.options[s.length-1].title='entrer une fonte par ligne...';
	s.size=Math.min(s.length,15);
	s.onclick=function(){
		if (this.value=='_edit')
			story.displayTiddler(story.findContainingTiddler(this.button),'QuickEdit_fontList',DEFAULT_EDIT_TEMPLATE);			
		else
			config.quickEdit.wrapSelection(this.button,'@@font-family:\x22'+this.value+'\x22;','@@');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>fonte</a></html>
Arial
Times New Roman
Courier
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="plain text (remove ALL formatting)" accesskey="P" 
onclick="var e=config.quickEdit.getField(this); if (e) e.focus(); var txt=config.quickEdit.getSelection(e);
	config.quickEdit.setSelection(e,wikifyPlainText(txt)); return false;"
>&nbsp;~&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="''bold''" accesskey="B"
onclick="config.quickEdit.wrapSelection(this,'\x27\x27','\x27\x27'); return false;"
>&nbsp;B&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="//italics//" accesskey="I" 
onclick="config.quickEdit.wrapSelection(this,'//','//'); return false;"
>&nbsp;I&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="__underline__" accesskey="U" 
onclick="config.quickEdit.wrapSelection(this,'__','__'); return false;"
>&nbsp;U&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="--strikethrough--" accesskey="S" 
onclick="config.quickEdit.wrapSelection(this,'--','--'); return false;"
>&nbsp;S&nbsp;</a></html>/%

%/ &nbsp;/%  SPACER

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="format text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select text format...','');
	s.options[s.length]=new Option('CSS class wrapper','{{$1{,}}},Enter a CSS classname');
	s.options[s.length-1].title='CSS class wrapper - {{classname classname etc{...}}}';
	s.options[s.length]=new Option('inline CSS styles','@@$1,@@,Enter CSS (attribute:value;attribute:value;...;)');
	s.options[s.length-1].title='inline CSS styles - @@attr:value;attr:value;...@@';
	s.options[s.length]=new Option('heading 1','\n!,\n');
	s.options[s.length-1].title='H1 heading - !';
	s.options[s.length]=new Option('heading 2','\n!!,\n');
	s.options[s.length-1].title='H2 heading - !!';
	s.options[s.length]=new Option('heading 3','\n!!!,\n');
	s.options[s.length-1].title='H3 heading - !!!';
	s.options[s.length]=new Option('heading 4','\n!!!!,\n');
	s.options[s.length-1].title='H4 heading - !!!!';
	s.options[s.length]=new Option('heading 5','\n!!!!!,\n');
	s.options[s.length-1].title='H5 heading - !!!!!';
	s.options[s.length]=new Option('blockquote','\n\<\<\<\n,\n\<\<\<\n');
	s.options[s.length-1].title='indented blockquote - \<\<\<';
	s.options[s.length]=new Option('monospaced','{{{,}}}');
	s.options[s.length-1].title='inline monospaced text - {{{...}}}';
	s.options[s.length]=new Option('plain text','\n{{{\n,\n}}}\n');
	s.options[s.length-1].title='multi-line monospaced text box - {{{...}}}';
	s.options[s.length]=new Option('superscript','^^,^^');
	s.options[s.length-1].title='^^superscript^^';
	s.options[s.length]=new Option('subscript','~~,~~');
	s.options[s.length-1].title='~~subscript~~';
	s.options[s.length]=new Option('HTML','<html>,<\x2fhtml>');
	s.options[s.length-1].title='HTML syntax - <html>...<\x2fhtml>';
	s.options[s.length]=new Option('comment','/%,%/');
	s.options[s.length-1].title='comment (hidden content) - /%...%/';
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
		var parts=this.value.split(',');
		var prefix=parts[0]; var suffix=parts[1]; var ask=parts[2];
		if (ask) {
			var val=prompt(ask); if (!val) { Popup.remove(); return false; }
			prefix=prefix.replace(/\$1/g,val); suffix=suffix.replace(/\$1/g,val);
		}
		config.quickEdit.wrapSelection(this.button,prefix,suffix);
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>format</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
	title="inclure une image (jpg/gif/png) - [img[info|URL]] ou [img[info|chemin/image.ext]]"
	onclick="var fn=config.quickEdit.promptForFilename(
		'Entrer ou choisir un fichier',getLocalPath(document.location.href),'');
	if (!fn) return false;  /* cancelled by user */
	var h=document.location.href; var p=decodeURIComponent(h.substr(0,h.lastIndexOf('/')+1));
	if (fn.startsWith(p)) fn=fn.substr(p.length); /* use RELATIVE path/filename.ext */
	var tip=prompt('Enter a tooltip for this image',''); if (!tip) tip=''; else tip+='|';
	return config.quickEdit.setSelection(this,'[img['+tip+fn+']]');"
>image</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="insérer du contenu d'un autre codex ou fichier"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';

	var s2=createTiddlyElement(p,'select'); s2.title='filtrer par étiquette';
	s2.options[0]=new Option('filtrer par étiquette...','');
	s2.options[s2.length]=new Option('[tous papiers]','');
	var tags=store.getTags();
	for (var t=0; t<tags.length; t++) s2.options[s2.length]=new Option(tags[t][0],tags[t][0]);
	s2.onchange=function(){
		var tag=this.value;
		var tids=tag.length?store.reverseLookup('tags',tag,true):store.reverseLookup('tags','excludeLists');
		var list=this.nextSibling.nextSibling;
		while (list.length) list.options[0]=null;
		var prompt='choisir un papier ou fichier...';
		if (tag.length) prompt='choisir un papier étiqueté ['+tids.length+' matches]...';
		list.options[0]=new Option(prompt,'');
		if (!tag.length) list.options[list.length]=new Option('[chercher un fichier...]','_file');
		for (var t=0; t<tids.length; t++) {
			list.options[list.length]=new Option(tids[t].title,tids[t].title);
			list.options[list.length-1].title=tids[t].getSubtitle();
		}
		list.size=Math.min(list.length,10);
		list.selectedIndex=0; list.focus();
		this.style.width=list.offsetWidth+'px';
		if (!tag.length) this.selectedIndex=0;
	};
	createTiddlyElement(p,'br');

	var s=createTiddlyElement(p,'select'); s.button=this;
	s.title='choisir un papier ou fichier';
	s.options[0]=new Option('choisir un papier ou fichier...','');
	s.options[s.length]=new Option('[chercher un fichier...]','_file');
	var tids=store.reverseLookup('tags','excludeLists');
	for (var t=0; t<tids.length; t++) {
		s.options[s.length]=new Option(tids[t].title,tids[t].title);
		s.options[s.length-1].title=tids[t].getSubtitle();
	}
	s.size=Math.min(s.length,10);
	s.onclick=function(){ if (!this.value.length) return false;
		if (this.value=='_file') {
			var fn=config.quickEdit.promptForFilename(
				'Entrer ou choisir un fichier',getLocalPath(document.location.href),'');
			if (!fn) return false; /* cancelled by user */
			var txt=loadFile(getLocalPath(fn));
			if (!txt) { alert('Error: unable to read contents from \0027'+fn+'\0027'); return; }
		}
		else var txt=store.getTiddlerText(this.value);
		if (!txt) {
			displayMessage(this.value+' non trouvé');
			this.selectedIndex=0; this.focus();
			return false;
		}
		config.quickEdit.setSelection(this.button,txt);
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s2.style.width=s.offsetWidth+'px';
	s.focus();
	return config.quickEdit.processed(event);"
>insérer</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="ajouter un lien au papier - [[nom du lien|NomPapier]]"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';

	var s2=createTiddlyElement(p,'select'); s2.title='filtrer par étiquette';
	s2.options[0]=new Option('filtrer par étiquette...','');
	s2.options[s2.length]=new Option('[tous papiers]','');
	var tags=store.getTags();
	for (var t=0; t<tags.length; t++) s2.options[s2.length]=new Option(tags[t][0],tags[t][0]);
	s2.onchange=function(){
		var tag=this.value;
		var tids=tag.length?store.reverseLookup('tags',tag,true):store.reverseLookup('tags','excludeLists');
		var list=this.nextSibling.nextSibling;
		while (list.length) list.options[0]=null;
		var prompt='choisir un papier ou fichier...';
		if (tag.length) prompt='choisir un papier étiqueté ['+tids.length+' matches]...';
		list.options[0]=new Option(prompt,'');
		if (!tag.length) list.options[list.length]=new Option('[chercher un fichier...]','_file');
		for (var t=0; t<tids.length; t++) {
			list.options[list.length]=new Option(tids[t].title,tids[t].title);
			list.options[list.length-1].title=tids[t].getSubtitle();
		}
		list.size=Math.min(list.length,10);
		list.selectedIndex=0; list.focus();
		this.style.width=list.offsetWidth+'px';
		if (!tag.length) this.selectedIndex=0;
	};
	createTiddlyElement(p,'br');

	var s=createTiddlyElement(p,'select'); s.button=this;
	s.title='choisir un papier ou fichier';
	s.options[0]=new Option('choisir un papier ou fichier...','');
	s.options[s.length]=new Option('[chercher un fichier...]','_file');
	var tids=store.reverseLookup('tags','excludeLists');
	for (var t=0; t<tids.length; t++) {
		s.options[s.length]=new Option(tids[t].title,tids[t].title);
		s.options[s.length-1].title=tids[t].getSubtitle();
	}
	s.size=Math.min(s.length,10);
	s.onclick=function(){ if (!this.value.length) return false;
		var title=this.value; var txt=title;
		if (title=='_file') {
			title=config.quickEdit.promptForFilename('Select a file',
				getLocalPath(document.location.href),'');
			if (!title) { this.selectedIndex=0; this.focus(); return false; }
			var txt=title.substr(title.lastIndexOf('/')+1);
		}
		var txt=prompt('Enter the text to display for this link',txt);
		if (!txt) { this.selectedIndex=0; this.focus(); return false; }
		config.quickEdit.setSelection(this.button,'[['+txt+'|'+title+']]');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s2.style.width=s.offsetWidth+'px';
	s.focus();
	return config.quickEdit.processed(event);"
>lien</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

Note:
Optional 'guideText' can be used to add suggested defaults/placeholders for specific macro parameters.
Add guideText to your own plugin-defined macros using:
	config.macros.macroName.guideText='guide text goes here';

%/<<tiddler {{
	/* define guide text for a few common TW core macros */
	config.macros.edit.guideText='fieldname #rows';
	config.macros.view.guideText='fieldname (link,wikified,date) format';
	config.macros.slider.guideText='cookie TiddlerName label tooltip';
	config.macros.option.guideText='(txtCookieName,chkCookieName)';
	config.macros.tiddler.guideText='TiddlerName with: params...';
	''; /* must return blank to suppress output */ }}>>/%

%/<html><hide linebreaks><a href='javascript:;' class='tiddlyLink' tabindex='-1' 
title='add a macro - \<\<macroName ...\>\>'
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select a macro...','');
	var macros=[]; for (var m in config.macros) if (config.macros[m].handler) macros.push(m); macros.sort();
	for (var i=0; i<macros.length; i++) { var m=macros[i];
		var help=config.macros[m].guideText; if (!help) help=''; else help=' '+help;
		s.options[s.length]=new Option(m,m+help);
		s.options[s.length-1].title='\<\<'+m+help+'\>\>';
	}
	s.size=Math.min(s.length,15);
	s.onclick=function(){ if (!this.value.length) return;
		config.quickEdit.setSelection(this.button,'\<\<'+this.value+'\>\>');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>macro</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="trouver et remplacer un texte par un autre"
onclick="var here=story.findContainingTiddler(this); if (!here) return false;
	var e=config.quickEdit.getField(here);
	var s=config.quickEdit.getSelection(e); 
	var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
	var t=createTiddlyElement(p,'input'); t.onfocus=function(){this.select()};
	t.value=s.length?s:'entrer le texte cible';
	var r=createTiddlyElement(p,'input'); r.onfocus=function(){this.select()};
	r.value='entrer un texte de remplacement';
	var tid=here.getAttribute('tiddler');
	var b=createTiddlyElement(p,'button',null,null,'?',{tid:tid});
	b.style.width='2em';
	b.title='trouve le prochain texte cible';
	b.onclick=function(ev) { /* FIND */
		var e=story.getTiddlerField(this.getAttribute('tid'),'text');
		if (!e||e.getAttribute('edit')!='text') return;
		var t=this.previousSibling.previousSibling;
		var tv=t.value.replace(/\\t/mg,'\t').unescapeLineBreaks();
		e.focus();
		if (e.setSelectionRange) { /* MOZ */
			var newstart=e.value.indexOf(tv,e.selectionStart+1);
			if (newstart==-1) newstart=e.value.indexOf(tv); /* wrap around */
			if (newstart==-1) { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); return; }
			e.setSelectionRange(newstart,newstart+tv.length);
			var linecount=e.value.split('\n').length;
			var thisline=e.value.substr(0,e.selectionStart).split('\n').length;
			e.scrollTop=Math.floor((thisline-1-e.rows/2)*e.scrollHeight/linecount);
		} else if (document.selection) { /* IE */
			var range=document.selection.createRange();
			if(range.parentElement()==e) {
				range.collapse(false);
				var found=false; try{found=range.findText(v,e.value.length,4)}catch(e){}
				if (found) range.select();
				else { alert('\u0022'+t.value+'\u0022 non trouvé'); t.focus(); }
			}
		}
	};
	b=createTiddlyElement(p,'button',null,null,'=',{tid:tid});
	b.style.width='2em';
	b.title='remplace le texte sélectionné';
	b.onclick=function(ev) { /* REPLACE */
		var e=story.getTiddlerField(this.getAttribute('tid'),'text');
		if (!e||e.getAttribute('edit')!='text') return;
		var t=this.previousSibling.previousSibling.previousSibling;
		var r=this.previousSibling.previousSibling;
		var rv=r.value.replace(/\\t/mg,'\t').unescapeLineBreaks();
		if (   (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
		    || (document.selection && document.selection.createRange().text==''))
			this.previousSibling.click(); /* no selection... do FIND first */
		if (   (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
		    || (document.selection && document.selection.createRange().text==''))
			{ t.focus(); return; } /* still no selection... goto target input */
		e.focus(); replaceSelection(e,rv);
	};
	b=createTiddlyElement(p,'button',null,null,'+',{tid:tid});
	b.style.width='2em';
	b.title='remplace le texte sélectionné et trouve le prochain texte cible';
	b.onclick=function(ev) { /* REPLACE and FIND NEXT */
		this.previousSibling.click();
		this.previousSibling.previousSibling.click();
	};
	b=createTiddlyElement(p,'button',null,null,'!',{tid:tid});
	b.style.width='2em';
	b.title='remplace toutes les occurrences du texte cible';
	b.onclick=function(ev) { /* REPLACE ALL */
		var e=story.getTiddlerField(this.getAttribute('tid'),'text');
		if (!e||e.getAttribute('edit')!='text') return;
		var t=this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling;
		var r=this.previousSibling.previousSibling.previousSibling.previousSibling;
		var tv=t.value.replace(/\\t/mg,'\t').unescapeLineBreaks();
		var rv=r.value.replace(/\\t/mg,'\t').unescapeLineBreaks();
		if (!tv.length) { alert('Please enter the target text'); t.focus(); return; }
		var m='ceci remplacera toutes les occurrences de:\n\n'+tv+'\n\navec:\n\n'+rv+'\n\nConfirmation?';
		if (!confirm(m)) { r.focus(); r.select(); return; }
		e.value=e.value.replace(new RegExp(tv.escapeRegExp(),'gm'),rv);
		e.focus(); e.select(); Popup.remove();
	};
	Popup.show();
	if (!s.length) {t.focus();t.select()} else {r.focus();r.select()}
	event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>remplacer</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="trier des lignes de texte"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('choisir un ordre de tri...','');
	s.options[s.length]=new Option('ascendant','A');
	s.options[s.length-1].title='ascendant';
	s.options[s.length]=new Option('descendant','D');
	s.options[s.length-1].title='descendant';
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
		var e=config.quickEdit.getField(this.button); if (!e) return false;
		var lines=config.quickEdit.getSelection(e).split('\n').sort();
		if (this.value=='D') lines=lines.reverse();
		replaceSelection(e,lines.join('\n'));
		e.focus();
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>tri</a></html>
/%


Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

Based on ideas originally developed by YannPerrin
(http://yann.perrin.googlepages.com/twkd.html#easySlicer)

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="déplacer la sélection dans un nouveau papier et insérer un lien ou inclure un papier"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	p.style.whiteSpace='nowrap';
	var i=createTiddlyElement(p,'input');
	i.defaultValue='Entrer un nouveau titre de papier';
	i.onfocus=function(){this.select()};
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('choisir le type...','');
	s.options[0].title='choisir le type de partition';
	s.options[1]=new Option('lien','link');
	s.options[1].title='remplacer par [[NomPapier]]';
	s.options[2]=new Option('inclusion','embed');
	s.options[2].title='remplacer par \<\<tiddler TiddlerName\>\>';
	s.options[3]=new Option('vue','slider');
	s.options[3].title='remplacer par \<\<slider \u0022\u0022 [[NomPapier]] [[invite]] [[info]]\>\>';
	s.onchange=function(){
		if (s.previousSibling.value==s.previousSibling.defaultValue)
			{ alert('Titre de papier requis'); s.selectedIndex=0; s.previousSibling.focus(); return false; }
		var tid=s.previousSibling.value;
		if (store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid])))
			{ s.previousSibling.focus(); return false; }
		switch(s.value) {
			case 'link':
				var newtxt='[['+tid+']]';
				break;
			case 'embed':
				var newtxt='\<\<tiddler [['+tid+']]\>\>';
				break;
			case 'slider':
				var label=prompt('Entrer une invite de vue',tid);
				if (!label) { Popup.remove(); return false; }
				var tip=prompt('Entrer une info de vue',label);
				if (!tip) { Popup.remove(); return false; }
				var newtxt='\<\<slider \u0022\u0022 [['+tid+']] [['+label+']] [['+tip+']]\>\>';
				break;
		}
		var txt=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		store.saveTiddler(tid,tid,txt,config.options.txtUserName,new Date(),[],{});
		story.displayTiddler(story.findContainingTiddler(this.button),tid);
		config.quickEdit.setSelection(this.button,newtxt);
		Popup.remove(); return false;
	};
	Popup.show();
	event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>scinder</a></html>
/***


!!!!!Documentation
>see [[QuoteOfTheDayPluginInfo]]
!!!!!Revisions
<<<
2008.03.21 [1.4.1] in showNextItem(), corrected handling for random selection so that //initial// index value will randomized correctly instead of always showing first item, even when randomizing.  Thanks to Riccardo Gherardi for finding this.
| Please see [[QuoteOfTheDayPluginInfo]] for previous revision details |
2005.10.21 [1.0.0] Initial Release.  Based on a suggestion by M.Russula
<<<
!!!!!Code
***/
//{{{
version.extensions.QuoteOfTheDayPlugin= {major: 1, minor: 4, revision: 1, date: new Date(2008,3,21)};
config.macros.QOTD = {
	clickTooltip: "appuyer pour lancer au sort",
	timerTooltip: "compte à rebours avant lancement stoppé...  s'écarter pour reprendre",
	timerClickTooltip: "compte à rebours avant lancement stoppé...  appuyer pour lancer au sort ou s'écarter pour reprendre",
	handler:
	function(place,macroName,params) {
		var tid=params.shift(); // source tiddler containing HR-separated quotes
		var p=params.shift();
		var click=true; // allow click for next item
		var inline=false; // wrap in slider for animation effect
		var random=true; // pick an item at random (default for "quote of the day" usage)
		var folder=false; // use local filesystem folder list
		var cookie=""; // default to no cookie
		var next=0; // default to first item (or random item)
		while (p) {
			if (p.toLowerCase()=="noclick") var click=false;
			if (p.toLowerCase()=="inline") var inline=true;
			if (p.toLowerCase()=="norandom") var random=false;
			if (p.toLowerCase().substr(0,7)=="cookie:") var cookie=p.substr(8);
			if (!isNaN(p)) var delay=p;
			p=params.shift();
		}
		if ((click||delay) && !inline) {
			var panel = createTiddlyElement(null,"div",null,"sliderPanel");
			panel.style.display="none";
			place.appendChild(panel);
			var here=createTiddlyElement(panel,click?"a":"span",null,"QOTD");
		}
		else
			var here=createTiddlyElement(place,click?"a":"span",null,"QOTD");
		here.id=(new Date()).convertToYYYYMMDDHHMMSSMMM()+Math.random().toString(); // unique ID
		// get items from tiddler or file list
		var list=store.getTiddlerText(tid,"");
		if (!list||!list.length) { // not a tiddler... maybe an image directory?
			var list=this.getImageFileList(tid);
			if (!list.length) { // maybe relative path... fixup and try again
				var h=document.location.href;
				var p=getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf("/")+1)));
				var list=this.getImageFileList(p+tid);
			}
		}
		if (!list||!list.length) return false; // no contents... nothing to display!
		here.setAttribute("list",list);
		if (delay) here.setAttribute("delay",delay);
		here.setAttribute("random",random);
		here.setAttribute("cookie",cookie);
		if (click) {
			here.title=this.clickTooltip
			if (!inline) here.style.display="block";
			here.setAttribute("href","javascript:;");
			here.onclick=function(event)
				{ config.macros.QOTD.showNextItem(this); }
		}
		if (config.options["txtQOTD_"+cookie]!=undefined) next=parseInt(config.options["txtQOTD_"+cookie]);
		here.setAttribute("nextItem",next);
		config.macros.QOTD.showNextItem(here);
		if (delay) {
			here.title=click?this.timerClickTooltip:this.timerTooltip
			here.onmouseover=function(event)
				{ clearTimeout(this.ticker); };
			here.onmouseout=function(event)
				{ this.ticker=setTimeout("config.macros.QOTD.tick('"+this.id+"')",this.getAttribute("delay")); };
			here.ticker=setTimeout("config.macros.QOTD.tick('"+here.id+"')",delay);
		}
	},
	tick: function(id) {
		var here=document.getElementById(id); if (!here) return;
		config.macros.QOTD.showNextItem(here);
		here.ticker=setTimeout("config.macros.QOTD.tick('"+id+"')",here.getAttribute("delay"));
	},
	showNextItem:
	function (here) {
		// hide containing slider panel (if any)
		var p=here.parentNode;
		if (p.className=="sliderPanel") p.style.display = "none"
		// get a new quote
		var index=here.getAttribute("nextItem"); 
		var items=here.getAttribute("list").split("\n----\n");
		if (index<0||index>=items.length) index=0;
		if (here.getAttribute("random")=="true") index=Math.floor(Math.random()*items.length);
		var txt=items[index];
		// re-render quote display element, and advance index counter
		removeChildren(here); wikify(txt,here);
		index++; here.setAttribute("nextItem",index);
		var cookie=here.getAttribute("cookie");
		if (cookie.length) {
			config.options["txtQOTD_"+cookie]=index.toString();
			saveOptionCookie("txtQOTD_"+cookie);
		}
		// redisplay slider panel (if any)
		if (p.className=="sliderPanel") {
			if(anim && config.options.chkAnimate)
				anim.startAnimating(new Slider(p,true,false,"none"));
			else p.style.display="block";
		}
	},
	getImageFileList: function(cwd) { // returns HR-separated list of image files
		function isImage(fn) {
			var ext=fn.substr(fn.length-3,3).toLowerCase();
			return ext=="jpg"||ext=="gif"||ext=="png";
		}
		var files=[];
		if (config.browser.isIE) {
			cwd=cwd.replace(/\//g,"\\");
			// IE uses ActiveX to read filesystem info
			var fso = new ActiveXObject("Scripting.FileSystemObject");
			if(!fso.FolderExists(cwd)) return [];
			var dir=fso.GetFolder(cwd);
			for(var f=new Enumerator(dir.Files); !f.atEnd(); f.moveNext())
				if (isImage(f.item().path)) files.push("[img[%0]]".format(["file:///"+f.item().path.replace(/\\/g,"/")]));
		} else {
			// FireFox (mozilla) uses "components" to read filesystem info
			// get security access
			if(!window.Components) return;
			try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
			catch(e) { alert(e.description?e.description:e.toString()); return []; }
			// open/validate directory
			var file=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
			try { file.initWithPath(cwd); } catch(e) { return []; }
			if (!file.exists() || !file.isDirectory()) { return []; }
			var folder=file.directoryEntries;
			while (folder.hasMoreElements()) {
				var f=folder.getNext().QueryInterface(Components.interfaces.nsILocalFile);
				if (f instanceof Components.interfaces.nsILocalFile)
					if (isImage(f.path)) files.push("[img[%0]]".format(["file:///"+f.path.replace(/\\/g,"/")]));
			}
		}
		return files.join("\n----\n");
	}
}
//}}}
/***


adapted from: http://www.cs.utexas.edu/~joeraii/dragn/#Draggable
changes by ELS:
* hijack refreshTiddler() instead of overridding createTiddler()
* find title element by className instead of elementID
* set cursor style via code instead of stylesheet
* set tooltip help text
* set tiddler "position:relative" when starting drag event, restore saved value when drag ends
* update 2006.08.07: use getElementsByTagName("*") to find title element, even when it is 'buried' deep in tiddler DOM elements (due to custom template usage)
* update 2007.03.01: use apply() to invoke hijacked core function
* update 2008.01.13: only hijack core function once.  (allows for dynamic loading of plugin via bookmarklet)
* update 2008.10.19: added onclick popup menu with 'move to top' and 'move to bottom' commands
* update 2010.11.30: use story.getTiddler()
***/
//{{{

if (Story.prototype.rearrangeTiddlersHijack_refreshTiddler===undefined) {
Story.prototype.rearrangeTiddlersHijack_refreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template)
{
	this.rearrangeTiddlersHijack_refreshTiddler.apply(this,arguments);
	var theTiddler = this.getTiddler(title); if (!theTiddler) return;
	var theHandle;
	var children=theTiddler.getElementsByTagName("*");
	for (var i=0; i<children.length; i++) if (hasClass(children[i],"title")) { theHandle=children[i]; break; }
	if (!theHandle) return theTiddler;

	Drag.init(theHandle, theTiddler, 0, 0, null, null);
	theHandle.style.cursor="move";
	theHandle.title="glisser le titre pour le déplacer, appuyer dessus pour des options"
	theTiddler.onDrag = function(x,y,myElem) {
		if (this.style.position!="relative")
			{ this.savedstyle=this.style.position; this.style.position="relative"; }
		y = myElem.offsetTop;
		var next = myElem.nextSibling;
		var prev = myElem.previousSibling;
		if (next && y + myElem.offsetHeight > next.offsetTop + next.offsetHeight/2) { 
			myElem.parentNode.removeChild(myElem);
			next.parentNode.insertBefore(myElem, next.nextSibling);//elems[pos+1]);
			myElem.style["top"] = -next.offsetHeight/2+"px";
		}
		if (prev && y < prev.offsetTop + prev.offsetHeight/2) { 
			myElem.parentNode.removeChild(myElem);
			prev.parentNode.insertBefore(myElem, prev);
			myElem.style["top"] = prev.offsetHeight/2+"px";
		}
	};
	theTiddler.onDragEnd = function(x,y,myElem) {
		myElem.style["top"] = "0px";
		if (this.savedstyle!=undefined)
			this.style.position=this.savedstyle;
	};
	


	return theTiddler;
}
}

/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {
	obj:null,

	init:
	function(o, oRoot, minX, maxX, minY, maxY) {
		o.onmousedown = Drag.start;
		o.root = oRoot && oRoot != null ? oRoot : o ;
		if (isNaN(parseInt(o.root.style.left))) o.root.style.left="0px";
		if (isNaN(parseInt(o.root.style.top))) o.root.style.top="0px";
		o.minX = typeof minX != 'undefined' ? minX : null;
		o.minY = typeof minY != 'undefined' ? minY : null;
		o.maxX = typeof maxX != 'undefined' ? maxX : null;
		o.maxY = typeof maxY != 'undefined' ? maxY : null;
		o.root.onDragStart = new Function();
		o.root.onDragEnd = new Function();
		o.root.onDrag = new Function();
	},

	start:
	function(e) {
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.root.style.top);
		var x = parseInt(o.root.style.left);
		o.root.onDragStart(x, y, Drag.obj.root);
		o.lastMouseX = e.clientX;
		o.lastMouseY = e.clientY;
		if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
		if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
		if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
		if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
		document.onmousemove = Drag.drag;
		document.onmouseup = Drag.end;
		Drag.obj.root.style["z-index"] = "10";
		return false;
	},

	drag:
	function(e) {
		e = Drag.fixE(e);
		var o = Drag.obj;
		var ey = e.clientY;
		var ex = e.clientX;
		var y = parseInt(o.root.style.top);
		var x = parseInt(o.root.style.left);
		var nx, ny;
		if (o.minX != null) ex = Math.max(ex, o.minMouseX);
		if (o.maxX != null) ex = Math.min(ex, o.maxMouseX);
		if (o.minY != null) ey = Math.max(ey, o.minMouseY);
		if (o.maxY != null) ey = Math.min(ey, o.maxMouseY);
		nx = x + (ex - o.lastMouseX);
		ny = y + (ey - o.lastMouseY);
		Drag.obj.root.style["left"] = nx + "px";
		Drag.obj.root.style["top"] = ny + "px";
		Drag.obj.lastMouseX = ex;
		Drag.obj.lastMouseY = ey;
		Drag.obj.root.onDrag(nx, ny, Drag.obj.root);
		return false;
	},

	end:
	function() {
		document.onmousemove = null;
		document.onmouseup = null;
		Drag.obj.root.style["z-index"] = "0";
		Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style["left"]), parseInt(Drag.obj.root.style["top"]), Drag.obj.root);
		Drag.obj = null;
	},

	fixE:
	function(e) {
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};
//}}}
/%
!info

Usage
<<<
{{{
<<tiddler RefreshPageDisplay>>
<<tiddler RefreshPageDisplay with: label>>
}}}
<<<
Example
<<<
{{{<<tiddler RefreshPageDisplay with: "click me">>}}}
<<tiddler RefreshPageDisplay##show with: "click me">>
<<<
!end
!show
<html><nowiki><a href="javascript:;" title="Rafraîchir la page en appuyant ici"
onmouseover="
	this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
	+encodeURIComponent(encodeURIComponent(this.onclick))
	+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
	story.forEachTiddler(function(t,e){story.refreshTiddler(t,null,true)});
	refreshDisplay();
 	return false;"
>$1</a></html>
!end
%/<<tiddler {{var src='RefreshPageDisplay'; src+(tiddler&&tiddler.title==src?'##info':'##show')}}
	with: {{'$1'=='$'+'1'?'refresh page display':'$1'}}>>
/***

!!!!!Usage
<<<
Starting from a specified tiddler (default=current tiddler), {{{<<relatedTiddlers>>}}} recursively follows the internal links[] data to find all other tiddlers that are related to it by linking (e.g., {{{[[TiddlerName]]}}}) or used as macro parameter (e.g., {{{<<tiddler TiddlerName>>}}}).

The results can be displayed as a simple flat list of related tiddler titles, or as an indented tree diagram that shows the specific connections between the related tiddlers, and can be helpful for identifying clusters of interdependent tiddlers or simply generating an on-the-fly site map for quick discovery and navigation through complex or unfamiliar document content. 
//{{{
<<relatedTiddlers TiddlerName hideform "exclude list">>
//}}}
*''TiddlerName'' (optional)<br>specifies the starting tiddler (and hides the 'select a tiddler' form controls).  Use keyword ''here'' to specify the current tiddler.
*''hideform'' (optional)<br>when present, suppress display of 'select tiddler' droplist and buttons.
*''"exclude list"'' (optional)<br>space-separated list of tiddlers whose links should not be followed.  Use quotes or double-square brackets to ensure list is processed as a single parameter.
The plugin also defines two functions that can be called externally (from other plugins or scripts) to generate and retrieve either a list of links or a formatted "tree view":
>{{{var list=config.macros.relatedTiddlers.getList(start,exclude,callback);}}}
>{{{var tree=config.macros.relatedTiddlers.getTree(start,exclude,callback);}}}
where ''start'' and ''exclude'' are the same as the macro parameters described above, plus an optional reference to a callback function that allows you to generate an alternative list/tree, based on application-specific data (such tiddler references contained in tags or custom fields), rather than using the default "links" list, like this:
>{{block{
{{{
window.myCallback=function(tiddler) {
	var list=[];
	// ... fill the list based on the specified tiddler ...
	return list;
}
}}}
}}}
The function takes a tiddler object as input, and returns a list of tiddler titles that are //directly// linked (or otherwise related) to that specific tiddler.  {{{getList()}}} and {{{getTree()}}} then use this information to find all the //indirect// connections between tiddlers to produce the list or tree output.
<<<
!!!!!Configuration
<<<
<<option chkRelatedTiddlersShowList>> liste
<<option chkRelatedTiddlersShowTree>> arbre
<<option chkRelatedTiddlersZoom>> zoom
ne pas suivre les liens de ce papier: <<option txtRelatedTiddlersExclude>>
<<<
!!!!!Examples
<<<
{{smallform{<<relatedTiddlers>>}}}

Using getList()/getTree() public API from other scripts/plugins:
><script show>
	var start="About";
	var exclude=config.options.txtRelatedTiddlersExclude.readBracketedList();
	var callback=null;
	var list=config.macros.relatedTiddlers.getList(start,exclude,callback);
	var tree=config.macros.relatedTiddlers.getTree(start,exclude,callback);
	return "There are "+list.length+" tiddlers related to [["+start+"]]...\n"+tree;
</script>
<<<
!!!!!Revisions
<<<
2009.09.29 [1.1.8] in findRelatedTiddlers(), fixed recursion when using non-null callback
2007.11.11 [1.1.7] in findRelatedTiddlers(), refactored into separate getlinks(),<br>and added param for optional callback function that can be used to return an alternative set of links.<br>Also added API functions, getTree() and getList() for use by other scripts
2007.07.13 [1.1.6] performance optimizations, more code cleanup
2007.07.10 [1.1.5] extensive code cleanup
2007.07.08 [1.1.0] converted from inline script
2007.06.29 [1.0.0] started (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.RelatedTiddlersPlugin={major: 1, minor: 1, revision: 8, date: new Date(2009,9,29)};

// initialize 'autozoom' and 'exclude' tree options (defaults are not to zoom, and to follow all links)
if (config.options.chkRelatedTiddlersZoom===undefined)
	config.options.chkRelatedTiddlersZoom=false;
if (config.options.txtRelatedTiddlersExclude===undefined)
	config.options.txtRelatedTiddlersExclude='GettingStarted DefaultTiddlers';
if (config.options.chkRelatedTiddlersShowList===undefined)
	config.options.chkRelatedTiddlersShowList=true;
if (config.options.chkRelatedTiddlersShowTree===undefined)
	config.options.chkRelatedTiddlersShowTree=false;

config.macros.relatedTiddlers={
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {

		// create form with unique DOM element ID (using current timestamp)... permits multiple form instances
		var now=new Date().getTime();
		var span=createTiddlyElement(place,"span");
		span.innerHTML=this.form.format(["relatedTiddlers_form"+now]);
		var form=span.getElementsByTagName("form")[0]; // find form that we just created
		var target=createTiddlyElement(span,"div"); // create target block in which generated output will be placed

		// initialize droplist contents (all tiddlers except hidden ones)
		var tids=store.getTiddlers('title','excludeLists');
		for (i=0; i<tids.length; i++) form.list.options[form.list.options.length]=new Option(tids[i].title,tids[i].title,false,false);

		// initialize exclude field (space-separated list)
		if (config.options.txtRelatedTiddlersExclude) form.exclude.value=config.options.txtRelatedTiddlersExclude;

		// set starting tiddler, form display, and/or exclude list from macro params (if present) and then show the results!
		var root="";
		var hide=false;
		var exclude=config.options.txtRelatedTiddlersExclude;
		if (params[0]) root=params[0]; // TiddlerName
		if (params[1]) hide=(params[1].toLowerCase()=="hideform"); // keyword: "hideform" or "showform" (default)
		if (params[2]) exclude=params[2]; // list of tiddlers whose links should not be followed
		if (root=="here") { var tid=story.findContainingTiddler(place); if (tid) root=tid.getAttribute("tiddler"); }
		if (store.tiddlerExists(root)) {
			// NOTE:  don't hide form when running IE, where putting initial focus on hidden form creates an error
			if (!config.browser.isIE) form.style.display=hide?"none":"block"; // show/hide the controls
			form.list.value=root; // set the root
			form.exclude.value=exclude; // set 'exclude' field
			form.get.click(); // DISPLAY INITIAL RESULTS (if tiddler is selected)
		}
	},
	form:
		"<form id='%0' action='javascript:;' style='display:inline;margin:0;padding:0;' onsubmit='return false'><!-- \
		--><span class='fine' style='float:left;vertical-align:bottom;width:39.5%;'><i>find all tiddlers related to:</i></span><!-- \
		--><span class='fine' style='float:left;vertical-align:bottom;'><i>exclude links contained in:</i></span><!-- \
		--><div style='clear:both'><!-- \
		--><select name=list size=1 style='width:39.5%' onchange='this.form.get.click()'><!-- \
		--><option value=''>select a tiddler...</option><!-- \
		--></select><!-- \
		--><input type='text' option='txtRelatedTiddlersExclude' name='exclude' value='' style='width:40%' \
			title='papiers dont les liens ne doivent pas être suivis' \
			onkeyup='if (event.keyCode==13) { this.blur(); this.form.get.click(); }'  \
			onchange='config.options[this.getAttribute(\"option\")]=this.value;saveOptionCookie(this.getAttribute(\"option\"));'><!-- \
		--><input type=button name=get value='relations' style='width:10%'  \
			onclick='config.macros.relatedTiddlers.show(this.form,this.form.nextSibling);'><!-- \
		--><input type=button name=done value='fait' disabled style='width:10%'  \
			onclick='this.form.list.selectedIndex=0; this.form.get.click();'><!-- \
		--></div><!-- \
		--></form>",
	styles:
		".relatedTiddlers blockquote \
			{ border-left:1px dotted #999; margin:0 25px; padding-left:.5em; font-size:%0%; line-height:115%; } \
		.relatedTiddlers .borderleft \
			{ margin:0; padding:0; margin-left:1em; border-left:1px dotted #999; padding-left:.5em; } \
		.relatedTiddlers .fourcolumns \
			{ display:block; -moz-column-count:4; -moz-column-gap:1em; -moz-column-width:25%} \
		.relatedTiddlers a \
			{ font-weight:normal; } \
		.relatedTiddlers .bold, .relatedTiddlers .bold a \
			{ font-weight:bold; } \
		.relatedTiddlers .floatright \
			{ float:right; } \
		.relatedTiddlers .clear \
			{ clear:both; }	",
	toggleform:
		"{{floatright{<html><a href='javascript:;' class='button' title='commutateur' \
		onclick='var here=story.findContainingTiddler(this); var tid=here?here.getAttribute(\"tiddler\"):\"\"; \
			var f=document.getElementById(\"%0\"); var hide=(f.style.display!=\"aucun\"); \
			f.style.display=hide?\"aucun\":\"trouvé\"; this.innerHTML=hide?\"montrer\":\"cacher\"; return false;'>%1</a></html>}}}",
	treecheck:
		"{{floatright{@@display:none;<<option chkRelatedTiddlersShowTree>>@@<html><a href='javascript:;' class='button' onclick='this.parentNode.previousSibling.firstChild.click(); return false;'>tree view</a></html>}}}",
	tree:
		"{{clear{\n----\n}}} \
		{{floatright small{<<option chkRelatedTiddlersZoom>>autosize tree display}}} \
		{{fine{\n''papiers liés ou inclus par'' [[%0]]\n}}}%1",
	listcheck:
		"{{floatright{@@display:none;<<option chkRelatedTiddlersShowList>>@@<html><a href='javascript:;' class='button' onclick='this.parentNode.previousSibling.firstChild.click(); return false;'>list view</a></html>}}}",
	list:
		"{{clear{\n----\n}}} \
		{{fine{\n''tiddlers containing links to'' [[%0]]\n}}} \
		{{small fourcolumns borderleft{\n%1}}} \
		{{fine{\n''papiers liés ou inclus par'' [[%0]]\n}}} \
		{{borderleft{\n \
			{{fine{\n''bold''=//direct links//, plain=//indirect links//, ''...''=//liens non suivis//}}} \
			{{small fourcolumns{\n%2}}} \
		}}}",
	skipped:
		"<html><span title='les liens de %0 n'ont pas été suivis'>...</span></html>",
	mouseover: function(ev) {
		this.saveSize=this.style.fontSize;
		this.style.fontSize='100%';
		this.style.borderLeftStyle='solid';
	},
	mouseout: function(ev) {
		this.style.fontSize=this.saveSize;
		this.style.borderLeftStyle='dotted';
	},
	findRelatedTiddlers: function(tid,tids,treeout,level,exclude,callback) { 
		// recursively build list of related tids (links and includes FROM the root tiddler) and generate treeview output
		var t=store.getTiddler(tid);
		if (!t || tids.contains(tid)) return tids; // tiddler already in results (or missing tiddler)... just return current results
		tids.push(t.title); // add tiddler to results
		var skip=exclude && exclude.contains(tid);
		treeout.text+=level+"[["+tid+"]]"+(skip?this.skipped.format([tid]):"")+"\n";
		if (skip) return tids; // branch is pruned... don't follow links
		var links=callback?callback(t):this.getLinks(t);
		for (var i=0; i<links.length; i++) tids=this.findRelatedTiddlers(links[i],tids,treeout,level+">",exclude,callback);
		return tids;
	},
	getLinks: function(tiddler) {
		if (!tiddler.linksUpdated) tiddler.changed();
		return tiddler.links;
	},
	getTree: function(start,exclude,callback) {
		// get related tiddlers and generate blockquote-indented tree output
		var list=[]; var tree={text:""}; var level="";
		list=this.findRelatedTiddlers(start,list,tree,level,exclude,callback);
		return tree.text;
	},
	getList: function(start,exclude,callback) {
		// get related tiddlers and generate blockquote-indented tree output
		var list=[]; var tree={text:""}; var level="";
		list=this.findRelatedTiddlers(start,list,tree,level,exclude,callback);
		return list;
	},
	show: function(form,target) {
		removeChildren(target); form.done.disabled=true; // clear any existing output and disable 'done' button
		var start=form.list.value; if (!start.length) return; // get selected starting tiddler.  If blank value (heading), do nothing

		// get related tiddlers and generate blockquote-indented tree output
		var rels=[]; var treeview={text:""}; var level="";
		var exclude=config.options.txtRelatedTiddlersExclude.readBracketedList();
		var rels=this.findRelatedTiddlers(start,rels,treeview,level,exclude);
		rels.shift(); // remove self from list
		rels.sort(); // sort titles alphabetically

		// generate list output
		var tid=store.getTiddler(start);
		var relsview=""; for (t=0; t<rels.length; t++) {
			relsview+=tid.links.contains(rels[t])?("{{bold{[["+rels[t]+"]]}}}"):("[["+rels[t]+"]]");
			if (exclude && exclude.contains(rels[t])) relsview+=this.skipped.format([rels[t]]);
			relsview+="\n";
		}
	
		// get references TO the root tiddler, add to related tiddlers and generate refsview output
		var refs=[]; var referers=store.getReferringTiddlers(start);
		for(var r=0; r<referers.length; r++)
			if(referers[r].title!=start && !referers[r].tags.contains("excludeLists")) refs.push(referers[r].title);
		var refcount=refs.length; var relcount=rels.length; // remember individual counts
		for (var r=0; r<refs.length; r++) rels.pushUnique(refs[r]); // combine lists without duplicates
		var total=rels.length; // get combined total
		var refsview="[["+refs.sort().join("]]\n[[")+"]]\n";
	
		// set custom blockquote styles for treeview
		setStylesheet(this.styles.format([config.options.chkRelatedTiddlersZoom?80:100]),'relatedTiddlers_styles');

		// assemble and render output
		var summary=(total?(total+" papier"+(total==1?" is":"s sont")):"Aucun papier")+" relié à: [["+start+"]]";
		var list=this.list.format([start,refsview.length?refsview:"//aucun//",relsview.length?relsview:"//aucun//"]);
		var tree=this.tree.format([start,treeview.text]);
		var toggle=this.toggleform.format([form.id,(form.style.display=='none'?'show form':'hide form')]);
		var sep="{{floatright{ | }}}";
		var showList=total && config.options.chkRelatedTiddlersShowList;
		var showTree=relcount && config.options.chkRelatedTiddlersShowTree;
		var out="{{relatedTiddlers{"+toggle+(relcount?sep+this.treecheck:"")+(total?sep+this.listcheck:"")+summary+(showList?list:"")+(showTree?tree:"")+"}}}";
		wikify(out,target);
		form.done.disabled=false; // enable 'done' button

		// add mouseover/mouseout handling to blockquotes (for autosizing)
		var blocks=target.getElementsByTagName("blockquote");
		for (var b=0; b<blocks.length; b++)
			{ blocks[b].onmouseover=this.mouseover; blocks[b].onmouseout=this.mouseout; }

		// add side-effect to checkboxes so that display is refreshed when a checkbox state is changed
		var checks=target.getElementsByTagName("input");
		for (var c=0; c<checks.length; c++) {
			if (checks[c].type.toLowerCase()!="checkbox") continue;
			checks[c].coreClick=checks[c].onclick; // save standard click handler
			checks[c].formID=form.id; // link checkbox with correponding form
			checks[c].onclick=function() { this.coreClick.apply(this,arguments); document.getElementById(this.formID).get.click(); }
		}
	}
}
//}}}
/***


!Description
This plugin provides macros for tagging a date with a reminder.  Use the {{{reminder}}} macro to do this.  The {{{showReminders}}} and {{{displayTiddlersWithReminder}}} macros automatically search through all available tiddlers looking for upcoming reminders.

!Installation
* Create a new tiddler in your tiddlywiki titled ReminderPlugin and give it the {{{systemConfig}}} tag.  The tag is important because it tells TW that this is executable code.
* Double click this tiddler, and copy all the text from the tiddler's body.
* Paste the text into the body of the new tiddler in your TW.
* Save and reload your TW.
* You can copy some examples into your TW as well.  See [[Simple examples]], [[Holidays]], [[showReminders]] and [[Personal Reminders]]

!Syntax:
|>|See [[ReminderSyntax]] and [[showRemindersSyntax]]|

!Revision history
* v2.3.10 (Jun 28, 2007)
** Removed window.story = window backwards compatibility hacks since they were breaking TW 2.2
* v2.3.9 (Apr 26, 2007)
** allow bracketed list format in tags param lets you use tags with spaces
* v2.3.8 (Mar 9, 2006)
**Bug fix: A global variable had snuck in, which was killing FF 1.5.0.1
**Feature: You can now use TIDDLER and TIDDLERNAME in a regular reminder format
* v2.3.6 (Mar 1, 2006)
**Bug fix: Reminders for today weren't being matched sometimes.
**Feature:  Solidified integration with DatePlugin and CalendarPlugin
**Feature:  Recurring reminders will now return multiple hits in showReminders and the calendar.
**Feature:  Added TIDDLERNAME to the replacements for showReminders format, for plugins that need the title without brackets.
* v2.3.5 (Feb 8, 2006)
**Bug fix: Sped up reminders lots.  Added a caching mechanism for reminders that have already been matched.
* v2.3.4 (Feb 7, 2006)
**Bug fix: Cleaned up code to hopefully prevent the Firefox 1.5.0.1 crash that was causing lots of plugins 
to crash Firefox.  Thanks to http://www.jslint.com
* v2.3.3 (Feb 2, 2006)
**Feature: newReminder now has drop down lists instead of text boxes.
**Bug fix:  A trailing space in a title would trigger an infinite loop.
**Bug fix:  using tag:"birthday !reminder" would filter differently than tag:"!reminder birthday"
* v2.3.2 (Jan 21, 2006)
**Feature: newReminder macro, which will let you easily add a reminder to a tiddler. Thanks to Eric Shulman (http://www.elsdesign.com) for the code to do this.
** Bug fix: offsetday was not working sometimes
** Bug fix: when upgrading to 2.0, I included a bit to exclude tiddlers tagged with excludeSearch.  I've reverted back to searching through all tiddlers
* v2.3.1 (Jan 7, 2006)
**Feature: 2.0 compatibility
**Feature AlanH sent some code to make sure that showReminders prints a message if no reminders are found.
* v2.3.0 (Jan 3, 2006)
** Bug Fix:  Using "Last Sunday (-0)" as a offsetdayofweek wasn't working.
** Bug Fix:  Daylight Savings time broke offset based reminders (for example year:2005 month:8 day:23 recurdays:7 would match Monday instead of Tuesday during DST.

!Code
***/
//{{{

//============================================================================
//============================================================================
//           ReminderPlugin
//============================================================================
//============================================================================

version.extensions.ReminderPlugin = {major: 2, minor: 3, revision: 8, date: new Date(2006,3,9), source: "http://remindermacros.tiddlyspot.com/"};

//============================================================================
// Configuration
// Modify this section to change the defaults for 
// leadtime and display strings
//============================================================================

config.macros.reminders = {};
config.macros["reminder"] = {};
config.macros["newReminder"] = {};
config.macros["showReminders"] = {};
config.macros["displayTiddlersWithReminders"] = {};

config.macros.reminders["defaultLeadTime"] = [0,6000];
config.macros.reminders["defaultReminderMessage"] = "DIFF: TITLE le DATE ANNIVERSARY";
config.macros.reminders["defaultShowReminderMessage"] = "DIFF: TITLE le DATE ANNIVERSARY -- TIDDLER";
config.macros.reminders["defaultAnniversaryMessage"] = "(DIFF)";
config.macros.reminders["untitledReminder"] = "Rappel Indéfini";
config.macros.reminders["noReminderFound"] = "Pas de correspondance pour TITLE dans les prochains LEADTIMEUPPER jours."
config.macros.reminders["todayString"] = "Aujourd'hui";
config.macros.reminders["tomorrowString"] = "Demain";
config.macros.reminders["ndaysString"] = "DIFF jours";
config.macros.reminders["emtpyShowRemindersString"] = "";


//============================================================================
//  Code
// You should not need to edit anything 
// below this.  Make sure to edit this tiddler and copy 
// the code from the text box, to make sure that 
// tiddler rendering doesn't interfere with the copy 
// and paste.
//============================================================================

//this object will hold the cache of reminders, so that we don't
//recompute the same reminder over again.
var reminderCache = {};

config.macros.showReminders.handler = function showReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the 
         //leadtime a few lines down.
         paramHash["leadtime"] = [-10000, 10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }

   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   var elem = createTiddlyElement(place,"span",null,null, null);
   var mess = "";
   if (arr.length == 0)
   {
      mess += config.macros.reminders.emtpyShowRemindersString; 
   }
   for (var j = 0; j < arr.length; j++)
   {
      if (paramHash["format"] != null)
      {
         arr[j]["params"]["format"] = paramHash["format"];
      }
      else
      {
         arr[j]["params"]["format"] = config.macros.reminders["defaultShowReminderMessage"];
      }
      mess += getReminderMessageForDisplay(arr[j]["diff"], arr[j]["params"], arr[j]["matchedDate"], arr[j]["tiddler"]);
      mess += "\n";
   }
   wikify(mess, elem, null, null);
};


config.macros.displayTiddlersWithReminders.handler = function displayTiddlersWithReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the leadtime 
         //a few lines down.
         paramHash["leadtime"] = [-10000,10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }
   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   for (var j = 0; j < arr.length; j++)
   {
      displayTiddler(null, arr[j]["tiddler"], 0, null, false, false, false);
   }
};

config.macros.reminder.handler = function reminder(place,macroName,params)
{
   var dateHash = getParamsForReminder(params);
   if (dateHash["hidden"] != null)
   {
      return;
   }
   var leadTime = dateHash["leadtime"];
   if (leadTime == null)
   {
      leadTime = config.macros.reminders["defaultLeadTime"]; 
   }
   var leadTimeLowerBound = new Date().getMidnight().addDays(leadTime[0]);
   var leadTimeUpperBound = new Date().getMidnight().addDays(leadTime[1]);
   var matchedDate = findDateForReminder(dateHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound);
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(place).id.substr(7);
   if (matchedDate != null)
   {
      var diff = matchedDate.getDifferenceInDays(new Date().getMidnight());
      var elem = createTiddlyElement(place,"span",null,null, null);
      var mess = getReminderMessageForDisplay(diff, dateHash, matchedDate, title);
      wikify(mess, elem, null, null);
   }
   else
   {
      createTiddlyElement(place,"span",null,null, config.macros.reminders["noReminderFound"].replace("TITLE", dateHash["title"]).replace("LEADTIMEUPPER", leadTime[1]).replace("LEADTIMELOWER", leadTime[0]).replace("TIDDLERNAME", title).replace("TIDDLER", "[[" + title + "]]") );
   }
};

config.macros.newReminder.handler = function newReminder(place,macroName,params)
{
  var today=new Date().getMidnight();
  var formstring = '<html><form>Year: <select name="year"><option value="">Every year</option>';
  for (var i = 0; i < 5; i++)
  {
    formstring += '<option' + ((i == 0) ? ' selected' : '') + ' value="' + (today.getFullYear() +i) + '">' + (today.getFullYear() + i) + '</option>';
  }
  formstring += '</select>&nbsp;&nbsp;Month:<select name="month"><option value="">Every month</option>';
  for (i = 0; i < 12; i++)
  {
    formstring += '<option' + ((i == today.getMonth()) ? ' selected' : '') + ' value="' + (i+1) + '">' + config.messages.dates.months[i] + '</option>';
  }
  formstring += '</select>&nbsp;&nbsp;Day:<select name="day"><option value="">Every day</option>';
  for (i = 1; i < 32; i++)
  {
    formstring += '<option' + ((i == (today.getDate() )) ? ' selected' : '') + ' value="' + i + '">' + i + '</option>';
  }

formstring += '</select>&nbsp;&nbsp;Reminder Title:<input type="text" size="40" name="title" value="please enter a title" onfocus="this.select();"><input type="button" value="ok" onclick="addReminderToTiddler(this.form)"></form></html>';

  var panel = config.macros.slider.createSlider(place,null,"New Reminder","Open a form to add a new reminder to this tiddler");
  wikify(formstring ,panel,null,store.getTiddler(params[1]));
};

// onclick: process input and insert reminder at 'marker'
window.addReminderToTiddler = function(form) {
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(form).id.substr(7);
   var tiddler=store.getTiddler(title);
  var txt='\n<<reminder ';
  if (form.year.value != "")
    txt += 'year:'+form.year.value + ' ';
  if (form.month.value != "")
    txt += 'month:'+form.month.value + ' ';
  if (form.day.value != "")
    txt += 'day:'+form.day.value + ' ';
  txt += 'title:"'+form.title.value+'" ';
  txt +='>>';
   tiddler.set(null,tiddler.text + txt);
   window.story.refreshTiddler(title,1,true);
   store.setDirty(true);
};

function hasTag(tiddlerTags, tagFilters)
{
  //Make sure we respond well to empty tiddlerTaglists or tagFilterlists
  if (tagFilters.length==0 || tiddlerTags.length==0)
  {
    return true;
  }

  var bHasTag = false;
  
  /*bNoPos says: "'till now there has been no check using a positive filter"
     Imagine a filterlist consisting of 1 negative filter:
         If the filter isn't matched, we want hasTag to be true.
         Yet bHasTag is still false ('cause only positive filters cause bHasTag to change)
         
     If no positive filters are present bNoPos is true, and no negative filters are matched so we have not returned false
         Thus: hasTag returns true.
      
      If at any time a positive filter is encountered, we want at least one of the tags to match it, so we turn bNoPos to false, which
      means bHasTag must be true for hasTag to return true*/
  var bNoPos=true;
  
for (var t3 = 0; t3 < tagFilters.length; t3++)
  {
      for(var t2=0; t2<tiddlerTags.length; t2++)
      {
           if (tagFilters[t3].length > 1 && tagFilters[t3].charAt(0) == '!') 
           {
              if (tiddlerTags[t2] == tagFilters[t3].substring(1))
              {
                 //If at any time a negative filter is matched, we return false
                  return false;
              }
           }
           else 
           {
              if (bNoPos)
              {
                 //We encountered the first positive filter
                 bNoPos=false;
              }
              if (tiddlerTags[t2] == tagFilters[t3])
              {
                  //A positive filter is matched. As long as no negative filter is matched, hasTag will return true
                  bHasTag=true;
              }
           }
        }
    }
    return (bNoPos || bHasTag);
};

//This function searches all tiddlers for the reminder  //macro.  It is intended that other plugins (like //calendar) will use this function to query for 
//upcoming reminders.
//The arguments to this function filter out reminders //based on when they will fire.
//
//ARGUMENTS:
//baseDate is the date that is used as "now".  
//leadtime is a two element int array, with leadtime[0] 
//         as the lower bound and leadtime[1] as the
//         upper bound.  A reasonable default is [0,14]
//tags is a space-separated list of tags to use to filter 
//         tiddlers.  If a tag name begins with an !, then 
//         only tiddlers which do not have that tag will 
//         be considered.  For example "examples holidays"  
//         will search for reminders in any tiddlers that  
//         are tagged with examples or holidays and 
//         "!examples !holidays" will search for reminders 
//         in any tiddlers that are not tagged with 
//         examples or holidays.  Pass in null to search 
//         all tiddlers.
//limit.  If limit is null, individual reminders can 
//        override the leadtime specified earlier.  
//        Pass in 1 in order to override that behavior.

window.findTiddlersWithReminders = function findTiddlersWithReminders(baseDate, leadtime, tags, limit)
{
//function(searchRegExp,sortField,excludeTag)
//   var macroPattern = "<<([^>\\]+)(?:\\*)([^>]*)>>";
   var macroPattern = "<<(reminder)(.*)>>";
   var macroRegExp = new RegExp(macroPattern,"mg");
   var matches = store.search(macroRegExp,"title","");
   var arr = [];
   var tagsArray = null;
   if (tags != null)
   {
      // tagsArray = tags.split(" ");
      tagsArray = tags.readBracketedList(); // allows tags with spaces. thanks Robin Summerhill, 4-Oct-06.
   }
   for(var t=matches.length-1; t>=0; t--)
   {
      if (tagsArray != null)
      {
         //If they specified tags to filter on, and this tiddler doesn't 
	 //match, skip it entirely.
         if ( ! hasTag(matches[t].tags, tagsArray))
         {
            continue;
         }
      }

      var targetText = matches[t].text;
      do {
         // Get the next formatting match
         var formatMatch = macroRegExp.exec(targetText);
         if(formatMatch && formatMatch[1] != null && formatMatch[1].toLowerCase() == "reminder")
         {
            //Find the matching date.
            
            var params = formatMatch[2] != null ? formatMatch[2].readMacroParams() : {};
            var dateHash = getParamsForReminder(params);
            if (limit != null || dateHash["leadtime"] == null)
            {
               if (leadtime == null)
                   dateHash["leadtime"] = leadtime;
               else
               {
                  dateHash["leadtime"] = [];
                  dateHash["leadtime"][0] = leadtime[0];
                  dateHash["leadtime"][1] = leadtime[1];
               }
            }
	    if (dateHash["leadtime"] == null)
               dateHash["leadtime"] = config.macros.reminders["defaultLeadTime"]; 
            var leadTimeLowerBound = baseDate.addDays(dateHash["leadtime"][0]);
            var leadTimeUpperBound = baseDate.addDays(dateHash["leadtime"][1]);
            var matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
            while (matchedDate != null)
            {
               var hash = {};
               hash["diff"] = matchedDate.getDifferenceInDays(baseDate);
               hash["matchedDate"] = new Date(matchedDate.getFullYear(), matchedDate.getMonth(), matchedDate.getDate(), 0, 0);
               hash["params"] = cloneParams(dateHash);
               hash["tiddler"] = matches[t].title;
               hash["tags"] = matches[t].tags;
               arr.pushUnique(hash);
	       if (dateHash["recurdays"] != null || (dateHash["year"] == null))
	       {
	         leadTimeLowerBound = leadTimeLowerBound.addDays(matchedDate.getDifferenceInDays(leadTimeLowerBound)+ 1);
                 matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
	       }
	       else matchedDate = null;
            }
         }
      }while(formatMatch);
   }
   if(arr.length > 1)  //Sort the array by number of days remaining.
   {
      arr.sort(function (a,b) {if(a["diff"] == b["diff"]) {return(0);} else {return (a["diff"] < b["diff"]) ? -1 : +1; } });
   }
   return arr;
};

//This function takes the reminder macro parameters and
//generates the string that is used for display.
//This function is not intended to be called by 
//other plugins.
 window.getReminderMessageForDisplay= function getReminderMessageForDisplay(diff, params, matchedDate, tiddlerTitle)
{
   var anniversaryString = "";
   var reminderTitle = params["title"];
   if (reminderTitle == null)
   {
      reminderTitle = config.macros.reminders["untitledReminder"];
   }
   if (params["firstyear"] != null)
   {
      anniversaryString = config.macros.reminders["defaultAnniversaryMessage"].replace("DIFF", (matchedDate.getFullYear() - params["firstyear"]));
   }
   var mess = "";
   var diffString = "";
   if (diff == 0)
   {
      diffString = config.macros.reminders["todayString"];
   }
   else if (diff == 1)
   {
      diffString = config.macros.reminders["tomorrowString"];
   }
   else
   {
      diffString = config.macros.reminders["ndaysString"].replace("DIFF", diff);
   }
   var format = config.macros.reminders["defaultReminderMessage"];
   if (params["format"] != null)
   {
      format = params["format"];
   }
   mess = format;
//HACK!  -- Avoid replacing DD in TIDDLER with the date
   mess = mess.replace(/TIDDLER/g, "TIDELER");
   mess = matchedDate.formatStringDateOnly(mess);
   mess = mess.replace(/TIDELER/g, "TIDDLER");
   if (tiddlerTitle != null)
   {
      mess = mess.replace(/TIDDLERNAME/g, tiddlerTitle);
      mess = mess.replace(/TIDDLER/g, "[[" + tiddlerTitle + "]]");
   }
   
   mess = mess.replace("DIFF", diffString).replace("TITLE", reminderTitle).replace("DATE", matchedDate.formatString("DDD MMM DD, YYYY")).replace("ANNIVERSARY", anniversaryString);
   return mess;
};

// Parse out the macro parameters into a hashtable.  This
// handles the arguments for reminder, showReminders and 
// displayTiddlersWithReminders.
window.getParamsForReminder = function getParamsForReminder(params)
{
   var dateHash = {};
   var type = "";
   var num = 0;
   var title = "";
   for(var t=0; t<params.length; t++)
   {
      var split = params[t].split(":");
      type = split[0].toLowerCase();
      var value = split[1];
      for (var i=2; i < split.length; i++)
      {
         value += ":" + split[i];
      }
      if (type == "nolinks" || type == "limit" || type == "hidden")
      {
         num = 1;
      }
      else if (type == "leadtime")
      {
         var leads = value.split("...");
         if (leads.length == 1)
         {
            leads[1]= leads[0];
            leads[0] = 0;
         }
         leads[0] = parseInt(leads[0], 10);
         leads[1] = parseInt(leads[1], 10);
         num = leads;
      }
      else if (type == "offsetdayofweek")
      {
          if (value.substr(0,1) == "-")
          {
             dateHash["negativeOffsetDayOfWeek"] = 1;
	     value = value.substr(1);
          }
          num = parseInt(value, 10);
      }
      else if (type != "title" && type != "tag" && type != "format")
      {
         num = parseInt(value, 10);
      }
      else
      {
         title = value;
         t++;
         while (title.substr(0,1) == '"' && title.substr(title.length - 1,1) != '"' && params[t] != undefined)
         {
            title += " " + params[t++];
         }
         //Trim off the leading and trailing quotes
         if (title.substr(0,1) == "\"" && title.substr(title.length - 1,1)== "\"")
         {
            title = title.substr(1, title.length - 2);
            t--;
         }
         num = title;
      }
      dateHash[type] = num;
   }
   //date is synonymous with day
   if (dateHash["day"] == null)
   {
      dateHash["day"] = dateHash["date"];
   }
   return dateHash;
};

//This function finds the date specified in the reminder 
//parameters.  It will return null if no match can be
//found.  This function is not intended to be used by
//other plugins.
window.findDateForReminder= function findDateForReminder( dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound)
{
   if (baseDate == null)
   {
     baseDate = new Date().getMidnight();
   }
   var hashKey = baseDate.convertToYYYYMMDDHHMM();
   for (var k in dateHash)
   {
      hashKey += "," + k + "|" + dateHash[k];
   }
   hashKey += "," + leadTimeLowerBound.convertToYYYYMMDDHHMM();
   hashKey += "," + leadTimeUpperBound.convertToYYYYMMDDHHMM();
   if (reminderCache[hashKey] == null)
   {
      //If we don't find a match in this run, then we will
      //cache that the reminder can't be matched.
      reminderCache[hashKey] = false;
   }
   else if (reminderCache[hashKey] == false)
   {
      //We've already tried this date and failed
      return null;
   }
   else
   {
      return reminderCache[hashKey];
   }
   
   var bOffsetSpecified = dateHash["offsetyear"] != null || 
				dateHash["offsetmonth"] != null || 
				dateHash["offsetday"] != null || 
				dateHash["offsetdayofweek"] != null || 
				dateHash["recurdays"] != null;
   
   // If we are matching the base date for a dayofweek offset, look for the base date a 
   //little further back.
   var tmp1leadTimeLowerBound = leadTimeLowerBound;  
   if ( dateHash["offsetdayofweek"] != null)
   {
      tmp1leadTimeLowerBound = leadTimeLowerBound.addDays(-6);  
   }
   var matchedDate = baseDate.findMatch(dateHash, tmp1leadTimeLowerBound, leadTimeUpperBound);
   if (matchedDate != null)
   {
      var newMatchedDate = matchedDate;
      if (dateHash["recurdays"] != null)
      {
         while (newMatchedDate.getTime() < leadTimeLowerBound.getTime())
         {
            newMatchedDate = newMatchedDate.addDays(dateHash["recurdays"]);
         }
      }
      else if (dateHash["offsetyear"] != null || 
		dateHash["offsetmonth"] != null || 
		dateHash["offsetday"] != null || 
		dateHash["offsetdayofweek"] != null)
      {
         var tmpdateHash = cloneParams(dateHash);
         tmpdateHash["year"] = dateHash["offsetyear"];
         tmpdateHash["month"] = dateHash["offsetmonth"];
         tmpdateHash["day"] = dateHash["offsetday"];
         tmpdateHash["dayofweek"] = dateHash["offsetdayofweek"];
	 var tmpleadTimeLowerBound = leadTimeLowerBound;
	 var tmpleadTimeUpperBound = leadTimeUpperBound;
	 if (tmpdateHash["offsetdayofweek"] != null)
	 {
	 	if (tmpdateHash["negativeOffsetDayOfWeek"] == 1)
		{
		   tmpleadTimeLowerBound = matchedDate.addDays(-6);
		   tmpleadTimeUpperBound = matchedDate;

		}
		else
		{
		   tmpleadTimeLowerBound = matchedDate;
		   tmpleadTimeUpperBound = matchedDate.addDays(6);
		}

	 }
	 newMatchedDate = matchedDate.findMatch(tmpdateHash, tmpleadTimeLowerBound, tmpleadTimeUpperBound);
         //The offset couldn't be matched.  return null.
         if (newMatchedDate == null)
         {
            return null;
         }
      }
      if (newMatchedDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         reminderCache[hashKey] = newMatchedDate;
         return newMatchedDate;
      }
   }
   return null;
};

//This does much the same job as findDateForReminder, but
//this one doesn't deal with offsets or recurring 
//reminders.
Date.prototype.findMatch = function findMatch(dateHash, leadTimeLowerBound, leadTimeUpperBound)
{

   var bSpecifiedYear =     (dateHash["year"] != null);
   var bSpecifiedMonth =     (dateHash["month"] != null);
   var bSpecifiedDay =     (dateHash["day"] != null);
   var bSpecifiedDayOfWeek =     (dateHash["dayofweek"] != null);
   if (bSpecifiedYear && bSpecifiedMonth && bSpecifiedDay)
   {
      return new Date(dateHash["year"], dateHash["month"]-1, dateHash["day"], 0, 0);
   }
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedDay && bSpecifiedMonth && !bSpecifiedYear && !bSpecifiedDayOfWeek)
   {

      //Shortcut -- First try this year.  If it's too small, try next year.
      var tmpMidnight = this.getMidnight();
      var tmpDate = new Date(this.getFullYear(), dateHash["month"]-1, dateHash["day"], 0,0);
      if (tmpDate.getTime() < leadTimeLowerBound.getTime())
      {
         tmpDate = new Date((this.getFullYear() + 1), dateHash["month"]-1, dateHash["day"], 0,0);
      }
      if ( tmpDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         return tmpDate;
      }
      else
      {
         return null;
      }
   }

   var newDate = leadTimeLowerBound; 
   while (newDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
   {
      var tmp = testDate(newDate, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek);
      if (tmp != null)
        return tmp;
      newDate = newDate.addDays(1);
   }
};

function testDate(testMe, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek)
{
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedYear)
   {
      bMatchedYear = (dateHash["year"] == testMe.getFullYear());
   }
   if (bSpecifiedMonth)
   {
      bMatchedMonth = ((dateHash["month"] - 1)  == testMe.getMonth() );
   }
   if (bSpecifiedDay)
   {
      bMatchedDay = (dateHash["day"] == testMe.getDate());
   }
   if (bSpecifiedDayOfWeek)
   {
      bMatchedDayOfWeek = (dateHash["dayofweek"] == testMe.getDay());
   }

   if (bMatchedYear && bMatchedMonth && bMatchedDay && bMatchedDayOfWeek)
   {
      return testMe;
   }
};

//Returns true if the date is in between two given dates
Date.prototype.isBetween = function isBetween(lowerBound, upperBound)
{
  return (this.getTime() >= lowerBound.getTime() && this.getTime() <= upperBound.getTime());
}
//Return a new date, with the time set to midnight (0000)
Date.prototype.getMidnight = function getMidnight()
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0);
};
// Add the specified number of days to a date.
Date.prototype.addDays = function addDays(numberOfDays)
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate() + numberOfDays, 0, 0);
};
//Return the number of days between two dates.
Date.prototype.getDifferenceInDays = function getDifferenceInDays(otherDate)
{
//I have to do it this way, because this way ignores daylight savings
   var tmpDate = this.addDays(0);
   if (this.getTime() > otherDate.getTime())
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() > otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(-1);
      }
      return i;
   }
   else
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() < otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(1);
      }
      return i * -1;
   }
   return 0;
};
function cloneParams(what) {
    var tmp = {};
    for (var i in what) {
        tmp[i] = what[i];
    }
    return tmp;
}
// Substitute date components into a string
Date.prototype.formatStringDateOnly = function formatStringDateOnly(template)
{
	template = template.replace("YYYY",this.getFullYear());
	template = template.replace("YY",String.zeroPad(this.getFullYear()-2000,2));
	template = template.replace("MMM",config.messages.dates.months[this.getMonth()]);
	template = template.replace("0MM",String.zeroPad(this.getMonth()+1,2));
	template = template.replace("MM",this.getMonth()+1);
	template = template.replace("DDD",config.messages.dates.days[this.getDay()]);
	template = template.replace("0DD",String.zeroPad(this.getDate(),2));
	template = template.replace("DD",this.getDate());
	return template;
};

//}}}
/***

!!!Usage
<<<
This plugin automatically updates the default (shadow) ToolbarCommands slice definitions to insert the ''revisions'' command.

When you select the ''revisions'' command, a drop down popup is shown with all the revisions of the current tiddler.

The plugin takes control of the ''saveTiddler'' command and check the tags of the current tiddler. If the current tiddler is taged with the <<tag v>> tag then the ''saveTiddler'' command automatically will create a new revision of the tiddler.

All revision tiddlers will be tagged with <<c10>>, <<tag v>>, <<tag excludeLists>> and <<tag excludeMissing>>.

Note: if you are already using customized toolbar definitions, you will need to manually add the ''version'' toolbar command to your existing ToolbarCommands tiddler, e.g.:
{{{
|EditToolbar|... version ... |
}}}
<<<
!!!Revisions
<<<
2009.03.27 [1.0.1] added some documentation
2009.03.23 [1.0.0] initial version
<<<
!!!Code
***/
//{{{
version.extensions.RevisionsPlugin= {major: 1, minor: 0, revision: 0, date: new Date(2009,3,23)};

config.extensions.RevisionsPlugin = {};
config.extensions.RevisionsPlugin.core_saveTiddler_handler = config.commands.saveTiddler.handler;
merge(config.commands.saveTiddler,{
	zeroPad: 4,
	keepRevisonsTag: "v",
	suffixText: " V%0",
	newtags: ["c10", "v", "vv", "excludeLists", "excludeMissing"],
	keepTags: false
	});

config.commands.saveTiddler.handler = function(event,src,title) {
	if(store.tiddlerExists(title) && store.getTiddler(title).isTagged(this.keepRevisonsTag)) {
		// Not a new tiddler and tagged with keepRevisonsTag
		n = 1;
		var newTitle = title + this.suffixText.format([String.zeroPad(n, this.zeroPad)]);
		while (store.tiddlerExists(newTitle) || document.getElementById(story.idPrefix + newTitle)) {
			n++;
			newTitle = title + this.suffixText.format([String.zeroPad(n, this.zeroPad)]);
		}
		var text = store.getTiddlerText(title, '');
		var newtags = this.newtags;
		var newfields = {};
		var tid = store.getTiddler(title);
		if (tid) {
			if(this.keepTags)
				for (var t = 0; t < tid.tags.length; t++) newtags.push(tid.tags[t]);
			store.forEachField(tid,
				function(t, f, v) {
					newfields[f] = v;
				},
			true);
		}
		store.saveTiddler(newTitle, newTitle, text, tid.modifier, tid.modified, newtags, newfields, false);
	}
	return config.extensions.RevisionsPlugin.core_saveTiddler_handler.apply(this,arguments);
}

config.commands.version = {
	type: "popup",
	text: "version",
	tooltip: "Versions de ce papier",
	shortSuffixText: " V"
}

config.commands.version.handlePopup = function(popup,title) {
	var tiddlertitle = title;
	store.forEachTiddler(function(title,tiddler) {
		if(title.startsWith(tiddlertitle + config.commands.version.shortSuffixText))
			createTiddlyLink(createTiddlyElement(popup,"li"),title,true,null,false,null,true);
		});
};

config.shadowTiddlers.ToolbarCommands = config.shadowTiddlers.ToolbarCommands.replace(
	/jump/m,
	"version jump");

//}}}
/***

This plugin enhances tiddler links so that they can include section references that ''auto-scroll to the indicated section heading'' within a tiddler (i.e., similar to the 'anchor' behavior provided in HTML by {{{<a name="foo">}}} and {{{<a href="#foo">...</a>}}}).  The {{{<<tiddler>>}}} macro syntax has also be extended to allow section references without a tiddler name, so that transclusion of //hidden sections from the same tiddler// can be easily accomplished.  The plugin also adds a new macro, <<sectionTOC>> which can auto-generate and embed a 'Table of Contents' outline view into a tiddler to enable quick navigation to sections within that tiddler.
!!!Usage
<<<
!!!!~TiddlyLink syntax
You can link to a section of a tiddler by adding the "##sectionname" syntax to the tiddlername:
{{{
[[SomeTiddler##SomeSection]]
}}}
When clicked, the tiddler is displayed and the specified section heading is automatically scrolled into view. If the tiddler title is omitted or the 'here' keyword is used, e.g.,
{{{
[[##SomeSection]] or [[here##SomeSection]]>>
}}}
then the current containing tiddler is implied by default.
!!!!HTML anchor syntax
You can use HTML syntax to create a scrollable 'anchor' location within a tiddler without use of the standard TW section heading syntax:
{{{
<html><a name="sectionname" /></html>
}}}
You can then link to that section using the enhanced TiddlyLink syntax as above.
!!!!{{{<<tiddler>>}}} macro 
The {{{<<tiddler>>}}} syntax has been extended so that when the tiddler title is omitted or the 'here' keyword is used, e.g.,
{{{
<<tiddler ##SomeSection>> or <<tiddler here##SomeSection>>
}}}
then the current containing tiddler is implied by default.
!!!!"""<<sectionTOC>>""" macro
This macro generates a 'Table of Contents' outline-style bullet list with links to all sections within the current tiddler.  Simply place the following macro at the //end of the tiddler content// (i.e., following all section headings).  Important note: //''The {{{<<sectionTOC>>}}} macro must occur at the end of the tiddler in order to locate the rendered section headings that precede it.''//
{{{
<<sectionTOC>> or <<sectionTOC className>>
}}}
To position the macro's //output// within the tiddler, you must create a special 'target element' that uses a specific classname (default='sectionTOC'), like this:
{{{
{{sectionTOC{}}}
}}}
When the {{{<<sectionTOC>>}}} macro is rendered, it will find the matching 'sectionTOC'-classed element and writes it's output there.  You can also add the macro and/or target elements directly to the [[ViewTemplate]] definition, so that every tiddler can automatically display the table of contents:
{{{
<span class='sectionTOC'></span> <!-- target element -->
...
<span macro='sectionTOC'></span> <!-- must be at end of tiddler -->
}}}
<<<
!!!Configuration
<<<
You can change the {{{<<SectionTOC>>}}} output link format by adding the following statement to a tiddler tagged with <<tag systemConfig>>
{{{
config.macros.sectionTOC.linkFormat='[[%0|##%0]]';
}}}
The default value (shown above) produces a link to each section within the tiddler, using "%0" to insert the section name into the link.  You can add extra formatting to generate additional output to suit your purposes.  For example, if you have EditSectionPlugin installed, you could include a link that invokes that plugin's popup editor directly from each item in the TOC display, like this:
{{{
config.macros.sectionTOC.linkFormat='[[%0|##%0]] <<editSection [[##%0]] [[(edit)]]>>';
}}}
<<<
!!!Examples
<<<
links to sections defined by ''TW heading syntax'' (e.g, {{{!!!sectionname}}}):{{indent{
[[SectionLinksPlugin##onClickTiddlerLink]]
[[##onClickTiddlerLink]] //(current tiddler implied)//}}}
links to anchors defined by ''HTML syntax'' (e.g., {{{<html><a href="anchorname"></html>}}}):{{indent{
[[SectionLinksPlugin##sampleanchorlink]]
[[##sampleanchorlink]] //(current tiddler implied)//}}}
<<<
!!!Revisions
<<<
2011.12.21 1.4.2 refactor sectionTOCformat to permit customization
2011.02.08 1.4.1 in isExternalLink() hijack, strip section references before testing for external link
2010.08.09 1.4.0 in scrollToSection(), added support for using HTML <a name="..."> anchor elements
2009.08.21 1.3.4 added handling to ignore leading/trailing whitespace in section references
2009.08.21 1.3.3 in createTiddlyLink(), add tiddlyLinkNonExistingSection class if matching section is not found
2009.08.14 1.3.2 in createTiddlyLink(), don't override core value for ~TiddlyLink attribute
2009.08.02 1.3.1 in sectionTOC.handler(), trim leading/trailing whitespace from generated section links
2009.08.01 1.3.0 in scrollToSection(), apply 3-tier section matching (exact, startsWith, contains)
2009.07.06 1.2.2 fixed displayTiddler() hijack
2009.07.03 1.2.1 in {{{<<sectionTOC>>}}}, suppress output if target is not found
2009.06.02 1.2.0 added support for 'here' keyword in {{{[[here##section]]}}} links and {{{<<tiddler here##section>>}}} macro
2009.04.09 1.1.1 in sectionTOC macro, make target visible when TOC is rendered.
2009.01.18 1.1.0 added {{{<<sectionTOC>>}}} macro to generate numbered-bullet links to sections of current tiddler
2009.01.06 1.0.0 converted to stand-alone plugin
2008.10.14 0.0.0 initial release (as [[CoreTweaks]] #784 - http://trac.tiddlywiki.org/ticket/784)
<<<
!!!Code
***/
//{{{
version.extensions.SectionLinksPlugin= {major: 1, minor: 4, revision: 2, date: new Date(2011,12,21)};

Story.prototype.scrollToSection = function(title,section) {
	if (!title||!section) return; var t=this.getTiddler(title); if (!t) return null;
	var elems=t.getElementsByTagName('*');
	var heads=[]; var anchors=[];
	for (var i=0; i<elems.length; i++)
		if (['H1','H2','H3','H4','H5'].contains(elems[i].nodeName)) heads.push(elems[i]);
	for (var i=0; i<elems.length; i++)
		if (elems[i].nodeName=='A' && (elems[i].getAttribute('name')||'').length) anchors.push(elems[i]);
	var found=null;
	for (var i=0; i<heads.length; i++)
		if (getPlainText(heads[i]).trim()==section) { found=heads[i]; break; }
	if (!found) for (var i=0; i<heads.length; i++)
		if (getPlainText(heads[i]).trim().startsWith(section)) { found=heads[i]; break; }
	if (!found) for (var i=0; i<heads.length; i++)
		if (getPlainText(heads[i]).trim().indexOf(section)!=-1) { found=heads[i]; break; }
	if (!found) for (var i=0; i<anchors.length; i++)
		if (anchors[i].getAttribute('name')==section) { found=anchors[i]; break; }
	if (!found) for (var i=0; i<anchors.length; i++)
		if (anchors[i].getAttribute('name').startsWith(section)) { found=anchors[i]; break; }
	if (!found) for (var i=0; i<anchors.length; i++)
		if (anchors[i].getAttribute('name').indexOf(section)!=-1) { found=anchors[i]; break; }
	if (found) {
		// if section heading is collapsed, click to expand it - see [[FoldHeadingsPlugin]]
		if (hasClass(found,'foldable') && found.nextSibling.style.display=='none') found.onclick();
		// scroll *after* tiddler animation
		var delay=config.options.chkAnimate?config.animDuration+100:0;
		setTimeout('window.scrollTo('+findPosX(found)+','+findPosY(found)+')',delay);
		return found;
	}
}
//}}}
/***
!!!!core hijacks
***/
/***
!!!!!createTiddlyLink
***/
//{{{
// [[tiddlername##section]] and [[##section]]
if (!window.createTiddlyLink_section)
	window.createTiddlyLink_section=window.createTiddlyLink;
window.createTiddlyLink=function(place,title) {
	var t=story.findContainingTiddler(place); var tid=t?t.getAttribute('tiddler'):'';
	var parts=title.split(config.textPrimitives.sectionSeparator);
	var title=parts[0]; var section=parts[1]; if (section) section=section.trim();
	if (!title.length || title.toLowerCase()=='here') title=tid;  // default=current tiddler
	arguments[1]=title;
	var btn=createTiddlyLink_section.apply(this,arguments);
	if (section) {
		btn.setAttribute('section',section);
		if (store.getTiddlerText(title+config.textPrimitives.sectionSeparator+section)===null)
			addClass(btn,'tiddlyLinkNonExistingSection');
	}
	return btn;
}
//}}}
/***
!!!!!onClickTiddlerLink
***/
//{{{
if (!window.onClickTiddlerLink_section)
	window.onClickTiddlerLink_section=window.onClickTiddlerLink;
window.onClickTiddlerLink=function(ev) {
	var e=ev||window.event;	var target=resolveTarget(e); var title=null;
	while (target!=null && title==null) {
		title=target.getAttribute('tiddlyLink');
		section=target.getAttribute('section');
		target=target.parentNode;
	} 
	var t=story.findContainingTiddler(target); var tid=t?t.getAttribute('tiddler'):'';
	if (title!=tid||!section) // avoid excess scrolling for intra-tiddler links
		onClickTiddlerLink_section.apply(this,arguments);
	story.scrollToSection(title,section);
	return false;
}
//}}}
/***
!!!!! displayTiddler
***/
//{{{
if (!Story.prototype.displayTiddler_section)
	Story.prototype.displayTiddler_section=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,tiddler)
{
	var title=(tiddler instanceof Tiddler)?tiddler.title:tiddler;
	var parts=title.split(config.textPrimitives.sectionSeparator);
	var title=parts[0]; var section=parts[1]; if (section) section=section.trim();
	if (!title.length || title.toLowerCase()=='here') {
		var t=story.findContainingTiddler(place);
		title=t?t.getAttribute('tiddler'):'';
	}
	arguments[1]=title;  // default=current tiddler
	this.displayTiddler_section.apply(this,arguments);
	story.scrollToSection(title,section);
}
//}}}
/***
<html><a name="sampleanchorlink" /></html>This is a sample ''anchor link'': {{{<html><a name="sampleanchorlink" /></html>}}}
!!!!!isExternalLink
***/
//{{{
if (!config.formatterHelpers.isExternalLink_section)
	config.formatterHelpers.isExternalLink_section=config.formatterHelpers.isExternalLink;
config.formatterHelpers.isExternalLink=function(link) {  // remove section references before testing
	var l=link.split(config.textPrimitives.sectionSeparator)[0];
	return config.formatterHelpers.isExternalLink_section(l);
}
//}}}
/***
!!!!!tiddler.handler
***/
//{{{
if (!config.macros.tiddler.handler_section)
	config.macros.tiddler.handler_section=config.macros.tiddler.handler;
config.macros.tiddler.handler=function(place,macroName,params,wikifier,paramString,tiddler)
{
	if (!params[0]) return;
	var sep=config.textPrimitives.sectionSeparator;
	var parts=params[0].split(sep); var tid=parts[0]; var sec=parts[1]; if (sec) sec=sec.trim();
	if ((tid.toLowerCase()=='here'||!tid.length) && sec) { // fixup for 'here##section' and '##section'
		var here=story.findContainingTiddler(place)
		var tid=here?here.getAttribute('tiddler'):tiddler?tiddler.title:'';
		arguments[2][0]=tid+sep+sec;
		arguments[4]=paramString.replace(new RegExp('(here)?'+sep+sec),tid+sep+sec);
	}
	config.macros.tiddler.handler_section.apply(this,arguments);
}
//}}}
/***
!!!!sectionTOC macro
***/
//{{{
config.macros.sectionTOC = {
	targetClass: 'sectionTOC',
	linkFormat: '[[%0|##%0]]',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var out=[];
		var targetClass=params[0]||this.targetClass;
		var t=story.findContainingTiddler(place); if (!t) return;
		var elems=t.getElementsByTagName('*');
		var level=5; // topmost heading level
		for (var i=0; i<elems.length; i++) {
			var txt=getPlainText(elems[i]).trim();
			var link=this.linkFormat.format([txt]);
			switch(elems[i].nodeName) {
				case 'H1': out.push('#'+link);		level=1; break;
				case 'H2': out.push('##'+link);		level=level<2?level:2; break;
				case 'H3': out.push('###'+link);	level=level<3?level:3; break;
				case 'H4': out.push('####'+link);	level=level<4?level:4; break;
				case 'H5': out.push('#####'+link);	level=level<5?level:5; break;
				default: if (hasClass(elems[i],targetClass)) var target=elems[i];
			}
		}
		// trim excess bullet levels
		if (level>1) for (var i=0; i<out.length; i++) out[i]=out[i].substr(level-1);
		// show numbered list
		if (out.length && target) {
			if (target.style.display=='none') target.style.display='block';
			wikify(out.join('\n'),target);
		}
	}
}
//}}}
/***
!!!Invoke macro
{{{
<<sectionTOC>>
}}}
***/
// //<<sectionTOC>>
/***

!!!!!Documentation
>see [[SetIconPluginInfo]]
!!!!!Configuration
<<<
<<option chkIconsShowImage>> show images on links
<<option chkIconsShowText>> include link text with images
default image style: {{stretch{<<option txtIconsCSS>>}}}
<<<
!!!!!Revisions
<<<
2008.05.11 [1.8.0] added optional 'notext' value for iconpos to force text to be hidden for specific links
| see [[SetIconPluginInfo]] for additional revision details |
2008.05.09 [1.0.0] initial release (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.SetIconPlugin= {major: 1, minor: 8, revision: 0, date: new Date(2008,5,11)};

if (config.options.chkIconsShowImage===undefined)
	config.options.chkIconsShowImage=true;
if (config.options.chkIconsShowText===undefined)
	config.options.chkIconsShowText=true;
if (config.options.txtIconsCSS===undefined)
	config.options.txtIconsCSS="vertical-align:middle;width:auto;height:auto";

config.macros.setIcon = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if (!config.options.chkIconsShowImage) return; // text-only - do nothing
		if (!params[0]) return; // no image src specified - do nothing

		// find nearest link element
		var btn=place.lastChild; // look for sibling link
		while (btn && btn.nodeName!="A") btn=btn.previousSibling;
		if (!btn) { // look for child link
			var links=place.getElementsByTagName("A");
			if (links.length) btn=links[links.length-1];
		}
		if (!btn) { // look for parent link
			var btn=place.parentNode.lastChild;
			while (btn && btn.nodeName!="A") btn=btn.previousSibling;
		}
		if (!btn) { // look for cousin link
			var links=place.parentNode.getElementsByTagName("A");
			if (links.length) btn=links[links.length-1];
		}
		if (!btn) return; // can't find a link - do nothing

		// set icon and command text/tip
		var txt=btn.innerHTML;
		var src=params[0];  // default to direct URL
		if (config.macros.attach && config.macros.attach.isAttachment(src))
			src=config.macros.attach.getAttachment(src); // retrieve attachment (if any)
		var css=params[1]; if (!css||!css.length) css=config.options.txtIconsCSS;
		var after=params[2]&&params[2].toUpperCase()=="RIGHT";
		var notext=params[2]&&params[2].toUpperCase()=="NOTEXT";
		btn.innerHTML="<img src='"+src+"' style='"+css+"'>";
		if (config.options.chkIconsShowText && !notext)
			btn.innerHTML=after?txt+btn.innerHTML:btn.innerHTML+txt;
		else
			btn.title=txt.toUpperCase()+": "+btn.title; // add text to tooltip

		// adjust nested slider button text/tip
		if (btn.getAttribute("closedtext")!=null) {
			btn.setAttribute("closedtext",btn.innerHTML);
			btn.setAttribute("openedtext",btn.innerHTML);
			if (!config.options.chkIconsShowText || notext) {
				btn.setAttribute("closedtip",txt.toUpperCase()+": "+btn.getAttribute("closedtip"));
				btn.setAttribute("openedtip",txt.toUpperCase()+": "+btn.getAttribute("openedtip"));
			}
		}
	}
};
//}}}
/%
!info

Usage
<<<
{{{
<<tiddler ShowAge with: startdate enddate>>
}}}
*''startdate''<br>starting date, using any javascript-recognized date format, such as ''YYYY/MM/DD'' ("1962/07/24"), or ''MM/DD/YYY'' ("07/24/1962"), or ''Month DD, YYY'' ("July 24, 1962").  Use keyword ''today'' for the current date.
*''enddate'' (optional, default=''"today"'')<br>ending date, using javascript-recognized date format
Note: the elapsed date calculation uses an //averaged// 30.4 days/month.  For dates greater than one month apart, the resulting number of elapsed //days// may be only approximate.
<<<
Examples
<<<
*{{{This tiddler is <<tiddler ShowAge with: "2009/10/23">> old}}}<br>This tiddler is <<tiddler ShowAge##show with: "2009/10/23">> old
*{{{Eric is <<tiddler ShowAge with: "July 24, 1962">> old}}}<br>Eric is <<tiddler ShowAge##show with: "July 24, 1962">> old
*{{{There are <<tiddler ShowAge with: "today" "January 1, 2100">> until the next century}}}<br>There are <<tiddler ShowAge##show with: "today" "January 1, 2100">> until the next century
<<<
!end

!show
<<tiddler ShowAge##out with: {{
	var out=[];
	var start=new Date(); if ('$1'!='$'+'1' && '$1'!='today') start=new Date('$1');
	var end  =new Date(); if ('$2'!='$'+'2' && '$2'!='today') end  =new Date('$2');
	var hs=3600000; var ds=24*hs; var ms=30.4*ds; var ys=365*ds;
	var age=end.getTime()-start.getTime();
	var y=Math.floor(age/ys);
	var m=Math.floor((age-y*ys)/ms);
	var d=Math.floor((age-y*ys-m*ms)/ds)+1;
	if (y) out.push(y+' anneau' +(y>1?'x':''));
	if (m) out.push(m+' lune'+(m>1?'s':''));
	if (d) out.push(d+' soleil'  +(d>1?'s':''));
	if (!out.length) out.push('0 jours');
out.join(', ');}}>>
!out
$1
!end

%/<<tiddler {{var src='ShowAge'; src+(tiddler&&tiddler.title==src?'##info':'##show');}}
	with: [[$1]] [[$2]]>>
/***

!!!!!Documenatation
>see [[ShowPopupPluginInfo]]
!!!!!Revisions
<<<
2011.03.13 2.1.1 in click(), removed check for popup already shown (prevents nested popups!)
| Please see [[ShowPopupPluginInfo]] for previous revision details |
2006.09.09 1.0.0 initial release (transclusion)
<<<
!!!!!Code
***/
//{{{
version.extensions.ShowPopupPlugin=
	{ major:2, minor:1, revision:1, date:new Date(2011,3,13) };
config.macros.showPopup = {
	tip: 'affiche "%0"',
	init: function() {
		config.shadowTiddlers.ShowPopup =
			'<<showPopup tiddler:[[$1]] label:"$2" tip:"$3" buttonClass:"button $4" width:"$5" popupClass:"$6" "$7">>';
		config.annotations.ShowPopup =
			'created by ShowPopupPlugin';
	},
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var p=paramString.parseParams('name',null,true,false,true);
		var tid=getParam(p,'tiddler','TiddlerName');
		var label=getParam(p,'label',tid);
		var tip=getParam(p,'tip',this.tip.format([tid]));
		var buttonClass=getParam(p,'buttonClass','');
		var width=getParam(p,'width','auto');
		var popupClass=getParam(p,'popupClass','');
		var above=params.contains('above');
		var mouseover=params.contains('mouseover');
		var b=createTiddlyButton(place, label, tip, this.click, buttonClass, null, null,
			{ tid:tid, popupClass:popupClass, width:width, above:above });
		b.innerHTML=label; // render HTML for entities, images, etc
		if (mouseover) b.onmouseover=b.onclick;  // option: mouseover triggers click
	},
	click: function(ev) { var ev=ev||window.event;
		// DISABLED if (Popup.find(this)!=-1)return false; // popup already shown!
		var p=Popup.create(this); if(!p)return false; // popup not created!
		addClass(p,this.getAttribute('popupClass'));
		var d=createTiddlyElement(p,'div');
		var s=d.style; s.whiteSpace='normal'; s.width=this.getAttribute('width'); s.padding='2px';
		wikify(store.getTiddlerText(this.getAttribute('tid'),''),d);
		if (this.getAttribute('above')!='true') Popup.show();
		else Popup.show('top','left',{x:0,y:-jQuery(d).outerHeight()});
		ev.cancelBubble=true; if(ev.stopPropagation)ev.stopPropagation(); return false;
	}
}
//}}}
<<search>><<closeAll>><<permaview>><<newTiddler label:'papier' tag:'k'>><<newJournal label:'journal' "YYYY-0MM-0DD" tag:'journal''k'>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
+++[log]<<tiddler [[titre]]>>===
//dia//
/*{{{*/
.header, #mainMenu, #sidebar, #backstageButton, #backstageArea, .toolbar, .title, .subtitle, .tagging, .tagged, .tagClear, .comment{
 display:none !important
}

#slideBlanker{
 position: absolute;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 z-index: 90; 
 background-color: #000;
 opacity: 0.9;
 filter: alpha(opacity=90)
}

.nextOverlay{
 visibility: hidden
}

.previousOverlay,.currentOverlay{
 visibility: visible
}

#displayArea{
 font-size: 170%;
 margin: 0 !important;
 padding: 0
}

#controlBar{
 position: fixed;
 bottom: 2px;
 right: 2px;
 width: 100%;
 text-align: right
}

#controlBar .button{
 margin: 0 0.25em;
 padding: 0 0.25em
}

#slideHeader{
 font-size: 75%;
 font-weight: bold
}

#slideFooter{
 position: fixed;
 bottom: 2px
}

.slideFooterOff #navigator{
 visibility: hidden
}

#slideClock{
 margin: 0 5px 0 5px
}

#slideCounter{
 cursor: pointer;
 color: #aaa
}

#toc{
 display: none;
 position: absolute;
 font-size: .75em;
 bottom: 2em;
 right: 0;
 background: #fff;
 border: 1px solid #000;
 text-align: left
}

#jumpItem{
 padding-left:0.25em
}

#jumpInput{
 margin-left: 0.25em;
 width: 3em
}

.tocLevel1{
 font-size: .8em
}

.tocLevel2{
 margin-left: 1em;
 font-size: .75em
}

.tocLevel3{
 margin-left: 2em;
 font-size: .7em
}

.tocLevel4{
 margin-left: 3em;
 font-size: .65em
}

.tocLevel5{
 margin-left: 4em;
 font-size: .6em
}

.tocLevel6{
 margin-left: 5em;
 font-size: .55em
}
/*}}}*/
/***

This plugin provides a macro as well as tiddler toolbar commands to create a file or browser window containing the //rendered// CSS-and-HTML that is currently being displayed for selected elements of the current document.
!!!!!Documentation
>see [[SnapshotPluginInfo]]
!!!!!Configuration
<<<
<<option chkSnapshotHTMLOnly>> output HTML only (omit CSS)
<<<
!!!!!Revisions
<<<
2011.02.14 1.4.3 fix OSX error: use picker.file.path
2011.01.03 1.4.2 added snapshotSaveViewer toolbar command
2010.12.15 1.4.1 added 'snapshot' class to wrapper
|please see [[SnapshotPluginInfo]] for additional revision details|
2008.04.21 1.0.0 initial release - derived from [[NewDocumentPlugin]] with many improvements...
<<<
!!!!!Code
***/
//{{{
version.extensions.SnapshotPlugin= {major: 1, minor: 4, revision: 3, date: new Date(2011,2,14)};

if (config.options.chkSnapshotHTMLOnly===undefined)
	config.options.chkSnapshotHTMLOnly=false;

config.macros.snapshot = {
	snapLabel: "enregistrer une capture",
	printLabel: "imprimer une capture",
	snapPrompt: "enregistrer une image html",
	printPrompt: "imprimer une image html",
	hereID: "here",
	viewerID: "viewer",
	storyID: "story",
	allID: "all",
	askID: "ask",
	askTiddlerID: "askTiddler",
	askDOMID: "askDOM",
	askMsg: "choisir un élément...",
	hereItem: "papier: '%0'",
	viewerItem: "papier: '%0' (contenu seul)",
	storyItem: "colonne histoire (un fichier)",
	storyFilesItem: "colonne histoire (fichiers multiples)",
	allItem: "document entier",
	tiddlerItem: "choisir un papier...",
	IDItem: "choisir un élément DOM par ID...",
	HTMLItem: "[%0] sortie html seulement (sans CSS)",
	fileMsg: "choisir ou entrer un chemin de fichier",
	defaultFilename: "capture.html",
	okmsg: "capture écrite à %0",
	failmsg: "une erreur est apparue lors de la création de %0",
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var printing=params[0]&&params[0]=="print"; if (printing) params.shift();
		params = paramString.parseParams("anon",null,true,false,false);
		var id=getParam(params,"id","here");
		var label=getParam(params,"label",printing?this.printLabel:this.snapLabel);
		var prompt=getParam(params,"prompt",printing?this.printPrompt:this.snapPrompt);
		var btn=createTiddlyButton(place,label,prompt, function(ev){
			this.setAttribute("snapID",this.getAttribute("startID"));
			config.macros.snapshot.go(this,ev)
		});
		btn.setAttribute("startID",id);
		btn.setAttribute("snapID",id);
		btn.setAttribute("printing",printing?"true":"false");
		btn.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
	},
	go: function(here,ev) {
		var cms=config.macros.snapshot; // abbreviation
		var id=here.getAttribute("snapID");
		var printing=here.getAttribute("printing")=="true";
		var HTMLOnly=here.getAttribute("HTMLOnly")=="true";

		if (id==cms.askID||id==cms.askTiddlerID||id==cms.askDOMID) {
			cms.askForID(here,ev);
		} else if (id==cms.storyID) {
			story.forEachTiddler(function(t,e) {
				var out=cms.getsnap(e,e.id,printing,HTMLOnly);
				if (printing) cms.printsnap(out);
				else cms.savesnap(out,e.getAttribute('tiddler')+'.html');
			});
		} else {
			if (id==cms.allID) id="contentWrapper";
			var snapElem=document.getElementById(id);
			if (id==cms.hereID || id==cms.viewerID)
				var snapElem=story.findContainingTiddler(here);
			if (snapElem && hasClass(snapElem,"tiddler") && (id==cms.viewerID || HTMLOnly)) {
				// find viewer class element within tiddler element
				var nodes=snapElem.getElementsByTagName("*");
				for (var i=0; i<nodes.length; i++)
					if (hasClass(nodes[i],"viewer")) { snapElem=nodes[i]; break; }
			}
			if (!snapElem) // not in a tiddler or no viewer element or unknown ID
				{ e.cancelBubble=true; if(e.stopPropagation)e.stopPropagation(); return(false); }
			// write or print snapshot
			var out=cms.getsnap(snapElem,id,printing,HTMLOnly);
			if (printing) cms.printsnap(out); else cms.savesnap(out);
		}
		return false;
	},
	askForID: function(here,ev) {
		var ev = ev ? ev : window.event; 
		var cms=config.macros.snapshot; // abbreviation
		var id=here.getAttribute("snapID");
		var indent='\xa0\xa0\xa0\xa0';
		var p=Popup.create(here); if (!p) return false; p.className+=' sticky smallform';
		var s=createTiddlyElement(p,'select'); s.button=here;
		if (id==cms.askID) {
			s.options[s.length]=new Option(cms.askMsg,cms.askID);
			var tid=story.findContainingTiddler(here);
			if(tid) { 
				var title=tid.getAttribute("tiddler");
				if (here.getAttribute("HTMLOnly")!="true")
					s.options[s.length]=new Option(indent+cms.hereItem.format([title]),cms.hereID);
				s.options[s.length]=new Option(indent+cms.viewerItem.format([title]),cms.viewerID);
			}
			s.options[s.length]=new Option(indent+cms.tiddlerItem,cms.askTiddlerID);
			s.options[s.length]=new Option(indent+cms.IDItem,cms.askDOMID);
			s.options[s.length]=new Option(indent+cms.storyItem,"tiddlerDisplay");
			s.options[s.length]=new Option(indent+cms.storyFilesItem,cms.storyID);
			s.options[s.length]=new Option(indent+cms.allItem,"contentWrapper");
		}
		if (id==cms.askDOMID) {
			s.options[s.length]=new Option(cms.IDItem,cms.askDOMID);
			var elems=document.getElementsByTagName("*");
			var ids=[];
			for (var i=0;i<elems.length;i++)
				if (elems[i].id.length && elems[i].className!="animationContainer")
					ids.push(elems[i].id);
			ids.sort();
			for (var i=0;i<ids.length;i++) s.options[s.length]=new Option(indent+ids[i],ids[i]);
		}
		if (id==cms.askTiddlerID) {
			s.options[s.length]=new Option(cms.tiddlerItem,cms.askTiddlerID);
			var elems=document.getElementsByTagName("div");
			var ids=[];
			for (var i=0;i<elems.length;i++) { var id=elems[i].id;
				if (id.length && id.substr(0,story.idPrefix.length)==story.idPrefix && id!="tiddlerDisplay")
					ids.push(id);
			}
			ids.sort();
			for (var i=0;i<ids.length;i++) s.options[s.length]=new Option(indent+ids[i].substr(story.idPrefix.length),ids[i]);
		}
		s.options[s.length]=new Option(cms.HTMLItem.format([here.getAttribute("HTMLOnly")=="true"?"\u221a":"_"]),cms.HTMLItem);
		s.onchange=function(ev){
			var ev = ev ? ev : window.event; 
			var cms=config.macros.snapshot; // abbreviation
			var here=this.button;
			if (this.value==cms.HTMLItem) {
				config.options.chkSnapshotHTMLOnly=!config.options.chkSnapshotHTMLOnly;
				here.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
				config.macros.option.propagateOption("chkSnapshotHTMLOnly","checked",
					config.options.chkSnapshotHTMLOnly,"input");
			} else
				here.setAttribute("snapID",this.value);
			config.macros.snapshot.go(here,ev);
			return false;
		};
		Popup.show();
		ev.cancelBubble=true;
		if(ev.stopPropagation)ev.stopPropagation();
		return false;
	},
	getpath: function() {
		// get current path
		var path=getLocalPath(window.location.href);
		var slashpos=path.lastIndexOf("/");
		if (slashpos==-1) slashpos=path.lastIndexOf("\\"); 
		if (slashpos!=-1) path=path.substr(0,slashpos+1); // trim filename
		return path;
	},
	getsnap: function(snapElem,id,printing,HTMLOnly) {
		var cms=config.macros.snapshot; // abbreviation
		var out='<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />';
		if (printing)
			out+='<base href="file:///'+cms.getpath().replace(/\\/g,'/')+'"></base>\n';
		if (!HTMLOnly) {
			var styles=document.getElementsByTagName('style');
			var fmt='<style>\n/* stylesheet=%0 */\n%1\n\n</style>\n';
			for(var i=0; i < styles.length; i++)
				out+=fmt.format([styles[i].getAttribute('id'),styles[i].innerHTML]);
		}
		out+='</head>\n';

		var elems=snapElem.getElementsByTagName('input');
		for (var i=0; i<elems.length; i++) { var e=elems[i];
			if (e.type=='text')		e.defaultValue=e.value;
			if (e.type=='checkbox')	 	e.defaultChecked=e.checked;
			if (e.type=='radiobutton')	e.defaultChecked=e.checked;
		}
		var elems=snapElem.getElementsByTagName('textarea');
		for (var i=0; i<elems.length; i++)	elems[i].defaultValue=elems[i].value;

		var fmt='<body>\n\n<div class="snapshot %0">%1</div>\n\n</body>\n';
		out+=fmt.format([(id==cms.viewerID?'tiddler viewer':''),snapElem.innerHTML]);

		return '<html>\n'+out+'</html>';
	},
	printsnap: function(out) {
		var win=window.open("","_blank","");
		win.document.open();
		win.document.writeln(out);
		win.document.close();
		win.focus(); // bring to front
		win.print(); // trigger print dialog
	},
	savesnap: function(out,target) {
		var cms=config.macros.snapshot; // abbreviation
		// make sure we are local
		if (window.location.protocol!="file:")
			{ alert(config.messages.notFileUrlError); return; }
		var target=target||cms.askForFilename(cms.fileMsg,cms.getpath(),cms.defaultFilename);
		if (!target) return; // cancelled by user
		// if specified file does not include a path, assemble fully qualified path and filename
		var slashpos=target.lastIndexOf("/"); if (slashpos==-1) slashpos=target.lastIndexOf("\\");
		if (slashpos==-1) {
			var h=document.location.href;
			var cwd=getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf('/')+1)));
			target=cwd+target;
		}
		var link="file:///"+target.replace(/\\/g,'/'); // link for message text
		var ok=saveFile(target,convertUnicodeToUTF8(out));
		var msg=ok?cms.okmsg.format([target]):cms.failmsg.format([target]);
		displayMessage(msg,link);
	},
	askForFilename: function(msg,path,file) {
		if(window.Components) { // moz
			try {
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
				var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
				var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
				picker.init(window, msg, nsIFilePicker.modeSave);
				var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
				thispath.initWithPath(path);
				picker.displayDirectory=thispath;
				picker.defaultExtension='html';
				picker.defaultString=file;
				picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
				if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.path;
			}
			catch(e) { alert('error during local file access: '+e.toString()) }
		}
		else { // IE
			try { // XP/Vista only
				var s = new ActiveXObject('UserAccounts.CommonDialog');
				s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
				s.FilterIndex=3; // default to HTML files;
				s.InitialDir=path;
				s.FileName=file;
				if (s.showOpen()) var result=s.FileName;
			}
			catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
		}
		return result;
	}
};
//}}}

// // TOOLBAR DEFINITIONS
//{{{
config.commands.snapshotSave = {
	text: "snap",
	tooltip: config.macros.snapshot.snapPrompt,
	handler: function(ev,src,title) {
		src.setAttribute("snapID","ask");
		src.setAttribute("printing","false");
		src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
		config.macros.snapshot.go(src,ev);
		return false;
	}
};
config.commands.snapshotSaveViewer = {
	text: "snap",
	tooltip: config.macros.snapshot.snapPrompt,
	handler: function(ev,src,title) {
		src.setAttribute("snapID","viewer");
		src.setAttribute("printing","false");
		src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
		config.macros.snapshot.go(src,ev);
		return false;
	}
};
config.commands.snapshotPrint = {
	text: "imprimer",
	tooltip: config.macros.snapshot.printPrompt,
	handler: function(ev,src,title) {
		src.setAttribute("snapID","ask");
		src.setAttribute("printing","true");
		src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
		config.macros.snapshot.go(src,ev);
		return false;
	}
};
config.commands.snapshotPrintViewer = {
	text: "imprimer",
	tooltip: config.macros.snapshot.printPrompt,
	handler: function(ev,src,title) {
		src.setAttribute("snapID","viewer");
		src.setAttribute("printing","true");
		src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
		config.macros.snapshot.go(src,ev);
		return false;
	}
};
//}}}

// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
	// if click is in a sticky popup, ignore it so popup will remain visible
	var e = ev ? ev : window.event; var target = resolveTarget(e);
	var p=target; while (p) {
		if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
		else p=p.parentNode;
	}
	if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
		Popup.onDocumentClick(ev);
	return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/***

!Usage
{{{
<<sparkline numbers>>
}}}
The macro accepts space-separated numeric values as parameter.
!!Examples
Activity on http://www.tiddlywiki.com during the month of April 2005:
{{{<<sparkline 163 218 231 236 232 266 176 249 289 1041 1835 2285 3098 2101 1755 3283 3353 3335 2898 2224 1404 1354 1825 1839 2142 1942 1784 1145 979 1328 1611>>}}}
<<sparkline 163 218 231 236 232 266 176 249 289 1041 1835 2285 3098 2101 1755 3283 3353 3335 2898 2224 1404 1354 1825 1839 2142 1942 1784 1145 979 1328 1611>>
!Code
***/
//{{{
if(!version.extensions.SparklinePlugin) {
version.extensions.SparklinePlugin = {installed:true};

//--
//-- Sparklines
//--

config.macros.sparkline = {};
config.macros.sparkline.handler = function(place,macroName,params)
{
	var data = [];
	var min = 0;
	var max = 0;
	var v;
	for(var t=0; t<params.length; t++) {
		v = parseInt(params[t]);
		if(v < min)
			min = v;
		if(v > max)
			max = v;
		data.push(v);
	}
	if(data.length < 1)
		return;
	var box = createTiddlyElement(place,"span",null,"sparkline",String.fromCharCode(160));
	box.title = data.join(",");
	var w = box.offsetWidth;
	var h = box.offsetHeight;
	box.style.paddingRight = (data.length * 2 - w) + "px";
	box.style.position = "relative";
	for(var d=0; d<data.length; d++) {
		var tick = document.createElement("img");
		tick.border = 0;
		tick.className = "sparktick";
		tick.style.position = "absolute";
		tick.src = "data:image/gif,GIF89a%01%00%01%00%91%FF%00%FF%FF%FF%00%00%00%C0%C0%C0%00%00%00!%F9%04%01%00%00%02%00%2C%00%00%00%00%01%00%01%00%40%02%02T%01%00%3B";
		tick.style.left = d*2 + "px";
		tick.style.width = "2px";
		v = Math.floor(((data[d] - min)/(max-min)) * h);
		tick.style.top = (h-v) + "px";
		tick.style.height = v + "px";
		box.appendChild(tick);
	}
};


}
//}}}
/***

Usually, when a TW popup is displayed, it is automatically closed whenever a click occurs //anywhere// in the document, either //inside// or //outside// the popup itself.  This plugin makes popups persistent (a.k.a, "sticky"), allowing you to perform multiple mouse interactions on content //inside// the popup (e.g., entering form fields, opening links, selecting text, etc.), remaining visible until you click //outside// the popup or perform an action that opens another popup (only one popup can be displayed at any given time).
!!!!!Configuration
<<<
You can cause popups to behave in a persistent ("sticky") manner simply by selecting the option checkbox below.  The selected popup display behavior will be applied to ALL popups in the document automatically.
><<option chkStickyPopups>> make all popups "sticky"
>{{{usage: <<option chkStickyPopups>>}}}
<<<
!!!!!Usage
<<<
If you are developing your own plugins or inline scripts that create popups programmatically using the core function:
{{{
Popup.create(this)
}}}
you can provide additional parameters that specify the desired CSS classname(s) to assign to the popup DOM element.  The default class when none is specified is simply "popup".  To create a //sticky// popup, simply enter a custom class combination like this:
{{{
Popup.create(this,null,"sticky popup")
}}}
<<<
!!!!!Revisions
<<<
2008.05.16 [1.0.1] added try..catch around addEvent/removeEvent calls to avoid error in Opera
2007.11.25 [1.0.0] initial release - moved from [[CoreTweaks]]
<<<
!!!!!Code
***/
//{{{
version.extensions.StickyPopupPlugin= {major: 1, minor: 0, revision: 1, date: new Date(2008,5,16)};

if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;

Popup.stickyPopup_onDocumentClick = function(ev)
{
	// if click is in a sticky popup, ignore it so popup will remain visible
	var e = ev ? ev : window.event; var target = resolveTarget(e);
	var p=target; while (p) {
		if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
		else p=p.parentNode;
	}
	if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
		Popup.onDocumentClick(ev);
	return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/***

Automatically save a list of currently viewed tiddlers (the 'story') in a local cookie, {{{txtSavedStory}}} and then open those tiddlers when the document is reloaded, so you can resume working from the same place you left off!!  Also, use {{{<<saveStory>>}}} and {{{<<openStory>>}}} macros to quickly save/re-display stories stored in tiddlers, using a command link, droplist, or popup display.
!!!!!Documentation
>see [[StorySaverPluginInfo]]
!!!!!Configuration
<<<
<<option chkSaveStory>> use automatic story cookie (reopens tiddlers on startup)
<<option chkStoryAllowAdd>>include 'add a story' command in droplist/popup
<<option chkStoryFold>>fold story tiddlers when opening a story (see [[CollapseTiddlersPlugin]])
<<option chkStoryClose>>close other tiddlers when opening a story
<<option chkStoryTop>>open story tiddlers at top of column
<<option chkStoryBottom>>open story tiddlers at bottom of column
<<<
!!!!!Revisions
<<<
2009.10.20 1.8.3 fix handling for 'add' item in popup menu
|please see [[StorySaverPluginInfo]] for additional revision details|
2007.10.05 1.0.0 initial release. Moved [[SetDefaultTiddlers]] inline script and rewrote as a {{{<<saveStory>>}}} macro.
<<<
!!!!!Code
***/
//{{{
version.extensions.StorySaverPlugin= {major: 1, minor: 8, revision: 3, date: new Date(2009,10,20)};

var defaults={
	chkSaveStory:		false,
	chkStoryFold:		true,
	chkStoryClose:		true,
	chkStoryAllowAdd:	true,
	chkStoryTop:		true,
	chkStoryBottom:		false
};
for (var id in defaults) if (config.options[id]===undefined)
	config.options[id]=defaults[id];

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

// save or clear story cookie on exit
if (window.coreTweaks_confirmExit==undefined) {
	window.coreTweaks_confirmExit=window.confirmExit;
	window.confirmExit=function() {
		if (config.options.chkSaveStory) { // save cookie
			var links=[];
			story.forEachTiddler(function(title,element){links.push('<<tiddlerIcons "='+title+'">> <<tiddler [['+title+']]>>');});
			config.options.txtSavedStory=links.join(' ');
			saveOptionCookie('txtSavedStory');
		} else removeCookie('txtSavedStory');
		return window.coreTweaks_confirmExit.apply(this,arguments);
	}
}
//}}}
/***
''apply saved story on startup:'' //important note: the following code is actually located in [[MarkupPostBody]].  This is because it needs to supercede the core's getParameters() function, which is called BEFORE plugins are loaded, preventing the normal plugin-based hijack method from working, while code loaded into [[MarkupPostBody]] will be processed as soon as the document is read, even before the TW main() function is invoked.//
<<tiddler MarkupPostBody>>
***/
//{{{
config.macros.saveStory = {
	label: 'papiers par défaut',
	defaultTiddler: 'FuniculaireDuLivre',
	prompt: 'grave une liste de papiers actuellement ouverts sur un autre papier',
	askMsg: 'Saisir le nom du papier qui recevra le funiculaire:',
	tag: 'story',
	excludeTag: 'excludeStory',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var tid=params.shift()||'DefaultTiddlers';
		var label=params.shift()||this.label;
		var tip=params.shift()||this.prompt;
		var btn=createTiddlyButton(place,label,tip,this.setTiddler,'button');
		btn.setAttribute('tid',tid);
		btn.setAttribute('extratags','[['+params.join(']] [[')+']]');
	},
	setTiddler: function() {
		var cms=config.macros.saveStory; // abbrev
		// get list of current open tiddlers
		var tids=[];
		story.forEachTiddler(function(title,element){
			var t=store.getTiddler(title);
			if (!t || !t.isTagged(cms.excludeTag)) tids.push('<<tiddlerIcons "='+title+'">> <<tiddler [['+title+']]>>');
		});
		// get target tiddler
		var tid=this.getAttribute('tid');
		if (!tid || tid=='ask') {
			tid=prompt(cms.askMsg,cms.defaultTiddler);
			if (!tid || !tid.length) return false; // cancelled by user
		}
		if(store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid])))
			return false;
		tids=tids.join('\n');
		var t=store.getTiddler(tid); var tags=t?t.tags:[];
		var extratags=(this.getAttribute('extratags')||'').readBracketedList();
		for (var i=0; i<extratags.length; i++) tags.pushUnique(extratags[i]);
		tags.pushUnique(cms.tag);
		store.saveTiddler(tid,tid,tids,config.options.txtUserName,new Date(),tags,t?t.fields:null);
		story.displayTiddler(null,tid);
		story.refreshTiddler(tid,null,true);
		displayMessage(tid+' a été '+(t?'mis à jour':'créé'));
		return false;
	}
}
//}}}
//{{{
config.macros.openStory = {
	label: 'open story: %0',
	prompt: 'ouvrir les papiers en liste dans: %0',
	popuplabel: 'story',
	popupprompt: 'afficher le funiculaire',
	tag: 'story',
	selectprompt: 'choisir un funiculaire',
	optionsprompt: 'options affichage',
	foldcmd: '[%0] plier le funiculaire',
	foldprompt: 'plier les papiers avant ouverture du funiculaire',
	closecmd: '[%0] fermer les autres',
	closeprompt: 'fermer les autres papiers quand un un funiculaire doit être ouvert',
	topcmd: '[%0] ouvrir en tête',
	topprompt: 'ouvrir les papiers en tête de liste',
	bottomcmd: '[%0] ouvrir en queue',
	bottomprompt: 'ouvrir les papiers en queue de liste',
	addcmd: 'ajouter un funiculaire',
	addprompt: 'créer un nouveau funiculaire',
	excludeTag: 'excludeStory',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if (params[0].toLowerCase()=='list') return this.createList(place,params);
		else if (params[0].toLowerCase()=='popup') return this.createPopup(place,params);
		else this.createButton(place,params);
	},
	showStory: function(tid,fold) {
		var co=config.options; // abbrev
		var tids=[];
		var t=store.getTiddler(tid);
		var tagged=store.getTaggedTiddlers(tid,'title');
		if (tagged.length) // if tiddler IS a tag, use tagged tiddlers as story
			for (var i=0; i<tagged.length; i++) tids.push(tagged[i].title);
		else if (t) { // get tiddler list from content
			if (!t.linksUpdated) t.changed();
			for (var i=0; i<t.links.length; i++) {
				var tid=store.getTiddler(t.links[i]);
				if (tid && !tid.isTagged(this.excludeTag))
					tids.push(t.links[i]);
			}
		}
		var template=null;
		if (fold||co.chkStoryFold) template='CollapsedTemplate'; // see [[CollapseTiddlersPlugin]]
		if (!store.tiddlerExists('CollapsedTemplate')) template=null;
		if (co.chkStoryClose) story.closeAllTiddlers();
		var pos='top'; var first=tids[0];
		if (!story.isEmpty() && co.chkStoryBottom) { pos='bottom'; tids=tids.reverse(); }
		story.displayTiddlers(pos,tids,template);
		var cmd='var t=story.getTiddler("'+first+'");if(t)window.scrollTo(0,t.offsetTop);';
		var delay=config.options.chkAnimate?config.animDuration+100:0;
		setTimeout(cmd,delay);
	},
	createButton: function(place,params) {
		var tid=params[0]||'';
		var label=params[1]||this.label; label=label.format([tid]);
		var tip=params[2]||this.prompt; tip=tip.format([tid]);
		var fold=(params[3]&&(params[3].toLowerCase()=='fold'))||config.options.chkStoryFold;
		var fn=function(){config.macros.openStory.showStory(this.getAttribute('tid'),this.getAttribute('fold')); return false; };
		var btn=createTiddlyButton(place,label,tip,fn,'button');
		btn.setAttribute('tid',tid);
		if (fold) btn.setAttribute('fold',fold);
	},
	createPopup: function(place,params) {
		params.shift(); // discard 'popup' keyword
		var label=params.shift()||this.popuplabel;
		var tip=params.shift()||this.popupprompt;
		var btn=createTiddlyButton(place,label,tip,this.showPopup,'button');
		btn.setAttribute('filter',params.shift()||config.macros.openStory.tag);
	},
	showPopup: function(ev) { var e=ev||window.event;
		var co=config.options; // abbrev
		var cmo=config.macros.openStory; // abbrev
		var indent='\xa0\xa0';
		var p=Popup.create(this); if (!p) return false;
		createTiddlyText(createTiddlyElement(p,'li'),cmo.selectprompt);
		var stories=store.filterTiddlers('[tag['+this.getAttribute('filter')+']]');
		for (var s=0; s<stories.length; s++) {
			var label=indent+stories[s].title;
			var tip=cmo.prompt.format([stories[s].title]);
			var fn=function(){config.macros.openStory.showStory(this.getAttribute('tid'));return false;};
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
			btn.setAttribute('tid',stories[s].title);
		}
		createTiddlyText(createTiddlyElement(p,'li'),cmo.optionsprompt);
		if (store.tiddlerExists('CollapsedTemplate')) {
			var label=indent+cmo.foldcmd.format([co.chkStoryFold?'x':'\xa0\xa0']);
			var tip=cmo.foldprompt;
			var fn=function(){ config.macros.option.propagateOption(
				'chkStoryFold','checked',!config.options.chkStoryFold,'input'); return false; };
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		}
		var label=indent+cmo.closecmd.format([co.chkStoryClose?'x':'\xa0\xa0']);
		var tip=indent+cmo.closeprompt;
		var fn=function(){ config.macros.option.propagateOption(
			'chkStoryClose','checked',!config.options.chkStoryClose,'input'); return false; };
		var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		if (!co.chkStoryClose) {
			var label=indent+cmo.topcmd.format([co.chkStoryTop?'x':'\xa0\xa0']);
			var tip=indent+cmo.topprompt;
			var fn=function(){
				config.macros.option.propagateOption(
					'chkStoryTop','checked',!config.options.chkStoryTop,'input');
				config.macros.option.propagateOption(
					'chkStoryBottom','checked',!config.options.chkStoryTop,'input');
				return false;
			};
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
			var label=indent+cmo.bottomcmd.format([co.chkStoryBottom?'x':'\xa0\xa0']);
			var tip=indent+cmo.botprompt;
			var fn=function(){
				config.macros.option.propagateOption(
					'chkStoryBottom','checked',!config.options.chkStoryBottom,'input');
				config.macros.option.propagateOption(
					'chkStoryTop','checked',!config.options.chkStoryBottom,'input');
				return false;
			};
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		}
		if (!readOnly && co.chkStoryAllowAdd) {
			var label=cmo.addcmd;
			var tip=cmo.addprompt;
			var fn=config.macros.saveStory.setTiddler;
			createTiddlyElement(createTiddlyElement(p,'li'),'hr');
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		}
		Popup.show();
		e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();
		return false;
	},
	createList: function(place,params) {
		var cmo=config.macros.openStory; // abbrev
		var s=createTiddlyElement(place,'select',null,'storyListbox');
		s.size=1;
		s.onchange=function() {
			if (this.value=='_fold') {
				config.macros.option.propagateOption('chkStoryFold','checked',
					!config.options.chkStoryFold,'input');
				cmo.refreshList();
			} else if (this.value=='_close') {
				config.macros.option.propagateOption('chkStoryClose','checked',
					!config.options.chkStoryClose,'input');
				cmo.refreshList();
			} else if (this.value=='_top') {
				config.macros.option.propagateOption('chkStoryTop','checked',
					!config.options.chkStoryTop,'input');
				cmo.refreshList();
			} else if (this.value=='_bottom') {
				config.macros.option.propagateOption('chkStoryBottom','checked',
					!config.options.chkStoryBottom,'input');
				cmo.refreshList();
			} else if (this.value=='_add')
				config.macros.saveStory.setTiddler.apply(this,arguments);
			else cmo.showStory(this.value);
		}
		params.shift(); // discard 'list' keyword
		s.setAttribute('filter',params.shift()||cmo.tag);
		setStylesheet('.storyListbox { width:100%; }', 'StorySaverStyles');
		store.addNotification(null,this.refreshList); this.refreshList();
		return;
	},
	refreshList: function() {
		var cmo=config.macros.openStory; // abbrev
		var indent='\xa0\xa0\xa0\xa0';
		var lists=document.getElementsByTagName('select');
		for (var i=0; i<lists.length; i++) { if (lists[i].className!='storyListbox') continue;
			var here=lists[i];
			var stories=store.filterTiddlers('[tag['+here.getAttribute('filter')+']]');
			while (here.length) here.options[0]=null; // remove current list items
			here.options[here.length]=new Option(cmo.selectprompt,'',true,true);
			for (var s=0; s<stories.length; s++)
				here.options[here.length]=new Option(indent+stories[s].title,stories[s].title);
			if (!readOnly && config.options.chkStoryAllowAdd)
				here.options[here.length]=new Option(cmo.addcmd,'_add');
			here.options[here.length]=new Option(cmo.optionsprompt,'');
			if (store.tiddlerExists('CollapsedTemplate')) {
				var msg=cmo.foldcmd.format([config.options.chkStoryFold?'x':'\xa0\xa0']);
				here.options[here.length]=new Option(indent+msg,'_fold');
			}
			var msg=cmo.closecmd.format([config.options.chkStoryClose?'x':'\xa0\xa0']);
			here.options[here.length]=new Option(indent+msg,'_close',false,false);
			if (!config.options.chkStoryClose) {
				var msg=cmo.topcmd.format([config.options.chkStoryTop?'x':'\xa0\xa0']);
				here.options[here.length]=new Option(indent+msg,'_top',false,false);
				var msg=cmo.bottomcmd.format([config.options.chkStoryBottom?'x':'\xa0\xa0']);
				here.options[here.length]=new Option(indent+msg,'_bottom',false,false);
			}
		}
	}
}
//}}}
/***

Automatically save a list of currently viewed tiddlers (the 'story') in a local cookie, {{{txtSavedStory}}} and then open those tiddlers when the document is reloaded, so you can resume working from the same place you left off!!  Also, use {{{<<saveStory>>}}} and {{{<<openStory>>}}} macros to quickly save/re-display stories stored in tiddlers, using a command link, droplist, or popup display.
!!!!!Documentation
>see [[StorySaverPluginInfo]]
!!!!!Configuration
<<<
<<option chkSaveStory>> use automatic story cookie (reopens tiddlers on startup)
<<option chkStoryAllowAdd>>include 'add a story' command in droplist/popup
<<option chkStoryFold>>fold story tiddlers when opening a story (see [[CollapseTiddlersPlugin]])
<<option chkStoryClose>>close other tiddlers when opening a story
<<option chkStoryTop>>open story tiddlers at top of column
<<option chkStoryBottom>>open story tiddlers at bottom of column
<<<
!!!!!Revisions
<<<
2009.10.20 1.8.3 fix handling for 'add' item in popup menu
|please see [[StorySaverPluginInfo]] for additional revision details|
2007.10.05 1.0.0 initial release. Moved [[SetDefaultTiddlers]] inline script and rewrote as a {{{<<saveStory>>}}} macro.
<<<
!!!!!Code
***/
//{{{
version.extensions.StorySaverPlugin= {major: 1, minor: 8, revision: 3, date: new Date(2009,10,20)};

var defaults={
	chkSaveStory:		false,
	chkStoryFold:		true,
	chkStoryClose:		true,
	chkStoryAllowAdd:	true,
	chkStoryTop:		true,
	chkStoryBottom:		false
};
for (var id in defaults) if (config.options[id]===undefined)
	config.options[id]=defaults[id];

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

// save or clear story cookie on exit
if (window.coreTweaks_confirmExit==undefined) {
	window.coreTweaks_confirmExit=window.confirmExit;
	window.confirmExit=function() {
		if (config.options.chkSaveStory) { // save cookie
			var links=[];
			story.forEachTiddler(function(title,element){links.push('<<tiddlerIcons "='+title+'">> [['+title+']]');});
			config.options.txtSavedStory=links.join(' ');
			saveOptionCookie('txtSavedStory');
		} else removeCookie('txtSavedStory');
		return window.coreTweaks_confirmExit.apply(this,arguments);
	}
}
//}}}
/***
''apply saved story on startup:'' //important note: the following code is actually located in [[MarkupPostBody]].  This is because it needs to supercede the core's getParameters() function, which is called BEFORE plugins are loaded, preventing the normal plugin-based hijack method from working, while code loaded into [[MarkupPostBody]] will be processed as soon as the document is read, even before the TW main() function is invoked.//
<<tiddler MarkupPostBody>>
***/
//{{{
config.macros.saveStory = {
	label: 'papiers par défaut',
	defaultTiddler: 'FuniculaireDuLivre',
	prompt: 'grave une liste de papiers actuellement ouverts sur un autre papier',
	askMsg: 'Saisir le nom du papier qui recevra le funiculaire:',
	tag: 'story',
	excludeTag: 'excludeStory',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var tid=params.shift()||'DefaultTiddlers';
		var label=params.shift()||this.label;
		var tip=params.shift()||this.prompt;
		var btn=createTiddlyButton(place,label,tip,this.setTiddler,'button');
		btn.setAttribute('tid',tid);
		btn.setAttribute('extratags','[['+params.join(']] [[')+']]');
	},
	setTiddler: function() {
		var cms=config.macros.saveStory; // abbrev
		// get list of current open tiddlers
		var tids=[];
		story.forEachTiddler(function(title,element){
			var t=store.getTiddler(title);
			if (!t || !t.isTagged(cms.excludeTag)) tids.push('<<tiddlerIcons "='+title+'">> [['+title+']]');
		});
		// get target tiddler
		var tid=this.getAttribute('tid');
		if (!tid || tid=='ask') {
			tid=prompt(cms.askMsg,cms.defaultTiddler);
			if (!tid || !tid.length) return false; // cancelled by user
		}
		if(store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid])))
			return false;
		tids=tids.join('\n');
		var t=store.getTiddler(tid); var tags=t?t.tags:[];
		var extratags=(this.getAttribute('extratags')||'').readBracketedList();
		for (var i=0; i<extratags.length; i++) tags.pushUnique(extratags[i]);
		tags.pushUnique(cms.tag);
		store.saveTiddler(tid,tid,tids,config.options.txtUserName,new Date(),tags,t?t.fields:null);
		story.displayTiddler(null,tid);
		story.refreshTiddler(tid,null,true);
		displayMessage(tid+' a été '+(t?'mis à jour':'créé'));
		return false;
	}
}
//}}}
//{{{
config.macros.openStory = {
	label: 'open story: %0',
	prompt: 'ouvrir les papiers en liste dans: %0',
	popuplabel: 'story',
	popupprompt: 'afficher le funiculaire',
	tag: 'story',
	selectprompt: 'choisir un funiculaire',
	optionsprompt: 'options affichage',
	foldcmd: '[%0] plier le funiculaire',
	foldprompt: 'plier les papiers avant ouverture du funiculaire',
	closecmd: '[%0] fermer les autres',
	closeprompt: 'fermer les autres papiers quand un un funiculaire doit être ouvert',
	topcmd: '[%0] ouvrir en tête',
	topprompt: 'ouvrir les papiers en tête de liste',
	bottomcmd: '[%0] ouvrir en queue',
	bottomprompt: 'ouvrir les papiers en queue de liste',
	addcmd: 'ajouter un funiculaire',
	addprompt: 'créer un nouveau funiculaire',
	excludeTag: 'excludeStory',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if (params[0].toLowerCase()=='list') return this.createList(place,params);
		else if (params[0].toLowerCase()=='popup') return this.createPopup(place,params);
		else this.createButton(place,params);
	},
	showStory: function(tid,fold) {
		var co=config.options; // abbrev
		var tids=[];
		var t=store.getTiddler(tid);
		var tagged=store.getTaggedTiddlers(tid,'title');
		if (tagged.length) // if tiddler IS a tag, use tagged tiddlers as story
			for (var i=0; i<tagged.length; i++) tids.push(tagged[i].title);
		else if (t) { // get tiddler list from content
			if (!t.linksUpdated) t.changed();
			for (var i=0; i<t.links.length; i++) {
				var tid=store.getTiddler(t.links[i]);
				if (tid && !tid.isTagged(this.excludeTag))
					tids.push(t.links[i]);
			}
		}
		var template=null;
		if (fold||co.chkStoryFold) template='CollapsedTemplate'; // see [[CollapseTiddlersPlugin]]
		if (!store.tiddlerExists('CollapsedTemplate')) template=null;
		if (co.chkStoryClose) story.closeAllTiddlers();
		var pos='top'; var first=tids[0];
		if (!story.isEmpty() && co.chkStoryBottom) { pos='bottom'; tids=tids.reverse(); }
		story.displayTiddlers(pos,tids,template);
		var cmd='var t=story.getTiddler("'+first+'");if(t)window.scrollTo(0,t.offsetTop);';
		var delay=config.options.chkAnimate?config.animDuration+100:0;
		setTimeout(cmd,delay);
	},
	createButton: function(place,params) {
		var tid=params[0]||'';
		var label=params[1]||this.label; label=label.format([tid]);
		var tip=params[2]||this.prompt; tip=tip.format([tid]);
		var fold=(params[3]&&(params[3].toLowerCase()=='fold'))||config.options.chkStoryFold;
		var fn=function(){config.macros.openStory.showStory(this.getAttribute('tid'),this.getAttribute('fold')); return false; };
		var btn=createTiddlyButton(place,label,tip,fn,'button');
		btn.setAttribute('tid',tid);
		if (fold) btn.setAttribute('fold',fold);
	},
	createPopup: function(place,params) {
		params.shift(); // discard 'popup' keyword
		var label=params.shift()||this.popuplabel;
		var tip=params.shift()||this.popupprompt;
		var btn=createTiddlyButton(place,label,tip,this.showPopup,'button');
		btn.setAttribute('filter',params.shift()||config.macros.openStory.tag);
	},
	showPopup: function(ev) { var e=ev||window.event;
		var co=config.options; // abbrev
		var cmo=config.macros.openStory; // abbrev
		var indent='\xa0\xa0';
		var p=Popup.create(this); if (!p) return false;
		createTiddlyText(createTiddlyElement(p,'li'),cmo.selectprompt);
		var stories=store.filterTiddlers('[tag['+this.getAttribute('filter')+']]');
		for (var s=0; s<stories.length; s++) {
			var label=indent+stories[s].title;
			var tip=cmo.prompt.format([stories[s].title]);
			var fn=function(){config.macros.openStory.showStory(this.getAttribute('tid'));return false;};
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
			btn.setAttribute('tid',stories[s].title);
		}
		createTiddlyText(createTiddlyElement(p,'li'),cmo.optionsprompt);
		if (store.tiddlerExists('CollapsedTemplate')) {
			var label=indent+cmo.foldcmd.format([co.chkStoryFold?'x':'\xa0\xa0']);
			var tip=cmo.foldprompt;
			var fn=function(){ config.macros.option.propagateOption(
				'chkStoryFold','checked',!config.options.chkStoryFold,'input'); return false; };
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		}
		var label=indent+cmo.closecmd.format([co.chkStoryClose?'x':'\xa0\xa0']);
		var tip=indent+cmo.closeprompt;
		var fn=function(){ config.macros.option.propagateOption(
			'chkStoryClose','checked',!config.options.chkStoryClose,'input'); return false; };
		var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		if (!co.chkStoryClose) {
			var label=indent+cmo.topcmd.format([co.chkStoryTop?'x':'\xa0\xa0']);
			var tip=indent+cmo.topprompt;
			var fn=function(){
				config.macros.option.propagateOption(
					'chkStoryTop','checked',!config.options.chkStoryTop,'input');
				config.macros.option.propagateOption(
					'chkStoryBottom','checked',!config.options.chkStoryTop,'input');
				return false;
			};
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
			var label=indent+cmo.bottomcmd.format([co.chkStoryBottom?'x':'\xa0\xa0']);
			var tip=indent+cmo.botprompt;
			var fn=function(){
				config.macros.option.propagateOption(
					'chkStoryBottom','checked',!config.options.chkStoryBottom,'input');
				config.macros.option.propagateOption(
					'chkStoryTop','checked',!config.options.chkStoryBottom,'input');
				return false;
			};
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		}
		if (!readOnly && co.chkStoryAllowAdd) {
			var label=cmo.addcmd;
			var tip=cmo.addprompt;
			var fn=config.macros.saveStory.setTiddler;
			createTiddlyElement(createTiddlyElement(p,'li'),'hr');
			var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
		}
		Popup.show();
		e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();
		return false;
	},
	createList: function(place,params) {
		var cmo=config.macros.openStory; // abbrev
		var s=createTiddlyElement(place,'select',null,'storyListbox');
		s.size=1;
		s.onchange=function() {
			if (this.value=='_fold') {
				config.macros.option.propagateOption('chkStoryFold','checked',
					!config.options.chkStoryFold,'input');
				cmo.refreshList();
			} else if (this.value=='_close') {
				config.macros.option.propagateOption('chkStoryClose','checked',
					!config.options.chkStoryClose,'input');
				cmo.refreshList();
			} else if (this.value=='_top') {
				config.macros.option.propagateOption('chkStoryTop','checked',
					!config.options.chkStoryTop,'input');
				cmo.refreshList();
			} else if (this.value=='_bottom') {
				config.macros.option.propagateOption('chkStoryBottom','checked',
					!config.options.chkStoryBottom,'input');
				cmo.refreshList();
			} else if (this.value=='_add')
				config.macros.saveStory.setTiddler.apply(this,arguments);
			else cmo.showStory(this.value);
		}
		params.shift(); // discard 'list' keyword
		s.setAttribute('filter',params.shift()||cmo.tag);
		setStylesheet('.storyListbox { width:100%; }', 'StorySaverStyles');
		store.addNotification(null,this.refreshList); this.refreshList();
		return;
	},
	refreshList: function() {
		var cmo=config.macros.openStory; // abbrev
		var indent='\xa0\xa0\xa0\xa0';
		var lists=document.getElementsByTagName('select');
		for (var i=0; i<lists.length; i++) { if (lists[i].className!='storyListbox') continue;
			var here=lists[i];
			var stories=store.filterTiddlers('[tag['+here.getAttribute('filter')+']]');
			while (here.length) here.options[0]=null; // remove current list items
			here.options[here.length]=new Option(cmo.selectprompt,'',true,true);
			for (var s=0; s<stories.length; s++)
				here.options[here.length]=new Option(indent+stories[s].title,stories[s].title);
			if (!readOnly && config.options.chkStoryAllowAdd)
				here.options[here.length]=new Option(cmo.addcmd,'_add');
			here.options[here.length]=new Option(cmo.optionsprompt,'');
			if (store.tiddlerExists('CollapsedTemplate')) {
				var msg=cmo.foldcmd.format([config.options.chkStoryFold?'x':'\xa0\xa0']);
				here.options[here.length]=new Option(indent+msg,'_fold');
			}
			var msg=cmo.closecmd.format([config.options.chkStoryClose?'x':'\xa0\xa0']);
			here.options[here.length]=new Option(indent+msg,'_close',false,false);
			if (!config.options.chkStoryClose) {
				var msg=cmo.topcmd.format([config.options.chkStoryTop?'x':'\xa0\xa0']);
				here.options[here.length]=new Option(indent+msg,'_top',false,false);
				var msg=cmo.bottomcmd.format([config.options.chkStoryBottom?'x':'\xa0\xa0']);
				here.options[here.length]=new Option(indent+msg,'_bottom',false,false);
			}
		}
	}
}
//}}}
.tour img{ /* 1st set of icons. Rotate them 60deg onmouseover and out */
-moz-transition: all 0.2s ease-in-out;
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}

.tour img:hover{
-moz-transform: rotate(70deg);
-webkit-transform: rotate(70deg);
-o-transform: rotate(70deg);
-ms-transform: rotate(70deg);
transform: rotate(70deg);
}

----
ul.gallery{
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.gallery li{
  display: block;
  width: 200px; /* width of gallery */
  height: 50px; /* portion of each gallery image that's shown initially */
  position: relative;
  -webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}


ul.gallery li img{
  position: absolute;
  width: 100%;
  border: 10px solid #D8D2A2;
 -webkit-filter: grayscale(1);
  -moz-filter: grayscale(1);
	filter: url(#grayscale); 
  filter: grayscale(1);
	-webkit-transition: all .5s ease-in-out; /* CSS3 transition setting */
	-moz-transition: all .5s ease-in-out;
  transition: all .5s ease-in-out;
}


ul.gallery li:focus{ /* when a LI receives focus (clicked on) */
  z-index: 100;
	outline: none;
	-webkit-transform: rotate(3deg); /* rotate enlarged LI by 3 degrees */
	-moz-transform: rotate(3deg);
	transform: rotate(3deg); 
	pointer-events: none; /* disable pointer events on enlarged LI so thumbnail(s) beneath it can receive those events */
}

ul.gallery li:nth-of-type(even):focus{ /* even LIs that received focus */
	-webkit-transform: rotate(-1deg); /* rotate enlarged LI by -1 degrees instead */
	-moz-transform: rotate(-1deg);
	transform: rotate(-1deg);
}

ul.gallery li:focus img{
  -webkit-transform: scale(2) translateX(80%); /* enlarge focused image and move horizontally */
  -moz-transform: scale(2) translateX(80%);
  transform: scale(2) translateX(80%);
  top: 10px; /* shift enlarged image downwards by 10px */
	outline: none;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4); 
  -webkit-filter: grayscale(0); /* nullify grayscale effect */
  filter: none;
}

ul.gallery li:first-of-type:focus img{ /* first image within list of thumbnails that receives focus */
  top: 80px; /* move image down by 80px so it's not obscured by top of window edge */
}

svg{
	position: absolute;
	visibility: hidden;
}

.sparkline {
background: transparent;
}
.sparktick {
background: red;
}

@font-face {
  font-family: "greek_column";
  src: url(k/fontes/greek_column-webfont.woff) 
format("opentype");
}

@font-face {
  font-family: "frakturshadowed";
  src: url(k/fontes/frakturshadowed-webfont.ttf) 
format("truetype");
}

@font-face {
  font-family: "dark11";
  src: url(k/fontes/dark11__-webfont.ttf) 
format("truetype");
}

@font-face {
  font-family: "HeroQuest";
  src: url(k/fontes/hq_core-webfont.ttf) 
format("truetype");
}

@font-face {
  font-family: "Hawkmoon";
  src: url(k/fontes/hawkmoon-webfont.ttf) 
format("truetype");
}

@font-face {
  font-family: "Sebaldus-Gotisch";
  src: url(k/fontes/sebaldus-gotisch-webfont.ttf) format("truetype");
}
@font-face {
  font-family: "Liberation Serif";
  src: url(k/fontes/liberationserif-regular-webfont.ttf) format("truetype");
}
@font-face {
  font-family: "RUNEnglish 1";
  src: url(k/fontes/runeng1-webfont.ttf) format("truetype");
}
@font-face {
  font-family: "SF Gothican";
  src: url(k/fontes/sf_gothican-webfont.ttf) format("truetype");
}
@font-face {
  font-family: "technovia";
  src: url(k/fontes/technott-webfont.ttf) 
format("truetype");
}
@font-face {
  font-family: "DecoCaps";
  src: url(k/fontes/decocaps-webfont.ttf) 
format("truetype");
}
/*{{{*/

/*
ul li {list-style-image: url('k/symb/cs.png'); } 
*/

.fondV{background-image:url("k/titre/fond3.gif"); background-repeat: repeat; padding: 100px; font-family: technott; font-size: 18px; color:white; text-align: justify; margin: 25px 50px 75px 400px;}


.BoutonPopupLettre { display: block; background-image:url("k/lettre.png"); background-repeat: no-repeat; width: 30px; height: 30px; color:transparent; }
.popupListe {background-color:#F3DEC9; height:350px; overflow:scroll; filter: alpha(opacity= 85); -moz-opacity: .85; opacity: .85; !important;}
.BoutonPopupListe { display: block; background-image:url("k/lecture.png"); background-repeat: no-repeat; width: 30px; height: 30px; color:transparent;  !important; }

.multi{color:black;}

.sdp{page-break-before: always;} 

.titregoth {font-family: Hawkmoon; font-size: 40px; color:[[ColorPalette::TiTre]]; font-weight:thin;}

.supgoth { font-family: "Sebaldus-Gotisch"; font-size: 40px; color:[[ColorPalette::TiTre]]; font-weight:thin;}

.supgoth2 { font-family: tannenbergfett; font-size: 40px; color:[[ColorPalette::TiTre]]; font-weight:thin;}

.titre { font-family: dark11; font-size: 50px; color:[[ColorPalette::TiTre]]; font-weight:thin;}

.num { font-family: technovia; font-size: 48px; color:[[ColorPalette::TiTre]]; font-weight:thin; text-align: right;}

.lettrine {font-family: DecoCaps; font-size: 28px; color:black; font-weight:thin;}

.livre { text-align: justify; -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  -o-hyphens: auto;
  hyphens: auto; 
}

.livret { text-align: justify; -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  -o-hyphens: auto;
  hyphens: auto; 
display:block;
	-moz-column-count:2; -moz-column-gap:1em; -moz-column-width:200px; font-size:12pt; line-height:120%; 
width: 330px !important;
}

.cadre { border: 1px solid black; padding: 10px; 
}

.deuxcolonnes { display:block;
	-moz-column-count:2; -moz-column-gap:1em; -moz-column-width:50%; font-size:14pt;line-height:120%; text-align: justify;}

.pt { font-family: 'Liberation Serif'; font-size:10pt; line-height:10pt; }

.tmbg { background-image:url("k/tm.jpg"); color:white; !important; } 

.viewer { font-family: 'Liberation Serif';}

.viewer a:link, .body a:visited { color:#505050; } 
.viewer a:hover { color:#fff; background:#505050; } 
a:hover{
        background: #505050;
        color: #fff;
}  

.icapr {float: right; font-size: 12px; color: black; background-color: transparent; border: 1px solid #ccc; padding: 5px; margin: 5px;}
.icapl {float: left; font-size: 12px; color: black; background-color: transparent; border: 1px solid #ccc; padding: 5px; margin: 5px;}
.icapn {display: block; font-size: 12px; color: black; background-color: transparent; border: 1px solid #ccc; padding: 5px; margin: 5px;}
.icapr img {border: none; padding: 0; margin: 0;}
.icapl img {border: none; float: left; padding: 3px 3px 0px 3px;}
.icapn img {border: none; padding: 0; margin: 0;}
.fond2 {
background-color: black;
}
.fond1 {
background-image: url(k/titre/plume.png); background-position: center center; background-repeat: no-repeat; background-attachment:fixed;
}

.fil1 {
background-image: url(k/titre/plume.png); background-position: center center; background-repeat: no-repeat; background-attachment:fixed;
}
.fil2 {
background-image: url(k/titre/carre_codex.png); background-position: center center; background-repeat: no-repeat; background-attachment:fixed;
}

.bord1 img {
border: 8px grey; border-style: inset;
} 
.bord2 img {
border: 8px grey; border-style: inset; float: right;
} 
.curseursud {
cursor : s-resize;
}
.imgdroite {
border: none; float: right; background-color: white;
} 
.imggauche {
border: none; float: left;
} 
.center
	{ display:block;text-align:center; }
.txtdroite {
text-align: right;
}
.txtcentre {
text-align: center;
}
.tm {
color: white; vertical-align: top; background-image:url("k/fond2.gif"); background-repeat: repeat;
}
* html .tiddler {height:1%;}
body {background-image: url(k/fond4.gif) ; background-attachment: fixed;
background-repeat: repeat; background-position: left; background-color: transparent;  background-image: url(k/titre/carre_codex.gif); background-position: center center; background-repeat: no-repeat;}

body {font-size:1.2em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none; color:[[ColorPalette::TiTre]]; font-family:'arial';}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:decimal;}
ol ol ol {list-style-type:decimal;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative; width:0px; height:0px;}
.header a:hover {none;}
.headerShadow {none;}
.headerForeground {position:relative; padding:0em 3em 1em 1em; left:1px; top:0px; padding-bottom:0em; background-image: url(k/fond4.gif); background-repeat: repeat; background-position: left;}

.siteTitle {font-size:4.0em; color:black; font-family:"technott"}
.siteSubtitle {font-size:1.0em; color:black; font-family:"technott"}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em; background-image: url(k/fond4.gif);}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position: absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabContents {background-image: url(k/fond4.gif) ;
background-repeat: repeat; background-position: left; background-color: transparent;}
.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 14em 0em 1em;}

.toolbar {text-align:left; font-size:.7em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {color:[[ColorPalette::TiTre]]; font-size:2em; font-family:"frakturshadowed";}

.missing .subtitle {display:none;}
.subtitle {font-size:.9em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:left; display:none;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit; background-image: url(k/fond4.gif) ;
background-repeat: repeat; background-position: left; background-color: transparent;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}
	
.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***

***/

/*{{{*/
@media print {

#mainMenu, #sidebar, #messageArea, .toolbar, .tagged, .tagging, .subtitle, .header
	{display: none !important;}
#breadCrumbs, #siteMenu, #storyMenu
	{ display:none !important; }
#displayArea
	{ margin: 1em !important; }
noscript /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
	{ display:none; }
.tiddler
	{ page-break-after:always; { height:14,8mm !important; width:21mm !important; overflow:none !important;}

/*****
use this for 3x5 index cards:
.tiddler { height:14,8mm !important; width:21mm !important; overflow:none !important; .livre;}
*****/

}
/*}}}*/




}
}}}
/***

!!Usage:
* Make sure your table has a header row
** {{{|Name|Phone Number|Address|h}}}<br> Note the /h/ that denote a header row 
* Give the table a class of 'sortable'
** {{{
|sortable|k
|Name|Phone Number|Address|h
}}}<br>Note the /k/ that denotes a class name being assigned to the table.
* To disallow sorting by a column, place {{{<<nosort>>}}} in it's header
* To automatically sort a table by a column, place {{{<<autosort>>}}} in the header for that column
** Or to sort automatically but in reverse order, use {{{<<autosort reverse>>}}}

!!Example:
|sortable|k
|Name |Salary |Extension |Performance |File Size |Start date |h
|ZBloggs, Fred |$12000.00 |1353 |+1.2 |74.2Kb |Aug 19, 2003 21:34:00 |
|ABloggs, Fred |$12000.00 |1353 |1.2 |3350b |09/18/2003 |
|CBloggs, Fred |$12000 |1353 |1.200 |55.2Kb |August 18, 2003 |
|DBloggs, Fred |$12000.00 |1353 |1.2 |2100b |07/18/2003 |
|Bloggs, Fred |$12000.00 |1353 |01.20 |6.156Mb |08/17/2003 05:43 |
|Turvey, Kevin |$191200.00 |2342 |-33 |1b |02/05/1979 |
|Mbogo, Arnold |$32010.12 |2755 |-21.673 |1.2Gb |09/08/1998 |
|Shakespeare, Bill |£122000.00|3211 |6 |33.22Gb |12/11/1961 |
|Shakespeare, Hamlet |£9000 |9005 |-8 |3Gb |01/01/2002 |
|Fitz, Marvin |€3300.30 |5554 |+5 |4Kb |05/22/1995 |

***/
// /%
//!BEGIN-PLUGIN-CODE
config.tableSorting = {
	
	darrow: "\u2193",
	
	uarrow: "\u2191",
	
	getText : function (o) {
		var p = o.cells[SORT_INDEX];
		return p.innerText || p.textContent || '';
	},
	
	sortTable : function (o,rev) {
		SORT_INDEX = o.getAttribute("index");
		var c = config.tableSorting;
		var T = findRelated(o.parentNode,"TABLE");
		if(T.tBodies[0].rows.length<=1) 
			return;
		var itm = "";
		var i = 0;
		while (itm == "" && i < T.tBodies[0].rows.length) {
			itm = c.getText(T.tBodies[0].rows[i]).trim();
			i++;
		}
		if (itm == "") 
			return; 	
		var r = [];
		var S = o.getElementsByTagName("span")[0];		
		c.fn = c.sortAlpha; 
		if(!isNaN(Date.parse(itm)))
			c.fn = c.sortDate; 
		else if(itm.match(/^[$|£|€|\+|\-]{0,1}\d*\.{0,1}\d+$/)) 
			c.fn = c.sortNumber; 
		else if(itm.match(/^\d*\.{0,1}\d+[K|M|G]{0,1}b$/)) 
			c.fn = c.sortFile; 
		for(i=0; i<T.tBodies[0].rows.length; i++) {
			 r[i]=T.tBodies[0].rows[i]; 
		} 
		r.sort(c.reSort);
		if(S.firstChild.nodeValue==c.darrow || rev) {
			r.reverse();
			S.firstChild.nodeValue=c.uarrow;
		} 
		else 
			S.firstChild.nodeValue=c.darrow;
		var thead = T.getElementsByTagName('thead')[0]; 
		var headers = thead.rows[thead.rows.length-1].cells;
		for(var k=0; k<headers.length; k++) {
			if(!hasClass(headers[k],"nosort"))
				addClass(headers[k].getElementsByTagName("span")[0],"hidden");
		}
		removeClass(S,"hidden");
		for(i=0; i<r.length; i++) { 
			T.tBodies[0].appendChild(r[i]);
			c.stripe(r[i],i);
			for(var j=0; j<r[i].cells.length;j++){
				removeClass(r[i].cells[j],"sortedCol");
			}
			addClass(r[i].cells[SORT_INDEX],"sortedCol");
		}
	},
	
	stripe : function (e,i){
		var cl = ["oddRow","evenRow"];
		i&1? cl.reverse() : cl;
		removeClass(e,cl[1]);
		addClass(e,cl[0]);
	},
	
	sortNumber : function(v) {
		var x = parseFloat(this.getText(v).replace(/[^0-9.-]/g,''));
		return isNaN(x)? 0: x;
	},
	
	sortDate : function(v) {
		return Date.parse(this.getText(v));
	},

	sortAlpha : function(v) {
		return this.getText(v).toLowerCase();
	},
	
	sortFile : function(v) { 		
		var j, q = config.messages.sizeTemplates, s = this.getText(v);
		for (var i=0; i<q.length; i++) {
			if ((j = s.toLowerCase().indexOf(q[i].template.replace("%0\u00a0","").toLowerCase())) != -1)
				return q[i].unit * s.substr(0,j);
		}
		return parseFloat(s);
	},
	
	reSort : function(a,b){
		var c = config.tableSorting;
		var aa = c.fn(a);
		var bb = c.fn(b);
		return ((aa==bb)? 0 : ((aa<bb)? -1:1));
	}
};

Story.prototype.tSort_refreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template,force,customFields,defaultText){
	var elem = this.tSort_refreshTiddler.apply(this,arguments);
	if(elem){
		var tables = elem.getElementsByTagName("TABLE");
		var c = config.tableSorting;
		for(var i=0; i<tables.length; i++){
			if(hasClass(tables[i],"sortable")){
				var x = null, rev, table = tables[i], thead = table.getElementsByTagName('thead')[0], headers = thead.rows[thead.rows.length-1].cells;
				for (var j=0; j<headers.length; j++){
					var h = headers[j];
					if (hasClass(h,"nosort"))
						continue;
					h.setAttribute("index",j);
					h.onclick = function(){c.sortTable(this); return false;};
					h.ondblclick = stopEvent;
					if(h.getElementsByTagName("span").length == 0)
						createTiddlyElement(h,"span",null,"hidden",c.uarrow); 
					if(!x && hasClass(h,"autosort")) {
						x = j;
						rev = hasClass(h,"reverse");
					}
				}
				if(x)
					c.sortTable(headers[x],rev);		
			}
		}
	}
	return elem; 
};

setStylesheet("table.sortable span.hidden {visibility:hidden;}\n"+
	"table.sortable thead {cursor:pointer;}\n"+
	"table.sortable .nosort {cursor:default;}\n"+
	"table.sortable td.sortedCol {background:#ffc;}","TableSortingPluginStyles");

function stopEvent(e){
	var ev = e? e : window.event;
	ev.cancelBubble = true;
	if (ev.stopPropagation) ev.stopPropagation();
	return false;	
}	

config.macros.nosort={
	handler : function(place){
		addClass(place,"nosort");
	}	
};

config.macros.autosort={
	handler : function(place,m,p,w,pS){
		addClass(place,"autosort"+" "+pS);		
	}	
};
//!END-PLUGIN-CODE
// %/
/***

!Usage
<<<
{{{
<<cloud type action:... limit:... tag tag tag ...>>
<<cloud type action:... limit:... +TiddlerName>>
<<cloud type action:... limit:... -TiddlerName>>
<<cloud type action:... limit:... =tagvalue>>
}}}
where:
* //type// is a keyword, one of:
** ''tags'' (default) - displays a cloud of tags, based on frequency of use
** ''links'' - displays a cloud of tiddlers, based on number of links //from// each tiddler
** ''references'' - displays a cloud of tiddlers, based on number of links //to// each tiddler
* ''action:popup'' (default) - clicking a cloud item shows a popup with links to related tiddlers<br>//or//<br> ''action:goto'' - clicking a cloud item immediately opens the tiddler corresponding to that item
* ''limit:N'' (optional) - restricts the cloud display to only show the N most popular tags/links
* ''tag tag tag...'' (or ''title title title'' if ''links''/''references'' is used)<br>shows all tags/links in the document //except// for those listed as macro parameters
* ''+TiddlerName''<br>show only tags/links read from a space-separated, bracketed list stored in a separate tiddler.
* ''-TiddlerName''<br>show all tags/links //except// those read from a space-separated, bracketed list stored in a separate tiddler.
* ''=tagvalue'' (//only if type=''tags''//)<br>shows only tags that are themselves tagged with the indicated tag value (i.e., ~TagglyTagging usage)
//note: for backward-compatibility, you can also use the macro {{{<<tagCloud ...>>}}} in place of {{{<<cloud ...>>}}}//
<<<
!Examples
<<<
//all tags excluding<<tag systemConfig>>, <<tag excludeMissing>> and <<tag script>>//
{{{<<cloud systemConfig excludeMissing script>>}}}
{{groupbox{<<cloud systemConfig excludeMissing script>>}}}
//top 10 tags excluding<<tag systemConfig>>, <<tag excludeMissing>> and <<tag script>>//
{{{<<cloud limit:10 systemConfig excludeMissing script>>}}}
{{groupbox{<<cloud limit:10 systemConfig excludeMissing script>>}}}
//tags listed in// [[FavoriteTags]]
{{{<<cloud +FavoriteTags>>}}}
{{groupbox{<<cloud +FavoriteTags>>}}}
//tags NOT listed in// [[FavoriteTags]]
{{{<<cloud -FavoriteTags>>}}}
{{groupbox{<<cloud -FavoriteTags>>}}}
//links to tiddlers tagged with 'package'//
{{{<<cloud action:goto =package>>}}}
{{groupbox{<<cloud action:goto =package>>}}}
//top 20 most referenced tiddlers//
{{{<<cloud references limit:20>>}}}
{{groupbox{<<cloud references limit:20>>}}}
//top 20 tiddlers that contain the most links//
{{{<<cloud links limit:20>>}}}
{{groupbox{<<cloud links limit:20>>}}}
<<<
!Revisions
<<<
2009.07.17 [1.7.0] added {{{-TiddlerName}}} parameter to exclude tags that are listed in the indicated tiddler
2009.02.26 [1.6.0] added {{{action:...}}} parameter to apply popup vs. goto action when clicking cloud items
2009.02.05 [1.5.0] added ability to show links or back-links (references) instead of tags and renamed macro to {{{<<cloud>>}}} to reflect more generalized usage.
2008.12.16 [1.4.2] corrected group calculation to prevent 'group=0' error
2008.12.16 [1.4.1] revised tag filtering so excluded tags don't affect calculations
2008.12.15 [1.4.0] added {{{limit:...}}} parameter to restrict the number of tags displayed to the top N most popular
2008.11.15 [1.3.0] added {{{+TiddlerName}}} parameter to include only tags that are listed in the indicated tiddler
2008.09.05 [1.2.0] added '=tagname' parameter to include only tags that are themselves tagged with the specified value (i.e., ~TagglyTagging usage)
2008.07.03 [1.1.0] added 'segments' property to macro object.  Extensive code cleanup
<<<
!Code
***/
//{{{
version.extensions.TagCloudPlugin= {major: 1, minor: 7 , revision: 0, date: new Date(2009,7,17)};
//Originally created by Clint Checketts, contributions by Jonny Leroy and Eric Shulman
//Currently maintained and enhanced by Eric Shulman
//}}}
//{{{
config.macros.cloud = {
	tagstip: "%1 papiers étiquetés '%0'",
	refslabel: " (%0 références)",
	refstip: "%1 papiers sont liés à '%0'",
	linkslabel: " (%0 liens)",
	linkstip: "'%0' est lié à %1 autres papiers",
	groups: 9,
	init: function() {
		config.macros.tagCloud=config.macros.cloud; // for backward-compatibility
		config.shadowTiddlers.TagCloud='<<cloud>>';
		config.shadowTiddlers.StyleSheetTagCloud=
			'/*{{{*/\n'
			+'.tagCloud span {line-height: 3.5em; margin:3px;}\n'
			+'.tagCloud1{font-size: 80%;}\n'
			+'.tagCloud2{font-size: 100%;}\n'
			+'.tagCloud3{font-size: 120%;}\n'
			+'.tagCloud4{font-size: 140%;}\n'
			+'.tagCloud5{font-size: 160%;}\n'
			+'.tagCloud6{font-size: 180%;}\n'
			+'.tagCloud7{font-size: 200%;}\n'
			+'.tagCloud8{font-size: 220%;}\n'
			+'.tagCloud9{font-size: 240%;}\n'
			+'/*}}}*/\n';
		setStylesheet(store.getTiddlerText('StyleSheetTagCloud'),'tagCloudsStyles');
	},
	getLinks: function(tiddler) { // get list of links to existing tiddlers and shadows
		if (!tiddler.linksUpdated) tiddler.changed();
		var list=[]; for (var i=0; i<tiddler.links.length; i++) {
			var title=tiddler.links[i];
			if (store.isShadowTiddler(title)||store.tiddlerExists(title))
				list.push(title);
		}
		return list;
	},
	handler: function(place,macroName,params) {
		// unpack params
		var inc=[]; var ex=[]; var limit=0; var action='popup';
		var links=(params[0]&&params[0].toLowerCase()=='links'); if (links) params.shift();
		var refs=(params[0]&&params[0].toLowerCase()=='references'); if (refs) params.shift();
		if (params[0]&&params[0].substr(0,7).toLowerCase()=='action:')
			action=params.shift().substr(7).toLowerCase();
		if (params[0]&&params[0].substr(0,6).toLowerCase()=='limit:')
			limit=parseInt(params.shift().substr(6));
		while (params.length) {
			if (params[0].substr(0,1)=='+') { // read taglist from tiddler
				inc=inc.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
			} else if (params[0].substr(0,1)=='-') { // exclude taglist from tiddler
				ex=ex.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
			} else if (params[0].substr(0,1)=='=') { // get tag list using tagged tags
				var tagged=store.getTaggedTiddlers(params[0].substr(1));
				for (var t=0; t<tagged.length; t++) inc.push(tagged[t].title);
			} else ex.push(params[0]); // exclude params
			params.shift();
		}
		// get all items, include/exclude specific items
		var items=[];
		var list=(links||refs)?store.getTiddlers('title','excludeLists'):store.getTags();
		for (var t=0; t<list.length; t++) {
			var title=(links||refs)?list[t].title:list[t][0];
			if (links)	var count=this.getLinks(list[t]).length;
			else if (refs)	var count=store.getReferringTiddlers(title).length;
			else 		var count=list[t][1];
			if ((!inc.length||inc.contains(title))&&(!ex.length||!ex.contains(title)))
				items.push({ title:title, count:count });
		}
		if(!items.length) return;
		// sort by decending count, limit results (optional)
		items=items.sort(function(a,b){return(a.count==b.count)?0:(a.count>b.count?-1:1);});
		while (limit && items.length>limit) items.pop();
		// find min/max and group size
		var most=items[0].count;
		var least=items[items.length-1].count;
		var groupSize=(most-least+1)/this.groups;
		// sort by title and draw the cloud of items
		items=items.sort(function(a,b){return(a.title==b.title)?0:(a.title>b.title?1:-1);});
		var cloudWrapper = createTiddlyElement(place,'div',null,'tagCloud',null);
		for (var t=0; t<items.length; t++) {
			cloudWrapper.appendChild(document.createTextNode(' '));
			var group=Math.ceil((items[t].count-least)/groupSize)||1;
			var className='tagCloudtag tagCloud'+group;
			var tip=refs?this.refstip:links?this.linkstip:this.tagstip;
			tip=tip.format([items[t].title,items[t].count]);
			if (action=='goto') { // TAG/LINK/REFERENCES GOTO
				var btn=createTiddlyLink(cloudWrapper,items[t].title,true,className);
				btn.title=tip;
				btn.style.fontWeight='normal';
			} else if (!links&&!refs) { // TAG POPUP
				var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,onClickTag,className);
				btn.setAttribute('tag',items[t].title);
			} else { // LINK/REFERENCES POPUP
				var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,
					function(ev) { var e=ev||window.event; var cmt=config.macros.cloud;
						var popup = Popup.create(this);
						var title = this.getAttribute('tiddler');
						var count = this.getAttribute('count');
						var refs  = this.getAttribute('refs')=='T';
						var links = this.getAttribute('links')=='T';
						var label = (refs?cmt.refslabel:cmt.linkslabel).format([count]);
						createTiddlyLink(popup,title,true);
						createTiddlyText(popup,label);
						createTiddlyElement(popup,'hr');
						if (refs) {
							popup.setAttribute('tiddler',title);
							config.commands.references.handlePopup(popup,title);
						}
						if (links) {
							var tiddler = store.fetchTiddler(title);
							var links=config.macros.cloud.getLinks(tiddler);
							for(var i=0;i<links.length;i++)
								createTiddlyLink(createTiddlyElement(popup,'li'),
									links[i],true);
						}
						Popup.show();
						e.cancelBubble=true; if(e.stopPropagation) e.stopPropagation();
						return false;
					}, className);
				btn.setAttribute('tiddler',items[t].title);
				btn.setAttribute('count',items[t].count);
				btn.setAttribute('refs',refs?'T':'F');
				btn.setAttribute('links',links?'T':'F');
				btn.title=tip;
			}
		}
	}
};
//}}}
/***

!!!!!Documentation
>see [[TagGridPluginInfo]]
!!!!!Revisions
<<<
2008.04.21 [1.7.0] added support for "filter:..." param to exclude tiddlers from grid
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info tiddler
2007.12.04 [*.*.*] update for TW2.3.0: replaced deprecated core functions, regexps, and macros
2007.07.24 [1.6.5] corrected handling for @TiddlerName with excluded tags, so that excluded tags are not actually removed from the @TiddlerName source tiddler.
|please see [[TagGridPluginInfo]] for additional revision details|
2006.10.05 [1.0.0] initial release (converted from prototype inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.TagGridPlugin= {major: 1, minor: 7, revision: 0, date: new Date(2008,4,21)};

config.macros.tagGrid= {
	verbose:false, // display debugging/performance feedback messages
	warn:true,	// display workload warning message before rendering
	threshold:300000, // workload warning threshold (workload=# of comparisons to perform)
	handler:
	function(place,macroName,params) {

		// get columns
		var columntags=params.shift(); var cols=[];
		if ((!columntags)||(columntags=="all")) // no param (or "all") - use all tags
			{ var all=store.getTags(); for (i=0;i<all.length;i++) cols.push(all[i][0]); }
		else if (columntags.substr(0,1)=="+") // get tag list from tiddler content
			{ var t=store.getTiddlerText(columntags.substr(1)); if (t&&t.length) cols=t.readBracketedList(); }
		else if (columntags.substr(0,1)=="@") // get tag list from tiddler tags
			{ var t=store.getTiddler(columntags.substr(1)); if (t&&t.tags) for (i=0;i<t.tags.length;i++) cols.push(t.tags[i]); }
		else if (columntags.substr(0,1)=="=")  // get names of "tagtiddlers" tagged with meta-tag
			{ var t=store.getTaggedTiddlers(columntags.substr(1)); for (i=0;i<t.length;i++) cols.push(t[i].title); }
		else cols=columntags.readBracketedList();
		if (!cols.length) { wikify("~TagGrid: no columns to display\n",place); return; }

		// exclude specific column tags
		if (params[0]&&params[0].substr(0,8)=="exclude:") {
			var ex=params.shift().substr(8).readBracketedList();
			for (x=0; x<ex.length; x++) {
				var i=cols.indexOf(ex[x]);
				if (i!=-1) cols.splice(i,1); // remove excluded tags
			}
		}

		// get rows
		var rowtags=params.shift(); var rows=[];
		if ((!rowtags)||(rowtags=="all")) // no param (or "all") - use all tags
			{ var all=store.getTags(); for (i=0;i<all.length;i++) rows.push(all[i][0]); }
		else if (rowtags.substr(0,1)=="+") // get tag list from tiddler content
			{ var t=store.getTiddlerText(rowtags.substr(1)); if (t&&t.length) rows=t.readBracketedList(); }
		else if (rowtags.substr(0,1)=="@") // get tag list from tiddler tags
			{ var t=store.getTiddler(rowtags.substr(1)); if (t&&t.tags) for (i=0;i<t.tags.length;i++) rows.push(t.tags[i]); }
		else if (rowtags.substr(0,1)=="=")  // get names of "tagtiddlers" tagged with meta-tag
			{ var t=store.getTaggedTiddlers(rowtags.substr(1)); for (i=0;i<t.length;i++) rows.push(t[i].title); }
		else rows=rowtags.readBracketedList();
		if (!rows.length) { wikify("~TagGrid: no rows to display\n",place); return; }

		// exclude specific row tags
		if (params[0]&&params[0].substr(0,8)=="exclude:") {
			var ex=params.shift().substr(8).readBracketedList();
		 	for (x=0; x<ex.length; x++) {
				var i=rows.indexOf(ex[x]);
				if (i!=-1) rows.splice(i,1); // remove excluded tags
			}
		}

		// get optional tiddler filter
		if (params[0]&&params[0].substr(0,7).toUpperCase()=="FILTER:")
			var filter=params.shift().substr(7);

		// get optional flag keywords and/or color gradient endpoints
		var defOpen=false;
		var colorAll=false;
		var sortRows=false;
		var sortColumns=false;
		var showInline=false;
		var p=params.shift();
		while (p) {
			switch (p.toUpperCase()) {
				case "OPEN":
					defOpen=true; break;
				case "COLORALL":
					colorAll=true; break;
				case "SORTROWS":
					sortRows=true; break;
				case "SORTCOLUMNS":
					sortColumns=true; break;
				case "INLINE":
					showInline=true; break;
				default:
					if (startcolor==undefined) var startcolor=p;
					else if (endcolor==undefined) var endcolor=p;
					else alert("unexpected parameter: '"+p+"'");
					break;
			}
			p=params.shift();
		}

		// get the tiddlers
		if (filter&&filter.length)
			var tiddlers=store.filterTiddlers(filter);
		else
			var tiddlers=store.getTiddlers("modified","excludeLists");

		// show "workload warning"... get permission to proceed...
		if (this.warn) {
			var workload=rows.length*cols.length*tiddlers.length;
			var warning="Cross-indexing %0 tiddlers in %1 row%3 by %2 column%4...\n(up to %5 comparisons MAY be needed)\n\n";
			warning+="This may take a while.  It is OK to proceed?";
			warning=warning.format([tiddlers.length,rows.length,cols.length,rows.length!=1?"s":"",cols.length!=1?"s":"",workload]);
			if (workload>this.threshold&&!confirm(warning)) { wikify("~TagGrid: display cancelled by user\n",place); return; }
		}

		// sort row and column tags in decending order, by frequency of use
		if (sortRows||sortColumns) {
			var tags=store.getTags(); var tagcount={}; for (i=0; i<tags.length; i++) tagcount[tags[i][0]]=tags[i][1];
			if (sortRows) rows.sort(function(a,b){return (!tagcount[a]||tagcount[a]<tagcount[b])?+1:(tagcount[a]==tagcount[b]?0:-1);});
			if (sortColumns) cols.sort(function(a,b){return (!tagcount[a]||tagcount[a]<tagcount[b])?+1:(tagcount[a]==tagcount[b]?0:-1);});
		}

		// cross-index tiddlers by tags, building lists of tiddler titles into grid[i][j] (sparse array)
		var time1=new Date();
		var grid=new Array();
		var max=0;  // track maximum cross-index value
		for (var t=0;t<tiddlers.length;t++) { // for each tiddler
			for (var i=0;i<tiddlers[t].tags.length;i++) { // for each tag in tiddler
				var row=rows.indexOf(tiddlers[t].tags[i]); if (row==-1) continue; // this tag not in rows
				if (!grid[row]) grid[row]=new Array(); // create row as needed
				for (var j=0;j<tiddlers[t].tags.length;j++) {  // for each tag in tiddler
					var col=cols.indexOf(tiddlers[t].tags[j]); if (col==-1) continue; // this tag not in columns
					if (!grid[row][col]) grid[row][col]=new Array(); // create cell
					grid[row][col].push("[["+tiddlers[t].title+"]]"); // add tiddler title to cell
					if (max<grid[row][col].length) max=grid[row][col].length; // check for new maximum
				}
			}
		}

		// compute gradient color map
		if (startcolor && endcolor) {
			var digits="0123456789ABCDEF";
			function hexToDec(s) // 2-digit conversion
				{ return digits.indexOf(s.substr(0,1).toUpperCase())*16+digits.indexOf(s.substr(1,1).toUpperCase()); }
			function decToHex(d) // 2-digit conversion
				{ return digits.substr(Math.floor(d/16),1)+digits.substr(d%16,1); }
			var steps=max;
			var startR=hexToDec(startcolor.substr(0,2));
			var startG=hexToDec(startcolor.substr(2,2));
			var startB=hexToDec(startcolor.substr(4,2));
			var endR=hexToDec(endcolor.substr(0,2));
			var endG=hexToDec(endcolor.substr(2,2));
			var endB=hexToDec(endcolor.substr(4,2));
			var rangeR=endR-startR;
			var rangeG=endG-startG;
			var rangeB=endB-startB;
			var stepR=rangeR/steps; if (stepR>0) stepR=Math.floor(stepR); else stepR=Math.ceil(stepR);
			var stepG=rangeG/steps; if (stepG>0) stepG=Math.floor(stepG); else stepG=Math.ceil(stepG);
			var stepB=rangeB/steps; if (stepB>0) stepB=Math.floor(stepB); else stepB=Math.ceil(stepB);
			var colors=[];
			colors[0]=startcolor;
			for (var i=1; i<steps; i++)
				colors[i]=decToHex(startR+stepR*i)+decToHex(startG+stepG*i)+decToHex(startB+stepB*i);
			colors[steps-1]=endcolor; // fixup for roundoff error
		}

		// generate HTML table containing popups (and optional inline links)
		var time2=new Date();
		var out="<html><table cellpadding='0' cellspacing='0' style='border:0;border-collapse:collapse'>";
		// column headings
		out+="<tr style='border:0;'><td style='text-align:right;border:0'>";

		for (var i=0;i<cols.length;i++) {
			out+="<td style='text-align:center;cursor:pointer;border:0;padding-left:2px;padding-right:2px' ";
			
			out+="<a href='' title='papier étiqueté'";
			if (!defOpen) out+="	style='display:none' ";
			out+="	onclick='story.displayTiddler(this,\""+cols[i]+"\");return false'>"+cols[i]+"</a>";
			out+="</td>";
		}
		out+="</tr>";
		for (var i=0;i<rows.length;i++) {
			// row heading
			var rowlink="<a href='' onclick='story.displayTiddler(this,\""+rows[i]+"\");return false'>"+rows[i]+"</a>";
			out +="<tr style='border:0'>";
			out +="<td style='text-align:right;border:0;padding-right:2px'>"+rowlink+"</td>";
			for (var j=0;j<cols.length;j++) {
				var content="";
				var bgcolor="transparent"; // default empty cell background
				if (colors && colorAll) bgcolor="#"+colors[0]; // empty cell background uses startcolor 
				var bordercolor=""; // default border color (inherits current CSS value)
				if (colors) bordercolor="#"+colors[Math.floor(colors.length/2-1)]; // border uses mid-tone color 
				var linkstyle=""; // use default unless background color is very light or very dark
				var cross=(grid[i]&&grid[i][j])?grid[i][j]:null;
				var hdr=rows[i]+(rows[i]!=cols[j]?(" + "+cols[j]):"");
				if (cross) {
					// cross-tagged list of tiddlers (in a popup)
					var label="<b>"+cross.length+"</b>";
					var tip=hdr;
					var list=cross.sort().join(' ').replace(/'/g,"\\'").replace(/"/g,'&quot;');
					var handler="return config.macros.tagGrid.popup(this,event,\'"+rows[i]+"\',\'"+cols[j]+"\',\'"+list+"\')";
					if (colors) {
						var c=colors[cross.length-1];
						bgcolor="#"+c;
						linkstyle="style='color:#000000 !important'";
						// invert link color if background is very light
						if (c.substr(0,2)<"60" || c.substr(2,2)<"60" || c.substr(4,2)<"60")
							linkstyle="style='color:#FFFFFF !important'";
					}
				} else {
					var label="&nbsp;-&nbsp;";
					var tip="nouveau papier étiqueté: "+hdr;
					var list="";
					var handler="var title=config.macros.newTiddler.title;";
					handler+="story.displayTiddler(this,title,DEFAULT_EDIT_TEMPLATE);";
					handler+="story.setTiddlerTag(title,\'"+rows[i]+"\',+1);";
					handler+="story.setTiddlerTag(title,\'"+cols[j]+"\',+1);";
					handler+="story.focusTiddler(title,\'text\');return(false);";
				}
				if (!showInline || !cross)
					content+='<a href="javascript:;" '+linkstyle+' onclick="'+handler+'" title="'+tip+'">'+label+'</a>';
				if (showInline && cross) {
					content+="<div "+linkstyle+"><span style='white-space:nowrap'>";
					content+=hdr+" ("+label+")";
					content+="</span></div><hr>";
					// list tiddler links inline in table cell
					for (t=0; t<cross.length; t++) {
						var title=cross[t].replace(/\[\[/g,'').replace(/\]\]/g,'');
						var handler="story.displayTiddler(null,'"+title+"');return false;"
						var tid=store.getTiddler(title);
						var author=tid.modifier;
						var date=tid.modified.toLocaleString();
						var tip=config.messages.tiddlerLinkTooltip.format([title,author,date]);
						if (t>0) content+="<br>";
						content+='<a href="javascript:;" '+linkstyle+' onclick="'+handler+'" title="'+tip+'">'+title+'</a>';
					}
					content+="<hr>";
					handler="var tids=\'"+list+"\'.readBracketedList();story.displayTiddlers(this,tids); return(false);"
					tip="tous les papiers étiquetés: "+hdr;
					content+='<a href="javascript:;" '+linkstyle+' onclick="'+handler+'" title="'+tip+'">ouvrir tout</a><br>';
					handler="var title=config.macros.newTiddler.title;";
					handler+="story.displayTiddler(this,title,DEFAULT_EDIT_TEMPLATE);";
					handler+="story.setTiddlerTag(title,\'"+rows[i]+"\',+1);";
					handler+="story.setTiddlerTag(title,\'"+cols[j]+"\',+1);";
					handler+="story.focusTiddler(title,'text'); return(false);"
					tip="nouveau papier étiqueté: "+hdr;
					content+='<a href="javascript:;" '+linkstyle+' onclick="'+handler+'" title="'+tip+'">new tiddler...</a>';
				}
				out+="<td style='background-color:"+bgcolor+";border:1px solid "+bordercolor+" !important;text-align:center'>"+content+"</td>";
			}
			out+="</tr>";
		}
		out+="</table>";
		out+="</html>";
		createTiddlyElement(place,"span").innerHTML=out;
		var time3=new Date();
		if (this.verbose) displayMessage("TagGrid: scan="+(time2-time1)+", generate table="+(time3-time2));
	},
	popup:
	function(here,event,row,col,list) {
		var tids=list.replace(/&quot;/g,'"').readBracketedList();
		var hdr=row+(row!=col?(" AND "+col):"");
		if (tids.length) {
			var p=Popup.create(here); if (!p) return;
			createTiddlyText(p,hdr);
			createTiddlyElement(p,'hr');
			for(var t=0; t<tids.length; t++) createTiddlyLink(createTiddlyElement(p,'li'),tids[t],true);
			createTiddlyElement(p,'hr');
			createTiddlyButton(createTiddlyElement(p,'li'),
				"ouvrir tout", "tous papiers étiquetés: "+hdr,
				function(){story.displayTiddlers(null,tids); return(false);});
			var a=createTiddlyButton(createTiddlyElement(p,'li'),
				"nouveau papier", "nouveau papier étiqueté avec: "+hdr,
				function(){
					var title=config.macros.newTiddler.title;
					story.displayTiddler(this,title,DEFAULT_EDIT_TEMPLATE);
					story.setTiddlerTag(title,this.getAttribute("rowtag"),+1);
					story.setTiddlerTag(title,this.getAttribute("coltag"),+1);
					story.focusTiddler(title,"text");
					return(false);
				});
			a.setAttribute("rowtag",row);
			a.setAttribute("coltag",col);
			Popup.show();
		}
		event.cancelBubble = true;
		if (event.stopPropagation) event.stopPropagation();
		return(false);
	},

};
//}}}
/***

!!!!!Usage
<<<
{{{<<tiddlerIcons>>}}} - shows icons for the current tiddler
or
{{{<<tiddlerIcons =TiddlerName>>}}} - shows icons for the specified tiddler
or
{{{<<tiddlerIcons iconID>>}}} - shows a specific icon
<<<
!!!!!Examples
<<<
{{{
icons for current tiddler: <<tiddlerIcons>>
}}}
icons for current tiddler: <<tiddlerIcons>>
{{{
icons for [[Welcome]] tiddler: <<tiddlerIcons =Welcome>>
}}}
icons for [[Welcome]] tiddler: <<tiddlerIcons =Welcome>>
{{{
All icons:
<<tiddlerIcons recent>> <<tiddlerIcons changed>> <<tiddlerIcons unsaved>> <<tiddlerIcons Trash>>
<<tiddlerIcons tag>> <<tiddlerIcons core>> <<tiddlerIcons systemConfig>> <<tiddlerIcons CSS>>
<<tiddlerIcons html>> <<tiddlerIcons template>> <<tiddlerIcons script>> <<tiddlerIcons attachment>>
<<tiddlerIcons settings>> <<tiddlerIcons pluginInfo>> <<tiddlerIcons faq>> <<tiddlerIcons task>>
}}}
All icons:
<<tiddlerIcons recent>> <<tiddlerIcons changed>> <<tiddlerIcons unsaved>> <<tiddlerIcons Trash>> <<tiddlerIcons tag>> <<tiddlerIcons core>> <<tiddlerIcons systemConfig>> <<tiddlerIcons CSS>> <<tiddlerIcons html>> <<tiddlerIcons template>> <<tiddlerIcons script>> <<tiddlerIcons attachment>> <<tiddlerIcons settings>> <<tiddlerIcons pluginInfo>> <<tiddlerIcons faq>> <<tiddlerIcons task>>
<<<
!!!!!Configuration
<<<
You can add extra icons definitions based on matching tag values.  First, import or create a tiddler called [[TiddlerIconsPluginConfig]] and tag it with<<tag systemConfig>>.  Then, in that tiddler, use the following code format to //merge// your additional icon definitions into the default {{{config.macros.tiddlerIcons.map}}} object.
{{{
merge(config.macros.tiddlerIcons.map,{
	tagvalue: ["tooltip","imagefile"],
	tagvalue: ["tooltip","imagefile"],
	...
	tagvalue: ["tooltip","imagefile"]   // note: no comma after last definition
}
}}}
<<<
!!!!!Revisions
<<<
2008.10.02 [2.1.0] added "=TiddlerName" param (shows icons for specified tiddler)
2007.08.01 [2.0.0] converted from inline script
2007.05.28 [1.0.0] initial release (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.TiddlerIconsPlugin= {major: 2, minor: 1, revision: 0, date: new Date(2008,10,2)};
config.macros.tiddlerIcons = {
	unknown: "unknown tiddler icon: %0",
	map: {
		recent: ["this tiddler was UPDATED within the last 10 days","asterisk_yellow.png"],
		changed: ["this tiddler was UPDATED after your last visit","star.png"],
		unsaved: ["this tiddler has UNSAVED CHANGES","exclamation.png"],
		tag: ["this is a TAG tiddler","tag_blue.png"],
		html: ["this is an HTML MARKUP tiddler","html.png"]
	},
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var img="[img[%0|%1]]";
		var imgs=[]; // collected set of applicable images
		var p=params[0]; // abbrev

		// if icon keyword was supplied, just show one icon and exit.
		if (p&&p.substr(0,1)!="=") {
			wikify(this.map[p]?img.format(this.map[p]):this.unknown.format([p]),place);
			return;
		}

		// if TiddlerName was supplied, use that tiddler, otherwise use current tiddler
		var here=story.findContainingTiddler(place);
		if (!p && !here) return; // not in a tiddler
		var title=p?p.substr(1):here.getAttribute('tiddler');
		var tid=store.getTiddler(title); if (!tid) return; // tiddler not found

		// add 'type' icons based on tag(s)... see TiddlerIconsPluginConfig for icon map definitions
		// sort tags for consistent icon display order 
		var tags=[]; for (i=0;i<tid.tags.length;i++) tags.push(tid.tags[i]); tags.sort();
		for (var t=0; t<tags.length; t++)
			if (this.map[tags[t]]) imgs.push(img.format(this.map[tags[t]]));
		wikify(imgs.join(""),place);
	}
};
//}}}
/***


!!!!!Usage
<<<
This plugin configuration tiddler can be used to add extra icon definitions, based on matching tag values, using the following code format:
{{{
merge(config.macros.tiddlerIcons.map, {
	tagvalue: ["tooltip","imagefile"],
	tagvalue: ["tooltip","imagefile"],
	...
	tagvalue: ["tooltip","imagefile"]   // note: no comma after last definition
}
}}}
<<<
!!!!!Revisions
<<<
2007.08.01 [2.0.0] converted from inline script
<<<
!!!!!Code
***/
//{{{
merge(config.macros.tiddlerIcons.map, {
p1: ["papier commencé","k/p1.png"], 
p2: ["papier travaillé","k/p2.png"], 
p3: ["papier achevé","k/p3.png"], 
p0: ["papier remisé","k/p0.png"],
"d-vert": ["dossier vert","k/vert.png"],
"d-jaune": ["dossier jaune","k/jaune.png"], 
"d-bleu": ["dossier bleu","k/bleu.png"], 
"d-rouge": ["dossier rouge","k/rouge.png"],
"e-vert": ["sous-dossier vert","k/vert2.png"],
"e-jaune": ["sous-dossier jaune","k/jaune2.png"], 
"e-bleu": ["sous-dossier bleu","k/bleu2.png"], 
"e-rouge": ["sous-dossier rouge","k/rouge2.png"]

});
//}}}
/***

~TiddlerTweaker is a 'power tool' for TiddlyWiki authors.  Select multiple tiddlers from a listbox and 'bulk modify' the creator, author, created, modified and/or tag values of those tiddlers using a compact set of form fields.  The values you enter into the fields simultaneously overwrite the existing values in all tiddlers you have selected.
!!!!!Usage
<<<
{{{<<tiddlerTweaker>>}}}
{{smallform{<<tiddlerTweaker>>}}}
By default, any tags you enter into the TiddlerTweaker will //replace// the existing tags in all the tiddlers you have selected.  However, you can also use TiddlerTweaker to quickly filter specified tags from the selected tiddlers, while leaving any other tags assigned to those tiddlers unchanged:
>Any tag preceded by a '+' (plus) or '-' (minus), will be added or removed from the existing tags //instead of replacing the entire tag definition// of each tiddler (e.g., enter '-excludeLists' to remove that tag from all selected tiddlers.  When using this syntax, care should be taken to ensure that //every// tag is preceded by '+' or '-', to avoid inadvertently overwriting any other existing tags on the selected tiddlers.  (note: the '+' or '-' prefix on each tag value is NOT part of the tag value, and is only used by TiddlerTweaker to control how that tag value is processed)
Important Notes:
* TiddlerTweaker is a 'power user' tool that can make changes to many tiddlers at once.  ''You should always have a recent backup of your document (or 'save changes' just *before* tweaking the tiddlers), just in case you accidentally 'shoot yourself in the foot'.''
* The date and author information on any tiddlers you tweak will ONLY be updated if the corresponding checkboxes have been selected.  As a general rule, after using TiddlerTweaker, always ''//remember to save your document//'' when you are done, even though the tiddler timeline tab may not show any recently modified tiddlers.
* Selecting and updating all tiddlers in a document can take a while.  Your browser may warn about an 'unresponsive script'.  Usually, if you allow it to continue, it should complete the processing... eventually.  Nonetheless, be sure to save your work before you begin tweaking lots of tiddlers, just in case something does get stuck.
<<<
!!!!!Revisions
<<<
2011.01.21 2.4.5 auto-selection: use "-" for untagged tiddlers.  Also, added 'opened', 'invert'
2009.09.15 2.4.4 added 'edit' button. moved html definition to separate section
2009.09.13 2.4.3 in settiddlers(), convert backslashed chars (\n\b\s\t) in replacement text
2009.06.26 2.4.2 only add brackets around tags containing spaces
2009.06.22 2.4.1 in setFields(), add brackets around all tags shown tweaker edit field
2009.03.30 2.4.0 added 'sort by modifier'
2009.01.22 2.3.0 added support for text pattern find/replace
2008.10.27 2.2.3 in setTiddlers(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
2008.09.07 2.2.2 added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.12 2.2.1 replace built-in backstage tweak task with tiddler tweaker control panel (moved from BackstageTweaks)
2008.01.13 2.2.0 added 'auto-selection' links: all, changed, tags, title, text
2007.12.26 2.1.0 added support for managing 'creator' custom field (see [[CoreTweaks]])
2007.11.01 2.0.3 added config.options.txtTweakerSortBy for cookie-based persistence of list display order preference setting.
2007.09.28 2.0.2 in settiddlers() and deltiddlers(), added suspend/resume notification handling (improves performance when operating on multiple tiddlers)
2007.08.03 2.0.1 added shadow definition for [[TiddlerTweaker]] tiddler for use as parameter references with {{{<<tiddler>>, <<slider>> or <<tabs>>}}} macros.
2007.08.03 2.0.0 converted from inline script
2006.01.01 1.0.0 initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.TiddlerTweakerPlugin= {major: 2, minor: 4, revision: 5, date: new Date(2011,1,21)};

// shadow tiddler
config.shadowTiddlers.TiddlerTweaker='<<tiddlerTweaker>>';

// defaults
if (config.options.txtTweakerSortBy==undefined) config.options.txtTweakerSortBy='modified';

// backstage task
if (config.tasks) { // for TW2.2b3 or above
	config.tasks.tweak.tooltip='revoir ou modifier dates, auteurs, étiquettes, etc.';
	config.tasks.tweak.content='{{smallform small groupbox{<<tiddlerTweaker>>}}}';
}

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

config.macros.tiddlerTweaker = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var span=createTiddlyElement(place,'span');
		span.innerHTML=store.getTiddlerText('TiddlerTweakerPlugin##html');
		this.init(span.getElementsByTagName('form')[0],config.options.txtTweakerSortBy);
	},
	init: function(f,sortby) { // set form controls
		if (!f) return; // form might not be rendered yet...
		while (f.list.options[0]) f.list.options[0]=null; // empty the list
		var tids=store.getTiddlers(sortby);
		if (sortby=='size') // descending order
			tids.sort(function(a,b) {return a.text.length > b.text.length ? -1 : (a.text.length == b.text.length ? 0 : +1);});
		var who='';
		for (i=0; i<tids.length; i++) { var t=tids[i];
			var label=t.title; var value=t.title;
			switch (sortby) {
				case 'modifié':
				case 'créé':
					var t=tids[tids.length-i-1]; // reverse order
					var when=t[sortby].formatString('YY.0MM.0DD 0hh:0mm ');
					label=when+t.title;
					value=t.title;
					break;
				case 'taille':
					label='['+t.text.length+'] '+label;
					break;
				case 'auteur 2nd':
				case 'auteur 1er':
					if (who!=t[sortby]) {
						who=t[sortby];
						f.list.options[f.list.length]=new Option('by '+who+':','',false,false);
					}
					label='\xa0\xa0\xa0'+label; // indent
					break;
			}
			f.list.options[f.list.length]=new Option(label,value,false,false);
		}
		f.title.value=f.who.value=f.creator.value=f.tags.value='';
		f.cm.value=f.cd.value=f.cy.value=f.ch.value=f.cn.value='';
		f.mm.value=f.md.value=f.my.value=f.mh.value=f.mn.value='';
		f.stats.disabled=f.set.disabled=f.del.disabled=f.edit.disabled=f.display.disabled=true;
		f.settitle.disabled=false;
		config.options.txtTweakerSortBy=sortby;
		f.sortby.value=sortby; // sync droplist
		if (sortby!='modified') saveOptionCookie('txtTweakerSortBy');
		else removeCookie('txtTweakerSortBy');
	},
	enablefields: function(here) { // enables/disables inputs based on #items selected
		var f=here.form; var list=f.list;
		var c=0; for (i=0;i<list.length;i++) if (list.options[i].selected) c++;
		if (c>1) f.title.disabled=true;
		if (c>1) f.settitle.checked=false;
		f.set.disabled=(c==0);
		f.del.disabled=(c==0);
		f.edit.disabled=(c==0);
		f.display.disabled=(c==0);
		f.settitle.disabled=(c>1);
		f.stats.disabled=(c==0);
		var msg=(c==0)?'choix des papiers':(c+' tiddler'+(c!=1?'s':'')+' selected');
		here.previousSibling.firstChild.firstChild.nextSibling.innerHTML=msg;
		if (c) clearMessage(); else displayMessage('aucun papier sélectionné');
	},
	setfields: function(here) { // set fields from first selected tiddler
		var f=here.form;
		if (!here.value.length) {
			f.title.value=f.who.value=f.creator.value=f.tags.value='';
			f.cm.value=f.cd.value=f.cy.value=f.ch.value=f.cn.value='';
			f.mm.value=f.md.value=f.my.value=f.mh.value=f.mn.value='';
			return;
		}
		var tid=store.getTiddler(here.value); if (!tid) return;
		f.title.value=tid.title;
		f.who.value=tid.modifier;
		f.creator.value=tid.fields['creator']||''; // custom field - might not exist
		f.tags.value=tid.tags.map(function(t){return String.encodeTiddlyLink(t)}).join(' ');
		var c=tid.created; var m=tid.modified;
		f.cm.value=c.getMonth()+1;
		f.cd.value=c.getDate();
		f.cy.value=c.getFullYear();
		f.ch.value=c.getHours();
		f.cn.value=c.getMinutes();
		f.mm.value=m.getMonth()+1;
		f.md.value=m.getDate();
		f.my.value=m.getFullYear();
		f.mh.value=m.getHours();
		f.mn.value=m.getMinutes();
	},
	selecttiddlers: function(here,callback) {
		var f=here; while (f&&f.nodeName.toLowerCase()!='form')f=f.parentNode;
		for (var t=f.list.options.length-1; t>=0; t--)
			f.list.options[t].selected=callback(f.list.options[t]);
		config.macros.tiddlerTweaker.enablefields(f.list);
		return false;
	},
	settiddlers: function(here) {
		var f=here.form; var list=f.list;
		var tids=[];
		for (i=0;i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('choisir au moins un papier'); return; }
		var cdate=new Date(f.cy.value,f.cm.value-1,f.cd.value,f.ch.value,f.cn.value);
		var mdate=new Date(f.my.value,f.mm.value-1,f.md.value,f.mh.value,f.mn.value);
		if (tids.length>1 && !confirm('Confirmez la modification de ces papiers:\n\n'+tids.join(', '))) return;
		store.suspendNotifications();
		for (t=0;t<tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			var title=!f.settitle.checked?tid.title:f.title.value;
			var who=!f.setwho.checked?tid.modifier:f.who.value;
			var text=tid.text;
			if (f.replacetext.checked) {
				var r=f.replacement.value.replace(/\\t/mg,'\t').unescapeLineBreaks();
				text=text.replace(new RegExp(f.pattern.value,'mg'),r);
			}				
			var tags=tid.tags;
			if (f.settags.checked) { 
				var intags=f.tags.value.readBracketedList();
				var addtags=[]; var deltags=[]; var reptags=[];
				for (i=0;i<intags.length;i++) {
					if (intags[i].substr(0,1)=='+')
						addtags.push(intags[i].substr(1));
					else if (intags[i].substr(0,1)=='-')
						deltags.push(intags[i].substr(1));
					else
						reptags.push(intags[i]);
				}
				if (reptags.length)
					tags=reptags;
				if (addtags.length)
					tags=new Array().concat(tags,addtags);
				if (deltags.length)
					for (i=0;i<deltags.length;i++)
						{ var pos=tags.indexOf(deltags[i]); if (pos!=-1) tags.splice(pos,1); }
			}
			if (!f.setcdate.checked) cdate=tid.created;
			if (!f.setmdate.checked) mdate=tid.modified;
			store.saveTiddler(tid.title,title,text,who,mdate,tags,tid.fields);
			if (f.setcreator.checked) store.setValue(tid.title,'creator',f.creator.value); // set creator
			if (f.setcdate.checked) tid.assign(null,null,null,null,null,cdate); // set create date
		}
		store.resumeNotifications();
		this.init(f,f.sortby.value);
	},
	displaytiddlers: function(here,edit) {
		var f=here.form; var list=f.list;
		var tids=[];
		for (i=0; i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('sélectionnez au moins un papier'); return; }
		story.displayTiddlers(story.findContainingTiddler(f),tids,edit?DEFAULT_EDIT_TEMPLATE:null);
	},
	deltiddlers: function(here) {
		var f=here.form; var list=f.list;
		var tids=[];
		for (i=0;i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('sélectionnez au moins un papier'); return; }
		if (!confirm('Confirmez la destruction de ces papiers:\n\n'+tids.join(', '))) return;
		store.suspendNotifications();
		for (t=0;t<tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			if (tid.tags.contains('systemConfig')) {
				var msg=tid.title+' is tagged with systemConfig.'
					+'\n\nConfirmez la destruction de ces papiers pouvant causer des effets indésirables.';
				if (!confirm(msg)) continue;
			}
			store.removeTiddler(tid.title);
			story.closeTiddler(tid.title);
		}
		store.resumeNotifications();
		this.init(f,f.sortby.value);
	},
	stats: function(here) {
		var f=here.form; var list=f.list; var tids=[]; var out=''; var tot=0;
		var target=f.nextSibling;
		for (i=0;i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('sélectionnez au moins un papier'); return; }
		for (t=0;t<tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			out+='[['+tid.title+']] '+tid.text.length+'\n'; tot+=tid.text.length;
		}
		var avg=tot/tids.length;
		out=tot+' bytes dans '+tids.length+' papiers choisis ('+avg+' bytes/papier)\n<<<\n'+out+'<<<\n';
		removeChildren(target);
		target.innerHTML="<hr><font size=-2><a href='javascript:;' style='float:right' "
			+"onclick='this.parentNode.parentNode.style.display=\"aucun\"'>fermer</a></font>";
		wikify(out,target);
		target.style.display='block';
	}
};
//}}}
/***
//{{{
!html
<style>
.tiddlerTweaker table,
.tiddlerTweaker table tr,
.tiddlerTweaker table td
	{ padding:0;margin:0;border:0;white-space:nowrap; }
</style><form class='tiddlerTweaker'><!--
--><table style="width:100%"><tr valign="top"><!--
--><td style="text-align:center;width:99%;"><!--
	--><font size=-2><div style="text-align:left;"><span style="float:right"><!--
	-->&nbsp; <a href="javascript:;" 
		title="choisir tous les papiers"
		onclick="return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
			return opt.value.length;
		});">tout</a><!--
	-->&nbsp; <a href="javascript:;" 
		title="choisir les papiers actuellement affichés"
		onclick="return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
			return story.getTiddler(opt.value);
		});">ouverts</a><!--
	-->&nbsp; <a href="javascript:;" 
		title="choisir les papiers nouveaux ou modifiés dernièrement"
		onclick="var lastmod=new Date(document.lastModified);
			return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
				var tid=store.getTiddler(opt.value);
				return tid&&tid.modified>lastmod;
			});
		">changés</a><!--
	-->&nbsp; <a href="javascript:;" 
		title="choisir les papiers répondant à au moins une étiquette"
		onclick="var t=prompt('Entrer des étiquettes séparées par un espace. Utiliser \x22-\x22 pour faire correspondre les papiers sans étiquette.');
			if (!t||!t.length) return false;
			var tags=t.readBracketedList();
			return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
				var tid=store.getTiddler(opt.value);
				return tid&&tags[0]=='-'?!tid.tags.length:tid.tags.containsAny(tags);
			});
		">étiquettes</a><!--
	-->&nbsp; <a href="javascript:;" 
		title="choisir les papiers dont les titres répondent au texte"
		onclick="var t=prompt('Entrer un titre ou une partie à correspondre');
			if (!t||!t.length) return false;
			return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
				return opt.value.indexOf(t)!=-1;
			});
		">titres</a><!--
	-->&nbsp; <a href="javascript:;" 
		title="choisir les papiers dont le contenu répond au texte"
		onclick="var t=prompt('Enter tiddler text (content) to match');
			if (!t||!t.length) return false;
			return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
				var tt=store.getTiddlerText(opt.value,'');
				return tt.indexOf(t)!=-1;
			});
		">texte</a><!--
	-->&nbsp; <a href="javascript:;" 
		title="inverser la sélection de la liste"
		onclick="return config.macros.tiddlerTweaker.selecttiddlers(this,function(opt){
			return !opt.selected;
		});">inverser</a><!--
	--></span><span>choix des papiers</span><!--
	--></div><!--
	--></font><select multiple name=list size="11" style="width:99.99%" 
		title="sélection multiple des titres par appui accompagné des touches maj ou ctrl" 
		onclick="config.macros.tiddlerTweaker.enablefields(this)" 
		onchange="config.macros.tiddlerTweaker.setfields(this)"><!--
	--></select><br><!--
	-->montrer<input type=text size=1 value="11" 
		onchange="this.form.list.size=this.value; this.form.list.multiple=(this.value>1);"><!--
	-->par<!--
	--><select name=sortby size=1 
		onchange="config.macros.tiddlerTweaker.init(this.form,this.value)"><!--
	--><option value="titre">titre</option><!--
	--><option value="taille">taille</option><!--
	--><option value="modifié">modifié</option><!--
	--><option value="créé">créé</option><!--
	--><option value="auteur 2nd">auteur 2nd</option><!--
	--></select><!--
	--><input type="button" value="rafraîchir" 
		onclick="config.macros.tiddlerTweaker.init(this.form,this.form.sortby.value)"<!--
	--> <input type="button" name="stats" disabled value="total" 
		onclick="config.macros.tiddlerTweaker.stats(this)"><!--
--></td><td style="width:1%"><!--
	--><div style="text-align:left"><font size=-2>&nbsp;valeurs à changer</font></div><!--
	--><table style="width:100%;"><tr><!--
	--><td style="padding:1px"><!--
		--><input type=checkbox name=settitle unchecked 
			title="permet de renommer les titres des papiers" 
			onclick="this.form.title.disabled=!this.checked">titre<!--
	--></td><td style="padding:1px"><!--
		--><input type=text name=title size=35 style="width:98%" disabled><!--
	--></td></tr><tr><td style="padding:1px"><!--
		--><input type=checkbox name=setcreator unchecked 
			title="change l'auteur 1er" 
			onclick="this.form.creator.disabled=!this.checked">créé par<!--
	--></td><td style="padding:1px;"><!--
		--><input type=text name=creator size=35 style="width:98%" disabled><!--
	--></td></tr><tr><td style="padding:1px"><!--
		--><input type=checkbox name=setwho unchecked 
			title="change l'auteur" 
			onclick="this.form.who.disabled=!this.checked">modifié par<!--
	--></td><td style="padding:1px"><!--
		--><input type=text name=who size=35 style="width:98%" disabled><!--
	--></td></tr><tr><td style="padding:1px"><!--
		--><input type=checkbox name=setcdate unchecked 
			title="change la date de création" 
			onclick="var f=this.form;
				f.cm.disabled=f.cd.disabled=f.cy.disabled=f.ch.disabled=f.cn.disabled=!this.checked"><!--
		-->créé le<!--
	--></td><td style="padding:1px"><!--
		--><input type=text name=cm size=2 style="width:2em;padding:0;text-align:center" disabled><!--
		--> / <input type=text name=cd size=2 style="width:2em;padding:0;text-align:center" disabled><!--
		--> / <input type=text name=cy size=4 style="width:3em;padding:0;text-align:center" disabled><!--
		--> à <input type=text name=ch size=2 style="width:2em;padding:0;text-align:center" disabled><!--
		--> : <input type=text name=cn size=2 style="width:2em;padding:0;text-align:center" disabled><!--
	--></td></tr><tr><td style="padding:1px"><!--
		--><input type=checkbox name=setmdate unchecked 
			title="allow changes to modified date" 
			onclick="var f=this.form;
				f.mm.disabled=f.md.disabled=f.my.disabled=f.mh.disabled=f.mn.disabled=!this.checked"><!--
		-->modifié le<!--
	--></td><td style="padding:1px"><!--
		--><input type=text name=mm size=2 style="width:2em;padding:0;text-align:center" disabled><!--
		--> / <input type=text name=md size=2 style="width:2em;padding:0;text-align:center" disabled><!--
		--> / <input type=text name=my size=4 style="width:3em;padding:0;text-align:center" disabled><!--
		--> à <input type=text name=mh size=2 style="width:2em;padding:0;text-align:center" disabled><!--
		--> : <input type=text name=mn size=2 style="width:2em;padding:0;text-align:center" disabled><!--
	--></td></tr><tr><td style="padding:1px"><!--
		--><input type=checkbox name=replacetext unchecked
			title="trouver et remplacer le texte correspondant" 
			onclick="this.form.pattern.disabled=this.form.replacement.disabled=!this.checked">change le texte<!--
	--></td><td style="padding:1px"><!--
		--><input type=text name=pattern size=15 value="" style="width:40%" disabled 
			title="entrer une expression régulière"> par<!--
		--><input type=text name=replacement size=15 value="" style="width:40%" disabled 
			title="entrer le texte de remplacement"><!--
	--></td></tr><tr><td style="padding:1px"><!--
		--><input type=checkbox name=settags checked 
			title="change les étiquettes" 
			onclick="this.form.tags.disabled=!this.checked">étiquettes<!--
	--></td><td style="padding:1px"><!--
		--><input type=text name=tags size=35 value="" style="width:98%" 
			title="entrer de nouvelles étiquettes ou utiliser '+étiquette' et '-étiquette' pour en ajouter ou en retirer"><!--
	--></td></tr></table><!--
	--><div style="text-align:center"><!--
	--><nobr><input type=button name=display disabled style="width:24%" value="afficher" 
		title="montre les papiers choisis"
		onclick="config.macros.tiddlerTweaker.displaytiddlers(this,false)"><!--
	--> <input type=button name=edit disabled style="width:23%" value="édite" 
		title="édite les papiers choisis"
		onclick="config.macros.tiddlerTweaker.displaytiddlers(this,true)"><!--
	--> <input type=button name=del disabled style="width:24%" value="efface" 
		title="efface les papiers choisis"
		onclick="config.macros.tiddlerTweaker.deltiddlers(this)"><!--
	--> <input type=button name=set disabled style="width:24%" value="change" 
		title="met à jour les papiers choisis"
		onclick="config.macros.tiddlerTweaker.settiddlers(this)"></nobr><!--
	--></div><!--
--></td></tr></table><!--
--></form><span style="display:none"><!--content replaced by tiddler "stats"--></span>
!end
//}}}
***/
 
/***

!Demos
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], open several tiddlers to use the tabs bar.
!Installation
#import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
#save and reload
#''if you're using a custom [[PageTemplate]]'', add {{{<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>}}} before {{{<div id='tiddlerDisplay'></div>}}}
#optionally, adjust StyleSheetTiddlersBar
!Tips
*Doubleclick on the tiddlers bar (where there is no tab) create a new tiddler.
*Tabs include a button to close {{{x}}} or save {{{!}}} their tiddler.
*By default, click on the current tab close all others tiddlers.
!Configuration options 
<<option chkDisableTabsBar>> Disable the tabs bar (to print, by example).
<<option chkHideTabsBarWhenSingleTab >> Automatically hide the tabs bar when only one tiddler is displayed. 
<<option txtSelectedTiddlerTabButton>> ''selected'' tab command button.
<<option txtPreviousTabKey>> previous tab access key.
<<option txtNextTabKey>> next tab access key.
!Code
***/
//{{{
config.options.chkDisableTabsBar = config.options.chkDisableTabsBar ? config.options.chkDisableTabsBar : false;
config.options.chkHideTabsBarWhenSingleTab  = config.options.chkHideTabsBarWhenSingleTab  ? config.options.chkHideTabsBarWhenSingleTab  : false;
config.options.txtSelectedTiddlerTabButton = config.options.txtSelectedTiddlerTabButton ? config.options.txtSelectedTiddlerTabButton : "closeOthers";
config.options.txtPreviousTabKey = config.options.txtPreviousTabKey ? config.options.txtPreviousTabKey : "";
config.options.txtNextTabKey = config.options.txtNextTabKey ? config.options.txtNextTabKey : "";
config.macros.tiddlersBar = {
	tooltip : "see ",
	tooltipClose : "pour fermer",
	tooltipSave : "pour enregistrer",
	promptRename : "entrer un nouveau nom",
	currentTiddler : "",
	previousState : false,
	previousKey : config.options.txtPreviousTabKey,
	nextKey : config.options.txtNextTabKey,	
	tabsAnimationSource : null, //use document.getElementById("tiddlerDisplay") if you need animation on tab switching.
	handler: function(place,macroName,params) {
		var previous = null;
		if (config.macros.tiddlersBar.isShown())
			story.forEachTiddler(function(title,e){
				if (title==config.macros.tiddlersBar.currentTiddler){
					var d = createTiddlyElement(null,"span",null,"tab tabSelected");
					config.macros.tiddlersBar.createActiveTabButton(d,title);
					if (previous && config.macros.tiddlersBar.previousKey) previous.setAttribute("accessKey",config.macros.tiddlersBar.nextKey);
					previous = "active";
				}
				else {
					var d = createTiddlyElement(place,"span",null,"tab tabUnselected");
					var btn = createTiddlyButton(d,title,config.macros.tiddlersBar.tooltip + title,config.macros.tiddlersBar.onSelectTab);
					btn.setAttribute("tiddler", title);
					if (previous=="active" && config.macros.tiddlersBar.nextKey) btn.setAttribute("accessKey",config.macros.tiddlersBar.previousKey);
					previous=btn;
				}
				var isDirty =story.isDirty(title);
				var c = createTiddlyButton(d,isDirty ?"!":"x",isDirty?config.macros.tiddlersBar.tooltipSave:config.macros.tiddlersBar.tooltipClose, isDirty ? config.macros.tiddlersBar.onTabSave : config.macros.tiddlersBar.onTabClose,"tabButton");
				c.setAttribute("tiddler", title);
				if (place.childNodes) {
					place.insertBefore(document.createTextNode(" "),place.firstChild); // to allow break line here when many tiddlers are open
					place.insertBefore(d,place.firstChild); 
				}
				else place.appendChild(d);
			})
	}, 
	refresh: function(place,params){
		removeChildren(place);
		config.macros.tiddlersBar.handler(place,"tiddlersBar",params);
		if (config.macros.tiddlersBar.previousState!=config.macros.tiddlersBar.isShown()) {
			story.refreshAllTiddlers();
			if (config.macros.tiddlersBar.previousState) story.forEachTiddler(function(t,e){e.style.display="";});
			config.macros.tiddlersBar.previousState = !config.macros.tiddlersBar.previousState;
		}
	},
	isShown : function(){
		if (config.options.chkDisableTabsBar) return false;
		if (!config.options.chkHideTabsBarWhenSingleTab) return true;
		var cpt=0;
		story.forEachTiddler(function(){cpt++});
		return (cpt>1);
	},
	selectNextTab : function(){  //used when the current tab is closed (to select another tab)
		var previous="";
		story.forEachTiddler(function(title){
			if (!config.macros.tiddlersBar.currentTiddler) {
				story.displayTiddler(null,title);
				return;
			}
			if (title==config.macros.tiddlersBar.currentTiddler) {
				if (previous) {
					story.displayTiddler(null,previous);
					return;
				}
				else config.macros.tiddlersBar.currentTiddler=""; 	// so next tab will be selected
			}
			else previous=title;
			});		
	},
	onSelectTab : function(e){
		var t = this.getAttribute("tiddler");
		if (t) story.displayTiddler(null,t);
		return false;
	},
	onTabClose : function(e){
		var t = this.getAttribute("tiddler");
		if (t) {
			if(story.hasChanges(t) && !readOnly) {
				if(!confirm(config.commands.cancelTiddler.warning.format([t])))
				return false;
			}
			story.closeTiddler(t);
		}
		return false;
	},
	onTabSave : function(e) {
		var t = this.getAttribute("tiddler");
		if (!e) e=window.event;
		if (t) config.commands.saveTiddler.handler(e,null,t);
		return false;
	},
	onSelectedTabButtonClick : function(event,src,title) {
		var t = this.getAttribute("tiddler");
		if (!event) event=window.event;
		if (t && config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton])
			config.commands[config.options.txtSelectedTiddlerTabButton].handler(event, src, t);
		return false;
	},
	onTiddlersBarAction: function(event) {
		var source = event.target ? event.target.id : event.srcElement.id; // FF uses target and IE uses srcElement;
		if (source=="tiddlersBar") story.displayTiddler(null,'New Tiddler',DEFAULT_EDIT_TEMPLATE,false,null,null);
	},
	createActiveTabButton : function(place,title) {
		if (config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton]) {
			var btn = createTiddlyButton(place, title, config.commands[config.options.txtSelectedTiddlerTabButton].tooltip ,config.macros.tiddlersBar.onSelectedTabButtonClick);
			btn.setAttribute("tiddler", title);
		}
		else
			createTiddlyText(place,title);
	}
}

story.coreCloseTiddler = story.coreCloseTiddler? story.coreCloseTiddler : story.closeTiddler;
story.coreDisplayTiddler = story.coreDisplayTiddler ? story.coreDisplayTiddler : story.displayTiddler;

story.closeTiddler = function(title,animate,unused) {
	if (title==config.macros.tiddlersBar.currentTiddler)
		config.macros.tiddlersBar.selectNextTab();
	story.coreCloseTiddler(title,false,unused); //disable animation to get it closed before calling tiddlersBar.refresh
	var e=document.getElementById("tiddlersBar");
	if (e) config.macros.tiddlersBar.refresh(e,null);
}

story.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle){
	story.coreDisplayTiddler(config.macros.tiddlersBar.tabsAnimationSource,tiddler,template,animate,unused,customFields,toggle);
	var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;  
	if (config.macros.tiddlersBar.isShown()) {
		story.forEachTiddler(function(t,e){
			if (t!=title) e.style.display="none";
			else e.style.display="";
		})
		config.macros.tiddlersBar.currentTiddler=title;
	}
	var e=document.getElementById("tiddlersBar");
	if (e) config.macros.tiddlersBar.refresh(e,null);
}

var coreRefreshPageTemplate = coreRefreshPageTemplate ? coreRefreshPageTemplate : refreshPageTemplate;
refreshPageTemplate = function(title) {
	coreRefreshPageTemplate(title);
	if (config.macros.tiddlersBar) config.macros.tiddlersBar.refresh(document.getElementById("tiddlersBar"));
}



config.shadowTiddlers.StyleSheetTiddlersBar = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .button {border:0}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .tab {white-space:nowrap}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar {padding : 1em 0.5em 2px 0.5em}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tabUnselected .tabButton, .tabSelected .tabButton {padding : 0 2px 0 2px; margin: 0 0 0 4px;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tiddler, .tabContents {border:1px [[ColorPalette::TertiaryPale]] solid;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar +="/*}}}*/";
store.addNotification("StyleSheetTiddlersBar", refreshStyles);

config.refreshers.none = function(){return true;}
config.shadowTiddlers.PageTemplate=config.shadowTiddlers.PageTemplate.replace(/<div id='tiddlerDisplay'><\/div>/m,"<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>\n<div id='tiddlerDisplay'></div>");

//}}}
/***
|''Name''|TiddlyFileImportr|
|''Version''|0.2.7|
|''Status''|experimental|
|''Source''|https://github.com/jdlrobson/TiddlyWikiPlugins/tree/master/apps/fileimport|
|''Latest''|http://repository.tiddlyspace.com/TiddlyFileImportr|
***/
//{{{
var ImportWizard, WizardMaker;

(function($) {
window.WizardMaker = function(place, wizard) {
	var steps = wizard[0];
	var options = wizard[1] || {};
	$("<h1 />").text(options.heading || "Wizard").appendTo(place);
	var wizard = this;
	$('<button class="button">recommencer</button>').click(function(ev) {
		wizard.jumpTo(0);
		}).appendTo(place)[0];
	this.currentStep = 0;
	this.body = $('<div class="wizardBody"/>').appendTo(place)[0];
	this.steps = steps;
	this.values = {};
	this.createStep(0);
};

WizardMaker.prototype = {
	/*
	OPTIONS
	step: [function, options]
	*/
	createStep: function(stepNumber) {
		$(this.body).empty();
		var step = this.steps[stepNumber];
		if(!step) {
			throw "étape (" + stepNumber + ") invalide"
		}
		var options = step[1] || {};
		var humanStep = stepNumber + 1;
		var heading = "Etape " + humanStep;
		if(options.heading) {
			heading += ": " + options.heading;
		}
		$("<h2 />").text(heading).appendTo(this.body);
		var container = $('<div class="wizardStep" />').appendTo(this.body)[0];
		step[0](container, this);
	},
	next: function() {
		if(this.currentStep < this.steps.length - 1) {
			this.currentStep += 1;
		}
		this.createStep(this.currentStep);
	},
	jumpTo: function(step) {
		this.currentStep = step;
		this.createStep(step);
	},
	setValue: function(name, val) {
		this.values[name] = val;
	},
	getValue: function(name) {
		return this.values[name];
	}
};

if(window.FileReader) {
	window.ImportWizard = function(options) {
		var proxy = options.proxy, saveFunction = options.save,
			internalizeTiddler = options.internalizeTiddler, proxyType = options.proxyType || "GET";
		return [
			[
				[function(body, wizard) {
					$(body).html('Lieu d\'importation <select><option value="1">codex</option><option value="2">cyberespace</option></select><button class="button">valider</button>');
					$("button", body).click(function(ev) {
						var opt = $("select", body).val();
						if(opt === "1") {
							wizard.next();
						} else {
							wizard.jumpTo(2);
						}
					});
				},
				{ heading: "Codex ou Cyberespace" }],
				[function(body, wizard) {
					$(body).html('Recherche de codex: <input type="file" size="50" name="Parcourir"><br><hr><div class="wizardFooter"><div class="message"></div></div>');
					function handleFileSelect(evt) {
						reader = new FileReader();
						reader.onerror = function(e, msg) {
							alert("Erreur")
						};
						reader.onabort = function(e) {
							alert('Lecture codex annulée');
						};
						reader.onload = function(e) {
							var html = reader.result;
							wizard.setValue("html", html);
							wizard.jumpTo(3)
						}
						// Read in the image file as a binary string.
						window.reader = reader;
						reader.readAsText(evt.target.files[0]);
					}
					$("[type=file]", body)[0].addEventListener('change', handleFileSelect, false);
				}, { heading: "Localiser le codex" }],
				[function(body, wizard) {
					$(body).html('Entrer ici le chemin: <div class="message"></div><input type="text" size="50" name="txtPath"><button class="button">ouvrir</button>');

					$("button", body).click(function(ev) {
						var url = proxy.replace("%0", $("input", body).val())
						ajaxReq({
							type: options.proxyType,
							url: url,
							success: function(html) {
								wizard.setValue("html", html);
								wizard.jumpTo(3);
							},
							error: function() {
								$(".message").html("Chemin inadéquat ; un autre est requis.");
								$("input", body).addClass("error");
							}
						})
					})
				},
				{ heading: "Importation du cyberespace" }],
				[function(body, wizard) {
					var html = wizard.getValue("html");
					var doc = $(html);
					var store;
					$(html).each(function(i, el) {
						if(el.id === "storeArea") {
							store = el;
						}
					});
					if(store) {
						var tiddlers = [];
						$(store).children().each(function(i, el) {
							var title = $(el).attr("titles");
							tiddlers.push(internalizeTiddler(el));
						});
						$("<div />").text("Choisir les papiers à importer");
						var table = $("<table />").appendTo(body)[0];
						$("<tr />").html('<th><input type="checkbox" checked/></th><th>papier</th>').
							appendTo(table)
						$("input", table).change(function(ev) {
							var checked = $(ev.target).is(':checked');
							$("input[type=checkbox]", body).attr("checked", checked);
						});
						for(var i = 0; i < tiddlers.length; i++) {
							var title = tiddlers[i].title;
							var row = $("<tr />").data("tiddler", tiddlers[i]).appendTo(table)[0];
							$("<td />").html('<input type="checkbox" checked="checked"/>').appendTo(row);
							$("<td />").text(title).appendTo(row);
						}
						$('<button class="button">importer les papiers sélectionnés</button>').click(function(ev) {
							var tids = [];
							$("input[type=checkbox]:checked").each(function(i, chk) {
								var tiddler = $(chk).parents("tr").data("tiddler");
								if(tiddler) {
									tids.push(tiddler);
								}
							});
							wizard.setValue("selected", tids);
							wizard.jumpTo(4)
						}).prependTo(body);
					}
				},
				{ heading: "Choisir les papiers" }],
				[function(body, wizard) {
					var tids = wizard.getValue("selected");
					$(body).text("Veuillez patienter");
					// do import
					var save = 0;
					var complete = function() {
						save += 1;
						if(save === tids.length) {
							wizard.jumpTo(5);
						}
					};
					$(body).text("Veuillez patienter (Importation de " + tids.length + " papiers)");
					for(var i = 0; i < tids.length; i++) {
						var tid = tids[i];
						$(body).text("Veuillez patienter (Importation de " + tid.title + ")");
						saveFunction(tid, complete);
					}
				},
				{ heading: "Importation" }],
				[function(body, wizard) {
					$(body).html("Importation achevée.");
				},
				{ heading: "Finalisation" }]
			],
			{
				heading: "Importer des papiers d'un autre codex ou serveur"
			}
		];
	}
} else {
  $("#container").addClass("error").text("Navigateur trop ancien pour supporter ce greffon.");
}

})(jQuery);
(function($) {

if(window.ImportWizard) {
	var proxy = "%0", proxyType = "GET";
	if(config.extensions.tiddlyspace) {
		proxy = "/reflector?uri=%0";
		proxyType: "POST";
	}
	var loader = new TW21Loader();
	var internalizer = function(node) {
		var title = $(node).attr("title");
		var tiddler = new Tiddler(title);
		loader.internalizeTiddler(store, tiddler, title, node);
		return tiddler;
	};

	var importer = ImportWizard({proxy:"%0", save: function(tid, callback) {
		merge(tid.fields, config.defaultCustomFields);
		delete tid.fields["server.page.revision"];
		delete tid.fields["server.etag"];
		tid = store.saveTiddler(tid.title, tid.title, tid.text,
			tid.modifier, tid.modified, tid.tags, tid.fields, null, tid.created, tid.creator);
		autoSaveChanges(null, [tid]);
		callback();
	}, internalizeTiddler: internalizer, proxyType: proxyType });

	config.macros.importTiddlers = {
		handler: function(place) {
			var container = $("<div />").appendTo(place)[0];
			new WizardMaker(container, importer);
		}
	};
} else if(config.macros.importTiddlers) {
	var _import = config.macros.importTiddlers.handler;
	config.macros.importTiddlers.handler = function(place) {
		_import.apply(this, arguments);
		jQuery("<div class='annotation error' />").text("Veuillez moderniser votre navigateur.").prependTo(place);
	};
}

})(jQuery);
//}}}
/***

!!!!!Usage
<<<
{{{
<<tiddlyPod autoplay loop verbose track:... width:... height:... size:... @TiddlerName>>
}}}
where:
* ''autoplay'' / ''noautoplay'' (keyword, default=''autoplay'')<br>the selected item will play immediately, without pressing the PLAY button.
* ''loop'' / ''noloop'' (keyword, default=''noloop'')<br>the current item is repeatedly played until you press the stop button.
* ''verbose'' (keyword, default=//none//)<br>a message will be displayed whenever an item is selected.
* ''track:...'' (number, default=//last played//)<br>the index into the playlist for the initial item to load into the player.  If no item is specified, the last one played is re-loaded (tracked in a browser cookie).  If no cookie exists (i.e., the first time you play after installing, or after clearing cookies, etc.), then the first item in the playlist is used.
* ''width:...'' and ''height:...'' (default=115x15 for QuickTime or, if using Internet Explorer, 90x44 for Windows Media Player)<br>specify a non-default width/height dimensions for the embedded player (using pixels).
* ''size:xxxx'' (default="auto")<br>a fixed height for the playlist popup container itself (using CSS measurement units, e.g., "px", "em", "cm", "in", etc.).  If the items in the list overflow this height, then a scrollbar is automatically added to the popup list.  "auto" shows //all// playlist entries without scrolling, using a variable height popup.
* ''@~TiddlerName'' (default=[[TiddlyPodList]])<br>specifies a tiddler containing the list of items to play.  Entries in the list are separated by "----", and each entry consist of two lines: the first line is the location (or URL) of the media file to be played.  The second line is a title to be displayed when that item is playing.
<<<
!!!!!Examples
<<<
{{{<<tiddlyPod noautoplay loop track:1 @TiddlyPodList>>}}}
<<tiddlyPod noautoplay loop track:1 @TiddlyPodList>>
<<<
!!!!!Code
***/
//{{{
version.extensions.TiddlyPodPlugin= {major: 1, minor: 4, revision: 4, date: new Date(2008,3,22)};

config.shadowTiddlers['TiddlyPod']='<<tiddlyPod>>';

config.macros.tiddlyPod= {
	verbose: false, // set to true to display messages
	playlist: "TiddlyPodList", // tiddler containing list of tunes
	size: "auto", // maximum length (using CSS) of playlist to show before adding a scrollbar
	width: config.browser.isIE?90:115, // width of embedded player (IE w/WinMedia vs FireFox w/QuickTime)
	height: config.browser.isIE?44:15, // height of embedded player (IE w/WinMedia vs FireFox w/QuickTime)
	getPlayer: function(src,w,h,auto,loop) {
		var out='';
		out+='<EMBED WIDTH="'+w+'" HEIGHT="'+h+'" ';
		out+='	style="height:'+h+'px;width:'+w+'px;margin:0;padding:0;" ';
		out+='	src="'+src+'" ';
		out+='	autostart="'+(auto?'true':'false')+'" autoplay="'+(auto?'true':'false')+'" ';
		out+='	loop="'+(loop?'true':'false')+'" ';
		out+='	controller="show" volume="100" EnableJavaScript="true" ';
		out+='	showtracker="1" showpositioncontrols="0" showaudiocontrols="0" ';
		out+='	showdisplay="0" showstatusbar="0" showgotobar="0"> ';
		out+='</EMBED>';
		return out;
	},
	getPod: function(playlist,which) {
		var txt=store.getTiddlerText(playlist); if (!txt) return;
		var songs=txt.split("\n----\n");
		var first=0;
		var last=songs.length-1;
		if (which===undefined) which=config.options.txtTiddlyPodNowPlaying;
		if (which<first) which=first; if (which>last) which=last;
		var next=(which-1)+2; if (next>last) next=last;
		var prev=which-1; if (prev<first) prev=first;
		var src=songs[which].split("\n")[0];
		var descr=songs[which].split("\n")[1];

		// if src is a tiddlername, check for attachment
		if (config.macros.attach!=undefined) // if AttachFilePlugin is installed
			if ((tid=store.getTiddler(src))!=null && tid.isTagged("attachment")) // if src is attachment tiddler title
				src=config.macros.attach.getAttachment(src); // replace TiddlerTitle with attachment-expanded src URL

		var out='';
		var tip=config.messages.externalLinkTooltip.format([src]); // use core defined tooltip
		out+='<div><a href="'+src+'" target="_blank" class="button" title="'+tip+'" style="white-space:normal">'+descr+'</a></div>';
		out+=this.getPlayer(src,this.width,this.height,config.options.chkTiddlyPodAutoPlay,config.options.chkTiddlyPodLoopPlay);
		out+='<div class="small">';
		out+='<a href="javascript:;" class="button" title="[première] piste '+(first+1)+' - '+songs[first].split("\n")[1]+'" ';
		out+='	onclick="config.macros.tiddlyPod.play(this.parentNode.parentNode,'+first+'); return false;">&lt;&lt;</a>';
		out+='&nbsp;';
		out+='<a href="javascript:;" class="button" title="[précédente] piste '+(prev+1)+' - '+songs[prev].split("\n")[1]+'" ';
		out+='	onclick="config.macros.tiddlyPod.play(this.parentNode.parentNode,'+prev+'); return false;">&nbsp;&lt;&nbsp;</a>';
		out+='&nbsp;';
		out+='<a href="javascript:;" class="button" title="[liste]" ';
		out+='	onclick="config.macros.tiddlyPod.showpopup(this,event); return false;">...</a>';
		out+='&nbsp;';
		out+='<a href="javascript:;" class="button" title="[suivante] piste '+(next+1)+' - '+songs[next].split("\n")[1]+'" ';
		out+='	onclick="config.macros.tiddlyPod.play(this.parentNode.parentNode,'+next+'); return false;">&nbsp;&gt;&nbsp;</a>';
		out+='&nbsp;';
		out+='<a href="javascript:;" class="button" title="[dernière] piste '+(last+1)+' - '+songs[last].split("\n")[1]+'" ';
		out+='	onclick="config.macros.tiddlyPod.play(this.parentNode.parentNode,'+last+'); return false;">&gt;&gt;</a>';
		out+='</div>';

		if (this.verbose) displayMessage('en lecture... piste '+(which+1)+' - "'+descr+'"');
		return out;
	},
	play: function(target,which) {
		if (which==undefined) which=config.options.txtTiddlyPodNowPlaying; // if not specified, use most recently played item
		if (which==undefined) which=0; // default to first item in playlist if no previous item
		target.innerHTML=this.getPod(this.playlist,which);
		config.options.txtTiddlyPodNowPlaying=which;
		saveOptionCookie("txtTiddlyPodNowPlaying");
		return;
	},
	showpopup: function(place,event) {
		var popup=Popup.create(place); if (!popup) return;
		var txt=store.getTiddlerText(this.playlist); if (!txt) return;
		var songs=txt.split("\n----\n");
		config.macros.tiddlyPod.target=place.parentNode.parentNode;
		createTiddlyButton(createTiddlyElement(popup,'li'),
			"lire aléatoirement une piste", "mélanger la liste",
			function(){
				var t=config.options.chkTiddlyPodAutoPlay;
				config.options.chkTiddlyPodAutoPlay=true; // force autoplay
				config.macros.tiddlyPod.play(config.macros.tiddlyPod.target,Math.floor(Math.random()*songs.length));
				config.options.chkTiddlyPodAutoPlay=t;
				return false;
			});
		createTiddlyElement(popup,"hr");
		createTiddlyButton(createTiddlyElement(popup,'li'),
			(config.options.chkTiddlyPodAutoPlay?"[x]":"[_]")+" lecture automatique",
			"lire automatiquement la piste lorsque sélectionnée",
			function(){
				config.options.chkTiddlyPodAutoPlay=!config.options.chkTiddlyPodAutoPlay;
				saveOptionCookie("chkTiddlyPodAutoPlay");
				config.macros.tiddlyPod.play(config.macros.tiddlyPod.target,config.options.txtTiddlyPodNowPlaying);
				return false;
			});
		createTiddlyButton(createTiddlyElement(popup,'li'),
			(config.options.chkTiddlyPodLoopPlay?"[x]":"[_]")+" répéter la lecture",
			"répéter la sélection une fois celle-ci achevée",
			function(){
				config.options.chkTiddlyPodLoopPlay=!config.options.chkTiddlyPodLoopPlay;
				saveOptionCookie("chkTiddlyPodLoopPlay");
				config.macros.tiddlyPod.play(config.macros.tiddlyPod.target,config.options.txtTiddlyPodNowPlaying);
				return false;
			});
		createTiddlyElement(popup,"hr");
		var playlist=createTiddlyElement(popup,"div",null,"fine"); // uses 'fine' CSS class to set font size
		playlist.style.padding="2px"; // room for dotted 'focus' indicator (prevent horizontal scrollbar from appearing)
		playlist.style.height=config.macros.tiddlyPod.size;
		playlist.style.overflow="auto";
		for (var s=0; s<songs.length; s++) {
			var src=songs[s].split("\n")[0];
			var descr=(s+1)+" - "+songs[s].split("\n")[1];
			var a=createTiddlyButton(createTiddlyElement(playlist,'li'), descr, src,
				function(){
					var t=config.options.chkTiddlyPodAutoPlay;
					config.options.chkTiddlyPodAutoPlay=true; // force autoplay
					config.macros.tiddlyPod.play(config.macros.tiddlyPod.target,this.getAttribute("which"));
					config.options.chkTiddlyPodAutoPlay=t;
					return false;
				});
			a.setAttribute("which",s); // song index
			if (s==config.options.txtTiddlyPodNowPlaying) a.style.fontWeight="bold";
		}
		createTiddlyElement(popup,"hr");
		createTiddlyButton(createTiddlyElement(popup,'li'), 'éditer la liste...', '',
			function(){story.displayTiddler(null,config.macros.tiddlyPod.playlist,2);return false;});
		Popup.show(popup,false);
		if (!event) var event=window.event;
		if (event) event.cancelBubble = true;
		if (event && event.stopPropagation) event.stopPropagation();
	},
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if (config.options.chkTiddlyPodAutoPlay==undefined)
			config.options.chkTiddlyPodAutoPlay=true; // default enable auto play
		if (config.options.chkTiddlyPodLoopPlay==undefined)
			config.options.chkTiddlyPodLoopPlay=false; // default disable loop play
		if (config.options.chkTiddlyPodNowPlaying==undefined)
			config.options.chkTiddlyPodNowPlaying=0; // default to first item in playlist
		while (p=params.shift()) {
			if (p=="autoplay")
				config.options.chkTiddlyPodAutoPlay=true; // enable auto play
			if (p=="noautoplay")
				config.options.chkTiddlyPodAutoPlay=false; // disable auto play
			else if (p=="loop")
				config.options.chkTiddlyPodLoopPlay=true; // enable loop play
			else if (p=="noloop")
				config.options.chkTiddlyPodLoopPlay=false; // disable loop play
			else if (p=="verbose")
				this.verbose=true; // enable message display
			else if (p.substr(0,1)=="@")
				this.playlist=p.substr(1); // alternative playlist tiddler 
			else if (p.substr(0,6)=="track:")
				config.options.txtTiddlyPodNowPlaying=p.substr(6)-1; // initial playlist index (0-based, e.g. track #1=index 0)
			else if (p.substr(0,6)=="width:")
				this.width=p.substr(6); // width of embedded player controls
			else if (p.substr(0,7)=="height:")
				this.height=p.substr(7); // height of embedded player controls
			else if (p.substr(0,11)=="size:")
				this.size=p.substr(11); // height of playlist in popup
		}
		this.play(createTiddlyElement(place,"span"),config.options.txtTiddlyPodNowPlaying);
	}
}
//}}}
/%
!info

Usage:
<<<
in tiddler content:
{{{
<<tiddler ToggleTiddlerTags>>
<<tiddler ToggleTiddlerTags with: label>>
}}}
or, in ViewTemplate:
{{{
<span class='toolbar' macro='tiddler ToggleTiddlerTags'></span>
	OR, if TiddlyTools' CoreTweaks for ticket #610 is installed:
<span class='toolbar' macro='toolbar ... ToggleTiddlerTags...'></span>
}}}
or, in ToolbarCommands (with CoreTweaks #610 installed):
{{{
| ViewToolbar| ... ToggleTiddlerTags... |
| EditToolbar| ... ToggleTiddlerTags... |
}}}
<<<

!end

!show
<html><nowiki><a href='javascript:;' title='montrer ou cacher les étiquettes' onclick="
	config.options.chkHideTiddlerTags=!config.options.chkHideTiddlerTags;
	var show=config.options.chkHideTiddlerTags?'inline':'none';
	setStylesheet('.tiddler .tagged { display:'+show+'; }','toggleTiddlerTags');
">$1</a></html>
!end
%/<<tiddler {{'ToggleTiddlerTags##'+(tiddler&&tiddler.title=='ToggleTiddlerTags'?'info':'show')}}
	with: {{"$1"=='$'+'1'?'tags':"$1"}}>>
|~ViewToolbar|collapseTiddler collapseOthers closeTiddler closeOthers copyTiddler +editTiddler  > fields syncing permalink references jump|
|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler version|
|~CollapsedToolbar|+expandTiddler collapseOthers closeTiddler closeOthers|

<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'><span class='toolbar' macro='tiddler ToggleTiddlerTags with:étiquette'></span><span class='toolbar' macro='toolbar snapshotPrintViewer'></span>
</div>
<span class='title'>
        <span class='floatleft' macro='tiddlerIcons''></span>
        <span macro='view title'></span>
</span> 
<!--<div class='tagging' macro='tagging'></div>-->
<div class='tagged' macro='tags'><div style="font-size:75%">(<span macro="wordCount"></span> mots)</div><span
macro='view created date'></span></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
/***
|Author:|Simon Baird|
|URL:|http://linktomemacro.tiddlyspot.com/|
(Almost) as posted by BradleyMeck on the mailing list, 21-Oct-2006. To use put this somewhere in your ViewTemplate:
{{{<div style="font-size:150%">(<span macro="wordCount"></span> words)</div>}}}
***/
//{{{
merge(config.macros,{
	wordCount: {
		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			createTiddlyText(place,tiddler&&tiddler.text?tiddler.text.match(/\w+/g).length:"0");
		}
	}
});
//}}}
!Recherche dans des parties d'un papier
Il est possible de restreindre la recherche à certaines parties d'un papier, comme rechercher uniquement les étiquettes ou les titres. La forme générale est //partie//'':''//texte// (ex. {{{title:intro}}}). Des raccourcis de ces codes sont disponibles dans les parties générales d'un papier {{{title}}} (pour titre), {{{text}}} (pour texte) et {{{tags}}} (pour étiquettes):
|!Quoi|!Comment|!Exemple|
|Chercher ''seulement dans les titres''|commencer avec ''!''|{{{!roma}}} (raccourci pour {{{title:roma}}})|
|Chercher''dans le texte seulement''|commencer avec ''%''|{{{%aristocratie}}} (raccourci pour {{{text:aristocratie}}})|
|Chercher ''dans les étiquettes seulement''|commencer avec ''#''|{{{#p1}}} (raccourci pour {{{tags:p1}}})|

{{{priority:1}}} trouve en outre les papiers dont la valeur de champ est à "1".

L'on peut aussi chercher un mot dans plus d'un partie comme {{{!#p1}}} (or {{{title:tags:p1}}}) pour trouver "p1" dans les titres et les étiquettes (mais, dans cet exemple, pas dans le texte).

!Recherche booléenne
Utile pour chercher différents mots.
|!Quoi|!Comment|!Exemple|
|''Tous les mots'' doivent exister|Liste de mots|{{{roma aristocratie}}} (ou {{{roma and aristocratie}}})|
|''Au moins un mot'' doit exister|mots séparés par ''or''|{{{roma or aristocratie}}}|
|Un mot ''ne doit pas exister''|Commencer avec ''-''|{{{-roma}}} (ou {{{not roma}}})|

''Note:'' Lorsqu'on spécifie deux mots, séparés par un espace, le codex trouve tous les papiers qui contiennent les deux mots, mais pas nécessairement contigus. Pour trouver une séquence de mots, comme '{{{Isidore Ducasse}}}', il faut placer ces mots entre guillemets : {{{"isidore ducasse"}}}.

L'usage des parenthèses peut changer le sens de la recherche booléenne comme {{{not (isidore or ducasse)}}} trouve tous les papiers qui ne contiennent ni "isidore" ni "ducasse". A l'inverse, {{{not isidore or ducasse}}} trouve les papiers qui ne contiennent pas "isidore" et ceux qui contiennent "ducasse".

!Recherche de 'Mot exact'
Par défaut, la recherche s'effectue sur toutes les parties d'un mot comme {{{Fait}}} trouvera les papiers contenant aussi bien 'Fait' que 'défait', 'contrefait', etc.

Pour une racherche "exacte" du mot, il faut le faire précéder du préfixe '=' comme '=Fait'.

!Respect des majuscules et des expressions régulières
Les options de recherche ~CaseSensitiveSearch (respect des majuscules) et ~RegExpSearch (expressions régulières) sont supportées par le codex. Cependant, lorsque ''~RegExpSearch'' est utilisé, les recherches booléennes et filtrées sont inopérantes.

Il est possible d'effectuer une recherche sur une "espression régulière" sans activer ''~RegExpSearch'' en entrant directement l'expression dans le champ de recherche entre les signes {{{/.../}}}. 

Exemple: {{{/m[ae][iy]er/}}} trouve tous les papiers contenant soit "maier", "mayer", "meier" ou "meyer".

!Filtre ~JavaScript
Il est possible encore d'utiliser du code ~JavaScript pour effectuer des recherches filtrées en l'entrant entre les signes {{{ { ... } }}}.

Exemple: {{{ { tiddler.modified > new Date("Jul 4, 2005")} }}} retourne tous les papiers modifiés après le 4 Juillet 2005.

!Recherche combinée
La combinaison des diverses options de recherche est possible. 

''Exemples''
|!Quoi|!Résultat|
|{{{!roma !jaristocratie -%ducasse}}}|tous les papiers à la fois {{{roma}}} et {{{aristocratie}}} dans leurs titres, mais sans {{{ducasse}}} dans leur texte.|
|{{{#=Fait}}}|Tous les papiers étiquetés 'Fait' (mot exact). Les étiquettes '~ContreFait', '~Défait' etc. ne sont pas considérées.|

!Touches d'accès
Des touches (raccourcis clavier) sont utilisables.

|!Touche|!Opération|
|{{{Alt-F}}}|''Utile'': Place le curseur dans le champ de recherche pour saisir la recherche. Affiche également la dernière recherche effectuée.|
|{{{ESC}}}|Ferme le résultat de recherche ou efface la saisie dans le champ.|
|{{{Alt-1}}}, {{{Alt-2}}},... |Ouvre le papier correspondant à son ordre dans la page de résultats affichée.|
|{{{Alt-O}}}|Ouvre tous les papiers trouvés.|
|{{{Alt-P}}}|Commute le mode 'Texte prévisualisé'.|
|{{{Alt-'<'}}}, {{{Alt-'>'}}}|Affiche la page de résultat des recherches suivante ou précédante.|
|{{{Retour charriot}}}|Effectue la recherche si l'option 'recherche en saisie' est désactivée.|

//Si certains raccourcis ne fonctionnent pas, une inspection des touches utilisées par le navigateur ou ses greffons est nécessaire.//
|>|!Options de recherche|
|>|<<option chkUseYourSearch>> Utilisation du champ de recherche|
|!|<<option chkPreviewText>> Affiche le texte recherché|
|!|<<option chkSearchAsYouType>> Mode 'Recherche en saisie' (pas de retour charriot nécessaire)|
|!|Filtre de recherche par défaut:<<option chkSearchInTitle>>Titre ('!')     <<option chkSearchInText>>Texte ('%')     <<option chkSearchInTags>>Etiquettes ('#')    <<option chkSearchExtendedFields>>Champs étendus<html><br><font size="-2">Les parties d'un papier inspectés lorsqu'un filtre n'est pas explicitement spécifié dans le champ de recherche<br>(Spécifier la partie en utilisant au moins un '!', '%', '#' ou 'fieldname:' en préfixe d'un mot ou expression à chercher).</font></html>|
|!|Nombre de résultats sur la page: <<option txtItemsPerPage>>|
|!|Nombre de résultats sur la page avec prévisualisation du texte: <<option txtItemsPerPageWithPreview>>|
/***
|''Name:''|YourSearchPlugin|
|''Version:''|2.1.6 (2012-04-19)|
|''Summary:''|Search your TiddlyWiki with advanced search features such as result lists, tiddler preview, result ranking, search filters, combined searches and many more.|
|''Source:''|http://tiddlywiki.abego-software.de/#YourSearchPlugin|
|''Twitter:''|[[@abego|https://twitter.com/#!/abego]]|
|''GitHub:''|https://github.com/abego/YourSearchPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''License:''|[[BSD open source license|http://www.abego-software.de/legal/apl-v10.html]]|
!About YourSearch
YourSearch gives you a bunch of new features to simplify and speed up your daily searches in TiddlyWiki. It seamlessly integrates into the standard TiddlyWiki search: just start typing into the 'search' field and explore!

For more information see [[Help|YourSearch Help]].
!Compatibility
This plugin requires TiddlyWiki 2.1. 
Check the [[archive|http://tiddlywiki.abego-software.de/archive]] for ~YourSearchPlugins supporting older versions of TiddlyWiki.
!Source Code
***/
/***
This plugin's source code is compressed (and hidden). 
Use this [[link|http://tiddlywiki.abego-software.de/archive/YourSearchPlugin/2.1.6/YourSearchPlugin-2.1.6-src.js]] to get the readable source code.
***/
///%
if(!version.extensions.YourSearchPlugin){version.extensions.YourSearchPlugin={major:2,minor:1,revision:6,source:"http://tiddlywiki.abego-software.de/#YourSearchPlugin",licence:"[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]",copyright:"Copyright (c) abego Software GmbH, 2005-2012 (www.abego-software.de)"};if(!window.abego){window.abego={}}if(!Array.forEach){Array.forEach=function(c,e,d){for(var b=0,a=c.length;b<a;b++){e.call(d,c[b],b,c)}};Array.prototype.forEach=function(d,c){for(var b=0,a=this.length;b<a;b++){d.call(c,this[b],b,this)}}}abego.toInt=function(b,a){if(!b){return a}var c=parseInt(b);return(c==NaN)?a:c};abego.createEllipsis=function(a){var b=createTiddlyElement(a,"span");b.innerHTML="&hellip;"};abego.shallowCopy=function(b){if(!b){return b}var a={};for(var c in b){a[c]=b[c]}return a};abego.copyOptions=function(a){return !a?{}:abego.shallowCopy(a)};abego.countStrings=function(d,c){if(!c){return 0}var a=c.length;var f=0;var e=0;while(true){var b=d.indexOf(c,e);if(b<0){return f}f++;e=b+a}return f};abego.getBracedText=function(j,e,a){if(!e){e=0}var k=/\{([^\}]*)\}/gm;k.lastIndex=e;var d=k.exec(j);if(d){var l=d[1];var b=abego.countStrings(l,"{");if(!b){if(a){a.lastIndex=k.lastIndex}return l}var g=j.length;for(var f=k.lastIndex;f<g&&b;f++){var h=j.charAt(f);if(h=="{"){b++}else{if(h=="}"){b--}}}if(!b){if(a){a.lastIndex=f-1}return j.substring(d.index+1,f-1)}}};abego.select=function(d,c,b,a){if(!a){a=[]}d.forEach(function(e){if(c.call(b,e)){a.push(e)}});return a};abego.consumeEvent=function(a){if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;a.returnValue=true};abego.TiddlerFilterTerm=function(d,b){if(!b){b={}}var c=d;if(!b.textIsRegExp){c=d.escapeRegExp();if(b.fullWordMatch){c="\\b"+c+"\\b"}}var a=new RegExp(c,"m"+(b.caseSensitive?"":"i"));this.tester=new abego.MultiFieldRegExpTester(a,b.fields,b.withExtendedFields)};abego.TiddlerFilterTerm.prototype.test=function(a){return this.tester.test(a)};abego.parseNewTiddlerCommandLine=function(c){var a=/(.*?)\.(?:\s+|$)([^#]*)(#.*)?/.exec(c);if(!a){a=/([^#]*)()(#.*)?/.exec(c)}if(a){var d;if(a[3]){var b=a[3].replace(/#/g,"");d=b.parseParams("tag")}else{d=[[]]}var e=a[2]?a[2].trim():"";d.push({name:"text",value:e});d[0].text=[e];return{title:a[1].trim(),params:d}}else{return{title:c.trim(),params:[[]]}}};abego.parseTiddlerFilterTerm=function(queryText,offset,options){var re=/\s*(?:(?:\{([^\}]*)\})|(?:(=)|([#%!])|(?:(\w+)\s*\:(?!\/\/))|(?:(?:("(?:(?:\\")|[^"])+")|(?:\/((?:(?:\\\/)|[^\/])+)\/)|(\w+\:\/\/[^\s]+)|([^\s\)\-\"]+)))))/mg;var shortCuts={"!":"title","%":"text","#":"tags"};var fieldNames={};var fullWordMatch=false;re.lastIndex=offset;while(true){var i=re.lastIndex;var m=re.exec(queryText);if(!m||m.index!=i){throw"Word or String literal expected"}if(m[1]){var lastIndexRef={};var code=abego.getBracedText(queryText,0,lastIndexRef);if(!code){throw"Invalid {...} syntax"}var f=Function("tiddler","return ("+code+");");return{func:f,lastIndex:lastIndexRef.lastIndex,markRE:null}}if(m[2]){fullWordMatch=true}else{if(m[3]){fieldNames[shortCuts[m[3]]]=1}else{if(m[4]){fieldNames[m[4]]=1}else{var textIsRegExp=m[6];var text=m[5]?window.eval(m[5]):m[6]?m[6]:m[7]?m[7]:m[8];options=abego.copyOptions(options);options.fullWordMatch=fullWordMatch;options.textIsRegExp=textIsRegExp;var fields=[];for(var n in fieldNames){fields.push(n)}if(fields.length==0){options.fields=options.defaultFields}else{options.fields=fields;options.withExtendedFields=false}var term=new abego.TiddlerFilterTerm(text,options);var markREText=textIsRegExp?text:text.escapeRegExp();if(markREText&&fullWordMatch){markREText="\\b"+markREText+"\\b"}return{func:function(tiddler){return term.test(tiddler)},lastIndex:re.lastIndex,markRE:markREText?"(?:"+markREText+")":null}}}}}};abego.BoolExp=function(i,c,j){this.s=i;var h=j&&j.defaultOperationIs_OR;var e=/\s*\)/g;var f=/\s*(?:(and|\&\&)|(or|\|\|))/gi;var b=/\s*(\-|not)?(\s*\()?/gi;var a;var d=function(p){b.lastIndex=p;var l=b.exec(i);var o=false;var k=null;if(l&&l.index==p){p+=l[0].length;o=l[1];if(l[2]){var n=a(p);e.lastIndex=n.lastIndex;if(!e.exec(i)){throw"Missing ')'"}k={func:n.func,lastIndex:e.lastIndex,markRE:n.markRE}}}if(!k){k=c(i,p,j)}if(o){k.func=(function(m){return function(q){return !m(q)}})(k.func);k.markRE=null}return k};a=function(s){var n=d(s);while(true){var p=n.lastIndex;f.lastIndex=p;var k=f.exec(i);var o;var q;if(k&&k.index==p){o=!k[1];q=d(f.lastIndex)}else{try{q=d(p)}catch(r){return n}o=h}n.func=(function(t,m,l){return l?function(u){return t(u)||m(u)}:function(u){return t(u)&&m(u)}})(n.func,q.func,o);n.lastIndex=q.lastIndex;if(!n.markRE){n.markRE=q.markRE}else{if(q.markRE){n.markRE=n.markRE+"|"+q.markRE}}}};var g=a(0);this.evalFunc=g.func;if(g.markRE){this.markRegExp=new RegExp(g.markRE,j.caseSensitive?"mg":"img")}};abego.BoolExp.prototype.exec=function(){return this.evalFunc.apply(this,arguments)};abego.BoolExp.prototype.getMarkRegExp=function(){return this.markRegExp};abego.BoolExp.prototype.toString=function(){return this.s};abego.MultiFieldRegExpTester=function(b,a,c){this.re=b;this.fields=a?a:["title","text","tags"];this.withExtendedFields=c};abego.MultiFieldRegExpTester.prototype.test=function(b){var d=this.re;for(var a=0;a<this.fields.length;a++){var c=store.getValue(b,this.fields[a]);if(typeof c=="string"&&d.test(c)){return this.fields[a]}}if(this.withExtendedFields){return store.forEachField(b,function(e,g,f){return typeof f=="string"&&d.test(f)?g:null},true)}return null};abego.TiddlerQuery=function(b,a,d,c,e){if(d){this.regExp=new RegExp(b,a?"mg":"img");this.tester=new abego.MultiFieldRegExpTester(this.regExp,c,e)}else{this.expr=new abego.BoolExp(b,abego.parseTiddlerFilterTerm,{defaultFields:c,caseSensitive:a,withExtendedFields:e})}this.getQueryText=function(){return b};this.getUseRegExp=function(){return d};this.getCaseSensitive=function(){return a};this.getDefaultFields=function(){return c};this.getWithExtendedFields=function(){return e}};abego.TiddlerQuery.prototype.test=function(a){if(!a){return false}if(this.regExp){return this.tester.test(a)}return this.expr.exec(a)};abego.TiddlerQuery.prototype.filter=function(a){return abego.select(a,this.test,this)};abego.TiddlerQuery.prototype.getMarkRegExp=function(){if(this.regExp){return"".search(this.regExp)>=0?null:this.regExp}return this.expr.getMarkRegExp()};abego.TiddlerQuery.prototype.toString=function(){return(this.regExp?this.regExp:this.expr).toString()};abego.PageWiseRenderer=function(){this.firstIndexOnPage=0};merge(abego.PageWiseRenderer.prototype,{setItems:function(a){this.items=a;this.setFirstIndexOnPage(0)},getMaxPagesInNavigation:function(){return 10},getItemsCount:function(a){return this.items?this.items.length:0},getCurrentPageIndex:function(){return Math.floor(this.firstIndexOnPage/this.getItemsPerPage())},getLastPageIndex:function(){return Math.floor((this.getItemsCount()-1)/this.getItemsPerPage())},setFirstIndexOnPage:function(a){this.firstIndexOnPage=Math.min(Math.max(0,a),this.getItemsCount()-1)},getFirstIndexOnPage:function(){this.firstIndexOnPage=Math.floor(this.firstIndexOnPage/this.getItemsPerPage())*this.getItemsPerPage();return this.firstIndexOnPage},getLastIndexOnPage:function(){return Math.min(this.getFirstIndexOnPage()+this.getItemsPerPage()-1,this.getItemsCount()-1)},onPageChanged:function(a,b){},renderPage:function(a){if(a.beginRendering){a.beginRendering(this)}try{if(this.getItemsCount()){var d=this.getLastIndexOnPage();var c=-1;for(var b=this.getFirstIndexOnPage();b<=d;b++){c++;a.render(this,this.items[b],b,c)}}}finally{if(a.endRendering){a.endRendering(this)}}},addPageNavigation:function(c){if(!this.getItemsCount()){return}var k=this;var g=function(n){if(!n){n=window.event}abego.consumeEvent(n);var i=abego.toInt(this.getAttribute("page"),0);var m=k.getCurrentPageIndex();if(i==m){return}var l=i*k.getItemsPerPage();k.setFirstIndexOnPage(l);k.onPageChanged(i,m)};var e;var h=this.getCurrentPageIndex();var f=this.getLastPageIndex();if(h>0){e=createTiddlyButton(c,"précédent","(Alt-'<')",g,"prev");e.setAttribute("page",(h-1).toString());e.setAttribute("accessKey","<")}for(var d=-this.getMaxPagesInNavigation();d<this.getMaxPagesInNavigation();d++){var b=h+d;if(b<0){continue}if(b>f){break}var a=(d+h+1).toString();var j=b==h?"currentPage":"otherPage";e=createTiddlyButton(c,a,"Go to page %0".format([a]),g,j);e.setAttribute("page",(b).toString())}if(h<f){e=createTiddlyButton(c,"suivant","(Alt-'>')",g,"next");e.setAttribute("page",(h+1).toString());e.setAttribute("accessKey",">")}}});abego.LimitedTextRenderer=function(){var l=40;var c=4;var k=function(p,z,v){var q=p.length;if(q==0){p.push({start:z,end:v});return}var u=0;for(;u<q;u++){var w=p[u];if(w.start<=v&&z<=w.end){var o;var s=u+1;for(;s<q;s++){o=p[s];if(o.start>v||z>w.end){break}}var x=z;var y=v;for(var t=u;t<s;t++){o=p[t];x=Math.min(x,o.start);y=Math.max(y,o.end)}p.splice(u,s-u,{start:x,end:y});return}if(w.start>v){break}}p.splice(u,0,{start:z,end:v})};var d=function(n){var q=0;for(var p=0;p<n.length;p++){var o=n[p];q+=o.end-o.start}return q};var b=function(n){return(n>="a"&&n<="z")||(n>="A"&&n<="Z")||n=="_"};var f=function(p,r){if(!b(p[r])){return null}for(var o=r-1;o>=0&&b(p[o]);o--){}var q=o+1;var t=p.length;for(o=r+1;o<t&&b(p[o]);o++){}return{start:q,end:o}};var a=function(o,q,p){var n;if(p){n=f(o,q)}else{if(q<=0){return q}n=f(o,q-1)}if(!n){return q}if(p){if(n.start>=q-c){return n.start}if(n.end<=q+c){return n.end}}else{if(n.end<=q+c){return n.end}if(n.start>=q-c){return n.start}}return q};var j=function(r,q){var n=[];if(q){var u=0;do{q.lastIndex=u;var o=q.exec(r);if(o){if(u<o.index){var p=r.substring(u,o.index);n.push({text:p})}n.push({text:o[0],isMatch:true});u=o.index+o[0].length}else{n.push({text:r.substr(u)});break}}while(true)}else{n.push({text:r})}return n};var i=function(p){var n=0;for(var o=0;o<p.length;o++){if(p[o].isMatch){n++}}return n};var h=function(v,u,q,t,o){var w=Math.max(Math.floor(o/(t+1)),l);var n=Math.max(w-(q-u),0);var r=Math.min(Math.floor(q+n/3),v.length);var p=Math.max(r-w,0);p=a(v,p,true);r=a(v,r,false);return{start:p,end:r}};var m=function(r,y,o){var n=[];var v=i(r);var u=0;for(var p=0;p<r.length;p++){var x=r[p];var w=x.text;if(x.isMatch){var q=h(y,u,u+w.length,v,o);k(n,q.start,q.end)}u+=w.length}return n};var g=function(t,p,o){var n=o-d(p);while(n>0){if(p.length==0){k(p,0,a(t,o,false));return}else{var q=p[0];var v;var r;if(q.start==0){v=q.end;if(p.length>1){r=p[1].start}else{k(p,v,a(t,v+n,false));return}}else{v=0;r=q.start}var u=Math.min(r,v+n);k(p,v,u);n-=(u-v)}}};var e=function(p,x,w,n,o){if(n.length==0){return}var u=function(z,I,D,F,C){var H;var G;var E=0;var B=0;var A=0;for(;B<D.length;B++){H=D[B];G=H.text;if(F<E+G.length){A=F-E;break}E+=G.length}var y=C-F;for(;B<D.length&&y>0;B++){H=D[B];G=H.text.substr(A);A=0;if(G.length>y){G=G.substr(0,y)}if(H.isMatch){createTiddlyElement(z,"span",null,"marked",G)}else{createTiddlyText(z,G)}y-=G.length}if(C<I.length){abego.createEllipsis(z)}};if(n[0].start>0){abego.createEllipsis(p)}var q=o;for(var r=0;r<n.length&&q>0;r++){var t=n[r];var v=Math.min(t.end-t.start,q);u(p,x,w,t.start,t.start+v);q-=v}};this.render=function(p,q,o,t){if(q.length<o){o=q.length}var r=j(q,t);var n=m(r,q,o);g(q,n,o);e(p,q,r,n,o)}};(function(){function alertAndThrow(msg){alert(msg);throw msg}if(version.major<2||(version.major==2&&version.minor<1)){alertAndThrow("YourSearchPlugin requires TiddlyWiki 2.1 or newer.\n\nCheck the archive for YourSearch plugins\nsupporting older versions of TiddlyWiki.\n\nArchive: http://tiddlywiki.abego-software.de/archive")}abego.YourSearch={};var lastResults=undefined;var lastQuery=undefined;var setLastResults=function(array){lastResults=array};var getLastResults=function(){return lastResults?lastResults:[]};var getLastResultsCount=function(){return lastResults?lastResults.length:0};var matchInTitleWeight=4;var precisionInTitleWeight=10;var matchInTagsWeight=2;var getMatchCount=function(s,re){var m=s.match(re);return m?m.length:0};var standardRankFunction=function(tiddler,query){var markRE=query.getMarkRegExp();if(!markRE){return 1}var matchesInTitle=tiddler.title.match(markRE);var nMatchesInTitle=matchesInTitle?matchesInTitle.length:0;var nMatchesInTags=getMatchCount(tiddler.getTags(),markRE);var lengthOfMatchesInTitle=matchesInTitle?matchesInTitle.join("").length:0;var precisionInTitle=tiddler.title.length>0?lengthOfMatchesInTitle/tiddler.title.length:0;var rank=nMatchesInTitle*matchInTitleWeight+nMatchesInTags*matchInTagsWeight+precisionInTitle*precisionInTitleWeight+1;return rank};var findMatches=function(store,searchText,caseSensitive,useRegExp,sortField,excludeTag){lastQuery=null;var candidates=store.reverseLookup("tags",excludeTag,false);try{var defaultFields=[];if(config.options.chkSearchInTitle){defaultFields.push("title")}if(config.options.chkSearchInText){defaultFields.push("text")}if(config.options.chkSearchInTags){defaultFields.push("tags")}lastQuery=new abego.TiddlerQuery(searchText,caseSensitive,useRegExp,defaultFields,config.options.chkSearchExtendedFields)}catch(e){return[]}var results=lastQuery.filter(candidates);var rankFunction=abego.YourSearch.getRankFunction();for(var i=0;i<results.length;i++){var tiddler=results[i];var rank=rankFunction(tiddler,lastQuery);tiddler.searchRank=rank}if(!sortField){sortField="title"}var sortFunction=function(a,b){var searchRankDiff=a.searchRank-b.searchRank;if(searchRankDiff==0){if(a[sortField]==b[sortField]){return(0)}else{return(a[sortField]<b[sortField])?-1:+1}}else{return(searchRankDiff>0)?-1:+1}};results.sort(sortFunction);return results};var maxCharsInTitle=80;var maxCharsInTags=50;var maxCharsInText=250;var maxCharsInField=50;var itemsPerPageDefault=25;var itemsPerPageWithPreviewDefault=10;var yourSearchResultID="yourSearchResult";var yourSearchResultItemsID="yourSearchResultItems";var lastSearchText=null;var resultElement=null;var searchInputField=null;var searchButton=null;var lastNewTiddlerButton=null;var initStylesheet=function(){if(version.extensions.YourSearchPlugin.styleSheetInited){return}version.extensions.YourSearchPlugin.styleSheetInited=true;setStylesheet(store.getTiddlerText("YourSearchStyleSheet"),"yourSearch")};var isResultOpen=function(){return resultElement!=null&&resultElement.parentNode==document.body};var closeResult=function(){if(isResultOpen()){document.body.removeChild(resultElement)}};var closeResultAndDisplayTiddler=function(e){closeResult();var title=this.getAttribute("tiddlyLink");if(title){var withHilite=this.getAttribute("withHilite");var oldHighlightHack=highlightHack;if(withHilite&&withHilite=="true"&&lastQuery){highlightHack=lastQuery.getMarkRegExp()}story.displayTiddler(this,title);highlightHack=oldHighlightHack}return(false)};var adjustResultPositionAndSize=function(){if(!searchInputField){return}var root=searchInputField;var rootLeft=findPosX(root);var rootTop=findPosY(root);var rootHeight=root.offsetHeight;var popupLeft=rootLeft;var popupTop=rootTop+rootHeight;var winWidth=findWindowWidth();if(winWidth<resultElement.offsetWidth){resultElement.style.width=(winWidth-100)+"px";winWidth=findWindowWidth()}var popupWidth=resultElement.offsetWidth;if(popupLeft+popupWidth>winWidth){popupLeft=winWidth-popupWidth-30}if(popupLeft<0){popupLeft=0}resultElement.style.left=popupLeft+"px";resultElement.style.top=popupTop+"px";resultElement.style.display="block"};var scrollVisible=function(){if(resultElement){window.scrollTo(0,ensureVisible(resultElement))}if(searchInputField){window.scrollTo(0,ensureVisible(searchInputField))}};var ensureResultIsDisplayedNicely=function(){adjustResultPositionAndSize();scrollVisible()};var indexInPage=undefined;var currentTiddler=undefined;var pager=new abego.PageWiseRenderer();var MyItemRenderer=function(parent){this.itemHtml=store.getTiddlerText("YourSearchItemTemplate");if(!this.itemHtml){alertAndThrow("YourSearchItemTemplate not found")}this.place=document.getElementById(yourSearchResultItemsID);if(!this.place){this.place=createTiddlyElement(parent,"div",yourSearchResultItemsID)}};merge(MyItemRenderer.prototype,{render:function(pager,object,index,indexOnPage){indexInPage=indexOnPage;currentTiddler=object;var item=createTiddlyElement(this.place,"div",null,"yourSearchItem");item.innerHTML=this.itemHtml;applyHtmlMacros(item,null);refreshElements(item,null)},endRendering:function(pager){currentTiddler=null}});var refreshResult=function(){if(!resultElement||!searchInputField){return}var html=store.getTiddlerText("YourSearchResultTemplate");if(!html){html="<b>Tiddler YourSearchResultTemplate not found</b>"}resultElement.innerHTML=html;applyHtmlMacros(resultElement,null);refreshElements(resultElement,null);var itemRenderer=new MyItemRenderer(resultElement);pager.renderPage(itemRenderer);ensureResultIsDisplayedNicely()};pager.getItemsPerPage=function(){var n=(config.options.chkPreviewText)?abego.toInt(config.options.txtItemsPerPageWithPreview,itemsPerPageWithPreviewDefault):abego.toInt(config.options.txtItemsPerPage,itemsPerPageDefault);return(n>0)?n:1};pager.onPageChanged=function(){refreshResult()};var reopenResultIfApplicable=function(){if(searchInputField==null||!config.options.chkUseYourSearch){return}if((searchInputField.value==lastSearchText)&&lastSearchText&&!isResultOpen()){if(resultElement&&(resultElement.parentNode!=document.body)){document.body.appendChild(resultElement);ensureResultIsDisplayedNicely()}else{abego.YourSearch.onShowResult(true)}}};var invalidateResult=function(){closeResult();resultElement=null;lastSearchText=null};var isDescendantOrSelf=function(self,e){while(e!=null){if(self==e){return true}e=e.parentNode}return false};var onDocumentClick=function(e){if(e.target==searchInputField){return}if(e.target==searchButton){return}if(resultElement&&isDescendantOrSelf(resultElement,e.target)){return}closeResult()};var onDocumentKeyup=function(e){if(e.keyCode==27){closeResult()}};addEvent(document,"click",onDocumentClick);addEvent(document,"keyup",onDocumentKeyup);var myStorySearch=function(text,useCaseSensitive,useRegExp){lastSearchText=text;setLastResults(findMatches(store,text,useCaseSensitive,useRegExp,"title","excludeSearch"));abego.YourSearch.onShowResult()};var myMacroSearchHandler=function(place,macroName,params,wikifier,paramString,tiddler){initStylesheet();lastSearchText="";var searchTimeout=null;var doSearch=function(txt){if(config.options.chkUseYourSearch){myStorySearch(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch)}else{story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch)}lastSearchText=txt.value};var clickHandler=function(e){doSearch(searchInputField);return false};var keyHandler=function(e){if(!e){e=window.event}searchInputField=this;switch(e.keyCode){case 13:if(e.ctrlKey&&lastNewTiddlerButton&&isResultOpen()){lastNewTiddlerButton.onclick.apply(lastNewTiddlerButton,[e])}else{doSearch(this)}break;case 27:if(isResultOpen()){closeResult()}else{this.value="";clearMessage()}break}if(String.fromCharCode(e.keyCode)==this.accessKey||e.altKey){reopenResultIfApplicable()}if(this.value.length<3&&searchTimeout){clearTimeout(searchTimeout)}if(this.value.length>2){if(this.value!=lastSearchText){if(!config.options.chkUseYourSearch||config.options.chkSearchAsYouType){if(searchTimeout){clearTimeout(searchTimeout)}var txt=this;searchTimeout=setTimeout(function(){doSearch(txt)},500)}}else{if(searchTimeout){clearTimeout(searchTimeout)}}}if(this.value.length==0){closeResult()}};var focusHandler=function(e){this.select();clearMessage();reopenResultIfApplicable()};var args=paramString.parseParams("list",null,true);var buttonAtRight=getFlag(args,"buttonAtRight");var sizeTextbox=getParam(args,"sizeTextbox",this.sizeTextbox);var txt=createTiddlyElement(null,"input",null,"txtOptionInput searchField",null);if(params[0]){txt.value=params[0]}txt.onkeyup=keyHandler;txt.onfocus=focusHandler;txt.setAttribute("size",sizeTextbox);txt.setAttribute("accessKey",this.accessKey);txt.setAttribute("autocomplete","off");if(config.browser.isSafari){txt.setAttribute("type","search");txt.setAttribute("results","5")}else{if(!config.browser.isIE){txt.setAttribute("type","text")}}var btn=createTiddlyButton(null,this.label,this.prompt,clickHandler);if(place){if(!buttonAtRight){place.appendChild(btn)}place.appendChild(txt);if(buttonAtRight){place.appendChild(btn)}}searchInputField=txt;searchButton=btn};var openAllFoundTiddlers=function(){closeResult();var results=getLastResults();var n=results.length;if(n){var titles=[];for(var i=0;i<n;i++){titles.push(results[i].title)}story.displayTiddlers(null,titles)}};var createOptionWithRefresh=function(place,optionParams,wikifier,tiddler){invokeMacro(place,"option",optionParams,wikifier,tiddler);var elem=place.lastChild;var oldOnClick=elem.onclick;elem.onclick=function(e){var result=oldOnClick.apply(this,arguments);refreshResult();return result};return elem};var removeTextDecoration=function(s){var removeThis=["''","{{{","}}}","//","<<<","/***","***/"];var reText="";for(var i=0;i<removeThis.length;i++){if(i!=0){reText+="|"}reText+="("+removeThis[i].escapeRegExp()+")"}return s.replace(new RegExp(reText,"mg"),"").trim()};var getShortCutNumber=function(){var i=indexInPage;return(i>=0&&i<=9)?(i<9?(i+1):0):-1};var limitedTextRenderer=new abego.LimitedTextRenderer();var renderLimitedText=function(place,s,maxLen){limitedTextRenderer.render(place,s,maxLen,lastQuery.getMarkRegExp())};var oldTiddlyWikiSaveTiddler=TiddlyWiki.prototype.saveTiddler;TiddlyWiki.prototype.saveTiddler=function(title,newTitle,newBody,modifier,modified,tags,fields){oldTiddlyWikiSaveTiddler.apply(this,arguments);invalidateResult()};var oldTiddlyWikiRemoveTiddler=TiddlyWiki.prototype.removeTiddler;TiddlyWiki.prototype.removeTiddler=function(title){oldTiddlyWikiRemoveTiddler.apply(this,arguments);invalidateResult()};config.macros.yourSearch={label:"yourSearch",prompt:"Gives access to the current/last YourSearch result",handler:function(place,macroName,params,wikifier,paramString,tiddler){if(params.length==0){return}var name=params[0];var func=config.macros.yourSearch.funcs[name];if(func){func(place,macroName,params,wikifier,paramString,tiddler)}},tests:{"true":function(){return true},"false":function(){return false},found:function(){return getLastResultsCount()>0},previewText:function(){return config.options.chkPreviewText}},funcs:{itemRange:function(place){if(getLastResultsCount()){var lastIndex=pager.getLastIndexOnPage();var s="%0 - %1".format([pager.getFirstIndexOnPage()+1,lastIndex+1]);createTiddlyText(place,s)}},count:function(place){createTiddlyText(place,getLastResultsCount().toString())},query:function(place){if(lastQuery){createTiddlyText(place,lastQuery.toString())}},newTiddlerButton:function(place){if(lastQuery){var r=abego.parseNewTiddlerCommandLine(lastQuery.getQueryText());var btn=config.macros.newTiddler.createNewTiddlerButton(place,r.title,r.params,"papier","Créer un papier comportant les critères de recherche. (Touches: Ctrl-Enter; Séparateurs: '.', '#')",null,"text");var oldOnClick=btn.onclick;btn.onclick=function(){closeResult();oldOnClick.apply(this,arguments)};lastNewTiddlerButton=btn}},linkButton:function(place,macroName,params,wikifier,paramString,tiddler){if(params<2){return}var tiddlyLink=params[1];var text=params<3?tiddlyLink:params[2];var tooltip=params<4?text:params[3];var accessKey=params<5?null:params[4];var btn=createTiddlyButton(place,text,tooltip,closeResultAndDisplayTiddler,null,null,accessKey);btn.setAttribute("tiddlyLink",tiddlyLink)},closeButton:function(place,macroName,params,wikifier,paramString,tiddler){createTiddlyButton(place,"fermer","Fermer les résultats (Touche: ESC)",closeResult)},openAllButton:function(place,macroName,params,wikifier,paramString,tiddler){var n=getLastResultsCount();if(n==0){return}var title=n==1?"apporter":"ouvrir tous les %0 papiers".format([n]);var button=createTiddlyButton(place,title,"Apporter tous les papiers trouvés (touches: Alt-O)",openAllFoundTiddlers);button.setAttribute("accessKey","O")},naviBar:function(place,macroName,params,wikifier,paramString,tiddler){pager.addPageNavigation(place)},"if":function(place,macroName,params,wikifier,paramString,tiddler){if(params.length<2){return}var testName=params[1];var negate=(testName=="not");if(negate){if(params.length<3){return}testName=params[2]}var test=config.macros.yourSearch.tests[testName];var showIt=false;try{if(test){showIt=test(place,macroName,params,wikifier,paramString,tiddler)!=negate}else{showIt=(!eval(testName))==negate}}catch(ex){}if(!showIt){place.style.display="none"}},chkPreviewText:function(place,macroName,params,wikifier,paramString,tiddler){var elem=createOptionWithRefresh(place,"chkPreviewText",wikifier,tiddler);elem.setAttribute("accessKey","P");elem.title="Show text preview of found tiddlers (Shortcut: Alt-P)";return elem}}};config.macros.foundTiddler={label:"foundTiddler",prompt:"Provides information on the tiddler currently processed on the YourSearch result page",handler:function(place,macroName,params,wikifier,paramString,tiddler){var name=params[0];var func=config.macros.foundTiddler.funcs[name];if(func){func(place,macroName,params,wikifier,paramString,tiddler)}},funcs:{title:function(place,macroName,params,wikifier,paramString,tiddler){if(!currentTiddler){return}var shortcutNumber=getShortCutNumber();var tooltip=shortcutNumber>=0?"Open tiddler (Shortcut: Alt-%0)".format([shortcutNumber.toString()]):"Open tiddler";var btn=createTiddlyButton(place,null,tooltip,closeResultAndDisplayTiddler,null);btn.setAttribute("tiddlyLink",currentTiddler.title);btn.setAttribute("withHilite","true");renderLimitedText(btn,currentTiddler.title,maxCharsInTitle);if(shortcutNumber>=0){btn.setAttribute("accessKey",shortcutNumber.toString())}},tags:function(place,macroName,params,wikifier,paramString,tiddler){if(!currentTiddler){return}renderLimitedText(place,currentTiddler.getTags(),maxCharsInTags)},text:function(place,macroName,params,wikifier,paramString,tiddler){if(!currentTiddler){return}renderLimitedText(place,removeTextDecoration(currentTiddler.text),maxCharsInText)},field:function(place,macroName,params,wikifier,paramString,tiddler){if(!currentTiddler){return}var name=params[1];var len=params.length>2?abego.toInt(params[2],maxCharsInField):maxCharsInField;var v=store.getValue(currentTiddler,name);if(v){renderLimitedText(place,removeTextDecoration(v),len)}},number:function(place,macroName,params,wikifier,paramString,tiddler){var numberToDisplay=getShortCutNumber();if(numberToDisplay>=0){var text="%0)".format([numberToDisplay.toString()]);createTiddlyElement(place,"span",null,"shortcutNumber",text)}}}};var opts={chkUseYourSearch:true,chkPreviewText:true,chkSearchAsYouType:true,chkSearchInTitle:true,chkSearchInText:true,chkSearchInTags:true,chkSearchExtendedFields:true,txtItemsPerPage:itemsPerPageDefault,txtItemsPerPageWithPreview:itemsPerPageWithPreviewDefault};for(var n in opts){if(config.options[n]==undefined){config.options[n]=opts[n]}}config.shadowTiddlers.AdvancedOptions+="\n<<option chkUseYourSearch>> Use 'Your Search' //([[more options|YourSearch Options]]) ([[help|YourSearch Help]])// ";config.shadowTiddlers["YourSearch Help"]="!Field Search\nWith the Field Search you can restrict your search to certain fields of a tiddler, e.g only search the tags or only the titles. The general form is //fieldname//'':''//textToSearch// (e.g. {{{title:intro}}}). In addition one-character shortcuts are also supported for the standard fields {{{title}}}, {{{text}}} and {{{tags}}}:\n|!What you want|!What you type|!Example|\n|Search ''titles only''|start word with ''!''|{{{!jonny}}} (shortcut for {{{title:jonny}}})|\n|Search ''contents/text only''|start word with ''%''|{{{%football}}} (shortcut for {{{text:football}}})|\n|Search ''tags only''|start word with ''#''|{{{#Plugin}}} (shortcut for {{{tags:Plugin}}})|\n\nUsing this feature you may also search the extended fields (\"Metadata\") introduced with TiddlyWiki 2.1, e.g. use {{{priority:1}}} to find all tiddlers with the priority field set to \"1\".\n\nYou may search a word in more than one field. E.g. {{{!#Plugin}}} (or {{{title:tags:Plugin}}} in the \"long form\") finds tiddlers containing \"Plugin\" either in the title or in the tags (but does not look for \"Plugin\" in the text). \n\n!Boolean Search\nThe Boolean Search is useful when searching for multiple words.\n|!What you want|!What you type|!Example|\n|''All words'' must exist|List of words|{{{jonny jeremy}}} (or {{{jonny and jeremy}}})|\n|''At least one word'' must exist|Separate words by ''or''|{{{jonny or jeremy}}}|\n|A word ''must not exist''|Start word with ''-''|{{{-jonny}}} (or {{{not jonny}}})|\n\n''Note:'' When you specify two words, separated with a space, YourSearch finds all tiddlers that contain both words, but not necessarily next to each other. If you want to find a sequence of word, e.g. '{{{John Brown}}}', you need to put the words into quotes. I.e. you type: {{{\"john brown\"}}}.\n\nUsing parenthesis you may change the default \"left to right\" evaluation of the boolean search. E.g. {{{not (jonny or jeremy)}}} finds all tiddlers that contain neither \"jonny\" nor \"jeremy. In contrast to this {{{not jonny or jeremy}}} (i.e. without parenthesis) finds all tiddlers that either don't contain \"jonny\" or that contain \"jeremy\".\n\n!'Exact Word' Search\nBy default a search result all matches that 'contain' the searched text. E.g. if you search for {{{Task}}} you will get all tiddlers containing 'Task', but also '~CompletedTask', '~TaskForce' etc.\n\nIf you only want to get the tiddlers that contain 'exactly the word' you need to prefix it with a '='. E.g. typing '=Task' will find the tiddlers that contain the word 'Task', ignoring words that just contain 'Task' as a substring.\n\n!~CaseSensitiveSearch and ~RegExpSearch\nThe standard search options ~CaseSensitiveSearch and ~RegExpSearch are fully supported by YourSearch. However when ''~RegExpSearch'' is on Filtered and Boolean Search are disabled.\n\nIn addition you may do a \"regular expression\" search even with the ''~RegExpSearch'' set to false by directly entering the regular expression into the search field, framed with {{{/.../}}}. \n\nExample: {{{/m[ae][iy]er/}}} will find all tiddlers that contain either \"maier\", \"mayer\", \"meier\" or \"meyer\".\n\n!~JavaScript Expression Filtering\nIf you are familiar with JavaScript programming and know some TiddlyWiki internals you may also use JavaScript expression for the search. Just enter a JavaScript boolean expression into the search field, framed with {{{ { ... } }}}. In the code refer to the variable tiddler and evaluate to {{{true}}} when the given tiddler should be included in the result. \n\nExample: {{{ { tiddler.modified > new Date(\"Jul 4, 2005\")} }}} returns all tiddler modified after July 4th, 2005.\n\n!Combined Search\nYou are free to combine the various search options. \n\n''Examples''\n|!What you type|!Result|\n|{{{!jonny !jeremy -%football}}}|all tiddlers with both {{{jonny}}} and {{{jeremy}}} in its titles, but no {{{football}}} in content.|\n|{{{#=Task}}}|All tiddlers tagged with 'Task' (the exact word). Tags named '~CompletedTask', '~TaskForce' etc. are not considered.|\n\n!Access Keys\nYou are encouraged to use the access keys (also called \"shortcut\" keys) for the most frequently used operations. For quick reference these shortcuts are also mentioned in the tooltip for the various buttons etc.\n\n|!Key|!Operation|\n|{{{Alt-F}}}|''The most important keystroke'': It moves the cursor to the search input field so you can directly start typing your query. Pressing {{{Alt-F}}} will also display the previous search result. This way you can quickly display multiple tiddlers using \"Press {{{Alt-F}}}. Select tiddler.\" sequences.|\n|{{{ESC}}}|Closes the [[YourSearch Result]]. When the [[YourSearch Result]] is already closed and the cursor is in the search input field the field's content is cleared so you start a new query.|\n|{{{Alt-1}}}, {{{Alt-2}}},... |Pressing these keys opens the first, second etc. tiddler from the result list.|\n|{{{Alt-O}}}|Opens all found tiddlers.|\n|{{{Alt-P}}}|Toggles the 'Preview Text' mode.|\n|{{{Alt-'<'}}}, {{{Alt-'>'}}}|Displays the previous or next page in the [[YourSearch Result]].|\n|{{{Return}}}|When you have turned off the 'as you type' search mode pressing the {{{Return}}} key actually starts the search (as does pressing the 'search' button).|\n\n//If some of these shortcuts don't work for you check your browser if you have other extensions installed that already \"use\" these shortcuts.//";config.shadowTiddlers["YourSearch Options"]="|>|!YourSearch Options|\n|>|<<option chkUseYourSearch>> Use 'Your Search'|\n|!|<<option chkPreviewText>> Show Text Preview|\n|!|<<option chkSearchAsYouType>> 'Search As You Type' Mode (No RETURN required to start search)|\n|!|Default Search Filter:<<option chkSearchInTitle>>Title ('!')     <<option chkSearchInText>>Text ('%')     <<option chkSearchInTags>>Tags ('#')    <<option chkSearchExtendedFields>>Extended Fields<html><br><font size=\"-2\">The fields of a tiddlers that are searched when you don't explicitly specify a filter in the search text <br>(Explictly specify fields using one or more '!', '%', '#' or 'fieldname:' prefix before the word/text to find).</font></html>|\n|!|Number of items on search result page: <<option txtItemsPerPage>>|\n|!|Number of items on search result page with preview text: <<option txtItemsPerPageWithPreview>>|\n";config.shadowTiddlers.YourSearchStyleSheet="/***\n!~YourSearchResult Stylesheet\n***/\n/*{{{*/\n.yourSearchResult {\n\tposition: absolute;\n\twidth: 800px;\n\n\tpadding: 0.2em;\n\tlist-style: none;\n\tmargin: 0;\n\n\tbackground: #ffd;\n\tborder: 1px solid DarkGray;\n}\n\n/*}}}*/\n/***\n!!Summary Section\n***/\n/*{{{*/\n.yourSearchResult .summary {\n\tborder-bottom-width: thin;\n\tborder-bottom-style: solid;\n\tborder-bottom-color: #999999;\n\tpadding-bottom: 4px;\n}\n\n.yourSearchRange, .yourSearchCount, .yourSearchQuery   {\n\tfont-weight: bold;\n}\n\n.yourSearchResult .summary .button {\n\tfont-size: 10px;\n\n\tpadding-left: 0.3em;\n\tpadding-right: 0.3em;\n}\n\n.yourSearchResult .summary .chkBoxLabel {\n\tfont-size: 10px;\n\n\tpadding-right: 0.3em;\n}\n\n/*}}}*/\n/***\n!!Items Area\n***/\n/*{{{*/\n.yourSearchResult .marked {\n\tbackground: none;\n\tfont-weight: bold;\n}\n\n.yourSearchItem {\n\tmargin-top: 2px;\n}\n\n.yourSearchNumber {\n\tcolor: #808080;\n}\n\n\n.yourSearchTags {\n\tcolor: #008000;\n}\n\n.yourSearchText {\n\tcolor: #808080;\n\tmargin-bottom: 6px;\n}\n\n/*}}}*/\n/***\n!!Footer\n***/\n/*{{{*/\n.yourSearchFooter {\n\tmargin-top: 8px;\n\tborder-top-width: thin;\n\tborder-top-style: solid;\n\tborder-top-color: #999999;\n}\n\n.yourSearchFooter a:hover{\n\tbackground: none;\n\tcolor: none;\n}\n/*}}}*/\n/***\n!!Navigation Bar\n***/\n/*{{{*/\n.yourSearchNaviBar a {\n\tfont-size: 16px;\n\tmargin-left: 4px;\n\tmargin-right: 4px;\n\tcolor: black;\n\ttext-decoration: underline;\n}\n\n.yourSearchNaviBar a:hover {\n\tbackground-color: none;\n}\n\n.yourSearchNaviBar .prev {\n\tfont-weight: bold;\n\tcolor: blue;\n}\n\n.yourSearchNaviBar .currentPage {\n\tcolor: #FF0000;\n\tfont-weight: bold;\n\ttext-decoration: none;\n}\n\n.yourSearchNaviBar .next {\n\tfont-weight: bold;\n\tcolor: blue;\n}\n/*}}}*/\n";config.shadowTiddlers.YourSearchResultTemplate='<!--\n{{{\n-->\n<span macro="yourSearch if found">\n<!-- The Summary Header ============================================ -->\n<table class="summary" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody>\n  <tr>\n\t<td align="left">\n\t\tRésultat <span class="yourSearchRange" macro="yourSearch itemRange"></span>\n\t\t&nbsp;de&nbsp;<span class="yourSearchCount" macro="yourSearch count"></span>\n\t\tpour&nbsp;<span class="yourSearchQuery" macro="yourSearch query"></span>\n\t</td>\n\t<td class="yourSearchButtons" align="right">\n\t\t<span macro="yourSearch chkPreviewText"></span><span class="chkBoxLabel">prévisualiser</span>\n\t\t<span macro="yourSearch newTiddlerButton"></span>\n\t\t<span macro="yourSearch openAllButton"></span>\n\t\t<span macro="yourSearch linkButton \'YourSearch Options\' options \'Configurer\'"></span>\n\t\t<span macro="yourSearch linkButton \'YourSearch Help\' aide \'Aide\'"></span>\n\t\t<span macro="yourSearch closeButton"></span>\n\t</td>\n  </tr>\n</tbody></table>\n\n<!-- The List of Found Tiddlers ============================================ -->\n<div id="yourSearchResultItems" itemsPerPage="25" itemsPerPageWithPreview="10"></div>\n\n<!-- The Footer (with the Navigation) ============================================ -->\n<table class="yourSearchFooter" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody>\n  <tr>\n\t<td align="left">\n\t\tPage: <span class="yourSearchNaviBar" macro="yourSearch naviBar"></span>\n\t</td>\n\t<td align="right"><span macro="yourSearch version"></span>, <span macro="yourSearch copyright"></span>\n\t</td>\n  </tr>\n</tbody></table>\n<!-- end of the \'tiddlers found\' case =========================================== -->\n</span>\n\n\n<!-- The "No tiddlers found" case =========================================== -->\n<span macro="yourSearch if not found">\n<table class="summary" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody>\n  <tr>\n\t<td align="left">\n\t\tRésultat: Aucun papier trouvé pour <span class="yourSearchQuery" macro="yourSearch query"></span>.\n\t</td>\n\t<td class="yourSearchButtons" align="right">\n\t\t<span macro="yourSearch newTiddlerButton"></span>\n\t\t<span macro="yourSearch linkButton \'YourSearch Options\' options \'Configurer\'"></span>\n\t\t<span macro="yourSearch linkButton \'YourSearch Help\' help \'Get help how to use YourSearch\'"></span>\n\t\t<span macro="yourSearch closeButton"></span>\n\t</td>\n  </tr>\n</tbody></table>\n</span>\n\n\n<!--\n}}}\n-->\n';config.shadowTiddlers.YourSearchItemTemplate="<!--\n{{{\n-->\n<span class='yourSearchNumber' macro='foundTiddler number'></span>\n<span class='yourSearchTitle' macro='foundTiddler title'/></span>&nbsp;-&nbsp;\n<span class='yourSearchTags' macro='foundTiddler field tags 50'/></span>\n<span macro=\"yourSearch if previewText\"><div class='yourSearchText' macro='foundTiddler field text 250'/></div></span>\n<!--\n}}}\n-->";config.shadowTiddlers.YourSearch="<<tiddler [[YourSearch Help]]>>";config.shadowTiddlers["YourSearch Result"]="The popup-like window displaying the result of a YourSearch query.";config.macros.search.handler=myMacroSearchHandler;var checkForOtherHijacker=function(){if(config.macros.search.handler!=myMacroSearchHandler){alert("Message from YourSearchPlugin:\n\n\nAnother plugin has disabled the 'Your Search' features.\n\n\nYou may disable the other plugin or change the load order of \nthe plugins (by changing the names of the tiddlers)\nto enable the 'Your Search' features.")}};setTimeout(checkForOtherHijacker,5000);abego.YourSearch.getStandardRankFunction=function(){return standardRankFunction};abego.YourSearch.getRankFunction=function(){return abego.YourSearch.getStandardRankFunction()};abego.YourSearch.getCurrentTiddler=function(){return currentTiddler};abego.YourSearch.closeResult=function(){closeResult()};abego.YourSearch.getFoundTiddlers=function(){return lastResults};abego.YourSearch.getQuery=function(){return lastQuery};abego.YourSearch.onShowResult=function(useOldResult){highlightHack=lastQuery?lastQuery.getMarkRegExp():null;if(!useOldResult){pager.setItems(getLastResults())}if(!resultElement){resultElement=createTiddlyElement(document.body,"div",yourSearchResultID,"yourSearchResult")}else{if(resultElement.parentNode!=document.body){document.body.appendChild(resultElement)}}refreshResult();highlightHack=null}})()};
//%/
/***
!~YourSearchResult Stylesheet
***/
/*{{{*/
.yourSearchResult {
	position: absolute;
	width: 800px;

	padding: 0.2em;
	list-style: none;
	margin: 0;

	background: #ffd;
	border: 1px solid DarkGray;
}

/*}}}*/
/***
!!Summary Section
***/
/*{{{*/
.yourSearchResult .summary {
	border-bottom-width: thin;
	border-bottom-style: solid;
	border-bottom-color: #999999;
	padding-bottom: 4px;
}

.yourSearchRange, .yourSearchCount, .yourSearchQuery   {
	font-weight: bold;
}

.yourSearchResult .summary .button {
	font-size: 10px;

	padding-left: 0.3em;
	padding-right: 0.3em;
}

.yourSearchResult .summary .chkBoxLabel {
	font-size: 10px;

	padding-right: 0.3em;
}

/*}}}*/
/***
!!Items Area
***/
/*{{{*/
.yourSearchResult .marked {
	background: none;
	font-weight: bold;
}

.yourSearchItem {
	margin-top: 2px;
}

.yourSearchNumber {
	color: #808080;
}


.yourSearchTags {
	color: #008000;
}

.yourSearchText {
	color: #808080;
	margin-bottom: 6px;
}

/*}}}*/
/***
!!Footer
***/
/*{{{*/
.yourSearchFooter {
	margin-top: 8px;
	border-top-width: thin;
	border-top-style: solid;
	border-top-color: #999999;
}

.yourSearchFooter a:hover{
	background: none;
	color: none;
}
/*}}}*/
/***
!!Navigation Bar
***/
/*{{{*/
.yourSearchNaviBar a {
	font-size: 16px;
	margin-left: 4px;
	margin-right: 4px;
	color: black;
	text-decoration: underline;
}

.yourSearchNaviBar a:hover {
	background-color: none;
}

.yourSearchNaviBar .prev {
	font-weight: bold;
	color: blue;
}

.yourSearchNaviBar .currentPage {
	color: #FF0000;
	font-weight: bold;
	text-decoration: none;
}

.yourSearchNaviBar .next {
	font-weight: bold;
	color: blue;
}
/*}}}*/
Pour finir, une "main" de photos pour lesquelles tu n'auras guère besoin de commentaires pour les comprendre. Cela montre essentiellement la versatilité du système :

[[main|main/index.html]]

- Alors ?
- Très impressionnant ! Je trouve ça excellent...
- Et ceci a été fait sur un codex ! Tu en veux un ?
- Si j'en avais l'utilité, oui !
De quel environnement parle-t-on ? Une partie de mon travail consiste à "dépoussiérer", c'est-à-dire s'assurer de l'absence de dispositifs d'espionnage électronique. Mais je ne suis pas toujours appelé et une caméra, possiblement de surveillance, peut recueillir les saisies sur un clavier, en particulier ce qui peut s'apparenter à un mot de passe.
Le clavier que j'ai conçu permet de former des combinaisons de touches courtes et logiques, donc simples, tout en injectant en réalité des signes complexes et donc incassables.
L'autre avantage est sa taille très réduite tout en offrant de vraies touches mécaniques pour des saisies confortables avec tous les signes et accents voulus selon un schéma logique révolutionnaire. Ses dimensions réduites permettent un protocole par lequel la compromission du clavier devient impossible : avec l'ordinateur et son portefeuille, son emport est aisé et naturel.

Ici, une photo de ce type de clavier.
+++<[img(,600px)[k/photos/clavobliquepf.png]]>===
//^^Les clés de chiffrement sont soit faciles et donc cassables, soit unique et donc son accès sur un serveur donne accès à tout, soit difficiles et donc notées et trouvables.^^//
Une des clés usb fournies est un système d'exploitation autonome qui shunte celui de l'ordinateur. La clé offre des outils logiciels de manière à pouvoir travailler, et d'autres destinés à communiquer les données. Ce protocole est destiné aux cas les plus sensibles. En effet, le chiffrement n'est qu'une partie de la question de la discrétion. Il n'évite pas, par exemple, de savoir qui a communiqué, avec qui, quand et où, avec quoi, etc. C'est suffisant pour monter des actions ou compléter des conclusions. L'anonymat est donc, éventuellement, une autre affaire réclamant d'autres outils. Enfin, il peut aussi être utile de devoir compter sur des preuves à opposer à la Justice. Ceci encore sont d'autres outils. Alors qu'un ordinateur ne peut garantir la destruction de données parce qu'elles sont disséminées et dupliquées de manière solide et complexe, notre clé usb système vient en soutien pour certaines communications.

Avec le codex qui s'exprime en html, rien de plus simple que de partager un document complexe sans envoi :
+++<[img(,600px)[k/photos/c71.png]]>===
//^^Trois aspects assurent des objectifs différents d'une communication sensible qu'il convient de composer : le chiffrement, l'anonymat et la preuve.^^//
Voici donc un adepte. Moine, il lui faut une arme pour être soldat. Toute arme est un moyen de communication. L'épée, la balle, l'avion, le mot, sont des vecteurs. La proximité est une influence, une modification d'état. L'arme des armes, c'est le miroir, le conseil de soi, la réflexion, nourrie et forgée qui prendra forme, idée pour soumettre les idées. Ce miroir opérationnel peut se nommer secrétaire en raison du secret qui doit entourer la gestation.
Autrefois, le secrétaire était sténographe-dactylographe. Grâce à l'ordinateur, plus facile que la petite imprimerie portative, l'idée peut être mise en forme sans intermédiaire potentiellement indiscret. Mais les codes informatiques rendent une dépendance peut-être plus grande encore. J'ai réglé cette question en supprimant les boîtes noires, trop magiques pour être honnêtes, pour les remplacer par des boîte transparentes où l'opérateur sait écrire le code derrière les boutons de commandes dont il a besoin. En un mot, le soldat a une arme fiable et puissante qu'il sait configurer et entretenir.
Est-ce rebutant ? Oui, si une heure par jour pendant une petite semaine d'instruction l'est.
Le codex est mon logiciel universel révolutionnaire comme l'est le clavier. Il est difficile de dire exhaustivement en quoi le codex est supérieur aux logiciels habituellement utilisés. Bien sûr, l'argument premier est que son code est ouvert. Tout connaisseur verra rapidement sa légitimité, il n'a, contrairement aux solutions payantes, aucun cheval de Troie. Ceci dit, il faut ajouter qu'il n'est constitué que d'un fichier unique, de type html, qui n'a en conséquence aucunement besoin d'installation. Cela signifie qu'il est transportable comme tel et comme tel opérationnel. Ceci est rendu possible par le fait que son code de fonctionnement et le contenu créé forment le même fichier.
Du point de vue de la sûreté de l'information, cela résoud des questions très importantes grâce à cet aspect centralisé. Mais aussi du point de vue pratique : inutile de se demander quoi copier, emporter et où trouver cela ; tel fichier comporte tout. Son clonage par voie de synchronisation assure sa sûreté et on sait protéger ce point non éparpillé.
Les fonctions du codex sont pléthoriques mais son interface est pourtant extrêmement épurée, au point de paraître simpliste. C'est que les fonctions se construisent selon les besoins de chacun et les invocations transparentes.
Par exemple, contrairement à Word qui, pour satisfaire tout le monde, propose autant de boutons et de menus pour les questions de mise en forme, le codex laisse écrire le code pour les mises en forme voulues ; on les invoquera ensuite à dessein. La différence est à peu près comparable à celle qui sépare l'écriture idéogrammique de l'écriture moderne, par association de signes restreints mais à la souplesse d'emploi, la simplicité et la richesse sans commune mesure. Le style est régi par le css. Les fonctions qui donnent la puissance et la versatilité du codex sont, elles, régies par le javascript. Et l'ensemble par le html. Au milieu de ceci, le contenu. Une des conséquences immédiates est la mise à disposition de n'importe quelle source ou partie de source, en nombre quelconque, discriminées à l'envie et s'étalant aux yeux de l'utilisateur de la manière qui lui sied. Ainsi, il peut ouvrir instantanément cinquante papiers qu'il désire consulter ou travailler ou synthétiser et en disposer par onglets ou à la suite ou encore en liens avec aperçus, etc. Il peut les ordonner en les faisant glisser et créer en un tour de main un papier de synthèse sur cet ordre sous une mise en forme propre. Le codex peut aussi servir d'agenda avec rappels, de présentation, de base de données... Les notes de renvoi, les tables de matière, les liens divers et variés, les tables de compte-rendus, le système des étiquettes, la recherche booléenne et bien d'autres choses rendent le codex sans rival. Alors qu'un simple traitement de texte demande des efforts d'apprentissage remis en cause par d'incessantes versions qui remettent même en cause la compatibilité de l'affichage du contenu, le codex est solide, invariant, inépuisable et simple. On peut par exemple lui faire rendre un ensemble de codex, disons, appartenant chacun à un agent. Le codex gère en outre les versions des papiers, ce qui est un gage de sûreté de l'information. S'exprimant en html, qui est le format avéré de l'avenir depuis maintenant fort longtemps, rien n'est plus simple que de partager des papiers du codex sans déplacement à travers des serveurs inconnus grâce à des clés de chiffrement et le système Tor.

Il n'est pas évident de te dire les avantages du codex par une photo, mais en voici tout de même une qui montre la manière dont on peut avoir tous les papiers d'un dossier devant soi.
+++<[img(,600px)[k/photos/codx.png]]>===
//^^Les logiciels propriétaires monopolistiques agissent presque comme une feuille de carbone sous les saisies de l'utilisateur. Il faut un logiciel de traitement des données universel, ouvert, simple, gérant automatiquement les versions, sans installation, puissant et versatile mais léger...^^//
Les écrans indépendants donnent de larges possibilités de disposition. L'une d'elles permet l'emploi en plein air même par temps ensoleillé. Ceci n'est pas si anecdotique. De même que le pointeur remplace avantageusement la souris pour sa précision, son confort et sa position fixe, le traitement à la pâte thermique du processeur de l'ordinateur le rend résistant à la chaleur tout en assurant l'absence totale de bruit que tout ventilateur provoque avec à la clé une certaine fatigue de l'opérateur.
Le système de deux écrans offre la possibilité de partager en toute discrétion une présentation sans devoir téléguider la réunion dans une salle équipée, généralement d'un écran géant fort peu discret à la vue et sans doute encore moins du point de vue connectivité électronique. En effet, il suffit à une équipe pareillement équipée de réaliser une chaîne d'écrans où chaque interlocuteur a le sien devant lui, posé par exemple à plat comme une feuille de journal dans une orientation éventuellement verticale pour une lecture plus naturelle. On voit alors ce qu'a le présentateur.

Je donne là une possibilité, courante, d'espionnage électronique à l'aide de caméra dissimulée.
+++<[img(,600px)[k/photos/bug1x.png]]>===
//^^Les réunions sont une source de captation d'informations sensibles notamment par les écrans géants et connectés qui déterninent même le lieu.^^//
Ma //physique de l'information// décline notamment l'idée selon laquelle la forme diplomatique devra nécessairement descendre dans les usages de l'homme de la rue. En effet, c'est ce niveau qui est celui de l'avenir, comme c'est lui qui fait, expérimente, bute, trouve et invente. C'est lui qui communique et cherche, et à ce titre développe l'intelligence. Mais celle-ci se trouve bloquée si la communication n'adopte pas les formes pour, précisément, les dépasser.
Aucun génie ne s'est révélé dans son emploi, mais tous les employeurs ont assimilé, sinon leurs personnes, leurs noms et leurs travaux. La raison est simple : la passion naît de la liberté, celle d'assouvir sa curiosité. Telles seraient nos //humanités//.
Pour satisfaire ces conditions d'apparition de l'esprit, il faut donc des contraintes volontairement consenties, de celles qui proviennent de la réponse au //pourquoi// ?
Alors, le subtil vient habiter les relations, non seulement vis-à-vis de nos semblables, mais de toute "mécanique" que président les formes. Et la machine intelligente doit aussi recevoir certaines attentions pour rendre au centuple l'investissement d'un comportement responsable. Le tact...

Tiens : voici l'affaire...
+++<[img(,600px)[k/photos/tor_5x.png]]>===
//^^L'ordinateur est à considérer comme un secrétaire particulier. Il détient à ce titre les secrets, et s'il n'est pas de bonne constitution, il trahira.^^//
Il faut comprendre que le nouveau sorcier, l'informaticien, est comme toute personne cherchant à être employé et, à cette fin, développe son art selon les modes, c'est-à-dire les demandes du moment. Or, ces modes viennent de l'Amérique, pays de l'informatique. Si les solutions développées pour elle sont valables pour leurs entreprises, peuvent-elles nécessairement l'être pour les autres, qui devraient chercher à se protéger de leur puissance et de leur voracité ? Mais un développeur suit la tendance, faite de gadgets et de surpuissance qui implique de s'appuyer sur les modules existants pour les associer et les compléter afin de créer la solution qui lui est demandée. Le résultat est positif en termes de transformation des données ; jamais en termes de sûreté, à la fois parce que le temps fait défaut devant la complexité, et parce que les modules employés sont incontournables alors même qu'ils permettent l'espionnage. Ils ne posent pas problème de confidentialité entre des entités de même nationalité partageant les mêmes objectifs, et plutôt les aident largement à les remplir par le vol de données. La vidéo-conférence et l'usage des serveurs font partie des modes où la complexité oblige à des moyens qui dépassent le cadre de l'indépendance, qui est le fondement de toute sûreté.
Le vol d'ordinateur portable est une chose habituelle car tout personnel en possédant un devient une cible pour la somme fabuleuse d'informations qu'il recèle. Qu'il suffise de requérir un instant ses deux mains et l'objet toujours trop encombrant est promptement subtilisé. Voilà pourquoi ma solution décline une composition d'éléments transportables mais de manière discriminée : clavier et ordinateur dans une pochette avec clés usb spéciales, tournevis et étiquettes de sécurité d'une part ; une malette d'autre part renfermant mais aussi organisant deux écrans, un séparateur, un bloc de prises, une barre de son, un pointeur professionnel et des câbles.

La sacoche est conçue pour être discrète, élégante et pratique :
+++<[img(,600px)[k/photos/clav_p.png]]>===
//^^Si les éléments clés dépassent la taille d'un portefeuille, ils seront forcément laissés tôt ou tard et donc volés ou compromis.^^//
Le système TOR est absolument complet. Il n'y manque pas même étiquettes ou tournevis. Et, bien entendu, malette et sacoche. Mais le détail est encore mis sur les symboles sur ces éléments de transport qui portent, respectivement, l'aigle et le reptile comme référence aux animaux nietzschéens dans son Zarathoustra : hauteur de vue pour le sens de la terre et tact servant la défiance. C'est que la //distinction// peut seule amener à faire adopter librement une tournure d'esprit, une moralité, lorsqu'elles sont considérées par les anonymes du Grand Jeu des contraintes. Par la constitution d'équipes, et par le bas, peut-on ainsi propager la vertu : par l'exemple d'un système qui fonctionne et distingue. Autrement dit en donnant envie.

L'usage d'un matériel nouveau ne peut qu'attirer attention et convoitise, puis fantasmes. Mon clavier entre dans cette stratégie, mais pas seulement lui :
+++<[img(,600px)[k/photos/cc.png]]>===
//^^Matériel et équipement standards ne rendent ni la distinction ni les moyens qui font le sentiment d'une élite reconnaissable et sa motivation.^^//
>Prélude au codex : l'ouverture du système.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago4.webm" type="video/webm">
 </video> 
  </body>
</html>
>Balises usuelles, tableaux, etc.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago12.webm" type="video/webm">
 </video> 
  </body>
</html>
>Un exemple d'intégration des codes pour une présentation saisissante.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago13.webm" type="video/webm">
 </video> 
  </body>
</html>
>Un codex pour les voir tous et autres fonctionnalités extraordinaires.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago14.webm" type="video/webm">
 </video> 
  </body>
</html>
>Un journal et des codes.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago2.webm" type="video/webm">
 </video> 
  </body>
</html>
>Un exemple de présentation.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago3.webm" type="video/webm">
 </video> 
  </body>
</html>
>Interaction codex - téléphone - ordinateur ou comment travailler sur le pouce en déplacement.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago5.webm" type="video/webm">
 </video> 
  </body>
</html>
>Etat des lieux : où en sommes-nous sur les dossiers.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago6.webm" type="video/webm">
 </video> 
  </body>
</html>
>De l'usage combiné du codex et de la tablette graphique.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago8.webm" type="video/webm">
 </video> 
  </body>
</html>
>Personnaliser le codex afin qu'il nous représente.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago9.webm" type="video/webm">
 </video> 
  </body>
</html>
>Encore du code, des fonctionnalités et un aspect capital du codex : sa capacité à garder les versions.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago10.webm" type="video/webm">
 </video> 
  </body>
</html>
>Créer facilement une synthèse.
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "1024" height="819" controls>
  <source src="k\son\pedago11.webm" type="video/webm">
 </video> 
  </body>
</html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="">
  <title></title>
  </head>
  <body>
<video width= "600" height="480" controls>
  <source src="k\photos\sc.webm" type="video/webm">
 </video> 
  </body>
</html>
- Comment vas-tu ?
- Bien ! Je suis très content de moi : j'ai bien travaillé.
- Sur quoi ?
- Oh !... Comment dire ? Je me suis penché sur la question des ordinateurs, mais d'une manière profonde. Cela m'a pris 3 bons mois intensifs. Trois seulement, parce que j'avais travaillé auparavent d'arrache-pied depuis fort longtemps sur un certain nombre de solutions.
- C'est pour qui ?
- Pour moi, d'abord. Mon étude est destinée à des équipes qui rencontrent des problèmes récurrents. Mais personne ne voudra de ma solution.
- Tiens ! Et pourquoi donc ?
- Il n'y a plus de dirigeants ; seulement des gestionnaires qui gèrent leur position. Quel que soit le niveau de responsabilité, la responsabilité s'évanouit avec les solutions parce qu'elles réclament quelque chose qui a à voir avec le travail.
- Tu es bien sévère !
- Pas même. J'ai expérimenté, et partout j'ai pu constater que même l'écoute relevait de l'effort. Quant à la compréhension, elle est encore comme une sorte d'horizon. Mais je parle de solution opérationnelle, qui nécessite un engagement personnel. Une chimère.
- Te voici amère !
- C'est plutôt le goût qu'on trouve à ma solution. Veux-tu l'entendre ?
- Allons-y !
- Assieds-toi et prends une respiration.
On recrute quelqu'un ; il a des compétences. Cela doit-il suffire ? Bien sûr que non. Cette personne ne sait même pas pourquoi elle travaille. Plutôt, elle croit le savoir, dans une superficialité telle qu'on peut parler de fragilité structurelle. Cette ignorance fonde toutes les autres par complaisance. On se complaît dans l'idée que l'on est là presque anonymement et qu'un autre anonyme est là pour régler ce dont on n'est pas directement payé à s'occuper. En un mot, la paie est un quitus de responsabilité. Savoir un fonctionnement hors de sa sphère dite de compétences pour adopter un comportement plus sûr est une proposition hérétique. La première mesure consiste donc à instruire une hérésie sur une religion de l'irresponsabilité. Il faut dire la doctrine de la secte, ses principes, avant que de considérer ses rites, c'est-à-dire ses protocoles. J'ai donc mis à disposition une instruction en sûreté civique qui aborde tout par le fil de la forme que je dénomme informatique. L'instruction est automatisée et adaptée aux deux sexes, aux jeunes comme aux adultes et aux différentes classes sociales. Des branches spécialisées abordent encore certains sujets comme le commandement ou la question des épidémies. L'angle demeure le même, car universel ; il est celui d'une physique de l'information. Grâce à cette vision, aucun effort n'est requis pour comprendre des systèmes aussi différents que l'homme, l'animal, le microbe, la société ou la machine. Une telle connaissance marque définitivement au point de faire d'une recrue un moine-soldat. Sans cette vision, point d'espoir d'aller plus avant dans la sûreté ; sans sûreté, aucun intérêt de construire pour rien.

Mais quoi de mieux qu'un petit film si tu veux t'en faire une idée :
+++[>]<<tiddler [[film sc]]>>===
Le choix de bureaux de représentation choisis pour //faire comme tout le monde// est une absurdité courante et suit celle des solutions informatiques. Aucun de ces choix ne permet la maîtrise de l'environnement. Au contraire, les accès et les proximités sont contrôlés par l'ennemi. La femme de ménage qui n'est pas un ennemi, comme un traducteur ou un homme à tout faire, ou même un collaborateur, peut le devenir plus ou moins à son insu. C'est pourquoi les seules solutions techniques ne suffisent pas. Il faut une véritable occupation de l'espace de l'intelligence par l'intelligence. C'est toute l'orientation de mes Instructions en sûreté civique.

J'ai là de quoi donner une idée du Cours Majeur, sorte de tronc commun aux Instructions en sûreté civique...
+++<[img(,600px)[k/photos/cm.png]]>===
//^^Aucun système n'est jamais proposé avec un mode d'emploi intelligent qui commencerait par expliquer les raisons profondes de la démarche avant que de relever les moyens dont l'homme fait partie.^^//
/***

/%***/
/*{{{*/
(function(e){e.fn.outline=function(t,n){function r(e){if(!+e)return false;var t=String(+e).split(""),n="",r=3,i=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"];while(r--)n=(i[+t.pop()+r*10]||"")+n;return Array(+t.join("")+1).join("M")+n}function i(e){var n,i,s="",o,u=t.counterTemplates,a=t.plain,f=a?e.length-1:0;for(n=f;n<e.length;n++){i=e[n];o=n%u.length;switch(u[o].substr(0,1)){case"a":i=String.fromCharCode(96+i);break;case"A":i=String.fromCharCode(64+i);break;case"i":i=r(i).toLowerCase();break;case"I":i=r(i);break}s+=i+u[o].substr(1)}return s+" "}var t=e.extend({},e.fn.outline.defaults,t),n=n||[];this.each(function(){e(this).children("li").each(function(r){var s=n.concat([r+1]);e("<span></span>").addClass(t.liClass).text(i(s)).prependTo(this);e(this).children("ol").outline(t,s)})});if(!n.length)this.addClass(t.olClass)};e.fn.outline.defaults={liClass:"pseudo-ol-li",olClass:"pseudo-ol",counterTemplates:["1.","a.","i."],plain:true};var t=config.macros.outline={handler:function(t){var n=e(t).children().last();while(n.is("br")){n=n.prev()}if(n.is("span, div")){n=n.children("ol").first()}n.outline()}}})(jQuery);config.shadowTiddlers["StyleSheetjQueryOutline"]="/*{{{*/\n"+"ol .pseudo-ol-li { display: none }\n"+"ol.pseudo-ol, ol.pseudo-ol ol { list-style: none; margin-left: 1.5em; padding-left: 0.5em;}\n"+"ol.pseudo-ol {margin-left: 0.5em;padding-left:0em;}\n"+"ol.pseudo-ol .pseudo-ol-li { display: inline; font-weight: bold; padding-right:3px; }\n"+"/*}}}*/";store.addNotification("StyleSheetjQueryOutline",refreshStyles)
//%/
Il en est de même du comportement de l'ordinateur, dicté par ses logiciels et au premier chef son système d'exploitation. Un seul système est libre et donc contrôlable. C'est-à-dire que les deux autres, de la même nation, espionnent. Les mises à jour et autres configurations données pour la forme échappent totalement à l'utilisateur. Les licences emmènent sur des pentes toujours plus audacieuses avec des exigences accrues en termes de ressources pour une lourdeur et des lenteurs assumées. L'ordinateur travaille beaucoup, tout seul. Ma solution Linux offre le chiffrement du disque dur complet, une esthétique raffinée, des fonctionnalités supérieures pour une facilité d'utilisation optimale, une rapidité de mise en oeuvre inégalée avec une fermeture du système en moins de trois secondes et une sécurité transparente.

Bon ; juste pour fixer les idées, voici comment se présente le système d'exploitation.
+++<[img(,600px)[k/photos/lin09.png]]>===
//^^Les systèmes d'exploitation commerciaux sont des boîtes noires dont l'hégémonie ne peut échapper aux intérêts du pays dont ils proviennent.^^//
Parlons à présent du routage en pelure d'oignon que notre système adopte, supérieur aux solutions VPN payantes pour la raison qu'il est naïf et plutôt fautif de se placer en position de devoir croire. Croire que le prestataire fait ce qu'il dit et qu'il resistera aux pressions étatiques, aux attaques, à la corruption, aux rachats et refusera de se conformer aux lois toujours plus dictatoriales et internationales. La question est de préférer la statistique plus favorable du nombre et de l'aléatoire, et même de l'esprit du volontaire à celui du marchand.
Il est, du reste, un biais à rectifier, qui consiste à penser l'ordinateur comme un outil de communication. Il est avant tout un outil universel car traitant de l'information. A cette fin, il est conçu pour ne pas la perdre. Il est une mémoire avec des capacités de transformation. Lui demander l'amnésie est une tâche contraire et pour cette raison incompatible et donc quasiment insurmontable. Toute communication est ainsi un clonage et, en tant que tel, compromet l'exclusivité de l'information. C'est pourquoi ma Réponse informatique introduit des composés pour les maîtriser. On sait quoi emporter, on sait même démonter et remplacer, on sait encore travailler seul et échanger dans une combinaison de moyens technologiques et archaïques constituant la seule parade aux vols de données institutionnalisés.
Courant encore est cet aveu :
''Notre informaticien a mis son équipe sur l'amélioration de la sécurité de notre outil informatique depuis que nous avons fait l'objet d'attaques. Tout a été bloqué. Nous devons changer tout le parc.''
Le cas classique pour lequel je suis appelé est :
''Nous travaillons sur un gros appel d'offres. Nous avons récemment constaté des fuites d'information.''
Il me vient à l'esprit un exemple rencontré qui va nous permettre d'entrer dans le vif du sujet :
''Nous avons demandé à notre responsable informatique de nous fournir l'accès aux courriels d'un de nos employés soupçonné de collusion avec la concurrence. Cela fait trois semaines déjà. Il a argué du fait qu'il n'a pas le temps ; à présent, il prétend que ce n'est pas possible. Nous ne savons plus comment faire...''
Une des ritournelles est celle-ci :
''Je ne comprends pas. //Word// est devenu lourd et compliqué, je passe mon temps à chercher comment faire alors qu'avant, je m'en sortais. Heureurement, nous avons le //cloud// qui héberge nos données. Cela permet sauvegardes et mises à disposition. Mais je suis obligé de compter sur nos techniciens...''
Il y a une expression typique de lassitude et de fatalisme qu'on peut résumer par la complainte suivante :
''J'ai beau multiplier les protocoles et les séances de sensibilisation, les gens ne suivent rien. L'autre jour, un collaborateur qui travaille sur un dossier très sensible s'est vanté d'avoir achevé le travail dans l'avion.''
Voici un autre exemple, très courant, grave et pourtant minimisé ; sans doute par honte, mais aussi par déni :
''Un de nos collaborateurs s'est fait voler son ordinateur portable. Il l'a juste posé deux secondes à ses pieds le temps de héler un taxi !''
{{deuxcolonnes{
<<tiddlerIcons "=insolubilité">> <<tiddler [[insolubilité]]>>

<<tiddlerIcons "=système">> <<tiddler [[système]]>>

<<tiddlerIcons "=diplomatie">> <<tiddler [[diplomatie]]>>

<<tiddlerIcons "=pb hommes">> <<tiddler [[pb hommes]]>>

<<tiddlerIcons "=instruction">> <<tiddler [[instruction]]>>

<<tiddlerIcons "=codes">> <<tiddler [[codes]]>>

<<tiddlerIcons "=pb lourdeurs">> <<tiddler [[pb lourdeurs]]>>

<<tiddlerIcons "=secrétaire intime">> <<tiddler [[secrétaire intime]]>>

<<tiddlerIcons "=codex libre">> <<tiddler [[codex libre]]>>

<<tiddlerIcons "=onion">> <<tiddler [[onion]]>>

<<tiddlerIcons "=pb failles">> <<tiddler [[pb failles]]>>

<<tiddlerIcons "=développeur">> <<tiddler [[développeur]]>>

<<tiddlerIcons "=licences">> <<tiddler [[licences]]>>

<<tiddlerIcons "=pb fuites">> <<tiddler [[pb fuites]]>>

<<tiddlerIcons "=clavier">> <<tiddler [[clavier]]>>

<<tiddlerIcons "=deux écrans">> <<tiddler [[deux écrans]]>>

<<tiddlerIcons "=écran sans micro">> <<tiddler [[écran sans micro]]>>

<<tiddlerIcons "=intelligence">> <<tiddler [[intelligence]]>>

<<tiddlerIcons "=pb vols">> <<tiddler [[pb vols]]>>

<<tiddlerIcons "=emport">> <<tiddler [[emport]]>>

<<tiddlerIcons "=clés usb">> <<tiddler [[clés usb]]>>

<<tiddlerIcons "=pb protocoles">> <<tiddler [[pb protocoles]]>>

<<tiddlerIcons "=élitisme">> <<tiddler [[élitisme]]>>

<<tiddlerIcons "=esthétique">> <<tiddler [[esthétique]]>>

<<tiddlerIcons "=téléphone">> <<tiddler [[téléphone]]>>

<<tiddlerIcons "=confort">> <<tiddler [[confort]]>>

<<tiddlerIcons "=amertume">> <<tiddler [[amertume]]>> 
}}}
Une arme, surtout lorsqu'elle contient des secrets, est un objet de convoitises. Elle focalise, en tant que secrétaire, toutes les attentions. C'est pourquoi elle ne doit en aucun cas être compromise, que ce soit par malveillance, accident ou incident. J'ai conçu l'arme pour répondre aux menaces dans tous ces compartiments, et non pas en inventeur jaloux mais en prodigant la logique à l'opérateur de sorte qu'arme et protocoles ne fassent qu'un. L'arme devient ainsi une extension naturelle de la pensée de l'opérateur ; une pensée armée. D'éternelle victime, l'opérateur devient un chasseur redoutable n'ayant plus à craindre un environnement désormais maîtrisé.
Mon système s'appelle TOR pour ~TranspOrdinateuR. Un autre système est également dénommé Tor pour //The Onion Router// c'est-à-dire la route en oignon : des serveurs pour naviguer dans le cyberespace en sécurité. Mon système étant global, ses protocoles touchent de manière intégrale les composantes : l'homme, la machine, ses périphériques, ses logiciels, et cette intégralité a été étudiée et expérimentée pour une intégrité maximale, autrement dit une solidité hors pair en matière de sûreté.
{{tour{[img[k/titre/carre_codex.png][papier]]}}} <<search>> ou écrire un <<newJournal title:'j-YY0MM0DD-ss' label:'papier' tag:'k''so''p1' text:'!Description'>> | <<snapshot print label:Imprimer id:ask>> | Liste persistante :<<option chkStickyPopups>> | Sans onglets :<<option chkDisableTabsBar>> | <<tiddler RefreshPageDisplay with: Rafraîchir>> | <<openStory popup 'Ouvrir une composition''choix de funiculaire' [[story]]>> & <<expandAll>> / <<collapseAll>> ou <<saveStory ask "en graver une">> | Liste des <<tag vv 'versions'>> |
Le codex est à l'image du système TOR : éminemment compatible, épuré et modulaire. Le //clavier oblique// peut ainsi se brancher sur un téléphone, lui aussi épuré par mes soins des logiciels parasites. Cela permet d'y consulter les données organisées par le codex et d'en ajouter dès que notre esprit en éprouve le besoin, le cas échéant en déplacement. Ce cas pose des questions de sûreté, en particulier avec un ordinateur portable du fait de la taille indiscrète de son écran. Avec un téléphone comme interface et le clavier oblique aux clés fortes mais aussi au confort de frappe, la chose devient acceptable. Il suffit ensuite de connecter le téléphone au système TOR et demander à son codex d'importer les papiers créés dans le codex du téléphone pour effectuer la mise à jour. Bien entendu, la réciproque peut s'appliquer.

Tiens : un démontage, par exemple pour remplacer un disque ou en ajouter un...
+++<[img(,600px)[k/photos/pc_4.png]]>===
//^^La modularité permet la versatilité et aussi un meilleur entretien, des remplacements partiels non contraignants et informatiquement dommageables.^^//
//{{{
config.options.chkAutoSave = true;
config.options.txtUserName = "k";
config.options.txtMaxEditRows = 10;
config.options.chkFramedLinks = true;
config.options.chkFramedLinksTag = false;
config.options.chkSaveBackups = false;
config.views.editor.defaultText=""; //pour que tout tiddler existe
config.views.wikified.defaultText=""; //aucun texte par défaut

//}}}
function getPageTitle() { return "RepInfo"; } 
Un avantage décisif de cette solution est en outre la maîtrise des microphones et autres caméras qu'équipent systématiquement les ordinateurs portables. Ces derniers possèdent de surcroît une batterie, ce qui acentue les problèmes de sûreté.

Même si elle est un peu commerciale, cette image montre bien l'épuration du concept.
+++<[img(,600px)[k/photos/tor_2.png]]>===
//^^Les ordinateurs portables possèdent des caractéristiques dommageables à la sûreté : caméra et microphone d'une part ; batterie d'autre part.^^//
Qu'il suffise qu'un système, un protocole, soit un peu contraignant, et l'homme trouvera naturellement un biais pour améliorer son confort, à commencer par //éviter// le travail ou une de ses composantes. Il faut donc fournir les meilleurs outils en termes d'efficacité et d'ergonomie ; mais aussi faire en sorte que les protocoles viennent des agents eux-mêmes, issus, en quelque sorte, de leurs outils. Ainsi, les outils doivent conférer une esthétique à l'agent, telle qu'elle lui suggère une fonction spéciale, une identité particulière, et, //in fine//, une mission élitiste. C'est pourquoi l'instruction que je prodigue doit être générale et ressembler aussi peu que possible à un manuel. Plutôt qu'une doctrine, des principes. Plutôt que des protocoles, des moyens. Ce sont eux qui suggéreront une combinaison réfléchie //dans le contexte// de moyens protocolaires. L'objectif est de faire prendre au jeu de la sûreté l'intelligence en lui fournissant des moyens modulaires et intègres, au milieu de clés de compréhension du monde de la chasse. Et cette Instruction, par son automatisation, la rend confortable et aussi peu contraignante que possible.

Voici un aspect de l'Instruction automatisée. Mais le matériel est aussi léché. Il intègre même une tablette graphique professionnelle, fort pratique pour les présentations en direct par exemple !
+++<[img(,600px)[k/photos/cours.png]]>===
//^^L'indépendance est la seule voie de la sûreté. Il faut néanmoins lui adjoindre le confort d'utilisation si l'on ne veut voir des biais.^^//