Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
/***
|''Name''|NewTaggedCommand|
|''Description''|Creates a new tiddler, and tags it with it's parents title!|
|''Authors''|PMario|
|''Version''|0.1.1|
|''Date''|2011-07-20|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#NewTaggedCommand|
|''License''|BSD|
|''CoreVersion''|2.5|
|''Keywords''|toolbar command add new tagged tiddler|
!!!Description
<<<
To use this new toolbar command you have to add {{{newTagged}}} to ToolbarCommands tiddler
eg:
{{{
|~ViewToolbar| +editTiddler newTagged ...
}}}
<<<
!!!Change the button text
<<<
If you want to change the buttons text from "newTagged" to eg "+", you need to create at tiddler [[zzConfig]] and tag it "systemConfig" and insert the following line.
//{{{
config.commands.newTagged.text = "+";
//}}}
<<<
!!!Code
***/
//{{{
config.commands.newTagged = {
text: "newTagged",
tooltip: "Create a new tiddler, and tag it!",
isEnabled: function(tiddler) {
return !readOnly;
}
};
config.commands.newTagged.handler = function(event,src,title)
{
var newTitle = config.macros.newTiddler.title;
story.displayTiddler(null, newTitle);
config.commands.editTiddler.handler.call(this,event,src,newTitle);
story.setTiddlerTag(newTitle, title, +1);
return false;
};
//}}}
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/1d2f7a0ea82b966e?hl=en
<<tiddler {{tiddler.title+"##code"}} with: {{tiddler.title}}>>
{{{
<<tiddler "Your script tiddler" with: {{tiddler.title}}>>
eg:
<<tiddler {{tiddler.title+"##code"}} with: {{tiddler.title}}>>
!code
<script label="New user dashboard" title="Create a new User Dashboard">
var alwaysTag="user_dashboard";
var alwaysTitle="'s Dashboard";
var title=("$1"+alwaysTitle);
var tags=[alwaysTag, "anyTag"];
store.saveTiddler(
title,
title,
"someText",
config.options.txtUserName,
new Date(),
tags);
story.displayTiddler(null,title);
</script>
!end
}}}
/***
|''Name''|TagWithStoryCommand|
|''Description''|Tag the tiddler, with the names of _all_ open tiddlers!|
|''Authors''|PMario|
|''Version''|0.1.1|
|''Date''|2011-07-28|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#TagWithStoryCommand|
|''License''|BSD|
|''CoreVersion''|2.5|
|''Keywords''|toolbar command add story tag open tiddler|
!!!Description
<<<
To use this new toolbar command you have to add {{{tagWithStory}}} to ToolbarCommands tiddler
eg:
{{{
|~ViewToolbar| +editTiddler tagWithStory ...
}}}
<<<
!!! Change the button text
<<<
If you want to change the buttons text from "tagWithStory" to eg "t++", you need to create at tiddler [[zzConfig]], tag it "systemConfig" and insert the following line.
//{{{
config.commands.tagWithStory.text = "t++";
//}}}
<<<
!!! Disable the confirmation dialog
<<<
@@Be warned! You can mess up your TW if you are not carefull with this option. But ''it speeds things up a lot :))''@@
<<option chkDisableTagWithStoryConfirm>> disable "tabWithStory" confirmation dialog
<<option chkAutoSave>> auto save changes
<<<
!!! Auto enable confirmation dialog at reload
<<<
Disabling the confirmation dialog is stored with a cookie. If you want to activate the confirmation dialog at browser reaload, go to [[zzConfig]] and insert the following line.
{{{
config.options.chkDisableTagWithStoryConfirm = false;
}}}
<<<
!!!Code
***/
//{{{
config.commands.tagWithStory = {
text: "tagWithStory",
tooltip: "Tag this tiddler with story tiddlers!",
txtConfirm: "Tag this tiddler with %0 tag(s):",
isEnabled: function(tiddler) {
return !readOnly;
},
};
config.commands.tagWithStory.handler = function(event,src,title)
{
var tags = [], i, co = config.options;
story.forEachTiddler(function(tt, tiddler){
if (tt != title) tags.push(tt);
});
if ( co.chkDisableTagWithStoryConfirm || confirm( this.txtConfirm.format([tags.length]) + "\n\n" + tags.join(', ')) ) {
store.suspendNotifications;
for ( i = 0; i < tags.length; i++) {
store.setTiddlerTag(title, 1, tags[i]);
}
store.resumeNotifications;
store.notifyAll;
}
if (co.chkAutoSave) autoSaveChanges(true);
return false;
};
//}}}
/***
|''Name''|TagOthersCommands|
|''Description''|''Tag'' and ''Untag'' every open tiddler with the name of the tiddler that activates the command.|
|''Authors''|PMario|
|''Version''|0.1.0|
|''Date''|2011-07-28|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#TagOthersCommands|
|''License''|BSD|
|''CoreVersion''|2.5|
|''Keywords''|toolbar command story tag other open tiddler|
!!!Description
<<<
To use these new toolbar commands you have to add {{{tagOthers}}} and/or {{{untagOthers}}} to ToolbarCommands tiddler
eg:
{{{
|~ViewToolbar| +editTiddler ... > untagOthers tagOthers ... close ...
}}}
<<<
!!! Change the button text
<<<
If you want to change the buttons text from "tagOthers" to eg "something", you need to create at tiddler [[zzConfig]], tag it "systemConfig" and insert the following line.
//{{{
config.commands.tagOthers.text = "something";
config.commands.untagOthers.text = "somethingElse";
//}}}
<<<
!!! Disable the confirmation dialog
<<<
@@Be warned! You can mess up your TW if you are not carefull with this option. But ''it speeds things up a lot :))''@@
<<option chkDisableTagOthersConfirm>> disable "tagOthers" confirmation dialog
<<option chkDisableUnTagOthersConfirm>> disable "''untagOthers''" confirmation dialog
<<option chkAutoSave>> auto save changes
<<<
!!! Auto enable confirmation dialog at reload
<<<
Disabling the confirmation dialog is stored with a cookie. If you want to activate the confirmation dialog at browser reaload, go to [[zzConfig]] and insert the following line.
{{{
config.options.chkDisableTagOthersConfirm = false;
config.options.chkDisableUnTagOthersConfirm = false;
}}}
<<<
!!!Code
***/
//{{{
config.commands.tagOthers = {
text: "tagOthers",
tooltip: "Tag all open tiddlers with this tiddlers name!",
txtConfirm: "The following tiddlers will be tagged: [[%0]]",
isEnabled: function(tiddler) {
return (!readOnly && !( tiddler.title == 'systemConfig' ));
},
};
config.commands.tagOthers.handler = function(event,src,title)
{
var list = [], i, co = config.options;
// collect info about effected tiddlers.
story.forEachTiddler(function(tt, tiddler){
if (tt != title) list.push(tt);
});
if ( co.chkDisableTagOthersConfirm || confirm( this.txtConfirm.format([title]) + "\n\n" + list.join(', ')) ) {
store.suspendNotifications;
for ( i = 0; i < list.length; i++) {
store.setTiddlerTag(list[i], 1, title);
}
store.resumeNotifications;
store.notifyAll;
}
if (co.chkAutoSave) autoSaveChanges(true);
return false;
};
config.commands.untagOthers = {
text: "untagOthers",
tooltip: "Remove this tiddler name tag, from other tiddlers!",
txtConfirm: "Remove tag: [[%0]], from all open tiddlers:",
isEnabled: function(tiddler) {
return (!readOnly && !( tiddler.title == 'systemConfig' ));
},
};
config.commands.untagOthers.handler = function(event,src,title)
{
var list = [], i, co = config.options;
// collect info about effected tiddlers.
story.forEachTiddler(function(tt, tiddler){
if (tt != title) list.push(tt);
});
if ( co.chkDisableUnTagOthersConfirm || confirm( this.txtConfirm.format([title]) + "\n\n" + list.join(', ')) ) {
store.suspendNotifications;
for ( i = 0; i < list.length; i++) {
store.setTiddlerTag(list[i], 0, title);
}
store.resumeNotifications;
store.notifyAll;
}
if (co.chkAutoSave) autoSaveChanges(true);
return false;
};
//}}}
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/2ab6a09c82cb286?hl=en
{{{
<<tabs txtMyTabs "Tab1" "helpTab1" Tab1 "Tab2" "helpTab2" Tab2>>
}}}
<<tabs txtMyTabs "Tab1" "helpTab1" Tab1 "Tab2" "helpTab2" Tab2>>
{{{<<option txtMyTabs>>}}}: <<option txtMyTabs>> shows the actual label text stored in config.options.txtMyTabs. The label and the tiddler have to have the same name. Otherwise it will not work. The option and the tiddler macro are not automatically updated, if you change the active tab.
{{{
<<tiddler {{tiddler.title+"##code"}} with: {{store.getTiddlerText(config.options.txtMyTabs)}}>>
}}}
<<tiddler {{tiddler.title+"##code"}} with:
{{store.getTiddlerText(config.options.txtMyTabs)}}>>
//{{{
!code
$1
!end
//}}}
|''Name:''|[[TWDefaultTheme]]|
|''Description:''|Your description here!|
|''Generator:''|[[TW FreeStyle|http://FreeStyle.tiddlyspot.com]]|
|''Gen.Description:''|Automatically generated from: TWDefaultThemeProject|
|''PageTemplate:''|##PageTemplate|
|''ViewTemplate:''|##ViewTemplate|
|''EditTemplate:''|##EditTemplate|
|''StyleSheet:''|##StyleSheet|
!PageTemplate
<!--{{{-->
<!-- RowTwHeader -->
<div class='dp100'>
<!-- ColTwTitle -->
<div class='dp100'>
<!-- BoxTWHeader -->
<!-- defines the TW header. Comes from PageTemplate -->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
</div>
</div> <!-- rows are allways 100% -->
<div class='clear'></div> <!-- do not delete this! -->
<!-- RowTwBody -->
<div class='dp100'>
<!-- ColTWMainMenu -->
<div class='dp15'>
<!-- BoxTWMainMenu -->
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
</div>
<!-- ColTWDisplayArea -->
<div id='displayArea' class='dp70'>
<!-- BoxTWMessageArea -->
<div id='messageArea'></div>
<!-- BoxTWTiddlerDisplay -->
<div id='tiddlerDisplay'></div>
</div>
<!-- ColTWSidebar -->
<div id='sidebar' class='dp15 dpfr' style='width:15%; position:relative;'>
<!-- BoxTWSidebarOptions -->
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<!-- BoxTWSidebarTabs -->
<div id='sidebarTabs' refresh='content' force='true' tiddler='CSideBarTabs'></div>
</div>
</div> <!-- rows are allways 100% -->
<div class='clear'></div> <!-- do not delete this! -->
<!--}}}-->
!ViewTemplate
<!--{{{-->
<!-- TwViewTemplate -->
<div class='dp100'>
<!-- BoxVT_TwToolbar -->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<!-- BoxVT_TwTitle -->
<div class='title' macro='view title'></div>
<!-- BoxVT_TwSubtitle -->
<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>
<!-- BoxVT_TwTagged -->
<div class='tagged' macro='tags'></div>
<!-- BoxVT_TwTagging -->
<div class='tagging' macro='tagging'></div>
<!-- BoxVT_TWBody -->
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
</div>
<!--}}}-->
!EditTemplate
<!--{{{-->
<!-- TwEditTemplate -->
<div class='dp100'>
<!-- BoxET_TwEditToolbar -->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<!-- BoxET_TwTitle -->
<div class='title' macro='view title'></div>
<!-- BoxET_TWEditTitle -->
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<!-- BoxET_TwEditBody -->
<div class='editor' macro='edit text'></div>
<!-- BoxET_TwTagging -->
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
</div>
<!--}}}-->
!StyleSheet
/*{{{*/
/*-- new in emastic --*/
/* left main menu stuff */
#mainMenu {
width:auto; /*-- new in emastic --*/
position:relative; /*-- new in emastic --*/
text-align:right;
line-height:1.6em;
padding:1.5em 0.5em 0.5em 0.5em;
font-size:1.1em;
}
#sidebarTabs .tabContents{
margin: 0 0.5em; /* new for emastic */
width: auto;
}
#displayArea {
float: left; /*-- new for emastic --*/
padding: 0; /*-- new for emastic --*/
margin: 0; /*-- new for emastic --*/
}
/***
This fixes a problem with the tabs slider
***/
#sidebarTabs .button {
margin:0em 0.2em;
padding:0.2em 0.3em;
display:inline-block;
}
/*-- emastic System --*/
[[EmasticSystem]]
[[EmFreeStyle]]
/*-- call the standard StyleSheet --*/
[[StyleSheet]]
/*}}}*/
tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text. tiddler text.
belongs to: ListTemplateTest
id: testIDT2
text: text in T2
/***
Enable ask for revision text: <<option chkAskForRevisionText>>
***/
/*{{{*/
if(!version.extensions.RevisionsCommandEditSaveHj) { //# ensure that the plugin is only installed once
version.extensions.RevisionsCommandEditSaveHj = { installed: true };
(function($) {
var _handler = config.macros.edit.handler;
config.macros.edit.handler= function (place, macroName, params, wikifier, paramString, tiddler) {
tiddler.fields['revision.text']="";
return _handler.apply(this, arguments);
} // handler
var _CoreSaveTiddler=TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler = function (title, newTitle, newBody, modifier, modified, tags, fields) {
var revMsg = "Enter revision text!";
var co = config.options;
if (co.chkAskForRevisionText === 'undefined') co.chkAskForRevisionText = true;
if (co.chkAskForRevisionText) fields['revision.text'] = prompt( revMsg, "") || "";
var tiddler = _CoreSaveTiddler.apply(this, arguments);
return tiddler;
}
})(jQuery);
} //# end of "install only once"
/*}}}*/
/***
!Description
!CSS
***/
/*{{{*/
body { font:75%/1.5em Arial, Helvetica, sans-serif;
font-size-adjust:none;
font-style:normal;
font-variant:normal;
font-weight:normal;
}
p { padding:0 0 1.5em 1em;color:#111; word-spacing:0.08em; letter-spacing:0.03em; }
p img { float: left; margin: 0 1em 1em 0; padding: 0; }
p img.right { float: right; margin: 0 0 1em 1em; }
h1,h2{ font-weight:normal; color: #333; font-family:Georgia, "Times New Roman", serif; letter-spacing: 2px; word-spacing:0.1em; }
h3,h4,h5,h6 { font-weight: normal; color: #333; font-family:Georgia, "Times New Roman", serif; }
h1 { font-size: 2.2em; margin-bottom: 0.682em; }
h2 { font-size: 1.9em; margin-bottom: 0.79em; }
h3 { font-size: 1.7em; margin-bottom: 0.882em; }
h4 { font-size: 1.4em; margin-bottom: 1.071em; }
h5,h6 { font-size: 1.3em; margin-bottom: 1,154em; }
li ul,
li ol { margin:0 1.5em; }
ul, ol { margin: 0 1.5em 1.5em 1.5em; }
dl { margin: 0 0 1.5em 0; }
dl dt { font-weight: bold; }
dl dd { margin-left: 1.5em; }
a { color: #035292; text-decoration: none; }
a:hover { text-decoration: underline; }
table { margin-bottom: 1.5em; border-collapse: collapse; }
th {font-weight: bold; }
tr, th, td { margin:0; padding:0 1.5em 0 1em; height:18px; }
tfoot { font-style: italic; }
caption { text-align:center; font-family:Georgia, serif; }
abbr, acronym { border-bottom: 1px dotted #000; }
address { margin-top: 1.5em; font-style: italic; }
del { color: #000; }
blockquote { padding-left:1.5em; margin: 1.5em; border-left:3px solid #ccc; font-style:italic; }
strong { font-weight: bold; }
em, dfn { font-style: italic; }
dfn { font-weight: bold; }
pre, code { margin: 1.5em 0; white-space: pre; }
pre, code, tt { font: 1em monospace; line-height: 1.5; }
tt { display: block; margin: 1.5em 0; }
hr {margin-bottom:1.5em;}
/*}}}*/
<<newJournal title:"YYYY.0MM.0DD@0hh:0mm:0ss"
text: {{
var txt="";
var dt=new Date();
txt=store.getTiddlerText("TypeButton##button");
txt.format([
dt.formatString("YYYY.0MM.0DD@0hh:0mm:0ss"),
config.options.txtUserName
]);
}}
label:"new typewith.me"
tag:"typeWithMe">>
/%
!button
<<tiddler TypeButton##url with: "%0-by-%1">>
!url
<html><div align="center">
<iframe src="http://willyou.typewith.me/p/$1"
frameborder="0" width="100%" height="600" />
</iframe></div></html>
!end %/
/***
|''Name''|TiddlyWebAdaptor|
|''Description''|adaptor for interacting with TiddlyWeb|
|''Author:''|FND|
|''Contributors''|Chris Dent, Martin Budden|
|''Version''|1.4.10|
|''Status''|stable|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/adaptors/TiddlyWebAdaptor.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/association/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.5|
|''Keywords''|serverSide TiddlyWeb|
!Notes
This plugin includes [[jQuery JSON|http://code.google.com/p/jquery-json/]].
!To Do
* createWorkspace
* document custom/optional context attributes (e.g. filters, query, revision) and tiddler fields (e.g. server.title, origin)
!Code
***/
//{{{
(function($) {
var adaptor = config.adaptors.tiddlyweb = function() {};
adaptor.prototype = new AdaptorBase();
adaptor.serverType = "tiddlyweb";
adaptor.serverLabel = "TiddlyWeb";
adaptor.mimeType = "application/json";
adaptor.parsingErrorMessage = "Error parsing result from server";
adaptor.noBagErrorMessage = "no bag specified for tiddler";
adaptor.locationIDErrorMessage = "no bag or recipe specified for tiddler"; // TODO: rename
// retrieve current status (requires TiddlyWeb status plugin)
adaptor.prototype.getStatus = function(context, userParams, callback) {
context = this.setContext(context, userParams, callback);
var uriTemplate = "%0/status";
var uri = uriTemplate.format([context.host]);
var req = httpReq("GET", uri, adaptor.getStatusCallback, context,
null, null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getStatusCallback = function(status, context, responseText, uri, xhr) {
context.status = responseText ? status : false;
try {
context.statusText = xhr.statusText;
} catch(exc) { // offline (Firefox)
context.status = false;
context.statusText = null;
}
context.httpStatus = xhr.status;
if(context.status) {
context.serverStatus = $.evalJSON(responseText); // XXX: error handling!?
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// retrieve a list of workspaces
adaptor.prototype.getWorkspaceList = function(context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.workspaces = [];
var uriTemplate = "%0/recipes"; // XXX: bags?
var uri = uriTemplate.format([context.host]);
var req = httpReq("GET", uri, adaptor.getWorkspaceListCallback,
context, { accept: adaptor.mimeType }, null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getWorkspaceListCallback = function(status, context, responseText, uri, xhr) {
context.status = status;
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(status) {
try {
var workspaces = $.evalJSON(responseText);
} catch(ex) {
context.status = false; // XXX: correct?
context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
if(context.callback) {
context.callback(context, context.userParams);
}
return;
}
context.workspaces = workspaces.map(function(itm) { return { title: itm }; });
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// retrieve a list of tiddlers
adaptor.prototype.getTiddlerList = function(context, userParams, callback) {
context = this.setContext(context, userParams, callback);
var uriTemplate = "%0/%1/%2/tiddlers%3";
var params = context.filters ? "?" + context.filters : "";
if(context.format) {
params = context.format + params;
}
var workspace = adaptor.resolveWorkspace(context.workspace);
var uri = uriTemplate.format([context.host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name), params]);
var req = httpReq("GET", uri, adaptor.getTiddlerListCallback,
context, merge({ accept: adaptor.mimeType }, context.headers), null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getTiddlerListCallback = function(status, context, responseText, uri, xhr) {
context.status = status;
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(status) {
context.tiddlers = [];
try {
var tiddlers = $.evalJSON(responseText); //# NB: not actual tiddler instances
} catch(ex) {
context.status = false; // XXX: correct?
context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
if(context.callback) {
context.callback(context, context.userParams);
}
return;
}
for(var i = 0; i < tiddlers.length; i++) {
var tiddler = adaptor.toTiddler(tiddlers[i], context.host);
context.tiddlers.push(tiddler);
}
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// perform global search
adaptor.prototype.getSearchResults = function(context, userParams, callback) {
context = this.setContext(context, userParams, callback);
var uriTemplate = "%0/search?q=%1%2";
var filterString = context.filters ? ";" + context.filters : "";
var uri = uriTemplate.format([context.host, context.query, filterString]); // XXX: parameters need escaping?
var req = httpReq("GET", uri, adaptor.getSearchResultsCallback,
context, { accept: adaptor.mimeType }, null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getSearchResultsCallback = function(status, context, responseText, uri, xhr) {
adaptor.getTiddlerListCallback(status, context, responseText, uri, xhr); // XXX: use apply?
};
// retrieve a particular tiddler's revisions
adaptor.prototype.getTiddlerRevisionList = function(title, limit, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions";
var workspace = adaptor.resolveWorkspace(context.workspace);
var uri = uriTemplate.format([context.host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name), adaptor.normalizeTitle(title)]);
var req = httpReq("GET", uri, adaptor.getTiddlerRevisionListCallback,
context, merge({ accept: adaptor.mimeType }, context.headers), null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getTiddlerRevisionListCallback = function(status, context, responseText, uri, xhr) {
context.status = status;
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(status) {
context.revisions = [];
try {
var tiddlers = $.evalJSON(responseText); //# NB: not actual tiddler instances
} catch(ex) {
context.status = false; // XXX: correct?
context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
if(context.callback) {
context.callback(context, context.userParams);
}
return;
}
for(var i = 0; i < tiddlers.length; i++) {
var tiddler = adaptor.toTiddler(tiddlers[i], context.host);
context.revisions.push(tiddler);
}
var sortField = "server.page.revision";
context.revisions.sort(function(a, b) {
return a.fields[sortField] < b.fields[sortField] ? 1 :
(a.fields[sortField] == b.fields[sortField] ? 0 : -1);
});
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// retrieve an individual tiddler revision -- XXX: breaks with standard arguments list -- XXX: convenience function; simply use getTiddler?
adaptor.prototype.getTiddlerRevision = function(title, revision, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.revision = revision;
return this.getTiddler(title, context, userParams, callback);
};
// retrieve an individual tiddler
//# context is an object with members host and workspace
//# callback is passed the new context and userParams
adaptor.prototype.getTiddler = function(title, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.title = title;
if(context.revision) {
var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions/%4";
} else {
uriTemplate = "%0/%1/%2/tiddlers/%3";
}
if(!context.tiddler) {
context.tiddler = new Tiddler(title);
}
context.tiddler.fields["server.type"] = adaptor.serverType;
context.tiddler.fields["server.host"] = AdaptorBase.minHostName(context.host);
context.tiddler.fields["server.workspace"] = context.workspace;
var workspace = adaptor.resolveWorkspace(context.workspace);
var uri = uriTemplate.format([context.host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name), adaptor.normalizeTitle(title),
context.revision]);
var req = httpReq("GET", uri, adaptor.getTiddlerCallback, context,
merge({ accept: adaptor.mimeType }, context.headers), null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getTiddlerCallback = function(status, context, responseText, uri, xhr) {
context.status = status;
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(status) {
try {
var tid = $.evalJSON(responseText);
} catch(ex) {
context.status = false;
context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
if(context.callback) {
context.callback(context, context.userParams);
}
return;
}
var tiddler = adaptor.toTiddler(tid, context.host);
tiddler.title = context.tiddler.title;
tiddler.fields["server.etag"] = xhr.getResponseHeader("Etag");
// normally we'd assign context.tiddler = tiddler here - but we can't do
// that because of IE, which triggers getTiddler in putTiddlerCallback,
// and since ServerSideSavingPlugin foolishly relies on persistent
// object references, we need to merge the data into the existing object
$.extend(context.tiddler, tiddler);
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// retrieve tiddler chronicle (all revisions)
adaptor.prototype.getTiddlerChronicle = function(title, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.title = title;
var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions?fat=1";
var workspace = adaptor.resolveWorkspace(context.workspace);
var uri = uriTemplate.format([context.host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name), adaptor.normalizeTitle(title)]);
var req = httpReq("GET", uri, adaptor.getTiddlerChronicleCallback,
context, { accept: adaptor.mimeType }, null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.getTiddlerChronicleCallback = function(status, context, responseText, uri, xhr) {
context.status = status;
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(status) {
context.responseText = responseText;
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// store an individual tiddler
adaptor.prototype.putTiddler = function(tiddler, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.title = tiddler.title;
context.tiddler = tiddler;
context.host = context.host || this.fullHostName(tiddler.fields["server.host"]);
var uriTemplate = "%0/%1/%2/tiddlers/%3";
try {
context.workspace = context.workspace || tiddler.fields["server.workspace"];
var workspace = adaptor.resolveWorkspace(context.workspace);
} catch(ex) {
return adaptor.locationIDErrorMessage;
}
var uri = uriTemplate.format([context.host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name),
adaptor.normalizeTitle(tiddler.title)]);
var etag = adaptor.generateETag(workspace, tiddler);
var headers = etag ? { "If-Match": etag } : null;
var payload = {
type: tiddler.fields["server.content-type"] || null,
text: tiddler.text,
tags: tiddler.tags,
fields: $.extend({}, tiddler.fields)
};
delete payload.fields.changecount;
$.each(payload.fields, function(key, value) {
if(key.indexOf("server.") == 0) {
delete payload.fields[key];
}
});
payload = $.toJSON(payload);
var req = httpReq("PUT", uri, adaptor.putTiddlerCallback,
context, headers, payload, adaptor.mimeType, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.putTiddlerCallback = function(status, context, responseText, uri, xhr) {
context.status = [204, 1223].contains(xhr.status);
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(context.status) {
var loc = xhr.getResponseHeader("Location");
var etag = xhr.getResponseHeader("Etag");
if(loc && etag) {
var bag = loc.split("/bags/").pop().split("/")[0];
context.tiddler.fields["server.bag"] = bag;
context.tiddler.fields["server.workspace"] = "bags/" + bag;
var rev = etag.split("/").pop().split(/;|:/)[0];
context.tiddler.fields["server.page.revision"] = rev;
context.tiddler.fields["server.etag"] = etag;
if(context.callback) {
context.callback(context, context.userParams);
}
} else { // IE
context.adaptor.getTiddler(context.tiddler.title, context,
context.userParams, context.callback);
}
} else if(context.callback) {
context.callback(context, context.userParams);
}
};
// store a tiddler chronicle
adaptor.prototype.putTiddlerChronicle = function(revisions, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.title = revisions[0].title;
var headers = null;
var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions";
var host = context.host || this.fullHostName(tiddler.fields["server.host"]);
var workspace = adaptor.resolveWorkspace(context.workspace);
var uri = uriTemplate.format([host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name),
adaptor.normalizeTitle(context.title)]);
if(workspace.type == "bag") { // generate ETag
var etag = [adaptor.normalizeTitle(workspace.name),
adaptor.normalizeTitle(context.title), 0].join("/"); //# zero-revision prevents overwriting existing contents
headers = { "If-Match": '"' + etag + '"' };
}
var payload = $.toJSON(revisions);
var req = httpReq("POST", uri, adaptor.putTiddlerChronicleCallback,
context, headers, payload, adaptor.mimeType, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.putTiddlerChronicleCallback = function(status, context, responseText, uri, xhr) {
context.status = [204, 1223].contains(xhr.status);
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(context.callback) {
context.callback(context, context.userParams);
}
};
// store a collection of tiddlers (import TiddlyWiki HTML store)
adaptor.prototype.putTiddlerStore = function(store, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
var uriTemplate = "%0/%1/%2/tiddlers";
var host = context.host;
var workspace = adaptor.resolveWorkspace(context.workspace);
var uri = uriTemplate.format([host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name)]);
var req = httpReq("POST", uri, adaptor.putTiddlerStoreCallback,
context, null, store, "text/x-tiddlywiki", null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.putTiddlerStoreCallback = function(status, context, responseText, uri, xhr) {
context.status = [204, 1223].contains(xhr.status);
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(context.callback) {
context.callback(context, context.userParams);
}
};
// rename an individual tiddler or move it to a different workspace -- TODO: make {from|to}.title optional
//# from and to are objects with members title and workspace (bag; optional),
//# representing source and target tiddler, respectively
adaptor.prototype.moveTiddler = function(from, to, context, userParams, callback) { // XXX: rename parameters (old/new)?
var self = this;
var newTiddler = store.getTiddler(from.title) || store.getTiddler(to.title); //# local rename might already have occurred
var oldTiddler = $.extend(true, {}, newTiddler); //# required for eventual deletion
oldTiddler.title = from.title; //# required for original tiddler's ETag
var _getTiddlerChronicle = function(title, context, userParams, callback) {
return self.getTiddlerChronicle(title, context, userParams, callback);
};
var _putTiddlerChronicle = function(context, userParams) {
if(!context.status) {
return callback(context, userParams);
}
var revisions = $.evalJSON(context.responseText); // XXX: error handling?
// change current title while retaining previous location
for(var i = 0; i < revisions.length; i++) {
delete revisions[i].revision;
if(!revisions[i].fields.origin) { // NB: origin = "<workspace>/<title>"
revisions[i].fields.origin = ["bags", revisions[i].bag, revisions[i].title].join("/");
}
revisions[i].title = to.title;
}
// add new revision
var rev = $.extend({}, revisions[0]);
$.each(newTiddler, function(i, item) {
if(!$.isFunction(item)) {
rev[i] = item;
}
});
rev.title = to.title;
rev.created = rev.created.convertToYYYYMMDDHHMM();
rev.modified = new Date().convertToYYYYMMDDHHMM();
delete rev.fields.changecount;
revisions.unshift(rev);
if(to.workspace) {
context.workspace = to.workspace;
} else if(context.workspace.substring(0, 4) != "bags") { // NB: target workspace must be a bag
context.workspace = "bags/" + rev.bag;
}
var subCallback = function(context, userParams) {
if(!context.status) {
return callback(context, userParams);
}
context.adaptor.getTiddler(newTiddler.title, context, userParams, _deleteTiddler);
};
return self.putTiddlerChronicle(revisions, context, context.userParams, subCallback);
};
var _deleteTiddler = function(context, userParams) {
if(!context.status) {
return callback(context, userParams);
}
$.extend(true, newTiddler, context.tiddler);
context.callback = null;
return self.deleteTiddler(oldTiddler, context, context.userParams, callback);
};
callback = callback || function() {};
context = this.setContext(context, userParams);
context.host = context.host || oldTiddler.fields["server.host"];
context.workspace = from.workspace || oldTiddler.fields["server.workspace"];
return _getTiddlerChronicle(from.title, context, userParams, _putTiddlerChronicle);
};
// delete an individual tiddler
adaptor.prototype.deleteTiddler = function(tiddler, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.title = tiddler.title; // XXX: not required!?
var uriTemplate = "%0/bags/%1/tiddlers/%2";
var host = context.host || this.fullHostName(tiddler.fields["server.host"]);
var bag = tiddler.fields["server.bag"];
if(!bag) {
return adaptor.noBagErrorMessage;
}
var uri = uriTemplate.format([host, adaptor.normalizeTitle(bag),
adaptor.normalizeTitle(tiddler.title)]);
var etag = adaptor.generateETag({ type: "bag", name: bag }, tiddler);
var headers = etag ? { "If-Match": etag } : null;
var req = httpReq("DELETE", uri, adaptor.deleteTiddlerCallback, context, headers,
null, null, null, null, true);
return typeof req == "string" ? req : true;
};
adaptor.deleteTiddlerCallback = function(status, context, responseText, uri, xhr) {
context.status = [204, 1223].contains(xhr.status);
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
if(context.callback) {
context.callback(context, context.userParams);
}
};
// compare two revisions of a tiddler (requires TiddlyWeb differ plugin)
//# if context.rev1 is not specified, the latest revision will be used for comparison
//# if context.rev2 is not specified, the local revision will be sent for comparison
//# context.format is a string as determined by the TiddlyWeb differ plugin
adaptor.prototype.getTiddlerDiff = function(title, context, userParams, callback) {
context = this.setContext(context, userParams, callback);
context.title = title;
var tiddler = store.getTiddler(title);
try {
var workspace = adaptor.resolveWorkspace(tiddler.fields["server.workspace"]);
} catch(ex) {
return adaptor.locationIDErrorMessage;
}
var tiddlerRef = [workspace.type + "s", workspace.name, tiddler.title].join("/");
var rev1 = context.rev1 ? [tiddlerRef, context.rev1].join("/") : tiddlerRef;
var rev2 = context.rev2 ? [tiddlerRef, context.rev2].join("/") : null;
var uriTemplate = "%0/diff?rev1=%1";
if(rev2) {
uriTemplate += "&rev2=%2";
}
if(context.format) {
uriTemplate += "&format=%3";
}
var host = context.host || this.fullHostName(tiddler.fields["server.host"]);
var uri = uriTemplate.format([host, adaptor.normalizeTitle(rev1),
adaptor.normalizeTitle(rev2), context.format]);
if(rev2) {
var req = httpReq("GET", uri, adaptor.getTiddlerDiffCallback, context, null,
null, null, null, null, true);
} else {
var payload = {
title: tiddler.title,
text: tiddler.text,
modifier: tiddler.modifier,
tags: tiddler.tags,
fields: $.extend({}, tiddler.fields)
}; // XXX: missing attributes!?
payload = $.toJSON(payload);
req = httpReq("POST", uri, adaptor.getTiddlerDiffCallback, context,
null, payload, adaptor.mimeType, null, null, true);
}
return typeof req == "string" ? req : true;
};
adaptor.getTiddlerDiffCallback = function(status, context, responseText, uri, xhr) {
context.status = status;
context.statusText = xhr.statusText;
context.httpStatus = xhr.status;
context.uri = uri;
if(status) {
context.diff = responseText;
}
if(context.callback) {
context.callback(context, context.userParams);
}
};
// generate tiddler information
adaptor.prototype.generateTiddlerInfo = function(tiddler) {
var info = {};
var uriTemplate = "%0/%1/%2/tiddlers/%3";
var host = this.host || tiddler.fields["server.host"]; // XXX: this.host obsolete?
host = this.fullHostName(host);
var workspace = adaptor.resolveWorkspace(tiddler.fields["server.workspace"]);
info.uri = uriTemplate.format([host, workspace.type + "s",
adaptor.normalizeTitle(workspace.name),
adaptor.normalizeTitle(tiddler.title)]);
return info;
};
// create Tiddler instance from TiddlyWeb tiddler JSON
adaptor.toTiddler = function(json, host) {
var created = Date.convertFromYYYYMMDDHHMM(json.created);
var modified = Date.convertFromYYYYMMDDHHMM(json.modified);
var fields = json.fields;
fields["server.type"] = adaptor.serverType;
fields["server.host"] = AdaptorBase.minHostName(host);
fields["server.bag"] = json.bag;
fields["server.title"] = json.title;
if(json.recipe) {
fields["server.recipe"] = json.recipe;
}
if(json.type && json.type != "None") {
fields["server.content-type"] = json.type;
}
fields["server.permissions"] = json.permissions.join(", ");
fields["server.page.revision"] = json.revision;
fields["server.workspace"] = "bags/" + json.bag;
var tiddler = new Tiddler(json.title);
tiddler.assign(tiddler.title, json.text, json.modifier, modified, json.tags,
created, json.fields, json.creator);
return tiddler;
};
adaptor.resolveWorkspace = function(workspace) {
var components = workspace.split("/");
return {
type: components[0] == "bags" ? "bag" : "recipe",
name: components[1] || components[0]
};
};
adaptor.generateETag = function(workspace, tiddler) {
var revision = tiddler.fields["server.page.revision"];
var etag = revision == "false" ? null : tiddler.fields["server.etag"];
if(!etag && workspace.type == "bag") {
if(typeof revision == "undefined") {
revision = "0";
} else if(revision == "false") {
return null;
}
etag = [adaptor.normalizeTitle(workspace.name),
adaptor.normalizeTitle(tiddler.title), revision].join("/");
etag = '"' + etag + '"';
}
return etag;
};
adaptor.normalizeTitle = function(title) {
return encodeURIComponent(title);
};
})(jQuery);
/*
* jQuery JSON Plugin
* version: 1.3
* source: http://code.google.com/p/jquery-json/
* license: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
(function($){function toIntegersAtLease(n)
{return n<10?'0'+n:n;}
Date.prototype.toJSON=function(date)
{return this.getUTCFullYear()+'-'+
toIntegersAtLease(this.getUTCMonth())+'-'+
toIntegersAtLease(this.getUTCDate());};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};$.quoteString=function(string)
{if(escapeable.test(string))
{return'"'+string.replace(escapeable,function(a)
{var c=meta[a];if(typeof c==='string'){return c;}
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};$.toJSON=function(o,compact)
{var type=typeof(o);if(type=="undefined")
return"undefined";else if(type=="number"||type=="boolean")
return o+"";else if(o===null)
return"null";if(type=="string")
{return $.quoteString(o);}
if(type=="object"&&typeof o.toJSON=="function")
return o.toJSON(compact);if(type!="function"&&typeof(o.length)=="number")
{var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i],compact));}
if(compact)
return"["+ret.join(",")+"]";else
return"["+ret.join(", ")+"]";}
if(type=="function"){throw new TypeError("Unable to convert object of type 'function' to json.");}
var ret=[];for(var k in o){var name;type=typeof(k);if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;var val=$.toJSON(o[k],compact);if(typeof(val)!="string"){continue;}
if(compact)
ret.push(name+":"+val);else
ret.push(name+": "+val);}
return"{"+ret.join(", ")+"}";};$.compactJSON=function(o)
{return $.toJSON(o,true);};$.evalJSON=function(src)
{return eval("("+src+")");};$.secureEvalJSON=function(src)
{var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};})(jQuery);
//}}}
Name: MptwTeal
Background: #fff
Foreground: #000
PrimaryPale: #B5D1DF
PrimaryLight: #618FA9
PrimaryMid: #1a3844
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #f8f8f8
TertiaryLight: #bbb
TertiaryMid: #999
TertiaryDark: #888
Error: #f88
related to: http://groups.google.com/group/tiddlywiki/browse_thread/thread/b24bb260e98d0d50?hl=en
{{dp50{
!Default list order
<<list filter [tag[filterMe]]>>
}}}{{dp50{
!Sorted by custom field "order"
<<tiddler "HowTo Sort by custom field##Code">>}}}
{{{
!Code
<script>
var levA="filterMe";
var ecbt="order";
var tids=store.getTaggedTiddlers(levA, ecbt);
// console.log(tids);
tids = store.sortTiddlers(tids, ecbt);
var text = "";
for (i=0; i < tids.length; i++) {
text += tids[i].title + '\n';
}
return text;
</script>
!end
}}}
/***
reference: http://groups.google.com/group/tiddlywikidev/browse_thread/thread/eaaa398fd6583a4c
Copy the following code into a tiddler eg: "SliderCookieHack" and tag it "systemConfig"
//{{{
config.macros.slider.onClickSlider = function(ev)
{
var e = ev || window.event;
var n = this.nextSibling;
var cookie = n.getAttribute("cookie");
var isOpen = n.style.display != "none";
if(config.options.chkAnimate && anim && typeof Slider == "function")
anim.startAnimating(new Slider(n,!isOpen,null,"none"));
else
n.style.display = isOpen ? "none" : "block";
if (cookie != "") { //!!
config.options[cookie] = !isOpen;
saveOptionCookie(cookie);
} //!!
return false;
};
//}}}
!!!Click the button to see the code section
<<slider "" {{tiddler.title+'##Code'}} "View code »" "Display the code">>
/%
!Code
***/
/*{{{*/
<<slider "" {{tiddler.title+'##Code'}} "View code »" "Display the code">>
/*}}}*/
// /% %/
/***
!Description
2010.01.21
<<<
*pplx added
<<<
!CSS
***/
/*{{{*/
/* CSS Document */
.rc {-moz-border-radius: 10px; -webkit-border-radius: 10px; border:1px solid #fff; }
.fr {border:1px solid #ccc; padding:0.25em;}
.byline {
font-family: "Lucida Grande", Tahoma;
font-size: 0.865em;
font-weight: lighter;
font-variant: normal;
text-transform: uppercase;
color: #666666;
letter-spacing: 0.4em;
display: block;
margin-bottom: 1.734em;
padding:0em 0em 0em 1em;
}
.and {font-family: Baskerville, "Goudy Old Style", "Palatino", "Book Antiqua", serif;
font-style: italic;
color: #777;
}
.tc {text-align:center;}
.tr {text-align:right;}
.tl {text-align:left;}
.b{ font-weight:bold;}
.pl1{padding-left:1em;}
.pl2{padding-left:2em;}
.pl3{padding-left:3em;}
.ppl2{padding-left:1.8%;}
.ppl3{padding-left:3.13%;}
.ppl5{padding-left:4.8%;}
.water{color:#5582d1;}
.earth{color:#4e3e2c;}
.air{color:#f1fff7;}
.fire{ color:#ff8a19;}
/* drinks food */
.wine{color:#4a040a;}
.beer{color:#F0C030;}
.caffe{color:#473523;}
.caffe-cream{color:#b68d3d;}
.espresso{color:#2c1901;}
.caramel{color:#ab671f;}
.chocolate{color:#290200;}
.black-pepper{color:#444334;}
.pepper-lite{color:#8d8a72;}
.lipstick{color:#c20c0c;}
.oldbook{font-family:"Book Antiqua","Warnock Pro","Goudy Old Style","Palatino",Georgia,serif;}
.note{font-family:Georgia, "Times New Roman", Times, serif; font-style:italic; font-size:0.9em; margin:0.1em; color:#333;}
.mono{font-family:"Courier New", Courier, monospace;}
/*}}}*/
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/99b74a246b1e7a84?hl=en
<<tiddler {{tiddler.title+'##code'}}>>
{{{
!code
<script label="click me">
var text = '';
story.forEachTiddler(function(title, tiddler){
text += title + '\n';
});
return '\n\n' + text;
</script>
!end
}}}
/%
!echo
$1
!end
%/
<<list filter [tag[listTemplateTest]] template:'ListTemplateTest##template'>>
{{{
<<list filter [tag[listTemplateTest]] template:'ListTemplateTest##template'>>
!template
<<view title link>> <<view modified date "YYYY 0MM 0DD">>
!end
}}}
Date formats can be seen at [[tiddlywiki.org - Date Formats|http://tiddlywiki.org/#%5B%5BDate%20Formats%5D%5D]]
Learn more about list macro at: [[tiddlywiki.org - list macro|http://tiddlywiki.org/#%5b%5blist%20macro%5d%5d]]
----
see: http://groups.google.com/group/tiddlyspace/browse_thread/thread/e96a6232fdf4817b?hl=en
id: testID
text: one line of text
{{{
<<list filter [tag[listTemplateTest]] template:'ListTemplateTest##slicetext'>>
}}}
<<list filter [tag[listTemplateTest]] template:'ListTemplateTest##slicetext'>>
{{{
!slicetext
<<view title link>> <<view modified date "YYYY 0MM 0DD">> - <<view "::id" text>> - <<view "::text" text>>
!end
}}}
Name: MptwSmoke
Background: #fff
Foreground: #000
PrimaryPale: #aaa
PrimaryLight: #777
PrimaryMid: #111
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
Play with project lists
<<tagsplorer Project>>
<script type="text/javascript" src="http://wave-api.appspot.com/public/embed.js"></script>
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/fe65c47c793df59
! Important
This is an example: for production use: TagWithStoryCommand instead!
!! Usage
{{{
<<tiddler "TagTiddler with Story##code">>
}}}
{{{
!code
<script label="Click me: Use (story) open tiddlers, to tag this tiddler">
var tags = [], i;
var container = story.findContainingTiddler(place).getAttribute('tiddler');
story.forEachTiddler(function(title, tiddler){
if (title != container) tags.push(title);
});
if ( confirm("Tag this tiddler with: \n\n" + tags.join('\n')) ) {
store.suspendNotifications;
for ( i = 0; i < tags.length; i++) {
store.setTiddlerTag(container, 1, tags[i]);
}
store.resumeNotifications;
store.notifyAll;
}
if (config.options.chkAutoSave) autoSaveChanges(true);
</script>
!end
}}}
! Google Disabled this stuff
This is a Google Wave, that is viewable and editable according to tiddlywiki@googlegroups.com settings
If you are not logged in to your google account, you should only see the content.
If you are logged in to your google account, and if you are a member of tiddlywiki group it should be editable too.
Learn more about adding a group to a wave at: http://googlewave.blogspot.com/2009/12/waving-with-groups.html
/*{{{*/
<html>
<div id="wave1" style="width: 100%; height: 420px; margin-bottom:1em;"></div>
</html>
<script>
var wave = new WavePanel('https://wave.google.com/wave/');
wave.setUIConfig('white', 'black', 'Arial', '13px');
wave.loadWave('googlewave.com!w+eyiPS7ZkCWe');
wave.init(document.getElementById('wave1'));
</script>
/*}}}*/
/***
Here are the changes, that have to be made, to overwrite the core predefinitions.
***/
/*{{{*/
/*-- new for clearing floats --*/
.outer{
overflow: auto;
}
.tabContents {
overflow: auto;
}
/* new for emastic */
.box {
background: [[ColorPalette::Background]];
border-right: 1px [[ColorPalette::TertiaryMid]] solid;
border-bottom: 1px [[ColorPalette::TertiaryMid]] solid;
padding: 1px 1em 0.75em;
margin: 1em .5em 0.25em;
}
#sidebarOptions .input {
margin: 0.4em 5%;
}
.txtOptionInput, .pasOptionInput {
width: 90%;
}
/*}}}*/
/***
|sortable|k
|Subject|Value|h
|Name|dsPlugin|
|Created by|Mike Praeuner|
|Location|http://www.strm.us/tw/|
|Version|1.0.0|
|Requires|~TW2.5 , [[jquery.dragsort-0.310.js]] |
Basic Macro **very experimental ** not all functions or ideas are working yet.
{{{<<ds>>}}}
Invokes dragsort capability for ordered and unordered lists (currently can not save)
*need to add parameters
*need to figure out saving mechanism
*need to figure out how to stop bleeding of macro to other tiddlers
***/
/***
!!!dragsort macro
***/
//{{{
config.macros.ds = {};
config.macros.ds.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
jQuery("ol").dragsort({ dragSelector: "li", dragBetween: true }); //unordered lists
jQuery("ul").dragsort({ dragSelector: "li", dragBetween: true }); //ordered lists
jQuery("div.viewer").addClass("custom"); //change bullet style
}
//}}}
/***
!!!dragsort style
***/
//{{{
setStylesheet(
".custom ul {list-style: none;}\n"+
".custom ul li:before {content: '\u2B0D \u0020';}\n"+
".custom ol li:before {content: '\u2B0D \u0020';}\n"
,"dsStyles");
//}}}
<<tiddler "TagTiddler with Story##code">>
/***
|''Name''|RevisionsCommandPlugin|
|''Description''|provides access to tiddler revisions|
|''Author''|FND|
|''Contributors''|Martin Budden|
|''Version''|0.3.3|
|''Status''|@@beta@@|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/plugins/RevisionsCommandPlugin.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/association/plugins/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.6.0|
|''Keywords''|serverSide|
!Usage
Extend [[ToolbarCommands]] with {{{revisions}}}.
!Revision History
!!v0.1 (2009-07-23)
* initial release (renamed from experimental ServerCommandsPlugin)
!!v0.2 (2010-03-04)
* suppressed wikification in diff view
!!v0.3 (2010-04-07)
* restored wikification in diff view
* added link to side-by-side diff view
!To Do
* strip server.* fields from revision tiddlers
* resolve naming conflicts
* i18n, l10n
* code sanitizing
* documentation
!Code
***/
//{{{
(function($) {
jQuery.twStylesheet(".diff { white-space: pre, font-family: monospace }",
{ id: "diff" });
var cmd = config.commands.revisions = {
type: "popup",
hideShadow: true,
text: "revisions",
tooltip: "display tiddler revisions",
revTooltip: "", // TODO: populate dynamically?
loadLabel: "loading...",
loadTooltip: "loading revision list",
selectLabel: "select",
selectTooltip: "select revision for comparison",
selectedLabel: "selected",
compareLabel: "compare",
linkLabel: "side-by-side view",
revSuffix: " [rev. #%0]",
diffSuffix: " [diff: #%0 #%1]",
dateFormat: "YYYY-0MM-0DD 0hh:0mm",
listError: "revisions could not be retrieved",
handlePopup: function(popup, title) {
title = this.stripSuffix("rev", title);
title = this.stripSuffix("diff", title);
var tiddler = store.getTiddler(title);
var type = _getField("server.type", tiddler);
var adaptor = new config.adaptors[type]();
var limit = null; // TODO: customizable
var context = {
host: _getField("server.host", tiddler),
workspace: _getField("server.workspace", tiddler)
};
var loading = createTiddlyButton(popup, cmd.loadLabel, cmd.loadTooltip);
var params = { popup: popup, loading: loading, origin: title };
adaptor.getTiddlerRevisionList(title, limit, context, params, this.displayRevisions);
},
displayRevisions: function(context, userParams) {
removeNode(userParams.loading);
if(context.status) {
var callback = function(ev) {
var e = ev || window.event;
var revision = resolveTarget(e).getAttribute("revision");
context.adaptor.getTiddlerRevision(tiddler.title, revision, context,
userParams, cmd.displayTiddlerRevision);
};
var table = createTiddlyElement(userParams.popup, "table");
for(var i = 0; i < context.revisions.length; i++) {
var tiddler = context.revisions[i];
var row = createTiddlyElement(table, "tr");
var timestamp = tiddler.modified.formatString(cmd.dateFormat);
var revision = tiddler.fields["server.page.revision"];
var cell = createTiddlyElement(row, "td");
createTiddlyButton(cell, timestamp, cmd.revTooltip, callback, null,
null, null, { revision: revision });
cell = createTiddlyElement(row, "td", null, null, tiddler.modifier);
cell = createTiddlyElement(row, "td");
createTiddlyButton(cell, cmd.selectLabel, cmd.selectTooltip,
cmd.revisionSelected, null, null, null,
{ index:i, revision: revision, col: 2 });
cmd.context = context; // XXX: unsafe (singleton)!?
}
} else {
$("<li />").text(cmd.listError).appendTo(userParams.popup);
}
},
revisionSelected: function(ev) {
var e = ev || window.event;
e.cancelBubble = true;
if(e.stopPropagation) {
e.stopPropagation();
}
var n = resolveTarget(e);
var index = n.getAttribute("index");
var col = n.getAttribute("col");
while(!index || !col) {
n = n.parentNode;
index = n.getAttribute("index");
col = n.getAttribute("col");
}
cmd.revision = n.getAttribute("revision");
var table = n.parentNode.parentNode.parentNode;
var rows = table.childNodes;
for(var i = 0; i < rows.length; i++) {
var c = rows[i].childNodes[col].firstChild;
if(i == index) {
if(c.textContent) {
c.textContent = cmd.selectedLabel;
} else {
c.text = cmd.selectedLabel;
}
} else {
if(c.textContent) {
c.textContent = cmd.compareLabel;
} else {
c.text = cmd.compareLabel;
}
c.onclick = cmd.compareSelected;
}
}
},
compareSelected: function(ev) {
var e = ev || window.event;
var n = resolveTarget(e);
var context = cmd.context;
context.rev1 = n.getAttribute("revision");
context.rev2 = cmd.revision;
context.tiddler = context.revisions[n.getAttribute("index")];
context.format = "unified";
context.adaptor.getTiddlerDiff(context.tiddler.title, context,
context.userParams, cmd.displayTiddlerDiffs);
},
displayTiddlerDiffs: function(context, userParams) {
var tiddler = context.tiddler;
tiddler.title += cmd.diffSuffix.format([context.rev1, context.rev2]);
tiddler.text = "{{diff{\n" + context.diff + "\n}}}";
tiddler.tags = ["diff"];
tiddler.fields.doNotSave = "true"; // XXX: correct?
if(!store.getTiddler(tiddler.title)) {
store.addTiddler(tiddler);
}
var src = story.getTiddler(userParams.origin);
var tiddlerEl = story.displayTiddler(src, tiddler);
var uri = context.uri.replace("format=unified", "format=horizontal");
var link = $('<a target="_blank" />').attr("href", uri).text(cmd.linkLabel);
$(".viewer", tiddlerEl).prepend(link);
},
displayTiddlerRevision: function(context, userParams) {
var tiddler = context.tiddler;
tiddler.title += cmd.revSuffix.format([tiddler.fields["server.page.revision"]]);
tiddler.fields.doNotSave = "true"; // XXX: correct?
if(!store.getTiddler(tiddler.title)) {
store.addTiddler(tiddler);
}
var src = story.getTiddler(userParams.origin);
story.displayTiddler(src, tiddler);
},
stripSuffix: function(type, title) {
var str = cmd[type + "Suffix"];
var i = str.indexOf("%0");
i = title.indexOf(str.substr(0, i));
if(i != -1) {
title = title.substr(0, i);
}
return title;
}
};
var _getField = function(name, tiddler) {
return tiddler.fields[name] || config.defaultCustomFields[name];
};
})(jQuery);
//}}}
/%
!info
|Name|SortXListCancel|
|Source||
|Version|0.2.0|
|Author|Mario Pietsch|
|Derived from:|http://www.tiddlytools.com/#ToggleLeftSidebar|
|License|http://creativecommons.org/licenses/by-nc-sa/3.0/at/|
|~CoreVersion|2.6|
|Type|transclusion|
|Description|Activate xList drag and drop sorting.|
Usage
<<<
{{{
<<tiddler SortXListCancel>>
<<tiddler SortXListCancel with: label tooltip>>
<<tiddler SortXListCancel with: "⨯" "Cancel xList sorter changes!">>
}}}
Try to start xList sorter: <<tiddler SortXListCancel##show
with: "⨯" "Cancel xList sorter changes!">>
<<<
!end
!show
<<tiddler {{
// some init here
'';}}>><html><nowiki><a href='javascript:;' title="$2"
onmouseover="
this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
+encodeURIComponent(encodeURIComponent(this.onclick))
+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
if (!version.extensions.jqueryui) {alert('Styling is not active!\nYou need to use: [ActivateStyling] macro.'); return false;}
jQuery('.xList').sortable('destroy');
story.forEachTiddler(function(t,e){story.refreshTiddler(t,null,true)});
refreshDisplay();
return false;
">$1</a></html>
!end
%/<<tiddler {{
var src='SortXListCancel';
src+(tiddler&&tiddler.title==src?'##info':'##show');
}} with: "$1" "$2">>
related to: http://groups.google.com/group/tiddlywiki/browse_thread/thread/5b5c0206c9f39e11?hl=en
!Needs
*InlineJavascriptPlugin
*MaloStyleSheet or EmasticPercent included in StyleSheet
*If you have small screen resolution, toggle sidebars first.
*ToggleLeftSidebarEm: <<tiddler ToggleLeftSidebarEm>> | ToggleRightSidebarEm <<tiddler ToggleRightSidebarEm>>
<<tiddler [[Temporary SideBySide##Code50]]>> <<tiddler [[Temporary SideBySide##Code33]]>> <<tiddler [[Temporary SideBySide##Code100]]>>
/*{{{*/
!Code50
<script label="click for 2 columns">
jQuery('.tiddler').each(function () {
var hasWrapper = jQuery(this).parent().hasClass('tidWrapper');
if (!hasWrapper)jQuery(this).wrap('<div class="tidWrapper" />');
});
jQuery('.tidWrapper').attr('class', 'tidWrapper dp50');
</script>
!Code33
<script label="click for 3 columns">
jQuery('.tiddler').each(function () {
var hasWrapper = jQuery(this).parent().hasClass('tidWrapper');
if (!hasWrapper)jQuery(this).wrap('<div class="tidWrapper" />');
});
jQuery('.tidWrapper').attr('class', 'tidWrapper dp33');
</script>
!Code100
<script label="click for 1 column">
jQuery('.tiddler').each( function () {
if (jQuery(this).parent().hasClass('tidWrapper')) jQuery(this).unwrap();
});
</script>
!end
/*}}}*/
/***
|''Name''|ColorfulToolbarPlugin004|
|''Description''|Change color of reference button in toolbar if there are references / backlinks to the tiddler|
|''Authors''|see Related to|
|''Version''|0.0.4|
|''Date''|2010-05-30|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#ColorfulToolbarPlugin|
|''License''|<...>|
|''CoreVersion''|2.5|
|''Documentation''|included|
|''Related to''|http://groups.google.com/group/tiddlywiki/browse_thread/thread/508b5fc7730e2372?hl=en|
|''Keywords''|change color, references, toolbar|
!!!Description
<<<
This script is an attempt to color ‘references’ in the toolbar red if the tiddler has references.
<<<
!!!Notes
<<<
To see, what it does click the "more" button at the toolbar!
<<<
!!!Usage
<<<
!!!!Standard
{{{
<<colorfulReferences>>
<<colorfulReferences color green>>
<<colorfulReferences text-decoration underline>>
}}}
!!!!ViewTemplate
{{{
<span class='test' macro='colorfulReferences' ></span>
}}}
<<<
!!!Parameters
<<<
Parameters are optional!
{{{
<<colorfulReference [CSS attribute] [value]>>
}}}
[CSS attribute] ... can be any valid CSS attribute
[value] ... can be any value according to used attribute
<<<
!!!Examples
<<<
{{{
<<colorfulReferences>>
}}}
<<colorfulReferences>>
<<<
!!!Configuration Options
<<<
none
<<<
!!!Revision History
<<<
V 0.0.4 - 2010-05-30
* additional Parameters added by Colm
**see Usage
V 0.0.3 - 2010-05-29
* initial Release
<<<
!!!To Do
<<<
<Alex ???>
<<<
!!!Code
***/
/*{{{*/
if(!version.extensions.ColorfulToolbarPlugin) { //# ensure that the plugin is only installed once
version.extensions.ColorfulToolbarPlugin = { installed: true };
config.macros.colorfulReferences = {
handler: function (place, macroName, params, wikifier, paramString, tiddler) {
var refAttribute = params[0] || 'color'; // default CSS attribute is "color"
var attValue = params[1] || 'red'; // default value is "red";
var tids = store.getReferringTiddlers(tiddler.title);
if (tids.length > 0) {
var id = story.findContainingTiddler(place);
jQuery(id).find('.command_references').css(refAttribute,attValue);
} //; if
} // handler
}; // config.macros
} //# end of "install only once"
/*}}}*/
/***
|''Name''|ColorfulToolbarPlugin|
|''Description''|Change color of reference button in toolbar if there are references / backlinks to the tiddler|
|''Authors''|see Related to|
|''Version''|0.0.5|
|''Date''|2010-06-03|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#ColorfulToolbarPlugin|
|''License''|<...>|
|''CoreVersion''|2.5|
|''Documentation''|included|
|''Related to''|http://groups.google.com/group/tiddlywiki/browse_thread/thread/508b5fc7730e2372?hl=en|
|''Keywords''|change color, references, toolbar|
!!!Description
<<<
This script is an attempt to color ‘references’ in the toolbar red if the tiddler has references.
<<<
!!!Notes
<<<
To see, what it does click the "more" button at the toolbar!
<<<
!!!Usage
<<<
!!!!Standard
{{{
<<colorfulReferences>>
<<colorfulReferences color green>>
<<colorfulReferences text-decoration underline>>
<<colorfulReferences color green true>>
}}}
!!!!ViewTemplate
{{{
<span class='test' macro='colorfulReferences' ></span>
}}}
<<<
!!!Parameters
<<<
Parameters are optional!
{{{
<<colorfulReference [CSS attribute] [value] [true|false]>>
}}}
[CSS attribute] ... can be any valid CSS attribute
[value] ... can be any value according to used attribute
[true|false] ... used to display number of references next to the toolbar command
<<<
!!!Examples
<<<
{{{
<<colorfulReferences color green true>>
}}}
<<colorfulReferences color green true>>
<<<
!!!Configuration Options
<<<
none
<<<
!!!Revision History
<<<
V 0.0.5 - 2010-06-03
* option to display quantity of references added by Colm
**2010-06-06 this tiddler uses {{{<<colorfulReferences color green true>>}}}
**updated the header info. no code changes.
V 0.0.4 - 2010-05-30
* additional Parameters added by Colm
**see Usage
V 0.0.3 - 2010-05-29
* initial Release
<<<
!!!To Do
<<<
<Alex ???>
<<<
!!!Code
***/
/*{{{*/
if(!version.extensions.ColorfulToolbarPlugin) { //# ensure that the plugin is only installed once
version.extensions.ColorfulToolbarPlugin = { installed: true };
config.macros.colorfulReferences = {
handler: function (place, macroName, params, wikifier, paramString, tiddler) {
var refAttribute = params[0] || 'color'; // default CSS attribute is "color"
var attValue = params[1] || 'red'; // default value is "red";
var numFlag = params[2] || 'false';
var tids = store.getReferringTiddlers(tiddler.title);
if (tids.length > 0) {
var id = story.findContainingTiddler(place);
var command_ref = jQuery(id).find('.command_references');
(numFlag === 'true') ? command_ref.css(refAttribute,attValue).append('('+tids.length+')') : command_ref.css(refAttribute,attValue);
} //; if
} // handler
}; // config.macros
} //# end of "install only once"
/*}}}*/
/***
|''Name''|TagsplorerMacro|
|''Description''|tag-based faceted tiddler navigation|
|''Author''|FND|
|''Version''|1.3.3|
|''Status''|stable|
|''Source''|http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/TagsplorerMacro.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/contributors/FND/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.6.0|
|''Keywords''|navigation tagging|
!Usage
{{{
<<tagsplorer [exclude:<tagName>] [tag] [tag] ... >>
}}}
!!Examples
<<tagsplorer exclude:excludeLists systemConfig>>
!Revision History
!!v1.0 (2010-03-21)
* initial release
!!v1.1 (2010-03-26)
* added sorting for tag and tiddler collections
* added section headings
* adjusted styling
!!v1.2 (2010-03-27)
* added exclude parameter for excludeLists support
!!v1.3 (2010-03-29)
* added automatic scrolling after tag selection
!To Do
* refresh handling
* "open all" functionality
* animations for new/removed tags/tiddlers (requires array diff'ing)
!StyleSheet
.tagsplorer {
border: 1px solid [[ColorPalette::TertiaryLight]];
padding: 5px;
background-color: [[ColorPalette::TertiaryPale]];
}
.tagsplorer h3,
.tagsplorer ul {
margin: 0;
padding: 0;
}
.tagsplorer h3 {
margin: 0 -5px;
padding: 0 5px;
border: none;
}
.tagsplorer h3.tags {
float: left;
margin-right: 1em;
}
.tagsplorer h3.tiddlers {
margin-top: 5px;
border-top: 1px solid [[ColorPalette::TertiaryLight]];
padding-top: 5px;
}
.tagsplorer .tagSelection {
overflow: auto;
list-style-type: none;
}
.tagsplorer .tagSelection li {
float: left;
}
.tagsplorer .tagSelection li a.tag {
border: 1px solid [[ColorPalette::TertiaryLight]];
border-top-right-radius: 0.7em;
-webkit-border-top-right-radius: 0.7em;
-moz-border-radius-topright: 0.7em;
border-bottom-right-radius: 0.7em;
-webkit-border-bottom-right-radius: 0.7em;
-moz-border-radius-bottomright: 0.7em;
padding: 0 0.5em 0 0.3em;
}
.tagsplorer .tiddlerList {
margin-left: 1.5em;
}
!Code
***/
//{{{
(function($) {
config.shadowTiddlers.StyleSheetTagsplorer = store.getTiddlerText(tiddler.title + "##StyleSheet");
store.addNotification("StyleSheetTagsplorer", refreshStyles);
var macro = config.macros.tagsplorer = {};
config.macros.tagsplorer = $.extend(macro, {
locale: {
tagsLabel: "Tags",
tiddlersLabel: "Tiddlers",
newTagLabel: "[+]",
newTagTooltip: "add tag to filter",
delTagTooltip: "remove tag from filter",
noTagsLabel: "N/A",
noTiddlersLabel: "N/A"
},
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
var prms = paramString.parseParams("anon", null, true);
var excludeTag = getParam(prms, "exclude", null);
var tags = prms[0].anon || [];
var tiddlers = getTiddlers(tags, excludeTag);
var container = $('<div class="tagsplorer" />').
append('<h3 class="tags" />').children(":last").
text(this.locale.tagsLabel).end().
append('<ul class="tagSelection" />').
append('<h3 class="tiddlers" />').children(":last").
text(this.locale.tiddlersLabel).end().
append('<ul class="tiddlerList" />').
data("excludeTag", excludeTag);
macro.refreshTags(tags, container);
macro.refreshTiddlers(tiddlers, container);
container.appendTo(place);
},
newTagClick: function(ev) {
var btn = $(this);
var container = btn.closest(".tagsplorer");
var tags = container.find(".tagSelection").data("tags");
var tiddlers = container.find(".tiddlerList").data("tiddlers");
var tagSelection = getTagSelection(tiddlers, tags);
var popup = Popup.create(this, "ul");
if(tagSelection.length) {
$.each(tagSelection, function(i, tag) {
createTagElement(popup, tag, macro.locale.newTagTooltip, macro.onTagClick);
});
} else {
createTagElement(popup, macro.locale.noTagsLabel);
}
$(popup).data({
container: container,
tags: tags,
tiddlers: tiddlers
});
Popup.show();
ev.stopPropagation();
return false;
},
onTagClick: function(ev) {
var btn = $(this);
var popup = btn.closest(".popup");
var data = popup.data();
var tag = btn.text();
data.tags.pushUnique(tag);
data.tiddlers = filterTiddlers(data.tiddlers, tag);
if(config.options.chkAnimate && anim && typeof Scroller == "function") {
anim.startAnimating(new Scroller(data.container[0]));
} else {
window.scrollTo(0, ensureVisible(data.container[0]));
}
macro.refreshTags(data.tags, data.container);
macro.refreshTiddlers(data.tiddlers, data.container);
return !ev.ctrlKey;
},
delTag: function(ev) {
var btn = $(this);
var container = btn.closest(".tagsplorer");
var tags = container.find(".tagSelection").data("tags");
tags.remove(btn.text());
var tiddlers = getTiddlers(tags, container.data("excludeTag"));
btn.parent().remove();
macro.refreshTags(tags, container);
macro.refreshTiddlers(tiddlers, container);
return false;
},
refreshTags: function(tags, container) {
var orig = container.find(".tagSelection");
var clone = orig.clone().empty();
clone.data("tags", tags);
var self = this;
$.each(tags, function(i, tag) {
createTagElement(clone, tag, self.locale.delTagTooltip, self.delTag, "tag");
});
createTagElement(clone, this.locale.newTagLabel, this.locale.newTagTooltip, this.newTagClick).
addClass("button");
orig.replaceWith(clone);
},
refreshTiddlers: function(tiddlers, container) {
var orig = container.find(".tiddlerList");
var clone = orig.clone().empty();
clone.data("tiddlers", tiddlers);
if(tiddlers.length) {
$.each(tiddlers, function(i, tiddler) {
var el = $("<li />").appendTo(clone)[0];
createTiddlyLink(el, tiddler.title, true);
});
} else {
$("<li />").text(macro.locale.noTiddlersLabel).appendTo(clone);
}
orig.replaceWith(clone);
}
});
var getTiddlers = function(tags, excludeTag) {
var tiddlers = store.getTiddlers("title", excludeTag);
for(var i = 0; i < tags.length; i++) {
tiddlers = filterTiddlers(tiddlers, tags[i]);
}
return tiddlers;
};
var filterTiddlers = function(tiddlers, tag) {
return $.map(tiddlers, function(item, i) {
if(item.tags.contains(tag)) {
return item;
}
});
};
var getTagSelection = function(tiddlers, exclude) {
var tags = [];
for(var i = 0; i < tiddlers.length; i++) {
var _tags = tiddlers[i].tags;
for(var j = 0; j < _tags.length; j++) {
var tag = _tags[j];
if(!exclude.contains(tag)) {
tags.pushUnique(tag);
}
}
}
return tags.sort();
};
var createTagElement = function(container, label, tooltip, action, className) {
var el = $("<li />").appendTo(container);
return $('<a href="javascript:;" />').
addClass(className || "").
attr("title", tooltip || "").
text(label).
click(action || null).
appendTo(el);
};
})(jQuery);
//}}}
/***
|''Name''|ColorfulToolbarPlugin|
|''Description''|Change color of reference button in toolbar if there are references / backlinks to the tiddler|
|''Authors''|see Related to|
|''Version''|0.0.3|
|''Date''|2010-05-29|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#ColorfulToolbarPlugin|
|''License''|<...>|
|''CoreVersion''|2.5|
|''Documentation''|included|
|''Related to''|http://groups.google.com/group/tiddlywiki/browse_thread/thread/508b5fc7730e2372?hl=en|
|''Keywords''|change color, references, toolbar|
!!!Description
<<<
This script is an attempt to color ‘references’ in the toolbar red if the tiddler has references.
<<<
!!!Notes
<<<
To see, what it does click the "more" button at the toolbar!
<<<
!!!Usage
<<<
!!!!Standard
{{{
<<colorfulReferences>>
}}}
!!!!ViewTemplate
{{{
<span class='test' macro='colorfulReferences' ></span>
}}}
<<<
!!!Parameters
<<<
none
<<<
!!!Examples
<<<
{{{
<<colorfulReferences>>
}}}
<<colorfulReferences>>
<<<
!!!Configuration Options
<<<
none
<<<
!!!Revision History
<<<
V 0.0.3 - 2010-05-29
* initial Release
<<<
!!!To Do
<<<
<...>
<<<
!!!Code
***/
/*{{{*/
if(!version.extensions.ColorfulToolbarPlugin) { //# ensure that the plugin is only installed once
version.extensions.ColorfulToolbarPlugin = { installed: true };
config.macros.colorfulReferences = {
handler: function (place, macroName, params, wikifier,paramString, tiddler) {
var refAttribute = 'color';
var refColor = 'red';
var tids = store.getReferringTiddlers(tiddler.title);
if (tids.length > 0) {
var id = story.findContainingTiddler(place);
jQuery(id).find('.command_references').css(refAttribute,refColor);
} //; if
} // handler
}; // config.macros
} //# end of "install only once"
/*}}}*/
! Disabled
/*{{{*/
<html>
<a name="wavethis_link" href="https://wave.google.com/wave/wavethis?&t=New+Post&c=I+was+thinking..."
target="_blank"><img src="http://wave.google.com/wavethis/icon16.png" /></a>
</html>
/*}}}*/
/***
|''Name''|BinaryTiddlersPlugin|
|''Description''|renders base64-encoded binary tiddlers as images or links|
|''Author''|FND|
|''Version''|0.3.2|
|''Status''|@@beta@@|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/plugins/BinaryTiddlersPlugin.js|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.5|
!Code
***/
//{{{
(function($) {
var ctfield = "server.content-type";
var plugin = config.extensions.BinaryTiddlersPlugin = {
isWikiText: function(tiddler) {
var ctype = tiddler.fields[ctfield];
if(ctype) {
return !this.isBinary(tiddler) && !this.isTextual(ctype);
} else {
return true;
}
},
// NB: pseudo-binaries are considered non-binary here
isBinary: function(tiddler) {
var ctype = tiddler.fields[ctfield];
return ctype ? !this.isTextual(ctype) : false;
},
isTextual: function(ctype) {
return ctype.indexOf("text/") == 0
|| this.endsWith(ctype, "+xml")
|| ctype == 'application/json'
|| ctype == 'application/javascript';
},
endsWith: function(str, suffix) {
return str.length >= suffix.length &&
str.substr(str.length - suffix.length) == suffix;
},
isLink: function(tiddler) {
return this.isBinary(tiddler) && tiddler.text.indexOf("<html>") != -1
}
};
// Disable edit for linked tiddlers (for now)
// This will be changed to a GET then PUT
config.commands.editTiddler.isEnabled = function(tiddler) {
var existingTest = config.commands.editTiddler.isEnabled;
if (existingTest) {
return existingTest && !plugin.isLink(tiddler);
} else {
return !plugin.isLink(tiddler);
}
};
// hijack text viewer to add special handling for binary tiddlers
var _view = config.macros.view.views.wikified;
config.macros.view.views.wikified = function(value, place, params, wikifier,
paramString, tiddler) {
var ctype = tiddler.fields["server.content-type"];
if(params[0] == "text" && ctype && !tiddler.tags.contains("systemConfig") && !plugin.isLink(tiddler)) {
var el;
if(plugin.isBinary(tiddler)) {
var uri = "data:%0;base64,%1".format([ctype, tiddler.text]); // TODO: fallback for legacy browsers
if(ctype.indexOf("image/") == 0) {
el = $("<img />").attr("alt", tiddler.title).attr("src", uri);
} else {
el = $("<a />").attr("href", uri).text(tiddler.title);
}
} else {
el = $("<pre />").text(tiddler.text);
}
el.appendTo(place);
} else {
_view.apply(this, arguments);
}
};
// hijack edit macro to disable editing of binary tiddlers' body
var _editHandler = config.macros.edit.handler;
config.macros.edit.handler = function(place, macroName, params, wikifier,
paramString, tiddler) {
if(params[0] == "text" && plugin.isBinary(tiddler)) {
return false;
} else {
_editHandler.apply(this, arguments);
}
};
// hijack autoLinkWikiWords to ignore binary tiddlers
var _autoLink = Tiddler.prototype.autoLinkWikiWords;
Tiddler.prototype.autoLinkWikiWords = function() {
return plugin.isWikiText(this) ? _autoLink.apply(this, arguments) : false;
};
})(jQuery);
//}}}
|400|3|here is a field of different length|
|401|3|here is a field of xxx length|
|402|3|here is a field of xx length|
|403|3|here is a field of xxxxxxxxx length|
|404|3|here is a field of xxxxxxxxxxxxxxxx length|
|405|3|here is a field|
t:
<<tiddler [[AddTagWithScript##qwe2]] with:{{store.getTiddlerText('AddTagWithScript##qwe1')}}>>
d:
<<tiddler [[AddTagWithScript##qwe2]] with:"foo,bar,[[baz x]],qweq">>
!qwe1
foo,[[bar x]],baz,qweq
!!!!!!end
/%
!qwe2
<script>
var strTagList = "$1";
var arrTags = strTagList.split(",");
//console.log(arrTags);
var i;
for (i=0;i<arrTags.length;i++) {
wikify( "<<addTag "+arrTags[i]+">><br />", place);
}
</script>
!end
%/
<<timeline "modified" "17" "YYYY-0MM-0DD">>
/%
!!22 July 2010
*ToggleLeftSidebarEm and ToggleRightSidebarEm included
**The work similar to the TiddlyTools toggle buttons but they __only__ work with [[FreeStyle|http://freestyle.tiddlyspot.com/]] Themes and EmasticSystem Framework.
!!28 June 2010
*RevisionsCommandPlugin now displays the custom field "revision.text"
**There is a second possibility to edit the field, by editing the ~EditTemplate
*New plugin RevisionsCommandEditSaveHj which prompts for "revision.text"
%/
/***
|Name:|SelectThemePlugin|
|Description:|Lets you easily switch theme and palette|
|Version:|1.0.1 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SelectThemePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
* Borrows largely from ThemeSwitcherPlugin by Martin Budden http://www.martinswiki.com/#ThemeSwitcherPlugin
* Theme is cookie based. But set a default by setting config.options.txtTheme in MptwConfigPlugin (for example)
* Palette is not cookie based. It actually overwrites your ColorPalette tiddler when you select a palette, so beware.
!Usage
* {{{<<selectTheme>>}}} makes a dropdown selector
* {{{<<selectPalette>>}}} makes a dropdown selector
* {{{<<applyTheme>>}}} applies the current tiddler as a theme
* {{{<<applyPalette>>}}} applies the current tiddler as a palette
* {{{<<applyTheme TiddlerName>>}}} applies TiddlerName as a theme
* {{{<<applyPalette TiddlerName>>}}} applies TiddlerName as a palette
***/
//{{{
config.macros.selectTheme = {
label: {
selectTheme:"select theme",
selectPalette:"select palette"
},
prompt: {
selectTheme:"Select the current theme",
selectPalette:"Select the current palette"
},
tags: {
selectTheme:'systemTheme',
selectPalette:'systemPalette'
}
};
config.macros.selectTheme.handler = function(place,macroName)
{
var btn = createTiddlyButton(place,this.label[macroName],this.prompt[macroName],this.onClick);
// want to handle palettes and themes with same code. use mode attribute to distinguish
btn.setAttribute('mode',macroName);
};
config.macros.selectTheme.onClick = function(ev)
{
var e = ev ? ev : window.event;
var popup = Popup.create(this);
var mode = this.getAttribute('mode');
var tiddlers = store.getTaggedTiddlers(config.macros.selectTheme.tags[mode]);
// for default
if (mode == "selectPalette") {
var btn = createTiddlyButton(createTiddlyElement(popup,'li'),"(default)","default color palette",config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',"(default)");
btn.setAttribute('mode',mode);
}
for(var i=0; i<tiddlers.length; i++) {
var t = tiddlers[i].title;
var name = store.getTiddlerSlice(t,'Name');
var desc = store.getTiddlerSlice(t,'Description');
var btn = createTiddlyButton(createTiddlyElement(popup,'li'), name?name:t, desc?desc:config.macros.selectTheme.label['mode'], config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',t);
btn.setAttribute('mode',mode);
}
Popup.show();
return stopEvent(e);
};
config.macros.selectTheme.onClickTheme = function(ev)
{
var mode = this.getAttribute('mode');
var theme = this.getAttribute('theme');
if (mode == 'selectTheme')
story.switchTheme(theme);
else // selectPalette
config.macros.selectTheme.updatePalette(theme);
return false;
};
config.macros.selectTheme.updatePalette = function(title)
{
if (title != "") {
store.deleteTiddler("ColorPalette");
if (title != "(default)")
store.saveTiddler("ColorPalette","ColorPalette",store.getTiddlerText(title),
config.options.txtUserName,undefined,"");
refreshAll();
if(config.options.chkAutoSave)
saveChanges(true);
}
};
config.macros.applyTheme = {
label: "apply",
prompt: "apply this theme or palette" // i'm lazy
};
config.macros.applyTheme.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
var useTiddler = params[0] ? params[0] : tiddler.title;
var btn = createTiddlyButton(place,this.label,this.prompt,config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',useTiddler);
btn.setAttribute('mode',macroName=="applyTheme"?"selectTheme":"selectPalette"); // a bit untidy here
}
config.macros.selectPalette = config.macros.selectTheme;
config.macros.applyPalette = config.macros.applyTheme;
config.macros.refreshAll = { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
createTiddlyButton(place,"refresh","refresh layout and styles",function() { refreshAll(); });
}};
//}}}
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/e028c2aaa8017175?hl=en
{{{
<html>
<div macro='tiddler "Echo##code" thumbnails with: {{tiddler.title}}'></div>
</html>
}}}
<html>
<div macro='tiddler "Echo##code" thumbnails with: {{tiddler.title}}'></div>
</html>
{{{
!code
Hello $1
Test: $1
!end
}}}
{{{
<<colorfulReferences>>
}}}
<<colorfulReferences>>
!!!!reference
http://groups.google.com/group/tiddlywiki/browse_thread/thread/12a884a6723be0b0?hl=en
|@@background:red; some text@@| http://tiddlywiki.org/wiki/TiddlyWiki_Markup|
|''Name:''|[[TWTopListTheme]]|
|''Description:''|Your description here!|
|''Generator:''|[[TW FreeStyle|http://FreeStyle.tiddlyspot.com]]|
|''Gen.Description:''|Automatically generated from: TWTopListTheme|
|''PageTemplate:''|##PageTemplate|
|''ViewTemplate:''|##ViewTemplate|
|''EditTemplate:''|##EditTemplate|
|''StyleSheet:''|##StyleSheet|
!PageTemplate
<!--{{{-->
<!-- RowTwHeader -->
<div class='dp100'>
<!-- ColTwTitle -->
<div class='dp100'>
<!-- BoxTWHeader -->
<!-- defines the TW header. Comes from PageTemplate -->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
</div>
</div> <!-- rows are allways 100% -->
<div class='clear'></div> <!-- do not delete this! -->
<!-- RowTWTopList -->
<div class='dp100'>
<!-- ColTWTopList -->
<div class='viewer dp100'>
<!-- BoxTWTopList -->
<div class='box outer' refresh='content' tiddler='TopListC'></div>
</div>
</div> <!-- rows are allways 100% -->
<div class='clear'></div> <!-- do not delete this! -->
<!-- RowTwBody -->
<div class='dp100'>
<!-- ColTWMainMenu -->
<div class='dp15'>
<!-- BoxTWMainMenu -->
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
</div>
<!-- ColTWDisplayArea -->
<div id='displayArea' class='dp70'>
<!-- BoxTWMessageArea -->
<div id='messageArea'></div>
<!-- BoxTWTiddlerDisplay -->
<div id='tiddlerDisplay'></div>
</div>
<!-- ColTWSidebar -->
<div id='sidebar' class='dp15 dpfr' style='width:15%; position:relative;'>
<!-- BoxTWSidebarOptions -->
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<!-- BoxTWSidebarTabs -->
<div id='sidebarTabs' refresh='content' force='true' tiddler='CSideBarTabs'></div>
</div>
</div> <!-- rows are allways 100% -->
<div class='clear'></div> <!-- do not delete this! -->
<!--}}}-->
!ViewTemplate
<!--{{{-->
<!-- TwViewTemplate -->
<div class='dp100'>
<!-- BoxVT_TwToolbar -->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<!-- BoxVT_TwTitle -->
<div class='title' macro='view title'></div>
<!-- BoxVT_TwSubtitle -->
<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>
<!-- BoxVT_TwTagged -->
<div class='tagged' macro='tags'></div>
<!-- BoxVT_TwTagging -->
<div class='tagging' macro='tagging'></div>
<!-- BoxVT_TWBody -->
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
</div>
<!--}}}-->
!EditTemplate
<!--{{{-->
<!-- TwEditTemplate -->
<div class='dp100'>
<!-- BoxET_TwEditToolbar -->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<!-- BoxET_TwTitle -->
<div class='title' macro='view title'></div>
<!-- BoxET_TWEditTitle -->
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<!-- BoxET_TwEditBody -->
<div class='editor' macro='edit text'></div>
<!-- BoxET_TwTagging -->
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
</div>
<!--}}}-->
!StyleSheet
/*{{{*/
/*-- new in emastic --*/
/* left main menu stuff */
#mainMenu {
width:auto; /*-- new in emastic --*/
position:relative; /*-- new in emastic --*/
text-align:right;
line-height:1.6em;
padding:1.5em 0.5em 0.5em 0.5em;
font-size:1.1em;
}
#sidebarTabs .tabContents{
margin: 0 0.5em; /* new for emastic */
width: auto;
}
#displayArea {
float: left; /*-- new for emastic --*/
padding: 0; /*-- new for emastic --*/
margin: 0; /*-- new for emastic --*/
}
/***
This fixes a problem with the tabs slider
***/
#sidebarTabs .button {
margin:0em 0.2em;
padding:0.2em 0.3em;
display:inline-block;
}
/*-- emastic System --*/
[[EmasticSystem]]
[[EmFreeStyle]]
/*-- call the standard StyleSheet --*/
[[StyleSheet]]
/*}}}*/
!Definitions
<<tiddler OpenTaggedTiddlers with: "Open these" "$1 AND #Definition AND NOT #archived" modified reverse close>>
----
<<matchTags inline " • [[%0]]" "\n" sort:"-modified" "$1 AND #Definition AND NOT #archived">>
!
<<tabs txt$1
[[$1 Definitions]] "Definitions of $1" "TabTemplate##Definitions"
>>
<<slider chkSliderSideBarTabs SideBarTabs "Index »" "display the timeline">>
/***
|''Name''|PublishCommand|
|''Version''|0.2 mp03|
|''Status''|beta|
|''Date''|2010-06-29|
|''Author''|BenGillies|
|''Contributors''|Mario Pietsch|
|''Description''|Publish a tiddler by moving or copying it from one bag to another|
!!!!Usage
<<<
Add {{{publishtiddler}}} to your ToolbarCommands tiddler.
<<<
!!!!How it works
<<<
*check for custom field name. This has to be handled by program. ListboxPlugin will work
*check for config.options.fieldName - This has to be handled by program
*check for config.options.txtfieldName - {{{<<option txtpublishtobag>>}}} works or go for tiddlyTools ListboxPlugin
*check for PublishConfig slices - see shadow tiddler. Nothing special has to be done.
**You can override the default bag to publish to, and the default publishing mechanism in the PublishConfig shadow tiddler.
<<<
!!!!Options
<<<
Options for publishlevel are:
*copy
*move
<<<
!!!!Requires
<<<
TiddlyWeb - http://tiddlyweb.com
chrjs - http://github.com/tiddlyweb/chrjs/raw/master/main.js
<<<
***/
//{{{
config.shadowTiddlers['PublishConfig'] = '|publishtobag|common|\n|publishlevel|copy|\n\npublishtobag .. Rename "common" too your needs.\npublishlevel .. copy or move';
config.commands.publishtiddler = {
text: "publish",
tooltip: "publish this so everyone can see it",
confirmMsg: "Are you sure you want to publish this tiddler?\n\n",
tiddlerFieldTxt: "Custom tiddler field [%0]: %1",
configOptionsTxt: "config.options.%0: %1",
configOptionsTxtTxt: "config.options.txt%0: %1",
publishConfigTxt: "PublishConfig slice [%0]: %1",
errorMsg: "not defined",
saveFirstMsg: "Please save this first!",
noPublishLvlTxt: "no publish level set!",
incorrectPublishLvlTxt: "Incorrect publish level set.",
errorPublish: "Error publishing %0.",
successfullyCopiedTxt: "%0 successfully copied to %1.",
successfullyMovedTxt: "%0 successfully moved to %1.",
errorRemoveCopyOkTxt: "Error removing %0 from %1. It was successfully copied to %2.",
getPublishInfo: function (fieldName, tid) {
var param = {}
if (tid.fields[fieldName]) {
param.text = tid.fields[fieldName];
param.typeText = this.tiddlerFieldTxt.format([fieldName, param.text]);
}
else if (config.options[fieldName]) {
param.text = config.options[fieldName];
param.typeText = this.configOptionsTxt.format([fieldName, param.text]);
}
else if (config.options['txt'+fieldName]) {
param.text = config.options['txt'+fieldName];
param.typeText = this.configOptionsTxtTxt.format([fieldName, param.text]);
}
else {
param.text = store.getTiddlerSlice('PublishConfig', fieldName) || ccp.errorMsg;
param.typeText = this.publishConfigTxt.format([fieldName, param.text]);
}
return param;
},
handler: function(event,src,title) {
var t = store.getTiddler(title);
if(!t){
alert(this.saveFirstMsg);
}
var bP = this.getPublishInfo('publishtobag',t)
var lvlP = this.getPublishInfo('publishlevel',t)
var publishToBag = bP.text;
var publishLevel = lvlP.text;
// confirm here to get a better message
if (!confirm(this.confirmMsg + bP.typeText + '\n'+ lvlP.typeText)) {
return false;
}
if(publishLevel) {
try {
this.publish(t, publishLevel, publishToBag, function(successMessage) {
displayMessage(successMessage);
}, function(errorMessage) {
displayMessage(errorMessage);
});
} catch(e) {
displayMessage(e);
}
} else {
alert(this.noPublishLvlTxt);
}
},
publish: function(tid, publishLevel, publishToBag, callback, errBack) {
var newTiddler = new tiddlyweb.Tiddler(tid.title, new tiddlyweb.Bag(publishToBag, config.defaultCustomFields['server.host']));
newTiddler.tags = tid.tags;
newTiddler.modified = tid.modified.convertToYYYYMMDDHHMM() + '00';
newTiddler.created = tid.created.convertToYYYYMMDDHHMM() + '00';
newTiddler.modifier = tid.modifier;
newTiddler.fields = merge({}, tid.fields);
newTiddler.text = tid.text;
newTiddler.put(function() {
var ccp = config.commands.publishtiddler;
if (publishLevel === 'copy') {
callback(ccp.successfullyCopiedTxt.format([newTiddler.title, newTiddler.bag.name]));
return;
} else if (publishLevel === 'move') {
//delete the original tiddler
if (tid.fields['server.bag']) {
newTiddler.bag = new tiddlyweb.Bag(tid.fields['server.bag'], config.defaultCustomFields['server.host']);
} else {
var container = tid.fields['server.workspace'].split('/');
if (container === 'recipes') {
newTiddler.bag = null;
newTiddler.recipe = new tiddlyweb.Recipe(container[1], config.defaultCustomFields['server.host']);
} else {
newTiddler.bag = new tiddlyweb.Bag(container[1], config.defaultCustomFields['server.host']);
}
}
newTiddler['delete'](function() {
var containerName = newTiddler['bag'] ? newTiddler.bag.name : newTiddler.recipe.name;
callback(ccp.successfullyMovedTxt.format([newTiddler.title, publishToBag]));
newTiddler.bag = new tiddlyweb.Bag(publishToBag, config.defaultCustomFields['server.host']);
newTiddler.get(function(data) {
var newRevision = data.revision;
var newWorkspace = 'bags/' + publishToBag;
var newT = store.getTiddler(newTiddler.title);
var newFields = merge({}, newT.fields);
newFields['server.page.revision'] = newRevision;
newFields['server.workspace'] = newWorkspace;
newFields['server.bag'] = publishToBag;
delete newFields['server.recipe'];
newT.fields = merge({}, newFields);
var dirty = store.isDirty();
store.saveTiddler(newT.title, newT.title, newT.text, newT.modifier, newT.modified, newT.tags, newT.fields, true, newT.created, newT.creator);
story.setDirty(newT.title);
if (!dirty) store.setDirty(false);
});
}, function() {
//errBack('Error removing ' + newTiddler.title + ' from ' + containerName + '. It was successfully copied to ' + publishToBag + '.');
errBack(ccp.errorRemoveCopyOkTxt.format([newTiddler.title, containerName, publishToBag])); //Mp not tested
});
} else {
errBack(ccp.incorrectPublishLvlTxt);
}
}, function() {
errBack(ccp.errorPublish.format([newTiddler.title]));
});
}
};
//}}}
<<addTag "hello" >>
This tiddler is needed for AddTagPluginExperiment
/*{{{*/
/*
Malo - CSS Library
Author:Vladimir Carrer
Version: 1.0 (beta)
Source/License: http://code.google.com/p/malo/
*/
/* CSS Reset */
/* not needed for TiddlyWiki
html, body, div, p{
margin: 0;
padding: 0;
border: 0;
}
*/
/* CSS Grid */
/*
For center layout
Define your default width in %, px or em
.main { margin:0 auto; width:85%;}
*/
.dp20,
.dp25,
.dp33,
.dp50,
.dp100{float:left; display: inline; *margin-left:-0.04em; } /* IE margin hack */
.dpfr{float:right;}
/* dp = div percet */
.dp20{width:20%;}
.dp25{width:25%;}
.dp33{width:33.33%;}
.dp50{width:50%;}
.dp100{width:100%;}
.clear{ clear:both;}
/*}}}*/
Hi Folks,
!What's new
goto [[What's new]]
!Use case
It could be the HowTo use functions described at [[TiddlyWiki Reference|http://hoster.peermore.com/recipes/TiddlyWikiPatterns/tiddlers.wiki]]. So things can be nicely seperated!
!Info
This is a little test case, to have collaborative TW tweaking, using someone elses public (protected) and public bags.
At the top box, there is a typeWithMe editor. I thought it could be usfull. (And it is fun!)
!How to use it
*If you don't like my theme, use your own.
*You only need to enter my bags [[TeamPub|http://hoster.peermore.com/bags/TeamPub/tiddlers]], [[TeamPubMp|http://hoster.peermore.com/bags/TeamPubMp/tiddlers]]
*Make them your favorite.
*Add them to your hoster public recipe.
*That's it.
*Tell me, where your protected bag is, that I can include it here.
Have Fun!
Mario
Name: MpBlue
Background: #ffd
Foreground: #000
PrimaryPale: #ccd
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
<<tiddler [[TiddlerMapTabsAZ##Tabs]] with: 4>>
/%
!Tabs
<<tabs txtTiddlerMapTabsAZ
A 'list "A" tiddlers' [[TiddlerMapAZ$1::A]]
B 'list "B" tiddlers' [[TiddlerMapAZ$1::B]]
C 'list "C" tiddlers' [[TiddlerMapAZ$1::C]]
D 'list "D" tiddlers' [[TiddlerMapAZ$1::D]]
E 'list "E" tiddlers' [[TiddlerMapAZ$1::E]]
F 'list "F" tiddlers' [[TiddlerMapAZ$1::F]]
G 'list "G" tiddlers' [[TiddlerMapAZ$1::G]]
H 'list "H" tiddlers' [[TiddlerMapAZ$1::H]]
I 'list "I" tiddlers' [[TiddlerMapAZ$1::I]]
J 'list "J" tiddlers' [[TiddlerMapAZ$1::J]]
K 'list "K" tiddlers' [[TiddlerMapAZ$1::K]]
L 'list "L" tiddlers' [[TiddlerMapAZ$1::L]]
M 'list "M" tiddlers' [[TiddlerMapAZ$1::M]]
N 'list "N" tiddlers' [[TiddlerMapAZ$1::N]]
O 'list "O" tiddlers' [[TiddlerMapAZ$1::O]]
P 'list "P" tiddlers' [[TiddlerMapAZ$1::P]]
Q 'list "Q" tiddlers' [[TiddlerMapAZ$1::Q]]
R 'list "R" tiddlers' [[TiddlerMapAZ$1::R]]
S 'list "S" tiddlers' [[TiddlerMapAZ$1::S]]
T 'list "T" tiddlers' [[TiddlerMapAZ$1::T]]
U 'list "U" tiddlers' [[TiddlerMapAZ$1::U]]
V 'list "V" tiddlers' [[TiddlerMapAZ$1::V]]
W 'list "W" tiddlers' [[TiddlerMapAZ$1::W]]
X 'list "X" tiddlers' [[TiddlerMapAZ$1::X]]
Y 'list "Y" tiddlers' [[TiddlerMapAZ$1::Y]]
Z 'list "Z" tiddlers' [[TiddlerMapAZ$1::Z]]
0-9 'list "0-9" tiddlers' [[TiddlerMapAZ$1::0to9]]
>>
!!!end
%/
/***
!Description
!CSS
***/
/*{{{*/
/* Just name all ID elements you will need in your site
Emastic suports DIV inside DIV with same width.
<div id="sideNav">
<div class="dl20"> Hello World! </div>
<div class="dl10"> Hello CSS! </div>
<div>
*/
/*
#header, #sideNav, #footer {float:left; display:inline;}
*/
/*}}}*/
custom field: "order" is: <<view order>>
<<view modified>>
Name: MpGreen
Background: #cec
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
.dpfr{float:right;}
/*}}}*/
/***
***/
/*{{{*/
(function($) { //# set up alias
// create macro object
config.macros.listnav = {
// Add a handler function to be invoked by <<listnav TiddlerTitle>>
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
// target tiddler passed in as macro parameter
var title = params[0];
// read list items from tiddler contents
var text = store.getTiddlerText(title);
if(text) {
// generate nav bar
$("<div />").attr("id", "listnav-nav").appendTo(place);
// generate list
var items = text.split("\n");
var list = $("<ul />").attr("id", "listnav").appendTo(place);
$.each(items, function(i, itm) {
console.log('i: ' + i, 'itm: ', itm); // <------
$("<li />").text(itm).appendTo(list);
});
// apply listnav
list.listnav();
}
}
};
// add default styles (adapted from http://www.ihwy.com/labs/downloads/jquery-listnav/2.0/listnav.css)
config.shadowTiddlers.StyleSheetListNav = "/*{{{*/\n" +
"#listnav-nav { margin: 20px 0 10px; }\n" +
".ln-letters { overflow: hidden; }\n" +
".ln-letters a { font-size: 0.9em; display: block; float: left; padding: 2px 6px; border: 1px solid #eee; border-right: none; text-decoration: none; }\n"+
".ln-letters a.ln-last { border-right: 1px solid #eee; }\n" +
".ln-letters a:hover, .ln-letters a.ln-selected { background-color: #eaeaea; }\n" +
".ln-letters a.ln-disabled { color: #ccc; }\n" +
".ln-letter-count { text-align: center; font-size: 0.8em; line-height: 1; margin-bottom: 3px; color: #336699; }\n" +
"/*}}}*/";
store.addNotification("StyleSheetListNav", refreshStyles);
})(jQuery);
/*}}}*/
right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text. right text.
|RelatedTo| http://groups.google.com/group/tiddlywiki/browse_thread/thread/b95de9cb062ad2a4?hl=en|
!Script
<script>
var text=store.getTiddlerText(tiddler.title+'##Section_2');
match = text.match(/^[*|#]/im);
if (match != null) {
// matched text: match[0]
// match start: match.index
// capturing group n: match[n]
return ('*found list items');
} else {
// Match attempt failed
return ('*No Items')
}
</script>
!Code
<script>
var txt=store.getTiddlerText(tiddler.title+'##Script');
return( '{{{\n' + txt +'}}}');
</script>
!!!Section_1
*List 1
*List 2
!!!Section_2
*Delete ME (Mike) to see the difference (MP)
/%
!!!end%/
!!!reference
http://groups.google.com/group/tiddlywiki/browse_thread/thread/92d30f6ed55c00c4?hl=en
!!!Important
*InlineJavascriptPlugin is needed, that the following examples work.
!!!Test
<<tiddler {{tiddler.title+"##code"}} with: {{tiddler.title}}>>
{{{
<<tiddler "Your script tiddler" with: {{tiddler.title}}>>
!code
<script label="New Special Journal" title="Create a new Special Journal">
var alwaysTag="yourTagHere";
var alwaysTitle="Journal";
var date = new Date().formatString("YYYY-MM-0DD");
var title=(alwaysTitle + " " + date + " $1");
var tags=(alwaysTag);
store.saveTiddler(
title,
title,
"someText \nMay be empty.",
config.options.txtUserName,
new Date(),
tags);
story.displayTiddler(null,title);
</script>
!end
}}}
!Use it with ViewTemplate
You can use it with ViewTemplate. The following line is needed, near the toolbar definition.
{{{
<div class = "" macro="tiddler 'SpecialJournal##code' with: {{tiddler.title}}></div>
or
<span class = "" macro="tiddler 'SpecialJournal##code' with: {{tiddler.title}}></span>
}}}
/***
!Description
!CSS
***/
/*{{{*/
body {text-align:center;}
ol {margin-left:2em;}
/*}}}*/
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut et lectus ullamcorper est pharetra tristique at in orci. In tempus mollis tellus, id sodales felis euismod quis. Nulla ut egestas erat. Sed sapien urna, feugiat eget posuere ac, feugiat a dolor. Nulla facilisi. Quisque non nunc felis. Donec feugiat placerat quam, vitae aliquet ligula lacinia eu. Etiam mauris est, vehicula et condimentum non, convallis et nulla. Cras condimentum varius lorem, et gravida risus feugiat et. Nulla quis nulla sed sem condimentum ultricies. Ut ligula nulla, sagittis et vulputate vel, blandit non nisl. Suspendisse sagittis mattis neque, in dictum nulla euismod a. Aliquam vel mattis nibh. Phasellus scelerisque pharetra dolor, id venenatis purus facilisis ut. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non tellus orci. Fusce nec dui ac magna dignissim congue vitae eu ipsum. Cras et urna sem, vitae fringilla dui.
Vivamus iaculis ante eu diam fermentum a mattis diam pharetra. Donec ultricies leo non turpis vulputate ut fermentum ligula pulvinar. Curabitur sed odio id dui fringilla tempor sed sit amet diam. Duis vitae mauris turpis. Mauris condimentum vulputate laoreet. Ut tempor luctus mauris, nec hendrerit eros varius ut. Suspendisse dapibus elementum dolor, ac scelerisque neque luctus pulvinar. Aenean suscipit, ante ac mattis laoreet, lectus massa pulvinar lorem, tempus dignissim turpis est non purus. Suspendisse potenti. Proin fringilla commodo convallis. Mauris commodo mauris eu nunc malesuada aliquet. Curabitur ut risus nisl, at laoreet nisi. Vivamus quis eros purus, a dignissim dolor.
/*{{{*/
.dp5,
.dp10,
.dp15,
.dp20,
.dp25,
.dp30,
.dp33,
.dp35,
.dp40,
.dp45,
.dp50,
.dp55,
.dp60,
.dp65,
.dp67,
.dp70,
.dp75,
.dp80,
.dp85,
.dp90,
.dp95,
.dp100
{float:left; display: inline; }
.dp5{width:5%;}
.dp10{width:10%;*width:9.9%;}
.dp15{width:15%;*width:14.9%;}
.dp20{width:20%;*width:19.9%;}
.dp25{width:25%;*width:24.9%; }
.dp30{width:30%;*width:29.9%;}
.dp33{width:33.33%;*width:33.3%;}
.dp35{width:35%;*width:34.9%;}
.dp40{width:40%;*width:39.9%;}
.dp45{width:45%;*width:44.9%;}
.dp50{width:50%;*width:49.9%;}
.dp55{width:55%;*width:54.9%;}
.dp60{width:60%;*width:59.9%;}
.dp65{width:65%;*width:64.9%;}
.dp67{width:66.67%;*width:66.6%;}
.dp70{width:70%;*width:69.9%;}
.dp75{width:75%;*width:74.9%;}
.dp80{width:80%;*width:79.9%;}
.dp85{width:85%;*width:84.9%;}
.dp90{width:90%;*width:89.9%;}
.dp95{width:95%;*width:94.9%;}
.dp100{width:100%;*width:99.9%;}
/*}}}*/
related to: http://groups.google.com/group/tiddlywiki/browse_thread/thread/3acd43d856bc97cd?hl=en
! Code for transcluding a tiddler slice
{{{
Given that:
<<tiddler "Formulas::fx_sinx" "mqCenter">>
The first derivative is:
<<tiddler "Formulas::ffx_sinx" "mqCenter">>
}}}
! Result
Given that:
<<tiddler "Formulas::fx_sinx" "mqCenter">>
The first derivative is:
<<tiddler "Formulas::ffx_sinx" "mqCenter">>
! Code for Transcluding a Tiddler Section
{{{
!! The LaTex code for the above formula
<<tiddler "Formulas##Latex">>
}}}
! Result
!! The LaTex code for the above formula
<<tiddler "Formulas##Latex">>
{{{
<script>
var strTagList = "foo,[[bar x]],baz,qweq";
var arrTags = strTagList.split(",");
var i;
for (i=0;i<arrTags.length;i++) {
document.write(arrTags[i]+"<br/>");
}
</script>
}}}
<script>
var strTagList = "foo,[[bar x]],baz,qweq";
var arrTags = strTagList.split(",");
var i;
for (i=0;i<arrTags.length;i++) {
document.write(arrTags[i]+"<br/>");
}
</script>
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/860ca8f5546bd201?hl=en
/% Please do not use the following style definition in a production TW. Copy the .myCSS {} stuff into your StyleSheet. This is only a nice, fast test case. To have everything together in one tiddler and don't needs to change my StyleSheet :) %/
<html>
<style>
.myCSS .button {
border: 1px solid green;
display: block;
}
</style>
</html>
{{myCSS{<<slider chSliderXX "SliderButtonCSS##section1" "click me, I am a slider" "some help text">>}}}
{{{
{{myCSS{<<slider chSliderXX "SliderButtonCSS##section1" "click me, I am a slider" "some help text">>}}}
!section1
This is text inside a slider
!end
/*-- copy this to your StyleSheet --*/
.myCSS .button {
border: 1px solid green;
display: block;
}
}}}
Related to: http://groups.google.com/group/tiddlywikidev/browse_thread/thread/750414e4c68e7989?hl=en
//{{{
// Plugin Style
setStylesheet(
".custom ul {list-style: none;}\n"+
".custom ul li:before {content: '\u2B0D \u202F';}\n"+
".custom ol li:before {content: '\u2B0D \u202F';}\n"
,"dsStyles");
*ul list type
#ol list type
//}}}
<script>
setStylesheet(
".custom ul {list-style: none;}\n"+
".custom ul li:before {content: '\u2B0D \u202F';}\n"+
".custom ol li:before {content: '\u2B0D \u202F';}\n"
,"dsStyles");
</script>
{{custom{
* ul list type
# ol list type
}}}
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/67367c6a12750625?hl=en
For detailed info what it does read http://tiddlywiki.abego-software.de/#DataTiddlerPlugin documentation.
!Transclusion
{{{
1: <<tiddler {{tiddler.title + '##echo'}} with: {{DataTiddler.getData(tiddler.title, 'month')}}>>
2: <<tiddler {{tiddler.title + '##echo'}} with: {{DataTiddler.getData('TestDataTiddlerPlugin', 'amount')}}>>
}}}
!!!!needed for Transclusion
{{{
!echo
$1
!end
}}}
1: <<tiddler {{tiddler.title + '##echo'}} with: {{DataTiddler.getData(tiddler.title, 'month')}}>>
2: <<tiddler {{tiddler.title + '##echo'}} with: {{DataTiddler.getData('TestDataTiddlerPlugin', 'amount')}}>>
!~InlineJavaScript
{{{
<script>
return 'description: ' + DataTiddler.getData('TestDataTiddlerPlugin', 'descr');
</script>
}}}
<script>
return 'description: ' + DataTiddler.getData('TestDataTiddlerPlugin', 'descr');
</script>
!The Data
{{{
<data>{"month":"Dec","descr":"Restaurant","amount":35}</data>
}}}
/***
|''Name:''|XListPlugin|
|''Description:''|Provides a {{{<<xList>>}}} macro, that prepares the list for drag and drop sorting|
|''Author:''|Mario Pietsch|
|''Version:''|0.2.0|
|''Date:''|2010.08.03|
|''Status:''|''beta''|
|''Source:''|http://apm-plugins.tiddlyspot.com/#XListPlugin|
|''License''|[[MIT License]]|
|''CoreVersion:''|2.5.0|
|''Requires:''|XCaseListPlugin |
|''Documentation:''|this file|
|''Keywords:''|list extended sort filter|
!!!Description
<<<
If you call {{{ <<xList>> }}} without any parameter you will get a non sortet list of all tiddlers.
!!!!UseCase
{{{
<<xList xCase [prefix] [regExp] [tag]>>
}}}
>*prefix .. can be any string. Default is "sort."
>*regExp .. can be any valid regExp, that runs against the tiddler title. Default is "." (any char except linebreaks)
>*tag .. "[tag[myTag]]" ''If you have spaces inside the tag, it has to be covered inside double quotes !!''
{{{
eg:
<<xList xCase "sort." "." "[tag[with spaces]]">>
}}}
>The above configuration will produce a custom field named {{{sort.with.spaces}}}. Because custom fields have to be lower case and spaces are not allowed. Since the tag name is used for the custom field, one tiddler can be part of different sorted lists.
<<<
!!!ToDo
<<<
*Test together with MatchTagsPlugin
<<<
!!!History
<<<
*V 0.2.0 - 2010.08.03
**initial release
<<<
***/
/*{{{*/
config.macros.xList = {};
config.macros.xList.xCase = config.macros.list.xCase;
config.macros.xList.handler = function(place,macroName,params)
{
var type = params[0] || "xCase";
var sortField = params[1] || "sort.";
var tag = params[2] || ".";
var tag = params[3] || "";
tag = tag.toLowerCase();
sortField = sortField.toLowerCase();
var match = tag.match(/tag *\[(.+) *\] *\]/im); // get the tag text
if (match != null) tag = match[1];
var res = tag.replace(/^\s+|\s+$/g, ""); // remove whitespace start and end
if (res != null) tag = res;
res = tag.replace(/ +/g, "."); // replace spaces with a dot
if (res != null) tag = res;
params[1] = sortField+tag;
var list = document.createElement("ul");
list.setAttribute('class', 'xList');
list.setAttribute('tag', tag);
list.setAttribute('sortfield', sortField);
place.appendChild(list);
if(this[type].prompt) {
createTiddlyElement(list,"li",null,"listTitle",this[type].prompt);
}
var results;
if(this[type].handler) {
// console.log('params: ', params)
results = this[type].handler(params);
}
var li;
for(var t = 0; t < results.length; t++) {
li = document.createElement("li");
li.setAttribute('id', typeof results[t] == "string" ? results[t] : results[t].title);
list.appendChild(li);
createTiddlyLink(li,typeof results[t] == "string" ? results[t] : results[t].title,true);
}
};
/*}}}*/
{{dp100{<<tagsplorer tagsearch>>}}}
goto
<<gotoTiddler>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
/***
!Description
!CSS
***/
/*{{{*/
.main {
width:70em;margin:0 auto;text-align:left; }
.clear {clear:both;}
.dl1,
.dl2,
.dl5,
.dl10,
.dl15,
.dl20,
.dl25,
.dl30,
.dl35,
.dl40,
.dl45,
.dl50,
.dl55,
.dl60,
.dl65,
.dl70,
.dl75{float:left; display: inline; }
.dr1,
.dr2,
.dr5,
.dr10,
.dr15,
.dr20,
.dr25,
.dr30,
.dr35,
.dr40,
.dr45,
.dr50,
.dr55,
.dr60,
.dr65,
.dr70,
.dr75
{float:right; display: inline; }
.dl1, .dr1 {width:1em;}
.dl2, .dr2 {width:2em;}
.dl5, .dr5{width:5em;}
.dl10, .dr10{width:10em;}
.dl15, .dr15{width:15em;}
.dl20, .dr20{width:20em;}
.dl25, .dr25{width:25em;}
.dl30, .dr30{width:30em;}
.dl35, .dr35{width:35em;}
.dl40, .dr40{width:40em;}
.dl45, .dr45{width:45em;}
.dl50, .dr50{width:50em;}
.dl55, .dr55{width:55em;}
.dl60, .dr60{width:60em;}
.dl65, .dr65{width:65em;}
.dl70, .dr70{width:70em;}
.dl75, .dr75{width:75em;}
.ml5{margin-left:5em;}
.ml10{margin-left:10em;}
.ml15{margin-left:15em;}
.ml20{margin-left:20em;}
.ml25{margin-left:25em;}
.ml30{margin-left:30em;}
.ml35{margin-left:35em;}
.ml40{margin-left:40em;}
.ml45{margin-left:45em;}
.ml50{margin-left:50em;}
.ml55{margin-left:55em;}
.ml60{margin-left:60em;}
.ml65{margin-left:65em;}
.ml70{margin-left:70em;}
.ml75{margin-left:75em;}
.mr5{margin-right:5em;}
.mr10{margin-right:10em;}
.mr15{margin-right:15em;}
.mr20{margin-right:20em;}
.mr25{margin-right:25em;}
.mr30{margin-right:30em;}
.mr35{margin-right:35em;}
.mr40{margin-right:40em;}
.mr45{margin-right:45em;}
.mr50{margin-right:50em;}
.mr55{margin-right:55em;}
.mr60{margin-right:60em;}
.mr65{margin-right:65em;}
.mr70{margin-right:70em;}
.mr75{margin-right:75em;}
.mt1{margin-top:1em;}
.mt5{margin-top:5em;}
.mt10{margin-top:10em;}
.mt20{margin-top:20em;}
.mt30{margin-top:30em;}
.mt40{margin-top:40em;}
.mt50{margin-top:50em;}
.fluid {width:auto; float:none;}
.hp{width:100%; float:left; }
.clearfix, .main{ display:block;}
.clearfix:after, .main:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
/* IE5/MAC hack \*/
* html .clearfix{ display: inline; height: 1px;}
/* close */
/*}}}*/
/***
initially triggered by: https://groups.google.com/d/msg/tiddlywiki/7cdKvdeWZy0/8qCB-bivNGUJ
and again by: http://groups.google.com/group/tiddlywiki/browse_thread/thread/99ba457403a14543?hl=en
Known issues: {{{tiddler.title}}} mustn't contain {{{[}}} or {{{]}}}
This tiddler depends on MatchTagsPlugin and it needs to be tagged: {{{systemConfig}}} to work. I did disable this one by intention.
If you did overwrite the DefaultTiddlers shadow tiddler, this code does ''not'' overwrite your changes.
***/
//{{{
var tids1 = store.getMatchingTiddlers("default","modified").reverse()
var tids2 = store.getMatchingTiddlers("journal AND NOT archived","title").reverse()
var tids = []
tids = tids.concat(tids1,tids2);
tids = tids.map(function(elem){return elem.title})
config.shadowTiddlers["DefaultTiddlers"] = '[[' + tids.join(']]\n[[') + ']]';
//}}}
{{dp100{<<tagsplorer tagsplorer>>}}}
/***
|Name|MatchTagsPlugin|
|Source|http://www.TiddlyTools.com/#MatchTagsPlugin|
|Documentation|http://www.TiddlyTools.com/#MatchTagsPluginInfo|
|Version|2.0.6|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|'tag matching' with full boolean expressions (AND, OR, NOT, and nested parentheses)|
!!!!!Documentation
> see [[MatchTagsPluginInfo]]
!!!!!Revisions
<<<
2011.10.28 2.0.6 added .matchTags CSS class to popups to enable custom styling via StyleSheet
2011.01.23 2.0.5 fix core tweak for TW262+: adjust code in config.filters['tag'] instead of filterTiddlers()
2010.08.11 2.0.4 in getMatchingTiddlers(), fixed sorting for descending order (e.g, "-created")
| please see [[MatchTagsPluginInfo]] for additional revision details |
2008.02.28 1.0.0 initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.MatchTagsPlugin= {major: 2, minor: 0, revision: 6, date: new Date(2011,10,28)};
// store.getMatchingTiddlers() processes boolean expressions for tag matching
// sortfield (optional) sets sort order for tiddlers - default=title
// tiddlers (optional) use alternative set of tiddlers (instead of current store)
TiddlyWiki.prototype.getMatchingTiddlers = function(tagexpr,sortfield,tiddlers) {
var debug=config.options.chkDebug; // abbreviation
var cmm=config.macros.matchTags; // abbreviation
var r=[]; // results are an array of tiddlers
var tids=tiddlers||store.getTiddlers();
if (tids && sortfield) tids=store.sortTiddlers(tids,sortfield);
if (debug) displayMessage(cmm.msg1.format([tids.length]));
// try simple lookup to quickly find single tags or tags that
// contain boolean operators as literals, e.g. "foo and bar"
for (var t=0; t<tids.length; t++)
if (tids[t].isTagged(tagexpr)) r.pushUnique(tids[t]);
if (r.length) {
if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
return r;
}
// convert expression into javascript code with regexp tests,
// so that "tag1 AND ( tag2 OR NOT tag3 )" becomes
// "/\~tag1\~/.test(...) && ( /\~tag2\~/.test(...) || ! /\~tag3\~/.test(...) )"
// normalize whitespace, tokenize operators, delimit with "~"
var c=tagexpr.trim(); // remove leading/trailing spaces
c = c.replace(/\s+/ig," "); // reduce multiple spaces to single spaces
c = c.replace(/\(\s?/ig,"~(~"); // open parens
c = c.replace(/\s?\)/ig,"~)~"); // close parens
c = c.replace(/(\s|~)?&&(\s|~)?/ig,"~&&~"); // &&
c = c.replace(/(\s|~)AND(\s|~)/ig,"~&&~"); // AND
c = c.replace(/(\s|~)?\|\|(\s|~)?/ig,"~||~"); // ||
c = c.replace(/(\s|~)OR(\s|~)/ig,"~||~"); // OR
c = c.replace(/(\s|~)?!(\s|~)?/ig,"~!~"); // !
c = c.replace(/(^|~|\s)NOT(\s|~)/ig,"~!~"); // NOT
c = c.replace(/(^|~|\s)NOT~\(/ig,"~!~("); // NOT(
// change tag terms to regexp tests
var terms=c.split("~"); for (var i=0; i<terms.length; i++) { var t=terms[i];
if (/(&&)|(\|\|)|[!\(\)]/.test(t) || t=="") continue; // skip operators/parens/spaces
if (t==config.macros.matchTags.untaggedKeyword)
terms[i]="tiddlertags=='~~'"; // 'untagged' tiddlers
else
terms[i]="/\\~"+t+"\\~/.test(tiddlertags)";
}
c=terms.join(" ");
if (debug) { displayMessage(cmm.msg2.format([tagexpr])); displayMessage(cmm.msg3.format([c])); }
// scan tiddlers for matches
for (var t=0; t<tids.length; t++) {
// assemble tags from tiddler into string "~tag1~tag2~tag3~"
var tiddlertags = "~"+tids[t].tags.join("~")+"~";
try { if(eval(c)) r.push(tids[t]); } // test tags
catch(e) { // error in test
displayMessage(cmm.msg2.format([tagexpr]));
displayMessage(cmm.msg3.format([c]));
displayMessage(e.toString());
break; // skip remaining tiddlers
}
}
if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
return r;
}
//}}}
//{{{
config.macros.matchTags = {
msg1: "scanning %0 input tiddlers",
msg2: "looking for '%0'",
msg3: "using expression: '%0'",
msg4: "found %0 tiddlers matching '%1'",
noMatch: "no matching tiddlers",
untaggedKeyword: "-",
untaggedLabel: "no tags",
untaggedPrompt: "show tiddlers with no tags",
defTiddler: "MatchingTiddlers",
defTags: "",
defFormat: "[[%0]]",
defSeparator: "\n",
reportHeading: "Found %0 tiddlers tagged with: '{{{%1}}}'\n----\n",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var mode=params[0]?params[0].toLowerCase():'';
if (mode=="inline")
params.shift();
if (mode=="report" || mode=="panel") {
params.shift();
var target=params.shift()||this.defTiddler;
}
if (mode=="popup") {
params.shift();
if (params[0]&¶ms[0].substr(0,6)=="label:") var label=params.shift().substr(6);
if (params[0]&¶ms[0].substr(0,7)=="prompt:") var prompt=params.shift().substr(7);
} else {
var fmt=(params.shift()||this.defFormat).unescapeLineBreaks();
var sep=(params.shift()||this.defSeparator).unescapeLineBreaks();
}
var sortBy="+title";
if (params[0]&¶ms[0].substr(0,5)=="sort:") sortBy=params.shift().substr(5);
var expr = params.join(" ");
if (mode!="panel" && (!expr||!expr.trim().length)) return;
if (expr==this.untaggedKeyword)
{ var label=this.untaggedLabel; var prompt=this.untaggedPrompt };
switch (mode) {
case "popup": this.createPopup(place,label,expr,prompt,sortBy); break;
case "panel": this.createPanel(place,expr,fmt,sep,sortBy,target); break;
case "report": this.createReport(target,this.defTags,expr,fmt,sep,sortBy); break;
case "inline": default: this.createInline(place,expr,fmt,sep,sortBy); break;
}
},
formatList: function(tids,fmt,sep) {
var out=[];
for (var i=0; i<tids.length; i++) { var t=tids[i];
var title=t.title;
var who=t.modifier;
var when=t.modified.toLocaleString();
var text=t.text;
var first=t.text.split("\n")[0];
var desc=store.getTiddlerSlice(t.title,"description");
desc=desc||store.getTiddlerSlice(t.title,"Description");
desc=desc||store.getTiddlerText(t.title+"##description");
desc=desc||store.getTiddlerText(t.title+"##Description");
var tags=t.tags.length?'[['+t.tags.join(']] [[')+']]':'';
out.push(fmt.format([title,who,when,text,first,desc,tags]));
}
return out.join(sep);
},
createInline: function(place,expr,fmt,sep,sortBy) {
wikify(this.formatList(store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy),fmt,sep),place);
},
createPopup: function(place,label,expr,prompt,sortBy) {
var btn=createTiddlyButton(place,
(label||expr).format([expr]),
(prompt||config.views.wikified.tag.tooltip).format([expr]),
function(ev){ return config.macros.matchTags.showPopup(this,ev||window.event); });
btn.setAttribute("sortBy",sortBy);
btn.setAttribute("expr",expr);
},
showPopup: function(here,ev) {
var p=Popup.create(here,null,"matchTags popup"); if (!p) return false;
var tids=store.getMatchingTiddlers(here.getAttribute("expr"));
store.sortTiddlers(tids,here.getAttribute("sortBy"));
var list=[]; for (var t=0; t<tids.length; t++) list.push(tids[t].title);
if (!list.length) createTiddlyText(p,this.noMatch);
else {
var b=createTiddlyButton(createTiddlyElement(p,"li"),
config.views.wikified.tag.openAllText,
config.views.wikified.tag.openAllTooltip,
function() {
var list=this.getAttribute("list").readBracketedList();
story.displayTiddlers(null,tids);
});
b.setAttribute("list","[["+list.join("]] [[")+"]]");
createTiddlyElement(p,"hr");
}
var out=this.formatList(tids," [[%0]] ","\n"); wikify(out,p);
Popup.show();
ev.cancelBubble=true;
if(ev.stopPropagation) ev.stopPropagation();
return false;
},
createReport: function(target,tags,expr,fmt,sep,sortBy) {
var tids=store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy);
if (!tids.length) { displayMessage('no matches for: '+expr); return false; }
var msg=config.messages.overwriteWarning.format([target]);
if (store.tiddlerExists(target) && !confirm(msg)) return false;
var out=this.reportHeading.format([tids.length,expr])
out+=this.formatList(tids,fmt,sep);
store.saveTiddler(target,target,out,config.options.txtUserName,new Date(),tags,{});
story.closeTiddler(target); story.displayTiddler(null,target);
},
createPanel: function(place,expr,fmt,sep,sortBy,tid) {
var s=createTiddlyElement(place,"span"); s.innerHTML=store.getTiddlerText("MatchTagsPlugin##html");
var f=s.getElementsByTagName("form")[0];
f.expr.value=expr; f.fmt.value=fmt; f.sep.value=sep.escapeLineBreaks();
f.tid.value=tid; f.tags.value=this.defTags;
}
};
//}}}
/***
//{{{
!html
<form style='display:inline;white-space:nowrap'>
<input type='text' name='expr' style='width:50%' title='tag expression'><!--
--><input type='text' name='fmt' style='width:10%' title='list item format'><!--
--><input type='text' name='sep' style='width:5%' title='list item separator'><!--
--><input type='text' name='tid' style='width:12%' title='target tiddler title'><!--
--><input type='text' name='tags' style='width:10%' title='target tiddler tags'><!--
--><input type='button' name='go' style='width:8%' value='go' onclick="
var expr=this.form.expr.value;
if (!expr.length) { alert('Enter a boolean tag expression'); return false; }
var fmt=this.form.fmt.value;
if (!fmt.length) { alert('Enter the list item output format'); return false; }
var sep=this.form.sep.value.unescapeLineBreaks();
var tid=this.form.tid.value;
if (!tid.length) { alert('Enter a target tiddler title'); return false; }
var tags=this.form.tags.value;
config.macros.matchTags.createReport(tid,tags,expr,fmt,sep,'title');
return false;">
</form>
!end
//}}}
***/
//{{{
// SHADOW TIDDLER for displaying default panel input form
config.shadowTiddlers.MatchTags="<<matchTags panel>>";
//}}}
//{{{
// TWEAK core filterTiddlers() or config.filters['tag'] (in TW262+)
// to use getMatchingTiddlers instead getTaggedTiddlers
// for enhanced boolean matching in [tag[...]] syntax
var TW262=config.filters && config.filters['tag']; // detect TW262+
var fname=TW262?"config.filters['tag']":"TiddlyWiki.prototype.filterTiddlers";
var code=eval(fname).toString().replace(/getTaggedTiddlers/g,'getMatchingTiddlers');
eval(fname+'='+code);
//}}}
//{{{
// REDEFINE core handler for enhanced boolean matching in tag:"..." paramifier
// use filterTiddlers() instead of getTaggedTiddlers() to get list of tiddlers.
config.paramifiers.tag = {
onstart: function(v) {
var tagged = store.filterTiddlers("[tag["+v+"]]");
story.displayTiddlers(null,tagged,null,false,null);
}
};
//}}}
/***
|Name|SearchOptionsPlugin|
|Source|http://www.TiddlyTools.com/#SearchOptionsPlugin|
|Documentation|http://www.TiddlyTools.com/#SearchOptionsPluginInfo|
|Version|3.0.7|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|extend core search function with additional user-configurable options|
Adds extra options to core search function including selecting which data items to search, enabling/disabling incremental key-by-key searches, and generating a ''list of matching tiddlers'' instead of immediately displaying all matches. This plugin also adds syntax for rendering 'search links' within tiddler content to embed one-click searches using pre-defined 'hard-coded' search terms.
!!!!!Documentation
>see [[SearchOptionsPluginInfo]]
!!!!!Configuration
<<<
Search in:
<<option chkSearchTitles>> titles <<option chkSearchText>> text <<option chkSearchTags>> tags <<option chkSearchFields>> fields <<option chkSearchShadows>> shadows
<<option chkSearchHighlight>> Highlight matching text in displayed tiddlers
<<option chkSearchList>> Show list of matches
<<option chkSearchListTiddler>> Write list to [[SearchResults]] tiddler
<<option chkSearchTitlesFirst>> Show title matches first
<<option chkSearchByDate>> Sort matching tiddlers by modification date (most recent first)
<<option chkSearchResultsOptions>> Include {{{options...}}} slider in "search again" form
<<option chkIncrementalSearch>> Incremental key-by-key search: {{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, {{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay
<<option chkSearchOpenTiddlers>> Search only in tiddlers that are currently displayed
<<option chkSearchExcludeTags>> Exclude tiddlers tagged with: <<option txtSearchExcludeTags>>
<<<
!!!!!Revisions
<<<
2010.05.03 3.0.8 added chkSearchResultsOptions to allow/omit the "options..." slider from the "search again" form
|please see [[SearchOptionsPluginInfo]] for additional revision details|
2005.10.18 1.0.0 Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.SearchOptionsPlugin= {major: 3, minor: 0, revision: 8, date: new Date(2010,5,3)};
var defaults={
chkSearchTitles: true,
chkSearchText: true,
chkSearchTags: true,
chkSearchFields: true,
chkSearchTitlesFirst: true,
chkSearchList: true,
chkSearchHighlight: true,
chkSearchListTiddler: false,
chkSearchByDate: false,
chkIncrementalSearch: true,
chkSearchShadows: true,
chkSearchOpenTiddlers: false,
chkSearchResultsOptions:true,
chkSearchExcludeTags: true,
txtSearchExcludeTags: 'excludeSearch',
txtIncrementalSearchDelay: 500,
txtIncrementalSearchMin: 3
}; for (var id in defaults) if (config.options[id]===undefined)
config.options[id]=defaults[id];
if (config.macros.search.reportTitle==undefined)
config.macros.search.reportTitle="SearchResults"; // note: not a cookie!
config.macros.search.label+="\xa0"; // a little bit of space just because it looks better
//}}}
// // searchLink: {{{[search[text to find]] OR [search[text to display|text to find]]}}}
//{{{
config.formatters.push( {
name: "searchLink",
match: "\\[search\\[",
lookaheadRegExp: /\[search\[(.*?)(?:\|(.*?))?\]\]/mg,
prompt: "search for: '%0'",
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var label=lookaheadMatch[1];
var text=lookaheadMatch[2]||label;
var prompt=this.prompt.format([text]);
var btn=createTiddlyButton(w.output,label,prompt,
function(){story.search(this.getAttribute("searchText"))},"searchLink");
btn.setAttribute("searchText",text);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
});
//}}}
// // incremental search uses option settings instead of hard-coded delay and minimum input values
//{{{
var fn=config.macros.search.onKeyPress;
fn=fn.toString().replace(/500/g, "config.options.txtIncrementalSearchDelay||500");
fn=fn.toString().replace(/> 2/g, ">=(config.options.txtIncrementalSearchMin||3)");
eval("config.macros.search.onKeyPress="+fn);
//}}}
// // REPLACE story.search() for option to "show search results in a list"
//{{{
Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
var co=config.options; // abbrev
var re=new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
if (config.options.chkSearchHighlight) highlightHack=re;
var matches = store.search(re,co.chkSearchByDate?"modified":"title","");
if (co.chkSearchByDate) matches=matches.reverse(); // most recent first
var q = useRegExp ? "/" : "'";
clearMessage();
if (!matches.length) {
if (co.chkSearchListTiddler) discardSearchResults();
displayMessage(config.macros.search.failureMsg.format([q+text+q]));
} else {
if (co.chkSearchList||co.chkSearchListTiddler)
reportSearchResults(text,matches);
else {
var titles = []; for(var t=0; t<matches.length; t++) titles.push(matches[t].title);
this.closeAllTiddlers(); story.displayTiddlers(null,titles);
displayMessage(config.macros.search.successMsg.format([matches.length, q+text+q]));
}
}
highlightHack = null;
}
//}}}
// // REPLACE store.search() for enhanced searching/sorting options
//{{{
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag,match)
{
var co=config.options; // abbrev
var tids = this.reverseLookup("tags",excludeTag,!!match,sortField);
var opened=[]; story.forEachTiddler(function(tid,elem){opened.push(tid);});
// eliminate tiddlers tagged with excluded tags
if (co.chkSearchExcludeTags&&co.txtSearchExcludeTags.length) {
var ex=co.txtSearchExcludeTags.readBracketedList();
var temp=[]; for(var t=tids.length-1; t>=0; t--)
if (!tids[t].tags.containsAny(ex)) temp.push(tids[t]);
tids=temp;
}
// scan for matching titles first...
var results = [];
if (co.chkSearchTitles) {
for(var t=0; t<tids.length; t++) {
if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue;
if(tids[t].title.search(searchRegExp)!=-1) results.push(tids[t]);
}
if (co.chkSearchShadows)
for (var t in config.shadowTiddlers) {
if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue;
if ((t.search(searchRegExp)!=-1) && !store.tiddlerExists(t))
results.push((new Tiddler()).assign(t,config.shadowTiddlers[t]));
}
}
// then scan for matching text, tags, or field data
for(var t=0; t<tids.length; t++) {
if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue;
if (co.chkSearchText && tids[t].text.search(searchRegExp)!=-1)
results.pushUnique(tids[t]);
if (co.chkSearchTags && tids[t].tags.join(" ").search(searchRegExp)!=-1)
results.pushUnique(tids[t]);
if (co.chkSearchFields && store.forEachField!=undefined)
store.forEachField(tids[t],
function(tid,field,val) {
if (val.search(searchRegExp)!=-1) results.pushUnique(tids[t]);
},
true); // extended fields only
}
// then check for matching text in shadows
if (co.chkSearchShadows)
for (var t in config.shadowTiddlers) {
if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue;
if ((config.shadowTiddlers[t].search(searchRegExp)!=-1) && !store.tiddlerExists(t))
results.pushUnique((new Tiddler()).assign(t,config.shadowTiddlers[t]));
}
// if not 'titles first', or sorting by modification date,
// re-sort results to so titles, text, tag and field matches are mixed together
if(!sortField) sortField = "title";
var bySortField=function(a,b){
if(a[sortField]==b[sortField])return(0);else return(a[sortField]<b[sortField])?-1:+1;
}
if (!co.chkSearchTitlesFirst || co.chkSearchByDate) results.sort(bySortField);
return results;
}
//}}}
// // HIJACK core {{{<<search>>}}} macro to add "report" and "simple inline" output
//{{{
config.macros.search.SOP_handler=config.macros.search.handler;
config.macros.search.handler = function(place,macroName,params)
{
// if "report", use SearchOptionsPlugin report generator for inline output
if (params[1]&¶ms[1].substr(0,6)=="report") {
var keyword=params[0];
var options=params[1].split("=")[1]; // split "report=option+option+..."
var heading=params[2]?params[2].unescapeLineBreaks():"";
var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
if (matches.length) wikify(heading+window.formatSearchResults(keyword,matches,options),place);
} else if (params[1]) {
var keyword=params[0];
var heading=params[1]?params[1].unescapeLineBreaks():"";
var seperator=params[2]?params[2].unescapeLineBreaks():", ";
var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
if (matches.length) {
var out=[];
for (var m=0; m<matches.length; m++) out.push("[["+matches[m].title+"]]");
wikify(heading+out.join(seperator),place);
}
} else
config.macros.search.SOP_handler.apply(this,arguments);
};
//}}}
// // SearchResults panel handling
//{{{
setStylesheet(".searchResults { padding:1em 1em 0 1em; }","searchResults"); // matches std tiddler padding
config.macros.search.createPanel=function(text,matches,body) {
function getByClass(e,c) { var d=e.getElementsByTagName("div");
for (var i=0;i<d.length;i++) if (hasClass(d[i],c)) return d[i]; }
var panel=createTiddlyElement(null,"div","searchPanel","searchPanel");
this.renderPanel(panel,text,matches,body);
var oldpanel=document.getElementById("searchPanel");
if (!oldpanel) { // insert new panel just above tiddlers
var da=document.getElementById("displayArea");
da.insertBefore(panel,da.firstChild);
} else { // if panel exists
var oldwrap=getByClass(oldpanel,"searchResults");
var newwrap=getByClass(panel,"searchResults");
// if no prior content, just insert new content
if (!oldwrap) oldpanel.insertBefore(newwrap,null);
else { // swap search results content but leave containing panel intact
oldwrap.style.display='block'; // unfold wrapper if needed
var i=oldwrap.getElementsByTagName("input")[0]; // get input field
if (i) { var pos=this.getCursorPos(i); i.onblur=null; } // get cursor pos, ignore blur
oldpanel.replaceChild(newwrap,oldwrap);
panel=oldpanel; // use existing panel
}
}
this.showPanel(true,pos);
return panel;
}
config.macros.search.renderPanel=function(panel,text,matches,body) {
var wrap=createTiddlyElement(panel,"div",null,"searchResults");
wrap.onmouseover = function(e){ addClass(this,"selected"); }
wrap.onmouseout = function(e){ removeClass(this,"selected"); }
// create toolbar: "open all", "fold/unfold", "close"
var tb=createTiddlyElement(wrap,"div",null,"toolbar");
var b=createTiddlyButton(tb, "open all", "open all matching tiddlers", function() {
story.displayTiddlers(null,this.getAttribute("list").readBracketedList()); return false; },"button");
var list=""; for(var t=0;t<matches.length;t++) list+='[['+matches[t].title+']] ';
b.setAttribute("list",list);
var b=createTiddlyButton(tb, "fold", "toggle display of search results", function() {
config.macros.search.foldPanel(this); return false; },"button");
var b=createTiddlyButton(tb, "close", "dismiss search results", function() {
config.macros.search.showPanel(false); return false; },"button");
createTiddlyText(createTiddlyElement(wrap,"div",null,"title"),"Search for: "+text); // title
wikify(body,createTiddlyElement(wrap,"div",null,"viewer")); // report
return panel;
}
config.macros.search.showPanel=function(show,pos) {
var panel=document.getElementById("searchPanel");
var i=panel.getElementsByTagName("input")[0];
i.onfocus=show?function(){config.macros.search.stayFocused(true);}:null;
i.onblur=show?function(){config.macros.search.stayFocused(false);}:null;
if (show && panel.style.display=="block") { // if shown, grab focus, restore cursor
if (i&&this.stayFocused()) { i.focus(); this.setCursorPos(i,pos); }
return;
}
if(!config.options.chkAnimate) {
panel.style.display=show?"block":"none";
if (!show) { removeChildren(panel); config.macros.search.stayFocused(false); }
} else {
var s=new Slider(panel,show,false,show?"none":"children");
s.callback=function(e,p){e.style.overflow="visible";}
anim.startAnimating(s);
}
return panel;
}
config.macros.search.foldPanel=function(button) {
var d=document.getElementById("searchPanel").getElementsByTagName("div");
for (var i=0;i<d.length;i++) if (hasClass(d[i],"viewer")) var v=d[i]; if (!v) return;
var show=v.style.display=="none";
if(!config.options.chkAnimate)
v.style.display=show?"block":"none";
else {
var s=new Slider(v,show,false,"none");
s.callback=function(e,p){e.style.overflow="visible";}
anim.startAnimating(s);
}
button.innerHTML=show?"fold":"unfold";
return false;
}
config.macros.search.stayFocused=function(keep) { // TRUE/FALSE=set value, no args=get value
if (keep===undefined) return this.keepReportInFocus;
this.keepReportInFocus=keep;
return keep
}
config.macros.search.getCursorPos=function(i) {
var s=0; var e=0; if (!i) return { start:s, end:e };
try {
if (i.setSelectionRange) // FF
{ s=i.selectionStart; e=i.selectionEnd; }
if (document.selection && document.selection.createRange) { // IE
var r=document.selection.createRange().duplicate();
var len=r.text.length; s=0-r.moveStart('character',-100000); e=s+len;
}
}catch(e){};
return { start:s, end:e };
}
config.macros.search.setCursorPos=function(i,pos) {
if (!i||!pos) return; var s=pos.start; var e=pos.end;
if (i.setSelectionRange) //FF
i.setSelectionRange(s,e);
if (i.createTextRange) // IE
{ var r=i.createTextRange(); r.collapse(true); r.moveStart("character",s); r.select(); }
}
//}}}
// // SearchResults report generation
// note: these functions are defined globally, so they can be more easily redefined to customize report formats//
//{{{
if (!window.reportSearchResults) window.reportSearchResults=function(text,matches)
{
var cms=config.macros.search; // abbrev
var body=window.formatSearchResults(text,matches);
if (!config.options.chkSearchListTiddler) // show #searchResults panel
window.scrollTo(0,ensureVisible(cms.createPanel(text,matches,body)));
else { // write [[SearchResults]] tiddler
var title=cms.reportTitle;
var who=config.options.txtUserName;
var when=new Date();
var tags="excludeLists excludeSearch temporary";
var tid=store.getTiddler(title); if (!tid) tid=new Tiddler();
tid.set(title,body,who,when,tags);
store.addTiddler(tid);
story.closeTiddler(title);
story.displayTiddler(null,title);
}
}
if (!window.formatSearchResults) window.formatSearchResults=function(text,matches,opt)
{
var body='';
var title=config.macros.search.reportTitle
var q = config.options.chkRegExpSearch ? "/" : "'";
if (!opt) var opt="all";
var parts=opt.split("+");
for (var i=0; i<parts.length; i++) { var p=parts[i].toLowerCase();
if (p=="again"||p=="all") body+=window.formatSearchResults_again(text,matches);
if (p=="summary"||p=="all") body+=window.formatSearchResults_summary(text,matches);
if (p=="list"||p=="all") body+=window.formatSearchResults_list(text,matches);
if (p=="buttons"||p=="all") body+=window.formatSearchResults_buttons(text,matches);
}
return body;
}
if (!window.formatSearchResults_again) window.formatSearchResults_again=function(text,matches)
{
var title=config.macros.search.reportTitle
var body='';
// search again
body+='{{span{<<search "'+text.replace(/"/g,'"')+'">> /%\n';
body+='%/<html><input type="button" value="search again"';
body+=' onclick="var t=this.parentNode.parentNode.getElementsByTagName(\'input\')[0];';
body+=' config.macros.search.doSearch(t); return false;">';
if (!config.options.chkSearchResultsOptions) { // omit "options..."
body+='</html>}}}\n\n';
return body;
}
body+=' <a href="javascript:;" onclick="';
body+=' var e=this.parentNode.nextSibling;';
body+=' var show=e.style.display!=\'block\';';
body+=' if(!config.options.chkAnimate) e.style.display=show?\'block\':\'none\';';
body+=' else anim.startAnimating(new Slider(e,show,false,\'none\'));';
body+=' return false;">options...</a>';
body+='</html>@@display:none;border-left:1px dotted;margin-left:1em;padding:0;padding-left:.5em;font-size:90%;/%\n';
body+=' %/<<option chkSearchTitles>>titles /%\n';
body+=' %/<<option chkSearchText>>text /%\n';
body+=' %/<<option chkSearchTags>>tags /%\n';
body+=' %/<<option chkSearchFields>>fields /%\n';
body+=' %/<<option chkSearchShadows>>shadows\n';
body+=' <<option chkCaseSensitiveSearch>>case-sensitive /%\n';
body+=' %/<<option chkRegExpSearch>>text patterns /%\n';
body+=' %/<<option chkSearchByDate>>sorted by date\n';
body+=' <<option chkSearchHighlight>> highlight matching text in displayed tiddlers\n';
body+=' <<option chkIncrementalSearch>>incremental key-by-key search: /%\n';
body+=' %/{{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, /%\n';
body+=' %/{{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay\n';
body+=' <<option chkSearchOpenTiddlers>> search only in tiddlers that are currently displayed\n';
body+=' <<option chkSearchExcludeTags>>exclude tiddlers tagged with:\n';
body+=' {{editor{<<option txtSearchExcludeTags>>}}}/%\n';
body+='%/@@}}}\n\n';
return body;
}
if (!window.formatSearchResults_summary) window.formatSearchResults_summary=function(text,matches)
{
// summary: nn tiddlers found matching '...', options used
var body='';
var co=config.options; // abbrev
var title=config.macros.search.reportTitle
var q = co.chkRegExpSearch ? "/" : "'";
body+="''"+config.macros.search.successMsg.format([matches.length,q+"{{{"+text+"}}}"+q])+"''\n";
var opts=[];
if (co.chkSearchTitles) opts.push("titles");
if (co.chkSearchText) opts.push("text");
if (co.chkSearchTags) opts.push("tags");
if (co.chkSearchFields) opts.push("fields");
if (co.chkSearchShadows) opts.push("shadows");
if (co.chkSearchOpenTiddlers) body+="^^//search limited to displayed tiddlers only//^^\n";
body+="~~ searched in "+opts.join(" + ")+"~~\n";
body+=(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"^^ using ":"")
+(co.chkCaseSensitiveSearch?"case-sensitive ":"")
+(co.chkRegExpSearch?"pattern ":"")
+(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"matching^^\n":"");
return body;
}
if (!window.formatSearchResults_list) window.formatSearchResults_list=function(text,matches)
{
// bullet list of links to matching tiddlers
var body='';
var co=config.options; // abbrev
var pattern=co.chkRegExpSearch?text:text.escapeRegExp();
var sensitive=co.chkCaseSensitiveSearch?"mg":"img";
var link='{{tiddlyLinkExisting{<html><nowiki><a href="javascript:;" onclick="'
+'if(config.options.chkSearchHighlight)'
+' highlightHack=new RegExp(\x27'+pattern+'\x27.escapeRegExp(),\x27'+sensitive+'\x27);'
+'story.displayTiddler(null,\x27%0\x27);'
+'highlightHack = null; return false;'
+'" title="%2">%1</a></html>}}}';
for(var t=0;t<matches.length;t++) {
body+="* ";
if (co.chkSearchByDate)
body+=matches[t].modified.formatString('YYYY.0MM.0DD 0hh:0mm')+" ";
var title=matches[t].title;
var fixup=title.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
var tid=store.getTiddler(title);
var tip=tid?tid.getSubtitle():''; tip=tip.replace(/"/g,""");
body+=link.format([fixup,title,tip])+'\n';
}
return body;
}
if (!window.formatSearchResults_buttons) window.formatSearchResults_buttons=function(text,matches)
{
// embed buttons only if writing SearchResults to tiddler
if (!config.options.chkSearchListTiddler) return "";
// "open all" button
var title=config.macros.search.reportTitle;
var body="";
body+="@@diplay:block;<html><input type=\"button\" href=\"javascript:;\" "
+"onclick=\"story.displayTiddlers(null,[";
for(var t=0;t<matches.length;t++)
body+="'"+matches[t].title.replace(/\'/mg,"\\'")+"'"+((t<matches.length-1)?", ":"");
body+="],1);\" accesskey=\"O\" value=\"open all matching tiddlers\"></html> ";
// "discard SearchResults" button
body+="<html><input type=\"button\" href=\"javascript:;\" "
+"onclick=\"discardSearchResults()\" value=\"discard "+title+"\"></html>";
body+="@@\n";
return body;
}
if (!window.discardSearchResults) window.discardSearchResults=function()
{
// remove the tiddler
story.closeTiddler(config.macros.search.reportTitle);
store.deleteTiddler(config.macros.search.reportTitle);
store.notify(config.macros.search.reportTitle,true);
}
//}}}
/*{{{*/
(function($) { //# set up alias
// create macro object
config.macros.jqTables = {
// Add a handler function to be invoked by <<jqTables TiddlerTitle>>
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
// target tiddler passed in as macro parameter
var title = params[0]; // tiddler, that contains the table
var colNr = params[1] || 1; // column number. default = 1
// read list items from tiddler contents
var text = store.getTiddlerText(title);
text=wikifyStatic(text);
if($(text).find("table")) {
$("<div />").attr("id", "jqTables").appendTo(place);
$("<ul />").attr("id", "ListTableColumn").appendTo("#jqTables");
// generate list
var items = $(text).find("tr td:nth-child("+colNr+")");
//// Alternative method follows the ////
////var itmfound
$.each(items, function(i, itm) {
////itmfound=itm.innerHTML;
////$("<li>"+itmfound+"</li>").appendTo("#ListTableColumn");
$(itm).unwrap().appendTo("#ListTableColumn"); //// comment this
});
}
}
};
})(jQuery);
/*}}}*/
/***
|''Name''|jqTablesPlugin|
|''Description''|??|
|''Authors''|see Related to|
|''Version''|0.1|
|''Date''|2010-06-27|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#testPlugin|
|''License''|<...>|
|''CoreVersion''|2.5|
|''Documentation''|included|
|''Related to''|http://groups.google.com/group/tiddlywikidev/browse_thread/thread/8ba29d51caf59d37?hl=en|
|''Keywords''|??|
!!!Description
<<<
This script reads a column from a tiddler containing a table an lists it.
<<<
!!!Notes
<<<
some text here
<<<
!!!Usage
<<<
!!!!Standard
{{{
<<jqTables testTable>>
<<jqTables testTable 2>>
}}}
<<<
!!!Parameters
<<<
Parameters are optional!
{{{
<<jqTables [TiddlerTitle] [columnNumber]>>
}}}
[TiddlerTitle] .. Title, of the tidder, that contains the table
[columnNumber] .. Number of column to be used. default = 1
<<<
!!!Revision History
<<<
V 0.0.2 2010-06-27
* added second parameter "column"
V 0.0.1 2010-06-25
* initial Release
<<<
!!!To Do
<<<
???
<<<
***/
<!--{{{-->
<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 macro='tiddler "Echo##code" thumbnails with: {{tiddler.title}}'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
/***
|Name|GotoPlugin|
|Source|http://www.TiddlyTools.com/#GotoPlugin|
|Documentation|http://www.TiddlyTools.com/#GotoPluginInfo|
|Version|1.9.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|view any tiddler by entering it's title - displays list of possible matches|
''View a tiddler by typing its title and pressing //enter//.'' As you type, a list of possible matches is displayed. You can scroll-and-click (or use arrows+enter) to select/view a tiddler, or press escape to close the listbox to resume typing. When the listbox is not displayed, pressing //escape// clears the current input.
!!!Documentation
>see [[GotoPluginInfo]]
!!!Configuration
<<<
*Match titles only after {{twochar{<<option txtIncrementalSearchMin>>}}} or more characters are entered.<br>Use down-arrow to start matching with shorter input. //Note: This option value is also set/used by [[SearchOptionsPlugin]]//.
*To set the maximum height of the listbox, you can create a tiddler tagged with <<tag systemConfig>>, containing:
//{{{
config.macros.gotoTiddler.listMaxSize=10; // change this number
//}}}
<<<
!!!Revisions
<<<
2009.05.22 [1.9.2] use reverseLookup() for IncludePlugin
|please see [[GotoPluginInfo]] for additional revision details|
2006.05.05 [0.0.0] started
<<<
!!!Code
***/
//{{{
version.extensions.GotoPlugin= {major: 1, minor: 9, revision: 2, date: new Date(2009,5,22)};
// automatically tweak shadow SideBarOptions to add <<gotoTiddler>> macro above <<search>>
config.shadowTiddlers.SideBarOptions=config.shadowTiddlers.SideBarOptions.replace(/<<search>>/,"{{button{goto}}}\n<<gotoTiddler>><<search>>");
if (config.options.txtIncrementalSearchMin===undefined) config.options.txtIncrementalSearchMin=3;
config.macros.gotoTiddler= {
listMaxSize: 10,
listHeading: 'Found %0 matching title%1...',
searchItem: "Search for '%0'...",
handler:
function(place,macroName,params,wikifier,paramString,tiddler) {
var quiet =params.contains("quiet");
var showlist =params.contains("showlist");
var search =params.contains("search");
params = paramString.parseParams("anon",null,true,false,false);
var instyle =getParam(params,"inputstyle","");
var liststyle =getParam(params,"liststyle","");
var filter =getParam(params,"filter","");
var html=this.html;
var keyevent=window.event?"onkeydown":"onkeypress"; // IE event fixup for ESC handling
html=html.replace(/%keyevent%/g,keyevent);
html=html.replace(/%search%/g,search);
html=html.replace(/%quiet%/g,quiet);
html=html.replace(/%showlist%/g,showlist);
html=html.replace(/%display%/g,showlist?'block':'none');
html=html.replace(/%position%/g,showlist?'static':'absolute');
html=html.replace(/%instyle%/g,instyle);
html=html.replace(/%liststyle%/g,liststyle);
html=html.replace(/%filter%/g,filter);
if (config.browser.isIE) html=this.IEtableFixup.format([html]);
var span=createTiddlyElement(place,'span');
span.innerHTML=html; var form=span.getElementsByTagName("form")[0];
if (showlist) this.fillList(form.list,'',filter,search,0);
},
html:
'<form onsubmit="return false" style="display:inline;margin:0;padding:0">\
<input name=gotoTiddler type=text autocomplete="off" accesskey="G" style="%instyle%"\
title="Enter title text... ENTER=goto, SHIFT-ENTER=search for text, DOWN=select from list"\
onfocus="this.select(); this.setAttribute(\'accesskey\',\'G\');"\
%keyevent%="return config.macros.gotoTiddler.inputEscKeyHandler(event,this,this.form.list,%search%,%showlist%);"\
onkeyup="return config.macros.gotoTiddler.inputKeyHandler(event,this,%quiet%,%search%,%showlist%);">\
<select name=list style="display:%display%;position:%position%;%liststyle%"\
onchange="if (!this.selectedIndex) this.selectedIndex=1;"\
onblur="this.style.display=%showlist%?\'block\':\'none\';"\
%keyevent%="return config.macros.gotoTiddler.selectKeyHandler(event,this,this.form.gotoTiddler,%showlist%);"\
onclick="return config.macros.gotoTiddler.processItem(this.value,this.form.gotoTiddler,this,%showlist%);">\
</select><input name="filter" type="hidden" value="%filter%">\
</form>',
IEtableFixup:
"<table style='width:100%;display:inline;padding:0;margin:0;border:0;'>\
<tr style='padding:0;margin:0;border:0;'><td style='padding:0;margin:0;border:0;'>\
%0</td></tr></table>",
getItems:
function(list,val,filter) {
if (!list.cache || !list.cache.length || val.length<=config.options.txtIncrementalSearchMin) {
// starting new search, fetch and cache list of tiddlers/shadows/tags
list.cache=new Array();
if (filter.length) {
var fn=store.getMatchingTiddlers||store.getTaggedTiddlers;
var tiddlers=store.sortTiddlers(fn.apply(store,[filter]),'title');
} else
var tiddlers=store.reverseLookup('tags','excludeLists');
for(var t=0; t<tiddlers.length; t++) list.cache.push(tiddlers[t].title);
if (!filter.length) {
for (var t in config.shadowTiddlers) list.cache.pushUnique(t);
var tags=store.getTags();
for(var t=0; t<tags.length; t++) list.cache.pushUnique(tags[t][0]);
}
}
var found = [];
var match=val.toLowerCase();
for(var i=0; i<list.cache.length; i++)
if (list.cache[i].toLowerCase().indexOf(match)!=-1) found.push(list.cache[i]);
return found;
},
getItemSuffix:
function(t) {
if (store.tiddlerExists(t)) return ""; // tiddler
if (store.isShadowTiddler(t)) return " (shadow)"; // shadow
return " (tag)"; // tag
},
fillList:
function(list,val,filter,search,key) {
if (list.style.display=="none") return; // not visible... do nothing!
var indent='\xa0\xa0\xa0';
var found = this.getItems(list,val,filter); // find matching items...
found.sort(); // alpha by title
while (list.length > 0) list.options[0]=null; // clear list
var hdr=this.listHeading.format([found.length,found.length==1?"":"s"]);
list.options[0]=new Option(hdr,"",false,false);
for (var t=0; t<found.length; t++) list.options[list.length]=
new Option(indent+found[t]+this.getItemSuffix(found[t]),found[t],false,false);
if (search)
list.options[list.length]=new Option(this.searchItem.format([val]),"*",false,false);
list.size=(list.length<this.listMaxSize?list.length:this.listMaxSize); // resize list...
list.selectedIndex=key==38?list.length-1:key==40?1:0;
},
keyProcessed:
function(ev) { // utility function
ev.cancelBubble=true; // IE4+
try{event.keyCode=0;}catch(e){}; // IE5
if (window.event) ev.returnValue=false; // IE6
if (ev.preventDefault) ev.preventDefault(); // moz/opera/konqueror
if (ev.stopPropagation) ev.stopPropagation(); // all
return false;
},
inputEscKeyHandler:
function(event,here,list,search,showlist) {
if (event.keyCode==27) {
if (showlist) { // clear input, reset list
here.value=here.defaultValue;
this.fillList(list,'',here.form.filter.value,search,0);
}
else if (list.style.display=="none") // clear input
here.value=here.defaultValue;
else list.style.display="none"; // hide list
return this.keyProcessed(event);
}
return true; // key bubbles up
},
inputKeyHandler:
function(event,here,quiet,search,showlist) {
var key=event.keyCode;
var list=here.form.list;
var filter=here.form.filter;
// non-printing chars bubble up, except for a few:
if (key<48) switch(key) {
// backspace=8, enter=13, space=32, up=38, down=40, delete=46
case 8: case 13: case 32: case 38: case 40: case 46: break; default: return true;
}
// blank input... if down/enter... fall through (list all)... else, and hide or reset list
if (!here.value.length && !(key==40 || key==13)) {
if (showlist) this.fillList(here.form.list,'',here.form.filter.value,search,0);
else list.style.display="none";
return this.keyProcessed(event);
}
// hide list if quiet, or below input minimum (and not showlist)
list.style.display=(!showlist&&(quiet||here.value.length<config.options.txtIncrementalSearchMin))?'none':'block';
// non-blank input... enter=show/create tiddler, SHIFT-enter=search for text
if (key==13 && here.value.length) return this.processItem(event.shiftKey?'*':here.value,here,list,showlist);
// up or down key, or enter with blank input... shows and moves to list...
if (key==38 || key==40 || key==13) { list.style.display="block"; list.focus(); }
this.fillList(list,here.value,filter.value,search,key);
return true; // key bubbles up
},
selectKeyHandler:
function(event,list,editfield,showlist) {
if (event.keyCode==27) // escape... hide list, move to edit field
{ editfield.focus(); list.style.display=showlist?'block':'none'; return this.keyProcessed(event); }
if (event.keyCode==13 && list.value.length) // enter... view selected item
{ this.processItem(list.value,editfield,list,showlist); return this.keyProcessed(event); }
return true; // key bubbles up
},
processItem:
function(title,here,list,showlist) {
if (!title.length) return;
list.style.display=showlist?'block':'none';
if (title=="*") { story.search(here.value); return false; } // do full-text search
if (!showlist) here.value=title;
story.displayTiddler(null,title); // show selected tiddler
return false;
}
}
//}}}
/***
|''Name:''|DiffFormatterPlugin|
|''Description:''|Extension of TiddlyWiki syntax to support Diff text formatting|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#DiffFormatterPlugin |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/formatters/DiffFormatterPlugin.js |
|''Version:''|0.0.3|
|''Date:''|Sep 11, 2009|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] |
|''~CoreVersion:''|2.1.0|
This is an early release of the DiffFormatterPlugin, which extends the TiddlyWiki syntax to support Diff
text formatting.
The Diff formatter is different from the other formatters in that Tiddlers are not required to be
tagged: instead the Diff format adds formatting that augments TiddlyWiki's format.
The Diff formatter adds the following:
# ^+ for added
# ^- for removed
# ^"""@@ """, """--- """ and """+++ """ for special markers
Please report any defects you find at http://groups.google.co.uk/group/TiddlyWikiDev
!StyleSheet
.viewer .removed { background: #fdd; }
.viewer .added { background: #dfd; }
!Code
***/
//{{{
// Ensure that the DiffFormatterPlugin is only installed once.
if(!version.extensions.DiffFormatterPlugin) {
version.extensions.DiffFormatterPlugin = {installed:true};
if(version.major < 2 || (version.major == 2 && version.minor < 1)) {
alertAndThrow('DiffFormatterPlugin requires TiddlyWiki 2.1 or later.');
}
diffFormatter = {}; // 'namespace' for local functions
diffFormatter.init = function() {
var stylesheet = store.getTiddlerText(tiddler.title + "##StyleSheet");
if(stylesheet) { // check necessary because it happens more than once for some reason
config.shadowTiddlers["StyleSheetDiffFormatter"] = stylesheet;
store.addNotification("StyleSheetDiffFormatter", refreshStyles);
}
};
diffFormatter.added = {
name: 'diffAdded',
match: '^\\+',
termRegExp: /(\n)/mg,
handler: function(w)
{
var e = createTiddlyElement(w.output,'span',null,'added');
w.subWikifyTerm(e,this.termRegExp);
createTiddlyElement(w.output,'br');
}
};
diffFormatter.removed = {
name: 'diffRemoved',
match: '^-',
termRegExp: /(\n)/mg,
handler: function(w)
{
var e = createTiddlyElement(w.output,'span',null,'removed');
w.subWikifyTerm(e,this.termRegExp);
createTiddlyElement(w.output,'br');
}
};
diffFormatter.charDiff = {
name: 'diffChars',
match: '^(?:@@|[+-]{3}) ',
lookaheadRegExp: /^(?:@@|[+-]{3}) .*\n/mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
};
// add new formatters
diffFormatter.init();
config.formatters.push(diffFormatter.added);
config.formatters.push(diffFormatter.removed);
diffFormatter.replaceFormatter = function()
{
for(var i=0; i<config.formatters.length; i++) {
if(config.formatters[i].name == 'characterFormat') {
config.formatters.splice(i,0,diffFormatter.charDiff);
break;
}
}
};
diffFormatter.replaceFormatter();
}// end of 'install only once'
//}}}
This is not properly formatted, but it should take the first (default) or specified column of a table and list it.
2010-06-21
*--The macro should be designed with a column number parameter (to do). -- mp see [[testPlugin]]
<<jqTables [[testTable]] 3>>
/*{{{*/
//TAGSEARCH TOOLBAR OPTIONS
config.macros.tagsearch.cfg.toolbar="source:'TagSearchConfig##Tags' exclude:'' label:'tags ' tooltip:'Set tags' more:'TagSearchConfig##More' toolbar";
// config.options.chkSliderTopListA = true;
config.options.txtTheme = 'TWDefaultTheme';
config.options.chkAutoSave = false;
// Used with TagWithStoryCommand tiddler.
config.options.chkDisableTagWithStoryConfirm = false;
/*}}}*/
[[Intro]]
[[What's new]]
[[TiddlyWiki Reference|http://hoster.peermore.com/recipes/TiddlyWikiPatterns/tiddlers.wiki]]
[[InsideTW|http://www.tiddlytools.com/insideTW]]
[[jQuery AP Doku TW|http://fnd.lewcid.org/tmp/jQueryAPI.html]]
[[Join the Team|HowToJoinTeamWork]]
[[Join me in]]
[[Comments|2010.05.04@13:30:27]]
[[TeamWork video|HowToJoinTeamWork]]
----
<<selectTheme>>
<<selectPalette>>
/***
|grid:|EmasticGrid|
|ie:|EmasticIe|
|reset:|EmasticReset|
|type:|EmasticType|
|absoluteGrid:|EmasticAbsolut|
|gadgets:|EmasticGadgets|
|percentGrid:|EmasticPercent|
|semantic:|EmasticSemantic|
|freeStyle:|EmFreeStyle|
|Author:|Vladimir Carrer http://www.vcarrer.com/|
|License:|MIT license - see: http://code.google.com/p/emastic/|
|Source:|http://code.google.com/p/emastic/|
|Version:|emastic grid system V0.8 (beta 3)|
|Contributor:|Mario Pietsch|
!Description
The EmasticSystem has been generated to work with the ~FreeStyle package.
!Important
There have been ''no changes'' made to the CSS code, except covering it inside ~TiddlyWiki markup.
***/
/***
Only some parts are active at the moment, since the core works against an external layout, at the moment. (Or I haven't found the right switches :)
***/
/*{{{*/
/*[[EmasticReset] ]*/
/*[[EmasticIe] ]*/
/*[[EmasticType] ]*/
[[EmasticGrid]]
[[EmasticAbsolut]]
[[EmasticPercent]]
[[EmasticGadgets]]
/*-- need this at the moment. may be better solution --*/
[[EmFreeStyle]]
/*}}}*/
/***
|''Name:''|FieldsEditorPlugin|
|''Description:''|//create//, //edit//, //view// and //delete// commands in toolbar <<toolbar fields>>.|
|''Version:''|1.0.2|
|''Date:''|Dec 21,2007|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.2.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Demo:
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], see [[FieldEditor example]]
!Installation:
*import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
*save and reload
*optionnaly : add the following css text in your StyleSheet : {{{#popup tr.fieldTableRow td {padding:1px 3px 1px 3px;}}}
!Code
***/
//{{{
config.commands.fields.handlePopup = function(popup,title) {
var tiddler = store.fetchTiddler(title);
if(!tiddler)
return;
var fields = {};
store.forEachField(tiddler,function(tiddler,fieldName,value) {fields[fieldName] = value;},true);
var items = [];
for(var t in fields) {
var editCommand = "<<untiddledCall editFieldDialog "+escape(title)+" "+escape(t)+">>";
var deleteCommand = "<<untiddledCall deleteField "+escape(title)+" "+escape(t)+">>";
var renameCommand = "<<untiddledCall renameField "+escape(title)+" "+escape(t)+">>";
items.push({field: t,value: fields[t], actions: editCommand+renameCommand+deleteCommand});
}
items.sort(function(a,b) {return a.field < b.field ? -1 : (a.field == b.field ? 0 : +1);});
var createNewCommand = "<<untiddledCall createField "+escape(title)+">>";
items.push({field : "", value : "", actions:createNewCommand });
if(items.length > 0)
ListView.create(popup,items,this.listViewTemplate);
else
createTiddlyElement(popup,"div",null,null,this.emptyText);
}
config.commands.fields.listViewTemplate = {
columns: [
{name: 'Field', field: 'field', title: "Field", type: 'String'},
{name: 'Actions', field: 'actions', title: "Actions", type: 'WikiText'},
{name: 'Value', field: 'value', title: "Value", type: 'WikiText'}
],
rowClasses: [
{className: 'fieldTableRow', field: 'actions'}
],
buttons: [ //can't use button for selected then delete, because click on checkbox will hide the popup
]
}
config.macros.untiddledCall = { // when called from listview, tiddler is unset, so we need to pass tiddler as parameter
handler : function(place,macroName,params,wikifier,paramString) {
var macroName = params.shift();
if (macroName) var macro = config.macros[macroName];
var title = params.shift();
if (title) var tiddler = store.getTiddler(unescape(title));
if (macro) macro.handler(place,macroName,params,wikifier,paramString,tiddler);
}
}
config.macros.deleteField = {
handler : function(place,macroName,params,wikifier,paramString,tiddler) {
if(!readOnly && params[0]) {
fieldName = unescape(params[0]);
var btn = createTiddlyButton(place,"delete", "delete "+fieldName,this.onClickDeleteField);
btn.setAttribute("title",tiddler.title);
btn.setAttribute("fieldName", fieldName);
}
},
onClickDeleteField : function() {
var title=this.getAttribute("title");
var fieldName=this.getAttribute("fieldName");
var tiddler = store.getTiddler(title);
if (tiddler && fieldName && confirm("delete field " + fieldName+" from " + title +" tiddler ?")) {
delete tiddler.fields[fieldName];
store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
story.refreshTiddler(title,"ViewTemplate",true);
}
return false;
}
}
config.macros.createField = {
handler : function(place,macroName,params,wikifier,paramString,tiddler) {
if(!readOnly) {
var btn = createTiddlyButton(place,"create new", "create a new field",this.onClickCreateField);
btn.setAttribute("title",tiddler.title);
}
},
onClickCreateField : function() {
var title=this.getAttribute("title");
var tiddler = store.getTiddler(title);
if (tiddler) {
var fieldName = prompt("Field name","");
if (store.getValue(tiddler,fieldName)) {
window.alert("This field already exists.");
}
else if (fieldName) {
var v = prompt("Field value","");
tiddler.fields[fieldName]=v;
store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
story.refreshTiddler(title,"ViewTemplate",true);
}
}
return false;
}
}
config.macros.editFieldDialog = {
handler : function(place,macroName,params,wikifier,paramString,tiddler) {
if(!readOnly && params[0]) {
fieldName = unescape(params[0]);
var btn = createTiddlyButton(place,"edit", "edit this field",this.onClickEditFieldDialog);
btn.setAttribute("title",tiddler.title);
btn.setAttribute("fieldName", fieldName);
}
},
onClickEditFieldDialog : function() {
var title=this.getAttribute("title");
var tiddler = store.getTiddler(title);
var fieldName=this.getAttribute("fieldName");
if (tiddler && fieldName) {
var value = tiddler.fields[fieldName];
value = value ? value : "";
var lines = value.match(/\n/mg);
lines = lines ? true : false;
if (!lines || confirm("This field contains more than one line. Only the first line will be kept if you edit it here. Proceed ?")) {
var v = prompt("Field value",value);
tiddler.fields[fieldName]=v;
store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
story.refreshTiddler(title,"ViewTemplate",true);
}
}
return false;
}
}
config.macros.renameField = {
handler : function(place,macroName,params,wikifier,paramString,tiddler) {
if(!readOnly && params[0]) {
fieldName = unescape(params[0]);
var btn = createTiddlyButton(place,"rename", "rename "+fieldName,this.onClickRenameField);
btn.setAttribute("title",tiddler.title);
btn.setAttribute("fieldName", fieldName);
}
},
onClickRenameField : function() {
var title=this.getAttribute("title");
var fieldName=this.getAttribute("fieldName");
var tiddler = store.getTiddler(title);
if (tiddler && fieldName) {
var newName = prompt("Rename " + fieldName + " as ?", fieldName);
if (newName) {
tiddler.fields[newName]=tiddler.fields[fieldName];
delete tiddler.fields[fieldName];
store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
story.refreshTiddler(title,"ViewTemplate",true);
}
}
return false;
}
}
config.shadowTiddlers.StyleSheetFieldsEditor = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetFieldsEditor += ".fieldTableRow td {padding : 1px 3px}\n";
config.shadowTiddlers.StyleSheetFieldsEditor += ".fieldTableRow .button {border:0; padding : 0 0.2em}\n";
config.shadowTiddlers.StyleSheetFieldsEditor +="/*}}}*/";
store.addNotification("StyleSheetFieldsEditor", refreshStyles);
//}}}
/%
!info
|Name|SortXList|
|Source||
|Version|0.2.0|
|Author|Mario Pietsch|
|Derived from:|http://www.tiddlytools.com/#ToggleLeftSidebar|
|License|http://creativecommons.org/licenses/by-nc-sa/3.0/at/|
|~CoreVersion|2.6|
|Type|transclusion|
|Description|Activate xList drag and drop sorting.|
Usage
<<<
{{{
<<tiddler SortXList>>
<<tiddler SortXList with: label tooltip>>
<<tiddler SortXList with: "⇕" "Start xList sorter">>
}}}
Try to start xList sorter: <<tiddler SortXList##show
with: "⇕" "Start xList sorter">>
<<<
!end
!show
<<tiddler {{
// some init here
'';}}>><html><nowiki><a href='javascript:;' title="$2"
onmouseover="
this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
+encodeURIComponent(encodeURIComponent(this.onclick))
+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
if (!version.extensions.jqueryui) {alert('Styling is not active!\nYou need to use: [ActivateStyling] macro.'); return false;}
jQuery('.xList').sortable({
axis: 'y',
stop: function(event, ui) {
jQuery(ui.item).parent().attr('modified', 'true');
},
});
setStylesheet(
'.ui-sortable li:after{content: \'\u202F \u21D5\'; cursor: n-resize; border: 1px dotted gray; color:green}' , 'XListStyles');
return false;
">$1</a></html>
!end
%/<<tiddler {{
var src='SortXList';
src+(tiddler&&tiddler.title==src?'##info':'##show');
}} with: "$1" "$2">>
/%
!info
|Name|LoadRemotePlugin|
|Source|http://www.TiddlyTools.com/#LoadRemotePlugin|
|Version|2.0.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|Load a plugin from a remote .js URL|
Usage
<<<
{{{
<<tiddler LoadRemotePlugin with: "label" "tip" "URL"
"onloadfunction" "preloadedtest" "onrunfunction" "configoverlay">>
}}}
*''label'' and ''tip''<br>command link text and tooltip
*''URL''<br>location of .js (i.e., the remotely stored plugin file)
*''onloadfunction''<br>js code invoked after loading remote plugin (can be used to init values, display tiddlers, etc)
*''preloadedtest''<br>js expression evaluated to test if plugin has already been loaded
*''onrunfunction''<br>js code invoked //instead of onloadfunction// when plugin is already loaded
*''configoverlay''<br>name of tiddler containing js code with additional custom settings, tweaks, etc.
<<<
Examples
<<<
{{{
<<tiddler LoadRemotePlugin##show with:
[[ImportTiddlersPlugin]]
[[Load ImportTiddlersPlugin from svn.TiddlyWiki.org repository]]
[[http://svn.tiddlywiki.org/Trunk/contributors/EricShulman/plugins/ImportTiddlersPlugin.js]]
[[window.story.displayTiddler(null,'ImportTiddlers')]]
[[version.extensions.ImportTiddlersPlugin!=undefined]]
[[window.story.displayTiddler(null,'ImportTiddlers')]]
[[ImportTiddlersPluginConfig]]
>>
}}}
<<tiddler LoadRemotePlugin##Examples>>
<<<
!end
!Examples
*[[TiddlyTools|http://www.TiddlyTools.com/]]
**{{block{<<tiddler LoadRemotePlugin##show with:
[[ImportTiddlersPlugin]]
[[Load ImportTiddlersPlugin from svn.TiddlyWiki.org repository]]
[[http://svn.tiddlywiki.org/Trunk/contributors/EricShulman/plugins/ImportTiddlersPlugin.js]]
[[window.story.displayTiddler(null,'ImportTiddlers')]]
[[version.extensions.ImportTiddlersPlugin!=undefined]]
[[window.story.displayTiddler(null,'ImportTiddlers')]]
[[ImportTiddlersPluginConfig]]
>>}}}
**{{block{<<tiddler LoadRemotePlugin##show with:
[[TiddlerTweakerPlugin]]
[[Load TiddlerTweakerPlugin from svn.TiddlyWiki.org repository]]
[[http://svn.tiddlywiki.org/Trunk/contributors/EricShulman/plugins/TiddlerTweakerPlugin.js]]
[[window.story.displayTiddler(null,'TiddlerTweaker')]]
[[version.extensions.TiddlerTweakerPlugin!=undefined]]
>>}}}
**{{block{<<tiddler LoadRemotePlugin##show with:
[[RearrangeTiddlersPlugin]]
[[Load RearrangeTiddlersPlugin from www.TiddlyTools.com]]
[[http://www.TiddlyTools.com/plugins/RearrangeTiddlersPlugin.js]]
[[window.story.forEachTiddler(function(t,e){window.story.refreshTiddler(t,null,true)}); window.refreshDisplay()]]
[[Story.prototype.rearrangeTiddlersHijack_refreshTiddler!=undefined]]
>>}}}
*[[Abego Software|http://tiddlywiki.abego-software.de/]]
**{{block{<<tiddler LoadRemotePlugin##show with:
[[YourSearchPlugin]]
[[Load YourSearchPlugin from tiddlywiki.abego-software.de]]
[[http://tiddlywiki.abego-software.de/archive/YourSearchPlugin/Plugin-YourSearch-src.2.1.1.js]]
[[window.refreshPageTemplate()]]
[[version.extensions.YourSearchPlugin!=undefined]]
>>}}}
*[[FirefoxPrivileges.TiddlySpot.com|http://firefoxprivileges.tiddlyspot.com/]]
**{{block{<<tiddler LoadRemotePlugin##show with:
[[Firefox Privilege Manager]]
[[Load Firefox Privilege Manager from svn.TiddlyWiki.org repository]]
[[http://svn.tiddlywiki.org/Trunk/contributors/XavierVerges/plugins/FirefoxPrivilegesPlugin.js]]
[[config.macros.firefoxPrivileges.onload()]]
[[config.macros.firefoxPrivileges!=undefined]]
[[backstage.switchTab('firefoxPrivileges')]]
>>}}}
*[[BillyReisinger.com:|http://www.billyreisinger.com/jash/]]
**{{block{<<tiddler LoadRemotePlugin##show with:
[[Jash (JAvascript SHell)]]
[[Load Jash (JAvascript SHell) from www.billyreisinger.com/jash]]
[[http://www.billyreisinger.com/jash/source/latest/Jash.js]]
[[window.jash.close()]]
[[window.jash!=undefined]]
>>}}}
!end
!show
<html><nowiki><a href="javascript:;" title="$2"
onmouseover="
this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
+encodeURIComponent(encodeURIComponent(this.onclick))
+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
try { if ($5) {
clearMessage();
try {$6;} catch(e) {$4;}
displayMessage('$1 is already installed.');
return false;
} } catch(e){;}
var s=document.createElement('script');
s.src='$3';
s.onerror=function() {
clearMessage();
displayMessage('Could not load $1 from');
displayMessage(this.src,this.src);
};
s.onload=function() {
clearMessage();
{$4;}
try { eval(store.getTiddlerText('$7','')); }
catch(e) { displayMessage(e.description||e.toString()); }
displayMessage('$1 has been loaded from');
displayMessage(this.src,this.src);
};
s.onreadystatechange=function() /* for IE */
{ if(this.readyState=='complete') this.onload(); };
document.getElementsByTagName('head')[0].appendChild(s);
return false;
">$1</a></html>
!end
%/<<tiddler {{var src='LoadRemotePlugin';src+(tiddler&&tiddler.title==src?'##info':'##show');}}
with: [[$1]] [[$2]] [[$3]] [[$4]] [[$5]] [[$6]] [[$7]]>>
/***
jQuery List DragSort v0.3.10 dev
Website: http://dragsort.codeplex.com/
License: http://dragsort.codeplex.com/license
***/
//{{{
(function($) {
$.fn.dragsort = function(options) {
var opts = $.extend({}, $.fn.dragsort.defaults, options);
var lists = new Array();
var list = null, lastPos = null;
if (this.selector)
$("head").append("<style type='text/css'>" + (this.selector.split(",").join(" " + opts.dragSelector + ",") + " " + opts.dragSelector) + " { cursor: pointer; }</style>");
this.each(function(i, cont) {
if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
cont = $(cont).children().get(0);
var newList = {
draggedItem: null,
placeHolderItem: null,
pos: null,
offset: null,
offsetLimit: null,
container: cont,
init: function() {
$(this.container).attr("listIdx", i).mousedown(this.grabItem).find(opts.dragSelector).css("cursor", "pointer");
},
grabItem: function(e) {
if (e.button == 2 || $(e.target).is(opts.dragSelectorExclude))
return;
var elm = e.target;
while (!$(elm).is("[listIdx=" + $(this).attr("listIdx") + "] " + opts.dragSelector)) {
if (elm == this) return;
elm = elm.parentNode;
}
if (list != null && list.draggedItem != null)
list.dropItem();
$(e.target).css("cursor", "move");
list = lists[$(this).attr("listIdx")];
list.draggedItem = $(elm).closest(opts.itemSelector);
var mt = parseInt(list.draggedItem.css("marginTop"));
var ml = parseInt(list.draggedItem.css("marginLeft"));
list.offset = list.draggedItem.offset();
list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
if (!opts.dragBetween) {
var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + $(list.container).children(opts.itemSelector).size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight();
list.offsetLimit = $(list.container).offset();
list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
}
list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999 }).after(opts.placeHolderTemplate);
list.placeHolderItem = list.draggedItem.next().css("height", list.draggedItem.height()).attr("placeHolder", true);
$(lists).each(function(i, l) { l.ensureNotEmpty(); l.buildPositionTable(); });
list.setPos(e.pageX, e.pageY);
$(document).bind("selectstart", list.stopBubble); //stop ie text selection
$(document).bind("mousemove", list.swapItems);
$(document).bind("mouseup", list.dropItem);
return false; //stop moz text selection
},
setPos: function(x, y) {
var top = y - this.offset.top;
var left = x - this.offset.left;
if (!opts.dragBetween) {
top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
}
this.draggedItem.parents().each(function() {
if ($(this).css("position") != "static" && (!$.browser.mozilla || $(this).css("display") != "table")) {
var offset = $(this).offset();
top -= offset.top;
left -= offset.left;
return false;
}
});
this.draggedItem.css({ top: top, left: left });
},
buildPositionTable: function() {
var item = this.draggedItem == null ? null : this.draggedItem.get(0);
var pos = new Array();
$(this.container).children(opts.itemSelector).each(function(i, elm) {
if (elm != item) {
var loc = $(elm).offset();
loc.right = loc.left + $(elm).width();
loc.bottom = loc.top + $(elm).height();
loc.elm = elm;
pos.push(loc);
}
});
this.pos = pos;
},
dropItem: function() {
if (list.draggedItem == null)
return;
$(list.container).find(opts.dragSelector).css("cursor", "pointer");
list.placeHolderItem.before(list.draggedItem);
list.draggedItem.css({ position: "", top: "", left: "", opacity: "", "z-index": "" });
list.placeHolderItem.remove();
$("*[emptyPlaceHolder]").remove();
opts.dragEnd.apply(list.draggedItem);
list.draggedItem = null;
$(document).unbind("selectstart", list.stopBubble);
$(document).unbind("mousemove", list.swapItems);
$(document).unbind("mouseup", list.dropItem);
return false;
},
stopBubble: function() { return false; },
swapItems: function(e) {
if (list.draggedItem == null)
return false;
list.setPos(e.pageX, e.pageY);
var ei = list.findPos(e.pageX, e.pageY);
var nlist = list;
for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
ei = lists[i].findPos(e.pageX, e.pageY);
nlist = lists[i];
}
if (ei == -1 || $(nlist.pos[ei].elm).attr("placeHolder"))
return false;
if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
$(nlist.pos[ei].elm).before(list.placeHolderItem);
else
$(nlist.pos[ei].elm).after(list.placeHolderItem);
$(lists).each(function(i, l) { l.ensureNotEmpty(); l.buildPositionTable(); });
lastPos = list.draggedItem.offset();
return false;
},
findPos: function(x, y) {
for (var i = 0; i < this.pos.length; i++) {
if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
return i;
}
return -1;
},
ensureNotEmpty: function() {
if (!opts.dragBetween)
return;
var item = this.draggedItem == null ? null : this.draggedItem.get(0);
var emptyPH = null, empty = true;
$(this.container).children(opts.itemSelector).each(function(i, elm) {
if ($(elm).attr("emptyPlaceHolder"))
emptyPH = elm;
else if (elm != item)
empty = false;
});
if (empty && emptyPH == null)
$(this.container).append(opts.placeHolderTemplate).children(":last").attr("emptyPlaceHolder", true);
else if (!empty && emptyPH != null)
$(emptyPH).remove();
}
};
newList.init();
lists.push(newList);
});
return this;
};
$.fn.dragsort.defaults = {
itemSelector: "li",
dragSelector: "li",
dragSelectorExclude: "input, a[href]",
dragEnd: function() { },
dragBetween: false,
placeHolderTemplate: "<li> </li>"
};
})(jQuery);
//}}}
/*{{{*/
/*
*
* jQuery listnav plugin
* Copyright (c) 2009 iHwy, Inc.
* Author: Jack Killpatrick
*
* Version 2.0 (03/02/2009)
* Requires jQuery 1.3.2, jquery 1.2.6 or jquery 1.2.x plus the jquery dimensions plugin
*
* Visit http://www.ihwy.com/labs/jquery-listnav-plugin.aspx for more information.
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
(function($) {
$.fn.listnav = function(options) {
var opts = $.extend({}, $.fn.listnav.defaults, options);
var letters = ['_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
var firstClick = false;
return this.each(function(){
var $wrapper, list, $list, $letters, $letterCount, id;
id = this.id;
$wrapper = $('#' + id + '-nav'); // user must abide by the convention: <ul id="myList"> for list and <div id="myList-nav"> for nav wrapper
$list = $(this);
var counts = {}, allCount = 0, isAll = true, numCount = 0, prevLetter = '';
function init(){
$wrapper.append( createLettersHtml() );
$letters = $('.ln-letters', $wrapper).slice(0,1); // will always be a single item
if (opts.showCounts) $letterCount = $('.ln-letter-count', $wrapper).slice(0,1); // will always be a single item
$('.z', $letters).addClass('ln-last'); // allows for styling a case where last item needs right border set (because items before that only have top, left and bottom so that border between items isn't doubled)
addClasses();
addNoMatchLI();
if (opts.flagDisabled) addDisabledClass();
bindHandlers();
if (! opts.includeAll) $list.show(); // show the list in case the recommendation for includeAll=false was taken
// decide whether to show all or click on a letter
//
if (! opts.includeAll) $('.all', $letters).hide();
if (! opts.includeNums) $('._', $letters).hide();
if($.cookie && (opts.cookieName != null)){
var cookieLetter = $.cookie(opts.cookieName);
if(cookieLetter != null) opts.initLetter = cookieLetter;
}
if (opts.initLetter != ''){
firstClick = true;
$('.' + opts.initLetter.toLowerCase(), $letters).slice(0,1).click(); // click the initLetter if there was one
}
else {
if (opts.includeAll) $('.all', $letters).addClass('ln-selected'); // showing all: we don't need to click this: the whole list is already loaded
else { // ALL link is hidden, click the first letter that will display LI's
for(var i=((opts.includeNums)?0:1);i<letters.length;i++){
if(counts[letters[i]] > 0){
firstClick = true;
$('.' + letters[i], $letters).slice(0,1).click();
break;
}
}
}
}
}
// positions the letter count div above the letter links (so we only have to do it once: after this we just change it's left position via mouseover)
//
function setLetterCountTop(){
$letterCount.css({top: $('.a', $letters).slice(0,1).offset({margin:false, border:true}).top - $letterCount.outerHeight({margin:true})}); // note: don't set top based on '.all': it might not be visible
}
// adds a class to each LI that has text content inside of it (ie, inside an <a>, a <div>, nested DOM nodes, etc)
//
function addClasses(){
var str, firstChar;
$($list).children().each(function(){
str = $(this).text().replace(/\s+/g,''); //.toLowerCase(); // strip all white space from text (including tabs and linebreaks that might have been in the HTML) // thanks to Liam Byrne, liam@onsight.ie
if (str != '') {
firstChar = str.slice(0,1).toLowerCase();
if(! isNaN(firstChar)) firstChar = '_'; // use '_' if the first char is a number
$(this).addClass('ln-' + firstChar);
if(counts[firstChar] == undefined) counts[firstChar] = 0;
counts[firstChar]++;
allCount++;
}
});
}
function addDisabledClass(){
for(var i=0;i<letters.length;i++){
if(counts[letters[i]] == undefined) $('.' + letters[i], $letters).addClass('ln-disabled');
}
}
function addNoMatchLI(){
$list.append('<li class="ln-no-match" style="display:none">' + opts.noMatchText + '</li>');
}
function getLetterCount(el){
if($(el).hasClass('all')) return allCount;
else {
var count = counts[ $(el).attr('class').split(' ')[0] ];
return (count != undefined) ? count : 0; // some letters may not have a count in the hash
}
}
function bindHandlers(){
// sets the top position of the count div in case something above it on the page has resized
//
if (opts.showCounts){
$wrapper.mouseover(function(){
setLetterCountTop();
});
}
// mouseover for each letter: shows the count above the letter
//
if (opts.showCounts){
$('a', $letters).mouseover(function(){
var left = $(this).position().left;
var width = ($(this).outerWidth({margin:true})-1) + 'px'; // the -1 is to tweak the width a bit due to a seeming inaccuracy in jquery ui/dimensions outerWidth (same result in FF2 and IE6/7)
var count = getLetterCount(this);
$letterCount.css({left:left, width:width}).text( count ).show() ; // set left position and width of letter count, set count text and show it
});
// mouseout for each letter: hide the count
//
$('a', $letters).mouseout(function(){
$letterCount.hide();
});
}
// click handler for letters: shows/hides relevant LI's
//
$('a', $letters).click(function(){
$('a.ln-selected', $letters).removeClass('ln-selected');
var letter = $(this).attr('class').split(' ')[0];
if(letter == 'all'){
$list.children().show();
$list.children('.ln-no-match').hide();
isAll = true;
} else {
if(isAll){
$list.children().hide();
isAll = false;
} else if (prevLetter != '') $list.children('.ln-' + prevLetter).hide();
var count = getLetterCount(this);
if (count > 0) {
$list.children('.ln-no-match').hide(); // in case it's showing
$list.children('.ln-' + letter).show();
}
else $list.children('.ln-no-match').show();
prevLetter = letter;
}
if($.cookie && (opts.cookieName != null)) $.cookie(opts.cookieName, letter);
$(this).addClass('ln-selected');
$(this).blur();
if (!firstClick && (opts.onClick != null)) opts.onClick(letter);
else firstClick = false;
return false;
});
}
// creates the HTML for the letter links
//
function createLettersHtml(){
var html = [];
for(var i=1;i<letters.length;i++){
if (html.length == 0) html.push('<a class="all" href="#">ALL</a><a class="_" href="#">0-9</a>');
html.push('<a class="' + letters[i] + '" href="#">' + letters[i].toUpperCase() + '</a>');
}
return '<div class="ln-letters">' + html.join('') + '</div>' + ((opts.showCounts) ? '<div class="ln-letter-count" style="display:none; position:absolute; top:0; left:0; width:20px;">0</div>' : ''); // the styling for ln-letter-count is to give us a starting point for the element, which will be repositioned when made visible (ie, should not need to be styled by the user)
}
init();
});
};
$.fn.listnav.defaults = {
initLetter: '',
includeAll: true,
includeNums: true,
flagDisabled: true,
noMatchText: 'No matching entries',
showCounts: true,
cookieName: null,
onClick: null
};
})(jQuery);
/*}}}*/
!Visual ~HowTo
http://www.youtube.com/watch?v=WzHRHLd7tyk
!General
At the moment, everyone has write access.
This experiment was generated to give the group access to a "sandbox", where everyone can post and test short scripts or plugins and can get direct help from others.
!Register at Hoster
You need an account at: http://hoster.peermore.com
You need an openID: yourOpenID
!Create a TiddlyWiki at hoster
*register at hoster
*at your account click the "Wiki +" button
**Add a New Wiki
***Recipe Name: TeamWorkYourName
***Description: eg: collab with pmario's TeamWork experiment
**Bag Info:
***system
***TeamPubYourName
Now you have a Wiki named ~TeamWorkYourName
*click ~TeamWorkYourName
**On the right side you should see Policy, which should be "public"
*You shuld see
**''~TeamWorkYourName''
**1. system,
**2. TeamPubYourName,
*Click 2. ~TeamPubYourName which is a bag
**The policy of this bag (right side) will be all 'private'
**Change it to 'protected'. Now only you have write access.
**Don't forget to "submit"
Well done!
Now we need a new 'private' bag
*Go to your account. (Top left button user: YourName)
*Click "Bags +" button
**Add a new bag
**bag name: TeamPrivate
**description: my private ~TeamWork bag
**accept
Now the bag needs to be added to your ~TeamWorkYourName recipe
*Go to your account
*''Drag and drop'' the new bag onto the "TeamWorkYourName" recipe
**A dialog should pup up "Edit ~TeamWorkYourName"
***~TeamWorkYourName
****1. system,
****2. TeamPubYourName,
****3. TeamPublic
**Click OK
!Tell me your protected bag
Tell me the link to your "protected" bag, so that I can include it into this recipe.
That's it.
/***
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/99243b30d5edbd7b?hl=en
***/
//{{{
(function(formatters) { //# set up alias
for (var i=0; i<formatters.length; i++) {
if (formatters[i].name == "characterFormat") {
// merge( formatters[i], {match: "''|//|__|\\^\\^|~~|--(?!\\s|$)|\\{\\{\\{"}); /*original match*/
merge( formatters[i], {match: "''|//|__|\\^\\^|~~(?!\\s|$)|\\{\\{\\{"});
} // if
} // for
})(config.formatters); //# end of alias
//}}}
! Prose
{{{
fx_sinx: f(x) = sin(x)
ffx_sinx: f'(x) = cos(x)
}}}
!Latex
{{{
l_fx_sinx: f\left(x\right)\:=sin\left(x\right)\:
l_ffx_sinx: f'\left(x\right)\:=cos\left(x\right)\:
}}}
/***
|''Name:''|DataTiddlerPlugin|
|''Version:''|1.0.6 (2006-08-26)|
|''Source:''|http://tiddlywiki.abego-software.de/#DataTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
!Description
Enhance your tiddlers with structured data (such as strings, booleans, numbers, or even arrays and compound objects) that can be easily accessed and modified through named fields (in JavaScript code).
Such tiddler data can be used in various applications. E.g. you may create tables that collect data from various tiddlers.
''//Example: "Table with all December Expenses"//''
{{{
<<forEachTiddler
where
'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'
write
'"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\n"'
>>
}}}
//(This assumes that expenses are stored in tiddlers tagged with "expense".)//
<<forEachTiddler
where
'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'
write
'"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\n"'
>>
For other examples see DataTiddlerExamples.
''Access and Modify Tiddler Data''
You can "attach" data to every tiddler by assigning a JavaScript value (such as a string, boolean, number, or even arrays and compound objects) to named fields.
These values can be accessed and modified through the following Tiddler methods:
|!Method|!Example|!Description|
|{{{data(field)}}}|{{{t.data("age")}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|
|{{{data(field,defaultValue)}}}|{{{t.data("isVIP",false)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|
|{{{data()}}}|{{{t.data()}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|
|{{{setData(field,value)}}}|{{{t.setData("age",42)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|
|{{{setData(field,value,defaultValue)}}}|{{{t.setData("isVIP",flag,false)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|
Alternatively you may use the following functions to access and modify the data. In this case the tiddler argument is either a tiddler or the name of a tiddler.
|!Method|!Description|
|{{{DataTiddler.getData(tiddler,field)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|
|{{{DataTiddler.getData(tiddler,field,defaultValue)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|
|{{{DataTiddler.getDataObject(tiddler)}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|
|{{{DataTiddler.setData(tiddler,field,value)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|
|{{{DataTiddler.setData(tiddler,field,value,defaultValue)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|
//(For details on the various functions see the detailed comments in the source code.)//
''Data Representation in a Tiddler''
The data of a tiddler is stored as plain text in the tiddler's content/text, inside a "data" section that is framed by a {{{<data>...</data>}}} block. Inside the data section the information is stored in the [[JSON format|http://www.crockford.com/JSON/index.html]].
//''Data Section Example:''//
{{{
<data>{"isVIP":true,"user":"John Brown","age":34}</data>
}}}
The data section is not displayed when viewing the tiddler (see also "The showData Macro").
Beside the data section a tiddler may have all kind of other content.
Typically you will not access the data section text directly but use the methods given above. Nevertheless you may retrieve the text of the data section's content through the {{{DataTiddler.getDataText(tiddler)}}} function.
''Saving Changes''
The "setData" methods respect the "ForceMinorUpdate" and "AutoSave" configuration values. I.e. when "ForceMinorUpdate" is true changing a value using setData will not affect the "modifier" and "modified" attributes. With "AutoSave" set to true every setData will directly save the changes after a setData.
''Notifications''
No notifications are sent when a tiddler's data value is changed through the "setData" methods.
''Escape Data Section''
In case that you want to use the text {{{<data>}}} or {{{</data>}}} in a tiddler text you must prefix the text with a tilde ('~'). Otherwise it may be wrongly considered as the data section. The tiddler text {{{~<data>}}} is displayed as {{{<data>}}}.
''The showData Macro''
By default the data of a tiddler (that is stored in the {{{<data>...</data>}}} section of the tiddler) is not displayed. If you want to display this data you may used the {{{<<showData ...>>}}} macro:
''Syntax:''
|>|{{{<<}}}''showData '' [''JSON''] [//tiddlerName//] {{{>>}}}|
|''JSON''|By default the data is rendered as a table with a "Name" and "Value" column. When defining ''JSON'' the data is rendered in JSON format|
|//tiddlerName//|Defines the tiddler holding the data to be displayed. When no tiddler is given the tiddler containing the showData macro is used. When the tiddler name contains spaces you must quote the name (or use the {{{[[...]]}}} syntax.)|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|
!Revision history
* v1.0.6 (2006-08-26)
** Removed misleading comment
* v1.0.5 (2006-02-27) (Internal Release Only)
** Internal
*** Make "JSLint" conform
* v1.0.4 (2006-02-05)
** Bugfix: showData fails in TiddlyWiki 2.0
* v1.0.3 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.2 (2005-12-22)
** Enhancements:
*** Handle texts "<data>" or "</data>" more robust when used in a tiddler text or as a field value.
*** Improved (JSON) error messages.
** Bugs fixed:
*** References are not updated when using the DataTiddler.
*** Changes to compound objects are not always saved.
*** "~</data>" is not rendered correctly (expected "</data>")
* v1.0.1 (2005-12-13)
** Features:
*** The showData macro supports an optional "tiddlername" argument to specify the tiddler containing the data to be displayed
** Bugs fixed:
*** A script immediately following a data section is deleted when the data is changed. (Thanks to GeoffS for reporting.)
* v1.0.0 (2005-12-12)
** initial version
!Code
***/
//{{{
//============================================================================
//============================================================================
// DataTiddlerPlugin
//============================================================================
//============================================================================
// Ensure that the DataTiddler Plugin is only installed once.
//
if (!version.extensions.DataTiddlerPlugin) {
version.extensions.DataTiddlerPlugin = {
major: 1, minor: 0, revision: 6,
date: new Date(2006, 7, 26),
type: 'plugin',
source: "http://tiddlywiki.abego-software.de/#DataTiddlerPlugin"
};
// For backward compatibility with v1.2.x
//
if (!window.story) window.story=window;
if (!TiddlyWiki.prototype.getTiddler) {
TiddlyWiki.prototype.getTiddler = function(title) {
var t = this.tiddlers[title];
return (t !== undefined && t instanceof Tiddler) ? t : null;
};
}
//============================================================================
// DataTiddler Class
//============================================================================
// ---------------------------------------------------------------------------
// Configurations and constants
// ---------------------------------------------------------------------------
function DataTiddler() {
}
DataTiddler = {
// Function to stringify a JavaScript value, producing the text for the data section content.
// (Must match the implementation of DataTiddler.parse.)
//
stringify : null,
// Function to parse the text for the data section content, producing a JavaScript value.
// (Must match the implementation of DataTiddler.stringify.)
//
parse : null
};
// Ensure access for IE
window.DataTiddler = DataTiddler;
// ---------------------------------------------------------------------------
// Data Accessor and Mutator
// ---------------------------------------------------------------------------
// Returns the value of the given data field of the tiddler.
// When no such field is defined or its value is undefined
// the defaultValue is returned.
//
// @param tiddler either a tiddler name or a tiddler
//
DataTiddler.getData = function(tiddler, field, defaultValue) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler;
}
return DataTiddler.getTiddlerDataValue(t, field, defaultValue);
};
// Sets the value of the given data field of the tiddler to
// the value. When the value is equal to the defaultValue
// no value is set (and the field is removed)
//
// Changing data of a tiddler will not trigger notifications.
//
// @param tiddler either a tiddler name or a tiddler
//
DataTiddler.setData = function(tiddler, field, value, defaultValue) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler+ "("+t+")";
}
DataTiddler.setTiddlerDataValue(t, field, value, defaultValue);
};
// Returns the data object of the tiddler, with a property for every field.
//
// The properties of the returned data object may only be read and
// not be modified. To modify the data use DataTiddler.setData(...)
// or the corresponding Tiddler method.
//
// If no data section is defined a new (empty) object is returned.
//
// @param tiddler either a tiddler name or a Tiddler
//
DataTiddler.getDataObject = function(tiddler) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler;
}
return DataTiddler.getTiddlerDataObject(t);
};
// Returns the text of the content of the data section of the tiddler.
//
// When no data section is defined for the tiddler null is returned
//
// @param tiddler either a tiddler name or a Tiddler
// @return [may be null]
//
DataTiddler.getDataText = function(tiddler) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler;
}
return DataTiddler.readDataSectionText(t);
};
// ---------------------------------------------------------------------------
// Internal helper methods (must not be used by code from outside this plugin)
// ---------------------------------------------------------------------------
// Internal.
//
// The original JSONError is not very user friendly,
// especially it does not define a toString() method
// Therefore we extend it here.
//
DataTiddler.extendJSONError = function(ex) {
if (ex.name == 'JSONError') {
ex.toString = function() {
return ex.name + ": "+ex.message+" ("+ex.text+")";
};
}
return ex;
};
// Internal.
//
// @param t a Tiddler
//
DataTiddler.getTiddlerDataObject = function(t) {
if (t.dataObject === undefined) {
var data = DataTiddler.readData(t);
t.dataObject = (data) ? data : {};
}
return t.dataObject;
};
// Internal.
//
// @param tiddler a Tiddler
//
DataTiddler.getTiddlerDataValue = function(tiddler, field, defaultValue) {
var value = DataTiddler.getTiddlerDataObject(tiddler)[field];
return (value === undefined) ? defaultValue : value;
};
// Internal.
//
// @param tiddler a Tiddler
//
DataTiddler.setTiddlerDataValue = function(tiddler, field, value, defaultValue) {
var data = DataTiddler.getTiddlerDataObject(tiddler);
var oldValue = data[field];
if (value == defaultValue) {
if (oldValue !== undefined) {
delete data[field];
DataTiddler.save(tiddler);
}
return;
}
data[field] = value;
DataTiddler.save(tiddler);
};
// Internal.
//
// Reads the data section from the tiddler's content and returns its text
// (as a String).
//
// Returns null when no data is defined.
//
// @param tiddler a Tiddler
// @return [may be null]
//
DataTiddler.readDataSectionText = function(tiddler) {
var matches = DataTiddler.getDataTiddlerMatches(tiddler);
if (matches === null || !matches[2]) {
return null;
}
return matches[2];
};
// Internal.
//
// Reads the data section from the tiddler's content and returns it
// (as an internalized object).
//
// Returns null when no data is defined.
//
// @param tiddler a Tiddler
// @return [may be null]
//
DataTiddler.readData = function(tiddler) {
var text = DataTiddler.readDataSectionText(tiddler);
try {
return text ? DataTiddler.parse(text) : null;
} catch(ex) {
throw DataTiddler.extendJSONError(ex);
}
};
// Internal.
//
// Returns the serialized text of the data of the given tiddler, as it
// should be stored in the data section.
//
// @param tiddler a Tiddler
//
DataTiddler.getDataTextOfTiddler = function(tiddler) {
var data = DataTiddler.getTiddlerDataObject(tiddler);
return DataTiddler.stringify(data);
};
// Internal.
//
DataTiddler.indexOfNonEscapedText = function(s, subString, startIndex) {
var index = s.indexOf(subString, startIndex);
while ((index > 0) && (s[index-1] == '~')) {
index = s.indexOf(subString, index+1);
}
return index;
};
// Internal.
//
DataTiddler.getDataSectionInfo = function(text) {
// Special care must be taken to handle "<data>" and "</data>" texts inside
// a data section.
// Also take care not to use an escaped <data> (i.e. "~<data>") as the start
// of a data section. (Same for </data>)
// NOTE: we are explicitly searching for a data section that contains a JSON
// string, i.e. framed with braces. This way we are little bit more robust in
// case the tiddler contains unescaped texts "<data>" or "</data>". This must
// be changed when using a different stringifier.
var startTagText = "<data>{";
var endTagText = "}</data>";
var startPos = 0;
// Find the first not escaped "<data>".
var startDataTagIndex = DataTiddler.indexOfNonEscapedText(text, startTagText, 0);
if (startDataTagIndex < 0) {
return null;
}
// Find the *last* not escaped "</data>".
var endDataTagIndex = text.indexOf(endTagText, startDataTagIndex);
if (endDataTagIndex < 0) {
return null;
}
var nextEndDataTagIndex;
while ((nextEndDataTagIndex = text.indexOf(endTagText, endDataTagIndex+1)) >= 0) {
endDataTagIndex = nextEndDataTagIndex;
}
return {
prefixEnd: startDataTagIndex,
dataStart: startDataTagIndex+(startTagText.length)-1,
dataEnd: endDataTagIndex,
suffixStart: endDataTagIndex+(endTagText.length)
};
};
// Internal.
//
// Returns the "matches" of a content of a DataTiddler on the
// "data" regular expression. Return null when no data is defined
// in the tiddler content.
//
// Group 1: text before data section (prefix)
// Group 2: content of data section
// Group 3: text behind data section (suffix)
//
// @param tiddler a Tiddler
// @return [may be null] null when the tiddler contains no data section, otherwise see above.
//
DataTiddler.getDataTiddlerMatches = function(tiddler) {
var text = tiddler.text;
var info = DataTiddler.getDataSectionInfo(text);
if (!info) {
return null;
}
var prefix = text.substr(0,info.prefixEnd);
var data = text.substr(info.dataStart, info.dataEnd-info.dataStart+1);
var suffix = text.substr(info.suffixStart);
return [text, prefix, data, suffix];
};
// Internal.
//
// Saves the data in a <data> block of the given tiddler (as a minor change).
//
// The "chkAutoSave" and "chkForceMinorUpdate" options are respected.
// I.e. the TiddlyWiki *file* is only saved when AutoSave is on.
//
// Notifications are not send.
//
// This method should only be called when the data really has changed.
//
// @param tiddler
// the tiddler to be saved.
//
DataTiddler.save = function(tiddler) {
var matches = DataTiddler.getDataTiddlerMatches(tiddler);
var prefix;
var suffix;
if (matches === null) {
prefix = tiddler.text;
suffix = "";
} else {
prefix = matches[1];
suffix = matches[3];
}
var dataText = DataTiddler.getDataTextOfTiddler(tiddler);
var newText =
(dataText !== null)
? prefix + "<data>" + dataText + "</data>" + suffix
: prefix + suffix;
if (newText != tiddler.text) {
// make the change in the tiddlers text
// ... see DataTiddler.MyTiddlerChangedFunction
tiddler.isDataTiddlerChange = true;
// ... do the action change
tiddler.set(
tiddler.title,
newText,
config.options.txtUserName,
config.options.chkForceMinorUpdate? undefined : new Date(),
tiddler.tags);
// ... see DataTiddler.MyTiddlerChangedFunction
delete tiddler.isDataTiddlerChange;
// Mark the store as dirty.
store.dirty = true;
// AutoSave if option is selected
if(config.options.chkAutoSave) {
saveChanges();
}
}
};
// Internal.
//
DataTiddler.MyTiddlerChangedFunction = function() {
// Remove the data object from the tiddler when the tiddler is changed
// by code other than DataTiddler code.
//
// This is necessary since the data object is just a "cached version"
// of the data defined in the data section of the tiddler and the
// "external" change may have changed the content of the data section.
// Thus we are not sure if the data object reflects the data section
// contents.
//
// By deleting the data object we ensure that the data object is
// reconstructed the next time it is needed, with the data defined by
// the data section in the tiddler's text.
// To indicate that a change is a "DataTiddler change" a temporary
// property "isDataTiddlerChange" is added to the tiddler.
if (this.dataObject && !this.isDataTiddlerChange) {
delete this.dataObject;
}
// call the original code.
DataTiddler.originalTiddlerChangedFunction.apply(this, arguments);
};
//============================================================================
// Formatters
//============================================================================
// This formatter ensures that "~<data>" is rendered as "<data>". This is used to
// escape the "<data>" of a data section, just in case someone really wants to use
// "<data>" as a text in a tiddler and not start a data section.
//
// Same for </data>.
//
config.formatters.push( {
name: "data-escape",
match: "~<\\/?data>",
handler: function(w) {
w.outputText(w.output,w.matchStart + 1,w.nextMatch);
}
} );
// This formatter ensures that <data>...</data> sections are not rendered.
//
config.formatters.push( {
name: "data",
match: "<data>",
handler: function(w) {
var info = DataTiddler.getDataSectionInfo(w.source);
if (info && info.prefixEnd == w.matchStart) {
w.nextMatch = info.suffixStart;
} else {
w.outputText(w.output,w.matchStart,w.nextMatch);
}
}
} );
//============================================================================
// Tiddler Class Extension
//============================================================================
// "Hijack" the changed method ---------------------------------------------------
DataTiddler.originalTiddlerChangedFunction = Tiddler.prototype.changed;
Tiddler.prototype.changed = DataTiddler.MyTiddlerChangedFunction;
// Define accessor methods -------------------------------------------------------
// Returns the value of the given data field of the tiddler. When no such field
// is defined or its value is undefined the defaultValue is returned.
//
// When field is undefined (or null) the data object is returned. (See
// DataTiddler.getDataObject.)
//
// @param field [may be null, undefined]
// @param defaultValue [may be null, undefined]
// @return [may be null, undefined]
//
Tiddler.prototype.data = function(field, defaultValue) {
return (field)
? DataTiddler.getTiddlerDataValue(this, field, defaultValue)
: DataTiddler.getTiddlerDataObject(this);
};
// Sets the value of the given data field of the tiddler to the value. When the
// value is equal to the defaultValue no value is set (and the field is removed).
//
// @param value [may be null, undefined]
// @param defaultValue [may be null, undefined]
//
Tiddler.prototype.setData = function(field, value, defaultValue) {
DataTiddler.setTiddlerDataValue(this, field, value, defaultValue);
};
//============================================================================
// showData Macro
//============================================================================
config.macros.showData = {
// Standard Properties
label: "showData",
prompt: "Display the values stored in the data section of the tiddler"
};
config.macros.showData.handler = function(place,macroName,params) {
// --- Parsing ------------------------------------------
var i = 0; // index running over the params
// Parse the optional "JSON"
var showInJSONFormat = false;
if ((i < params.length) && params[i] == "JSON") {
i++;
showInJSONFormat = true;
}
var tiddlerName = story.findContainingTiddler(place).id.substr(7);
if (i < params.length) {
tiddlerName = params[i];
i++;
}
// --- Processing ------------------------------------------
try {
if (showInJSONFormat) {
this.renderDataInJSONFormat(place, tiddlerName);
} else {
this.renderDataAsTable(place, tiddlerName);
}
} catch (e) {
this.createErrorElement(place, e);
}
};
config.macros.showData.renderDataInJSONFormat = function(place,tiddlerName) {
var text = DataTiddler.getDataText(tiddlerName);
if (text) {
createTiddlyElement(place,"pre",null,null,text);
}
};
config.macros.showData.renderDataAsTable = function(place,tiddlerName) {
var text = "|!Name|!Value|\n";
var data = DataTiddler.getDataObject(tiddlerName);
if (data) {
for (var i in data) {
var value = data[i];
text += "|"+i+"|"+DataTiddler.stringify(value)+"|\n";
}
}
wikify(text, place);
};
// Internal.
//
// Creates an element that holds an error message
//
config.macros.showData.createErrorElement = function(place, exception) {
var message = (exception.description) ? exception.description : exception.toString();
return createTiddlyElement(place,"span",null,"showDataError","<<showData ...>>: "+message);
};
// ---------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// ---------------------------------------------------------------------------
//
setStylesheet(
".showDataError{color: #ffffff;background-color: #880000;}",
"showData");
} // of "install only once"
// Used Globals (for JSLint) ==============
// ... TiddlyWiki Core
/*global createTiddlyElement, saveChanges, store, story, wikify */
// ... DataTiddler
/*global DataTiddler */
// ... JSON
/*global JSON */
/***
!JSON Code, used to serialize the data
***/
/*
Copyright (c) 2005 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
The global object JSON contains two methods.
JSON.stringify(value) takes a JavaScript value and produces a JSON text.
The value must not be cyclical.
JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
throw a 'JSONError' exception if there is an error.
*/
var JSON = {
copyright: '(c)2005 JSON.org',
license: 'http://www.crockford.com/JSON/license.html',
/*
Stringify a JavaScript value, producing a JSON text.
*/
stringify: function (v) {
var a = [];
/*
Emit a string.
*/
function e(s) {
a[a.length] = s;
}
/*
Convert a value.
*/
function g(x) {
var c, i, l, v;
switch (typeof x) {
case 'object':
if (x) {
if (x instanceof Array) {
e('[');
l = a.length;
for (i = 0; i < x.length; i += 1) {
v = x[i];
if (typeof v != 'undefined' &&
typeof v != 'function') {
if (l < a.length) {
e(',');
}
g(v);
}
}
e(']');
return;
} else if (typeof x.toString != 'undefined') {
e('{');
l = a.length;
for (i in x) {
v = x[i];
if (x.hasOwnProperty(i) &&
typeof v != 'undefined' &&
typeof v != 'function') {
if (l < a.length) {
e(',');
}
g(i);
e(':');
g(v);
}
}
return e('}');
}
}
e('null');
return;
case 'number':
e(isFinite(x) ? +x : 'null');
return;
case 'string':
l = x.length;
e('"');
for (i = 0; i < l; i += 1) {
c = x.charAt(i);
if (c >= ' ') {
if (c == '\\' || c == '"') {
e('\\');
}
e(c);
} else {
switch (c) {
case '\b':
e('\\b');
break;
case '\f':
e('\\f');
break;
case '\n':
e('\\n');
break;
case '\r':
e('\\r');
break;
case '\t':
e('\\t');
break;
default:
c = c.charCodeAt();
e('\\u00' + Math.floor(c / 16).toString(16) +
(c % 16).toString(16));
}
}
}
e('"');
return;
case 'boolean':
e(String(x));
return;
default:
e('null');
return;
}
}
g(v);
return a.join('');
},
/*
Parse a JSON text, producing a JavaScript value.
*/
parse: function (text) {
var p = /^\s*(([,:{}\[\]])|"(\\.|[^\x00-\x1f"\\])*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)\s*/,
token,
operator;
function error(m, t) {
throw {
name: 'JSONError',
message: m,
text: t || operator || token
};
}
function next(b) {
if (b && b != operator) {
error("Expected '" + b + "'");
}
if (text) {
var t = p.exec(text);
if (t) {
if (t[2]) {
token = null;
operator = t[2];
} else {
operator = null;
try {
token = eval(t[1]);
} catch (e) {
error("Bad token", t[1]);
}
}
text = text.substring(t[0].length);
} else {
error("Unrecognized token", text);
}
} else {
token = operator = undefined;
}
}
function val() {
var k, o;
switch (operator) {
case '{':
next('{');
o = {};
if (operator != '}') {
for (;;) {
if (operator || typeof token != 'string') {
error("Missing key");
}
k = token;
next();
next(':');
o[k] = val();
if (operator != ',') {
break;
}
next(',');
}
}
next('}');
return o;
case '[':
next('[');
o = [];
if (operator != ']') {
for (;;) {
o.push(val());
if (operator != ',') {
break;
}
next(',');
}
}
next(']');
return o;
default:
if (operator !== null) {
error("Missing value");
}
k = token;
next();
return k;
}
}
next();
return val();
}
};
/***
!Setup the data serialization
***/
DataTiddler.format = "JSON";
DataTiddler.stringify = JSON.stringify;
DataTiddler.parse = JSON.parse;
//}}}
custom field: "order" is: <<view order>>
<<view modified>>
<<tiddler ListNavPlugin 'dp50'>><<tiddler testPlugin 'dp50'>>
/***
related to: https://groups.google.com/group/tiddlywikidev/browse_thread/thread/ffed849b8571a08c
!! Info
* This core extension adds a custom field named: label to every tiddler, that doesn't have one.
* If the field exists, it isn't touched.
* Whitespace will be trimmed.
* This extension is disabled. Remove the "systemConfigDisable" tag to activate it in your TW.
* Have a look at the EditTemplate to see the "label input field"
!! IMPORTANT
* It is strongly recomended to do extensive testing, if you want to use this extension.
* This extension may have side effects, if you use 3rd party plugins.
***/
//{{{
// hijack
// TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator)
TiddlyWiki.prototype.labeled_SaveTiddler=TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler=function(title, newTitle, newBody, modifier, modified, tags, fields, clearChangeCount, created, creator)
{
if (title instanceof Tiddler) {
// if label doesn't exist -> create it
title.fields.label = title.fields.label || "";
title.fields.label = title.fields.label.trim() ? title.fields.label.trim() : title.title.trim();
}
else {
// needed, tiddler is a shadow tiddler
fields = fields || {}
// if label doesn't exist -> create it
fields.label = fields.label || "";
fields.label = fields.label.trim() ? fields.label.trim() : newTitle.trim();
}
return this.labeled_SaveTiddler.apply(this,arguments);
}
//}}}
{{dpfr{<<tiddler ToggleLeftSidebarEm>> | <<tiddler ToggleRightSidebarEm>> | [[TopListC]] | [[TopListCode]]}}}<<slider chkSliderTopListA 2010.05.04@13:30:27 "TypeWithMe!" "display the typeWithMe editor">>
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Documentation|http://www.TiddlyTools.com/#InlineJavascriptPluginInfo|
|Version|1.9.5|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|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.
!!!!!Documentation
>see [[InlineJavascriptPluginInfo]]
!!!!!Revisions
<<<
2009.04.11 [1.9.5] pass current tiddler object into wrapper code so it can be referenced from within 'onclick' scripts
2009.02.26 [1.9.4] in $(), handle leading '#' on ID for compatibility with JQuery syntax
|please see [[InlineJavascriptPluginInfo]] for additional revision details|
2005.11.08 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.InlineJavascriptPlugin= {major: 1, minor: 9, revision: 5, date: new Date(2009,4,11)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?(?: key=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
handler: function(w) {
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var src=lookaheadMatch[1];
var label=lookaheadMatch[2];
var tip=lookaheadMatch[3];
var key=lookaheadMatch[4];
var show=lookaheadMatch[5];
var code=lookaheadMatch[6];
if (src) { // external script library
var script = document.createElement("script"); script.src = src;
document.body.appendChild(script); document.body.removeChild(script);
}
if (code) { // inline code
if (show) // display source in tiddler
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (label) { // create 'onclick' command link
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",wikifyPlainText(label));
var fixup=code.replace(/document.write\s*\(/gi,'place.bufferedHTML+=(');
link.code="function _out(place,tiddler){"+fixup+"\n};_out(this,this.tiddler);"
link.tiddler=w.tiddler;
link.onclick=function(){
this.bufferedHTML="";
try{ var r=eval(this.code);
if(this.bufferedHTML.length || (typeof(r)==="string")&&r.length)
var s=this.parentNode.insertBefore(document.createElement("span"),this.nextSibling);
if(this.bufferedHTML.length)
s.innerHTML=this.bufferedHTML;
if((typeof(r)==="string")&&r.length) {
wikify(r,s,null,this.tiddler);
return false;
} else return r!==undefined?r:false;
} catch(e){alert(e.description||e.toString());return false;}
};
link.setAttribute("title",tip||"");
var URIcode='javascript:void(eval(decodeURIComponent(%22(function(){try{';
URIcode+=encodeURIComponent(encodeURIComponent(code.replace(/\n/g,' ')));
URIcode+='}catch(e){alert(e.description||e.toString())}})()%22)))';
link.setAttribute("href",URIcode);
link.style.cursor="pointer";
if (key) link.accessKey=key.substr(0,1); // single character only
}
else { // run script immediately
var fixup=code.replace(/document.write\s*\(/gi,'place.innerHTML+=(');
var c="function _out(place,tiddler){"+fixup+"\n};_out(w.output,w.tiddler);";
try { var out=eval(c); }
catch(e) { out=e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
// // Backward-compatibility for TW2.1.x and earlier
//{{{
if (typeof(wikifyPlainText)=="undefined") window.wikifyPlainText=function(text,limit,tiddler) {
if(limit > 0) text = text.substr(0,limit);
var wikifier = new Wikifier(text,formatter,null,tiddler);
return wikifier.wikifyPlain();
}
//}}}
// // GLOBAL FUNCTION: $(...) -- 'shorthand' convenience syntax for document.getElementById()
//{{{
if (typeof($)=='undefined') { function $(id) { return document.getElementById(id.replace(/^#/,'')); } }
//}}}
//{{{
config.options.txtFadeTimer = 15000; // ms ... 15 seconds
function displayMessage(text,linkText,fadeTimer) {
var e = getMessageDiv();
if(!e) {
alert(text);
return;
}
if(linkText) {
var link = createTiddlyElement(e,"a",null,null,text);
link.href = linkText;
link.target = "_blank";
} else {
e.appendChild(document.createTextNode(text));
}
if(config.options.txtFadeTimer > 0) {
setTimeout(clearMessage, config.options.txtFadeTimer);
}
}
//}}}
Let me know, where I find your public, protected bags, that I can include them!
| http://hoster.peermore.com/bags/TeamPubScpm/tiddlers | done |
| | todo |
| | todo |
| | todo |
| | todo |
| SliceName | Content |h
|line1| some text <br> text after a line break |
|line2|<<tiddler {{tiddler.title + "::line1"}}>> |
|line3| <<tiddler {{tiddler.title + "##section1"}}>> |
|line4| <<tiddler {{tiddler.title + "##section2"}}>>|
|line5| <<tiddler {{tiddler.title + "::line4"}}>> |
|>| some footer text |f
{{{
| SliceName | Content |h
|line1| some text <br> text after a line break |
|line2|<<tiddler {{tiddler.title + "::line1"}}>> |
|line3| <<tiddler {{tiddler.title + "##section1"}}>> |
|line4| <<tiddler {{tiddler.title + "##section2"}}>>|
|line5|<<tiddler {{tiddler.title + "::line4"}}>> |
|>| some footer text |f
/% some invisible text follows
!section1
some text
new line
!end
!section2
this is text in
section 2
!end
%/
}}}
Provides configuration for TagSearchPlugin...
!Tags
[[Priority]]
[[Status]]
[[Action]]
[[Project]]
[[Contact]]
[[Many]]
!More
[[TAG:Archive]]
[[Journal]]
[[Reference]]
[[systemConfig]]
[[systemConfigDisable]]
[[excludeMissing]]
[[excludeSearch]]
[[excludeLists]]
[[TagSearchLegacy]]
!heading
< <newReminder>> .. I disabled the macro. see the < <
This tiddler is needed for: [[NewTiddler with prototype text]]
Reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/3c1d5fd27f781766?hl=en
<<tiddler jQueryAnimate##code>>
{{{
!code
<html>
<div id="box"
style="background:#98bf21;height:100px;width:100px;position:relative">
</div>
</html>
<script label="start animation">
jQuery("#box").animate({height:300},"slow");
jQuery("#box").animate({width:300},"slow");
jQuery("#box").animate({height:100},"slow");
jQuery("#box").animate({width:100},"slow");
</script>
!end
}}}
|publishtobag|TeamPubMp|
|publishlevel|move|
publishtobag .. Rename YourPublicBag too your needs.
publishlevel .. copy or move
<<tiddler TypeButton##url with: "2010.12.08@23:23:35-by-GUEST">>
Related to: http://groups.google.com/group/tiddlywiki/browse_thread/thread/508b5fc7730e2372?hl=en
This script is an attempt to color ‘references’ in the toolbar red if
the tiddler has references.
--It doesn't work.--
''Click the "more" button at the toolbar!''
/*{{{*/
<script>
var ref = store.getReferringTiddlers(tiddler.title);
if (ref.length > 0) {
jQuery('#tiddler'+tiddler.title).find('.command_references').css("color","red");
}
</script>
/*}}}*/
<script>
var ref = store.getReferringTiddlers(tiddler.title);
if (ref.length > 0) {
jQuery('#tiddler'+tiddler.title).find('.command_references').css("color","red");
}
</script>
<<tiddler TypeButton##url with: "2010.05.04@13:29:35-by-pmario.myopenid.com">>
//{{{
config.macros.slider.onClickSlider = function(ev)
{
var e = ev || window.event;
var n = this.nextSibling;
var cookie = n.getAttribute("cookie");
var isOpen = n.style.display != "none";
if(config.options.chkAnimate && anim && typeof Slider == "function")
anim.startAnimating(new Slider(n,!isOpen,null,"none"));
else
n.style.display = isOpen ? "none" : "block";
if (cookie != "") { //!!
config.options[cookie] = !isOpen;
saveOptionCookie(cookie);
} //!!
return false;
};
//}}}
<<newTiddler
label:"PrivatePublishConfig"
title:"PublishConfig"
text:{{store.getTiddlerText("PublishConfigTemplate##Content")}}
>>
!Content
|publishtobag|YourPublicBag|
|publishlevel|copy|
publishtobag .. Rename YourPublicBag too your needs.
publishlevel .. copy or move
a reusable non-linear collaborative webDev notebook <<tiddler ToggleLeftSidebarEm>> | <<tiddler ToggleRightSidebarEm>>
<<listnav 'MyFruitsList'>>
Apples
Bananas
Oranges
Pears
Peaches
Plums
/***
|''Name''|RevisionsCommandPlugin|
|''Description''|provides access to tiddler revisions|
|''Author''|FND|
|''Contributors''|Martin Budden, Mario Pietsch|
|''Version''|0.3.1 mp03|
|''Status''|@@beta@@|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/plugins/RevisionsCommandPlugin.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/association/plugins/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.6.0|
|''Keywords''|serverSide|
!Usage
Extend [[ToolbarCommands]] with {{{revisions}}}.
!Revision History
!!v0.1 (2009-07-23)
* initial release (renamed from experimental ServerCommandsPlugin)
!!v0.2 (2010-03-04)
* suppressed wikification in diff view
!!v0.3 (2010-04-07)
* restored wikification in diff view
* added link to side-by-side diff view
!To Do
* strip server.* fields from revision tiddlers
* resolve naming conflicts
* i18n, l10n
* code sanitizing
* documentation
!Code
***/
//{{{
(function($) {
jQuery.twStylesheet(".diff { white-space: pre, font-family: monospace }",
{ id: "diff" });
var cmd = config.commands.revisions = {
type: "popup",
hideShadow: true,
text: "revisions",
tooltip: "display tiddler revisions",
revTooltip: "", // TODO: populate dynamically?
loadLabel: "loading...",
loadTooltip: "loading revision list",
selectLabel: "select",
selectTooltip: "select revision for comparison",
selectedLabel: "selected",
compareLabel: "compare",
linkLabel: "side-by-side view",
revSuffix: " [rev. #%0]",
diffSuffix: " [diff: #%0 #%1]",
labelTemplate: "%0(%1)",
dateFormat: "YYYY-0MM-0DD 0hh:0mm",
listError: "revisions could not be retrieved",
getText: function(tiddler) {
var count = tiddler.fields["server.page.revision"] || 0;
return this.labelTemplate.format([this.text, count]);
},
handlePopup: function(popup, title) {
stripSuffix = function(type, title) {
var str = cmd[type + "Suffix"];
var i = str.indexOf("%0");
i = title.indexOf(str.substr(0, i));
if(i != -1) {
title = title.substr(0, i);
}
return title;
};
title = stripSuffix("rev", title);
title = stripSuffix("diff", title);
var tiddler = store.getTiddler(title);
var type = this._getField("server.type", tiddler);
var adaptor = new config.adaptors[type]();
var limit = null; // TODO: customizable
var context = {
host: this._getField("server.host", tiddler),
workspace: this._getField("server.workspace", tiddler)
};
var loading = createTiddlyButton(popup, cmd.loadLabel, cmd.loadTooltip);
var params = { popup: popup, loading: loading, origin: title };
adaptor.getTiddlerRevisionList(title, limit, context, params, this.displayRevisions);
},
displayRevisions: function(context, userParams) {
removeNode(userParams.loading);
if(context.status) {
var callback = function(ev) {
var e = ev || window.event;
var revision = resolveTarget(e).getAttribute("revision");
context.adaptor.getTiddlerRevision(tiddler.title, revision, context,
userParams, cmd.displayTiddlerRevision);
};
var table = createTiddlyElement(userParams.popup, "table");
for(var i = 0; i < context.revisions.length; i++) {
var tiddler = context.revisions[i];
var row = createTiddlyElement(table, "tr");
var timestamp = tiddler.modified.formatString(cmd.dateFormat);
var revision = tiddler.fields["server.page.revision"];
var revisionTxt = tiddler.fields["revision.text"]? tiddler.fields["revision.text"]: "-";
var cell = createTiddlyElement(row, "td");
createTiddlyButton(cell, timestamp, cmd.revTooltip, callback, null,
null, null, { revision: revision });
cell = createTiddlyElement(row, "td", null, null, tiddler.modifier);
cell = createTiddlyElement(row, "td");
createTiddlyButton(cell, cmd.selectLabel, cmd.selectTooltip,
cmd.revisionSelected, null, null, null,
{ index:i, revision: revision, col: 2 });
cell = createTiddlyElement(row, "td", null, null, ""+revisionTxt);
cmd.context = context; // XXX: unsafe (singleton)!?
}
} else {
$("<li />").text(cmd.listError).appendTo(userParams.popup);
}
},
revisionSelected: function(ev) {
var e = ev || window.event;
e.cancelBubble = true;
if(e.stopPropagation) {
e.stopPropagation();
}
var n = resolveTarget(e);
var index = n.getAttribute("index");
var col = n.getAttribute("col");
while(!index || !col) {
n = n.parentNode;
index = n.getAttribute("index");
col = n.getAttribute("col");
}
cmd.revision = n.getAttribute("revision");
var table = n.parentNode.parentNode.parentNode;
var rows = table.childNodes;
for(var i = 0; i < rows.length; i++) {
var c = rows[i].childNodes[col].firstChild;
if(i == index) {
if(c.textContent) {
c.textContent = cmd.selectedLabel;
} else {
c.text = cmd.selectedLabel;
}
} else {
if(c.textContent) {
c.textContent = cmd.compareLabel;
} else {
c.text = cmd.compareLabel;
}
c.onclick = cmd.compareSelected;
}
}
},
compareSelected: function(ev) {
var e = ev || window.event;
var n = resolveTarget(e);
var context = cmd.context;
context.rev1 = n.getAttribute("revision");
context.rev2 = cmd.revision;
context.tiddler = context.revisions[n.getAttribute("index")];
context.format = "unified";
context.adaptor.getTiddlerDiff(context.tiddler.title, context,
context.userParams, cmd.displayTiddlerDiffs);
},
displayTiddlerDiffs: function(context, userParams) {
var tiddler = context.tiddler;
tiddler.title += cmd.diffSuffix.format([context.rev1, context.rev2]);
tiddler.text = '{{diff{\n{{{\n' + context.diff + '\n}}}\n}}}';
// tiddler.tags = ["diff"];
tiddler.fields.doNotSave = "true"; // XXX: correct?
if(!store.getTiddler(tiddler.title)) {
store.addTiddler(tiddler);
}
var src = story.getTiddler(userParams.origin);
var tiddlerEl = story.displayTiddler(src, tiddler);
var uri = context.uri.replace("format=unified", "format=horizontal");
var link = $('<a target="_blank" />').attr("href", uri).text(cmd.linkLabel);
$(".viewer", tiddlerEl).prepend(link);
},
displayTiddlerRevision: function(context, userParams) {
var tiddler = context.tiddler;
tiddler.title += cmd.revSuffix.format([tiddler.fields["server.page.revision"]]);
tiddler.fields.doNotSave = "true"; // XXX: correct?
if(!store.getTiddler(tiddler.title)) {
store.addTiddler(tiddler);
}
var src = story.getTiddler(userParams.origin);
story.displayTiddler(src, tiddler);
},
_getField: function(name, tiddler) {
return tiddler.fields[name] || config.defaultCustomFields[name];
}
};
})(jQuery);
//}}}
/***
used for: [[MathQuill Workflow]]
***/
/*{{{*/
.mqCenter {
display: block;
text-align: center;
color: green;
font-size: 2em;
}
/*}}}*/
/***
used for: [[HowTo dynamic mainMenu]]
***/
/*{{{*/
.myListStyle ul {
list-style:none;
}
/*}}}*/
/***
used for: [[Temporary SideBySide]]
***/
/*{{{*/
[[EmasticSystem]]
/*}}}*/
/***
used for: [[SyntaxHighlighterPlugin]]
***/
/*{{{*/
[[StyleSheetSyntaxHighlighter]]
/*}}}*/
/***
used for [[Echo]]
***/
/*{{{*/
.thumbnails {
border:1px solid [[ColorPalette::Foreground]];
}
/*}}}*/
|~ViewToolbar|tagSearch closeTiddler closeOthers revisions +editTiddler addNow newTagged > fields permalink references jump tagWithStory tagOthers untagOthers publishtiddler|
|~EditToolbar|+saveTiddler addNow -cancelTiddler deleteTiddler|
custom field: "order" is: <<view order>>
<<view modified>>
/***
|''Name:''|TagSearchPlugin|
|''Description:''|Provides a drop down listing current tags and others to be set. Based on [[x-tagger|http://tbgtd.tiddlyspot.com/#x-tagger]] which in turn was once based on [[TaggerPlugin|http://tw.lewcid.org/#TaggerPlugin]].|
|''Author:''|[[Tobias Beer]]|
|''Version:''|1.2.0 (2010-10-10)|
|''Documentation:''|http://tagsearch.tiddlyspot.com|
|''Source:''|http://tagsearch.tiddlyspot.com/#TagSearchPlugin|
|''~TiddlyWiki:''|Version 2.5 or better|
/%***/
(function(e){config.macros.tagsearch={cfg:{defaultSource:"",defaultMore:"",defaultMode:1,keepModified:false,sidebarOffset:20,newAtSingle:30,newAt:18,excludeTagged:"",toolbar:"",label:"tags",options:"Options",more:"More...",tooltip:"Manage tiddler tags",notags:"no tags set...",aretags:"Current tags",addTag:"Add tag...",addTags:"Set tag...",txtEdit:"~ edit categories...",txtEditTip:"edit tiddler with GTD tag categories used by x-tagger",txtNew:"~ add another tag",txtRemove:"remove tag %0",txtAdd:"set tag %0",txtFor:"To be tagged... ",txtCtrl:" (hold SHIFT to just add it or CTRL to replace in category)",promptNew:"Enter new tag:",modeAsk:"Do you want to remove existing tags from category '%0'?\nCancel simply adds tag '%1'."},handler:function(k,g,i,l,h,n){var m=this.cfg,j=story.findContainingTiddler(k),f=h.parseParams("tagman",null,true);e(createTiddlyButton(k,getParam(f,"label",m.label),getParam(f,"tooltip",m.tooltip),this.click,"button")).attr({id:this.newId("btntgs"),tid:(j?j.getAttribute("tiddler"):"")}).data({pa:i,p:f})},click:function(O){var k,G,S,R,K=[],w=true,W,V,U,M,A,Y,T,D,N,L,J=[],C,f,H,aa=O||window.event,X=e(this),F=X.attr("popup"),B=window.event?"keydown":"keypress",I=config.macros.tagsearch,ab=I.cfg,u=X.data("pa"),Q=X.data("p"),h=u.contains("toolbar"),v=getParam(Q,"source",ab.defaultSource),q=getParam(Q,"more",ab.defaultMore),Z=!u.contains("nosearch"),z=!u.contains("notags"),E=!u.contains("nomore"),n=getParam(Q,"goto",""),o=parseInt(getParam(Q,"mode")),g=getParam(Q,"tiddler",""),r=g?g:X.attr("tid"),ac=(getParam(Q,"exclude","")+" "+ab.excludeTagged).readBracketedList(),y=nu=v?ab.newAt:ab.newAtSingle,P=store.getTiddler(r);if(!r){return}o=isNaN(o)?ab.defaultMode:o;ac.map(function(i){K.pushUnique(i)});for(W=0;W<ac.length;W++){store.getTaggedTiddlers(ac[W]).map(function(i){K.pushUnique(i.title)})}if(v&&!store.getTiddlerText(v)){return false}if(F){D=e("#"+F)[0];e(D).empty()}if(!D){M=true;F=I.newId("tgspop");D=Popup.create(this);e(D).addClass("tgs").attr({id:F}).data({btn:X,tiddler:r,source:v,mode:o}).click(I.noBubble);X.attr("popup",F)}if(v){C=store.getTiddlerText(v).readBracketedList();for(L=0;L<C.length;L++){if(!K.contains(C[L])){H=store.getTaggedTiddlers(C[L]);J.push("TAG:"+C[L]);for(N=0;N<H.length;N++){if(!K.contains(H[N].title)){J.push(H[N].title)}}}}}else{J=store.getTags()}G=P?P.tags.sort():[];Y=function(j,i){return createTiddlyElement(createTiddlyElement(j,"li",null,null),"ol",null,i?i:null)};A=function(j,x,i,p){var m,l;m=createTiddlyElement(createTiddlyElement(j,"li"),"span",null,null);l=e(createTiddlyButton(m,x,p.format(["'"+i+"'"]),I.setTag,"button toggleButton",null));l.data({tiddler:r,tag:i,source:v,mode:o});insertSpacer(m);createTagButton(m,i)};S=Y(D,"tgside");if(config.macros.gotoTiddler&&Z){R=Y(S);if(g){U=createTiddlyElement(R,"li",null,"addto","");wikify("{{title{"+ab.txtFor+"}}}<<tag [["+r+"]]>>",U);R=Y(S)}createTiddlyElement(R,"li",null,"title",ab.addTag);wikify("<<gotoTiddler "+n+" >>",R);e("input",D).bind(B,I.noBubble).data("notify",config.macros.tagsearch.notify).focus()}R=Y(S);createTiddlyElement(R,"li",null,"title",ab.aretags);if(G.length==0){wikify("{{notags{"+ab.notags+"}}}",R)}else{for(L=0;L<G.length;L++){A(R,"[X]",G[L],ab.txtRemove)}}if(z){for(W=0;W<J.length;W++){nu++;f=v?J[W]:J[W][0];if(f.indexOf("TAG:")==0){f=f.substr(4);if(nu>y){nu=0;S=Y(D)}R=Y(S);nu++;createTiddlyLink(createTiddlyElement(R,"li",null,null),f,f,"title")}else{if(!G.contains(f)&&!K.contains(f)){if(!v&&nu>y||v&&nu>ab.newAtSingle){nu=0;S=Y(D);R=Y(S);if(w){createTiddlyElement(createTiddlyElement(R,"li",null,null),"li",null,"title",ab.addTags);w=false}}A(R,"["+String.fromCharCode(160,160,160)+"]",f,ab.txtAdd+(v?ab.txtCtrl:""))}}}}if(E){S=Y(D,"tgside");R=Y(S);createTiddlyElement(R,"li",null,"title",ab.options,null);createTiddlyButton(createTiddlyElement(R,"li"),ab.txtNew,null,I.setTag,"tsopt",null,null,{tiddler:r});if(v){createTiddlyButton(createTiddlyElement(R,"li"),ab.txtEdit,ab.txtEditTip,onClickTiddlerLink,"tsopt",null,null,{tiddlyLink:v.split("##")[0]})}w=true;if(q){T=store.getTiddlerText(q).readBracketedList();if(T.length>0){for(W=0;W<T.length;W++){f=T[W];if(f.indexOf("TAG:")==0){f=f.substr(4,f.length-4);R=Y(S);createTiddlyLink(createTiddlyElement(R,"li",null,null),f,f,"title");k=store.getTaggedTiddlers(f);for(V=0;V<k.length;V++){f=k[V].title;if(!G.contains(f)&&!K.contains(f)){A(R,"["+String.fromCharCode(160,160)+"]",f,ab.txtAdd)}}}else{if(w){R=Y(S);createTiddlyElement(R,"li",null,"title",ab.more);w=false}if(!G.contains(f)&&!K.contains(f)){A(R,"["+String.fromCharCode(160,160)+"]",f,ab.txtAdd)}}}}}}if(M){Popup.show(D,false);if(h){N=document.getElementById("sidebar");D.style.left="";D.style.right=(ab.sidebarOffset+(N?N.offsetWidth:0))+"px"}}return I.noBubble(aa)},setTag:function(w){var q,j,z,l=true,n,u,s,g,v=w||window.event,k=config.macros.tagsearch,y=k.cfg,f=e(this),o=f.closest(".tgs"),i=o.data("btn"),A=f.data("tag"),B=o.data("tiddler"),h=o.data("source"),r=parseInt(o.data("mode"));if(!A){z=prompt(y.promptNew,"");if(!z){return false}else{A=z}}tid=k.exists(B,A);if(tid){u=tid.tags;if(!u.contains(A)){if(h&&r<2&&!v.shiftKey){j=store.getTiddlerText(h).readBracketedList();findTagged:for(q=0;q<j.length;q++){g=j[q];s=store.getTaggedTiddlers(g).map(function(m){return m.title});if(s.contains(A)){s.splice(s.indexOf(A),1);if(!v.ctrlKey&&r==1&&u.containsAny(s)){l=confirm(y.modeAsk.format([g,A]))}if(l){for(n=0;n<s.length;n++){g=s[n];if(u.contains(g)){store.setTiddlerTag(B,false,g)}}}break findTagged}}}store.setTiddlerTag(B,true,A)}else{if(!z){store.setTiddlerTag(B,false,A)}}n=store.getTiddler(B);store.saveTiddler(B,B,n.text,y.keepModified?n.modifier:config.options.txtUserName,y.keepModified?n.modified:new Date(),n.tags,n.fields)}if(config.options.chkAutoSave){autoSaveChanges()}i.click();o.find("input").focus();return k.noBubble(v)},newId:function(f){return f+Math.random().toString().substr(3)},notify:function(f,h){var j=e(h).closest(".tgs"),g=e("form input",j)[0];t=config.macros.tagsearch.exists(j.data("tiddler"),f);if(t&&!t.tags.contains(f)){store.setTiddlerTag(t.title,t,f)}j.data("btn").click();g.select()},exists:function(i,g){if(!store.getTiddler(i)){var h=merge({},config.defaultCustomFields);store.saveTiddler(i,i,"",config.options.txtUserName,new Date(),g,h);return false}return store.getTiddler(i)},noBubble:function(g){var h=g||window.event,f=resolveTarget(h);if(h.keyCode==27){Popup.remove(0)}else{if(h.type!="click"&&f.nodeName.toUpperCase()=="INPUT"){return true}}if(hasClass(f,"tiddlyLink")){return true}Popup.remove(1);h.cancelBubble=true;try{event.keyCode=0}catch(h){}if(window.event){h.returnValue=false}if(h.preventDefault){h.preventDefault()}if(h.stopPropagation){h.stopPropagation()}return false}};config.commands.tagSearch={};var d=config.macros.toolbar;d.createCommandTAGS=d.createCommand;d.createCommand=function(f,h,g,i){if(h=="tagSearch"){wikify("<<tagsearch toolbar "+config.macros.tagsearch.cfg.toolbar+">>",f);e(f.lastChild).attr({commandName:"tagSearch",tiddler:g.title})}else{d.createCommandTAGS.apply(this,arguments)}};var b=config.macros.gotoTiddler;if(b){b.processItem=function(i,g,h,f){if(!i.length){return}h.style.display=f?"block":"none";if(i=="*"){story.search(g.value);return false}if(!f){g.value=i}var j=e(g).data("notify");if(j){j.call(this,i,g)}else{story.displayTiddler(null,i)}return false};b.IEtableFixup="%0"}var c=store.getTiddlerText("ColorPalette::TertiaryMid"),a=store.getTiddlerText("ColorPalette::TertiaryDark");config.shadowTiddlers.StyleSheetTagSearch="/*{{{*/\n.tgs {padding:7px !important;-moz-border-radius:5px; -webkit-border-radius:5px;border-radius:5px;}\n.tgs li a, .tgs .quickopentag .tiddlyLink {display:inline;padding:2px;clear:none;}\n.tgs li a.toggleButton {display:inline;margin-left:5px;}\n.tgs .title {margin:3px 0 0 5px;font-weight:bold;font-size:150%;color:"+c+";padding:0;}\n.tgs form{display:block;float:left;clear:both;padding-left:5px !important;}\n.tgs .addto .quickopentag{display:block;clear:both;padding:5px;font-size:120%;}\n.tgs .notags, .tsopt{display:block;clear:both;margin:5px;}\n.tgs .highlight{background:"+a+";}\n.tgs ol{margin:0;padding:0 0 5px 0;}\n.tgs li{display:block;float:left;padding-bottom:10px !important;}\n.tgs li span{line-height:1em;}\n.tgs li ol li{clear:both;min-width:120px;display:inline;border:1px solid transparent;}\n.tgs li ol li:hover{border:1px solid "+c+";}\n.tgs li ol li ol li{padding:0 !important;}\n.tgs li ol li ol li:hover{border:1px solid transparent;}\n.tgside li ol li {min-width:150px;}.tgs .quickopentag {display:inline;}\n.tgs .quickopentag .tiddlyLink:hover {text-decoration:underline;}\n.tgs .quickopentag .button {border:0;padding:2px;font-size:1.5em;}\n/*}}}*/";store.addNotification("StyleSheetTagSearch",refreshStyles)})(jQuery);
//%/
/*{{{*/
<html>
<div id="wave" style="width: 100%; height: 420px; margin-bottom:1em;"></div>
</html>
<script>
var wave = new WavePanel('https://wave.google.com/wave/');
wave.setUIConfig('white', 'black', 'Arial', '13px');
wave.loadWave('googlewave.com!w+SApIZ9UMA');
wave.init(document.getElementById('wave'));
</script>
/*}}}*/
Disabled the following stuff since google deprecated the service.
/*{{{*/
<html>
<div id="wave" style="width: 100%; height: 420px; margin-bottom:1em;"></div>
</html>
<script>
var wave = new WavePanel('https://wave.google.com/wave/');
wave.setUIConfig('white', 'black', 'Arial', '13px');
wave.loadWave('googlewave.com!w+jWzzEBu-I');
wave.init(document.getElementById('wave'));
</script>
/*}}}*/
/%
!info
|Name|ToggleRightSidebarEm|
|Source|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#ToggleRightSidebarEm|
|Version|0.1.0|
|Author|Mario Pietsch|
|Derived from:|http://www.tiddlytools.com/#ToggleRightSidebar|
|License|http://creativecommons.org/licenses/by-nc-sa/3.0/at/|
|~CoreVersion|2.6|
|Type|transclusion|
|Description|show/hide right sidebar (MainMenu) for FreeStyle Themes. Works only with EmasticSystem|
Usage
<<<
{{{
<<tiddler ToggleRightSidebarEm>>
<<tiddler ToggleRightSidebarEmwith: label tooltip>>
}}}
Try it: <<tiddler ToggleRightSidebarEm##show
with: {{config.options.chkShowRightSidebar?'â–º':'â—„'}}>>
<<<
Configuration:
<<<
{{{
config.options.chkShowRightSidebar (true)
config.options.txtToggleRightSideBarLabelShow (â—„)
config.options.txtToggleRightSideBarLabelHide (â–º)
}}}
<<<
!end
!show
<<tiddler {{
var co=config.options;
if (co.chkShowRightSidebar===undefined) co.chkShowRightSidebar=true;
getDP = function(name) {
var width = undefined;
var myregexp = /dp([\d]{1,3})/;
var elem = jQuery(name);
var text = elem.attr('class');
var match = myregexp.exec(text);
if (match != null) {
width = match[1];
} else {
elem = jQuery(name).parent();
text = elem.attr('class');
match = myregexp.exec(text);
if (match != null) {
width = match[1]
}
else elem = undefined;
}
return {'width': width, 'elem': elem};
}; // end function
setDP = function(cmd, elem, target) {
if (!elem || !target) return alert('elem or target undefined!');
var newWidth = 0;
if (cmd === 'hide' && (elem.elem.css('display') != 'none')) {
newWidth = parseInt(target.width) + parseInt(elem.width);
jQuery(elem.elem).hide();
jQuery(target.elem).removeClass('dp'+target.width);
jQuery(target.elem).addClass('dp'+newWidth);
}
}; // end function
var mm = getDP('#mainMenu');
var da = getDP('#displayArea');
var sb = getDP('#sidebar');
var cmd = co.chkShowRightSidebar?'show':'hide';
setDP(cmd, sb, da);
'';}}>><html><nowiki><a href='javascript:;' title="$2"
onmouseover="
this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
+encodeURIComponent(encodeURIComponent(this.onclick))
+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
var co=config.options;
var opt='chkShowRightSidebar';
var show=co[opt]=!co[opt];
getDP = function(name) {
var width = undefined;
var myregexp = /dp([\d]{1,3})/;
var elem = jQuery(name);
var text = elem.attr('class');
var match = myregexp.exec(text);
if (match != null) {
width = match[1];
} else {
elem = jQuery(name).parent();
text = elem.attr('class');
match = myregexp.exec(text);
if (match != null) {
width = match[1]
}
else elem = undefined;
}
return {'width': width, 'elem': elem};
}; // end function
setDP = function(cmd, elem, target) {
if (!elem || !target) return alert('elem or target undefined!');
var newWidth = 0;
if (cmd === 'hide') {
newWidth = parseInt(target.width) + parseInt(elem.width);
jQuery(elem.elem).hide();
jQuery(target.elem).removeClass('dp'+target.width);
jQuery(target.elem).addClass('dp'+newWidth);
}
else if (cmd === 'show') {
newWidth = parseInt(target.width) - parseInt(elem.width);
jQuery(elem.elem).show();
jQuery(target.elem).removeClass('dp'+target.width);
jQuery(target.elem).addClass('dp'+newWidth);
}
}; // end function
var mm = getDP('#mainMenu');
var da = getDP('#displayArea');
var sb = getDP('#sidebar');
var cmd = co.chkShowRightSidebar?'show':'hide';
setDP(cmd, sb, da);
saveOptionCookie(opt);
var labelShow=co.txtToggleRightSideBarLabelShow||'◄';
var labelHide=co.txtToggleRightSideBarLabelHide||'►';
if (this.innerHTML==labelShow||this.innerHTML==labelHide)
this.innerHTML=show?labelHide:labelShow;
this.title=(show?'hide':'show')+' Right sidebar';
var sm=document.getElementById('storyMenu');
if (sm) config.refreshers.content(sm);
return false;
">$1</a></html>
!end
%/<<tiddler {{
var src='ToggleRightSidebarEm';
src+(tiddler&&tiddler.title==src?'##info':'##show');
}} with: {{
var co=config.options;
var labelShow=co.txtToggleRightSideBarLabelShow||'◄';
var labelHide=co.txtToggleRightSideBarLabelHide||'►';
'$1'!='$'+'1'?'$1':(co.chkShowRightSidebar?labelHide:labelShow);
}} {{
var tip=(config.options.chkShowRightSidebar?'hide':'show')+' Right sidebar';
'$2'!='$'+'2'?'$2':tip;
}}>>
http://groups.google.com/group/tiddlywiki/browse_thread/thread/65c700959373aac2?hl=en
''Imprtant:'' This macro call does only work with a "file" TiddlyWiki. It won't work with TiddlySpace, due to security resctrictions!
{{{
<<newTiddler
label:"new tiddler contains evaluated text"
tag:"yourTag"
tag:"secondTag"
title:"yourTitle"
text:{{"<<tiddler test>"+">"}}
>>
}}}
<<newTiddler
label:"new tiddler contains evaluated text"
tag:"yourTag"
tag:"secondTag"
title:"yourTitle"
text:{{"<<tiddler test>"+">"}}
>>
<<tiddler TopLeft 'dp50'>><<tiddler TopRight 'dp50'>>
|''Name:''|[[StandardTheme]]|
|''Description:''|It doesn't change anything. It just loads TW default tiddlers.|
|''PageTemplate:''|PageTemplate|
|''ViewTemplate:''|ViewTemplate|
|''EditTemplate:''|EditTemplate|
|''StyleSheet:''|StyleSheet|
/%
!info
|Name|ToggleLeftSidebarEm|
|Source|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#ToggleLeftSidebarEm|
|Version|0.1.0|
|Author|Mario Pietsch|
|Derived from:|http://www.tiddlytools.com/#ToggleLeftSidebar|
|License|http://creativecommons.org/licenses/by-nc-sa/3.0/at/|
|~CoreVersion|2.6|
|Type|transclusion|
|Description|show/hide left sidebar (MainMenu) for FreeStyle Themes. Works only with EmasticSystem|
Usage
<<<
{{{
<<tiddler ToggleLeftSidebarEm>>
<<tiddler ToggleLeftSidebarEm with: label tooltip>>
}}}
Try it: <<tiddler ToggleLeftSidebarEm##show
with: {{config.options.chkShowLeftSidebar?'â—„':'â–º'}}>>
<<<
Configuration:
<<<
{{{
config.options.chkShowLeftSidebar (true)
config.options.txtToggleLeftSideBarLabelShow (â–º)
config.options.txtToggleLeftSideBarLabelHide (â—„)
}}}
<<<
!end
!show
<<tiddler {{
var co=config.options;
if (co.chkShowLeftSidebar===undefined) co.chkShowLeftSidebar=true;
getDP = function(name) {
var width = undefined;
var myregexp = /dp([\d]{1,3})/;
var elem = jQuery(name);
var text = elem.attr('class');
var match = myregexp.exec(text);
if (match != null) {
width = match[1];
} else {
elem = jQuery(name).parent();
text = elem.attr('class');
match = myregexp.exec(text);
if (match != null) {
width = match[1]
}
else elem = undefined;
}
return {'width': width, 'elem': elem};
}; // end function
setDP = function(cmd, elem, target) {
if (!elem || !target) return alert('elem or target undefined!');
var newWidth = 0;
if (cmd === 'hide' && (elem.elem.css('display') != 'none')) {
newWidth = parseInt(target.width) + parseInt(elem.width);
jQuery(elem.elem).hide();
jQuery(target.elem).removeClass('dp'+target.width);
jQuery(target.elem).addClass('dp'+newWidth);
}
}; // end function
var mm = getDP('#mainMenu');
var da = getDP('#displayArea');
var sb = getDP('#sidebar');
var cmd = co.chkShowLeftSidebar?'show':'hide';
setDP(cmd, mm, da);
'';}}>><html><nowiki><a href='javascript:;' title="$2"
onmouseover="
this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
+encodeURIComponent(encodeURIComponent(this.onclick))
+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
var co=config.options;
var opt='chkShowLeftSidebar';
var show=co[opt]=!co[opt];
getDP = function(name) {
var width = undefined;
var myregexp = /dp([\d]{1,3})/;
var elem = jQuery(name);
var text = elem.attr('class');
var match = myregexp.exec(text);
if (match != null) {
width = match[1];
} else {
elem = jQuery(name).parent();
text = elem.attr('class');
match = myregexp.exec(text);
if (match != null) {
width = match[1]
}
else elem = undefined;
}
return {'width': width, 'elem': elem};
}; // end function
setDP = function(cmd, elem, target) {
if (!elem || !target) return alert('elem or target undefined!');
var newWidth = 0;
if (cmd === 'hide') {
newWidth = parseInt(target.width) + parseInt(elem.width);
jQuery(elem.elem).hide();
jQuery(target.elem).removeClass('dp'+target.width);
jQuery(target.elem).addClass('dp'+newWidth);
}
else if (cmd === 'show') {
newWidth = parseInt(target.width) - parseInt(elem.width);
jQuery(elem.elem).show();
jQuery(target.elem).removeClass('dp'+target.width);
jQuery(target.elem).addClass('dp'+newWidth);
}
}; // end function
var mm = getDP('#mainMenu');
var da = getDP('#displayArea');
var sb = getDP('#sidebar');
var cmd = co.chkShowLeftSidebar?'show':'hide';
setDP(cmd, mm, da);
saveOptionCookie(opt);
var labelShow=co.txtToggleLeftSideBarLabelShow||'►';
var labelHide=co.txtToggleLeftSideBarLabelHide||'◄';
if (this.innerHTML==labelShow||this.innerHTML==labelHide)
this.innerHTML=show?labelHide:labelShow;
this.title=(show?'hide':'show')+' left sidebar';
var sm=document.getElementById('storyMenu');
if (sm) config.refreshers.content(sm);
return false;
">$1</a></html>
!end
%/<<tiddler {{
var src='ToggleLeftSidebarEm';
src+(tiddler&&tiddler.title==src?'##info':'##show');
}} with: {{
var co=config.options;
var labelShow=co.txtToggleLeftSideBarLabelShow||'►';
var labelHide=co.txtToggleLeftSideBarLabelHide||'◄';
'$1'!='$'+'1'?'$1':(co.chkShowLeftSidebar?labelHide:labelShow);
}} {{
var tip=(config.options.chkShowLeftSidebar?'hide':'show')+' left sidebar';
'$2'!='$'+'2'?'$2':tip;
}}>>
Some text about Compassion
/***
|''Name:''|NoCaseListPlugin|
|''Description:''|Adds a new command ''noCase'' to the core list macro|
|''Author:''|Mario Pietsch|
|''Version:''|0.1.2|
|''Date:''|2010.03.04|
|''Status:''|''beta''|
|''Source:''|http://apm-plugins.tiddlyspot.com/#NoCaseListPlugin|
|''License''|[[MIT License]]|
|''CoreVersion:''|2.5.0|
|''Requires:''||
|''Documentation:''|this file|
|''Keywords:''|list, sort, not case sensitive, filter|
!Description
This plugin performs a alphabetical sort for tiddlers, but it is not case sensitive. That means ab = AB = aB = Ab! And it does some little filtering using the RegExp syntax.
The RegExp Syntax can be a little bit tricky to read and configure. But the best description I have found is at [[regular-expressions.info]]. This plugin is aware of 'excludeLists', and does not display them.
!Example
{{{
<<list noCase title '[m]'>>
}}}
<<list noCase title '[m]'>>
!Default Format
{{{
<<list noCase>>
}}}
!Other Possibilities
<<<
!!!Reverse order
{{{
<<list noCase -title >>
}}}
!!!Some basic filtering
*Every tiddler title, that starts with a number from 0 to 9.
**Alphabetically sorted
{{{
<<list noCase -title '[0-9]'>>
}}}
*Every tiddler title, that starts with an ''"a"'' or ''"b"'' or ''"c"''.
{{{
<<list noCase title '[abc]'>>
}}}
*Every tiddler title, that starts with exactly ''abc''.
{{{
<<list noCase title 'abc'>>
}}}
I think this is enough power, for the beginning. See [[XCaseListPlugin|http://apm-plugins.tiddlyspot.com/#XCaseListPlugin]] for more.
<<<
!History
V 0.1.2 - 2010.03.04
*Fixed the source links
V 0.1.1 - 2010.02.24
*some minimum changes
*some more docu
V 0.1.0 - 2010.02.19
*Initial release
!Code
***/
/*{{{*/
if(!version.extensions.NoCaseListPlugin) { //# ensure that the plugin is only installed once
version.extensions.NoCaseListPlugin = { installed: true };
config.macros.list.noCase = {};
config.macros.list.noCase.handler = function(params)
{
var defaultField = "+title";
var lookupField = "tags";
var lookupValue = "excludeLists";
var lookupMatch = false;
var results = [];
var match = null;
var sortField = params[1] || defaultField;
// get the sorting order
var asc = 1;
switch (sortField.substr(0, 1)) {
case "-":
asc = -1;
case "+":
sortField = sortField.substr(1);
break;
default:;
}
// define regExp and add ^ .. start of string
var regSnip = params[2] || '.'
var regExp = new RegExp('^' + regSnip, 'im');
store.forEachTiddler(
function (title, tiddler) {
var f = !lookupMatch;
for (var lookup = 0; lookup < tiddler[lookupField].length; lookup++) {
if (tiddler[lookupField][lookup] == lookupValue) {
f = lookupMatch;
}
}
if (f) {
// check if tiddler sortField matches regExp
match = tiddler[sortField].match(regExp);
if (match) results.push(tiddler);
}
}
);
// sort and return the results.
return results.sort(function (a,b) {
return a[sortField].toLowerCase() < b[sortField].toLowerCase() ? -asc : a[sortField].toLowerCase() == b[sortField].toLowerCase() ? 0 : asc;});
}
} //# end of "install only once"
/*}}}*/
{{{
{{dpfr{[[TopListC]] | [[TopListCode]]}}}<<slider chkSliderTopListA 2010.05.04@13:30:27 "TypeWithMe!" "display the typeWithMe editor">>
}}}
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div class='editor' macro='edit label'></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>
<!--}}}-->
<<tiddler TabTemplate with: {{tiddler.title}}>>
/***
|''Name:''|XCaseListPlugin|
|''Description:''|Adds a new command ''xCase'' to the core list macro|
|''Author:''|Mario Pietsch|
|''Version:''|0.2|
|''Date:''|2010.02.24|
|''Status:''|''beta''|
|''Source:''|http://apm-plugins.tiddlyspot.com/#XCaseListPlugin|
|''License''|[[MIT License]]|
|''CoreVersion:''|2.5.0|
|''Requires:''||
|''Documentation:''|this file|
|''Keywords:''|list, sort, not case sensitive, filter|
!Description
This plugin performs a alphabetical sort for tiddlers. Default it is not case sensitive. That means ab = AB = aB = Ab! And it does some little more filtering using the RegExp syntax. The RegExp Syntax can be a little bit tricky to read and configure. But the best description I have found is at [[regular-expressions.info]]
!!!Example
{{{
<<list xCase title '[m]'>>
}}}
< <list xCase title '[m]'>>
!Default Format
{{{
<<list xCase>>
}}}
!More Possibilities
<<<
!!!Reverse sort order
{{{
<<list xCase -title >>
}}}
!!!Some basic filtering
*Every tiddler title, that starts with a number from 0 to 9.
{{{
<<list xCase title '[0-9]'>>
}}}
*Every tiddler title, that starts with an ''"a"'' or ''"b"'' or ''"c"''.
{{{
<<list xCase title '[abc]'>>
}}}
*Every tiddler title, that starts with exactly ''abc''.
{{{
<<list xCase title 'abc'>>
}}}
<<<
!!!Some advanced filtering
<<<
*same as above but with a tagList for additional filtering.
*adding the tag filter will disable the "excludeLists" setting !!
**If you need excludeLists, than you have to define it with the expression.
*XCaseListPlugin should be compatible to [[MatchTagsPlugin]] from TiddlyTools!
{{{
<<list xCase title '[a]' "[tag[MyTag]]">>
}}}
!!!Global / Local Settings
|<<option chkXCaseListCaseSensitive>> Global sort case sensitive |Sets case sensitiv sort globally|
|<<option chkXCaseListCheckField>> Sortfield defines case sensitive |Ignores global setting. Evaluates sortField and sets the value everytime <br> {{{<<list xCase sortField ..>>}}} is executed.|
If sortField is eg: 'title' .. not case sensitive (default).
if sortField is eg: 'Title' or 'TITLE' .. case sesitive sort is active.
<<<
!Code
***/
/*{{{*/
if(!version.extensions.XCaseListPlugin) { //# ensure that the plugin is only installed once
version.extensions.XCaseListPlugin = { installed: true };
config.macros.list.xCase = {};
config.macros.list.xCase.handler = function(params){
var lookupField = 'tags';
var lookupValue = 'excludeLists';
var lookupMatch = false;
var sortField = params[1] || '+title';
// global setting for case sensitive search
var caseSensitive = config.options.chkXCaseListCaseSensitive || false;
var chkSortField = config.options.chkXCaseListCheckField || false;
// if this option is active the macro parameter sortField is parsed
// global setting is ignored !!
if (chkSortField) caseSensitive = (sortField != sortField.toLowerCase());
sortField = sortField.toLowerCase();
// check if numberedText called this macro.
// this parameter is used by <<list numberedText ..>> macro
// if you directly use it, it will return an unsorted list !!!
var numberedText = false;
if (sortField.substr(0, 1)== '#') {
numberedText = true;
sortField = sortField.substr(1);
caseSensitive = false;
}
// check for ascending or descending sort order
var asc = 1;
switch (sortField.substr(0, 1)) {
case "-":
asc = -1;
case "+":
sortField = sortField.substr(1);
break;
default: ;
}
var results = [];
var tmpResults = [];
// set the default for regExp filtering
var regSnip = params[2] || '.';
var regExp = new RegExp('^' + regSnip, 'im');
var match = null;
// check if [tag[...]] is set
var tagList = params[3] || '';
var tagMatch = tagList.length != 0; // if list is empty everything is valid.
if (tagMatch) {
tmpResults = store.filterTiddlers(params[3]);
for (var i=0, max=tmpResults.length; i<max; i++){
// match = tmpResults[i][sortField].match(regExp);
match = tmpResults[i].title.match(regExp);
if (match) results.push(tmpResults[i]);
}; // for ..
}
else {
store.forEachTiddler(function(title, tiddler){
var f = !lookupMatch;
for (var lookup = 0; lookup < tiddler[lookupField].length; lookup++) {
if (tiddler[lookupField][lookup] == lookupValue) {
f = lookupMatch;
}
}; // for..
if (f) {
// match = tiddler[sortField].match(regExp);
match = tiddler.title.match(regExp);
if (match) results.push(tiddler);
}; // if (f) ..
}); // store.forEach ..
}; // else ..
if (TiddlyWiki.isStandardField(sortField)) {
if (caseSensitive) {
results.sort(function(a, b){
return a[sortField] < b[sortField] ? -asc : a[sortField] == b[sortField] ? 0 : asc;
}); // results.sort
}
else if (numberedText) {
// do nothing, return the list, for further processing !
}
else {
results.sort(function(a, b){
return a[sortField].toLowerCase() < b[sortField].toLowerCase() ? -asc : a[sortField].toLowerCase() == b[sortField].toLowerCase() ? 0 : asc;
}); // results.sort
}; // if
}
else {
results.sort(function (a, b) {
var aField = (a.fields[sortField]) ? a.fields[sortField] : 'zzz';
var bField = (b.fields[sortField]) ? b.fields[sortField] : 'zzz';
return aField.toLowerCase() < bField.toLowerCase() ? -asc : aField.toLowerCase() == bField.toLowerCase() ? 0 : +asc;
});
}
return results;
}
} //# end of "install only once"
/*}}}*/
!HowTo use the "publish" command
!!Visual ~HowTo
A visual guide to join the TeamWork experiment: http://www.youtube.com/watch?v=WzHRHLd7tyk
/***
|''Name''|TiddlyWebConfig|
|''Description''|configuration settings for TiddlyWebWiki|
|''Author''|FND|
|''Version''|1.3.2|
|''Status''|stable|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/plugins/TiddlyWebConfig.js|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''Requires''|TiddlyWebAdaptor ServerSideSavingPlugin|
|''Keywords''|serverSide TiddlyWeb|
!Code
***/
//{{{
(function($) {
if(!config.extensions.ServerSideSavingPlugin) {
throw "Missing dependency: ServerSideSavingPlugin";
}
if(!config.adaptors.tiddlyweb) {
throw "Missing dependency: TiddlyWebAdaptor";
}
if(window.location.protocol != "file:") {
config.options.chkAutoSave = true;
}
var adaptor = tiddler.getAdaptor();
var recipe = tiddler.fields["server.recipe"];
var workspace = recipe ? "recipes/" + recipe : "bags/common";
var plugin = config.extensions.tiddlyweb = {
host: tiddler.fields["server.host"].replace(/\/$/, ""),
username: null,
status: {},
getStatus: null, // assigned later
getUserInfo: function(callback) {
this.getStatus(function(status) {
callback({
name: plugin.username,
anon: plugin.username ? plugin.username == "GUEST" : true
});
});
},
hasPermission: function(type, tiddler) {
var perms = tiddler.fields["server.permissions"];
if(perms) {
return perms.split(", ").contains(type);
} else {
return true;
}
}
};
config.defaultCustomFields = {
"server.type": tiddler.getServerType(),
"server.host": plugin.host,
"server.workspace": workspace
};
// modify toolbar commands
config.shadowTiddlers.ToolbarCommands = config.shadowTiddlers.ToolbarCommands.
replace("syncing ", "revisions syncing ");
config.commands.saveTiddler.isEnabled = function(tiddler) {
return plugin.hasPermission("write", tiddler) && !tiddler.isReadOnly();
};
config.commands.deleteTiddler.isEnabled = function(tiddler) {
return !readOnly && plugin.hasPermission("delete", tiddler);
};
// hijack option macro to disable username editing
var _optionMacro = config.macros.option.handler;
config.macros.option.handler = function(place, macroName, params, wikifier,
paramString) {
if(params[0] == "txtUserName") {
params[0] = "options." + params[0];
var self = this;
var args = arguments;
args[0] = $("<span />").appendTo(place)[0];
plugin.getUserInfo(function(user) {
config.macros.message.handler.apply(self, args);
});
} else {
_optionMacro.apply(this, arguments);
}
};
// hijack isReadOnly to take into account permissions and content type
var _isReadOnly = Tiddler.prototype.isReadOnly;
Tiddler.prototype.isReadOnly = function() {
return _isReadOnly.apply(this, arguments) ||
!plugin.hasPermission("write", this);
};
var getStatus = function(callback) {
if(plugin.status.version) {
callback(plugin.status);
} else {
var self = getStatus;
if(self.pending) {
if(callback) {
self.queue.push(callback);
}
} else {
self.pending = true;
self.queue = callback ? [callback] : [];
var _callback = function(context, userParams) {
var status = context.serverStatus || {};
for(var key in status) {
if(key == "username") {
plugin.username = status[key];
config.macros.option.propagateOption("txtUserName",
"value", plugin.username, "input");
} else {
plugin.status[key] = status[key];
}
}
for(var i = 0; i < self.queue.length; i++) {
self.queue[i](plugin.status);
}
delete self.queue;
delete self.pending;
};
adaptor.getStatus({ host: plugin.host }, null, _callback);
}
}
};
(plugin.getStatus = getStatus)(); // XXX: hacky (arcane combo of assignment plus execution)
})(jQuery);
//}}}
//{{{
// TiddlyWeb adaptor
// v0.8.2
//
// TODO:
// * ensure all routes are supported
// * Policy class (attributes read, write, create, delete, manage, accept and owner)
// * documentation
(function($) {
tiddlyweb = {
routes: {
// host is the TiddlyWeb instance's URI (including server_prefix)
// placeholders "_type" & "name" refer to the respective bag/recipe
root : "{host}/",
bags : "{host}/bags",
bag : "{host}/bags/{name}",
recipes : "{host}/recipes",
recipe : "{host}/recipes/{name}",
tiddlers : "{host}/{_type}s/{name}/tiddlers",
tiddler : "{host}/{_type}s/{name}/tiddlers/{title}",
revisions: "{host}/{_type}s/{name}/tiddlers/{title}/revisions",
revision : "{host}/{_type}s/{name}/tiddlers/{title}/revisions/{id}",
search : "{host}/search?q={query}"
}
};
// host (optional) is the URI of the originating TiddlyWeb instance
tiddlyweb.Resource = function(type, host) {
if(arguments.length) { // initialization
this._type = type; // XXX: somewhat redundant, as it generally corresponds to class name
if(host !== false) {
this.host = host !== undefined ? host.replace(/\/$/, "") : null;
}
}
};
$.extend(tiddlyweb.Resource.prototype, {
// retrieves resource from server
// callback is passed resource, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception, resource (cf. jQuery.ajax error)
// filters is a filter string (e.g. "select=tag:foo;limit=5")
get: function(callback, errback, filters) {
var uri = this.route();
if(filters) {
var separator = uri.indexOf("?") == -1 ? "?" : ";";
uri += separator + filters;
}
var self = this;
return $.ajax({
url: uri,
type: "GET",
dataType: "json",
success: function(data, status, xhr) {
var resource = self.parse(data);
callback(resource, status, xhr);
},
error: function(xhr, error, exc) {
errback(xhr, error, exc, self);
}
});
},
// sends resource to server
// callback is passed data, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception, resource (cf. jQuery.ajax error)
put: function(callback, errback) {
var uri = this.route();
var data = {};
var self = this;
$.each(this.data, function(i, item) {
var value = self[item];
if(value !== undefined) {
data[item] = value;
}
});
return $.ajax({
url: uri,
type: "PUT",
contentType: "application/json",
data: $.toJSON(data),
success: callback,
error: function(xhr, error, exc) {
errback(xhr, error, exc, self);
}
});
},
// deletes resource on server
// callback is passed data, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception, resource (cf. jQuery.ajax error)
"delete": function(callback, errback) {
var uri = this.route();
var self = this;
return $.ajax({
url: uri,
type: "DELETE",
success: callback,
error: function(xhr, error, exc) {
errback(xhr, error, exc, self);
}
});
},
// returns corresponding instance from raw JSON object (if applicable)
parse: function(data) {
return data;
},
// list of accepted keys in serialization
data: [],
// returns resource's URI
route: function() {
return supplant(tiddlyweb.routes[this._type], this);
}
});
var Container = function(type, name, host) {
if(arguments.length) { // initialization
tiddlyweb.Resource.apply(this, [type, host]);
this.name = name;
this.desc = "";
this.policy = null;
}
};
Container.prototype = new tiddlyweb.Resource();
$.extend(Container.prototype, {
tiddlers: function() {
return new TiddlerCollection(this);
},
parse: function(data) {
var type = tiddlyweb._capitalize(this._type);
var container = new tiddlyweb[type](this.name, this.host);
return $.extend(container, data);
},
data: ["desc", "policy"]
});
// attribs is an object whose members are merged into the instance (e.g. query)
tiddlyweb.Collection = function(type, host, attribs) {
if(arguments.length) { // initialization
tiddlyweb.Resource.apply(this, [type, host]);
$.extend(this, attribs);
}
};
tiddlyweb.Collection.prototype = new tiddlyweb.Resource();
var TiddlerCollection = function(container, tiddler) {
if(arguments.length) { // initialization
tiddlyweb.Collection.apply(this, [tiddler ? "revisions" : "tiddlers"]);
this.container = container || null;
this.tiddler = tiddler || null;
}
};
TiddlerCollection.prototype = new tiddlyweb.Collection();
$.extend(TiddlerCollection.prototype, {
route: function() {
if(this.tiddler) {
var container = this.tiddler.bag || this.tiddler.recipe;
var params = {
_type: container._type,
host: container.host,
name: container.name,
title: this.tiddler.title
};
} else {
params = this.container;
}
return supplant(tiddlyweb.routes[this._type], params);
}
});
// title is the name of the tiddler
// container (optional) is an instance of either Bag or Recipe
tiddlyweb.Tiddler = function(title, container) {
tiddlyweb.Resource.apply(this, ["tiddler", false]);
this.title = title;
this.bag = container && container._type == "bag" ? container : null;
this.recipe = container && container._type == "recipe" ? container : null;
var self = this;
$.each(this.data, function(i, item) {
self[item] = undefined; // exposes list of standard attributes for inspectability
});
};
tiddlyweb.Tiddler.prototype = new tiddlyweb.Resource();
$.extend(tiddlyweb.Tiddler.prototype, {
revisions: function() {
return new TiddlerCollection(this.bag || this.recipe, this);
},
route: function() {
var container = this.bag || this.recipe;
var params = $.extend({}, this, {
host: container ? container.host : null,
_type: this.bag ? "bag" : (this.recipe ? "recipe" : null),
name: container ? container.name : null
});
return supplant(tiddlyweb.routes[this._type], params);
},
parse: function(data) {
var tiddler = new tiddlyweb.Tiddler(this.title);
var container = this.bag || this.recipe;
tiddler.bag = new tiddlyweb.Bag(data.bag, container.host);
delete data.bag;
if(this.recipe) {
tiddler.recipe = this.recipe;
}
return $.extend(tiddler, data);
},
data: ["created", "modified", "modifier", "tags", "fields", "text", "type"]
});
tiddlyweb.Bag = function(name, host) {
Container.apply(this, ["bag", name, host]);
};
tiddlyweb.Bag.prototype = new Container();
tiddlyweb.Recipe = function(name, host) {
Container.apply(this, ["recipe", name, host]);
this.recipe = [];
};
tiddlyweb.Recipe.prototype = new Container();
$.extend(tiddlyweb.Recipe.prototype, {
data: ["recipe"].concat(Container.prototype.data)
});
/*
* utilities
*/
tiddlyweb._capitalize = function(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
// adapted from Crockford (http://javascript.crockford.com/remedial.html)
var supplant = function(str, obj) {
return str.replace(/{([^{}]*)}/g, function (a, b) {
var r = obj[b];
r = typeof r === "string" || typeof r === "number" ? r : a;
return b == "host" ? r : encodeURIComponent(r); // XXX: special-casing
});
};
})(jQuery);
//}}}
Needed to test: ReferencesNewColor and ColorfulToolbarPlugin, [[Test ColorfulToolbarPlugin]]
Reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/b53362cd9cccfe20?hl=en
!Command
<<tiddler "TransclusionWithStoreGetTiddlerText##Code" with: {{store.getTiddlerText('TransclusionWithStoreGetTiddlerText##Command')}}>>
!/%
!Code
{{{
$1
}}}
!end
%/
!The tiddler content
//{{{
Reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/b53362cd9cccfe20?hl=en
!Command
<<tiddler "TransclusionWithStoreGetTiddlerText##Code" with: {{store.getTiddlerText('TransclusionWithStoreGetTiddlerText##Command')}}>>
!/%
!Code
{{{
$1
}}}
!end
%/
//}}}
/*{{{*/
(function($) { //# set up alias
// create macro object
config.macros.jqTables = {
// Add a handler function to be invoked by <<jqTables TiddlerTitle>>
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
// target tiddler passed in as macro parameter
var title = params[0]; // tiddler, that contains the table
var colNr = params[1] || 1; // column number. default = 1
// read tiddler contents
var text = store.getTiddlerText(title);
//wikify to get proper tables
text=wikifyStatic(text);
if($(text).find("table")) {
$("<div />").attr("id", "jqTables").appendTo(place);
$("<ul />").attr("id", "ListTableColumn").appendTo("#jqTables");
// generate list
var items = $(text).find("tr td:nth-child("+colNr+")");
//// Alternative method follows: ////
//// The problem with the other (uncommented) method is that it does not unwrap the data from the <td>
////var itmfound
$.each(items, function(i, itm) {
////itmfound=itm.innerHTML;
////$("<li>"+itmfound+"</li>").appendTo("#ListTableColumn");
$(itm).unwrap().appendTo("#ListTableColumn"); //// comment this
});
}
}
};
})(jQuery);
/*}}}*/
/***
|''Name''|jqTablesPlugin|
|''Description''|??|
|''Authors''|see Related to|
|''Version''|0.1|
|''Date''|2010-06-27|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#testPlugin|
|''License''|<...>|
|''CoreVersion''|2.5|
|''Documentation''|included|
|''Related to''|http://groups.google.com/group/tiddlywikidev/browse_thread/thread/8ba29d51caf59d37?hl=en|
|''Keywords''|??|
!!!Description
<<<
This script reads a column from a tiddler containing a table an lists it.
<<<
!!!Notes
<<<
some text here
<<<
!!!Usage
<<<
!!!!Standard
{{{
<<jqTables testTable>>
<<jqTables testTable 2>>
}}}
<<<
!!!Parameters
<<<
Parameters are optional!
{{{
<<jqTables [TiddlerTitle] [columnNumber]>>
}}}
[TiddlerTitle] .. Title, of the tidder, that contains the table
[columnNumber] .. Number of column to be used. default = 1
<<<
!!!Revision History
<<<
V 0.0.2 2010-06-27
* added second parameter "column"
V 0.0.1 2010-06-25
* initial Release
<<<
!!!To Do
<<<
* Check that there are enough columns; perhaps defaulting to first if colNr is too big.
* Unwrap items from <td>
<<<
***/
/***
|''Name''|AddNowCommand|
|''Description''|Opens a tiddler in edit mode and adds "Date and Time" at the top/end of the text. top/end depends on the configuration.|
|''Authors''|see Related to|
|''Version''|0.0.3|
|''Date''|2011-06-10|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#AddNowCommand|
|''License''|BSD|
|''CoreVersion''|2.5|
|''Related to''|http://groups.google.com/group/tiddlywiki/browse_thread/thread/9f3fb012e80fdc4|
|''Keywords''|toolbar command add date time edit|
!!!Description
<<<
To use this new toolbar command you have to add {{{addNow}}} to ToolbarCommands tiddler
eg:
{{{
|~ViewToolbar|tagSearch addNow +editTiddler ...
}}}
<<<
!!!Date Format
<<<
Possible date formats can be seen at [[TiddlyWiki.org|http://tiddlywiki.org/#%5b%5bDate%20Formats%5d%5d]]
To change the date format add the following line to a tiddler eg: [[zzConfig]] tagged systemConfig
//{{{
config.commands.addNow.dateFormat = 'YYYY-0MM-0DD 0hh:0mm';
//}}}
To change the insert {{{mode}}} add:
//{{{
config.commands.addNow.mode = 'post';
//}}}
To change the {{{selectedText}}} in mode = 'pre' add:
//{{{
config.commands.addNow.selectedText = 'your text here';
//}}}
<<<
!!!Code
***/
//{{{
// http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area/841121#841121
// $('#elem').selectRange(3,5);
jQuery.fn.selectRange = function(start, end) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
});
};
config.commands.addNow = {
text: "addNow",
tooltip: "Edit tiddler and add [Date & Time]!",
selectedText: "insert text",
mode: 'pre', // 'pre' or 'post'
spacingText: '\n\n----\n',
insertText: '[%0]\n',
dateFormat: 'YYYY-0MM-0DD 0hh:0mm',
isEnabled: function(tiddler) {
return (!readOnly && !tiddler.isTagged('systemConfig'));
}
};
config.commands.addNow.handler = function(event,src,title)
{
config.commands.editTiddler.handler.call(this,event,src,title);
var text = jQuery(story.getTiddler(title)).find('textarea[edit=text]');
var spacer = text.val() ? this.spacingText : '' ;
var dynText = this.insertText.format([new Date().formatString(this.dateFormat)]);
if (this.mode == 'post') {
text.val(text.val() + spacer + dynText);
}
else {
text.val(dynText + this.selectedText + spacer + text.val() );
jQuery(text).selectRange(dynText.length, dynText.length + this.selectedText.length);
}
return false;
};
//}}}
<html>
<style>
.command {
background-color : #F9F9F9;
border : 1px dashed #2F6FAB;
color : black;
font-family : "Courier New", Courier, mono;
font-size : 12px;
font-style : italic;
line-height : 1.1em;
padding : 1em;
margin : 0 0 0.8em;
white-space: pre;
}
</style>
</html>
{{command{
your text here
intended with tab
}}}
{{{
pre formatted box
intended with tab
}}}
//{{{
{{command{
your text here
intended with tab
}}}
{{{
pre formatted box
intended with tab
}}}
//}}}
!How to get a dynamic main menue
RelatedTo: http://groups.google.com/group/tiddlywiki/browse_thread/thread/448cb260b7ace231?hl=en
The easiest way I think is to use tags and the {{{<<list filter [tag[yourTagHere]]>>}}} mechanism
{{{
<<list filter [tag[yourTagHere]]>>
}}}
<<list filter [tag[yourTagHere]]>>
If you don't like the style. Change it in StyleSheet
{{{
{{myListStyle{<<list filter [tag[yourTagHere]]>>}}}
}}}
{{myListStyle{<<list filter [tag[yourTagHere]]>>}}}
/%
!info
|Name|SortXListSave|
|Source||
|Version|0.2.0|
|Author|Mario Pietsch|
|Derived from:|http://www.tiddlytools.com/#ToggleLeftSidebar|
|License|http://creativecommons.org/licenses/by-nc-sa/3.0/at/|
|~CoreVersion|2.6|
|Type|transclusion|
|Description|Activate xList drag and drop sorting.|
Usage
<<<
{{{
<<tiddler SortXListSave>>
<<tiddler SortXListSave with: label tooltip>>
<<tiddler SortXListSave with: "⤓" "Save modified lists.">>
}}}
Try to save modified lists: <<tiddler SortXListSave##show
with: "⤓" "Save modified lists.">>
<<<
!end
!show
<<tiddler {{
// some init here
'';}}>><html><nowiki><a href='javascript:;' title="$2"
onmouseover="
this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
+encodeURIComponent(encodeURIComponent(this.onclick))
+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
if (!version.extensions.jqueryui) {alert('Styling is not active!\nYou need to use: [ActivateStyling] macro.'); return false;}
jQuery('.xList').each( function (idx) {
// console.log('outside: ',jQuery(this) )
if (jQuery(this).attr('modified') === 'true') {
// console.log('inside: ',jQuery(this))
var arr = jQuery(this).sortable( 'toArray');
// console.log('arr: ', arr)
var tag = jQuery(this).attr('tag');
// check for ascending or descending sort order
var sortField = jQuery(this).attr('sortfield');
var asc = 0; // this method is different here, to sorting asc -asc !!
switch (sortField.substr(0, 1)) {
case '-':
asc = -1;
case '+':
sortField = sortField.substr(1);
break;
default: ;
}
// console.log('arr: ', arr);
var t;
var x = arr.length - 1; // index starts at 0
for (i=0; i<arr.length; i++) {
if (store.tiddlerExists( arr[i])) {
var field = {};
// console.log('abs( asc*(x) + i): ', Math.abs( asc*(x) + i));
field[sortField+tag] = String.zeroPad( Math.abs( asc*(x) + i) , 4);
store.addTiddlerFields( arr[i], field)
}
} // for
autoSaveChanges();
} // if modified
}) // each
jQuery('.xList').sortable('destroy')
return false;
">$1</a></html>
!end
%/<<tiddler {{
var src='SortXListSave';
src+(tiddler&&tiddler.title==src?'##info':'##show');
}} with: "$1" "$2">>
!Simple time measuring routine
*The overhead can be easily calculated if you disable the second script block.
*To test your macro: Insert your macro instead of the second script block.
*You can use the RefreshTiddler transclusion to refresh the tiddler. So open and close would be needed.
*have fun!
reference: http://groups.google.com/group/tiddlywiki/browse_thread/thread/a76840c99ccd5ce?hl=en
{{{
<<tiddler PerformanceMeasurement##code>>
}}}
<<tiddler PerformanceMeasurement##code>>
{{{
!code
<script>
var time = new Date();
config.options.startTime = time.getTime()
</script>
<script>
for (i = 0; i < 10000; i++) {
i = i;
}
</script>
<script>
var time = new Date();
displayMessage( 'needed: ' + ( time.getTime() - config.options.startTime) + ' ms');
</script>
!end
}}}
/***
!Description
!CSS
***/
/*{{{*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, code,
del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
line-height: 1.5;
}
/* Tables still need 'cellspacing="0"' in the markup. */
table { border-collapse: separate; border-spacing: 0; }
caption, th, td { text-align: left; font-weight: normal; }
table, td, th { vertical-align: middle; }
/* Remove possible quote marks (") from <q>, <blockquote>. */
blockquote:before, blockquote:after, q:before, q:after { content: ""; }
blockquote, q { quotes: "" ""; }
/* Remove annoying border on linked images. */
a img { border: none; }
/*}}}*/
*save dragsort order to field?
*fix dragsort from bleeding from one tiddler to another without the macro (macro problem?)
*sample item 1
*sample item 2
*sample item 3
*sample item 4
<<ds>>
<script label="refresh this tiddler" title="redisplay the contents of this tiddler">
story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true);</script>
Potential solution to saving problem. . .
http://apm-plugins.tiddlyspot.com/#XListPluginTest
http://apm-plugins.tiddlyspot.com/#XListPlugin
~XListPlugin video: http://www.youtube.com/watch?v=jfXAACS2TGk
http://whatfettle.com/2008/07/MainMenuOrderPlugin/
/***
!!! Click the button to see the code section
<<slider chkTstSliderViewCode {{tiddler.title+'##Code'}} "View code »" "Display the code">>
/%
! Code
*** some intro text ***/
/*{{{*/
// <<slider chkTstSliderViewCode TstSliderViewCode##Code "View code »" "Display the code">>
// <<slider chkTstSliderViewCode {{tiddler.title+'##Code'}} "View code »" "Display the code">>
/*}}}*/
// /% %/
<html>
<div id="ColorfulToolbarPluginWishes" style="width: 100%; height: 420px; margin-bottom:1em;"></div>
</html>
<script>
var wave = new WavePanel('https://wave.google.com/wave/');
wave.setUIConfig('white', 'black', 'Arial', '13px');
wave.loadWave('googlewave.com!w+LmD-KrZkTeq');
wave.init(document.getElementById('ColorfulToolbarPluginWishes'));
</script>
Do something usefull here! Open TopListC and/or the [[dummy]] tiddler and change them!
{{{
<<xList xCase "sort." "." "[tag[with spaces]]">>
}}}
<<xList xCase "sort." "." "[tag[with spaces]]">>
{{dp50{
{{{
<<list filter "[tag[with spaces]][sort[sort.with.spaces]]">>
}}}
<<list filter "[tag[with spaces]][sort[sort.with.spaces]]">>}}}{{dp50{
{{{
<<list filter "[tag[with spaces]][sort[-sort.with.spaces]]">>
}}}
<<list filter "[tag[with spaces]][sort[-sort.with.spaces]]">>}}}
{{dp50 noBullets{
{{{
{{noBullets{ <<xList xCase "sort." "." "[tag[withoutSpaces]]">> }}}
}}}
<<xList xCase "sort." "." [tag[withoutSpaces]]>>}}}{{dp50{
{{{
<<xList xCase "-sort." "." "[tag[withoutSpaces]]">>
}}}
<<xList xCase "-sort." "." [tag[withoutSpaces]]>>}}}
/***
http://groups.google.com/group/tiddlywiki/browse_thread/thread/176aeb8e4099933b?hl=en
***/
//{{{
(function ($) {
var me;
config.macros.addTag = me = {
// locale should be used for easy translation!
locale: {
txtNoTagText: "No tag text specified!",
txtTooltip: "If you click this button, the tiddler will be tagged: [%0] "
},
handler: function(place, macroName, params, wikifier, paramString, tiddler){
var btn = null;
var data = {};
// this is the initialisation of btnContent. If there is no params[0] the ||=OR parameter will be used
// try <<addTag>> to see what happens
var btnContent = params[0] || me.locale.txtNoTagText;
// locale.txtTooltip is a string with a placeholder %0 which will be replaced by the content of the .format(["some text"])
// .format([]) is an array ! eg: .format([ "text1", "text2", varText3, ...])
var btnTooltip = me.locale.txtTooltip.format([btnContent]);
// If you need several buttons, you could use the next 2 __code__ lines to produce them.
// Since onClick gets its info from data section, you can call the same onClick all the times.
// only data needs to be different.
// createTiddlyButton(parent, text, tooltip, action, className, id, accessKey, attribs)
btn = createTiddlyButton(place, btnContent, btnTooltip, me.onClick, 'bold', 'btnAddTag');
// since the click function doesn't know anything about "place", "params", "tiddler" ...
// everything needed by onClick needs to be passed to it!
// next 2 lines could be written like data = {'place':place, 'tag':btnContent};
data.place = place;
data.tag = btnContent;
$(btn).data('dataForClick', data);
// console.log($(btn));
},
onClick: function() {
// get the data passed from handler()
var data = $(this).data('dataForClick');
var tiddler, tagIt = true;
// console.log('data: ', data);
var here=story.findContainingTiddler( data.place); // see: data.place !!
if (here) {
tiddler = store.getTiddler(here.getAttribute("tiddler"));
// enable the next line, if you need tag toggling.
// tagIt = !tiddler.isTagged(data.tag);
store.setTiddlerTag(tiddler.title, tagIt, data.tag);
// console.log('tiddler', tiddler);
} // if (here)
} // onClick
};
}) (jQuery);
//}}}
Related to: http://groups.google.com/group/tiddlywiki/browse_thread/thread/9f3fb012e80fdc4 and AddNowCommand
<<newTiddler
label:"new tiddler contains Date and Time"
tag:"yourTag"
tag:"secondTag"
title:"test addNow"
focus:"text"
text:{{config.commands.addNow.insertText.format([new Date().formatString(config.commands.addNow.dateFormat)] )}}
>>
{{{
<<newTiddler
label:"new tiddler contains Date and Time"
tag:"yourTag"
tag:"secondTag"
title:"yourTitle"
focus:"text"
text:{{config.commands.addNow.insertText.format([new Date().formatString(config.commands.addNow.dateFormat)] )}}
>>
}}}
/***
|Name:|LessBackupsPlugin|
|Description:|Intelligently limit the number of backup files you create|
|Version:|3.0.1 ($Rev: 2320 $)|
|Date:|$Date: 2007-06-18 22:37:46 +1000 (Mon, 18 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
|Author:|Simon Baird|
|Email:|simon.baird@gmail.com|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second. So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array
!!Notes
Works in IE and Firefox only. Algorithm by Daniel Baird. IE specific code by by Saq Imtiaz.
***/
//{{{
var MINS = 60 * 1000;
var HOURS = 60 * MINS;
var DAYS = 24 * HOURS;
if (!config.lessBackups) {
config.lessBackups = {
// comment out the ones you don't want or set config.lessBackups.modes in your 'tweaks' plugin
modes: [
["YYYY", 365*DAYS], // one per year for ever
["MMM", 31*DAYS], // one per month
["ddd", 7*DAYS], // one per weekday
//["d0DD", 1*DAYS], // one per day of month
["h0hh", 24*HOURS], // one per hour
["m0mm", 1*HOURS], // one per minute
//["s0ss", 1*MINS], // one per second
["latest",0] // always keep last version. (leave this).
]
};
}
window.getSpecialBackupPath = function(backupPath) {
var now = new Date();
var modes = config.lessBackups.modes;
for (var i=0;i<modes.length;i++) {
// the filename we will try
var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
'$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')
// open the file
try {
if (config.browser.isIE) {
var fsobject = new ActiveXObject("Scripting.FileSystemObject")
var fileExists = fsobject.FileExists(specialBackupPath);
if (fileExists) {
var fileObject = fsobject.GetFile(specialBackupPath);
var modDate = new Date(fileObject.DateLastModified).valueOf();
}
}
else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(specialBackupPath);
var fileExists = file.exists();
if (fileExists) {
var modDate = file.lastModifiedTime;
}
}
}
catch(e) {
// give up
return backupPath;
}
// expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
// June file on disk that's more than an month old then it must be stale so overwrite
// note that "latest" should be always written because the expiration period is zero (see above)
var expiry = new Date(modDate + modes[i][1]);
if (!fileExists || now > expiry)
return specialBackupPath;
}
}
// hijack the core function
window.getBackupPath_mptw_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
return getSpecialBackupPath(getBackupPath_mptw_orig(localPath));
}
//}}}
/***
|''Name''|ServerSideSavingPlugin|
|''Description''|server-side saving|
|''Author''|FND|
|''Version''|0.6.5|
|''Status''|stable|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/plugins/ServerSideSavingPlugin.js|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.5.3|
|''Keywords''|serverSide|
!Notes
This plugin relies on a dedicated adaptor to be present.
The specific nature of this plugin depends on the respective server.
!Revision History
!!v0.1 (2008-11-24)
* initial release
!!v0.2 (2008-12-01)
* added support for local saving
!!v0.3 (2008-12-03)
* added Save to Web macro for manual synchronization
!!v0.4 (2009-01-15)
* removed ServerConfig dependency by detecting server type from the respective tiddlers
!!v0.5 (2009-08-25)
* raised CoreVersion to 2.5.3 to take advantage of core fixes
!!v0.6 (2010-04-21)
* added notification about cross-domain restrictions to ImportTiddlers
!To Do
* conflict detection/resolution
* rename to ServerLinkPlugin?
* document deletion/renaming convention
!Code
***/
//{{{
(function($) {
readOnly = false; //# enable editing over HTTP
var plugin = config.extensions.ServerSideSavingPlugin = {};
plugin.locale = {
saved: "%0 saved successfully",
saveError: "Error saving %0: %1",
saveConflict: "Error saving %0: edit conflict",
deleted: "Removed %0",
deleteError: "Error removing %0: %1",
deleteLocalError: "Error removing %0 locally",
removedNotice: "This tiddler has been deleted.",
connectionError: "connection could not be established",
hostError: "Unable to import from this location due to cross-domain restrictions."
};
plugin.sync = function(tiddlers) {
tiddlers = tiddlers && tiddlers[0] ? tiddlers : store.getTiddlers();
$.each(tiddlers, function(i, tiddler) {
var changecount = parseInt(tiddler.fields.changecount, 10);
if(tiddler.fields.deleted === "true" && changecount === 1) {
plugin.removeTiddler(tiddler);
} else if(tiddler.isTouched() && !tiddler.doNotSave() &&
tiddler.getServerType() && tiddler.fields["server.host"]) { // XXX: server.host could be empty string
delete tiddler.fields.deleted;
plugin.saveTiddler(tiddler);
}
});
};
plugin.saveTiddler = function(tiddler) {
try {
var adaptor = this.getTiddlerServerAdaptor(tiddler);
} catch(ex) {
return false;
}
var context = {
tiddler: tiddler,
changecount: tiddler.fields.changecount,
workspace: tiddler.fields["server.workspace"]
};
var serverTitle = tiddler.fields["server.title"]; // indicates renames
if(!serverTitle) {
tiddler.fields["server.title"] = tiddler.title;
} else if(tiddler.title != serverTitle) {
return adaptor.moveTiddler({ title: serverTitle },
{ title: tiddler.title }, context, null, this.saveTiddlerCallback);
}
var req = adaptor.putTiddler(tiddler, context, {}, this.saveTiddlerCallback);
return req ? tiddler : false;
};
plugin.saveTiddlerCallback = function(context, userParams) {
var tiddler = context.tiddler;
if(context.status) {
if(tiddler.fields.changecount == context.changecount) { //# check for changes since save was triggered
tiddler.clearChangeCount();
} else if(tiddler.fields.changecount > 0) {
tiddler.fields.changecount -= context.changecount;
}
plugin.reportSuccess("saved", tiddler);
store.setDirty(false);
} else {
if(context.httpStatus == 412) {
plugin.reportFailure("saveConflict", tiddler);
} else {
plugin.reportFailure("saveError", tiddler, context);
}
}
};
plugin.removeTiddler = function(tiddler) {
try {
var adaptor = this.getTiddlerServerAdaptor(tiddler);
} catch(ex) {
return false;
}
var context = {
host: tiddler.fields["server.host"],
workspace: tiddler.fields["server.workspace"],
tiddler: tiddler
};
var req = adaptor.deleteTiddler(tiddler, context, {}, this.removeTiddlerCallback);
return req ? tiddler : false;
};
plugin.removeTiddlerCallback = function(context, userParams) {
var tiddler = context.tiddler;
if(context.status) {
if(tiddler.fields.deleted === "true") {
store.deleteTiddler(tiddler.title);
} else {
plugin.reportFailure("deleteLocalError", tiddler);
}
plugin.reportSuccess("deleted", tiddler);
store.setDirty(false);
} else {
plugin.reportFailure("deleteError", tiddler, context);
}
};
plugin.getTiddlerServerAdaptor = function(tiddler) { // XXX: rename?
var type = tiddler.fields["server.type"] || config.defaultCustomFields["server.type"];
return new config.adaptors[type]();
};
plugin.reportSuccess = function(msg, tiddler) {
displayMessage(plugin.locale[msg].format([tiddler.title]));
};
plugin.reportFailure = function(msg, tiddler, context) {
var desc = (context && context.httpStatus) ? context.statusText :
plugin.locale.connectionError;
displayMessage(plugin.locale[msg].format([tiddler.title, desc]));
};
config.macros.saveToWeb = { // XXX: hijack existing sync macro?
locale: { // TODO: merge with plugin.locale?
btnLabel: "save to web",
btnTooltip: "synchronize changes",
btnAccessKey: null
},
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
createTiddlyButton(place, this.locale.btnLabel, this.locale.btnTooltip,
plugin.sync, null, null, this.locale.btnAccessKey);
}
};
// hijack saveChanges to trigger remote saving
var _saveChanges = saveChanges;
saveChanges = function(onlyIfDirty, tiddlers) {
if(window.location.protocol == "file:") {
_saveChanges.apply(this, arguments);
} else {
plugin.sync(tiddlers);
}
};
// override removeTiddler to flag tiddler as deleted -- XXX: use hijack to preserve compatibility?
TiddlyWiki.prototype.removeTiddler = function(title) { // XXX: should override deleteTiddler instance method?
var tiddler = this.fetchTiddler(title);
if(tiddler) {
tiddler.tags = ["excludeLists", "excludeSearch", "excludeMissing"];
tiddler.text = plugin.locale.removedNotice;
tiddler.fields.deleted = "true"; // XXX: rename to removed/tiddlerRemoved?
tiddler.fields.changecount = "1";
this.notify(title, true);
this.setDirty(true);
}
};
// hijack ImportTiddlers wizard to handle cross-domain restrictions
var _onOpen = config.macros.importTiddlers.onOpen;
config.macros.importTiddlers.onOpen = function(ev) {
var btn = $(resolveTarget(ev));
var url = btn.closest(".wizard").find("input[name=txtPath]").val();
if(window.location.protocol != "file:" && url.indexOf("://") != -1) {
var host = url.split("/")[2];
var macro = config.macros.importTiddlers;
if(host != window.location.host) {
btn.text(macro.cancelLabel).attr("title", macro.cancelPrompt);
btn[0].onclick = macro.onCancel;
$('<span class="status" />').text(plugin.locale.hostError).insertAfter(btn);
return false;
}
}
return _onOpen.apply(this, arguments);
};
})(jQuery);
//}}}
/***
|''Name:''|NumberedTextListPlugin|
|''Description:''|Adds a new command ''numberedText'' to the core list macro|
|''Author:''|Mario Pietsch|
|''Version:''|0.2|
|''Date:''|2010.02.24|
|''Status:''|''beta''|
|''Source:''|http://apm-plugins.tiddlyspot.com/#NumberedTextListPlugin|
|''License''|[[MIT License]]|
|''CoreVersion:''|2.5.0|
|''Requires:''|XCaseListPlugin|
|''Documentation:''|this file|
|''Keywords:''|list, sort, number, numbered list, filter|
!Description
*NumberedTextListPlugin requires [[XCaseListPlugin|http://apm-plugins.tiddlyspot.com/#XCaseListPlugin]]!
*This plugin performs a numerical sort for tiddlers, that start with numbers in the title! It automatically performs a filter to the very first character of the tiddler title. It has to be a number!
For additional filtering it uses the {{{<<list filter [tag[]]>>}}} syntax.
!!!Example
{{{
<<list numberedText>>
}}}
<<list numberedText title '[.]' 4 [tag[dot]]>>
!Default Format
{{{
<<list numberedText>>
}}}
!Full Format
<<<
{{{
<<list numberedText sortField delimiter numberOfSections tagList>>
}}}
!!!!!list numberedText
>Calls the core list macro, which gives its parameters to numberedText "sub" macro
!!!!!sortField
>The tiddler field, which is used for sorting
>''title'' or ''+title'' means ascending sort order
>''-title'' means descending sort order
!!!!!delimiter
>If you want to change this parameter you have to have the ''sortField'' definition. Otherwise it will not work!
>Is a regExp expression which defines the delimiter between 2 sections.
>eg: 1.2.3 where 1 is section one, 2 = section two ....
!!!!!numberOfSections
>Is the number of sections which are used for sorting.
>If you have only 2 sections you can still use 4 sections for sorting, it doesn't change the result. But If you have 4 sections (eg: 1.2.a.b) you need to change it to {{{<<list numberedText title '[.]' 2>>}}} than a.b are sorted alpahbetically!
!!!!!tagList
>List of tags. eg: {{{"[tag[isTagged]]"}}}. It has to be covered inside qoutes!
>If MatchTagsPlugin is installed there are more possibilities. eg: {{{'[tag[thisTag AND thatTag]]'}}}
<<<
!More Possibilities
<<<
!!! Reverse order
{{{
<<list numberedText -title>>
}}}
!!! Different number delimiter
Number delimiters have to be enclosed in brackets '' '[ ]' '' and it has to be a string!
There should be _no_ spaces, except you want a "space" to be a delimiter!
{{{
<<list numberedText title '[-]'>>
}}}
!!! Two different number delimiters
{{{
<<list numberedText title '[.-]'>>
<<list numberedText title '[. ]'>> .. dot and space !
}}}
*first: 1.1-3 tiddler, 1-1-2 tiddler,
*second: 1.23 4 tiddler, 12 34.567 tiddler
!!! 2 Sections
Only 2 sections are used for sorting. 4 sections are default. More sections are also possible. (Didn't test that)
eg: 1''.''23''.''456''.''78
{{{
<<list numberedText title '[.]' 2>>
}}}
!!!Tag is needed, that tiddler is used
{{{
<<list numberedText title '[.]' 4 '[tag[MyTag]] [tag[OrTag]]'>>
}}}
!!!One number, no delimiters
If you don't have any delimiters
eg: 11 tiddler, 2 tiddler, 3 tiddler use:
{{{
<<list numberedText title '[.]' 1>>
}}}
<<<
!Code
***/
/*{{{*/
if(!version.extensions.NumberedTextListPlugin) { //# ensure that the plugin is only installed once
version.extensions.NumberedTextListPlugin = { installed: true };
config.macros.list.numberedText = {};
config.macros.list.numberedText.handler = function(params) {
var defaultField = '+title';
var lookupField = 'tags';
var lookupValue = 'excludeLists';
var lookupMatch = false;
var results = [];
var regDelim = params[2] || '[.]'; // default delimiter
var tagList = params[4] || '';
// default number of sections
var nbrSnips = (params[3]) ? parseInt(params[3]) : 4;
var regStart = '(^\\d+)'; // first element has to be a digit
var regSnip = '?(\\d+)?'; // other digits are optional
var regMod = 'im'; // regExp modifier
var newReg = '';
for (var i=1; i<nbrSnips; i++) {
newReg += regDelim + regSnip;
};
newReg = regStart + newReg;
var regExp = new RegExp(newReg, regMod);
//var regExp = /(^\d+)[.:-]?(\d+)?[.:-]?(\d+)?[.:-]?(\d+)?/im;
var maxDigits = []; // maximum digits in one section for zeroPad
for (var i=0; i<nbrSnips+1; i++) {maxDigits[i]=0;};
var match = null;
var sortField = params[1] || defaultField // optional sort field
var pSortField = sortField;
var asc = 1; // default sort order
switch (sortField.substr(0, 1)) {
case "-":
asc = -1;
pSortField = '#' + pSortField; //special prep for "list.expert"
sortField = sortField.substr(1);
break;
case "+":
pSortField = '#' + pSortField; //special prep for "list.expert"
sortField = sortField.substr(1);
break;
default: pSortField = '#+' + pSortField; //special prep for "list.expert"
}
var newParams = ['numberedText', pSortField, '\\d', tagList];
results = config.macros.list['xCase'].handler(newParams);
for (var x = 0, xMax = results.length; x < xMax; x++) {
match = results[x][sortField].match(regExp);
for (var i = 0, max = match.length; i < max; i++) {
if (match[i])
maxDigits[i] = (maxDigits[i] < match[i].length) ? match[i].length : maxDigits[i];
}; // for ..
};
results.sort(function (a,b) {
var match = a[sortField].match(regExp);
var aM = '';
for (var i=1, max = match.length; i<max; i++) {
aM += (match[i])? String.zeroPad(match[i], maxDigits[i]):'';
}
match = b[sortField].match(regExp);
var bM = '';
for (var i=1, max = match.length; i<max; i++) {
bM += (match[i])? String.zeroPad(match[i], maxDigits[i]):'';
}
return aM < bM ? -asc : aM == bM ? 0 : asc;});
return results;
};
} //# end of "install only once"
/*}}}*/
/***
|''Name''|DiffFormatter|
|''Description''|highlighting of text comparisons|
|''Author''|FND|
|''Version''|0.9.0|
|''Status''|beta|
|''Source''|http://svn.tiddlywiki.org/Trunk/contributors/FND/formatters/DiffFormatter.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/contributors/FND/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''Keywords''|formatting|
!Description
Highlights changes in a unified [[diff|http://en.wikipedia.org/wiki/Diff#Unified_format]].
!Notes
Based on Martin Budden's [[DiffFormatterPlugin|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/formatters/DiffFormatterPlugin.js]].
!Usage
The formatter is applied to blocks wrapped in <html><code>{{{diff{..}}}</code></html> within tiddlers tagged with "diff".
!Revision History
!!v0.9 (2010-04-07)
* initial release; fork of DiffFormatterPlugin
!StyleSheet
.diff { white-space: pre; font-family: monospace; }
.diff ins, .diff del { display: block; text-decoration: none; }
.diff ins { background-color: #dfd; }
.diff del { background-color: #fdd; }
.diff .highlight { background-color: [[ColorPalette::SecondaryPale]]; }
!Code
***/
//{{{
(function() {
config.shadowTiddlers.StyleSheetDiffFormatter = store.getTiddlerText(tiddler.title + "##StyleSheet");
store.addNotification("StyleSheetDiffFormatter", refreshStyles);
var formatters = [{
name: "diffWrapper",
match: "^\\{\\{diff\\{\n", // XXX: suboptimal
termRegExp: /(.*\}\}\})$/mg,
handler: function(w) {
var el = createTiddlyElement(w.output, "div", null, "diff");
w.subWikifyTerm(el, this.termRegExp);
}
}, {
name: "diffRange",
match: "^(?:@@|[+\\-]{3}) ",
lookaheadRegExp: /^(?:@@|[+\-]{3}) .*\n/mg,
handler: function(w) {
createTiddlyElement(w.output, "div", null, "highlight").
innerHTML = "…";
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
}, {
name: "diffAdded",
match: "^\\+",
termRegExp: /(\n)/mg,
handler: function(w) {
var el = createTiddlyElement(w.output, "ins", null, "added");
w.subWikifyTerm(el, this.termRegExp);
}
}, {
name: "diffRemoved",
match: "^-",
termRegExp: /(\n)/mg,
handler: function(w) {
var el = createTiddlyElement(w.output, "del", null, "removed");
w.subWikifyTerm(el, this.termRegExp);
}
}
];
config.parsers.diffFormatter = new Formatter(formatters);
config.parsers.diffFormatter.format = "diff";
config.parsers.diffFormatter.formatTag = "diff";
})();
//}}}
/***
!Description
!CSS
***/
/*{{{*/
.main{position:relative;}
.lf0,.lf5,.lf10,.lf15,.lf20,.lf25,.lf30,.lf35,.lf40,.lf45,.lf50,.lf55,.lf60,.lf65,.lf70,.lf75,.lf80,.lf85,.lfn5,.lfn10,.lfn15,.lfn20,.lfn25,.lfn30,
.tp0,.tp5,.tp10,.tp15,.tp20,.tp25,.tp30,.tp35,.tp40,.tp45,.tp50,
.bt0,.bt5,.bt10,.bt15,.bt20,.bt25,.bt30,.bt35,.bt40,.bt45,.bt50,
.rtn5,.rtn10,.rtn20,.rtn30{position:absolute;}
.lf0{left:0em;}
.lf5{left:5em;}
.lf10{left:10em;}
.lf15{left:15em;}
.lf20{left:20em;}
.lf25{left:25em;}
.lf30{left:30em;}
.lf35{left:35em;}
.lf40{left:40em;}
.lf45{left:45em;}
.lf50{left:50em;}
.lf55{left:55em;}
.lf60{left:60em;}
.lf65{left:65em;}
.lf70{left:70em;}
.lf75{left:75em;}
.lf80{left:80em;}
.lf85{left:85em;}
.lfn5{left:-5em;}
.lfn10{left:-10em;}
.lfn15{left:-15em;}
.lfn20{left:-20em;}
.lfn25{left:-25em;}
.lfn30{left:-30em;}
.rtn5{right:-5em;}
.rtn10{right:-10em;}
.rtn15{right:-15em;}
.rtn20{right:-20em;}
.rtn25{right:-25em;}
.rtn30{right:-30em;}
.tp0{top:0em;}
.tp5{top:5em;}
.tp10{top:10em;}
.tp15{top:15em;}
.tp20{top:20em;}
.tp25{top:25em;}
.tp30{top:30em;}
.tp35{top:35em;}
.tp40{top:40em;}
.tp45{top:45em;}
.tp50{top:50em;}
.bt0{bottom:0em;}
.bt5{bottom:0em;}
.bt10{bottom:10em;}
.bt15{bottom:15em;}
.bt20{bottom:20em;}
.bt25{bottom:25em;}
.bt30{bottom:30em;}
.bt35{bottom:35em;}
.bt40{bottom:40em;}
.bt45{bottom:45em;}
.bt50{bottom:50em;}
.zi1{ z-index:1;}
.zi2{ z-index:2;}
.zi3{ z-index:3;}
.zi4{ z-index:4;}
.zi5{ z-index:5;}
/*}}}*/
/***
|''Name''|ColorfulToolbarPlugin|
|''Description''|Change color of reference button in toolbar if there are references / backlinks to the tiddler|
|''Authors''|see Related to|
|''Version''|0.0.5|
|''Date''|2010-06-03|
|''Status''|@@beta@@|
|''Source''|http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#ColorfulToolbarPlugin|
|''License''|<...>|
|''CoreVersion''|2.5|
|''Documentation''|included|
|''Related to''|http://groups.google.com/group/tiddlywiki/browse_thread/thread/508b5fc7730e2372?hl=en|
|''Keywords''|change color, references, toolbar|
!!!Description
<<<
This script is an attempt to color ‘references’ in the toolbar red if the tiddler has references.
<<<
!!!Notes
<<<
To see, what it does click the "more" button at the toolbar!
<<<
!!!Usage
<<<
!!!!Standard
{{{
<<colorfulReferences>>
<<colorfulReferences color green>>
<<colorfulReferences text-decoration underline>>
<<colorfulReferences color green true>>
}}}
!!!!ViewTemplate
{{{
<span class='test' macro='colorfulReferences' ></span>
}}}
<<<
!!!Parameters
<<<
Parameters are optional!
{{{
<<colorfulReference [CSS attribute] [value] [true|false]>>
}}}
[CSS attribute] ... can be any valid CSS attribute
[value] ... can be any value according to used attribute
[true|false] ... used to display number of references next to the toolbar command
<<<
!!!Examples
<<<
{{{
<<colorfulReferences color green true>>
}}}
<<colorfulReferences color green true>>
<<<
!!!Configuration Options
<<<
none
<<<
!!!Revision History
<<<
V 0.0.5 - 2010-06-03
* option to display quantity of references added by Colm
**2010-06-06 this tiddler uses {{{<<colorfulReferences color green true>>}}}
**updated the header info. no code changes.
V 0.0.4 - 2010-05-30
* additional Parameters added by Colm
**see Usage
V 0.0.3 - 2010-05-29
* initial Release
<<<
!!!To Do
<<<
<Alex ???>
<<<
!!!Code
***/
/*{{{*/
if(!version.extensions.ColorfulToolbarPlugin) { //# ensure that the plugin is only installed once
version.extensions.ColorfulToolbarPlugin = { installed: true };
config.macros.colorfulReferences = {
handler: function (place, macroName, params, wikifier, paramString, tiddler) {
var refAttribute = params[0] || 'color'; // default CSS attribute is "color"
var attValue = params[1] || 'red'; // default value is "red";
var numFlag = params[2] || 'false';
var tids = store.getReferringTiddlers(tiddler.title);
if (tids.length > 0) {
var id = story.findContainingTiddler(place);
var command_ref = jQuery(id).find('.command_references');
(numFlag === 'true') ? command_ref.css(refAttribute,attValue).append('('+tids.length+')') : command_ref.css(refAttribute,attValue);
} //; if
} // handler
}; // config.macros
} //# end of "install only once"
/*}}}*/
Name: MptwBlue
Background: #fff
Foreground: #000
PrimaryPale: #cdf
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
Name: MptwGreen
Background: #fff
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/***
|''Name:''|AnnotationsPlugin|
|''Description:''|Inline annotations for tiddler text.|
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#AnnotationsPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
*{{{((text to annotate(annotation goes here)}}}
* To include the text being annotated, in the popup as a title, put {{{^}}} as the first letter of the annotation text.
** {{{((text to annotate(^annotation goes here)}}}
!!Examples:
Mouse over, the text below (which has two annotations, banana and kiwi; kiwi gets clobbered in the jQuery version, but not in the innerhtml version):
* ((//banana//(the best fruit in the world)))
* (([[banana|http://en.wikipedia.org/wiki/Banana]](^the best fruit in the world)))
* (([[banana|http://en.wikipedia.org/wiki/Banana]](the best fruit in the world)))
* ((--kiwi--(^ the best fruit in the world)))
!!View Code
<<slider chkAnnotations2 {{tiddler.title + '##Code'}} "View code »" "Display the code">>
// /%
!Code
***/
/*{{{*/
config.formatters.unshift({name:"annotations",match:"\\(\\(",lookaheadRegExp:/\(\((.*?)\((\^?)((?:.|\n)*?)\)\)\)/g,
handler:function(w){
// begin where the opening match has (already) been found
this.lookaheadRegExp.lastIndex=w.matchStart;
// now match the whole lookahead, which finds the 3 parts of the expression:
//1) the source, 2)the suject option and 3) the annotation
var _2=this.lookaheadRegExp.exec(w.source);
//if this condition applies, then the annotation is correctly formatted.
if(_2&&_2.index==w.matchStart){
//attach <span class=annosub> subject </span> to w.output
// and create a var, _3
var _3=createTiddlyElement(w.output,"span",null,"annosub");
// jQuery(wikifyStatic(_2[1])).appendTo(_3); //this does not work somehow!
_3.innerHTML=wikifyStatic(_2[1]); // this does
//attach the annotation as a property of _3
_3.anno=_2[3];
// add the subject to the annotation as a subject property if the ^ option is indicated
if(_2[2]){_3.subject=_2[1];}
// setup mousing functions
_3.onmouseover=this.onmouseover;
_3.onmouseout=this.onmouseout;
_3.ondblclick=this.onmouseout;
//continue formatting after the annotation; _2.index= start of annotation; _2[0] is then full pattern string found.
w.nextMatch=_2.index+_2[0].length;
}
},
onmouseover:function(e){
popup=createTiddlyElement(document.body,"div",null,"anno");
this.popup=popup;
if(this.subject){ wikify("!"+this.subject+"\n",popup);}
wikify(this.anno,popup);
addClass(this,"annosubover");
Popup.place(this,popup,{x:25,y:7});
},
onmouseout:function(e){
removeNode(this.popup);
this.popup=null;
removeClass(this,"annosubover");
}
});
setStylesheet(".anno{position:absolute;border:2px solid #000;background-color:#DFDFFF; color:#000;padding:0.5em;max-width:15em;width:expression(document.body.clientWidth > (255/12) *parseInt(document.body.currentStyle.fontSize)?'15em':'auto' );}\n"+
".anno h1, .anno h2{margin-top:0;color:#000;}\n"+
".annosub{background:#ccc;}\n"+
".annosub2{text-decoration:line-through;}\n"+
".annosubover{z-index:25; background-color:#DFDFFF;cursor:help;}\n","AnnotationStyles");
/*}}}*/
// /% %/
http://groups.google.com/group/tiddlywiki/browse_thread/thread/a9707f0cdf63b745?hl=en
{{{
<<newTiddler
label:"new tiddler contains YourPrototype text"
tag:"yourTag"
tag:"secondTag"
title:"yourTitle"
text:{{store.getTiddlerText("YourPrototype")}}
>>
}}}
<<newTiddler
label:"new tiddler contains YourPrototype text"
tag:"yourTag"
tag:"secondTag"
title:"yourTitle"
text:{{store.getTiddlerText("YourPrototype")}}
>>