<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
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
/*{{{*/
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;}
/*}}}*/
/***
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 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' 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' 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='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' 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>
<!--}}}-->
<!--{{{-->
<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>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

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

----
Also see [[AdvancedOptions]]
<<importTiddlers>>
|''Type:''|file|
|''URL:''|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/" title="Linkification: http://tiddlywiki.bidix.info/">http://tiddlywiki.bidix.info/</a></a>|
|''Workspace:''|(default)|

This tiddler was automatically created to record the details of this server
john <a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">mailto:boylejm@gmail.com</a>"><a class="linkification-ext" href="mailto:boylejm@gmail.com" title="Linkification: mailto:boylejm@gmail.com">boylejm@gmail.com</a></a>
Tiddlywiki Write (updated 3-23-09) is an implementation of the Tiddlywiki concept (version 2.5.0) and is an experiment in mind mapping for writers.

This TiddlyWiki is a modification based on the DevFire template, available here: <a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a>"><a class="linkification-ext" href="http://tiddlythemes.com/#Home" title="Linkification: http://tiddlythemes.com/#Home">http://tiddlythemes.com/#Home</a></a>

Feel free to use/alter this tool as is useful to you.  I am not a computer programmer and have built TWW using numerous existing plugins available for tiddlywiki.  Tiddlywiki is an open source project.

The Tiddlywiki homepage is here:  <a class="linkification-ext" href="http://www.tiddlywiki.com" title="Linkification: http://www.tiddlywiki.com">http://www.tiddlywiki.com</a> 
<<top>>
<<newTiddler>>
<<newJournal 'DD MMM YYYY'>>
<<saveChanges>>
<<slider chkSideBarTabs SideBarTabs 'Side Bar »' 'Open Side Bar Tabs'>>
<<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>
<<option chkGenerateAnRssFeed>> GenerateAnRssFeed
<<option chkOpenInNewWindow>> OpenLinksInNewWindow
<<option chkSaveEmptyTemplate>> SaveEmptyTemplate
<<option chkToggleLinks>> Clicking on links to tiddlers that are already open causes them to close
^^(override with Control or other modifier key)^^
<<option chkHttpReadOnly>> HideEditingFeatures when viewed over HTTP
<<option chkForceMinorUpdate>> Treat edits as MinorChanges by preserving date and time
^^(override with Shift key when clicking 'done' or by pressing Ctrl-Shift-Enter^^
<<option chkConfirmDelete>> ConfirmBeforeDeleting
Maximum number of lines in a tiddler edit box: <<option txtMaxEditRows>>
Folder name for backup files: <<option txtBackupFolder>>
<<option chkInsertTabs>> Use tab key to insert tab characters instead of jumping to next field
/***
|''Name:''|AlternateBackupPlugin|
|''Version:''|1.0.1 (3-Mar-2006)|
|''Source:''||
|''Author:''|KyleHale|
|''Type:''|Plugin|
!Description
Hijacks core backupPath function, replacing the datetime naming system
with a rotating set of backups, whose number is limited by the user.

!Issues/Todos
* Possible to insert an option into the AdvancedOptions Tiddler? That'd
make editing the number of backups that much easier.

!Revision History
* 1.0.1 (3-Mar-2006)
** Wrote code, totally stole [[Simon|SimonBaird]]'s documentation
system

!Code
***/
//{{{
config.options.txtBackupFolder = "twBackups";

if (!config.options.txtMaxBackups) config.options.txtMaxBackups="5";
if (!config.options.txtCurrentBackup)
config.options.txtCurrentBackup="1";

getBackupPath = function(localPath)
{
 var backSlash = true;
 var dirPathPos = localPath.lastIndexOf("\\");
 if(dirPathPos == -1)
 {
 dirPathPos = localPath.lastIndexOf("/");
 backSlash = false;
 }
 var backupFolder = config.options.txtBackupFolder;
 if(!backupFolder || backupFolder == "")
 backupFolder = ".";
 var backupPath = localPath.substr(0,dirPathPos) + (backSlash ? "\\" :
"/") + backupFolder + localPath.substr(dirPathPos);
 backupNum = config.options["txtCurrentBackup"];
 backupNum++;
 if (backupNum>config.options["txtMaxBackups"]) {
 backupNum=1;
 }
 backupPath = backupPath.substr(0,backupPath.lastIndexOf(".")) + "." +
backupNum + ".html";
 config.options["txtCurrentBackup"]=backupNum;
 saveOptionCookie("txtCurrentBackup");
 return backupPath;
}

//}}}
<<calendar>>
[[Skyrus]]

[[Tiela]]
[[Jaran&Jilia]]

[[Karick]]

[[Aldus]]

[[Mari]]

[[Tiran]]

[[Cord]]

[[Yardolus&Sark]]

[[Ayomere]]



/***
|Name|DatePlugin|
|Source|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#DatePlugin" title="Linkification: http://www.TiddlyTools.com/#DatePlugin">http://www.TiddlyTools.com/#DatePlugin</a></a>|
|Version|2.2.1|
|Author|Eric Shulman - ELS Design Studios|
|License|<a class="linkification-ext" href="http://www.TiddlyTools.com/#LegalStatements" title="Linkification: http://www.TiddlyTools.com/#LegalStatements">http://www.TiddlyTools.com/#LegalStatements</a> <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|<a class="linkification-ext" href="http://creativecommons.org/licenses/by-sa/2.5/" title="Linkification: http://creativecommons.org/licenses/by-sa/2.5/">http://creativecommo<a class="linkification-ext" href="http://ns.org/licenses/by-sa/2.5/" title="Linkification: http://ns.org/licenses/by-sa/2.5/">ns.org/licenses/by-sa/2.5/</a></a>]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description||

There are quite a few calendar generators, reminders, to-do lists, 'dated tiddlers' journals, blog-makers and GTD-like schedule managers that have been built around TW.  While they all have different purposes, and vary in format, interaction, and style, in one way or another each of these plugins displays and/or uses date-based information to make finding, accessing and managing relevant tiddlers easier.  This plugin provides a general approach to embedding dates and date-based links/menus within tiddler content.

This plugin display formatted dates, for the specified year, month, day using number values or mathematical expressions such as (Y+1) or (D+30).  Optionally, you can create a link from the formatted output to a 'dated tiddler' for quick blogging or create a popup menu that includes the dated tiddler link plus links to changes made on that date as well as links to any pending reminders for the coming 31 days (if the RemindersPlugin is installed).  This plugin also provides a public API for easily incorporating formatted date output (with or without the links/popups) into other plugins, such as calendar generators, etc.
!!!!!Usage
<<<
When installed, this plugin defines a macro: {{{<<date [mode] [date] [format] [linkformat]>>}}}.  All of the macro parameters are optional and, in it's simplest form, {{{<<date>>}}}, it is equivalent to the ~TiddlyWiki core macro, {{{<<today>>}}}.

However, where {{{<<today>>}}} simply inserts the current date/time in a predefined format (or custom format, using {{{<<today [format]>>}}}), the {{{<<date>>}}} macro's parameters take it much further than that:
* [mode] is either ''display'', ''link'' or ''popup''.  If omitted, it defaults to ''display''.  This param let's you select between simply displaying a formatted date, or creating a link to a specific 'date titled' tiddler or a popup menu containing a dated tiddler link, plus links to changes and reminders.
* [date] lets you enter ANY date (not just today) as ''year, month, and day values or simple mathematical expressions'' using pre-defined variables, Y, M, and D for the current year, month and day, repectively.  You can display the modification date of the current tiddler by using the keyword: ''tiddler'' in place of the year, month and day parameters.  Use ''tiddler://name-of-tiddler//'' to display the modification date of a specific tiddler.  You can also use keywords ''today'' or ''filedate'' to refer to these //dynamically changing// date/time values.  
* [format] and [linkformat] uses standard ~TiddlyWiki date formatting syntax.  The default is "YYYY.0MM.0DD"
>^^''DDD'' - day of week in full (eg, "Monday"), ''DD'' - day of month, ''0DD'' - adds leading zero^^
>^^''MMM'' - month in full (eg, "July"), ''MM'' - month number, ''0MM'' - adds leading zero^^
>^^''YYYY'' - full year, ''YY'' - two digit year, ''hh'' - hours, ''mm'' - minutes, ''ss'' - seconds^^
>^^//note: use of hh, mm or ss format codes is only supported with ''tiddler'', ''today'' or ''filedate'' values//^^
* [linkformat] - specify an alternative date format so that the title of a 'dated tiddler' link can have a format that differs from the date's displayed format

In addition to the macro syntax, DatePlugin also provides a public javascript API so that other plugins that work with dates (such as calendar generators, etc.) can quickly incorporate date formatted links or popups into their output:

''{{{showDate(place, date, mode, format, linkformat, autostyle, weekend)}}}'' 

Note that in addition to the parameters provided by the macro interface, the javascript API also supports two optional true/false parameters:
* [autostyle] - when true, the font/background styles of formatted dates are automatically adjusted to show the date's status:  'today' is boxed, 'changes' are bold, 'reminders' are underlined, while weekends and holidays (as well as changes and reminders) can each have a different background color to make them more visibly distinct from each other.
* [weekend] - true indicates a weekend, false indicates a weekday.  When this parameter is omitted, the plugin uses internal defaults to automatically determine when a given date falls on a weekend.
<<<
!!!!!Examples
<<<
The current date: <<date>>
The current time: <<date today "0hh:0mm:0ss">>
Today's blog: <<date link today "DDD, MMM DDth, YYYY">>
Recent blogs/changes/reminders: <<date popup Y M D-1 "yesterday">> <<date popup today "today">> <<date popup Y M D+1 "tomorrow">>
The first day of next month will be a <<date Y M+1 1 "DDD">>
This tiddler (DatePlugin) was last updated on: <<date tiddler "DDD, MMM DDth, YYYY">>
The SiteUrl was last updated on: <<date tiddler:SiteUrl "DDD, MMM DDth, YYYY">>
This document was last saved on <<date filedate "DDD, MMM DDth, YYYY at 0hh:0mm:0ss">>
<<date 2006 07 24 "MMM DDth, YYYY">> will be a <<date 2006 07 24 "DDD">>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''DatePlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2006.05.09 [2.2.1]'' added "todaybg" handling to set background color of current date.  Also, honor excludeLists tag when getting lists of tiddlers.  Based on suggestions by Mark Hulme.
''2006.05.05 [2.2.0]'' added "linkedbg" handling to set background color when a 'dated tiddler' exists.  Based on a suggestion by Mark Hulme.
''2006.03.08 [2.1.2]'' add 'override leadtime' flag param in call to findTiddlersWithReminders(), and add "Enter a title" default text to new reminder handler.  Thanks to Jeremy Sheeley for these additional tweaks.
''2006.03.06 [2.1.0]'' hasReminders() nows uses window.reminderCacheForCalendar[] when present.  If calendar cache is not present, indexReminders() now uses findTiddlersWithReminders() with a 90-day look ahead to check for reminders.  Also, switched default background colors for autostyled dates: reminders are now greenish ("c0ffee") and holidays are now reddish ("ffaace").
''2006.02.14 [2.0.5]'' when readOnly is set (by TW core), omit "new reminders..." popup menu item and, if a "dated tiddler" does not already exist, display the date as simple text instead of a link.
''2006.02.05 [2.0.4]'' added var to variables that were unintentionally global.  Avoids FireFox 1.5.0.1 crash bug when referencing global variables
''2006.01.18 [2.0.3]'' In 1.2.x the tiddler editor's text area control was given an element ID=("tiddlerBody"+title), so that it was easy to locate this field and programmatically modify its content.  With the addition of configuration templates in 2.x, the textarea no longer has an ID assigned.  To find this control we now look through all the child nodes of the tiddler editor to locate a "textarea" control where attribute("edit") equals "text", and then append the new reminder to the contents of that control.
''2006.01.11 [2.0.2]'' correct 'weekend' override detection logic in showDate()
''2006.01.10 [2.0.1]'' allow custom-defined weekend days (default defined in config.macros.date.weekend[] array)
added flag param to showDate() API to override internal weekend[] array
''2005.12.27 [2.0.0]'' Update for TW2.0
Added parameter handling for 'linkformat'
''2005.12.21 [1.2.2]'' FF's date.getYear() function returns 105 (for the current year, 2005).  When calculating a date value from Y M and D expressions, the plugin adds 1900 to the returned year value get the current year number.  But IE's date.getYear() already returns 2005.  As a result, plugin calculated date values on IE were incorrect (e.g., 3905 instead of 2005).  Adding +1900 is now conditional so the values will be correct on both browsers.
''2005.11.07 [1.2.1]'' added support for "tiddler" dynamic date parameter
''2005.11.06 [1.2.0]'' added support for "tiddler:title" dynamic date parameter
''2005.11.03 [1.1.2]'' when a reminder doesn't have a specified title parameter, use the title of the tiddler that contains the reminder as "fallback" text in the popup menu.  Based on a suggestion from BenjaminKudria.
''2005.11.03 [1.1.1]'' Temporarily bypass hasReminders() logic to avoid excessive overhead from generating the indexReminders() cache.  While reminders can still appear in the popup menu, they just won't be indicated by auto-styling the date number that is displayed.  This single change saves approx. 60% overhead (5 second delay reduced to under 2 seconds).
''2005.11.01 [1.1.0]'' corrected logic in hasModifieds() and hasReminders() so caching of indexed modifieds and reminders is done just once, as intended.  This should hopefully speed up calendar generators and other plugins that render multiple dates...
''2005.10.31 [1.0.1]'' documentation and code cleanup
''2005.10.31 [1.0.0]'' initial public release
''2005.10.30 [0.9.0]'' pre-release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://<a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">www.elsdesign.com</a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>">www.elsdesign.com</a></a>]].
<<<
!!!!!Code
***/
//{{{
version.extensions.date = {major: 2, minor: 2, revision: 1, date: new Date(2006,5,9)};
//}}}

//{{{
config.macros.date = {
	format: "YYYY.0MM.0DD", // default date display format
	linkformat: "YYYY.0MM.0DD", // 'dated tiddler' link format
	linkedbg: "#babb1e", // "babble"
	todaybg: "#ffab1e", // "fable"
	weekendbg: "#c0c0c0", // "cocoa"
	holidaybg: "#ffaace", // "face"
	modifiedsbg: "#bbeeff", // "beef"
	remindersbg: "#c0ffee", // "coffee"
	holidays: [ "01/01", "07/04", "07/24", "11/24" ], // NewYearsDay, IndependenceDay(US), Eric's Birthday (hooray!), Thanksgiving(US)
	weekend: [ 1,0,0,0,0,0,1 ] // [ day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6 ]
};
//}}}

//{{{
config.macros.date.handler = function(place,macroName,params)
{
	// do we want to see a link, a popup, or just a formatted date?
	var mode="display";
	if (params[0]=="display") { mode=params[0]; params.shift(); }
	if (params[0]=="popup") { mode=params[0]; params.shift(); }
	if (params[0]=="link") { mode=params[0]; params.shift(); }
	// get the date
	var now = new Date();
	var date = now;
	if (!params[0] || params[0]=="today")
		{ params.shift(); }
	else if (params[0]=="filedate")
		{ date=new Date(document.lastModified); params.shift(); }
	else if (params[0]=="tiddler")
		{ date=store.getTiddler(story.findContainingTiddler(place).id.substr(7)).modified; params.shift(); }
	else if (params[0].substr(0,8)=="tiddler:")
		{ var t; if ((t=store.getTiddler(params[0].substr(8)))) date=t.modified; params.shift(); }
	else {
		var y = eval(params.shift().replace(/Y/ig,(now.getYear()<1900)?now.getYear()+1900:now.getYear()));
		var m = eval(params.shift().replace(/M/ig,now.getMonth()+1));
		var d = eval(params.shift().replace(/D/ig,now.getDate()+0));
		date = new Date(y,m-1,d);
	}
	// date format with optional custom override
	var format=this.format; if (params[0]) format=params.shift();
	var linkformat=this.linkformat; if (params[0]) linkformat=params.shift();
	showDate(place,date,mode,format,linkformat);
}
//}}}

//{{{
window.showDate=showDate;
function showDate(place,date,mode,format,linkformat,autostyle,weekend)
{
	if (!mode) mode="display";
	if (!format) format=config.macros.date.format;
	if (!linkformat) linkformat=config.macros.date.linkformat;
	if (!autostyle) autostyle=false;

	// format the date output
	var title = date.formatString(format);
	var linkto = date.formatString(linkformat);

	// just show the formatted output
	if (mode=="display") { place.appendChild(document.createTextNode(title)); return; }

	// link to a 'dated tiddler'
	var link = createTiddlyLink(place, linkto, false);
	link.appendChild(document.createTextNode(title));
	link.title = linkto;
	link.date = date;
	link.format = format;
	link.linkformat = linkformat;

	// if using a popup menu, replace click handler for dated tiddler link
	// with handler for popup and make link text non-italic (i.e., an 'existing link' look)
	if (mode=="popup") {
		link.onclick = onClickDatePopup;
		link.style.fontStyle="normal";
	}

	// format the popup link to show what kind of info it contains (for use with calendar generators)
	if (!autostyle) return;
	if (hasModifieds(date))
		{ link.style.fontStyle="normal"; link.style.fontWeight="bold"; }
	if (hasReminders(date))
		{ link.style.textDecoration="underline"; }
	if(isToday(date))
		{ link.style.border="1px solid black"; }

	if( (weekend!=undefined?weekend:isWeekend(date)) && (config.macros.date.weekendbg!="") )
		{ place.style.background = config.macros.date.weekendbg; }
	if(isHoliday(date)&&(config.macros.date.holidaybg!=""))
		{ place.style.background = config.macros.date.holidaybg; }
	if (hasModifieds(date)&&(config.macros.date.modifiedsbg!=""))
		{ place.style.background = config.macros.date.modifiedsbg; }
	if (store.tiddlerExists(linkto)&&(config.macros.date.linkedbg!=""))
		{ place.style.background = config.macros.date.linkedbg; }
	if (hasReminders(date)&&(config.macros.date.remindersbg!=""))
		{ place.style.background = config.macros.date.remindersbg; }
	if(isToday(date)&&(config.macros.date.todaybg!=""))
		{ place.style.background = config.macros.date.todaybg; }
}
//}}}

//{{{
function isToday(date) // returns true if date is today
	{ var now=new Date(); return ((now-date>=0) && (now-date<86400000)); }

function isWeekend(date) // returns true if date is a weekend
	{ return (config.macros.date.weekend[date.getDay()]); }

function isHoliday(date) // returns true if date is a holiday
{
	var longHoliday = date.formatString("0MM/0DD/YYYY");
	var shortHoliday = date.formatString("0MM/0DD");
	for(var i = 0; i < config.macros.date.holidays.length; i++) {
		var holiday=config.macros.date.holidays[i];
		if (holiday==longHoliday||holiday==shortHoliday) return true;
	}
	return false;
}
//}}}

//{{{
// Event handler for clicking on a day popup
function onClickDatePopup(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	var popup = createTiddlerPopup(this);
	if(popup) {
		// always show dated tiddler link (or just date, if readOnly) at the top...
		if (!readOnly || store.tiddlerExists(this.date.formatString(this.linkformat)))
			createTiddlyLink(popup,this.date.formatString(this.linkformat),true);
		else
			createTiddlyText(popup,this.date.formatString(this.linkformat));
		addModifiedsToPopup(popup,this.date,this.format);
		addRemindersToPopup(popup,this.date,this.linkformat);
	}
	scrollToTiddlerPopup(popup,false);
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return(false);
}
//}}}

//{{{
function indexModifieds() // build list of tiddlers, hash indexed by modification date
{
	var modifieds= { };
	var tiddlers = store.getTiddlers("title","excludeLists");
	for (var t = 0; t < tiddlers.length; t++) {
		var date = tiddlers[t].modified.formatString("YYYY0MM0DD")
		if (!modifieds[date])
			modifieds[date]=new Array();
		modifieds[date].push(tiddlers[t].title);
	}
	return modifieds;
}
function hasModifieds(date) // returns true if date has modified tiddlers
{
	if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();
	return (config.macros.date.modifieds[date.formatString("YYYY0MM0DD")]!=undefined);
}

function addModifiedsToPopup(popup,when,format)
{
	if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var mods = config.macros.date.modifieds[when.formatString("YYYY0MM0DD")];
	if (mods) {
		mods.sort();
		var e=createTiddlyElement(popup,"div",null,null,"changes:");
		for(var t=0; t<mods.length; t++) {
			var link=createTiddlyLink(popup,mods[t],false);
			link.appendChild(document.createTextNode(indent+mods[t]));
			createTiddlyElement(popup,"br",null,null,null);
		}
	}
}
//}}}

//{{{
function indexReminders(date,leadtime) // build list of tiddlers with reminders, hash indexed by reminder date
{
	var reminders = { };
	if(window.findTiddlersWithReminders!=undefined) { // reminder plugin is installed
		// DEBUG var starttime=new Date();
		var t = findTiddlersWithReminders(date, [0,leadtime], null, null, 1);
		for(var i=0; i<t.length; i++) reminders[t[i].matchedDate]=true;
		// DEBUG var out="Found "+t.length+" reminders in "+((new Date())-starttime+1)+"ms\n";
		// DEBUG out+="startdate: "+date.toLocaleDateString()+"\n"+"leadtime: "+leadtime+" days\n\n";
		// DEBUG for(var i=0; i<t.length; i++) { out+=t[i].matchedDate.toLocaleDateString()+" "+t[i].params.title+"\n"; }
		// DEBUG alert(out);
	}
	return reminders;
}

function hasReminders(date) // returns true if date has reminders
{
	if (window.reminderCacheForCalendar)
		return window.reminderCacheForCalendar[date]; // use calendar cache
	if (!config.macros.date.reminders)
		config.macros.date.reminders = indexReminders(date,90); // create a 90-day leadtime reminder cache
	return (config.macros.date.reminders[date]);
}

function addRemindersToPopup(popup,when,format)
{
	if(window.findTiddlersWithReminders==undefined) return; // reminder plugin not installed

	var indent = String.fromCharCode(160)+String.fromCharCode(160);
	var reminders=findTiddlersWithReminders(when, [0,31],null,null,1);
	var e=createTiddlyElement(popup,"div",null,null,"reminders:"+(!reminders.length?" none":""));
	for(var t=0; t<reminders.length; t++) {
		link = createTiddlyLink(popup,reminders[t].tiddler,false);
		var diff=reminders[t].diff;
		diff=(diff<1)?"Today":((diff==1)?"Tomorrow":diff+" days");
		var txt=(reminders[t].params["title"])?reminders[t].params["title"]:reminders[t].tiddler;
		link.appendChild(document.createTextNode(indent+diff+" - "+txt));
		createTiddlyElement(popup,"br",null,null,null);
	}
	if (readOnly) return;	// omit "new reminder..." link
	var link = createTiddlyLink(popup,indent+"new reminder...",true); createTiddlyElement(popup,"br");
	var title = when.formatString(format);
	link.title="add a reminder to '"+title+"'";
	link.onclick = function() {
		// show tiddler editor
		story.displayTiddler(null, title, 2, null, null, false, false);
		// find body 'textarea'
		var c =document.getElementById("tiddler" + title).getElementsByTagName("*");
		for (var i=0; i<c.length; i++) if ((c[i].tagName.toLowerCase()=="textarea") && (c[i].getAttribute("edit")=="text")) break;
		// append reminder macro to tiddler content
		if (i<c.length) {
			if (store.tiddlerExists(title)) c[i].value+="\n"; else c[i].value="";
			c[i].value += "<<reminder";
			c[i].value += " day:"+when.getDate();
			c[i].value += " month:"+(when.getMonth()+1);
			c[i].value += " year:"+when.getFullYear();
			c[i].value += ' title:"Enter a title" >>';
		}
	};
}
//}}}

<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler wikibar'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></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>
<!--}}}-->
config.fontSize={};

//configuration settings
config.fontSize.settings =
{
            defaultSize : 100,  // all sizes in %
            maxSize : 200,
            minSize : 40,
            stepSize : 10
};

//startup code
var fontSettings = config.fontSize.settings;

if (!config.options.txtFontSize)
            {config.options.txtFontSize = fontSettings.defaultSize;
            saveOptionCookie("txtFontSize");}
setStylesheet(".tiddler .viewer {font-size:"+config.options.txtFontSize+"%;}\n","fontResizerStyles");
setStylesheet("#contentWrapper .fontResizer .button {display:inline;font-size:105%; font-weight:bold; margin:0 1px; padding: 0 3px; text-align:center !important;}\n .fontResizer {margin:0 0.5em;}","fontResizerButtonStyles");

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

               var sp = createTiddlyElement(place,"span",null,"fontResizer");
               sp.ondblclick=this.onDblClick;
               if (params[0])
                           createTiddlyText(sp,params[0]);
               createTiddlyButton(sp,"+","increase font-size",this.incFont);
               createTiddlyButton(sp,"=","reset font-size",this.resetFont);
               createTiddlyButton(sp,"–","decrease font-size",this.decFont);
}

config.macros.fontSize.onDblClick = function (e)
{
             if (!e) var e = window.event;
             e.cancelBubble = true;
             if (e.stopPropagation) e.stopPropagation();
             return false;
}

config.macros.fontSize.setFont = function ()
{
               saveOptionCookie("txtFontSize");
               setStylesheet(".tiddler .viewer {font-size:"+config.options.txtFontSize+"%;}\n","fontResizerStyles");
}

config.macros.fontSize.incFont=function()
{
               if (config.options.txtFontSize < fontSettings.maxSize)
                  config.options.txtFontSize = (config.options.txtFontSize*1)+fontSettings.stepSize;
               config.macros.fontSize.setFont();
}

config.macros.fontSize.decFont=function()
{

               if (config.options.txtFontSize > fontSettings.minSize)
                  config.options.txtFontSize = (config.options.txtFontSize*1) - fontSettings.stepSize;
               config.macros.fontSize.setFont();
}

config.macros.fontSize.resetFont=function()
{

               config.options.txtFontSize=fontSettings.defaultSize;
               config.macros.fontSize.setFont();
}

config.paramifiers.font =
{
               onstart: function(v)
                  {
                   config.options.txtFontSize = v;
                   config.macros.fontSize.setFont();
                  }
};
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>>
<html><b><i>Add New Tiddlers:</b></i></html>
Click on 'Admin Tools' in the right hand panel.  Click 'new tiddler'.  Follow the prompts to name your tiddler, add content, and add tags.  Or you may click on any existing tag in the main menu (to the left) and click on the option  'New (tagname) tiddler'.  Tagging is a powerful organizational too and lets you view your Tiddlywiki as a dynamic creation.

<html><b><i>Edit Tiddler</b></i></html>
Open any tiddler.  Click 'edit' on the right hand floating menu.  A text box will open and you will have different options on the menu - - 'done', 'cancel', and 'delete'.  You can click the 'wikibar' option to open a menu bar for easier formatting. (An additional menu opens at the bottom of the tiddler.)

<html><b><i>Calendar:</b></i></html>
You can access a  calendar in order to harness the power of tagging tiddlers by date.  Use for a submission calendar, for example.  Click on any number date on the calendar to create a tiddler linked to that date. 

<html><b><i>Navigation:</b></i></html>
Because the Tiddlywiki is a SINGLE webpage, you cannot navigate it with the forward/back buttons on your browser.  Use the 'close' button at the top of any tiddler to close that tiddler.  Use the 'close all' button on the right hand panel to close all open tiddlers.  You can also look at your tiddlers by tag (list of active tags in the main menu) which will open any particular tiddler with a specific tag or all tiddlers with a specific tag.

<html><b><i>On or Off Line?</b></i></html>
Unlike most wikis, TiddyWiki is not mainly a collaborative tool.  Use it on a local computer (it's small enough that you can place the html file on a usb storage device and take it with you) or upload it to a webspace and have access to your data wherever you happen to be.

<html><b><i>Tags:</b></i></html>
<html><i>Using Tags</i></html>
Tags are what make Tiddlywiki relational.  If you use tags efficiently, you can sort by tag and see all data relating to a specific tag.  All the current tags are listed in the main menu on the left.  Click on any tag and you can open a particular tiddler or select the 'open all' option to open all tiddlers with that particular tag. 

<html><i>Adding Tags</i></html>
To add a tag to the Tiddlywiki, type the text of the tag in the footer of the appropriate tiddler.  You can use wikiwords (words smashed together with a capital in the middle) or single words surrounded by double square brackets.  (Do NOT use multiple word tags with spaces between the words!) Save changes (right hand menu), click 'reload' on your browser window and the new tag will show up on the main menu.

<html><i>Changing Tag names</i></html>
To customize this for your own use, you will have to change the tag names.  Just click on any tag on the main menu, click 'open tag' option.  A new tiddler with the tag name as its tiddler name will open.  You can delete the tag or change its name.

//''Search:''//
Type any word or phrase in the search box (upper right hand corner) and you will get a list of all tiddlers that contain your search criteria.

//''Save:''//
If you make any changes/additions to your tiddlywiki, you must save them by clicking 'admin tools' and  'save changes' in the right hand menu or through 'save' which you can access on the flyout menu by clicking 'backstage' at the upper right corner of the page.

//''Personalizing:''//

//Personalize the header://
In order to have the name of your project and your name in the header, click 'admin tools' in the right hand menu, then click 'sidebar' .  Click 'all' to get a list of all tiddlers in alphabetical order.  Click 'Site title' and edit to change 'tiddlywikiwrite' to the title of your choice.  Click 'site subtitle' and edit to change 'a relation tool for writers' to the text of your choice.

//Personalize your name://
Click 'admin tools' and 'options'.  Add your name as a wikiword.


<<top>>

/***
|Name|InlineJavascriptPlugin|
|Source|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/#InlineJavascriptPlugin" title="Linkification: http://www.TiddlyTools.com/#InlineJavascriptPlugin">http://www.TiddlyTools.com/#InlineJavascriptPlugin</a></a></a>|
|Version|1.6.0|
|Author|Eric Shulman - ELS Design Studios|
|License|<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/#LegalStatements" title="Linkification: http://www.TiddlyTools.com/#LegalStatements">http://www.TiddlyTools.com/#LegalStatements</a>" title="Linkification: http://www.TiddlyTools.com/#LegalStatements">http://www.TiddlyTools.com/#LegalStatements</a> <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|<a class="linkification-ext" href="http://cr<a class="linkification-ext" href="http://eativecommons.org/licenses/by-sa/2.5/" title="Linkification: http://eativecommons.org/licenses/by-sa/2.5/">eativecommons.org/licenses/by-sa/2.5/</a>" title="Linkification: <a class="linkification-ext" href="http://creativecommons.org/licenses/by-sa/2.5/" title="Linkification: http://creativecommons.org/licenses/by-sa/2.5/">http://creativecommons.org/licenses/by-sa/2.5/</a>"><a class="linkification-ext" href="http://creativecommons.org/licenses/by-sa/2.5/" title="Linkification: http://creativecommons.org/licenses/by-sa/2.5/">http://creativecommons.org/licenses/by-sa/2.5/</a></a>]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Insert Javascript executable code directly into your tiddler content.|

''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.
!!!!!Usage
<<<
When installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.

''Deferred execution from an 'onClick' link''
By including a {{{label="..."}}} parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered.  You may also include a {{{title="..."}}} parameter to specify the 'tooltip' text that will appear whenever the mouse is moved over the onClick link text

''External script source files:''
You can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}).  This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins.  The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.

''Display script source in tiddler output''
By including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.

''Defining javascript functions and libraries:''
Although the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed.  Thus, you cannot load a library and //immediately// use it's functions within the same tiddler.  However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).

To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened.  For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.

Since the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines.  Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.

''Creating dynamic tiddler content''
An important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:
* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.
* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.

If your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display.  For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.

//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler.  To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//

''Accessing the ~TiddlyWiki DOM''
The plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.

Access to this DOM element allows you to create scripts that can:
* vary their actions based upon the specific location in which they are embedded
* access 'tiddler-relative' information (use findContainingTiddler(place))
* perform direct DOM manipulations (when returning wikified text is not enough)
<<<
!!!!!Examples
<<<
an "alert" message box:
><script show>
	alert('InlineJavascriptPlugin: this is a demonstration message');
</script>
dynamic output:
><script show>
	return (new Date()).toString();
</script>
wikified dynamic output:
><script show>
	return "link to current user: [["+config.options.txtUserName+"]]";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
   if (!window.story) window.story=window;
   var title=story.findContainingTiddler(place).id.substr(7);
   return title+" is using "+store.getTiddlerText(title).length+" bytes";
</script>
creating an 'onclick' button/link that runs a script:
><script label="click here" title="clicking this link will show an 'alert' box" show>
   if (!window.story) window.story=window;
   alert("Hello World!\nlinktext='"+place.firstChild.data+"'\ntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");
</script>
loading a script from a source url:
><a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.Tiddly<a class="linkification-ext" href="http://Tools.com/demo.js" title="Linkification: http://Tools.com/demo.js">Tools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyT" title="Linkification: http://www.TiddlyT">http://www.TiddlyT</a><a class="linkification-ext" href="http://ools.com/demo.js" title="Linkification: http://ools.com/demo.js">ools.com/demo.js</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a>"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js"><a class="linkification-ext" href="http://www.TiddlyTools.com/demo.js" title="Linkification: http://www.TiddlyTools.com/demo.js">http://www.TiddlyTools.com/demo.js</a></a></a> contains:
>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}
>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}
><script src="demo.js" show>
	return "loading demo.js..."
</script>
><script label="click to execute demo() function" show>
	demo()
</script>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.02.19 [1.6.0]'' added support for title="..." to specify mouseover tooltip when using an onclick (label="...") script
''2006.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper.  Fixes error caused when last line of script is a comment.
''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output
''2006.01.05 [1.4.0]'' added support 'onclick' scripts.  When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked.  'place' value is set to match the clicked button/link element.
''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString().  Fixed error reporting so IE shows the correct response text.  Based on a suggestion by UdoBorkowski
''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content.  Based on a suggestion by BradleyMeck
''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax
''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access 
''2005.11.08 [1.0.0]'' initial release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>">http://www.elsdesign.com</a>" title="Linkification: <a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">http://www.elsdesign.com</a>"><a class="linkification-ext" href="http://www.elsdesign.com" title="Linkification: http://www.elsdesign.com">www.elsdesign.com</a></a>]]
<<<
!!!!!Code
***/
//{{{
version.extensions.inlineJavascript= {major: 1, minor: 6, revision: 0, date: new Date(2007,2,19)};

config.formatters.push( {
	name: "inlineJavascript",
	match: "\\<script",
	lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\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) {
			if (lookaheadMatch[1]) { // load a script library
				// make script tag, set src, add to body to execute, then remove for cleanup
				var script = document.createElement("script"); script.src = lookaheadMatch[1];
				document.body.appendChild(script); document.body.removeChild(script);
			}
			if (lookaheadMatch[5]) { // there is script code
				if (lookaheadMatch[4]) // show inline script code in tiddler output
					wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
				if (lookaheadMatch[2]) { // create a link to an 'onclick' script
					// add a link, define click handler, save code in link (pass 'place'), set link attributes
					var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);
					link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}
					link.code="function _out(place){"+lookaheadMatch[5]+"\n};_out(this);"
					link.setAttribute("title",lookaheadMatch[3]?lookaheadMatch[3]:"");
					link.setAttribute("href","javascript:;");
					link.style.cursor="pointer";
				}
				else { // run inline script code
					var code="function _out(place){"+lookaheadMatch[5]+"\n};_out(w.output);"
					code=code.replace(/document.write\(/gi,'place.innerHTML+=(');
					try { var out = eval(code); } 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;
		}
	}
} )
//}}}
Part 3 of the series, chronologically, but the first one to be written.
 <<fontSize "font-size:">> 

<<allTagsExcept systemConfig AdminTools DevFireTheme script>>

GettingStarted
[[Help]]
[[Calendar]]
AboutMe
AboutTWW


These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

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

----
AdvancedOptions
PluginManager
ImportTiddlers
<div class='header' macro='gradient vert #390108 #900'>
<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'>
<div refresh='content' tiddler='MainMenu'></div>
</div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a></a>|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|<a class="linkification-ext" href="http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D" title="Linkification: http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D">http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D</a> ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
	major: 1, minor: 0, revision: 2, 
	date: new Date("Apr 19, 2007"),
	source: '<a class="linkification-ext" href="http://tiddlywiki.bidix.info/#PasswordOptionPlugin" title="Linkification: http://tiddlywiki.bidix.info/#PasswordOptionPlugin">http://tiddlywiki.bidix.info/#PasswordOptionPlugin</a>',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
	coreVersion: '2.2.0 (Beta 5)'
};

config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");

merge(config.macros.option.types, {
	'pas': {
		elementType: "input",
		valueField: "value",
		eventName: "onkeyup",
		className: "pasOptionInput",
		typeValue: config.macros.option.passwordInputType,
		create: function(place,type,opt,className,desc) {
			// password field
			config.macros.option.genericCreate(place,'pas',opt,className,desc);
			// checkbox linked with this password "save this password on this computer"
			config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);			
			// text savePasswordCheckboxLabel
			place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
		},
		onChange: config.macros.option.genericOnChange
	}
});

merge(config.optionHandlers['chk'], {
	get: function(name) {
		// is there an option linked with this chk ?
		var opt = name.substr(3);
		if (config.options[opt]) 
			saveOptionCookie(opt);
		return config.options[name] ? "true" : "false";
	}
});

merge(config.optionHandlers, {
	'pas': {
 		get: function(name) {
			if (config.options["chk"+name]) {
				return encodeCookie(config.options[name].toString());
			} else {
				return "";
			}
		},
		set: function(name,value) {config.options[name] = decodeCookie(value);}
	}
});

// need to reload options to load passwordOptions
loadOptionsCookie();

/*
if (!config.options['pasPassword'])
	config.options['pasPassword'] = '';

merge(config.optionsDesc,{
		pasPassword: "Test password"
	});
*/
//}}}
// --------------------------------------------------------------------
// Calendar
// --------------------------------------------------------------------

config.macros.calendar = {holidays: []};
config.macros.calendar.options = {
 // day week starts from (normally 0-Su or 1-Mo)
 calendarWeekStart: 1,
 calendarToday: "Today",
 calendarHoliday: "Holiday: ",
 calendarLongDateFormat: "0MM/0DD/YYYY",
 calendarShortDateFormat: "0MM/0DD",
 calendarTag: ["schedule"]
};

/***************************************************************************
** Internal functions
***************************************************************************/
var cldTag;

config.macros.calendar.calendarIsHoliday = function(date) {
 var cm = config.macros.calendar;
 var longHoliday = date.formatString(cm.options.calendarLongDateFormat);
 var shortHoliday = date.formatString(cm.options.calendarShortDateFormat);
 for(var i = 0; i < cm.holidays.length; i++) {
 if(cm.holidays[i][0] == longHoliday || cm.holidays[i][0] == shortHoliday) {
 return cm.holidays[i];
 }
 }
 return null;
}

config.macros.calendar.onClickOtherDay = function() {
 var day = this.getAttribute('tiddlylink');
 story.displayTiddler(null,day,DEFAULT_EDIT_TEMPLATE);
 for(var i=0; i<cldTag.length;i++){
 Story.prototype.setTiddlerTag(day, cldTag[i], 1);
 }
 Story.prototype.focusTiddler(day,"text");
}

config.macros.calendar.getPopupText = function(title) {
 var popup_entries = store.getTiddlerText(title).split("\n");
 var popup = popup_entries[0];
 if(popup_entries.length>1) popup += " ...";
 return popup;
}

config.macros.calendar.findCalendar = function(child) {
 var parent;
 while (child && child.parentNode) {
 parent = child.parentNode;
 if (parent.id == "calendarWrapper") {
 return parent;
 }
 child = parent;
 }
 return null;
}

config.macros.calendar.selectDate = function(e) {
 if (!e) var e = window.event;
 var cm = config.macros.calendar;
 var calendar = cm.findCalendar(this);
 if (calendar) {
 var d = this.getAttribute("date");
 if (d != null) cm.makeCalendar(calendar, new Date(new Number(d)));
 }
 e.cancelBubble = true;
 if (e.stopPropagation) e.stopPropagation();
 return false;
}

config.macros.calendar.makeCalendar = function(calendar, dt_current) {
 var cm = config.macros.calendar;
 var dt_today = new Date(new Number(calendar.getAttribute("today")));
 var currentDay = new Date(new Number(calendar.getAttribute("currentDay")));
 var setControls = calendar.getAttribute("setControls");
 calendar.setAttribute("date", dt_current.valueOf());

 while (calendar.hasChildNodes())
 calendar.removeChild(calendar.firstChild);

if(setControls==1){
 // get same date in the previous year
 var dt_prev_year = new Date(dt_current);
 dt_prev_year.setFullYear(dt_prev_year.getFullYear() - 1);
 if (dt_prev_year.getDate() != dt_current.getDate())
 dt_prev_year.setDate(0);

 // get same date in the next year
 var dt_next_year = new Date(dt_current);
 dt_next_year.setFullYear(dt_next_year.getFullYear() + 1);
 if (dt_next_year.getDate() != dt_current.getDate())
 dt_next_year.setDate(0);

 // get same date in the previous month
 var dt_prev_month = new Date(dt_current);
 dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);
 if (dt_prev_month.getDate() != dt_current.getDate())
 dt_prev_month.setDate(0);

 // get same date in the next month
 var dt_next_month = new Date(dt_current);
 dt_next_month.setMonth(dt_next_month.getMonth() + 1);
 if (dt_next_month.getDate() != dt_current.getDate())
 dt_next_month.setDate(0);
}

 // get first day to display in the grid for current month
 var dt_firstday = new Date(dt_current);
 dt_firstday.setDate(1);
 dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - cm.options.calendarWeekStart) % 7);

 var area, header;
 var line, cell, i;

 // 1 - calendar header table
 // 2 - print weekdays titles
 // 3 - calendar days table 
calendar.cellPadding = 0;
calendar.cellSpacing = 0;
area = createTiddlyElement(calendar, "tbody");

 // 1 - calendar header table
 header = createTiddlyElement(area,"tr", "calendarHeader");
 header.cellPadding = 0;
 header.cellSpacing = 0;

if(setControls==1){ 
var headerValues = [
 [ "<<", "selectYear", dt_prev_year.valueOf() ],
 [ "<", "selectMonth", dt_prev_month.valueOf() ],
 [ config.messages.dates.months[dt_current.getMonth()] + ' ' + dt_current.getFullYear(),
 "selectToday", dt_today.valueOf() ],
 [ ">", "selectMonth", dt_next_month.valueOf() ],
 [ ">>", "selectYear", dt_next_year.valueOf() ]
 ];

 for (i = 0; i < headerValues.length; ++i) {
 var link = createTiddlyElement(header,"td", null, null, headerValues[i][0]);
 if(i==2) link.colSpan=3;
 link.onclick = cm.selectDate;
 link.setAttribute("date", headerValues[i][2]);
 }
} else {
 var link = createTiddlyElement(header,"td", null, null, 
config.messages.dates.months[dt_current.getMonth()] + ' ' + dt_current.getFullYear());
//cm.options.calendarMonths
link.colSpan=7;
}

 // 2 - print weekdays titles
 line = createTiddlyElement(area, "tr", "weekNames");
 for (var n = 0; n < 7; ++n) {
 createTiddlyElement(line, "td", null, null, config.messages.dates.shortDays[(cm.options.calendarWeekStart + n)%7]);
//cm.options.calendarWeekDays
 }

 // 3 - calendar days table
 var dt_current_day = new Date(dt_firstday);
 var day_class;
 var title;
 var holiday;
 var popup;
 var clickHandler;

 while (dt_current_day.getMonth() == dt_current.getMonth() ||
 dt_current_day.getMonth() == dt_firstday.getMonth()) {

 // print row header
 line = createTiddlyElement(area, "tr", "calendarLine", null, null);
 for (var n_current_wday = 0; n_current_wday < 7; ++n_current_wday) {
 title = dt_current_day.formatString(cm.options.calendarLongDateFormat);
 clickHandler = cm.onClickOtherDay;
 popup = null;
 holiday = cm.calendarIsHoliday(dt_current_day);

 if (holiday != null) {
 // holidays
 day_class = (holiday.length==3)? holiday[2]: "holiDay";
 popup = cm.options.calendarHoliday + holiday[1];
 } else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6) {
 // weekend days
 day_class = "weekDay";
 } else {
 // print working days of current month
 day_class = "workingDay";
 }

if(dt_current_day.getMonth() == dt_current.getMonth()){
 if (currentDay.valueOf() == dt_current_day.valueOf()) {
 // print current date
 if (store.tiddlerExists(title)){
 // day has a tiddler associated with it
 day_class += " currentscheduledDay";
 clickHandler = onClickTiddlerLink;
 popup = cm.options.calendarToday + ": "+ cm.getPopupText(title);
 } else {
 day_class += " currentDay";
 popup = cm.options.calendarToday;
}
}

 if (store.tiddlerExists(title) && store.getTiddler(title).isTagged(cldTag[0]) && dt_current_day.valueOf() != dt_today.valueOf()) {
 // day has a tiddler associated with it
 day_class += " scheduledDay";
 clickHandler = onClickTiddlerLink;
 popup = cm.getPopupText(title);
 }
}

 // extra formatting for days of previous or next month
 if (dt_current_day.getMonth() != dt_current.getMonth()) {
 day_class += " otherMonthDay";
 }

 var text = dt_current_day.getDate();
 var cell = createTiddlyElement(line, "td", null, day_class, text);
 cell.onclick=clickHandler;
 cell.setAttribute("date", dt_current_day.valueOf());
 cell.setAttribute("tiddlyLink", title);
 if(popup) cell.setAttribute("title", popup);

 dt_current_day.setDate(dt_current_day.getDate()+1);
 }
 }
}

config.macros.calendar.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
 var start_date = new Array();
 var date = new Date();
 var cldParams = paramString.parseParams('calendarParams', null, true);
 var cldYear = (cldParams[0].year)?parseFloat(cldParams[0].year[0]): date.getFullYear();
 var cldMonth = (cldParams[0].month)?parseFloat(cldParams[0].month[0]): date.getMonth();
 var n_months = (cldParams[0].numberMonths)?parseFloat(cldParams[0].numberMonths[0]): 1;
 var n_cols = (cldParams[0].numberColumns)?parseFloat(cldParams[0].numberColumns[0]): 3;
 cldTag = (cldParams[0].tag)?cldParams[0].tag[0].split("#"): config.macros.calendar.options.calendarTag;
 for(var i = 0; i < n_months; i++){
 start_date[i] = new Date(cldYear, cldMonth+i, 1);
 }
 var n_rows = Math.max(1,Math.ceil(n_months/n_cols));
 n_cols = Math.min(n_cols,n_months);
 var setControls=(n_months>1)? 0: 1;
 var currentDay = new Date();
 currentDay = new Date(currentDay.getFullYear(), currentDay.getMonth(), currentDay.getDate());
 var holder = createTiddlyElement(place, "table", null,"calendarHolder");
 var holderTable = createTiddlyElement(holder, "tbody");
 for(var i = 0; i < n_rows; i++){
 var holderLine = createTiddlyElement(holderTable, "tr");
 for(var j = 0; j < n_cols; j++){
 var holderCell = createTiddlyElement(holderLine, "td");
 if(n_cols*i+j+1<=n_months){
 var calendar = createTiddlyElement(holderCell, "table", "calendarWrapper");
 calendar.setAttribute("name", "calendarWrapper");
 calendar.setAttribute("setControls", setControls);
 calendar.setAttribute("today", start_date[n_cols*i+j].valueOf());
 calendar.setAttribute("currentDay", currentDay.valueOf());
 config.macros.calendar.makeCalendar(calendar, start_date[n_cols*i+j]);
 }
 }
 }
}

function refreshCalendars(hint) {
 var calendars = document.getElementsByName("calendarWrapper");
 var i, c;
 for (i = 0; i < calendars.length; ++i) {
 c = calendars.item(i);
 if (c.id == "calendarWrapper") {
 config.macros.calendar.makeCalendar(c, new Date(new Number(c.getAttribute("date"))));
 }
 }
}

store.addNotification(null, refreshCalendars);

setStylesheet("/***\n!Calendar Styles\n***/\n/*{{{*/\n .viewer .calendarHolder {\n margin-left: auto;\n margin-right: auto;\n border: none;\n}\n\n .viewer .calendarHolder table {\n border: none;\n margin: 0;\n}\n\n .viewer .calendarHolder tr {\n border: none;\n vertical-align: top;\n}\n\n .viewer .calendarHolder td {\n border: none;\n vertical-align: top;\n}\n\n .viewer #calendarWrapper {\n width: 21em;\n border: 2px solid #4682b4;\n cursor: pointer;\n}\n\n #calendarWrapper #calendarLine td {\n height: 2.5em;\n}\n\n #calendarWrapper tr {\n border:none;\n}\n\n #calendarWrapper td {\n text-align: center;\n vertical-align: middle;\n width: 14.28%;\n border:none;\n}\n\n #calendarWrapper #calendarHeader td{\n color: #ffffff;\n background-color: #666;\n height: 2em;\n}\n\n #calendarWrapper #weekNames td {\n color: #ffffff;\n background-color: #87cefa;\n height: 2em;\n}\n\n #calendarWrapper .weekDay {\n background-color: #ccff99;\n}\n\n #calendarWrapper .holiDay {\n background-color: #9acd32;\n}\n\n #calendarWrapper .currentDay {\n border: solid #ff0000 2px;\n font-weight: bold;\n}\n\n #calendarWrapper .currentscheduledDay {\n border: solid #ff0000 2px;\n font-weight: bold;\n}\n\n #calendarWrapper .workingDay {\n background-color: #999;\n}\n\n #calendarWrapper .scheduledDay {\n border: solid orange 2px;\n}\n\n #calendarWrapper .otherMonthDay {\n background-color: #014;\n}\n\n/*}}}*/","CalendarStyles");
<<plugins>>
Currently, R.E.S. is just the science behind the later stories.

I don't have any characters or any other hook.

Revolutionary Energy Systems.

The usual, "Ooh, Technology can be misused" is overused and tired. I'd need something more compelling.
config.renameTags = {

	prompts: {
		rename: "Rename the tag '%0' to '%1' in %2 tidder%3?",
		remove: "Remove the tag '%0' from %1 tidder%2?"
	},

	removeTag: function(tag,tiddlers) {
		for (var i=0;i<tiddlers.length;i++) {
			store.setTiddlerTag(tiddlers[i].title,false,tag);
		}
	},

	renameTag: function(oldTag,newTag,tiddlers) {
		for (var i=0;i<tiddlers.length;i++) {
			store.setTiddlerTag(tiddlers[i].title,false,oldTag); // remove old
			store.setTiddlerTag(tiddlers[i].title,true,newTag);  // add new
		}
	},

	storeMethods: {

		saveTiddler_orig_renameTags: TiddlyWiki.prototype.saveTiddler,

		saveTiddler: function(title,newTitle,newBody,modifier,modified,tags,fields) {
			if (title != newTitle) {
				var tagged = this.getTaggedTiddlers(title);
				if (tagged.length > 0) {
					// then we are renaming a tag
					if (confirm(config.renameTags.prompts.rename.format([title,newTitle,tagged.length,tagged.length>1?"s":""])))
						config.renameTags.renameTag(title,newTitle,tagged);

					if (!this.tiddlerExists(title) && newBody == "")
						// dont create unwanted tiddler
						return null;
				}
			}
			return this.saveTiddler_orig_renameTags(title,newTitle,newBody,modifier,modified,tags,fields);
		},

		removeTiddler_orig_renameTags: TiddlyWiki.prototype.removeTiddler,

		removeTiddler: function(title) {
			var tagged = this.getTaggedTiddlers(title);
			if (tagged.length > 0)
				if (confirm(config.renameTags.prompts.remove.format([title,tagged.length,tagged.length>1?"s":""])))
					config.renameTags.removeTag(title,tagged);
			return this.removeTiddler_orig_renameTags(title);
		}

	},

	init: function() {
		merge(TiddlyWiki.prototype,this.storeMethods);
	}
}

config.renameTags.init();
The hook for Res Reborn is basically the impact one man can have on an entire society.

Mentis crash-lands, then becomes friendly with the locals. When the warlords attack, he takes sides with the farmers and against his better judgment, teaches them how to use Res.  He does save their lives and their land, but at what expense?  After returning to seclusion, he creates the Resmet, Turo, using Inner Res, which is taboo for his culture.

Turn eventually decides that to stay alive, he needs more power.  He seeks out the enemies of the farmers who also learned how to use Res and teaches them Inner Res. He then tricks them into creating Resmets that are too powerful for them to control. During the commotion, Turo kills or arranges for them to be killed, and he absorbs the untethered Resmets, thereby increasing his power high enough to prevent Mentis from recalling him (which would essentially kill him.

Not sure how it ends, but I want Turo to be a tragic figure... He's a bad guy, but is he really bad?  What does it mean to be 'bad' or 'good'?  Is Mentis 'less good' than Turo since it was Mentis who actually started everything... and technically, Turo and Mentis are the same... sorta.

I guess Res Reborn will explore what it means to be human and how people can be thrust into extreme situations and how they deal with them.
<<search>><<closeAll>><<permaview>><<slider chkSliderAdminTools AdminTools 'Admin Tools »'>>
<<tabs txtMainTab Timeline Timeline TabTimeline All 'All tiddlers' TabAll Tags 'All tags' TabTags More 'More lists' TabMore>>
R.E.S. ; Res Reborn ; Inner Res
The Official Res Novels Wiki
Mysterious origin.
Didn't get hurt falling over falls.
I think he's related to Turo... maybe son or grandson. Or maybe he IS Turo.

/***
<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a>"><a class="linkification-ext" href="http://tiddlystyles.com/#theme:DevFire" title="Linkification: http://tiddlystyles.com/#theme:DevFire">http://tiddlystyles.com/#theme:DevFire</a></a>
Author: Clint Checketts
***/

/*{{{*/
body {
background: #000;
}
/*}}}*/
/***
!Link styles /% ============================================================= %/
***/
/*{{{*/
a,
a.button,
#mainMenu a.button,
#sidebarOptions .sliderPanel a{
 color: #ffbf00;
 border: 0;
 background: transparent;
}

a:hover,
a.button:hover,
#mainMenu a.button:hover,
#sidebarOptions .sliderPanel a:hover
#sidebarOptions .sliderPanel a:active{
 color: #ff7f00;
 border: 0;
 border-bottom: #ff7f00 1px dashed;
 background: transparent;
 text-decoration: none;
}

#displayArea .button.highlight{
 color: #ffbf00;
 background: #4c4c4c;
}
/*}}}*/
/***
!Header styles /% ============================================================= %/
***/
/*{{{*/
.header{
 border-bottom: 2px solid #ffbf00;
 color: #fff;
}

.headerForeground a {
 color: #fff;
}

.header a:hover {
 border-bottom: 1px dashed #fff;
}
/*}}}*/
/***
!Main menu styles /% ============================================================= %/
***/
/*{{{*/
#mainMenu {color: #fff;}
#mainMenu h1{
 font-size: 1.1em;
}
#mainMenu li,#mainMenu ul{
 list-style: none;
 margin: 0;
 padding: 0;
}
/*}}}*/
/***
!Sidebar styles /% ============================================================= %/
***/
/*{{{*/
#sidebar {
 right: 0;
 color: #fff;
 border: 2px solid #ffbf00;
 border-width: 0 0 2px 2px;
}

#sidebarOptions {
 background-color: #4c4c4c;
 padding: 0;
}

#sidebarOptions a{
 margin: 0;
 color: #ffbf00;
 border: 0;
}
#sidebarOptions a:hover {
 color: #4c4c4c;
 background-color: #ffbf00;

}

#sidebarOptions a:active {
 color: #ffbf00;
 background-color: transparent;
}

#sidebarOptions .sliderPanel {
 background-color: #333;
 margin: 0;
}

#sidebarTabs {background-color: #4c4c4c;}
#sidebarTabs .tabSelected {
 padding: 3px 3px;
 cursor: default;
 color: #ffbf00;
 background-color: #666;
}
#sidebarTabs .tabUnselected {
 color: #ffbf00;
 background-color: #5f5f5f;
 padding: 0 4px;
}

#sidebarTabs .tabUnselected:hover,
#sidebarTabs .tabContents {
 background-color: #666;
}

.listTitle{color: #FFF;}
#sidebarTabs .tabContents a{
 color: #ffbf00;
}

#sidebarTabs .tabContents a:hover{
 color: #ff7f00;
 background: transparent;
}

#sidebarTabs .txtMoreTab .tabSelected,
#sidebarTabs .txtMoreTab .tab:hover,
#sidebarTabs .txtMoreTab .tabContents{
 color: #ffbf00;
 background: #4c4c4c;
}

#sidebarTabs .txtMoreTab .tabUnselected {
 color: #ffbf00;
 background: #5f5f5f;
}

.tab.tabSelected, .tab.tabSelected:hover{color: #ffbf00; border: 0; background-color: #4c4c4c;cursor:default;}
.tab.tabUnselected {background-color: #666;}
.tab.tabUnselected:hover{color:#ffbf00; border: 0;background-color: #4c4c4c;}
.tabContents {
 background-color: #4c4c4c;
 border: 0;
}
.tabContents .tabContents{background: #666;}
.tabContents .tabSelected{background: #666;}
.tabContents .tabUnselected{background: #5f5f5f;}
.tabContents .tab:hover{background: #666;}
/*}}}*/
/***
!Message area styles /% ============================================================= %/
***/
/*{{{*/
#messageArea {background-color: #666; color: #fff; border: 2px solid #ffbf00;}
#messageArea a:link, #messageArea a:visited {color: #ffbf00; text-decoration:none;}
#messageArea a:hover {color: #ff7f00;}
#messageArea a:active {color: #ff7f00;}
#messageArea .messageToolbar a{
 border: 1px solid #ffbf00;
 background: #4c4c4c;
}
/*}}}*/
/***
!Popup styles /% ============================================================= %/
***/
/*{{{*/
.popup {color: #fff; background-color: #4c4c4c; border: 1px solid #ffbf00;}
.popup li.disabled{color: #fff;}
.popup a {color: #ffbf00; }
.popup a:hover { background: transparent; color: #ff7f00; border: 0;}
.popup hr {color: #ffbf00; background: #ffbf00;}
/*}}}*/
/***
!Tiddler Display styles /% ============================================================= %/
***/
/*{{{*/
.title{color: #fff;}
h1, h2, h3, h4, h5 {
 color: #fff;
 background-color: transparent;
 border-bottom: 1px solid #333;
}

.subtitle{
 color: #666;
}

.viewer {color: #fff; }

.viewer table{background: #666; color: #fff;}

.viewer th {background-color: #996; color: #fff;}

.viewer pre, .viewer code {color: #ddd; background-color: #4c4c4c; border: 1px solid #ffbf00;}

.viewer hr {color: #666;}

.tiddler .button {color: #4c4c4c;}
.tiddler .button:hover { color: #ffbf00; background-color: #4c4c4c;}
.tiddler .button:active {color: #ffbf00; background-color: #4c4c4c;}

.toolbar {
 color: #4c4c4c;
}

.toolbar a.button,
.toolbar a.button:hover,
.toolbar a.button:active,
.editorFooter a{
 border: 0;
}

.footer {
 color: #ddd;
}

.selected .footer {
 color: #888;
}

.highlight, .marked {
 color: #000;
 background-color: #ffe72f;
}
.editorFooter {
 color: #aaa;
}

.tab{
-moz-border-radius-topleft: 3px;
-moz-border-radius-topright: 3px;
}

.tagging,
.tagged{
 background: #4c4c4c;
 border: 1px solid #4c4c4c; 
}

.selected .tagging,
.selected .tagged{
 background-color: #333;
 border: 1px solid #ffbf00;
}

.tagging .listTitle,
.tagged .listTitle{
 color: #fff;
}

.tagging .button,
.tagged .button{
 color: #ffbf00;
 border: 0;
 padding: 0;
}

.tagging .button:hover,
.tagged .button:hover{
background: transparent;
}

.selected .isTag .tagging.simple,
.selected .tagged.simple,
.isTag .tagging.simple,
.tagged.simple {
 float: none;
 display: inline;
 border: 0;
 background: transparent;
 color: #fff;
 margin: 0;
}

.cascade {
 background: #4c4c4c;
 color: #ddd;
 border: 1px solid #ffbf00;
}
/*}}}*/
<<allTags>>
/***
|!''Name:''|!''TemplatedTagTools''|
|''Description:''|this plugin replace the content of the tag popup with the one from TagToolTemplate (a new shadowTiddler).<<br>>It allows for quick and easy modification of this popup content (including some [[batchTagTools]] macros for example)|
|''Version:''|0.1.0|
|''Date:''|17/01/2007|
|''Source:''|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>" title="Linkification: <a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a>"><a class="linkification-ext" href="http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools" title="Linkification: http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools">http://yann.perrin.googlepages.com/twkd.html#TemplatedTagTools</a></a>|
|''Author:''|[[Yann Perrin|YannPerrin]]|
|''License:''|[[BSD open source license]]|
|''~CoreVersion:''|2.x|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
***/
//{{{
function onClickTag(e)
{
 if (!e) var e = window.event;
 var theTarget = resolveTarget(e);
 var popup = Popup.create(this);
 var tag = this.getAttribute("tag");
 var title = this.getAttribute("tiddler");
 if(popup && tag) {
 wikify('<<tiddler TagToolTemplate with:"'+tag+'">>',popup);
 }
 Popup.show(popup,false);
 e.cancelBubble = true;
 if (e.stopPropagation) e.stopPropagation();
 return(false);
}
//}}}
//{{{
config.macros.openAll = {};
config.macros.openAll.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
 var lingo = config.views.wikified.tag;
 var openAll = createTiddlyButton(place,lingo.openAllText.format(params),lingo.openAllTooltip,onClickTagOpenAll);
 openAll.setAttribute("tag",params[0]);
}
//}}}
////definition de TagToolTemplate
//{{{
config.shadowTiddlers.TagToolTemplate = "[[Open tag '$1'|$1]]\n<<openAll $1>>\n<<tagging $1>><<newTiddler label:\"New $1 Tiddler\" tag:\"$1\">>";
//}}}
Mentis crashes in 1900
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);
}
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 19/05/2009 20:27:04 | jmb | [[InnerRes-tww.html|<a class="linkification-ext" href="<a class="linkification-ext" href="file:///E:/projects/Novels/RES/InnerRes-tww.html" title="Linkification: file:///E:/projects/Novels/RES/InnerRes-tww.html">file:///E:/projects/Novels/RES/InnerRes-tww.html</a>" title="Linkification: <a class="linkification-ext" href="file:///E:/projects/Novels/RES/InnerRes-tww.html" title="Linkification: file:///E:/projects/Novels/RES/InnerRes-tww.html">file:///E:/projects/Novels/RES/InnerRes-tww.html</a>"><a class="linkification-ext" href="file:///E:/projects/Novels/RES/InnerRes-tww.html" title="Linkification: file:///E:/projects/Novels/RES/InnerRes-tww.html">file:///E:/projects/Novels/RES/InnerRes-tww.html</a></a>]] | [[store.php|<a class="linkification-ext" href="http://jmbjr.nfshost.com/innerres/wiki/store.php" title="Linkification: http://jmbjr.nfshost.com/innerres/wiki/store.php">http://jmbjr.nfshost.com/innerres/wiki/store.php</a>]] | . | [[InnerRes-tww.html | <a class="linkification-ext" href="http://jmbjr.nfshost.com/innerres/wiki/InnerRes-tww.html" title="Linkification: http://jmbjr.nfshost.com/innerres/wiki/InnerRes-tww.html">http://jmbjr.nfshost.com/innerres/wiki/InnerRes-tww.html</a>]] |  | ok |
| 19/05/2009 20:30:17 | jmb | [[InnerRes-tww.html|file:///E:/projects/Novels/RES/InnerRes-tww.html]] | [[store.php|http://jmbjr.nfshost.com/innerres/wiki/store.php]] | . | [[InnerRes-tww.html | http://jmbjr.nfshost.com/innerres/wiki/InnerRes-tww.html]] |  |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.4|
|''Date:''|2008-08-11|
|''Source:''|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPlugin" title="Linkification: http://tiddlywiki.bidix.info/#UploadPlugin">http://tiddlywiki.bidix.info/#UploadPlugin</a></a>|
|''Documentation:''|<a class="linkification-ext" href="http://tiddlywiki.bidix.info/#UploadPluginDoc" title="Linkification: http://tiddlywiki.bidix.info/#UploadPluginDoc">http://tiddlywiki.bidix.info/#UploadPluginDoc</a>|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|<a class="linkification-ext" href="http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D" title="Linkification: http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D">http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D</a> ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
	major: 4, minor: 1, revision: 4,
	date: new Date("2008-08-11"),
	source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	coreVersion: '2.2.0'
};

//
// Environment
//

if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false;	// true to activate both in Plugin and UploadService
	
//
// Upload Macro
//

config.macros.upload = {
// default values
	defaultBackupDir: '',	//no backup
	defaultStoreScript: "store.php",
	defaultToFilename: "index.html",
	defaultUploadDir: ".",
	authenticateUser: true	// UploadService Authenticate User
};
	
config.macros.upload.label = {
	promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
	promptParamMacro: "Save and Upload this TiddlyWiki in %0",
	saveLabel: "save to web", 
	saveToDisk: "save to disk",
	uploadLabel: "upload"	
};

config.macros.upload.messages = {
	noStoreUrl: "No store URL in parmeters or options",
	usernameOrPasswordMissing: "Username or password missing"
};

config.macros.upload.handler = function(place,macroName,params) {
	if (readOnly)
		return;
	var label;
	if (document.location.toString().substr(0,4) == "http") 
		label = this.label.saveLabel;
	else
		label = this.label.uploadLabel;
	var prompt;
	if (params[0]) {
		prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0], 
			(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
	} else {
		prompt = this.label.promptOption;
	}
	createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};

config.macros.upload.action = function(params)
{
		// for missing macro parameter set value from options
		if (!params) params = {};
		var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
		var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
		var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
		var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
		var username = params[4] ? params[4] : config.options.txtUploadUserName;
		var password = config.options.pasUploadPassword; // for security reason no password as macro parameter	
		// for still missing parameter set default value
		if ((!storeUrl) && (document.location.toString().substr(0,4) == "http")) 
			storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
		if (storeUrl.substr(0,4) != "http")
			storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
		if (!toFilename)
			toFilename = bidix.basename(window.location.toString());
		if (!toFilename)
			toFilename = config.macros.upload.defaultToFilename;
		if (!uploadDir)
			uploadDir = config.macros.upload.defaultUploadDir;
		if (!backupDir)
			backupDir = config.macros.upload.defaultBackupDir;
		// report error if still missing
		if (!storeUrl) {
			alert(config.macros.upload.messages.noStoreUrl);
			clearMessage();
			return false;
		}
		if (config.macros.upload.authenticateUser && (!username || !password)) {
			alert(config.macros.upload.messages.usernameOrPasswordMissing);
			clearMessage();
			return false;
		}
		bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password); 
		return false; 
};

config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir) 
{
	if (!storeUrl)
		return null;
		var dest = bidix.dirname(storeUrl);
		if (uploadDir && uploadDir != '.')
			dest = dest + '/' + uploadDir;
		dest = dest + '/' + toFilename;
	return dest;
};

//
// uploadOptions Macro
//

config.macros.uploadOptions = {
	handler: function(place,macroName,params) {
		var wizard = new Wizard();
		wizard.createWizard(place,this.wizardTitle);
		wizard.addStep(this.step1Title,this.step1Html);
		var markList = wizard.getElement("markList");
		var listWrapper = document.createElement("div");
		markList.parentNode.insertBefore(listWrapper,markList);
		wizard.setValue("listWrapper",listWrapper);
		this.refreshOptions(listWrapper,false);
		var uploadCaption;
		if (document.location.toString().substr(0,4) == "http") 
			uploadCaption = config.macros.upload.label.saveLabel;
		else
			uploadCaption = config.macros.upload.label.uploadLabel;
		
		wizard.setButtons([
				{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption, 
					onClick: config.macros.upload.action},
				{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
				
			]);
	},
	options: [
		"txtUploadUserName",
		"pasUploadPassword",
		"txtUploadStoreUrl",
		"txtUploadDir",
		"txtUploadFilename",
		"txtUploadBackupDir",
		"chkUploadLog",
		"txtUploadLogMaxLine"		
	],
	refreshOptions: function(listWrapper) {
		var opts = [];
		for(i=0; i<this.options.length; i++) {
			var opt = {};
			opts.push();
			opt.option = "";
			n = this.options[i];
			opt.name = n;
			opt.lowlight = !config.optionsDesc[n];
			opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
			opts.push(opt);
		}
		var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
		for(n=0; n<opts.length; n++) {
			var type = opts[n].name.substr(0,3);
			var h = config.macros.option.types[type];
			if (h && h.create) {
				h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
			}
		}
		
	},
	onCancel: function(e)
	{
		backstage.switchTab(null);
		return false;
	},
	
	wizardTitle: "Upload with options",
	step1Title: "These options are saved in cookies in your browser",
	step1Html: "<input type='hidden' name='markList'></input><br>",
	cancelButton: "Cancel",
	cancelButtonPrompt: "Cancel prompt",
	listViewTemplate: {
		columns: [
			{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
			{name: 'Option', field: 'option', title: "Option", type: 'String'},
			{name: 'Name', field: 'name', title: "Name", type: 'String'}
			],
		rowClasses: [
			{className: 'lowlight', field: 'lowlight'} 
			]}
};

//
// upload functions
//

if (!bidix.upload) bidix.upload = {};

if (!bidix.upload.messages) bidix.upload.messages = {
	//from saving
	invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
	backupSaved: "Backup saved",
	backupFailed: "Failed to upload backup file",
	rssSaved: "RSS feed uploaded",
	rssFailed: "Failed to upload RSS feed file",
	emptySaved: "Empty template uploaded",
	emptyFailed: "Failed to upload empty template file",
	mainSaved: "Main TiddlyWiki file uploaded",
	mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
	//specific upload
	loadOriginalHttpPostError: "Can't get original file",
	aboutToSaveOnHttpPost: 'About to upload on %0 ...',
	storePhpNotFound: "The store script '%0' was not found."
};

bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
	var callback = function(status,uploadParams,original,url,xhr) {
		if (!status) {
			displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
			return;
		}
		if (bidix.debugMode) 
			alert(original.substr(0,500)+"\n...");
		// Locate the storeArea div's 
		var posDiv = locateStoreArea(original);
		if((posDiv[0] == -1) || (posDiv[1] == -1)) {
			alert(config.messages.invalidFileError.format([localPath]));
			return;
		}
		bidix.upload.uploadRss(uploadParams,original,posDiv);
	};
	
	if(onlyIfDirty && !store.isDirty())
		return;
	clearMessage();
	// save on localdisk ?
	if (document.location.toString().substr(0,4) == "file") {
		var path = document.location.toString();
		var localPath = getLocalPath(path);
		saveChanges();
	}
	// get original
	var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
	var originalPath = document.location.toString();
	// If url is a directory : add index.html
	if (originalPath.charAt(originalPath.length-1) == "/")
		originalPath = originalPath + "index.html";
	var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
	var log = new bidix.UploadLog();
	log.startUpload(storeUrl, dest, uploadDir,  backupDir);
	displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
	if (bidix.debugMode) 
		alert("about to execute Http - GET on "+originalPath);
	var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
	if (typeof r == "string")
		displayMessage(r);
	return r;
};

bidix.upload.uploadRss = function(uploadParams,original,posDiv) 
{
	var callback = function(status,params,responseText,url,xhr) {
		if(status) {
			var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
			displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
			bidix.upload.uploadMain(params[0],params[1],params[2]);
		} else {
			displayMessage(bidix.upload.messages.rssFailed);			
		}
	};
	// do uploadRss
	if(config.options.chkGenerateAnRssFeed) {
		var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
		var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
		var rssString = generateRss();
		// no UnicodeToUTF8 conversion needed when location is "file" !!!
		if (document.location.toString().substr(0,4) != "file")
			rssString = convertUnicodeToUTF8(rssString);	
		bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
	} else {
		bidix.upload.uploadMain(uploadParams,original,posDiv);
	}
};

bidix.upload.uploadMain = function(uploadParams,original,posDiv) 
{
	var callback = function(status,params,responseText,url,xhr) {
		var log = new bidix.UploadLog();
		if(status) {
			// if backupDir specified
			if ((params[3]) && (responseText.indexOf("backupfile:") > -1))  {
				var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
				displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
			}
			var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
			displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
			store.setDirty(false);
			log.endUpload("ok");
		} else {
			alert(bidix.upload.messages.mainFailed);
			displayMessage(bidix.upload.messages.mainFailed);
			log.endUpload("failed");			
		}
	};
	// do uploadMain
	var revised = bidix.upload.updateOriginal(original,posDiv);
	bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};

bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
	var localCallback = function(status,params,responseText,url,xhr) {
		url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
		if (xhr.status == 404)
			alert(bidix.upload.messages.storePhpNotFound.format([url]));
		if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
			alert(responseText);
			if (responseText.indexOf("Debug mode") >= 0 )
				responseText = responseText.substring(responseText.indexOf("\n\n")+2);
		} else if (responseText.charAt(0) != '0') 
			alert(responseText);
		if (responseText.charAt(0) != '0')
			status = null;
		callback(status,params,responseText,url,xhr);
	};
	// do httpUpload
	var boundary = "---------------------------"+"AaB03x";	
	var uploadFormName = "UploadPlugin";
	// compose headers data
	var sheader = "";
	sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
	sheader += uploadFormName +"\"\r\n\r\n";
	sheader += "backupDir="+uploadParams[3] +
				";user=" + uploadParams[4] +
				";password=" + uploadParams[5] +
				";uploaddir=" + uploadParams[2];
	if (bidix.debugMode)
		sheader += ";debug=1";
	sheader += ";;\r\n"; 
	sheader += "\r\n" + "--" + boundary + "\r\n";
	sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
	sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
	sheader += "Content-Length: " + data.length + "\r\n\r\n";
	// compose trailer data
	var strailer = new String();
	strailer = "\r\n--" + boundary + "--\r\n";
	data = sheader + data + strailer;
	if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
	var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
	if (typeof r == "string")
		displayMessage(r);
	return r;
};

// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
	if (!posDiv)
		posDiv = locateStoreArea(original);
	if((posDiv[0] == -1) || (posDiv[1] == -1)) {
		alert(config.messages.invalidFileError.format([localPath]));
		return;
	}
	var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
				store.allTiddlersAsHtml() + "\n" +
				original.substr(posDiv[1]);
	var newSiteTitle = getPageTitle().htmlEncode();
	revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
	revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
	revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
	revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
	revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
	return revised;
};

//
// UploadLog
// 
// config.options.chkUploadLog :
//		false : no logging
//		true : logging
// config.options.txtUploadLogMaxLine :
//		-1 : no limit
//      0 :  no Log lines but UploadLog is still in place
//		n :  the last n lines are only kept
//		NaN : no limit (-1)

bidix.UploadLog = function() {
	if (!config.options.chkUploadLog) 
		return; // this.tiddler = null
	this.tiddler = store.getTiddler("UploadLog");
	if (!this.tiddler) {
		this.tiddler = new Tiddler();
		this.tiddler.title = "UploadLog";
		this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
		this.tiddler.created = new Date();
		this.tiddler.modifier = config.options.txtUserName;
		this.tiddler.modified = new Date();
		store.addTiddler(this.tiddler);
	}
	return this;
};

bidix.UploadLog.prototype.addText = function(text) {
	if (!this.tiddler)
		return;
	// retrieve maxLine when we need it
	var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
	if (isNaN(maxLine))
		maxLine = -1;
	// add text
	if (maxLine != 0) 
		this.tiddler.text = this.tiddler.text + text;
	// Trunck to maxLine
	if (maxLine >= 0) {
		var textArray = this.tiddler.text.split('\n');
		if (textArray.length > maxLine + 1)
			textArray.splice(1,textArray.length-1-maxLine);
			this.tiddler.text = textArray.join('\n');		
	}
	// update tiddler fields
	this.tiddler.modifier = config.options.txtUserName;
	this.tiddler.modified = new Date();
	store.addTiddler(this.tiddler);
	// refresh and notifiy for immediate update
	story.refreshTiddler(this.tiddler.title);
	store.notify(this.tiddler.title, true);
};

bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir,  backupDir) {
	if (!this.tiddler)
		return;
	var now = new Date();
	var text = "\n| ";
	var filename = bidix.basename(document.location.toString());
	if (!filename) filename = '/';
	text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
	text += config.options.txtUserName + " | ";
	text += "[["+filename+"|"+location + "]] |";
	text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
	text += uploadDir + " | ";
	text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
	text += backupDir + " |";
	this.addText(text);
};

bidix.UploadLog.prototype.endUpload = function(status) {
	if (!this.tiddler)
		return;
	this.addText(" "+status+" |");
};

//
// Utilities
// 

bidix.checkPlugin = function(plugin, major, minor, revision) {
	var ext = version.extensions[plugin];
	if (!
		(ext  && 
			((ext.major > major) || 
			((ext.major == major) && (ext.minor > minor))  ||
			((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
			// write error in PluginManager
			if (pluginInfo)
				pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
			eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
	}
};

bidix.dirname = function(filePath) {
	if (!filePath) 
		return;
	var lastpos;
	if ((lastpos = filePath.lastIndexOf("/")) != -1) {
		return filePath.substring(0, lastpos);
	} else {
		return filePath.substring(0, filePath.lastIndexOf("\\"));
	}
};

bidix.basename = function(filePath) {
	if (!filePath) 
		return;
	var lastpos;
	if ((lastpos = filePath.lastIndexOf("#")) != -1) 
		filePath = filePath.substring(0, lastpos);
	if ((lastpos = filePath.lastIndexOf("/")) != -1) {
		return filePath.substring(lastpos + 1);
	} else
		return filePath.substring(filePath.lastIndexOf("\\")+1);
};

bidix.initOption = function(name,value) {
	if (!config.options[name])
		config.options[name] = value;
};

//
// Initializations
//

// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);

// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");

//optionsDesc
merge(config.optionsDesc,{
	txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
	txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
	txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
	txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
	txtUploadUserName: "Upload Username",
	pasUploadPassword: "Upload Password",
	chkUploadLog: "do Logging in UploadLog (default: true)",
	txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});

// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');


// Backstage
merge(config.tasks,{
	uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");


//}}}

<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date [[DD MMM YYYY]]'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class="viewer" macro="tiddler CommentScript"></div> 
<div class='tagClear'></div>
<!--}}}-->
/***
|''Name:''|WikiBar|
|''Version:''|2.0.0 beta3|
|''Source:''|[[AiddlyWiki|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a>"><a class="linkification-ext" href="http://aiddlywiki.sourceforge.net" title="Linkification: http://aiddlywiki.sourceforge.net">http://aiddlywiki.sourceforge.net</a></a>]]|
|''Author:''|[[Arphen <a class="linkification-ext" href="http://Lin%7Cmailto:arphenlin@gmail.com" title="Linkification: http://Lin|mailto:arphenlin@gmail.com">Lin|mailto:arphenlin@gmail.com</a>]]|
|''Type:''|toolbar macro command extension|
|''Required:''|TiddlyWiki 2.0.0 beta6|
!Description
WikiBar is a toolbar that gives access to most of TiddlyWiki's formatting features with a few clicks. It's a handy tool for people who are not familiar with TiddlyWiki syntax.
Besides, with WikiBar-addons, users can extend the power of WikiBar.
!Support browser
*Firefox 1.5
!Revision history
*v2.0.0 beta3 (2005/12/30)
** remove macros (replaced by TWMacro addon)
** add wikibar command in toolbar automatically
** rename DOIT to HANDLER
** rename TIP to TOOLTIP
*v2.0.0 beta2 (2005/12/21)
** re-design Wikibar addon framework
*v2.0.0 beta1 (2005/12/14)
** Note:
*** WikiBarPlugin is renamed to WikiBar
** New Features:
*** support TiddlyWiki 2.0.0 template mechanism
*** new wikibar data structure
*** new wikibar-addon framework for developers
**** support dynamic popup menu generator
*** support most new macros added in TiddlyWiki 2.0.0
*** multi-level popup menu
*** fix wikibar tab stop
*** remove paletteSelector
** Known Bugs:
*** popup-menu and color-picker can't be closed correctly
*** some macros can't be displayed correctly in previewer
*** text in previewer will be displayed italic
*v1.2.0 (2005/11/21)
**New Features:
***User defined color palettes supported
####Get color palettes from [[ColorZilla Palettes|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>]].
####Save the palette file(*.gpl) as a new tiddler and tag it with 'ColorPalettes', then you can use it in WikiBar.
***WikiBar style sheet supported
***Click on document to close current colorPicker, paletteSelector or aboutWikibar
*v1.1.1 (2005/11/03)
**Bugs fixed:
***'Not enough parameters!' message is displayed when the parameter includes '%+number', ex: 'hello%20world!'
*v1.1.0 (2005/11/01)
**Bugs fixed:
***WikiBar overruns (reported by by GeoffS <<a class="linkification-ext" href="mailto:gslocock@yahoo.co.uk" title="Linkification: mailto:gslocock@yahoo.co.uk">gslocock@yahoo.co.uk</a>>)
**New features:
***Insert a color code at the cursor. (Thanks to RunningUtes <<a class="linkification-ext" href="<a class="linkification-ext" href="mailto:RunningUtes@gmail.com" title="Linkification: mailto:RunningUtes@gmail.com">mailto:RunningUtes@gmail.com</a>" title="Linkification: <a class="linkification-ext" href="mailto:RunningUtes@gmail.com" title="Linkification: mailto:RunningUtes@gmail.com">mailto:RunningUtes@gmail.com</a>">RunningUtes@gmail.com</a>>)
***Enable gradient macro. (Thanks to RunningUtes <<a class="linkification-ext" href="mailto:RunningUtes@gmail.com" title="Linkification: mailto:RunningUtes@gmail.com">RunningUtes@gmail.com</a>>)
***Insert tiddler comment tags {{{/% ... %/}}}. (new feature supported by TiddlyWiki 1.2.37)
***Insert DateFormatString for {{{<<today>>}}} macro. (new feature supported by TiddlyWiki 1.2.37)
**Enhanced:
***Allow optional parameters in syntax.
**Bugs:
***'Not enough parameters!' message is displayed when the parameter includes '%+number', ex: 'hello%20world!'
*v1.0.0 (2005/10/30)
**Initial release
!Code
***/
//{{{
config.macros.wikibar = {major: 2, minor: 0, revision: 0, beta: 3, date: new Date(2005,12,30)};
config.macros.wikibar.handler = function(place,macroName,params,wikifier,paramString,tiddler){
  if(!(tiddler instanceof Tiddler))  {return;}
	story.setDirty(tiddler.title,true);
  place.id = 'wikibar'+tiddler.title;
  place.className = 'toolbar wikibar';
};
function wikibar_install(){
  config.commands.wikibar = {
  	text: 'wikibar',
  	tooltip: 'wikibar on/off',
  	handler: function(e,src,title) {
      if(!e){ e = window.event; }
      var theButton = resolveTarget(e);
      theButton.id = 'wikibarButton'+title;
      wikibarPopup.remove();
      wikibar_installAddons(theButton, title);
      wikibar_createWikibar(title);
      return(false);
    }
  };
  config.shadowTiddlers['EditTemplate'] = wikibar_addWikibarCommand(config.shadowTiddlers['EditTemplate']);
  var tiddler = store.getTiddler('EditTemplate');
  if(tiddler){
    tiddler.text = wikibar_addWikibarCommand(tiddler.text);
  }
}
function wikibar_installAddons(theButton, title){
 	var tiddlers = store.getTaggedTiddlers('wikibarAddons');
	if(!tiddlers)	  { return; }
	theButton.addons=[];
  for(var i=0; i<tiddlers.length; i++){
    try{
      eval(tiddlers[i].text);
      try{
        wikibar_addonInstall(title);
        wikibar_addonInstall = null;
        theButton.addons.push({ok:true, name:tiddlers[i].title});
      }catch(ex){
        theButton.addons.push({ok:false, name:tiddlers[i].title, error:ex});
      }
    }catch(ex){
      theButton.addons.push({ok:false, name:tiddlers[i].title, error:ex});
    }
  }
}
function wikibar_addWikibarCommand(tiddlerText){
  var div = document.createElement('div');
  div.style.display = 'none';
  div.innerHTML = tiddlerText;
  for(var i=0; i<div.childNodes.length; i++){
    var o=div.childNodes[i];
    if(o.tagName==='DIV'){
      if(o.className=='toolbar'){
        var macroText = o.getAttribute('macro').trim();
        if(macroText.search('wikibar')<=0){
          macroText += ' wikibar';
          o.setAttribute('macro', macroText);
        }
        break;
      }
    }
  }
  return div.innerHTML.replace(/\"/g, "\'");
}
function wikibar_processSyntaxParams(theSyntax, params){
  try{
    var pcr = 'AplWikibarPcr';
    var rx=null;
    var allParams=null;
    if(params){
      if(typeof(params)=='object'){
        for(var i=0; i<params.length; i++){
          if(params[i]){
            params[i] = params[i].replace(new RegExp('%','g'), pcr).trim();
            rx = '(\\[%'+(i+1)+'\\])' + '|' + '(%'+(i+1)+')';
            theSyntax = theSyntax.replace(new RegExp(rx,'g'), params[i] );
          }
        }
        allParams = params.join(' ').trim();
      }else{
        allParams = params.replace(new RegExp('%','g'), pcr).trim();
        rx = /(\[%1{1}\])|(%1{1})/g;
        theSyntax = theSyntax.replace(rx, allParams);
      }
    }
    if(allParams){
      theSyntax = theSyntax.replace(new RegExp('%N{1}','g'), allParams);
    }
    rx=/\[%(([1-9]{1,}[0-9]{0,})|(N{1}))\]/g;
    theSyntax = theSyntax.replace(rx, '');
    rx=/%(([1-9]{1,}[0-9]{0,})|(N{1}))/g;
    if( theSyntax.match(rx) ){
      throw 'Not enough parameters! ' + theSyntax;
    }
    theSyntax=theSyntax.replace(new RegExp(pcr,'g'), '%');
    return theSyntax;
  } catch(ex){
    return null;
  }
}
function wikibar_resolveEditItem(tiddlerWrapper, itemName){
  if(tiddlerWrapper.hasChildNodes()){
    var c=tiddlerWrapper.childNodes;
    for(var i=0; i<c.length; i++){
      var txt=wikibar_resolveEditItem(c[i], itemName);
      if(!txt){
        continue;
      }else{
        return txt;
      }
    }
  }
  return ((tiddlerWrapper.getAttribute && tiddlerWrapper.getAttribute('edit')==itemName)? tiddlerWrapper : null);
}
function wikibar_resolveEditItemValue(tiddlerWrapper, itemName){
  var o = wikibar_resolveEditItem(tiddlerWrapper, itemName);
  return (o? o.value.replace(/\r/mg,'') : null);
}
function wikibar_resolveTiddlerEditorWrapper(obj){
  if(obj.id=='tiddlerDisplay'){return null;}
  if((obj.getAttribute && obj.getAttribute('macro')=='edit text')){return obj;}
  return wikibar_resolveTiddlerEditorWrapper(obj.parentNode);
}
function wikibar_resolveTiddlerEditor(obj){
  if(obj.hasChildNodes()){
    var c = obj.childNodes;
    for(var i=0; i<c.length; i++){
      var o=wikibar_resolveTiddlerEditor(c[i]);
      if(o){ return o;}
    }
  }
  return ((obj.getAttribute && obj.getAttribute('edit')=='text')? obj : null);
}
function wikibar_resolveTargetButton(obj){
  if(obj.id && obj.id.substring(0,7)=='wikibar'){ return null; }
  if(obj.tiddlerTitle){
    return obj;
  }else{
    return wikibar_resolveTargetButton(obj.parentNode);
  }
}
function wikibar_isValidMenuItem(tool){
  if(!tool){  return false; }
  if(tool.TYPE=='MENU' || tool.TYPE=='MAIN_MENU'){
    for(var key in tool){
      if(key.substring(0,8)=='DYNAITEM'){ return true; }
      if(wikibar_isValidMenuItem(tool[key])){ return true; }
    }
    return false;
  }else{
    return (tool.HANDLER? true : false);
  }
}
function wikibar_editFormat(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
	  frontText  = fullText.substring(0, ss);
	  endText    = fullText.substring(se, fullText.length);
	}
	else if(ss===0 && (se===0 || se == fullText.length) ){
    endText    = fullText;
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByWord(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){return;}
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var selText  = '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
	  frontText  = fullText.substring(0, ss);
	  selText	   = fullText.substring(ss,se);
	  endText    = fullText.substring(se, fullText.length);
	}
	else if(ss===0 && (se===0 || se == fullText.length) ){
    endText    = fullText;
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
	  if(!( fullText.charAt(ss-1).match(/\W/gi) || fullText.charAt(ss).match(/\W/gi) )){
      var m = frontText.match(/\W/gi);
      if(m){
        ss = frontText.lastIndexOf(m[m.length-1])+1;
      }
      else{
        ss = 0;
      }
      m = endText.match(/\W/gi);
      if(m){
        se += endText.indexOf(m[0]);
      }
      else{
        se = fullText.length;
      }
      frontText = fullText.substring(0, ss);
  	  endText   = fullText.substring(se, fullText.length);
  	  selText   = fullText.substring(ss,se);
	  }
	}
	if(selText.length>0){
		repText = repText.replace('user_text', selText);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByCursor(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
	  frontText  = fullText.substring(0, ss);
	  endText    = fullText.substring(se, fullText.length);
	}
	else if(ss===0 && (se===0 || se == fullText.length) ){
    endText    = fullText;
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByLine(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var selText  = '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
		if(this.byBlock){
	    frontText  = fullText.substring(0, ss);
	    selText		 = fullText.substring(ss,se);
	    endText    = fullText.substring(se, fullText.length);
		}
		else{
	  	se = ss;
		}
	}
  if(ss===0 && (se===0 || se == fullText.length) ){
    var m=fullText.match(/(\n|\r)/g);
    if(m){
      se = fullText.indexOf(m[0]);
    }else{
      se = fullText.length;
    }
    selText    = fullText.substring(0, se);
    endText    = fullText.substring(se, fullText.length);
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
    m = frontText.match(/(\n|\r)/g);
    if(m){
      ss = frontText.lastIndexOf(m[m.length-1])+1;
    }
    else{
      ss = 0;
    }
    m = endText.match(/(\n|\r)/g);
    if(m){
      se += endText.indexOf(m[0]);
    }
    else{
      se = fullText.length;
    }
    frontText = fullText.substring(0, ss);
	  selText   = fullText.substring(ss,se);
	  endText   = fullText.substring(se, fullText.length);
	}
	if(selText.length>0){
		repText = repText.replace('user_text', selText);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	if(this.byBlock){
    if( (frontText.charAt(frontText.length-1)!='\n') && ss>0 ){
    	repText = '\n' + repText;
    }
    if( (endText.charAt(0)!='\n') || se==fullText.length){
    	repText += '\n';
    }
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByTableCell(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var selText  = '';
	var endText  = '';
	var fullText = editor.value;
	if(ss===0 || ss==fullText.length){
		throw 'not valid cell!';
	}
	se=ss;
  frontText  = fullText.substring(0, ss);
  endText    = fullText.substring(se, fullText.length);
  i=frontText.lastIndexOf('\n');
  j=frontText.lastIndexOf('|');
  if(i>j || j<0){
  	throw 'not valid cell!';
  }
	ss = j+1;
  i=endText.indexOf('\n');
  j=endText.indexOf('|');
  if(i<j || j<0){
  	throw 'not valid cell!';
  }
  se += j;
  frontText = fullText.substring(0, ss-1);
  selText   = fullText.substring(ss,se);
  endText   = fullText.substring(se+1, fullText.length);
	if(this.key.substring(0,5)=='align'){
		selText = selText.trim();
		if(	selText=='>' || selText=='~' ||	selText.substring(0,8)=='bgcolor(')	{return; }
	}
	if(selText.length>0){
		repText = repText.replace('user_text', selText);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length - 2;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editSelectAll(param){
  var editor = param.button.editor;
	editor.selectionStart = 0;
	editor.selectionEnd   = editor.value.length;
	editor.scrollTop      = 0;
	editor.focus();
}
function wikibar_doPreview(param){
  var theButton = param.button;
  var editor = param.button.editor;
  var wikibar = theButton.parentNode;
  if(!wikibar)  { return; }
  title = theButton.tiddlerTitle;
  var editorWrapper = wikibar_resolveTiddlerEditorWrapper(editor);
  var tiddlerWrapper = editorWrapper.parentNode;
  var previewer = document.getElementById('previewer'+title);
  if(previewer){
    previewer.parentNode.removeChild(previewer);
    editorWrapper.style.display = 'block';
    visible=true;
  }else{
    previewer = document.createElement('div');
    previewer.id = 'previewer'+title;
    previewer.className = 'viewer previewer';
    previewer.style.height = (editor.offsetHeight) + 'px';
    wikify(editor.value, previewer);
    tiddlerWrapper.insertBefore(previewer, editorWrapper);
    editorWrapper.style.display = 'none';
    visible=false;
  }
  var pv=null;
  for(var i=0; i<wikibar.childNodes.length; i++){
    try{
      var btn = wikibar.childNodes[i];
      if(btn.toolItem.key == 'preview'){ pv=btn; }
      if(btn.toolItem.key != 'preview'){
        btn.style.display = visible ? '': 'none';
      }
    }catch(ex){}
  }
  if(!pv) { return; }
  if(visible){
    pv.innerHTML = '<font face=\"verdana\">&infin;</font>';
    pv.title = 'preview current tiddler';
  }
  else{
    pv.innerHTML = '<font face=\"verdana\">&larr;</font>';
    pv.title = 'back to editor';
  }
}
function wikibar_doListAddons(param){
  clearMessage();
  var title = param.button.tiddlerTitle;
  var wikibarButton = document.getElementById('wikibarButton'+title);
  var ok=0, fail=0;
  for(var i=0; i<wikibarButton.addons.length; i++){
    var addon=wikibarButton.addons[i];
    if(addon.ok){
      displayMessage('[ o ] '+addon.name);
      ok++;
    }
    else{
      displayMessage('[ x ] '+addon.name + ': ' + addon.error);
      fail++;
    }
  }
  displayMessage('---------------------------------');
  displayMessage(ok + ' ok ; ' + fail + ' failed');
}
function wikibar_getColorCode(param){
  var cbOnPickColor = function(colorCode, param){
    param.params = colorCode;
    param.button.toolItem.doMore(param);
  };
  wikibarColorTool.openColorPicker(param.button, cbOnPickColor, param);
}
function wikibar_getLinkUrl(param){
  var url= prompt('Please enter the link target', (this.param? this.param : ''));
  if (url && url.trim().length>0){
    param.params = url;
    this.doMore(param);
  }
}
function wikibar_getTableRowCol(param){
  var rc= prompt('Please enter (rows x cols) of the table', '2 x 3');
  if (!rc || (rc.trim()).length<=0){ return; }
  var arr = rc.toUpperCase().split('X');
  if(arr.length != 2)   { return; }
  for(var i=0; i<arr.length; i++){
    if(isNaN(arr[i].trim()))  { return; }
  }
  var rows = parseInt(arr[0].trim(), 10);
  var cols = parseInt(arr[1].trim(), 10);
  var txtTable='';
  for(var r=0; r<rows; r++){
    for(var c=0; c<=cols; c++){
      if(c===0){
        txtTable += '|';
      }else{
        txtTable += ' |';
      }
    }
    txtTable += '\n';
  }
  if(txtTable.trim().length>0){
    param.params = txtTable.trim();
    this.doMore(param);
  }
}
function wikibar_getMacroParam(param){
  var p = prompt('Please enter the parameters of macro \"' + this.key + '\":' +
                 '\nSyntax: ' + this.syntax +
                 '\n\nNote: '+
                 '\n%1,%2,... - parameter needed'+
                 '\n[%1] - optional parameter'+
                 '\n%N   - more than one parameter(1~n)'+
                 '\n[%N] - any number of parameters(0~n)'+
                 '\n\nPS:'+
                 '\n1. Parameters should be seperated with space character'+
                 '\n2. Use \" to wrap the parameter that includes space character, ex: \"hello world\"'+
                 '\n3. Input the word(null) for the optional parameter ignored',
                 (this.param? this.param : '') );
  if(!p)  { return; }
  p=p.readMacroParams();
  for(var i=0; i<p.length; i++){
    var s=p[i].trim();
    if(s.indexOf(' ')>0){ p[i]="'"+s+"'"; }
    if(s.toLowerCase()=='null'){ p[i]=null; }
  }
  param.params = p;
  this.doMore(param);
}
function wikibar_getMorePalette(unused){
  clearMessage();
  displayMessage('Get more color palettes(*.gpl) from ColorZilla Palettes site', 'http:\/\/<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>">http://<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>">www.iosart.com/firefox/colorzilla/palettes.html</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a></a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: <a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">http://www.iosart.com/firefox/colorzilla/palettes.html</a>"><a class="linkification-ext" href="http://www.iosart.com/firefox/colorzilla/palettes.html" title="Linkification: http://www.iosart.com/firefox/colorzilla/palettes.html">www.iosart.com/firefox/colorzilla/palettes.html</a></a></a>');
  displayMessage('Save it as a new tiddler with \"ColorPalettes\" tag');
}
function wikibar_createWikibar(title){
  var theWikibar = document.getElementById('wikibar' + title);
  if(theWikibar){
    if(theWikibar.hasChildNodes()){
      theWikibar.style.display = (theWikibar.style.display=='block'? 'none':'block');
      return;
    }
  }
  var tiddlerWrapper = document.getElementById('tiddler'+title);
  var theTextarea = wikibar_resolveTiddlerEditor(tiddlerWrapper);
  if(!theTextarea){
    clearMessage();
    displayMessage('WikiBar only works in tiddler edit mode now');
    return;
  }else{
    if(!theTextarea.id){ theTextarea.id = 'editor'+title; }
    if(!theTextarea.parentNode.id){ theTextarea.parentNode.id='editorWrapper'+title;  }
  }
  if(theWikibar){
    theWikibar = document.getElementById('wikibar'+title);
  }else{
    var editorWrapper = wikibar_resolveTiddlerEditorWrapper(theTextarea);
    theWikibar = createTiddlyElement(tiddlerWrapper, 'div', 'wikibar'+title, 'toolbar');
    addClass(theWikibar, 'wikibar');
    var previewer = document.getElementById('previewer'+title);
    if(previewer){
      tiddlerWrapper.insertBefore(theWikibar, previewer);
    }else{
      tiddlerWrapper.insertBefore(theWikibar, editorWrapper);
    }
  }
  wikibar_createMenu(theWikibar,wikibarStore,title,theTextarea);
  if(config.options['chkWikibarSetEditorHeight'] && config.options['txtWikibarEditorRows']){
    theTextarea.rows = config.options['txtWikibarEditorRows'];
  }
  setStylesheet(
    '.wikibar{text-align:left;visibility:visible;margin:2px;padding:1px;}.previewer{overflow:auto;display:block;border:1px solid;}#colorPicker{position:absolute;display:none;z-index:10;margin:0px;padding:0px;}#colorPicker table{margin:0px;padding:0px;border:2px solid #000;border-spacing:0px;border-collapse:collapse;}#colorPicker td{margin:0px;padding:0px;border:1px solid;font-size:11px;text-align:center;cursor:auto;}#colorPicker .header{background-color:#fff;}#colorPicker .button{background-color:#fff;cursor:pointer;cursor:hand;}#colorPicker .button:hover{padding-top:3px;padding-bottom:3px;color:#fff;background-color:#136;}#colorPicker .cell{padding:4px;font-size:7px;cursor:crosshair;}#colorPicker .cell:hover{padding:10px;}.wikibarPopup{position:absolute;z-index:10;border:1px solid #014;color:#014;background-color:#cef;}.wikibarPopup table{margin:0;padding:0;border:0;border-spacing:0;border-collapse:collapse;}.wikibarPopup .button:hover{color:#eee;background-color:#014;}.wikibarPopup .disabled{color:#888;}.wikibarPopup .disabled:hover{color:#888;background-color:#cef;}.wikibarPopup tr .seperator hr{margin:0;padding:0;background-color:#cef;width:100%;border:0;border-top:1px dashed #014;}.wikibarPopup tr .icon{font-family:verdana;font-weight:bolder;}.wikibarPopup tr .marker{font-family:verdana;font-weight:bolder;}.wikibarPopup td{font-size:0.9em;padding:2px;}.wikibarPopup input{border:0;border-bottom:1px solid #014;margin:0;padding:0;font-family:arial;font-size:100%;background-color:#fff;}',
  	'WikiBarStyleSheet');
}
function wikibar_createMenu(place,toolset,title,editor){
  if(!wikibar_isValidMenuItem(toolset)){return;}
  if(!(toolset.TYPE=='MAIN_MENU' || toolset.TYPE=='MENU')){ return; }
    for(var key in toolset){
      if(key.substring(0,9)=='SEPERATOR'){
        wikibar_createMenuSeperator(place);
        continue;
      }
      if(key.substring(0,8)=='DYNAITEM'){
        var dynaTools = toolset[key](title,editor);
        if(dynaTools.TYPE && dynaTools.TYPE=='MENU'){
          wikibar_createMenuItem(place,dynaTools,null,editor,title);
        }else{
          dynaTools.TYPE = 'MENU';
          wikibar_createMenu(place, dynaTools, title, editor);
        }
        continue;
      }
      if((toolset[key].TYPE!='MENU' && toolset[key].TYPE!='MAIN_MENU') && !toolset[key].HANDLER){continue;}
      wikibar_createMenuItem(place,toolset,key,editor,title);
    }
}
function wikibar_createMenuItem(place,toolset,key,editor,title){
  if(!key){
    var tool = toolset;
  }else{
    tool = toolset[key];
    tool.key = key;
  }
  if(!wikibar_isValidMenuItem(tool)){return;}
  var toolIsOnMainMenu = (toolset.TYPE=='MAIN_MENU');
  var toolIsMenu = (tool.TYPE=='MENU');
  var theButton;
  if(toolIsOnMainMenu){
    theButton = createTiddlyButton(
                  place,
                  '',
                  (tool.TOOLTIP? tool.TOOLTIP : ''),
                  (toolIsMenu? wikibar_onClickMenuItem : wikibar_onClickItem),
                  'button');
    theButton.innerHTML = (tool.CAPTION? tool.CAPTION : key);
    theButton.isOnMainMenu = true;
    addClass(theButton, (toolIsMenu? 'menu' : 'item'));
  	place.appendChild( document.createTextNode('\n') );
    if(!toolIsMenu){
      if(config.options['chkWikibarPopmenuOnMouseOver']){
        theButton.onmouseover = function(e){ wikibarPopup.remove(); };
      }
    }
  }else{
    theButton=createTiddlyElement(place, 'tr',key,'button');
    theButton.title = (tool.TOOLTIP? tool.TOOLTIP : '');
    theButton.onclick = (toolIsMenu? wikibar_onClickMenuItem : wikibar_onClickItem);
    var tdL = createTiddlyElement(theButton, 'td','','marker');
    var td = createTiddlyElement(theButton, 'td');
    var tdR = createTiddlyElement(theButton, 'td','','marker');
    td.innerHTML = (tool.CAPTION? tool.CAPTION : key);
    if(toolIsMenu){
      tdR.innerHTML='&nbsp;&nbsp;&rsaquo;';
    }
    if(tool.SELECTED){
      tdL.innerHTML = '&radic; ';
      addClass(theButton, 'selected');
    }
    if(tool.DISABLED){
      addClass(theButton, 'disabled');
    }
  }
  theButton.tiddlerTitle = title;
  theButton.toolItem = tool;
  theButton.editor = editor;
  theButton.tabIndex = 999;
  if(toolIsMenu){
    if(config.options['chkWikibarPopmenuOnMouseOver']){
      theButton.onmouseover = wikibar_onClickMenuItem;
    }
  }
}
function wikibar_createMenuSeperator(place){
  if(place.id.substring(0,7)=='wikibar')  { return; }
  var onclickSeperator=function(e){
  	if(!e){ e = window.event; }
  	e.cancelBubble = true;
    if (e.stopPropagation){ e.stopPropagation();  }
  	return(false);
  };
  var theButton=createTiddlyElement(place,'tr','','seperator');
  var td = createTiddlyElement(theButton, 'td','','seperator');
  td.colSpan=3;
  theButton.onclick=onclickSeperator;
	td.innerHTML = '<hr>';
}
function wikibar_genWikibarAbout(){
  var toolset={};
  toolset.version = {
    CAPTION: '<center>WikiBar ' +
              config.macros.wikibar.major + '.' +
              config.macros.wikibar.minor + '.' +
              config.macros.wikibar.revision +
              (config.macros.wikibar.beta? ' beta '+config.macros.wikibar.beta : '') +
              '</center>',
    HANDLER: function(){}
  };
  toolset.SEPERATOR = {};
  toolset.author = {
    CAPTION: '<center>Arphen Lin<br><a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: <a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>"><a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">arphenlin@gmail.com</a></a></center>',
    TOOLTIP: 'send mail to the author',
    HANDLER: function(){ window.open('<a class="linkification-ext" href="mailto:arphenlin@gmail.com" title="Linkification: mailto:arphenlin@gmail.com">mailto:arphenlin@gmail.com</a>'); }
  };
  toolset.website = {
    CAPTION: '<center>aiddlywiki.sourceforge.net</center>',
    TOOLTIP: 'go to the web site of WikiBar',
    HANDLER: function(){ window.open('http:\/\/<a class="linkification-ext" href="<a class="linkification-ext" href="http://aiddlywiki.sourceforge.net/" title="Linkification: http://aiddlywiki.sourceforge.net/">http://aiddlywiki.sourceforge.net/</a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net/" title="Linkification: http://aiddlywiki.sourceforge.net/">http://aiddlywiki.sourc<a class="linkification-ext" href="http://eforge.net/" title="Linkification: http://eforge.net/">eforge.net/</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://aiddlywiki.sourceforge.net/" title="Linkification: http://aiddlywiki.sourceforge.net/">http://aiddlywiki.sourceforge.net/</a>" title="Linkification: <a class="linkification-ext" href="http://aiddlywiki.sourceforge.net/" title="Linkification: http://aiddlywiki.sourceforge.net/">http://aiddlywiki.sourceforge.net/</a>">aiddlywiki.sourceforge.net/</a></a>'); }
  };
  return toolset;
}
function wikibar_genWikibarOptions(title, editor){
  var toolset={};
  toolset.popOnMouseOver = {
    CAPTION:'popup menu on mouse over',
    SELECTED: config.options['chkWikibarPopmenuOnMouseOver'],
    HANDLER: function(param){
      config.options['chkWikibarPopmenuOnMouseOver'] = !config.options['chkWikibarPopmenuOnMouseOver'];
      saveOptionCookie('chkWikibarPopmenuOnMouseOver');
      var title = param.button.tiddlerTitle;
      var wikibar = document.getElementById('wikibar'+title);
      if(wikibar){ wikibar.parentNode.removeChild(wikibar); }
      wikibar_createWikibar(title);
    }
  };
  toolset.setEditorSize = {
    CAPTION:'set editor height: <input id=\"txtWikibarEditorRows\" type=text size=1 MAXLENGTH=3 value=\"' +
            (config.options['txtWikibarEditorRows']? config.options['txtWikibarEditorRows']:editor.rows) + '\"> ok',
    HANDLER: function(param){
      var input = document.getElementById('txtWikibarEditorRows');
      if(input){
        var rows = parseInt(input.value, 10);
        if(!isNaN(rows)){
          var editor = param.button.editor;
          editor.rows = rows;
        }else{
          rows=config.maxEditRows;
        }
        config.options['txtWikibarEditorRows'] = rows;
        saveOptionCookie('txtWikibarEditorRows');
        config.maxEditRows = rows;
      }
    }
  };
  toolset.setEditorSizeOnLoadingWikibar = {
    CAPTION:'set editor height on loading wikibar',
    SELECTED: config.options['chkWikibarSetEditorHeight'],
    HANDLER: function(param){
      config.options['chkWikibarSetEditorHeight'] = !config.options['chkWikibarSetEditorHeight'];
      saveOptionCookie('chkWikibarSetEditorHeight');
      if(config.options['chkWikibarSetEditorHeight']){
        var rows = config.options['txtWikibarEditorRows'];
        if(!isNaN(rows)){ rows = 15; }
        var editor = param.button.editor;
        editor.rows = rows;
        config.options['txtWikibarEditorRows'] = rows;
        saveOptionCookie('txtWikibarEditorRows');
      }
    }
  };
  toolset.SEPERATOR = {};
  toolset.update = {
    CAPTION: 'check for updates',
    DISABLED: true,
    HANDLER: function(){}
  };
  return toolset;
}
function wikibar_genPaletteSelector(){
  try{
  	var cpTiddlers = store.getTaggedTiddlers('ColorPalettes');
  	if(!cpTiddlers) { return; }
  	var palettes=[];
  	palettes.push(wikibarColorTool.defaultPaletteName);
  	for(var i=0; i<cpTiddlers.length; i++){
  		palettes.push(cpTiddlers[i].title.trim());
  	}
    var toolset={};
    for(i=0; i<palettes.length; i++){
      toolset[palettes[i]] = {
        TOOLTIP: palettes[i],
        SELECTED: (palettes[i]==wikibarColorTool.paletteName),
        HANDLER: wikibar_doSelectPalette
      };
    }
    return toolset;
  }catch(ex){ return null; }
}
function wikibar_onClickItem(e){
	if(!e){ e = window.event; }
	var theTarget = resolveTarget(e);
	if(theTarget.tagName=='INPUT'){
    e.cancelBubble = true;
    if (e.stopPropagation){ e.stopPropagation(); }
    return;
	}
	var theButton = wikibar_resolveTargetButton(theTarget);
	if(!theButton){ return(false);  }
  	var o = theButton.toolItem;
    if(!o) { return; }
    var param = {
      event: e,
      button: theButton
    };
    if(o.HANDLER){ o.HANDLER(param);  }
  if(o.DISABLED){
    e.cancelBubble = true;
    if (e.stopPropagation){ e.stopPropagation(); }
  }
	return(false);
}
function wikibar_onClickMenuItem(e){
	if(!e){ e = window.event; }
	var theButton = wikibar_resolveTargetButton(resolveTarget(e));
	if(!theButton){ return(false);  }
	e.cancelBubble = true;
	if (e.stopPropagation){ e.stopPropagation(); }
    var title = theButton.tiddlerTitle;
    var editor = theButton.editor;
    var tool = theButton.toolItem;
    if(!tool) { return; }
    var popup = wikibarPopup.create(this);
  	if(popup){
      wikibar_createMenu(popup,tool,title,editor);
      if(!popup.hasChildNodes()){
        wikibarPopup.remove();
      }else{
        wikibarPopup.show(popup, false);
      }
    }
	return(false);
}
var wikibarColorTool = {
  defaultPaletteName : 'default',
  defaultColumns : 16,
  defaultPalette : [
    '#FFF','#DDD','#CCC','#BBB','#AAA','#999','#666','#333','#111','#000','#FC0','#F90','#F60','#F30','#C30','#C03',
    '#9C0','#9D0','#9E0','#E90','#D90','#C90','#FC3','#FC6','#F96','#F63','#600','#900','#C00','#F00','#F36','#F03',
    '#CF0','#CF3','#330','#660','#990','#CC0','#FF0','#C93','#C63','#300','#933','#C33','#F33','#C36','#F69','#F06',
    '#9F0','#CF6','#9C3','#663','#993','#CC3','#FF3','#960','#930','#633','#C66','#F66','#903','#C39','#F6C','#F09',
    '#6F0','#9F6','#6C3','#690','#996','#CC6','#FF6','#963','#630','#966','#F99','#F39','#C06','#906','#F3C','#F0C',
    '#3F0','#6F3','#390','#6C0','#9F3','#CC9','#FF9','#C96','#C60','#C99','#F9C','#C69','#936','#603','#C09','#303',
    '#0C0','#3C0','#360','#693','#9C6','#CF9','#FFC','#FC9','#F93','#FCC','#C9C','#969','#939','#909','#636','#606',
    '#060','#3C3','#6C6','#0F0','#3F3','#6F6','#9F9','#CFC','#9CF','#FCF','#F9F','#F6F','#F3F','#F0F','#C6C','#C3C',
    '#030','#363','#090','#393','#696','#9C9','#CFF','#39F','#69C','#CCF','#C9F','#96C','#639','#306','#90C','#C0C',
    '#0F3','#0C3','#063','#396','#6C9','#9FC','#9CC','#06C','#369','#99F','#99C','#93F','#60C','#609','#C3F','#C0F',
    '#0F6','#3F6','#093','#0C6','#3F9','#9FF','#699','#036','#039','#66F','#66C','#669','#309','#93C','#C6F','#90F',
    '#0F9','#6F9','#3C6','#096','#6FF','#6CC','#366','#069','#36C','#33F','#33C','#339','#336','#63C','#96F','#60F',
    '#0FC','#6FC','#3C9','#3FF','#3CC','#399','#033','#39C','#69F','#00F','#00C','#009','#006','#003','#63F','#30F',
    '#0C9','#3FC','#0FF','#0CC','#099','#066','#3CF','#6CF','#09C','#36F','#0CF','#09F','#06F','#03F','#03C','#30C'
  ],
	colorPicker : null,
  pickColorHandler: null,
  userData: null
};
wikibarColorTool.paletteName = wikibarColorTool.defaultPaletteName;
wikibarColorTool.columns = wikibarColorTool.defaultColumns;
wikibarColorTool.palette = wikibarColorTool.defaultPalette;
wikibarColorTool.onPickColor = function(e){
	if (!e){ e = window.event; }
	var theCell = resolveTarget(e);
	if(!theCell){ return(false); }
    color = theCell.bgColor.toLowerCase();
    if(!color)  { return; }
    wikibarColorTool.displayColorPicker(false);
    if(wikibarColorTool.pickColorHandler){
      wikibarColorTool.pickColorHandler(color, wikibarColorTool.userData);
    }
	return(false);
};
wikibarColorTool.onMouseOver = function(e){
	if (!e){ e = window.event; }
	var theButton = resolveTarget(e);
	if(!theButton){ return(false);  }
  	if(!wikibarColorTool)  { return; }
    color = theButton.bgColor.toUpperCase();
    if(!color)  { return; }
    td=document.getElementById('colorPickerInfo');
  	if(!td) { return; }
  	td.bgColor = color;
  	td.innerHTML = '<span style=\"color:#000;\">'+color+'</span>&nbsp;&nbsp;&nbsp;' +
  	               '<span style=\"color:#fff;\">'+color+'</span>';
	e.cancelBubble = true;
	if (e.stopPropagation){ e.stopPropagation(); }
	return(false);
};
wikibarColorTool.openColorPicker = function(theTarget, pickColorHandler, userData){
  wikibarColorTool.skipClickDocumentEvent = true;
  wikibarColorTool.pickColorHandler = pickColorHandler;
  wikibarColorTool.userData = userData;
  wikibarColorTool.moveColorPicker(theTarget);
};
wikibarColorTool.convert3to6HexColor = function(c){
  c=c.trim();
  var rx=/^\#(\d|[a-f])(\d|[a-f])(\d|[a-f])$/gi;
  return (rx.test(c)? c.replace(rx, '#$1$1$2$2$3$3') : c);
};
wikibarColorTool.numToHexColor = function (n){
  if(typeof(n)=='number' && (n>=0 && n<=255)) {
  		s = n.toString(16).toLowerCase();
  		return ((s.length==1)? '0'+s : s);
  }else{
	 return null;
	}
};
wikibarColorTool.renderColorPalette = function(){
	if(wikibarColorTool.paletteName==wikibarColorTool.defaultPaletteName){
		wikibarColorTool.palette=wikibarColorTool.defaultPalette;
		wikibarColorTool.columns=wikibarColorTool.defaultColumns;
		return;
	}
	tiddlerText = (store.getTiddlerText(wikibarColorTool.paletteName, '')).trim();
	if(tiddlerText.length<=0) { return; }
	var cpContents = tiddlerText.split('\n');
	var colors=[];
	columns = wikibarColorTool.defaultColumns;
	var tmpArray=null;
	errCount=0;
	for(var i=0; i<cpContents.length; i++){
		cpLine=cpContents[i].trim();
    if( (!cpLine) || (cpLine.length<=0) || (cpLine.charAt(0) == '#') ){ continue; }
		if(cpLine.substring(0,8).toLowerCase()=='columns:'){
			tmpArray = cpLine.split(':');
			try{
				columns = parseInt(tmpArray[1],10);
			}catch(ex){
				columns = wikibarColorTool.defaultColumns;
			}
		}else{
			tmpArray = cpLine.replace('\t', ' ').split(/[ ]{1,}/);
			try{
				color='';
				for(var j=0; j<3; j++){
          c=parseInt(tmpArray[j].trim(), 10);
          if(isNaN(c)){
						break;
          }else{
						c=wikibarColorTool.numToHexColor(c);
						if(!c) {break;}
            color+=c;
					}
				}
				if(color.length==6){
					colors.push('#'+color);
				}	else {
					throw 'error';
				}
			}catch(ex){
			}
		}
	}
	if(colors.length>0){
		wikibarColorTool.palette = colors;
		wikibarColorTool.columns = columns;
	}else{
		throw 'renderColorPalette(): No color defined in the palette.';
	}
};
wikibarColorTool.displayColorPicker = function(visible){
  if(wikibarColorTool.colorPicker){
    wikibarColorTool.colorPicker.style.display = (visible? 'block' : 'none');
  }
};
wikibarColorTool.moveColorPicker = function(theTarget){
  if(!wikibarColorTool.colorPicker){
  	wikibarColorTool.createColorPicker();
  }
	var cp = wikibarColorTool.colorPicker;
	var rootLeft = findPosX(theTarget);
  var rootTop = findPosY(theTarget);
  var popupLeft = rootLeft;
  var popupTop = rootTop;
  var popupWidth = cp.offsetWidth;
  var winWidth = findWindowWidth();
  if(popupLeft + popupWidth > winWidth){
	  popupLeft = winWidth - popupWidth;
	}
  cp.style.left = popupLeft + 'px';
  cp.style.top = popupTop + 'px';
  wikibarColorTool.displayColorPicker(true);
};
wikibarColorTool.createColorPicker = function(unused, palette){
  if(palette){	wikibarColorTool.paletteName=palette; }
	wikibarColorTool.renderColorPalette();
	wikibarColorTool.colorPicker = document.createElement('div');
	wikibarColorTool.colorPicker.id = 'colorPicker';
	document.body.appendChild(wikibarColorTool.colorPicker);
  var theTable = document.createElement('table');
  wikibarColorTool.colorPicker.appendChild(theTable);
  var theTR = document.createElement('tr');
	theTable.appendChild(theTR);
	var theTD = document.createElement('td');
	theTD.className = 'header';
	theTD.colSpan = wikibarColorTool.columns;
	theTD.innerHTML = wikibarColorTool.paletteName;
  theTR.appendChild(theTD);
  for(var i=0; i<wikibarColorTool.palette.length; i++){
    if((i%wikibarColorTool.columns)===0){
      theTR = document.createElement('tr');
      theTable.appendChild(theTR);
    }
    theTD = document.createElement('td');
    theTD.className = 'cell';
    theTD.bgColor = wikibarColorTool.convert3to6HexColor(wikibarColorTool.palette[i]);
    theTD.onclick = wikibarColorTool.onPickColor;
    theTD.onmouseover = wikibarColorTool.onMouseOver;
    theTR.appendChild(theTD);
  }
  rest = wikibarColorTool.palette.length % wikibarColorTool.columns;
  if(rest>0){
    theTD = document.createElement('td');
		theTD.colSpan = wikibarColorTool.columns-rest;
    theTD.bgColor = '#000000';
    theTR.appendChild(theTD);
  }
  theTR = document.createElement('tr');
	theTable.appendChild(theTR);
	theTD = document.createElement('td');
	theTD.colSpan = wikibarColorTool.columns;
	theTD.id = 'colorPickerInfo';
  theTR.appendChild(theTD);
};
wikibarColorTool.onDocumentClick = function(e){
	if (!e){ e = window.event; }
	if(wikibarColorTool.skipClickDocumentEvent) {
	  wikibarColorTool.skipClickDocumentEvent = false;
    return true;
	}
	if((!e.eventPhase) || e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET){
    wikibarColorTool.displayColorPicker(false);
  }
	return true;
};
function wikibar_doSelectPalette(param){
	clearMessage();
	var theButton = param.button;
	if(!theButton.toolItem.key)  { return; }
	var palette = theButton.toolItem.key;
	var oldPaletteName = wikibarColorTool.paletteName;
	if(oldPaletteName != palette){
		try{
			wikibarColorTool.createColorPicker(theButton, palette);
			displayMessage('Palette \"'+palette+'\" ('+ wikibarColorTool.palette.length +' colors) is selected');
		}catch(ex){
			errMsg = ex;
			if(errMsg.substring(0,18)=='renderColorPalette'){
				displayMessage('Invalid palette \"' + palette + '\", please check it out!');
				wikibarColorTool.createColorPicker(theButton, oldPaletteName);
			}
		}
	}
}
var wikibarPopup = {
  skipClickDocumentEvent: false,
	stack: []
};
wikibarPopup.resolveRootPopup = function(o){
  if(o.isOnMainMenu){  return null; }
  if(o.className.substring(0,12)=='wikibarPopup'){  return o;}
  return wikibarPopup.resolveRootPopup(o.parentNode);
};
wikibarPopup.create = function(root){
  for(var i=0; i<wikibarPopup.stack.length; i++){
    var p=wikibarPopup.stack[i];
    if(p.root==root){
      wikibarPopup.removeFrom(i+1);
      return null;
    }
  }
  var rootPopup = wikibarPopup.resolveRootPopup(root);
  if(!rootPopup){
    wikibarPopup.remove();
  }else{
    wikibarPopup.removeFromRootPopup(rootPopup);
  }
	var popup = createTiddlyElement(document.body,'div','wikibarPopup'+root.toolItem.key,'wikibarPopup');
	var pop = createTiddlyElement(popup,'table','','');
	wikibarPopup.stack.push({rootPopup: rootPopup, root: root, popup: popup});
	return pop;
};
wikibarPopup.show = function(unused,slowly){
	var curr = wikibarPopup.stack[wikibarPopup.stack.length-1];
	var overlayWidth = 1;
  var rootLeft, rootTop, rootWidth, rootHeight, popupLeft, popupTop, popupWidth;
  if(curr.rootPopup){
  	rootLeft = findPosX(curr.rootPopup);
  	rootTop = findPosY(curr.root);
  	rootWidth = curr.rootPopup.offsetWidth;
  	popupLeft = rootLeft + rootWidth - overlayWidth;
  	popupTop = rootTop;
  }else{
  	rootLeft = findPosX(curr.root);
  	rootTop = findPosY(curr.root);
  	rootHeight = curr.root.offsetHeight;
  	popupLeft = rootLeft;
  	popupTop = rootTop + rootHeight;
  }
	var winWidth = findWindowWidth();
	popupWidth = curr.popup.offsetWidth;
	if(popupLeft + popupWidth > winWidth){
		popupLeft = rootLeft - popupWidth + overlayWidth;
	}
	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));
	}
};
wikibarPopup.remove = function(){
	if(wikibarPopup.stack.length > 0){
		wikibarPopup.removeFrom(0);
  }
};
wikibarPopup.removeFrom = function(from){
	for(var t=wikibarPopup.stack.length-1; t>=from; t--){
		var p = wikibarPopup.stack[t];
		removeClass(p.root,'highlight');
		p.popup.parentNode.removeChild(p.popup);
  }
	wikibarPopup.stack = wikibarPopup.stack.slice(0,from);
};
wikibarPopup.removeFromRootPopup = function(from){
  for(var t=0; t<wikibarPopup.stack.length; t++){
    var p = wikibarPopup.stack[t];
    if(p.rootPopup==from){
      wikibarPopup.removeFrom(t);
      break;
    }
  }
};
wikibarPopup.onDocumentClick = function(e){
	if (!e){ e = window.event; }
	if(wikibarPopup.skipClickDocumentEvent){
	 wikibarPopup.skipClickDocumentEvent=false;
	 return true;
	}
	if((!e.eventPhase) || e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET){
		wikibarPopup.remove();
	}
	return true;
};
var wikibarStore = {
  TYPE: 'MAIN_MENU',
  help:{
    TYPE:'MENU',
    CAPTION: '<font face=\"verdana\">?</font>',
    TOOLTIP:     'about WikiBar',
    options:{
      TYPE:'MENU',
      DYNAITEM: wikibar_genWikibarOptions
    },
    about:{
      TYPE:'MENU',
      DYNAITEM: wikibar_genWikibarAbout
    }
  },
  preview:{
    TOOLTIP:     'preview this tiddler',
    CAPTION: '<font face=\"verdana\">&infin;</font>',
    HANDLER: wikibar_doPreview
  },
	line:{
		TOOLTIP:    'horizontal line',
		CAPTION: '<font face=\"verdana\">&mdash;</font>',
		syntax: '\n----\n',
		HANDLER: wikibar_editFormatByCursor
	},
	crlf:{
		TOOLTIP:    'new line',
		CAPTION: '<font face=\"verdana\">&para;</font>',
		syntax: '\n',
		HANDLER: wikibar_editFormatByCursor
	},
	selectAll:{
		TOOLTIP:    'select all',
		CAPTION: '<font face=\"verdana\">&sect;</font>',
		HANDLER: wikibar_editSelectAll
	},
	deleteSelected:{
		TOOLTIP:    'delete selected',
		CAPTION: '<font face=\"verdana\">&times;</font>',
		syntax: '',
		HANDLER: wikibar_editFormat
	},
  textFormat:{
    TYPE: 'MENU',
    CAPTION: 'text',
    TOOLTIP: 'text formatters',
    ignore:{
			TOOLTIP:     'ignore wiki word',
			CAPTION: 'ignore wikiWord',
			syntax:  '~user_text',
			hint:    'wiki_word',
			HANDLER:    wikibar_editFormatByWord
		},
		bolder:{
			TOOLTIP:     'bolder text',
			CAPTION: '<strong>bolder</strong>',
			syntax:  "''user_text''",
			hint:		 'bold_text',
			HANDLER:    wikibar_editFormatByWord
		},
		italic:{
			TOOLTIP:    'italic text',
			CAPTION: '<em>italic</em>',
			syntax: '\/\/user_text\/\/',
			hint:		'italic_text',
			HANDLER: wikibar_editFormatByWord
		},
		underline:{
			TOOLTIP:    'underline text',
			CAPTION: '<u>underline</u>',
			syntax: '__user_text__',
			hint:		'underline_text',
			HANDLER: wikibar_editFormatByWord
		},
		strikethrough:{
			TOOLTIP:    'strikethrough text',
			CAPTION: '<strike>strikethrough</strike>',
			syntax: '==user_text==',
			hint:		'strikethrough_text',
			HANDLER: wikibar_editFormatByWord
		},
		superscript:{
			TOOLTIP:    'superscript text',
			CAPTION: 'X<sup>superscript</sup>',
			syntax: '^^user_text^^',
			hint:		'superscript_text',
			HANDLER: wikibar_editFormatByWord
		},
		subscript:{
			TOOLTIP:    'subscript text',
			CAPTION: 'X<sub>subscript</sub>',
			syntax: '~~user_text~~',
			hint:		'subscript_text',
			HANDLER: wikibar_editFormatByWord
		},
		comment:{
			TOOLTIP:    'comment text',
			CAPTION: 'comment text',
			syntax: '/%user_text%/',
			hint:		'comment_text',
			HANDLER: wikibar_editFormatByWord
		},
		monospaced:{
			TOOLTIP:    'monospaced text',
			CAPTION: '<code>monospaced</code>',
			syntax: '{{{user_text}}}',
			hint:		'monospaced_text',
			HANDLER: wikibar_editFormatByWord
		}
  },
  paragraph:{
    TYPE: 'MENU',
    TOOLTIP: 'paragarph formatters',
    list:{
      TYPE: 'MENU',
      TOOLTIP: 'list tools',
      bullet:{
  			TOOLTIP:    'bullet point',
  			syntax: '*user_text',
  			hint:		'bullet_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		numbered:{
  			TOOLTIP:    'numbered list',
  			syntax: '#user_text',
  			hint:		'numbered_text',
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    heading:{
      TYPE: 'MENU',
      heading1:{
  		  CAPTION:'<h1>Heading 1</h1>',
  			TOOLTIP:    'Heading 1',
  			syntax: '!user_text',
  			hint:		'heading_1',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading2:{
  		  CAPTION:'<h2>Heading 2<h2>',
  			TOOLTIP:    'Heading 2',
  			syntax: '!!user_text',
  			hint:		'heading_2',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading3:{
  		  CAPTION:'<h3>Heading 3</h3>',
  			TOOLTIP:    'Heading 3',
  			syntax: '!!!user_text',
  			hint:		'heading_3',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading4:{
  		  CAPTION:'<h4>Heading 4</h4>',
  			TOOLTIP:    'Heading 4',
  			syntax: '!!!!user_text',
  			hint:		'heading_4',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading5:{
  		  CAPTION:'<h5>Heading 5</h5>',
  			TOOLTIP:    'Heading 5',
  			syntax: '!!!!!user_text',
  			hint:		'heading_5',
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    comment:{
      TYPE: 'MENU',
      commentByLine:{
  			CAPTION:'comment by line',
  			TOOLTIP:    'line comment',
  			syntax: '/%user_text%/',
  			hint:		'comment_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByBlock:{
  			CAPTION:'comment by block',
  			TOOLTIP:    'block comment',
  			syntax: '/%\nuser_text\n%/',
  			hint:		'comment_text',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    monospaced:{
      TYPE: 'MENU',
  		monosByLine:{
  			CAPTION: 	'monospaced by line',
  			TOOLTIP:    'line monospaced',
  			syntax: '{{{\nuser_text\n}}}',
  			hint:		'monospaced_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		monosByBlock:{
  			CAPTION: 	'monospaced by block',
  			TOOLTIP:    'block monospaced',
  			syntax: '{{{\nuser_text\n}}}',
  			hint:		'monospaced_text',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    quote:{
      TYPE: 'MENU',
  		quoteByLine:{
  			CAPTION: 	'quote by line',
  			TOOLTIP:    'line quote',
  			syntax: '>user_text',
  			hint:		'quote_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		quoteByBlcok:{
  			CAPTION: 	'quote by block',
  			TOOLTIP:    'block quote',
  			syntax: '<<<\nuser_text\n<<<',
  			hint:		'quote_text',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    plugin:{
      TYPE: 'MENU',
      code:{
  			CAPTION: 	'code area',
  			TOOLTIP:    'block monospaced for plugin',
  			syntax: '\n\/\/{{{\nuser_text\n\/\/}}}\n',
  			hint:		'monospaced_plugin_code',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByLine:{
  			CAPTION: 	'comment by line',
  			TOOLTIP:    'line comment',
  			syntax: '\/\/user_text',
  			hint:		'plugin_comment',
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByBlock:{
  			CAPTION: 	'comment by block',
  			TOOLTIP:    'block comment',
  			syntax: '\/\***\nuser_text\n***\/',
  			hint:		'plugin_comment',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    css:{
      TYPE: 'MENU',
      code:{
  			CAPTION: 	'code area',
  			TOOLTIP:    'block monospaced for css',
  			syntax: '\n\nuser_text\n\n',
  			hint:		'monospaced_css_code',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByLine:{
  			CAPTION: 	'comment by line',
  			TOOLTIP:    'line comment',
  			syntax: '',
  			hint:		'css_comment',
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByBlock:{
  			CAPTION: 	'comment by block',
  			TOOLTIP:    'block comment',
  			syntax: '',
  			hint:		'css_comment',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    }
  },
  color:{
    TYPE: 'MENU',
    TOOLTIP: 'color tools',
    highlight:{
		  CAPTION:'highlight text',
			TOOLTIP:    'highlight text',
			syntax: '@@user_text@@',
			hint:		'highlight_text',
			HANDLER: wikibar_editFormatByWord
		},
		color:{
		  CAPTION:'text color',
			TOOLTIP:    'text color',
			hint:		'your_text',
			syntax: '@@color(%1):user_text@@',
			HANDLER:   wikibar_getColorCode,
			doMore: wikibar_editFormatByWord
		},
		bgcolor:{
		  CAPTION:'background color',
			TOOLTIP:    'background color',
			hint:		'your_text',
			syntax: '@@bgcolor(%1):user_text@@',
			HANDLER: wikibar_getColorCode,
			doMore: wikibar_editFormatByWord
		},
		colorcode:{
      CAPTION:'color code',
      TOOLTIP:    'insert color code',
      syntax: '%1',
      HANDLER: wikibar_getColorCode,
      doMore: wikibar_editFormatByCursor
    },
    'color palette':{
      TYPE:'MENU',
      DYNAITEM: wikibar_genPaletteSelector,
  		SEPERATOR:{},
  		morePalette:{
  		  CAPTION:'more palettes',
  		  TOOLTIP:'get more palettes',
  		  HANDLER: wikibar_getMorePalette
  		}
    }
  },
  link:{
    TYPE: 'MENU',
    TOOLTIP: 'insert link',
    wiki:{
		  CAPTION:'wiki link',
			TOOLTIP:    'wiki link',
			syntax: '[[user_text]]',
			hint:		'wiki_word',
			HANDLER: wikibar_editFormatByWord
		},
		pretty:{
			CAPTION: 	'pretty link',
			TOOLTIP:    'pretty link',
			syntax: '[[user_text|%1]]',
			hint:		'pretty_word',
			param:	'PrettyLink Target',
			HANDLER:   wikibar_getLinkUrl,
			doMore: wikibar_editFormatByWord
		},
		url:{
			TOOLTIP:    'url link',
			syntax: '[[user_text|%1]]',
			hint:		'your_text',
			param:	'http:\/\/...',
			HANDLER:   wikibar_getLinkUrl,
			doMore: wikibar_editFormatByWord
		},
		image:{
			TOOLTIP:    'image link',
			syntax: '[img[user_text|%1]]',
			hint:		'alt_text',
			param:	'image/icon.jpg',
			HANDLER:   wikibar_getLinkUrl,
			doMore: wikibar_editFormatByWord
		}
  },
  macro:{},
  more:{
    TYPE: 'MENU',
    TOOLTIP: 'more tools',
    table:{
      TYPE: 'MENU',
      TOOLTIP: 'table',
      table:{
  		  CAPTION:'create table',
  			TOOLTIP:    'create a new table',
  			syntax: '\n%1\n',
  			HANDLER: wikibar_getTableRowCol,
  			doMore: wikibar_editFormatByWord
  		},
  		header:{
  			TOOLTIP:    'table header text',
  			syntax: '|user_text|c',
  			hint:		'table_header',
  			HANDLER: wikibar_editFormatByWord
  		},
  		cell:{
  			TOOLTIP:    'create a tabel cell',
  			syntax: '|user_text|',
  			hint:		'your_text',
  			HANDLER: wikibar_editFormatByWord
  		},
  		columnHeader:{
  		  CAPTION:'column header',
  			TOOLTIP:    'create a column header cell',
  			syntax: '|!user_text|',
  			hint:		'column_header',
  			HANDLER: wikibar_editFormatByWord
  		},
  	  cell:{
  	    TYPE: 'MENU',
        CAPTION: 'cell options',
    		bgcolor:{
    			CAPTION: 	'background color',
    			TOOLTIP:    'cell bgcolor',
    			syntax: '|bgcolor(%1):user_text|',
    			hint:		'your_text',
    			HANDLER: wikibar_getColorCode,
    			doMore: wikibar_editFormatByTableCell
    		},
    		alignLeft:{
    			CAPTION: 	'align left',
    			TOOLTIP:    'left align cell text',
    			syntax: '|user_text|',
    			hint:		'your_text',
    			HANDLER: wikibar_editFormatByTableCell
    		},
    		alignCenter:{
    			CAPTION: 	'align center',
    			TOOLTIP:    'center align cell text',
    			syntax: '| user_text |',
    			hint:		'your_text',
    			HANDLER: wikibar_editFormatByTableCell
    		},
    		alignRight:{
    			CAPTION: 	'align right',
    			TOOLTIP:    'right align cell text',
    			syntax: '| user_text|',
    			hint:		'your_text',
    			HANDLER: wikibar_editFormatByTableCell
    		}
    	}
    },
    html:{
      TYPE: 'MENU',
      html:{
  			CAPTION: 	'&lt;html&gt;',
  			TOOLTIP:    'html tag',
  			syntax: '<html>\nuser_text\n</html>',
  			hint:		'html_content',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    }
  },
  addon:{
    TYPE: 'MENU',
    TOOLTIP:'3rd party tools',
    'about addons':{
      TOOLTIP: 'list loaded addons',
      HANDLER: wikibar_doListAddons
    },
    SEPERATOR:{}
  }
};
addEvent(document, 'click', wikibarColorTool.onDocumentClick);
addEvent(document, 'click', wikibarPopup.onDocumentClick);
wikibar_install();
//}}}
/***
|''Name:''|YourSearchPlugin|
|''Version:''|2.1.0 (2006-10-12)|
|''Source:''|<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-softw<a class="linkification-ext" href="http://are.de/#YourSearchPlugin" title="Linkification: http://are.de/#YourSearchPlugin">are.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a> ([[del.icio.us|<a class="linkification-ext" href="http://del.icio.us/post?url=http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin" title="Linkification: http://del.icio.us/post?url=http://<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin">tiddlywiki.abego-software.de/index.html%23YourSearchPlugin</a>"><a class="linkification-ext" href="http://del.icio.us/post?url=http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin" title="Linkification: http://del.icio.us/post?url=http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin">http://del.icio.us/post?url=http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin</a></a>]])|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.abego-software.de/legal/apl-v10.html" title="Linkification: http://www.abego-software.de/legal/apl-v10.html">http://www.abego-software.de/legal/apl-v10.html</a>" title="Linkification: http://www.abego-software.de/legal/apl-v10.html">http://www.abego-software.de/legal/apl-v10.html</a>]]|
|''Copyright:''|&copy; 2005-2006 [[abego Software|<a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; ~InternetExplorer 6.0|
!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|<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>">http://tiddlywiki.abego-software.de/archive</a>]] for ~YourSearchPlugins supporting older versions of TiddlyWiki.
!Revision history
* v2.1.0 (2006-10-12)
** Release version with TiddlyWiki 2.1 support
*** Support (Extended) Field search
*** Support parenthesis in Boolean Search
*** Support direct regular expression input
*** Support JavaScript Expressions for filtering
*** "new tiddler" feature (create tiddler based on search text)
* v2.0.2 (2006-02-13)
** Bugfix for Firefox 1.5.0.1 related to the "Show prefix" checkbox. Thanks to Ted Pavlic for reporting and to BramChen for fixing. 
** Internal
*** Make "JSLint" conform
* v2.0.1 (2006-02-05)
** Support "Exact Word Match" (use '=' to prefix word)
** Support default filter settings (when no filter flags are given in search term)
** Rework on the "less than 3 chars search text" feature (thanks to EricShulman)
** Better support SinglePageMode when doing "Open all tiddlers" (thanks to EricShulman)
** Support Firefox 1.5.0.1
** Bug: Fixed a hilite bug in "classic search mode" (thanks to EricShulman)
* v2.0.0 (2006-01-16)
** Add User Interface
* v1.0.1 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.0 (2005-12-28)
** initial version
!Source Code
***/
//{{{
//============================================================================
//============================================================================
//                           YourSearchPlugin
//============================================================================
//============================================================================

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

version.extensions.YourSearchPlugin = {
	major: 2, minor: 1, revision: 0,
	source: "<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>",
	licence: "[[BSD open source license (abego Software)|<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.abego-software.de/legal/apl-v10.html" title="Linkification: http://www.abego-software.de/legal/apl-v10.html">http://www.abego-software.de/legal/apl-v10.html</a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de/legal/apl-v10.html" title="Linkification: http://www.abego-software.de/legal/apl-v10.html">http://www.abego-software.de/legal/apl-v10.html</a>"><a class="linkification-ext" href="http://www.abego-software.de/legal/apl-v10.html" title="Linkification: http://www.abego-software.de/legal/apl-v10.html">http://www.abego-software.de/legal/apl-v10.html</a></a>]]",
	copyright: "Copyright (c) abego Software GmbH, 2005-2006 (<a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">www.abego-software.de</a>)"
};

if (!window.abego) window.abego = {};

// define the Array forEach when not yet defined (e.g. by Mozilla)
if (!Array.forEach) {
    Array.forEach = function(obj, callback, thisObj) {
        for (var i = 0,len = obj.length; i < len; i++)
            callback.call(thisObj, obj[i], i, obj);
    };
    Array.prototype.forEach = function(callback, thisObj) {
        for (var i = 0,len = this.length; i < len; i++)
            callback.call(thisObj,  this[i], i, this);
    };
}

abego.toInt = function(s, defaultValue) {
	if (!s) return defaultValue;
	var n = parseInt(s);
	return (n == NaN) ? defaultValue : n;
};

abego.createEllipsis = function(place) {
	var e = createTiddlyElement(place,"span");
	e.innerHTML = "&hellip;";
};

//#concept Object
//
abego.shallowCopy = function(object) {
	if (!object)
		return object;
	var result = {};
	for (var n in object) 
		result[n] = object[n];
	return result;
};

// Returns a shallow copy of the options, or a new, empty object if options is null/undefined.
//
// @param options [may be null/undefined]
//
//#concept Object, Options
//#import abego.shallowCopy
//
abego.copyOptions = function(options) {
	return !options ? {} : abego.shallowCopy(options);
};

//#import abego.define-namespace
// returns the number of occurances of s in the text
abego.countStrings = function(text, s) {
	if (!s)
		return 0;
		
	var len = s.length;
	var n = 0;
	var lastIndex = 0;
	while (1) {
		var i = text.indexOf(s, lastIndex);
		if (i < 0)
			return n;
		n++;
		lastIndex = i+len;
	}
	return n;
};// Returns the content of the first "braced" text {...}
// Also takes care of nested braces
//
// Returns undefined when no braced text is found or it is not properly nested
//
// @param [optional] when defined and a braced text is found lastIndexRef.lastIndex will contain the index of the char following the (final) closing brace on return.
//
abego.getBracedText = function(text, offset,lastIndexRef) {
	if (!offset) offset = 0;
	var re = /\{([^\}]*)\}/gm;
	re.lastIndex = offset;
	var m = re.exec(text);
	if (m) {
		// The matching stopped at the first closing brace.
		// But if the matched text contains opening braces 
		// this is not the final closing brace.
		// Handle this case specially, find the "corresponding" closing brace
		var s = m[1];
		var nExtraOpenBrace = abego.countStrings(s,"{");
		
		if (!nExtraOpenBrace) {
			if (lastIndexRef)
				lastIndexRef.lastIndex = re.lastIndex;
			// simple case: no nested braces
			return s;
		}

		// special case: "nested braces"
		var len = text.length;
		for (var i = re.lastIndex; i < len && nExtraOpenBrace; i++) {
			var c = text.charAt(i);
			if (c == "{") 
				nExtraOpenBrace++;
			else if (c == "}")
				nExtraOpenBrace--;
		}
		if (!nExtraOpenBrace) {
			// found the corresponding "}".
			if (lastIndexRef)
				lastIndexRef.lastIndex = i-1;
			return text.substring(m.index+1, i-1);
		}
	}
	
	// no return means: return undefined;
};

// Returns an array with those items from the array that pass the given test
//
// @param test an one-arg boolean function that returns true when the item should be added.
// @param testObj [optional] the receiver for the test function (global if undefined or null)
// @param result [optional] an array. When define the selected items are added to this array, otherwise a new array is used.
//
//#import Array.prototype.forEach
//
abego.select = function(array,test,testObj,result) {
	if (!result) result = [];
	array.forEach(function(t) {
		if (test.call(testObj,t)) 
			result.push(t);
		});
	return result;
};

// Class abego.TiddlerFilterTerm =================================================================
//
// Used to check if a tiddler contains a given text.
//
// A list of fields (standard and/or extended) may be specified to restrict the search to certain fields. 
//
// When no explicit fields are given the fields defined by defaultFields are checked, plus all extended 
// fields (when options.withExtendedFields is true).
//
// @param options [may be null/undefined]
//		options.fields @seeParam abego.MultiFieldRegExpTester.fields
// 		options.withExtendedFields @seeParam abego.MultiFieldRegExpTester.withExtendedFields  
// 		options.caseSensitive [Default: false]
// 		options.fullWordMatch [Default: false]
// 		options.textIsRegExp [Default: false] when true the given text is already a regExp
//
//#import abego.MultiFieldRegExpTester
//
abego.TiddlerFilterTerm = function(text,options) {
	if (!options) options = {};

	var reText = text;
	if (!options.textIsRegExp) {
		reText = text.escapeRegExp();
		if (options.fullWordMatch) 
			reText = "\\b"+reText+"\\b";
	}
	var regExp = new RegExp(reText, "m"+(options.caseSensitive ? "" : "i"));

	this.tester = new abego.MultiFieldRegExpTester(regExp, options.fields, options.withExtendedFields);
}

abego.TiddlerFilterTerm.prototype.test = function(tiddler) {
	return this.tester.test(tiddler);
}

//#import abego.define-namespace
// Recognize a string like
//     "Some Title. Some content text #Tag1 #Tag2 Tag3"
// with the tags and the text being optional.
// Also the period at the end of the title is optional when no content text is specified)
//
// Returns the result in an object with properties "title" and "params",
// with "params" following the parseParams format, containing the "tag" and "text" arguments.
//
abego.parseNewTiddlerCommandLine = function(s) {
	var m = /(.*?)\.(?:\s+|$)([^#]*)(#.*)?/.exec(s);
	if (!m) 
		m = /([^#]*)()(#.*)?/.exec(s);
	if (m) {
		var r;
		if (m[3]) {
			var s2 = m[3].replace(/#/g,"");
			r = s2.parseParams("tag");
		} else
			r = [[]];
			
		// add the text parameter
		var text = m[2]?m[2].trim():"";
		r.push({name: "text", value: text});
		r[0].text = [text];
		
		return {title: m[1].trim(), params: r}; 
	} else
		return {title: s.trim(),params: [[]]};
}	
// 		options.defaultFields [@seeOptionDefault abego.TiddlerFilterTerm.fields] fields to check when no fields are explicitly specified in queryText.
// 		options.withExtendedFields [@seeOptionDefault abego.TiddlerFilterTerm.withExtendedFields] when true and no fields are explicitly specified in queryText also the extended fields are considered (in addition to the ones in defaultFields).
// @seeOptions abego.TiddlerFilterTerm (-fields -fullWordMatch -withExtendedFields)
//
//#import abego.getBracedText
//#import abego.copyOptions
//#import abego.TiddlerFilterTerm
//
abego.parseTiddlerFilterTerm = function(queryText,offset,options) {
	
	// group 1: {...} 		(JavaScript expression)
	// group 2: '=' 		(full word match (optional))
	// group 3: [!%#] 		(field selection short cuts)
	// group 4: fieldName ':'
	// group 5: String literal "..."
	// group 6: RegExp literal /.../
	// group 7: scheme '://' nonSpaceChars
	// group 8: word
	var re = /\s*(?:(?:\{([^\}]*)\})|(?:(=)|([#%!])|(?:(\w+)\s*\:(?!\/\/))|(?:(?:("(?:(?:\\")|[^"])+")|(?:\/((?:(?:\\\/)|[^\/])+)\/)|(\w+\:\/\/[^\s]+)|([^\s\)\-\"]+)))))/mg;
	var shortCuts = {'!':'title','%':'text','#':'tags'};
	
	var fieldNames = {};
	var fullWordMatch;
	re.lastIndex = offset;
	while (1) {
		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];
			
			var 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};
		}
	}
};

// Class abego.BoolExp =================================================================
//
// Allows the execution/evaluation of a boolean expression, according to this syntax:
//
// boolExpression    : unaryExpression (("AND"|"OR"|"&&"|"||")? unaryExpression)*
//                   ;
//
// unaryExpression   : ("not"|"-")? primaryExpression
//                   ;
//
// primaryExpression : "(" boolExpression ")" 
//                   | Term
//                   ;
//
// For flexibility the Term syntax is defined by a separate parse function.
//
// Notice that there is no precedence between "AND" and "OR" operators, i.e. they are evaluated from left to right.
//
// To evaluate the expression in a given context use code like this:
//
//	var be = new abego.BoolExp(s, termParseFunc);
//  var result = be.exec(context);
// 
// @param s the text defining the expression 
// @param parseTermFunc a Function(text,offset,options) that parses the text starting at offset for a "Term" and returns an object with properties {func: Function(context), lastIndex: ...}. func is the function to be used to evaluate the term in the given context.
// @param options [may be null/undefined] (is also passed to the parseTermFunc)
// 			options.defaultOperationIs_OR [Default: false] When true the concatenation of unaryExpressions (without an operator) is interpreted as an "OR", otherwise as an "AND".
// 			options.caseSensitive [default: false]
//
abego.BoolExp = function(s, parseTermFunc, options) {
	this.s = s;
	var defaultOperationIs_OR = options && options.defaultOperationIs_OR;
	
	var reStart = /\s*(?:(\-|not)|(\())/gi; 		// group 1: NOT, group2 "("
	var reCloseParenthesis = /\s*\)/g;  			// match )
	var reAndOr = /\s*(?:(and|\&\&)|(or|\|\|))/gi; 	// group 1: AND, group 2: OR
	var reNonWhiteSpace = /\s*[^\)\s]/g;
	
	var reNot_Parenthesis = /\s*(\-|not)?(\s*\()?/gi;
	
	var parseUnaryExpression = function(offset) {
		reNot_Parenthesis.lastIndex = offset;
		var m = reNot_Parenthesis.exec(s);
		var negate;
		var result;
		if (m && m.index == offset) {
			offset = reNot_Parenthesis.lastIndex;
			negate = m[1];
			if (m[2]) {
				// case:  (...)
				var e = parseBoolExpression(offset);
				reCloseParenthesis.lastIndex = e.lastIndex;
				if (!reCloseParenthesis.exec(s))
					throw "Missing ')'";
				result = {func: e.func, lastIndex: reCloseParenthesis.lastIndex};
			}
		}
		if (!result)
			result = parseTermFunc(s,offset,options);

		if (negate) {
			result.func = (function(f){return function(context) {return !f(context);}})(result.func);
			// don't mark patterns that are negated
			// (This is essential since the marking may also be used to calculate "ranks". If we
			// would also count the negated matches (i.e. that should not exist) the rank may get too high)
			result.markRE = null;
		}
		return result;
	};

	var parseBoolExpression = function(offset) {
		var result = parseUnaryExpression(offset);
		while (1) {
			var l = result.lastIndex;
			reAndOr.lastIndex = l;
			var m = reAndOr.exec(s);
			var isOrCase;
			var nextExp;
			if (m && m.index == l) {
				isOrCase = !m[1];
				nextExp = parseUnaryExpression(reAndOr.lastIndex);
			} else {
				// no "AND" or "OR" found. 
				// Maybe it is a concatenations of parseUnaryExpression without operators
				try {
					nextExp = parseUnaryExpression(l);
				} catch (e) {
					// no unary expression follows. We are done
					return result;
				}
				isOrCase = defaultOperationIs_OR;
			}
			result.func = (function(func1, func2, isOrCase) {
					return isOrCase
						? function(context) {return func1(context) || func2(context);}
						: function(context) {return func1(context) && func2(context);};
				})(result.func,nextExp.func,isOrCase);
			result.lastIndex = nextExp.lastIndex;
			if (!result.markRE)
				result.markRE = nextExp.markRE;
			else if (nextExp.markRE) 
				result.markRE = result.markRE + "|" + nextExp.markRE;
		}
	};
	
	var expr = parseBoolExpression(0);
	this.evalFunc = expr.func;
	if (expr.markRE)
		this.markRegExp = new RegExp(expr.markRE, options.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;
};

// Class abego.MultiFieldRegExpTester ==================================================================
//
// @param fields [optional; Default: ["title","text","tags"]] array of names of fields to be considered
// @param withExtendedFields [optional; Default: false] when true also extended fields are considered (in addition to the ones given in 'fields')
//
abego.MultiFieldRegExpTester = function(re, fields, withExtendedFields) {
	this.re = re;
	this.fields = fields ? fields : ["title","text","tags"];
	this.withExtendedFields = withExtendedFields;
}

// Returns the name of the first field found that value succeeds the given test,
// or null when no such field is found
//
abego.MultiFieldRegExpTester.prototype.test = function(tiddler) {
	var re = this.re;
	// Check the fields explicitly specified
	for (var i = 0; i < this.fields.length; i++) {
		var s = store.getValue(tiddler, this.fields[i]);
		if (typeof s == "string" && re.test(s))
			return this.fields[i];		
	}
	// Check the extended fields (if required)
	if (this.withExtendedFields) 
		return store.forEachField(
				tiddler,
				function(tiddler, fieldName, value) {
					return typeof value == "string" && re.test(value)?fieldName:null;
				}, true);
		
	return null;
}

// Class abego.TiddlerQuery ==================================================================
//
//#import abego.select
//#import abego.MultiFieldRegExpTester
//
abego.TiddlerQuery = function(queryText,caseSensitive,useRegExp,defaultFields,withExtendedFields) {
	if (useRegExp) {
		this.regExp = new RegExp(queryText, caseSensitive ? "mg" : "img");
		this.tester = new abego.MultiFieldRegExpTester(this.regExp, defaultFields, withExtendedFields);
	} else {
		this.expr = new abego.BoolExp(
				queryText,
				abego.parseTiddlerFilterTerm, {
				defaultFields: defaultFields,
				caseSensitive: caseSensitive,
				withExtendedFields: withExtendedFields});
	}
	
	this.getQueryText = function() {
		return queryText;
	};
	this.getUseRegExp = function() {
		return useRegExp;
	};
	this.getCaseSensitive = function() {
		return caseSensitive;
	};
	this.getDefaultFields = function() {
		return defaultFields;
	};
	this.getWithExtendedFields = function() {
		return withExtendedFields;
	};
}

// Returns true iff the query includes the given tiddler
//
// @param tiddler [may be null/undefined]
//
abego.TiddlerQuery.prototype.test = function(tiddler) {
	if (!tiddler) return false;
	if (this.regExp) {
		return this.tester.test(tiddler);
	}
	return this.expr.exec(tiddler);
};

// Returns an array with those tiddlers from the tiddlers array that match the query.
//
abego.TiddlerQuery.prototype.filter = function(tiddlers) {
	return abego.select(tiddlers,this.test,this);
};

abego.TiddlerQuery.prototype.getMarkRegExp = function() {
	if (this.regExp) {
		// Only use the regExp for marking when it does not match the empty string.
		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();
};

// Class abego.PageWiseRenderer ================================================
//
// Subclass or instance must implement getItemsPerPage function;
// They should also implement onPageChanged and refresh the container of the
// PageWiseRenderer on that event.
//
//#import abego.toInt
//
abego.PageWiseRenderer = function() {
	this.firstIndexOnPage = 0; // The index of the first item of the lastResults list displayed on the search result page
};

merge(abego.PageWiseRenderer.prototype, {
	setItems: function(items) {
		this.items = items;
		this.setFirstIndexOnPage(0);
	},
	
	// Maximum number of pages listed in the navigation bar (before or after the current page)
	//
	getMaxPagesInNavigation: function() {
		return 10;
	},
	
	getItemsCount: function(items) {
		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(index) {
		this.firstIndexOnPage = Math.min(Math.max(0, index), this.getItemsCount()-1);
	},
	
	getFirstIndexOnPage: function() {
		// Ensure that the firstIndexOnPage is really a page start. 
		// This may have become violated when getItemsPerPage has changed,
		// (e.g. when switching between previewText and simple mode.)
		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(pageIndex,oldPageIndex) {
	},
	
	renderPage: function(itemRenderer) {
		if (itemRenderer.beginRendering)
			itemRenderer.beginRendering(this);
		try {
			// When there are items found add them to the result page (pagewise)
			if (this.getItemsCount()) {
				// Add the items of the current page
				var lastIndex = this.getLastIndexOnPage();
				var iInPage = -1;
				for (var i=this.getFirstIndexOnPage(); i <= lastIndex; i++) {
					iInPage++;
					
					itemRenderer.render(this,this.items[i],i,iInPage);
				}
			}
		} finally {
			if (itemRenderer.endRendering)
				itemRenderer.endRendering(this);
		}
	},
	
	addPageNavigation: function(place) {
		if (!this.getItemsCount()) return;
	
		var self = this;
		var onNaviButtonClick = function(e) {
			if (!e) var e = window.event;
		
			var pageIndex = abego.toInt(this.getAttribute("page"),0);
			var oldPageIndex = self.getCurrentPageIndex();
			if (pageIndex == oldPageIndex)
				return;
			var index = pageIndex * self.getItemsPerPage();
			self.setFirstIndexOnPage(index);
			self.onPageChanged(pageIndex,oldPageIndex);	
		};
	
		var button;
		var currentPageIndex = this.getCurrentPageIndex();
		var lastPageIndex = this.getLastPageIndex();
		if (currentPageIndex > 0) {
			button = createTiddlyButton(place, "Previous", "Go to previous page (Shortcut: Alt-'<')", onNaviButtonClick, "prev");
			button.setAttribute("page",(currentPageIndex-1).toString());
			button.setAttribute("accessKey","<");
		}
	
		for (var i = -this.getMaxPagesInNavigation(); i < this.getMaxPagesInNavigation(); i++) {
			var pageIndex = currentPageIndex+i;
			if (pageIndex < 0) continue;
			if (pageIndex > lastPageIndex) break;
	
			var pageNo = (i+currentPageIndex+1).toString();
			var buttonClass = pageIndex == currentPageIndex ? "currentPage" : "otherPage";
			button = createTiddlyButton(place, pageNo, "Go to page %0".format([pageNo]), onNaviButtonClick, buttonClass);
			button.setAttribute("page",(pageIndex).toString());
		}
		
		if (currentPageIndex < lastPageIndex) {
			button = createTiddlyButton(place, "Next", "Go to next page (Shortcut: Alt-'>')", onNaviButtonClick, "next");
			button.setAttribute("page",(currentPageIndex+1).toString());
			button.setAttribute("accessKey",">");
		}
	}
});

// Class abego.LimitedTextRenderer ===========================================================
//
// Renders a given text, ensuring that a given limit of number of characters 
// is not exceeded.
//
// A "markRegExp" may be specified. Substring matching this regular expression 
// ("matched strings") are rendered with the class "marked". 
//
// if the given text is longer than the limit the matched strings are preferred 
// to be included in the rendered text (with some leading and trailing "context text"). 
// 
// Example:
//     var renderer = new abego.LimitedTextRenderer();
//
//     var place = ... // a DOM element that should contain the rendered (limited) text
//     var s = "This is another 'Hello World' example, as saying 'Hello' is always nice. So let's say it again: >Hello!<";
//     var maxLen = 50;
//     var markRE = /hello/gi;
//     renderer.render(place,s,maxLen,markRE);
// 
//#import abego.createEllipsis
//
abego.LimitedTextRenderer = function() {
	var minMatchWithContextSize = 40; 
	var maxMovementForWordCorrection = 4; // When a "match" context starts or end on a word the context borders may be changed to at most this amount to include or exclude the word.
	
	
	//----------------------------------------------------------------------------
	//
	// Ranges
	//
	// Objects with a "start" and "end" property (not a specific class). 
	// 
	// In a corresponding "Ranges array" these objects are sorted by their start 
	// and no Range object intersects/touches any other in the array.
	//
	//----------------------------------------------------------------------------
	
	// Adds the Range [startIndex,endIndex[ to the ranges, ensuring that the Ranges
	// in the array are sorted by their start and no Range object 
	// intersects/touches any other in the array (i.e. possibly the new Range is 
	// "merged" with existing ranges)
	//
	// @param ranges array of Range objects
	//
	var addRange = function(ranges, startIndex, endIndex) {
		var n = ranges.length;
		
		// When there are no ranges in ranges, just add it.
		if (n == 0) {
			ranges.push({start: startIndex, end: endIndex});
			return;
		}
		
		var i = 0;
		for (; i < n; i++) {
			var range = ranges[i];
			
			// find the first range that intersects or "touches" [startIndex, endIndex[
			if (range.start <= endIndex && startIndex <= range.end) {
				// Found.
				
				var r;
				// find the first range behind the new range that does not interfere
				var rIndex = i+1;
				for (; rIndex < n; rIndex++) {
					r = ranges[rIndex];
					if (r.start > endIndex || startIndex > range.end) {
						break;
					}
				}
				
				// Replace the ranges i to rIndex-1 with the union of the new range with these ranges.
				var unionStart = startIndex;
				var unionEnd = endIndex;
				for (var j = i; j < rIndex; j++) {
					r = ranges[j];
					unionStart = Math.min(unionStart, r.start);
					unionEnd = Math.max(unionEnd, r.end);
				}
				ranges.splice(i, rIndex-i, {start: unionStart, end: unionEnd});
				return;			
			}
			
			// if we found a range R that is right of the new range there is no
			// intersection and we can insert the new range before R.
			if (range.start > endIndex) {
				break;
			}
		}
	
		// When we are here the new range does not interfere with any range in ranges and
		// i is the index of the first range right to it (or ranges.length, when the new range
		// becomes the right most range). 
	
		ranges.splice(i, 0, {start: startIndex, end: endIndex});
	};
	
	// Returns the total size of all Ranges in ranges
	//
	var getTotalRangesSize = function(ranges) {
		var totalRangeSize = 0;
		for (var i=0; i < ranges.length; i++) {
			var range = ranges[i];
			totalRangeSize += range.end-range.start;
		}
		return totalRangeSize;
	};
	
	//----------------------------------------------------------------------------
	
	
	var isWordChar = function(c) {
		return (c >= "a" && c <= "z") || (c >= "A" && c <= "Z") || c == "_";
	};
	
	// Returns the bounds of the word in s around offset as a {start: , end:} object.
	//
	// Returns null when the char at offset is not a word char.
	//
	var getWordBounds = function(s, offset) {
		// Handle the "offset is not in word" case
		if (!isWordChar(s[offset])) return null;
	
		for (var i = offset-1; i >= 0 && isWordChar(s[i]); i--) 
			{/*empty*/}
			
		var startIndex = i+1;
		var n = s.length;
		for (i = offset+1; i < n && isWordChar(s[i]); i++) 
			{/*empty*/}
		
		return {start: startIndex, end: i};
	};
	
	var moveToWordBorder = function(s, offset, isStartOffset) {
		var wordBounds;
		if (isStartOffset) {
			wordBounds = getWordBounds(s, offset);
		} else {
			if (offset <= 0) return offset;
			wordBounds = getWordBounds(s, offset-1);
		}
		if (!wordBounds) return offset;
		
		if (isStartOffset) {
			if (wordBounds.start >= offset-maxMovementForWordCorrection) return wordBounds.start;
			if (wordBounds.end <= offset+maxMovementForWordCorrection) return wordBounds.end;
		} else {
			if (wordBounds.end <= offset+maxMovementForWordCorrection) return wordBounds.end;
			if (wordBounds.start >= offset-maxMovementForWordCorrection) return wordBounds.start;
		}
		return offset;
	};
	
	
	
	// Splits s into a sequence of "matched" and "unmatched" substrings, using the 
	// matchRegExp to do the matching.
	// 
	// Returns an array of objects with a "text" property containing the substring text. 
	// Substrings that are "matches" also contain a boolean "isMatch" property set to true.
	// 
	// @param matchRegExp [may be null] when null no matching is performed and the returned 
	// 			array just contains one item with s as its text
	// 
	var getTextAndMatchArray = function(s, matchRegExp) {
		var result = [];
		if (matchRegExp) {
			var startIndex = 0;
			var n = s.length;
			var currentLen = 0;
			do {
				matchRegExp.lastIndex = startIndex;
				var match = matchRegExp.exec(s);
				if (match) {
					if (startIndex < match.index) {
						var t = s.substring(startIndex, match.index);
						result.push({text:t});
					}
					result.push({text:match[0], isMatch:true});
					startIndex = match.index + match[0].length;
				} else {
					result.push({text: s.substr(startIndex)});
					break;
				}
			} while (true);
		} else {
			result.push({text: s});
		}
		return result;
	};
	
	
	
	var getMatchedTextCount = function(textAndMatches) {
		var result = 0;
		for (var i=0; i < textAndMatches.length; i++) {
			if (textAndMatches[i].isMatch) {
				result++;
			}
		}
		return result;	
	};
	
	
	
	var getContextRangeAround = function(s, startIndex, endIndex, matchCount, maxLen) {
		// Partition the available space into equal sized areas for each match and one 
		// for the text start.
		// But the size should not go below a certain limit
		var size = Math.max(Math.floor(maxLen/(matchCount+1)), minMatchWithContextSize);
		
		// Substract the size of the range to get the size of the context.
		var contextSize = Math.max(size-(endIndex-startIndex), 0);
		// Two thirds of the context should be before the match, one third after.
		var contextEnd = Math.min(Math.floor(endIndex+contextSize/3), s.length);
		var contextStart = Math.max(contextEnd - size, 0);
	
		// If the contextStart/End is inside a word and the end of the word is
		// close move the pointers accordingly to make the text more readable.
		contextStart = moveToWordBorder(s, contextStart, true);
		contextEnd = moveToWordBorder(s, contextEnd, false);
		
		return {start: contextStart, end: contextEnd};
	};
	
	// Get all ranges around matched substrings with their contexts
	//
	var getMatchedTextWithContextRanges = function(textAndMatches, s, maxLen) {
		var ranges = [];
		var matchCount = getMatchedTextCount(textAndMatches);
		var pos = 0;
		for (var i=0; i < textAndMatches.length; i++) {
			var t = textAndMatches[i];
			var text = t.text;
			if (t.isMatch) {
				var range = getContextRangeAround(s, pos, pos+text.length, matchCount, maxLen);
				addRange(ranges, range.start, range.end);
			}
			pos += text.length;
		}
		return ranges;
	};
	
	var fillUpRanges = function(s, ranges, maxLen) {
		var remainingLen = maxLen - getTotalRangesSize(ranges);
		while (remainingLen > 0) {
			if (ranges.length == 0) {
				// No matches added yet. Make one large range.
				addRange(ranges, 0, moveToWordBorder(s, maxLen, false));
				return;
			} else {
				var range = ranges[0];
				var startIndex;
				var maxEndIndex;
				if (range.start == 0) {
					// The first range already starts at the beginning of the string.
	
					// When there is a second range fill to the next range start or to the maxLen.
					startIndex = range.end;
					if (ranges.length > 1) {
						maxEndIndex =  ranges[1].start;
					} else {
						// Only one range. Add a range after that with the complete remaining len 
						// (corrected to "beautify" the output)
						addRange(ranges, startIndex, moveToWordBorder(s, startIndex+remainingLen, false));
						return;
					}
				} else {
					// There is unused space between the start of the text and the first range.
					startIndex = 0;
					maxEndIndex = range.start;
				}
				var endIndex = Math.min(maxEndIndex, startIndex+remainingLen);
				addRange(ranges, startIndex, endIndex);
				remainingLen -= (endIndex-startIndex);
			}
		}
	};
	
	
	// Write the given ranges of s, using textAndMatches for marking portions of the text.
	//
	var writeRanges = function(place, s, textAndMatches, ranges, maxLen) {
		if (ranges.length == 0) return;
		
		// Processes the text between startIndex and endIndex of the textAndMatches
		// "writes" them (as DOM elements) at the given place, possibly as "marked" text.
		//
		// When endIndex is not the end of the full text an ellisis is appended. 
		//
		var writeTextAndMatchRange = function(place, s, textAndMatches, startIndex, endIndex) {
			var t;
			var text;
			
			// find the first text item to write
			var pos = 0;
			var i = 0;
			var offset = 0;
			for (;i < textAndMatches.length; i++) {
				t = textAndMatches[i];
				text = t.text;
				if (startIndex < pos+text.length) {
					offset = startIndex - pos;
					break;
				}
				pos += text.length;
			}
			
			var remainingLen = endIndex - startIndex;
			for (; i < textAndMatches.length && remainingLen > 0; i++) {
				t = textAndMatches[i];
				text = t.text.substr(offset);
				offset = 0;
				if (text.length > remainingLen) text = text.substr(0,remainingLen);
				
				if (t.isMatch) {
					createTiddlyElement(place,"span",null,"marked",text);
				} else {
					createTiddlyText(place, text);
				}
				remainingLen -= text.length;
			}
			
			if (endIndex < s.length) {
				abego.createEllipsis(place);
			}
		};
		
		// When the first range is not at the start of the text write an ellipsis("...")
		// (Ellipses between ranges are written in the writeTextAndMatchRange method)
		if (ranges[0].start > 0) abego.createEllipsis(place);
	
		var remainingLen = maxLen;
		for (var i = 0; i < ranges.length && remainingLen > 0; i++) {
			var range = ranges[i];
			var len = Math.min(range.end - range.start, remainingLen);
			writeTextAndMatchRange(place, s, textAndMatches, range.start, range.start+len);
			remainingLen -= len;
		}
	};
	
	this.render = function(place,s,maxLen,markRegExp) {
		if (s.length < maxLen) maxLen = s.length;
		
		var textAndMatches = getTextAndMatchArray(s, markRegExp);
		
		var ranges = getMatchedTextWithContextRanges(textAndMatches, s, maxLen);
		
		// When the maxLen is not yet reached add more ranges 
		// starting from the beginning until either maxLen or 
		// the end of the string is reached.
		fillUpRanges(s, ranges, maxLen);
	
		writeRanges(place, s, textAndMatches, ranges, maxLen);
	};
};



(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: <a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>" title="Linkification: <a class="linkification-ext" href="http://<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">tiddlywiki.abego-software.de/archive</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>"><a class="linkification-ext" href="http://tiddlywiki.abeg<a class="linkification-ext" href="http://o-software.de/archive" title="Linkification: http://o-software.de/archive">o-software.de/archive</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/archive" title="Linkification: http://tiddlywiki.abego-software.de/archive">http://tiddlywiki.abego-software.de/archive</a></a>");

abego.YourSearch = {};

//----------------------------------------------------------------------------
// The Search Core
//----------------------------------------------------------------------------

// Model Variables
var lastResults; // Array of tiddlers that matched the last search
var lastQuery; // The last Search query (TiddlerQuery)

var setLastResults = function(array) {
	lastResults = array;
};

var getLastResults = function() {
	return lastResults ? lastResults : [];
};

var getLastResultsCount = function() {
	return lastResults ? lastResults.length : 0;
};

// Standard Ranking Weights
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) {	
	// Count the matches in the title and the tags
	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);

	// Calculate the "precision" of the matches in the title as the ratio of
	// the length of the matches to the total length of the title.
	var lengthOfMatchesInTitle = matchesInTitle ? matchesInTitle.join("").length : 0;
	var precisionInTitle = tiddler.title.length > 0 ? lengthOfMatchesInTitle/tiddler.title.length : 0;
	
	// calculate a weighted score
	var rank= nMatchesInTitle * matchInTitleWeight 
			+ nMatchesInTags * matchInTagsWeight 
			+ precisionInTitle * precisionInTitleWeight 
			+ 1;

	return rank;
};

// @return Tiddler[]
//
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) {
		// when an invalid query is given no tiddlers are matched
		return [];
	}

	var results = lastQuery.filter(candidates);

	// Rank the results
	var rankFunction = abego.YourSearch.getRankFunction();
	for (var i = 0; i < results.length; i++) {
		var tiddler = results[i];
		var rank = rankFunction(tiddler, lastQuery);
		// Add the rank information to the tiddler.
		// This is used during the sorting, but it may also
		// be used in the result, e.g. to display some "relevance" 
		// information in the result	
		tiddler.searchRank = rank;	
	}
	
	// sort the result, taking care of the rank and the sortField	
	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;
};

//----------------------------------------------------------------------------
// The Search UI (Result page)
//----------------------------------------------------------------------------


// Visual appearance of the result page
var maxCharsInTitle = 80;
var maxCharsInTags = 50;
var maxCharsInText = 250;
var maxCharsInField = 50;

var itemsPerPageDefault = 25; // Default maximum number of items on one search result page
var itemsPerPageWithPreviewDefault = 10; // Default maximum number of items on one search result page when PreviewText is on

// DOM IDs
var yourSearchResultID = "yourSearchResult";
var yourSearchResultItemsID = "yourSearchResultItems";

var lastSearchText; // The last search text, as passed to findMatches

var resultElement; // The (popup) DOM element containing the search result [may be null]
var searchInputField; // The "search" input field
var searchButton; // The "search" button
var lastNewTiddlerButton;

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);
	}
};

// Closes the Search Result window and displays the tiddler 
// defined by the "tiddlyLink" attribute of this element
//
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);
};

// Adjusts the resultElement's size and position, relative to the search input field.
//
var adjustResultPositionAndSize = function() {
	if (!searchInputField) return;
	
	var root = searchInputField;
	
	// Position the result below the root and resize it if necessary.
	var rootLeft = findPosX(root);
	var rootTop = findPosY(root);
	var rootHeight = root.offsetHeight;
	var popupLeft = rootLeft;
	var popupTop = rootTop + rootHeight;

	// Make sure the result is not wider than the window
	var winWidth = findWindowWidth();
	if (winWidth < resultElement.offsetWidth) {
		resultElement.style.width = (winWidth - 100)+"px";
		winWidth = findWindowWidth();
	}

	// Ensure that the left and right of the result are not
	// clipped by the window. Move it to the left or right, if necessary.	
	var popupWidth = resultElement.offsetWidth;
	if(popupLeft + popupWidth > winWidth)
		popupLeft = winWidth - popupWidth-30;
	if (popupLeft < 0) popupLeft = 0;
	
	// Do the actual moving
	resultElement.style.left = popupLeft + "px";
	resultElement.style.top = popupTop + "px";
	resultElement.style.display = "block";
};

var scrollVisible = function() {
	// Scroll the window to make the result page (and the search Input field) visible.
	if (resultElement) window.scrollTo(0,ensureVisible(resultElement));
	if (searchInputField) window.scrollTo(0,ensureVisible(searchInputField));
};

// Makes sure the result page has a good size and position and visible
// (may scroll the window)
//
var	ensureResultIsDisplayedNicely = function() {
	adjustResultPositionAndSize();
	scrollVisible();
};



var indexInPage; // The index (in the current page) of the tiddler currently rendered.
var currentTiddler; // While rendering the page the tiddler that is currently rendered.

var pager = new abego.PageWiseRenderer();

var MyItemRenderer = function(parent) {
	// Load the template how to display the items that represent a found tiddler
	this.itemHtml = store.getTiddlerText("YourSearchItemTemplate");
	if (!this.itemHtml) alertAndThrow("YourSearchItemTemplate not found");
	
	// Locate the node that shall contain the list of found tiddlers
	this.place = document.getElementById(yourSearchResultItemsID);
	if(!this.place)
		this.place = createTiddlyElement(parent,"div",yourSearchResultItemsID);
};

merge(MyItemRenderer.prototype,{
	render: function(pager,object,index,indexOnPage) {
		// Define global variables, referenced by macros during applyHtmlMacros
		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) {
		// The currentTiddler must only be defined while rendering the found tiddlers
		currentTiddler = null;
	}
});

// Refreshes the content of the result with the current search result
// of the selected page.
//
// Assumes that the result is already open. 
//
var refreshResult = function() {
	if (!resultElement || !searchInputField) return;

	// Load the template for the YourSearchResult
	var html = store.getTiddlerText("YourSearchResultTemplate");
	if (!html) html = "<b>Tiddler YourSearchResultTemplate not found</b>";
	resultElement.innerHTML = html;

	// Expand the template macros etc.
	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 showResult = function() {
	if (!resultElement) {
		resultElement = createTiddlyElement(document.body,"div",yourSearchResultID,"yourSearchResult");
	} else if (resultElement.parentNode != document.body) {
		document.body.appendChild(resultElement);
	}

	refreshResult();
};


var	reopenResultIfApplicable = function() {
	if (searchInputField == null || !config.options.chkUseYourSearch) return;
	
	if ((searchInputField.value == lastSearchText) && lastSearchText && !isResultOpen()) {
		// For speedup we check re-use the previously created resultElement, if possible.
		if (resultElement && (resultElement.parentNode != document.body)) {
			document.body.appendChild(resultElement);
			ensureResultIsDisplayedNicely();
		} else {
			showResult();
		}
	}
};


var invalidateResult = function() {
	closeResult();
	resultElement = null;
	lastSearchText = null;
};



//-------------------------------------------------------------------------
// Close the search result page when the user clicks on the document
// (and not into the searchInputField, on the search button or in the result)
// or presses the ESC key

// Returns true if e is either self or a descendant (child, grandchild,...) of self.
//
// @param self DOM:Element
// @param e DOM:Element or 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) {
	// Close the search result page when the user presses "ESC"
	if (e.keyCode == 27) closeResult();
};
addEvent(document,"click",onDocumentClick);
addEvent(document,"keyup",onDocumentKeyup);


// Our Search Macro Hijack Function ==========================================

// Helper
var myStorySearch = function(text,useCaseSensitive,useRegExp)
{
	lastSearchText = text;
	setLastResults(findMatches(store, text,useCaseSensitive,useRegExp,"title","excludeSearch"));

	highlightHack = lastQuery ? lastQuery.getMarkRegExp() : null;
	pager.setItems(getLastResults());
	showResult();
	highlightHack = null;
};


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) var 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:
				// When the result is open, close it, 
				// otherwise clear the content of the input field
				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 btn;
	if (!buttonAtRight)
		btn = createTiddlyButton(place,this.label,this.prompt,clickHandler);
		
	var txt = createTiddlyElement(place,"input",null,null,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
		txt.setAttribute("type","text");

	if (buttonAtRight)
		btn = createTiddlyButton(place,this.label,this.prompt,clickHandler);

	searchInputField = txt;
	searchButton = btn;
};

//----------------------------------------------------------------------------
// Support for Macros
//----------------------------------------------------------------------------

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);
	// The option macro appended the component at the end of the place.
	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();
};



// Returns the "shortcut number" of the currentTiddler. 
// I.e. When the user presses Alt-n the given tiddler is opened/display.
//
// @return 0-9 or -1 when no number is defined
//
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())
}

// When any tiddler are changed reset the result.
// 
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();
};

//----------------------------------------------------------------------------
// Macros
//----------------------------------------------------------------------------

// ====Macro yourSearch ================================================

config.macros.yourSearch = {
	// Standard Properties
	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());
			}
		},
		
		version: function(place) {
			var t = "YourSearch %0.%1.%2".format(
					[version.extensions.YourSearchPlugin.major, 
					 version.extensions.YourSearchPlugin.minor, 
					 version.extensions.YourSearchPlugin.revision]);
			var e = createTiddlyElement(place, "a");
			e.setAttribute("href", "<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywik<a class="linkification-ext" href="http://i.abego-software.de/#YourSearchPlugin" title="Linkification: http://i.abego-software.de/#YourSearchPlugin">i.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlu" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlu">http://tiddlywiki.abego-software.de/#YourSearchPlu</a>gin</a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://tiddlywiki.<a class="linkification-ext" href="http://abego-software.de/#YourSearchPlugin" title="Linkification: http://abego-software.de/#YourSearchPlugin">abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywi<a class="linkification-ext" href="http://ki.abego-software.de/#YourSearchPlugin" title="Linkification: http://ki.abego-software.de/#YourSearchPlugin">ki.abego-software.de/#YourSearchPlugin</a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a></a>" title="Linkification: <a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a>"><a class="linkification-ext" href="http://tiddlywiki.abego-software.de/#YourSearchPlugin" title="Linkification: http://tiddlywiki.abego-software.de/#YourSearchPlugin">http://tiddlywiki.abego-software.de/#YourSearchPlugin</a></a>");
			e.innerHTML = '<font color="black" face="Arial, Helvetica, sans-serif">'+t+'<font>';
		},
		
		copyright: function(place) {
			var e = createTiddlyElement(place, "a");
			e.setAttribute("href", "<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a></a>" title="Linkification: <a class="linkification-ext" href="<a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>");
			e.innerHTML = '<font color="black" face="Arial, Helvetica, sans-serif">&copy; 2005-2006 <b><font color="red">abego</font></b> Software<font>';
		},
		
		newTiddlerButton: function(place) {
			if (lastQuery) {
				var r = abego.parseNewTiddlerCommandLine(lastQuery.getQueryText());
				var btn = config.macros.newTiddler.createNewTiddlerButton(place,r.title,r.params,"new tiddler","Create a new tiddler based on search text. (Shortcut: Ctrl-Enter; Separators: '.', '#')",null,"text");				
				// Close the result before the new tiddler is created.
				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) {
			var button = createTiddlyButton(place, "close", "Close the Search Results (Shortcut: ESC)", closeResult);
		},
		
		openAllButton: function(place,macroName,params,wikifier,paramString,tiddler) {
			var n = getLastResultsCount();
			if (n == 0) return;
		
			var title = n == 1 ? "open tiddler" : "open all %0 tiddlers".format([n]);
			var button = createTiddlyButton(place, title, "Open all found tiddlers (Shortcut: 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 {
					// When no predefined test is specified try to evaluate it as a JavaScript expression.
					showIt = (!eval(testName)) == negate;
				}
			} catch (ex) {
			}
			
			if (!showIt) {
				place.style.display="none";
			}
		},
		
		chkPreviewText: function(place,macroName,params,wikifier,paramString,tiddler) {
			var optionParams = params.slice(1).join(" ");
			
			var elem = createOptionWithRefresh(place, "chkPreviewText", wikifier,tiddler);
			elem.setAttribute("accessKey", "P");
			elem.title = "Show text preview of found tiddlers (Shortcut: Alt-P)";	
			return elem;
		}
	}
};


// ====Macro foundTiddler ================================================

config.macros.foundTiddler = {
	// Standard Properties
	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);
		},
		
		// Renders the "shortcut number" of the current tiddler, to indicate to the user
		// what number to "Alt-press" to open the tiddler.
		//
		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);
			}
		}
	}
};


//----------------------------------------------------------------------------
// Configuration Stuff
//----------------------------------------------------------------------------

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];




//----------------------------------------------------------------------------
// Shadow Tiddlers
//----------------------------------------------------------------------------

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 field"+
"s {{{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 containin"+
"g \"Plugin\" either in the title or in the tags (but does not look for \"Plugin\" in the text). \n\n!Boole"+
"an 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 neces"+
"sarily 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 \"j"+
"eremy\".\n\n!'Exact Word' Search\nBy default a search result all matches that 'contain' the searched tex"+
"t. E.g. if you search for {{{Task}}} you will get all tiddlers containing 'Task', but also '~Complet"+
"edTask', '~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 'Tas"+
"k', 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 YourSearc"+
"h. However when ''~RegExpSearch'' is on Filtered and Boolean Search are disabled.\n\nIn addition you m"+
"ay do a \"regular expression\" search even with the ''~RegExpSearch'' set to false by directly enterin"+
"g 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 E"+
"xpression Filtering\nIf you are familiar with JavaScript programming and know some TiddlyWiki interna"+
"ls 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 e"+
"valuate to {{{true}}} when the given tiddler should be included in the result. \n\nExample: {{{ { tidd"+
"ler.modified > new Date(\"Jul 4, 2005\")} }}} returns all tiddler modified after July 4th, 2005.\n\n!Com"+
"bined Search\nYou are free to combine the various search options. \n\n''Examples''\n|!What you type|!Res"+
"ult|\n|{{{!jonny !jeremy -%football}}}|all tiddlers with both {{{jonny}}} and {{{jeremy}}} in its tit"+
"les, but no {{{football}}} in content.|\n|{{{#=Task}}}|All tiddlers tagged with 'Task' (the exact wor"+
"d). Tags named '~CompletedTask', '~TaskForce' etc. are not considered.|\n\n!Access Keys\nYou are encour"+
"aged to use the access keys (also called \"shortcut\" keys) for the most frequently used operations. F"+
"or 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 in"+
"put field so you can directly start typing your query. Pressing {{{Alt-F}}} will also display the pr"+
"evious search result. This way you can quickly display multiple tiddlers using \"Press {{{Alt-F}}}. S"+
"elect tiddler.\" sequences.|\n|{{{ESC}}}|Closes the [[YourSearch Result]]. When the [[YourSearch Resul"+
"t]] 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 e"+
"tc. 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 [[Your"+
"Search 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 t"+
"hese shortcuts don't work for you check your browser if you have other extensions installed that alr"+
"eady \"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 chk"+
"SearchInText>>Text ('%')     <<option chkSearchInTags>>Tags ('#')    <<option chkSearchExtendedFiel"+
"ds>>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 pre"+
"view text: <<option txtItemsPerPageWithPreview>>|\n";
			
config.shadowTiddlers["YourSearchStyleSheet"] = 
"/***\n!~YourSearchResult Stylesheet\n***/\n/*{{{*/\n.yourSearchResult {\n\tposition: absolute;\n\twidth: 800"+
"px;\n\n\tpadding: 0.2em;\n\tlist-style: none;\n\tmargin: 0;\n\n\tbackground: #ffd;\n\tborder: 1px solid DarkGra"+
"y;\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.yourSea"+
"rchRange, .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 .summa"+
"ry .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-to"+
"p: 2px;\n}\n\n.yourSearchNumber {\n\tcolor: #808080;\n}\n\n\n.yourSearchTags {\n\tcolor: #008000;\n}\n\n.yourSearc"+
"hText {\n\tcolor: #808080;\n\tmargin-bottom: 6px;\n}\n\n/*}}}*/\n/***\n!!Footer\n***/\n/*{{{*/\n.yourSearchFoote"+
"r {\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: bla"+
"ck;\n\ttext-decoration: underline;\n}\n\n.yourSearchNaviBar a:hover {\n\tbackground-color: none;\n}\n\n.yourSe"+
"archNaviBar .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\tYourSearch Result <span class=\"yourSearchRange\" macro=\"yourSearc"+
"h itemRange\"></span>\n\t\t&nbsp;of&nbsp;<span class=\"yourSearchCount\" macro=\"yourSearch count\"></span>\n"+
"\t\tfor&nbsp;<span class=\"yourSearchQuery\" macro=\"yourSearch query\"></span>\n\t</td>\n\t<td class=\"yourSea"+
"rchButtons\" align=\"right\">\n\t\t<span macro=\"yourSearch chkPreviewText\"></span><span class=\"chkBoxLabel"+
"\">preview text</span>\n\t\t<span macro=\"yourSearch newTiddlerButton\"></span>\n\t\t<span macro=\"yourSearch openAllButton\"></span>\n\t\t<span macro=\"yourSearch lin"+
"kButton 'YourSearch Options' options 'Configure YourSearch'\"></span>\n\t\t<span macro=\"yourSearch linkB"+
"utton 'YourSearch Help' help 'Get help how to use YourSearch'\"></span>\n\t\t<span macro=\"yourSearch clo"+
"seButton\"></span>\n\t</td>\n  </tr>\n</tbody></table>\n\n<!-- The List of Found Tiddlers ================="+
"=========================== -->\n<div id=\"yourSearchResultItems\" itemsPerPage=\"25\" itemsPerPageWithPr"+
"eview=\"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\tResult page: <span class=\"yourSearchNaviBar\" macro=\"yourSearch naviBar"+
"\"></span>\n\t</td>\n\t<td align=\"right\"><span macro=\"yourSearch version\"></span>, <span macro=\"yourSearc"+
"h 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\tYourSearch Resu"+
"lt: No tiddlers found for <span class=\"yourSearchQuery\" macro=\"yourSearch query\"></span>.\n\t</td>\n\t<t"+
"d class=\"yourSearchButtons\" align=\"right\">\n\t\t<span macro=\"yourSearch newTiddlerButton\"></span>\n\t\t<span macro=\"yourSearch linkButton 'YourSearch Options'"+
" options 'Configure YourSearch'\"></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='yourSea"+
"rchTitle' macro='foundTiddler title'/></span>&nbsp;-&nbsp;\n<span class='yourSearchTags' macro='found"+
"Tiddler field tags 50'/></span>\n<span macro=\"yourSearch if previewText\"><div class='yourSearchText' macro='fo"+
"undTiddler 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.";

//----------------------------------------------------------------------------
// Install YourSearch
//----------------------------------------------------------------------------

// Overwrite the TiddlyWiki search handler and verify after a while 
// that nobody else has overwritten it.
config.macros.search.handler = myMacroSearchHandler;

var checkForOtherHijacker = function() {
	// Check that still our search handler is installed
    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 tidd"+
"lers)\nto enable the 'Your Search' features.");
    }
};

setTimeout(checkForOtherHijacker, 5000);

// === Public API =================================

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();
}

})();
} // of "install only once"
// Used Globals (for JSLint) ==============

// ... JavaScript Core
/*global 	alert,clearTimeout,confirm */
// ... TiddlyWiki Core
/*global 	Tiddler, applyHtmlMacros, clearMessage, createTiddlyElement, createTiddlyButton, createTiddlyText, ensureVisible ,findPosX, highlightHack, findPosY,findWindowWidth, invokeMacro, saveChanges, refreshElements, story */
//}}}
/***
!Licence and Copyright
Copyright (c) abego Software ~GmbH, 2005-2006 ([[<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="<a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a></a>" title="Linkification: <a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>"><a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">www.abego-software.de</a></a>|<a class="linkification-ext" href="http://www.abego-software.de" title="Linkification: http://www.abego-software.de">http://www.abego-software.de</a>]])

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of abego Software nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
***/


/***
Macro: allTagsExcept
Author: Clint Checketts
Version: 1.0 Sept 8, 2005

usage: {{{<< allTagsExcept systemConfig systemTiddlers >>}}} This will show all tags but those listed (e.g. systemConfig and systemTiddlers

<<allTagsExcept systemConfig systemTiddlers >>
***/
//{{{
version.extensions.allTagsExcept = {major: 0, minor: 1, revision: 0, date: new Date(2005,8,15)};
config.macros.allTagsExcept = {tooltip: "Show tiddlers tagged with '%0'",noTags: "There are no tags to display"};

config.macros.allTagsExcept.handler = function(place,macroName,params)
{
	var tags = store.getTags();
	var theTagList = createTiddlyElement(place,"ul",null,null,null);
	if(tags.length == 0)
		createTiddlyElement(theTagList,"li",null,"listTitle",this.noTags);
	for (var t=0; t<tags.length; t++) {
            var includeTag = true;
            for (var p=0;p<params.length; p++) if (tags[t][0] == params[p]) includeTag = false;
            if (includeTag){
		var theListItem =createTiddlyElement(theTagList,"li",null,null,null);
		var theTag = createTiddlyButton(theListItem,tags[t][0] + " (" + tags[t][1] + ")",this.tooltip.format([tags[t][0]]),onClickTag);
		theTag.setAttribute("tag",tags[t][0]);
           }
	}
}
//}}}