Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association
!How to use this wiki
!To view the information
Select the links in the left-hand menu.
!!Navigation
Where there is a series, a set of boxes will appear below the text indicating how many items make up the series.
To navigate either click the ''Next'' or ''Previous'' text , or click on the specific box to see that item.
!Comments
!!To enter comments
Before you start entering comments fill your name in the textbox in the left-hand menu or below:
<<option txtUserName>>
When you see the ''add a comment'' button, select it, enter the text for your comment. When you have completed your comment, select the ''submit comment'' button.
!!Viewing comments
If the comments are already open, they can be folded by clicking on the comment title bar and vice versa.
----
<<tiddler CommentScript>>
/%comment%/
Sets of tiddlers
|''Exclude Lists'' |''System Config'' |''Presentation Package'' |''Comments Package'' |h
|<<list tagged excludeLists>> |<<list tagged systemConfig>> |<<list tagged PresentationPackage>> |<<list tagged CommentsPackage>> |
/***
===============================================================================
Author : Dawn Ahukanna
Version : $Id$
===============================================================================
----
''Name:'' _TwHelperLib
''Version:'' <<getPlugin _TwHelperLib >>
''Date:'' <<getPlugin _TwHelperLib date>>
''Author:'' <<getPlugin _TwHelperLib author>>
''Source:'' <<getPlugin _TwHelperLib code>>
''Documentation:'' <<getPlugin _TwHelperLib doc>>
''License:'' <<getPlugin _TwHelperLib license>>
''Browsers:'' <<getPlugin _TwHelperLib browsers>>
''~CoreVersion:'' <<getPlugin _TwHelperLib coreVersion>>
''Dependencies:'' <<getPlugin _TwHelperLib dependencies>>
''Summary:'' <<getPlugin _TwHelperLib summary>>
''Description:'' <<getPlugin _TwHelperLib description>>
----
!Dependencies
<<<
<<getPlugin _TwHelperLib dependencies>>
|Dependency |Author |Type |Version |Code URL |Comments |h
|GetPluginInfo |DawnAhukanna |Macro |<<getPlugin _GetPluginInfo version>> |<<getPlugin _GetPluginInfo code>> |<<getPlugin _GetPluginInfo description>>|
<<<
!Usage
<<<
<<getPlugin _TwHelperLib description>>
<<<
!Installation
<<<
Import (or copy/paste) the following tiddler into your document:
''_PluginTemplate'' (tagged with <<tag systemConfig>>)
<<<
!Configuration
<<<
''Syntax''
None.
<<<
!Revision History
<<<
|Release |Date |Comments|h
|1.0.0 |27 May 2007 |Updated for TiddlyWiki 2.2.0 release |
<<<
!Known Issues
<<<
None.
<<<
!To Do
<<<
None.
<<<
!Credits
<<<
This extension was produced by DawnAhukanna.
<<<
----
!Code
***/
/*
----
!Static Helper classes
{{{
*/
var pluginName="_TwHelperLib"; //Plugin name.
var coreVersion="2.2.0"; //Tiddlywiki version.
if(!version.extensions._TwHelperLib)
{ //Ensure that is only installed once.
version.extensions._TwHelperLib=
{
major: 1,
minor: 0,
revision: 0,
date: new Date("May 27, 2007"),
code: "http://project.dahukanna.net/tiddlywiki/twextensions.htm#_TwHelperLib",
doc: "http://project.dahukanna.net/tiddlywiki/twextensions.htm#_TwHelperLibDoc",
author:"DawnAhukanna dawn[at]dahukanna[dot]net",
coreVersion: coreVersion,
dependencies: "[[_GetPluginInfo]]",
license: "[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]",
browsers: "InternetExplorer 6.0, InternetExplorer 7.0, FireFox 1.5.x, FireFox 2.0.x",
summary: "[["+ pluginName + "]] for TiddlyWiki version "+coreVersion+" or above.",
description: "Library functions for core TiddlyWiki APIs. Exposes them in a unifiorm way so that any core changes don't require updating all custom plugin code. \n ''_TwHelperLib'' \n Static classes \n ''~TwHelper'' \n getTiddlersByTag: function(pTag,pSortField,pReverse) \n getTiddlers: function(pSortField,pReverse) \n matchTags: function(pTags, pReverse) \n sortTiddlers: function(pTiddlers, pSortField) \n createTiddlyElement: function(pParent,pElement,pId,pClass,pText) \n createTiddlyText: function(pParent,pText) \n wikify: function(pText,pPlace) \n alertAndThrow: function(pText) \n merge: function(pDst,pSrc,pPreserveExisting) \n",
name: pluginName,
installed: true
};
if(version.major < 2 || version.minor < 2)
alertAndThrow('_TwHelperLib requires TiddlyWiki 2.2.x or newer.');
/*
}}}
!TwDebugger static class.
{{{
*/
// Debugger methods for TW.
var TwDebug=
{
params: function(macro,array)
{
for (i=0; i<array.length; i++)
alert (macro + ".array[" + i + "]="+ array[i]);
},
length: function(macro, array)
{
for (i=0; i<array.length; i++)
alert (macro + ".length="+ array.length);
}
}
/*
}}}
!TwHelper static class.
{{{
*/
// Wrapper methods for TW.
var TwHelper=
{
/*
store.getTaggedTiddlers("[your tag]","[sort field]").reverse();
store.getTiddlers("[sort field]","excludeLists").reverse();
store.getTags();
*/
//variables
version: version,
//functions
getTiddlersByTag: function(pTag,pSortField,pReverse)
{
//Get all tiddlers with this tag, with optional reverse order.
var results=[];
switch (pTag)
{
case config.options.txtListEmpty:
case "":
case "null":
case "none":
var tids=store.getTiddlers(null,"excludeLists");
store.forEachTiddler(
function(title,tiddler)
{
if(tiddler.tags.length < 1)
results.push(tiddler);
}
);
break;
default:
if (pReverse)
{
results=store.getTaggedTiddlers(pTag,pSortField).reverse();
}
else
{
results=store.getTaggedTiddlers(pTag,pSortField);
}
break;
}
return results;
},
getTiddlers: function(pSortField,pReverse)
{
//Get all tiddlers apart from those tagged "excludeLists", with optional reverse order.
//DNA-TODO: Can I look up default "exclude ..." tags?.
var results;
if (pReverse)
{
results=store.getTiddlers(pSortField,"excludeLists").reverse();
}
else
{
results=store.getTiddlers(pSortField,"excludeLists");
}
return results;
},
matchTags: function(pTags, pReverse)
{
var allTags;
var results=[];
if (pReverse)
{
allTags=store.getTags().reverse();
}
else
{
allTags=store.getTags();
}
for (var t=0;t<allTags.length;t++)
{
for (var p=0;p<pTags.length;p++)
{
if (allTags[t][0]==pTags[p]) results.push(allTags[t]);
}
}
return results;
},
sortTiddlers: function(pTiddlers, pSortField)
{
if(pSortField)
//tiddlers.sort(function(a,b) {return a[pTiddlers] < b[pTiddlers] ? -1 : (a[pTiddlers] == b[pTiddlers] ? 0 : +1);});
return pTiddlers;
},
//Core TiddlyWiki APIs
createTiddlyElement: function(pParent,pElement,pId,pClass,pText)
{
return createTiddlyElement(pParent,pElement,pId,pClass,pText);
},
createTiddlyText: function(pParent,pText)
{
return createTiddlyText(pParent,pText);
},
wikify: function(pText,pPlace)
{
wikify(pText,pPlace);
},
alertAndThrow: function(pText)
{
alertAndThrow(pText);
},
merge: function(pDst,pSrc,pPreserveExisting)
{
merge(pDst,pSrc,pPreserveExisting);
}
}
}
/*
}}}
*/
!Introduction
Lorum ipsum
----
<<tiddler CommentScript>>
/%comment%/
!Specifications
!!Display Info
# Lorem Ipsum
# Lorem Ipsum
# Lorem Ipsum
# Lorem Ipsum
----
<<tiddler CommentScript>>
++++!!!!![comment from YourName on 26 June 2007 12:46:52]>
!3
Lorem Ipsum
!4
Lorem Ipsum
===
++++!!!!![comment from YourName on 26 June 2007 13:23:56]>
!4
Lorem Ipsum ===
/%comment%/
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
<<tiddler MainMenu>>
[[HowToSetup|_Setup]]
AuthorMainMenu
MainMenu
DefaultTiddlers
PluginManager
PresentationIndex
<!--{{{-->
<div id='header' 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 id='mainMenu' refresh='content' tiddler='AuthorMainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/***
Place your custom CSS here
***/
/*{{{*/
[[StyleSheetCommon]]
/*}}}*/
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date [[DD MMM YYYY]]'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='viewer topbutton' macro='top'></div>
<br><br>
<div class='viewer' macro='navigation tiddlers:{{store.getTiddlerText("PresentationIndex").readBracketedList()}}}'></div>
<div class='tagClear'></div>
<!--}}}-->
Story.prototype.refreshTiddler_activelink = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function (title,template,force)
{
var theTiddler = Story.prototype.refreshTiddler_activelink.apply(this,arguments);
if (!theTiddler)
return theTiddler
var menu = document.getElementById("mainMenu");
var links = menu.getElementsByTagName("a");
for (var i=0; i<links.length; i++)
{
if (!links[i].getAttribute("tiddlyLink"))
return;
if (document.getElementById(this.idPrefix+(links[i].getAttribute("tiddlylink"))))
addClass(links[i],"bold");
else
removeClass(links[i],"bold");
}
return theTiddler;
}
/%
|Name|CommentScript|
|Source|http://www.TiddlyTools.com/#CommentScript|
|Version|1.0.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin, NestedSlidersPlugin|
|Overrides||
|Description|form to enter feedback/comments that are automatically added to tiddler content|
Usage:
<<tiddler CommentScript with: reverse>>
To indicate the location within the containing tiddler where new comments are to be saved, embed the keyword "comment", enclosed in TW begin/end comment syntax in the containing tiddler source.
'reverse' is an optional keyword that causes all new comments to be inserted AFTER the comment marker instead of before the marker (producing reverse chronological order). Note that if you omit the comment marker from your tiddler source, the 'reverse' option is ignored and new comments are automatically appended to the end of the tiddler.
Revision History:
2007.05.26 added support for optional 'reverse' keyword.
%/+++[add a comment...]>...
<html><textarea id="comment" rows="10" style="width:100%"></textarea>
<input type="button" value="submit comment" onclick="addTiddlerComment(this.previousSibling.previousSibling);"></html><script>
place.lastChild.firstChild.value="Enter your comment text here";
</script>
===
<script>
window.addTiddlerComment = function(place) {
var here=story.findContainingTiddler(place); if (!here) return;
var title=here.getAttribute("tiddler");
var tiddler=store.getTiddler(title);
var marker="/%"+place.id+"%/";
var pos=tiddler.text.indexOf(marker);
if (pos==-1) pos=tiddler.text.length;
if ("$1".toLowerCase()=="reverse") pos+=marker.length; // reverse order by inserting AFTER comment marker
var heading="comment from "+config.options.txtUserName+" on "+(new Date()).toLocaleString();
var newtxt=tiddler.text.substr(0,pos);
//DNA-Replace: newtxt+="+++!!!!!["+heading+"]>\n"+place.value+"===\n";
newtxt+="++++!!!!!["+heading+"]>\n"+place.value+"===\n";
newtxt+=tiddler.text.substr(pos);
store.saveTiddler(tiddler.title,tiddler.title,newtxt,tiddler.modifier,tiddler.modified,tiddler.tags);
story.refreshTiddler(title,1,true);
//DNA: added for presentation comments.
saveChanges(true);
}
</script>
function setFooter() {
if (document.getElementById && document.getElementById("contentFooter") ) {
var windowHeight=findWindowHeight();
if (windowHeight>0) {
var contentHeight= document.getElementById('mainMenu').offsetHeight + document.getElementById("header").offsetHeight + document.getElementById("contentFooter").offsetHeight;
var menu= document.getElementById('mainMenu');
//var footerHeight=footerElement.offsetHeight;
if (windowHeight-(contentHeight)>=0) {
menu.style.position='relative';
menu.style.marginBottom=(windowHeight-(contentHeight))+'px';
}
else {
menu.style.position='';
menu.style.marginBottom='';
}
}
}
}
window.onresize = function() {
setFooter();
}
Story.prototype.refreshTiddler_footerhack=Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function (title,template,force)
{
var theTiddler = Story.prototype.refreshTiddler_footerhack.apply(this,arguments);
setFooter();
return theTiddler;}
//{{{
config.macros.def ={};
config.macros.def.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var sliceName = params[1]? params[1].toLowerCase() : params[0].toLowerCase();
var def = store.getTiddlerSlice("InfoDefinitions",sliceName);
if (def == undefined)
{
wikify(params[0],place);
return false;
}
var theClass = params[2]? params[2] : "info";
var container = createTiddlyElement(place,"span",null,theClass);
wikify(params[0],container);
if (document.all)
{
container.onmouseover = function(){addClass(this,"infoover");};
container.onmouseout = function(){removeClass(this,"infoover");};
}
var tooltip = createTiddlyElement(container,"span",null,null);
wikify(def, tooltip);
}
config.macros.note ={};
config.macros.note.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var sliceName = params[1]? params[1].toLowerCase() : params[0].toLowerCase();
var def = store.getTiddlerSlice("InfoDefinitions",sliceName);
if (def == undefined)
{
wikify(params[0],place);
return false;
}
var theClass = params[2]? params[2] : "note";
var container = createTiddlyElement(place,"span",null,theClass);
wikify("^^"+params[0]+"^^",container);
if (document.all)
{
container.onmouseover = function(){addClass(this,"noteover");};
container.onmouseout = function(){removeClass(this,"noteover");};
}
var tooltip = createTiddlyElement(container,"span",null,null);
wikify(def, tooltip);
}
//}}}
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Version|1.6.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Usage
<<<
When installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.
''Deferred execution from an 'onClick' link''
By including a {{{label="..."}}} parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered. You may also include a {{{title="..."}}} parameter to specify the 'tooltip' text that will appear whenever the mouse is moved over the onClick link text
''External script source files:''
You can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.
''Display script source in tiddler output''
By including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.
''Defining javascript functions and libraries:''
Although the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed. Thus, you cannot load a library and //immediately// use it's functions within the same tiddler. However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).
To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened. For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.
Since the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines. Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.
''Creating dynamic tiddler content''
An important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:
* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.
* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.
If your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display. For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.
//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//
''Accessing the ~TiddlyWiki DOM''
The plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.
Access to this DOM element allows you to create scripts that can:
* vary their actions based upon the specific location in which they are embedded
* access 'tiddler-relative' information (use findContainingTiddler(place))
* perform direct DOM manipulations (when returning wikified text is not enough)
<<<
!!!!!Examples
<<<
an "alert" message box:
><script show>
alert('InlineJavascriptPlugin: this is a demonstration message');
</script>
dynamic output:
><script show>
return (new Date()).toString();
</script>
wikified dynamic output:
><script show>
return "link to current user: [["+config.options.txtUserName+"]]";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
if (!window.story) window.story=window;
var title=story.findContainingTiddler(place).id.substr(7);
return title+" is using "+store.getTiddlerText(title).length+" bytes";
</script>
creating an 'onclick' button/link that runs a script:
><script label="click here" title="clicking this link will show an 'alert' box" show>
if (!window.story) window.story=window;
alert("Hello World!\nlinktext='"+place.firstChild.data+"'\ntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");
</script>
loading a script from a source url:
>http://www.TiddlyTools.com/demo.js contains:
>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}
>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}
><script src="demo.js" show>
return "loading demo.js..."
</script>
><script label="click to execute demo() function" show>
demo()
</script>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.02.19 [1.6.0]'' added support for title="..." to specify mouseover tooltip when using an onclick (label="...") script
''2006.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper. Fixes error caused when last line of script is a comment.
''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output
''2006.01.05 [1.4.0]'' added support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.
''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by UdoBorkowski
''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content. Based on a suggestion by BradleyMeck
''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax
''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access
''2005.11.08 [1.0.0]'' initial release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.inlineJavascript= {major: 1, minor: 6, revision: 0, date: new Date(2007,2,19)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
handler: function(w) {
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
if (lookaheadMatch[1]) { // load a script library
// make script tag, set src, add to body to execute, then remove for cleanup
var script = document.createElement("script"); script.src = lookaheadMatch[1];
document.body.appendChild(script); document.body.removeChild(script);
}
if (lookaheadMatch[5]) { // there is script code
if (lookaheadMatch[4]) // show inline script code in tiddler output
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (lookaheadMatch[2]) { // create a link to an 'onclick' script
// add a link, define click handler, save code in link (pass 'place'), set link attributes
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);
link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}
link.code="function _out(place){"+lookaheadMatch[5]+"\n};_out(this);"
link.setAttribute("title",lookaheadMatch[3]?lookaheadMatch[3]:"");
link.setAttribute("href","javascript:;");
link.style.cursor="pointer";
}
else { // run inline script code
var code="function _out(place){"+lookaheadMatch[5]+"\n};_out(w.output);"
code=code.replace(/document.write\(/gi,'place.innerHTML+=(');
try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
[[HowToUse|.HowToUse]]
[[Summary]]
[[Details|1-Introduction]]
----
Enter your name for comments
<<option txtUserName>>
<<author>>
// Resolves a Tiddler reference or tiddler title into a tiddler title string, or null if it doesn't exist
resolveTitle = function(t)
{
if (t instanceof Tiddler) t = t.title;
return store.tiddlerExists(t) ? t : null;
}
config.macros.navigation = {};
config.macros.navigation.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
if (!store.tiddlerExists(tiddler.title))
return false;
var e = createTiddlyElement(place,"span",null,"nav");
e.setAttribute("refresh","macro");
e.setAttribute("macroName",macroName);
e.setAttribute("params",paramString);
e.setAttribute("tiddler",tiddler.title)
this.refresh(e,paramString);
}
config.macros.navigation.refresh = function(place,params)
{
var tiddler = store.getTiddler(place.getAttribute("tiddler"));
removeChildren(place);
var params = place.getAttribute("params").parseParams("tiddlers",null,true);
//alert(store.getTiddlerText(getParam(params,"index",undefined)).parseParams("tiddlers",null,false))
var tiddlers = getParam(params,"tiddlers",undefined);
if (typeof tiddlers == 'string')
tiddlers = tiddlers.readBracketedList();
if (tiddlers == undefined)
alert("no source tiddlers defined for navigation");
var contents = [];
for (var i=0;i<tiddlers.length;i++)
{
var title = resolveTitle(tiddlers[i]);
contents.push(title);
}
var navIndex = contents.indexOf(tiddler.title);
if (navIndex == -1)
return false;
if (contents[navIndex-1])
{
wikify("[[<< Previous|"+contents[navIndex-1]+"]]",place);
place.lastChild.className += " navPrev";
}
if (contents[navIndex+1])
{
wikify("[[Next >>|"+contents[navIndex+1]+"]]",place);
place.lastChild.className += " navNext";
}
var theTable = createTiddlyElement(place,"table",null,"nav");
var theBody = createTiddlyElement(theTable,"tbody");
var theRow = createTiddlyElement(theBody,"tr");
for (var i=0; i<contents.length; i++)
{
var box = createTiddlyElement(theRow,"td",null,"navlinkcell"," ");
box.onclick = onClickTiddlerLink;
box.setAttribute("tiddlyLink",contents[i]);
box.title = (contents[i]);
if (contents[i] ==tiddler.title)
box.className += " activenav";
}
}
setStylesheet(
".navNext {float:right;}\n"+
".navPrev, .navPrevious{float:left;}\n"+
".nav .tiddlyLink {color:#000; background:transparent;border:none;padding:0;margin:0;}\n"+
".nav {padding:0;margin:0;}\n"+
".nav table {margin:0 auto !important; border:0px solid #000;padding:0;border-collapse:separate;}\n"+
".nav table tr{padding:0; margin:0;border-spacing: 1px;}\n"+
".nav table td {padding:4px; border:1px solid #000; border-spacing: 0px;cursor:pointer;cursor:hand}\n"+
".nav .activenav{background:#000 !important;}\n","NavigationPluginStyles");
/***
|Name|NestedSlidersPlugin|
|Source|http://www.TiddlyTools.com/#NestedSlidersPlugin|
|Version|2.0.5|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Slider.prototype.stop|
|Description|Make any tiddler content into an expandable 'slider' panel, without needing to create a separate tiddler to contain the slider content.|
++++!!!!![Configuration]>
Enable animation for slider panels
<<option chkFloatingSlidersAnimate>> allow sliders to animate when opening/closing
>(note: This setting is in //addition// to the general option for enabling/disabling animation effects:
><<option chkAnimate>> enable animations (entire document)
>For slider animation to occur, you must also allow animation in general.
Debugging messages for 'lazy sliders' deferred rendering:
<<option chkDebugLazySliderDefer>> show debugging alert when deferring slider rendering
<<option chkDebugLazySliderRender>> show debugging alert when deferred slider is actually rendered
===
++++!!!!![Usage]>
When installed, this plugin adds new wiki syntax for embedding 'slider' panels directly into tiddler content. Use {{{+++}}} and {{{===}}} to delimit the slider content. You can also 'nest' these sliders as deep as you like (see complex nesting example below), so that expandable 'tree-like' hierarchical displays can be created. This is most useful when converting existing in-line text content to create in-line annotations, footnotes, context-sensitive help, or other subordinate information displays.
Additional optional syntax elements let you specify
*default to open
*cookiename
*heading level
*floater (with optional CSS width value)
*mouse auto rollover
*custom class/label/tooltip/accesskey
*automatic blockquote
*deferred rendering
The complete syntax, using all options, is:
//{{{
++++(cookiename)!!!!!^width^*{{class{[label=key|tooltip]}}}>...
content goes here
===
//}}}
where:
* {{{+++}}} (or {{{++++}}}) and {{{===}}}^^
marks the start and end of the slider definition, respectively. When the extra {{{+}}} is used, the slider will be open when initially displayed.^^
* {{{(cookiename)}}}^^
saves the slider opened/closed state, and restores this state whenever the slider is re-rendered.^^
* {{{!}}} through {{{!!!!!}}}^^
displays the slider label using a formatted headline (Hn) style instead of a button/link style^^
* {{{^width^}}} (or just {{{^}}})^^
makes the slider 'float' on top of other content rather than shifting that content downward. 'width' must be a valid CSS value (e.g., "30em", "180px", "50%", etc.). If omitted, the default width is "auto" (i.e., fit to content)^^
* {{{*}}}^^
automatically opens/closes slider on "rollover" as well as when clicked^^
* {{{{{class{[label=key|tooltip]}}}}}}^^
uses custom label/tooltip/accesskey. {{{{{class{...}}}}}}, {{{=key}}} and {{{|tooltip}}} are optional. 'class' is any valid CSS class name, used to style the slider label text. 'key' must be a ''single letter only''. Default labels/tootips are: ">" (more) and "<" (less), with no default access key assignment.^^
* {{{">"}}} //(without the quotes)//^^
automatically adds blockquote formatting to slider content^^
* {{{"..."}}} //(without the quotes)//^^
defers rendering of closed sliders until the first time they are opened. //Note: deferred rendering may produce unexpected results in some cases. Use with care.//^^
//Note: to make slider definitions easier to read and recognize when editing a tiddler, newlines immediately following the {{{+++}}} 'start slider' or preceding the {{{===}}} 'end slider' sequence are automatically supressed so that excess whitespace is eliminated from the output.//
===
++++!!!!![Examples]>
simple in-line slider:
{{{
+++
content
===
}}}
+++
content
===
----
use a custom label and tooltip:
{{{
+++[label|tooltip]
content
===
}}}
+++[label|tooltip]
content
===
----
content automatically blockquoted:
{{{
+++>
content
===
}}}
+++>
content
===
----
all options combined //(default open, cookie, heading, sized floater, rollover, class, label/tooltip/key, blockquoted, deferred)//
{{{
++++(testcookie)!!!^30em^*{{big{[label=Z|click or press Alt-Z to open]}}}>...
content
===
}}}
++++(testcookie)!!!^30em^*{{big{[label=Z|click or press Alt-Z to open]}}}>...
content
===
----
complex nesting example:
{{{
+++^[get info...=I|click for information or press Alt-I]
put some general information here, plus a floating slider with more specific info:
+++^10em^[view details...|click for details]
put some detail here, which could include a rollover with a +++^25em^*[glossary definition]explaining technical terms===
===
===
}}}
+++^[get info...=I|click for information or press Alt-I]
put some general information here, plus a floating slider with more specific info:
+++^10em^[view details...|click for details]
put some detail here, which could include a rollover with a +++^25em^*[glossary definition]explaining technical terms===
===
===
===
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''NestedSlidersPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.06.10 - 2.0.5'' add check to ensure that window.adjustSliderPanel() is defined before calling it (prevents error on shutdown when mouse event handlers are still defined)
''2007.05.31 - 2.0.4'' add handling to invoke adjustSliderPanel() for onmouseover events on slider button and panel. This allows the panel position to be re-synced when the button position shifts due to changes in unrelated content above it on the page. (thanks to Harsha for bug report)
''2007.03.30 - 2.0.3'' added chkFloatingSlidersAnimate (default to FALSE), so that slider animation can be disabled independent of the overall document animation setting (avoids strange rendering and focus problems in floating panels)
''2007.03.01 - 2.0.2'' for TW2.2+, hijack Morpher.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends
''2007.03.01 - 2.0.1'' in hijack for Slider.prototype.stop, use apply() to pass params to core function
|please see [[NestedSlidersPluginHistory]] for additional revision details|
''2005.11.03 - 1.0.0'' initial public release
<<<
!!!!!Credits
<<<
This feature was implemented by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]] with initial research and suggestions from RodneyGomes, GeoffSlocock, and PaulPetterson.
<<<
!!!!!Code
***/
//{{{
version.extensions.nestedSliders = {major: 2, minor: 0, revision: 5, date: new Date(2007,6,10)};
//}}}
//{{{
// options for deferred rendering of sliders that are not initially displayed
if (config.options.chkDebugLazySliderDefer==undefined) config.options.chkDebugLazySliderDefer=false;
if (config.options.chkDebugLazySliderRender==undefined) config.options.chkDebugLazySliderRender=false;
if (config.options.chkFloatingSlidersAnimate==undefined) config.options.chkFloatingSlidersAnimate=false;
// default styles for 'floating' class
setStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \
background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");
//}}}
//{{{
config.formatters.push( {
name: "nestedSliders",
match: "\\n?\\+{3}",
terminator: "\\s*\\={3}\\n?",
lookahead: "\\n?\\+{3}(\\+)?(\\([^\\)]*\\))?(\\!*)?(\\^(?:[^\\^\\*\\[\\>]*\\^)?)?(\\*)?(?:\\{\\{([\\w]+[\\s\\w]*)\\{)?(\\[[^\\]]*\\])?(?:\\}{3})?(\\>)?(\\.\\.\\.)?\\s*",
handler: function(w)
{
// defopen=lookaheadMatch[1]
// cookiename=lookaheadMatch[2]
// header=lookaheadMatch[3]
// panelwidth=lookaheadMatch[4]
// rollover=lookaheadMatch[5]
// class=lookaheadMatch[6]
// label=lookaheadMatch[7]
// blockquote=lookaheadMatch[8]
// deferred=lookaheadMatch[9]
lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
{
// location for rendering button and panel
var place=w.output;
// default to closed, no cookie, no accesskey
var show="none"; var title=">"; var tooltip="show"; var cookie=""; var key="";
// extra "+", default to open
if (lookaheadMatch[1])
{ show="block"; title="<"; tooltip="hide"; }
// cookie, use saved open/closed state
if (lookaheadMatch[2]) {
cookie=lookaheadMatch[2].trim().slice(1,-1);
cookie="chkSlider"+cookie;
if (config.options[cookie]==undefined)
{ config.options[cookie] = (show=="block") }
if (config.options[cookie])
{ show="block"; title="<"; tooltip="hide"; }
else
{ show="none"; title=">"; tooltip="show"; }
}
// parse custom label/tooltip/accesskey: [label=X|tooltip]
if (lookaheadMatch[7]) {
title = lookaheadMatch[7].trim().slice(1,-1);
var pos=title.indexOf("|");
if (pos!=-1) { tooltip = title.substr(pos+1,title.length); title=title.substr(0,pos); }
if (title.substr(title.length-2,1)=="=") { key=title.substr(title.length-1,1); title=title.slice(0,-2); }
if (pos==-1) tooltip += " "+title; // default tooltip: "show/hide <title>"
}
// create the button
if (lookaheadMatch[3]) { // use "Hn" header format instead of button/link
var lvl=(lookaheadMatch[3].length>6)?6:lookaheadMatch[3].length;
var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,lookaheadMatch[6],title);
btn.onclick=onClickNestedSlider;
btn.setAttribute("href","javascript:;");
btn.setAttribute("title",tooltip);
}
else
var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,lookaheadMatch[6]);
// set extra button attributes
btn.sliderCookie = cookie; // save the cookiename (if any) in the button object
btn.defOpen=lookaheadMatch[1]!=null; // save default open/closed state (boolean)
btn.keyparam=key; // save the access key letter ("" if none)
if (key.length) {
btn.setAttribute("accessKey",key); // init access key
btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus
}
// "non-click" MouseOver opens/closes slider
if (lookaheadMatch[5]) btn.onmouseover=onClickNestedSlider;
// otherwise, mouseover aligns floater position with button
else btn.onmouseover=function(event)
{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this,this.sliderPanel,this.sliderPanel.className); }
// create slider panel
var panelClass=lookaheadMatch[4]?"floatingPanel":"sliderPanel";
var panel=createTiddlyElement(place,"div",null,panelClass,null);
panel.button = btn; // so the slider panel know which button it belongs to
panel.defaultPanelWidth=(lookaheadMatch[4] && lookaheadMatch[4].length>2)?lookaheadMatch[4].slice(1,-1):""; // save requested panel size
btn.sliderPanel=panel;
panel.style.display = show;
panel.style.width=panel.defaultPanelWidth;
panel.onmouseover=function(event) // mouseover aligns floater position with button
{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this.button,this,this.className); }
// render slider (or defer until shown)
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
if ((show=="block")||!lookaheadMatch[9]) {
// render now if panel is supposed to be shown or NOT deferred rendering
w.subWikify(lookaheadMatch[8]?createTiddlyElement(panel,"blockquote"):panel,this.terminator);
// align floater position with button
if (window.adjustSliderPos) window.adjustSliderPos(place,btn,panel,panelClass);
}
else {
var src = w.source.substr(w.nextMatch);
var endpos=findMatchingDelimiter(src,"+++","===");
panel.setAttribute("raw",src.substr(0,endpos));
panel.setAttribute("blockquote",lookaheadMatch[8]?"true":"false");
panel.setAttribute("rendered","false");
w.nextMatch += endpos+3;
if (w.source.substr(w.nextMatch,1)=="\n") w.nextMatch++;
if (config.options.chkDebugLazySliderDefer) alert("deferred '"+title+"':\n\n"+panel.getAttribute("raw"));
}
}
}
}
)
// TBD: ignore 'quoted' delimiters (e.g., "{{{+++foo===}}}" isn't really a slider)
function findMatchingDelimiter(src,starttext,endtext) {
var startpos = 0;
var endpos = src.indexOf(endtext);
// check for nested delimiters
while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {
// count number of nested 'starts'
var startcount=0;
var temp = src.substring(startpos,endpos-1);
var pos=temp.indexOf(starttext);
while (pos!=-1) { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }
// set up to check for additional 'starts' after adjusting endpos
startpos=endpos+endtext.length;
// find endpos for corresponding number of matching 'ends'
while (startcount && endpos!=-1) {
endpos = src.indexOf(endtext,endpos+endtext.length);
startcount--;
}
}
return (endpos==-1)?src.length:endpos;
}
//}}}
//{{{
window.onClickNestedSlider=function(e)
{
if (!e) var e = window.event;
var theTarget = resolveTarget(e);
var theLabel = theTarget.firstChild.data;
var theSlider = theTarget.sliderPanel
var isOpen = theSlider.style.display!="none";
// if using default button labels, toggle labels
if (theLabel==">") theTarget.firstChild.data = "<";
else if (theLabel=="<") theTarget.firstChild.data = ">";
// if using default tooltips, toggle tooltips
if (theTarget.getAttribute("title")=="show")
theTarget.setAttribute("title","hide");
else if (theTarget.getAttribute("title")=="hide")
theTarget.setAttribute("title","show");
if (theTarget.getAttribute("title")=="show "+theLabel)
theTarget.setAttribute("title","hide "+theLabel);
else if (theTarget.getAttribute("title")=="hide "+theLabel)
theTarget.setAttribute("title","show "+theLabel);
// deferred rendering (if needed)
if (theSlider.getAttribute("rendered")=="false") {
if (config.options.chkDebugLazySliderRender)
alert("rendering '"+theLabel+"':\n\n"+theSlider.getAttribute("raw"));
var place=theSlider;
if (theSlider.getAttribute("blockquote")=="true")
place=createTiddlyElement(place,"blockquote");
wikify(theSlider.getAttribute("raw"),place);
theSlider.setAttribute("rendered","true");
}
// show/hide the slider
if(config.options.chkAnimate && (theSlider.className!='floatingPanel' || config.options.chkFloatingSlidersAnimate))
anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));
else
theSlider.style.display = isOpen ? "none" : "block";
// reset to default width (might have been changed via plugin code)
theSlider.style.width=theSlider.defaultPanelWidth;
// align floater panel position with target button
if (!isOpen && window.adjustSliderPos) window.adjustSliderPos(theSlider.parentNode,theTarget,theSlider,theSlider.className);
// if showing panel, set focus to first 'focus-able' element in panel
if (theSlider.style.display!="none") {
var ctrls=theSlider.getElementsByTagName("*");
for (var c=0; c<ctrls.length; c++) {
var t=ctrls[c].tagName.toLowerCase();
if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")
{ ctrls[c].focus(); break; }
}
}
if (this.sliderCookie && this.sliderCookie.length) {
config.options[this.sliderCookie]=!isOpen;
if (config.options[this.sliderCookie]!=this.defOpen)
saveOptionCookie(this.sliderCookie);
else { // remove cookie if slider is in default display state
var ex=new Date(); ex.setTime(ex.getTime()-1000);
document.cookie = this.sliderCookie+"=novalue; path=/; expires="+ex.toGMTString();
}
}
return false;
}
// TW2.1 and earlier:
// hijack Slider animation handler 'stop' handler so overflow is visible after animation has completed
Slider.prototype.coreStop = Slider.prototype.stop;
Slider.prototype.stop = function()
{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }
// TW2.2+
// hijack Morpher animation handler 'stop' handler so overflow is visible after animation has completed
if (version.major+.1*version.minor+.01*version.revision>=2.2) {
Morpher.prototype.coreStop = Morpher.prototype.stop;
Morpher.prototype.stop = function()
{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }
}
// adjust floating panel position based on button position
if (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel,panelClass) {
if (panelClass=="floatingPanel") {
var left=0;
var top=btn.offsetHeight;
if (place.style.position!="relative") {
var left=findPosX(btn);
var top=findPosY(btn)+btn.offsetHeight;
var p=place; while (p && p.className!='floatingPanel') p=p.parentNode;
if (p) { left-=findPosX(p); top-=findPosY(p); }
}
if (findPosX(btn)+panel.offsetWidth > getWindowWidth()) // adjust position to stay inside right window edge
left-=findPosX(btn)+panel.offsetWidth-getWindowWidth()+15; // add extra 15px 'fudge factor'
panel.style.left=left+"px"; panel.style.top=top+"px";
}
}
function getWindowWidth() {
if(document.width!=undefined)
return document.width; // moz (FF)
if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
return document.documentElement.clientWidth; // IE6
if(document.body && ( document.body.clientWidth || document.body.clientHeight ) )
return document.body.clientWidth; // IE4
if(window.innerWidth!=undefined)
return window.innerWidth; // IE - general
return 0; // unknown
}
//}}}
<!--{{{-->
<div id="header" class='header'>
<div class='gradient' macro='gradient vert #EF9934 #C86719 '>
<div class='titleLine' >
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
</div>
<div id='bodywrapper'>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<div id='contentFooter' refresh='content' tiddler='contentFooter'></div>
</div>
[[1-Introduction]]
[[2-Specifications]]
//{{{
TiddlyWiki.prototype.removeNotification = function(title,fn) {
for (var i=0;i<this.namedNotifications.length;i++)
if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))
this.namedNotifications.splice(i,1);
}
//checks to see if a tiddler exists in store or as a shadow.
TiddlyWiki.prototype.isTiddler= function (title)
{return store.tiddlerExists(title) || store.isShadowTiddler(title)}
// Refresh all tiddlers in the Story
Story.prototype.lewcidrefreshAllTiddlers = function()
{
var place = document.getElementById(this.container);
var e = place.firstChild;
if(!e) return;
this.refreshTiddler(e.getAttribute("tiddler"),null,true);
while((e = e.nextSibling) != null)
this.refreshTiddler(e.getAttribute("tiddler"),null,true);
}
config.presentationPlugin ={
};
config.presentationPlugin.defaults = [
{name: "StyleSheet", notify: refreshStyles},
{name: "PageTemplate", notify: refreshPageTemplate}
];
window.presentationMode='';
function applyPresentationMode (oldMode,Mode)
{
presentationMode = Mode;
var defaults = config.presentationPlugin.defaults;
var oldStyleElement = document.getElementById(oldMode+"StyleSheet");
if (oldStyleElement)
{
oldStyleElement.parentNode.removeChild(oldStyleElement);
}
for (var i=0; i<defaults.length; i++)
{
var def = defaults[i]["name"];
var newMode = store.isTiddler(Mode + def)? Mode + def : def;
store.removeNotification(oldMode + def, defaults[i]["notify"]);
store.addNotification(newMode,defaults[i]["notify"]);
store.notify(newMode); //just one do blanket notify instead?
}
story.lewcidrefreshAllTiddlers();
}
config.macros.author={};
config.macros.author.handler= function (place,macroName,params,wikifier,paramString,tiddler) {
var e = createTiddlyElement(place,"div");
e.setAttribute("refresh","macro");
e.setAttribute("macroName","author");
e.setAttribute("params",paramString);
this.refresh(e,paramString);
}
config.macros.author.refresh = function(place,params){
if (window.lewcideditmode== false)
return false;
removeChildren(place);
var oldMode = window.presentationMode;
var newMode = (oldMode == "Author")?"":"Author";
var label = (oldMode == "Author")? "Presentation Mode":"Author Mode";
var tooltip = label;
createTiddlyButton(place,label,tooltip,function() {
applyPresentationMode(oldMode,newMode);
});
};
Story.prototype.chooseTemplateForTiddler_old_presentation = Story.prototype.chooseTemplateForTiddler;
Story.prototype.chooseTemplateForTiddler = function(title,template)
{
if (!template)
template = DEFAULT_VIEW_TEMPLATE;
var mode = presentationMode;
if (template == DEFAULT_VIEW_TEMPLATE)
{
if (store.isTiddler(mode+"ViewTemplate"))
return mode+"ViewTemplate";
}
else if (template == DEFAULT_EDIT_TEMPLATE)
{
if (store.isTiddler(mode+"EditTemplate"))
return mode+"EditTemplate";
}
return this.chooseTemplateForTiddler_old_presentation(title,template);
}
window.lewcideditmode = false;
config.paramifiers.author = {
onstart: function(v) {
if (v!="true")
return false;
applyPresentationMode("","Author");
window.lewcideditmode = true;
if (config.options.chkSinglePageMode)
config.options.chkSinglePageMode = false;
refreshDisplay();
}
};
//}}}
/***
|''Name:''|SinglePageModePlugin|
|''Source:''|http://www.TiddlyTools.com/#SinglePageModePlugin|
|''Author:''|Eric Shulman - ELS Design Studios|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|''~CoreVersion:''|2.0.10|
Normally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.
!!!!!Usage
<<<
SinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. When SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.
Even when SinglePageMode is disabled (i.e., displaying multiple tiddlers is permitted), you can reduce the potential for confusion by enable TopOfPageMode, which forces tiddlers to always open at the top of the page instead of being displayed following the tiddler containing the link that was clicked.
<<<
!!!!!Configuration
<<<
When installed, this plugin automatically adds checkboxes in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. For convenience, these checkboxes are also included here:
<<option chkSinglePageMode>> Display one tiddler at a time
<<option chkTopOfPageMode>> Always open tiddlers at the top of the page
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)
^^documentation and javascript for SinglePageMode handling^^
When installed, this plugin automatically adds checkboxes in the ''shadow'' AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to ''manually add these checkboxes to your customized tiddler.''
<<<
!!!!!Revision History
<<<
''2006.07.04 [2.2.1]'' in hijack for displayTiddlers(), suspend TPM as well as SPM so that DefaultTiddlers displays in the correct order.
''2006.06.01 [2.2.0]'' added chkTopOfPageMode (TPM) handling
''2006.02.04 [2.1.1]'' moved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals
''2005.12.27 [2.1.0]'' hijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list). Also, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers
''2005.12.27 [2.0.0]'' Update for TW2.0
''2005.11.24 [1.1.2]'' When the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts
''2005.10.14 [1.1.1]'' permalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them
''2005.10.14 [1.1.0]'' added automatic setting of window title and location bar ('auto-permalink'). feature suggestion by David Dickens.
''2005.10.09 [1.0.1]'' combined documentation and code in a single tiddler
''2005.08.15 [1.0.0]'' Initial Release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].
Support for BACK/FORWARD buttons adapted from code developed by Clint Checketts
<<<
!!!!!Code
***/
//{{{
Story.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)
{
var place = document.getElementById(this.container);
var theTiddler = document.getElementById(this.idPrefix + title);
if(theTiddler)
this.refreshTiddler(title,template);
else
{
var before = this.positionTiddler(srcElement);
theTiddler = this.createTiddler(place,before,title,template);
}
if(srcElement && typeof srcElement !== "string")
{
if(anim && config.options.chkAnimate && (animate == undefined || animate == true))
anim.startAnimating(new Cascade(title,srcElement,theTiddler,slowly),new Scroller(theTiddler,slowly));
else
window.scrollTo(0,0);
}
}
version.extensions.SinglePageMode= {major: 2, minor: 2, revision: 1, date: new Date(2006,7,3)};
config.options.chkSinglePageMode=true;
if (config.options.chkSinglePageMode==undefined) config.options.chkSinglePageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkSinglePageMode>> Display one tiddler at a time";
if (config.options.chkTopOfPageMode==undefined) config.options.chkTopOfPageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkTopOfPageMode>> Always open tiddlers at the top of the page";
config.SPMTimer = 0;
config.lastURL = window.location.hash;
function checkLastURL()
{
if (!config.options.chkSinglePageMode)
{ window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }
if (config.lastURL == window.location.hash)
return;
var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));
tiddlerName=tiddlerName.replace(/\[\[/,"").replace(/\]\]/,""); // strip any [[ ]] bracketing
if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);
}
if (Story.prototype.SPM_coreDisplayTiddler==undefined) Story.prototype.SPM_coreDisplayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)
{
if (config.options.chkSinglePageMode) {
window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));
config.lastURL = window.location.hash;
document.title = wikifyPlain("SiteTitle") + " - " + title;
story.closeAllTiddlers();
if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);
}
if (config.options.chkTopOfPageMode) { story.closeTiddler(title); window.scrollTo(0,0); srcElement=null; }
this.SPM_coreDisplayTiddler(srcElement,title,template,animate,slowly)
}
if (Story.prototype.SPM_coreDisplayTiddlers==undefined) Story.prototype.SPM_coreDisplayTiddlers=Story.prototype.displayTiddlers;
Story.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)
{
// suspend single-page mode when displaying multiple tiddlers
var saveSPM=config.options.chkSinglePageMode; config.options.chkSinglePageMode=false;
var saveTPM=config.options.chkTopOfPageMode; config.options.chkTopOfPageMode=false;
this.SPM_coreDisplayTiddlers(srcElement,titles,template,unused1,unused2,animate,slowly);
config.options.chkSinglePageMode=saveSPM; config.options.chkTopOfPageMode=saveTPM;
}
//}}}
/***
Place your custom CSS here
***/
/*{{{*/
[[styleBackStage]]
[[SideBarWG]]
/***
!Top Menu Styles
***/
/*{{{*/
#topMenu br {display:none; }
#topMenu { background: #000 ; color:#fff;padding: 1em 1em;}
/*}}}*/
/***
!General
***/
/*{{{*/
body {
background: #444;
margin: 0 auto;
}
#contentWrapper{
background: #fff;
border: 0;
margin: 0 1em;
padding:0;
}
/*}}}*/
/***
!Header rules
***/
/*{{{*/
.titleLine{
margin: 30px 3em 0em 0em;
margin-left:1.7em;
margin-bottom: 10px;
padding: 0;
text-align: left;
color: #fff;
}
.siteTitle {
font-size: 2em;
font-weight: bold;
}
.siteSubtitle {
font-size: 1.1em;
display: block;
margin: .5em auto 1em;
}
.gradient {margin: 0 auto; border-bottom:1px solid #000;}
.header {
background: #fff;
margin: 0 0em;
padding:0 12px;
}
/*}}}*/
/***
!Display Area
***/
/*{{{*/
#bodywrapper {margin:0 12px; padding:0;background:#fff; height:1%}
#displayArea{
margin: 0em 16em 0em 14em;
text-align: left;
}
.tiddler {
padding: 1em 1em 0em 0em;
}
h1,h2,h3,h4,h5 { color: #000; background: transparent; padding-bottom:2px; border-bottom: 1px dotted #666; }
.title {color:black; font-size:1.8em; border-bottom:1px solid #333; padding-bottom:0.3px;}
.subtitle { font-size:90%; color:#ccc; padding-left:0.25em; margin-top:0.1em; }
.shadow .title {
color: #aaa;
}
.tagClear{
clear: none;
}
* html .viewer pre {
margin-left: 0em;
}
* html .editor textarea, * html .editor input {
width: 98%;
}
.tiddler {margin-bottom:1em; padding-bottom:0em;}
.toolbar .button {color:#bbb; border:none;}
.toolbar .button:hover, .toolbar .highlight, .toolbar .marked, .toolbar a.button:active {background:transparent; color:#111; border:none; text-decoration:underline;}
#sidebar .highlight, #sidebar .marked {background:transparent;}
.tagging, .tagged {
border: 1px solid #eee;
background-color: #F7F7F7;
}
.selected .tagging, .selected .tagged {
background-color: #eee;
border: 1px solid #bbb;
}
.tagging .listTitle, .tagged .listTitle {
color: #bbb;
}
.selected .tagging .listTitle, .selected .tagged .listTitle {
color: #222;
}
.tagging .button:hover, .tagged .button:hover {
border: none; background:transparent; text-decoration:underline; color:#000;
}
.tagging .button, .tagged .button {
color:#aaa;
}
.selected .tagging .button, .selected .tagged .button {
color:#000;
}
.viewer blockquote {
border-left: 3px solid #000;
}
.viewer pre, .viewer code {
border: 1px dashed #ccc;
background: #eee;}
.viewer hr {
border: 0;
border-top: solid 1px #333;
margin: 0 8em;
color: #333;
}
.highlight, .marked {background:transparent; color:#111; border:none; text-decoration:underline;}
.viewer .highlight, .viewer .marked {text-decoration:none;}
#sidebarTabs .highlight, #sidebarTabs .marked {color:#000; text-decoration:none;}
.tabSelected {
color: #000;
background: #fff;
border-top: solid 1px #ccc;
border-left: solid 1px #ccc;
border-right: solid 1px #ccc;
border-bottom: none;
}
.viewer .tabSelected:hover{color:#000;}
.viewer .tabSelected {font-weight:bold;}
.tabUnselected {
color: #999;
background: #eee;
border-top: solid 1px #ccc;
border-left: solid 1px #ccc;
border-right: solid 1px #ccc;
border-bottom: solid 1px #ccc;
padding-bottom:1px;
}
.tabContents {
background: #fff;
color: #000;
}
/*}}}*/
/***
!!!Tables
***/
/*{{{*/
.viewer table {
border: 1px solid #000;
}
.viewer th, thead td {
background: #000;
border: 1px solid #000;
color: #fff;
}
.viewer td, .viewer tr {
border: 1px solid #111; padding:4px;
}
/*}}}*/
/***
!!!Editor area
***/
/*{{{*/
.editor input, .editor textarea {
border: 1px solid #ccc;
}
.editor {padding-top:0.3em;}
.editor textarea:focus, .editor input:focus {
border: 1px solid #333;
}
/*}}}*/
/***
!Sidebar
***/
/*{{{*/
#sidebar{
position:relative;
float:right;
margin-bottom:1em;
display:inline;
width: 16em;
}
#sidebarOptions .sliderPanel {
background: #eee; border:1px solid #ccc;
}
/*}}}*/
/***
!Body Footer rules
***/
/*{{{*/
#contentFooter {
text-align: center;
clear: both;
color:#fff;
background: #000;
padding: 1em 2em;
font-weight:bold;
}
/*}}}*/
/***
!Link Styles
***/
/*{{{*/
a{
color: #000;
}
a:hover{
color: #ED700B;
background:#fff;
}
.button {
color: #000;
border: 1px solid #fff;
}
.button:hover {
color: #fff;
background: #ED700B;
border-color: #000;
}
.button:active {
color: #fff;
background: #ED700B;
border: 1px solid #000;
}
.tiddlyLink {border-bottom: 1px dotted #000;}
.tiddlyLink:hover {border-bottom: 1px dotted #ED700B;}
.titleLine a {border-bottom: 1px dotted #FF9900;}
.titleLine a:hover {border-bottom: 1px dotted #fff;}
.siteTitle a, .siteSubtitle a{
color: #fff;
}
.viewer .button {border: 1px solid #ED700B; font-weight:bold;}
.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ED700B; color:#fff; font-weight:bold; border: 1px solid #000;}
#topMenu .button, #topMenu .tiddlyLink {
margin-left:0.5em; margin-right:0.5em;
padding-left:3px; padding-right:3px;
color:white; font-weight:bold;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover { background:#000; color:#FF8814}
#topMenu a{border:none;}
/*}}}*/
/***
!Message Area /%=================================================%/
***/
/*{{{*/
#messageArea {
border: 4px dotted #ff8614;
background: #000;
color: #fff;
font-size:90%;
}
#messageArea .button {
padding: 0.2em;
color: #000;
background: #fff;
text-decoration:none;
font-weight:bold;
border:1px solid #000;
}
#messageArea a {color:#fff;}
#messageArea a:hover {color:#ff8614; background:transparent;}
#messageArea .button:hover {background: #FF8614; color:#fff; border:1px solid #fff; }
/*}}}*/
/***
!Popup /%=================================================%/
***/
/*{{{*/
.popup {
background: #ff8814;
border: 1px solid #333;
}
.popup hr {
color: #333;
background: #333;
border-bottom: 1px;
}
.popup li.disabled {
color: #333;
}
.popup li a, .popup li a:visited {
color: #eee;
border: none;
}
.popup li a:hover {
background: #ff8614;
color: #fff;
border: none;
text-decoration:underline;
}
.searchBar {float:right; font-size:1em;}
.searchBar .button {display:block; border:none; color:#ccc; }
.searchBar .button:hover{border:none; color:#eee;}
.searchBar input{
border: 1px inset #000; background:#EFDFD1; width:10em; margin:0;
}
.searchBar input:focus {
border: 1px inset #000; background:#fff;
}
*html .titleLine {margin-right:1.3em;}
*html .searchBar .button {margin-left:1.7em;}
.HideSideBarButton {float:right;}
/*}}}*/
.blog h2, .blog h3, .blog h4{
margin:0;
padding:0;
border-bottom:none;
}
.blog {margin-left:1.5em;}
.blog .excerpt {
margin:0;
margin-top:0.3em;
padding: 0;
margin-left:1em;
padding-left:1em;
font-size:90%;
border-left:1px solid #ddd;
}
#tiddlerWhatsNew h1, #tiddlerWhatsNew h2 {border-bottom:none;}
div[tags~="RecentUpdates"], div[tags~="lewcidExtension"] {margin-bottom: 2em;}
#hoverMenu .button, #hoverMenu .tiddlyLink {border:none; font-weight:bold; background:#f37211; color:#fff; padding:0 5px; float:right; margin-bottom:4px;}
#hoverMenu .button:hover, #hoverMenu .tiddlyLink:hover {font-weight:bold; border:none; color:#f37211; background:#000; padding:0 5px; float:right; margin-bottom:4px;}
#topMenu .fontResizer {float:right;}
#topMenu .fontResizer .button{border:1px solid #000;}
#topMenu .fontResizer .button:hover {border:1px solid #f37211; color:#fff;}
#sidebarTabs .txtMainTab .tiddlyLinkExisting {
font-weight: normal;
font-style: normal;
}
#sidebarTabs .txtMoreTab .tiddlyLinkExisting {
font-weight: bold;
font-style: normal;
}
#displayArea {margin-right:1em;}
.headerShadow {
position: relative;
padding: 2.5em 0em 1em 1em;
left: -1px;
top: -1px;
}
.headerForeground {
position: absolute;
padding: 2.5em 0em 1em 1em;
left: 0px;
top: 0px;
}
.siteTitle {
font-size: 2.5em;
}
.siteSubtitle {
font-size: 1.2em;
}
#mainMenu {float:left; position:relative;}
.viewer .button {border: 1px solid #ED700B; font-weight:bold;}
.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ED700B; color:#fff; font-weight:bold; border: 1px solid #ED700B;}
[[StyleSheetCommon]]
#contentFooter .tiddlyLink {
color:#fff;
}
/*}}}*/
.centre {text-align:center; margin:0;}
.centre img {margin:0 auto;}
.title, h1 {font-size: 1.6em; font-weight:bold; background:transparent; margin-top:0;margin-bottom:0; color:#000;}
h2 {font-size: 1.45em; font-weight:bold; background:transparent; margin-top:0;margin-bottom:0; color:#000;}
#mainMenu {width:14em;}
#displayArea {margin-left:18em;}
.left {float:left; margin-right:1em;}
.bold {font-weight:bold;}
.topbutton button, .topbutton{float:right;}
.note{
position:relative; /*this is the key*/
z-index:24; background:#ccc;
color:#000;
text-decoration:none}
.note:hover, .noteover{z-index:25; background-color:#FFB865;cursor:help;}
.note span{display: none;}
.note:hover span, .noteover span{ /*the span will display just on :hover state*/
display:block;
position:absolute;
top:2em; left:2em; width:15em;
border:1px solid #000;
background-color:#FFB35A; color:#000;
padding:0.5em;}
.info{
position:relative; /*this is the key*/
z-index:24; background:#ccc;
color:#000;
text-decoration:none}
.info:hover, .infoover{z-index:25; background-color:#FFB865;cursor:help;}
.info span{display: none}
.info:hover span, .infoover span{ /*the span will display just on :hover state*/
display:block;
position:absolute;
top:2em; left:2em; width:15em;
border:1px solid #000;
background-color:#FFB35A; color:#000;
padding:0.5em;}
.bold {font-weight: bold !important;}
!Summary
Lorem Ipsum
!!Sections
<<lister slides>>
To view the details of the sections select the link below or in the left-hand menu.
[[Details|1-Introduction]]
----
<<tiddler CommentScript>>
/%comment%/
Create the tiddler title in the form: [number]-[title]
!Title
Lorem ipsum.
Create the tiddler title in the form: [number]-[title]
!Title
Lorem ipsum.
----
<<tiddler CommentScript with: reverse>>
/%comment%/
Tiddler.prototype.getSubtitle = function()
{
return(this.title);
}
config.macros.top={};
config.macros.top.handler=function(place,macroName)
{
createTiddlyButton(place,"^","jump to top",this.onclick);
}
config.macros.top.onclick=function()
{
window.scrollTo(0,0);
};
<!--{{{-->
<div class='viewer' macro='view text wikified'></div>
<div class='viewer topbutton' macro='top'></div>
<br><br>
<div class='viewer' macro='navigation tiddlers:{{store.getTiddlerText("PresentationIndex").readBracketedList()}}}'></div>
<div class='tagClear'></div>
<!--}}}-->
/***
===============================================================================
Author : Dawn Ahukanna
Version : $Id$
===============================================================================
----
''Name:'' _GetPluginInfo
''Version:'' <<getPlugin _GetPluginInfo>>
''Date:'' <<getPlugin _GetPluginInfo date>>
''Author:'' <<getPlugin _GetPluginInfo author>>
''Source:'' <<getPlugin _GetPluginInfo code>>
''Documentation:'' <<getPlugin _GetPluginInfo doc>>
''License:'' <<getPlugin _GetPluginInfo license>>
''Browsers:'' <<getPlugin _GetPluginInfo browsers>>
''~CoreVersion:'' <<getPlugin _GetPluginInfo coreVersion>>
''Dependencies:'' <<getPlugin _GetPluginInfo dependencies>>
''Summary:'' <<getPlugin _GetPluginInfo summary>>
''Description:'' <<getPlugin _GetPluginInfo description>>
----
!Dependencies
<<<
<<getPlugin _GetPluginInfo dependencies>>
|Dependency |Author |Type |Version |Code URL |Comments |h
|[[.TwHelperLib]] |DawnAhukanna |Lib |<<getPlugin _TwHelperLib version>> |<<getPlugin _TwHelperLib code>> |<<getPlugin _TwHelperLib description>> |
<<<
!Usage
<<<
<<getPlugin _GetPluginInfo description>>
<<<
!Installation
<<<
Import (or copy/paste) the following tiddler into your document:
''_GetPluginInfo'' (tagged with <<tag systemConfig>>)
<<<
!Configuration
<<<
''Syntax''
{{{
<<getPlugin [pluginName] [attribute]>>
}}}
Where ''[attribute]'' is the name of a plugin attribute. If none or an incorrect attribute is supplied, the ''version'' attribute is returned by default. The following are valid attributes:
|Plugin attribute name |Description |h
|''version'' |Version of plugin and also default attribute. |
|''author'' |Author's name (in camel case) of plugin. |
|''date'' |Release date of plugin. |
|''code'' |URL for plugin code. |
|''doc'' |URL for plugin documentation. |
|''summary'' |Short description of plugin functionality. |
|''description'' |Long description of plugin functionality. |
|''coreVersion'' |TiddlyWiki version required. Interacts with plugin manager for dependencies. |
|''license'' |License for plugin code. |
|''browsers'' |Supported browsers for the plugin. |
|''dependencies'' |Other plugins or libraries that the plugin requires. |
|''name'' |Name of plugin. |
!!Examples
|Code |Result |h
|{{{<<getPlugin _GetPluginInfo>>}}} |<<getPlugin _GetPluginInfo>>|
|{{{<<getPlugin _GetPluginInfo code>>}}} |<<getPlugin _GetPluginInfo code>> |
|{{{<<getPlugin _GetPluginInfo doc>>}}} |<<getPlugin _GetPluginInfo doc>> |
|{{{<<getPlugin _GetPluginInfo date>>}}} |<<getPlugin _GetPluginInfo date>> |
|{{{<<getPlugin _GetPluginInfo author>>}}} |<<getPlugin _GetPluginInfo author>> |
|{{{<<getPlugin _GetPluginInfo version>>}}} |<<getPlugin _GetPluginInfo version>> |
|{{{<<getPlugin _GetPluginInfo summary>>}}} |<<getPlugin _GetPluginInfo summary>> |
|{{{<<getPlugin _GetPluginInfo description>>}}} |<<getPlugin _GetPluginInfo description>> |
|{{{<<getPlugin _GetPluginInfo coreVersion>>}}} |<<getPlugin _GetPluginInfo coreVersion>> |
|{{{<<getPlugin _GetPluginInfo license>>}}} |<<getPlugin _GetPluginInfo license>> |
|{{{<<getPlugin _GetPluginInfo browsers>>}}} |<<getPlugin _GetPluginInfo browsers>> |
|{{{<<getPlugin _GetPluginInfo dependencies>>}}} |<<getPlugin _GetPluginInfo dependencies>> |
|{{{<<getPlugin _GetPluginInfo name>>}}} |<<getPlugin _GetPluginInfo name>> |
<<<
!Revision History
<<<
|Release |Date |Comments|h
|2.2.0 |27 May 2007 |Updated and tested with version 2.2.0. Added ''license'', ''browsers'', ''dependencies'' and ''name'' attributes. Also uses the TwHelper object.|
|2.1.0 |2 Jan 2007 |Updated and tested with version 2.1.3. Added ''code'', ''doc'', ''summary'', ''description'' and ''coreVersion'' attributes. Refactored the switch statment to use one code block for multiple cases.|
|1.0.1 |12 Mar 2006 |Refactored the code to have one macro with multiple parameters. |
|1.0.0 |12 Mar 2006 |Initial release |
<<<
!Known Issues
<<<
This line of js code does not work -
{{{
date: new Date(2007,1,2)
}}}
, had to use this instead -
{{{
date: new Date("Jan 2, 2007")
}}}
<<<
!To Do
<<<
#Sort out Javascript date issue. Update all dependent macros to use new date format.
#Create wikified urls for code and doc attributes.
<<<
!Credits
<<<
This extension was produced by DawnAhukanna.
<<<
----
!Code
***/
//{{{
var pluginName="_GetPluginInfo"; //Plugin name.
var coreVersion="2.2.0"; //Tiddlywiki version.
if(!version.extensions._GetPluginInfo)
{ //Ensure that is only installed once.
version.extensions._GetPluginInfo=
{
major: 2,
minor: 2,
revision: 0,
date: new Date("May 27, 2007"),
code: "http://project.dahukanna.net/tiddlywiki/twextensions.htm#_GetPluginInfo",
doc: "http://project.dahukanna.net/tiddlywiki/twextensions.htm#_GetPluginInfoDoc",
author: "DawnAhukanna dawn[at]dahukanna[dot]net",
coreVersion: coreVersion,
dependencies: "[[.TwHelperLib]]",
license: "[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]",
browsers: "InternetExplorer 6.0, InternetExplorer 7.0, FireFox 1.5.x, FireFox 2.0.x",
summary: "[["+ pluginName + "]] for TiddlyWiki version "+coreVersion+" or above.",
description: "Displays the ''version.extensions.[pluginName]'' plugin attributes. Currently all plugins in this collection have the following attributes: \n 1. version \n 2. date \n 3. source code \n 4. author \n 5. doc \n 6. summary \n 7. description \n 8. license \n 9. browsers \n 10. dependencies \n 11. coreVersion \n 12. name \n 13. installed \n All other plugins use this macro to display plugin details.",
name: pluginName,
installed: true
}
if(version.major < 2 && version.minor < 2)
TwHelper.alertAndThrow(version.extensions[pluginName].summary);
if(!version.extensions._TwHelperLib)
alertAndThrow(wikify(pluginName +' requires '+version.extensions[pluginName].dependencies+'. Please import '+version.extensions[pluginName].dependencies+'.'));
config.macros.getPlugin = {dateFormat: "DD MMM YYYY"}
config.macros.getPlugin.handler = function(place,macroName,params)
{
var pluginName = params[0]; //params[0]: pluginName (string) that matches with version.extensions.[pluginName] declaration.
var pluginAttributeName = params[1]; //params[1]: Plugin info to retrieve e.g "date". If not supplied then "version" is supplied by default.
var pluginAttribute="";
switch (pluginAttributeName)
{
case "author" :
case "code" :
case "doc" :
case "summary" :
case "description" :
case "license" :
case "browsers" :
case "dependencies" :
case "name" :
pluginAttribute = version.extensions[pluginName][pluginAttributeName];
TwHelper.wikify(pluginAttribute,place);
break;
case "date" :
pluginAttribute = version.extensions[pluginName][pluginAttributeName].formatString(this.dateFormat);
case "coreVersion" :
if(pluginAttribute == "")
{
pluginAttribute = version.extensions[pluginName][pluginAttributeName];
}
TwHelper.createTiddlyElement(place,"span",null,null,pluginAttribute);
break;
default ://Display plugin version attribute
pluginAttribute = version.extensions[pluginName].major + "." + version.extensions[pluginName].minor + "." + version.extensions[pluginName].revision;
TwHelper.createTiddlyElement(place,"span",null,null,pluginAttribute);
break;
}
}
}//Load once.
//}}}
//----
/***
===============================================================================
Author : Dawn Ahukanna
Version : $Id$
===============================================================================
----
''Name:'' _ListMacroExtension
''Version:'' <<getPlugin _ListMacroExtension>>
''Date:'' <<getPlugin _ListMacroExtension date>>
''Author:'' <<getPlugin _ListMacroExtension author>>
''Source:'' <<getPlugin _ListMacroExtension code>>
''Documentation:'' <<getPlugin _ListMacroExtension doc>>
''License:'' <<getPlugin _ListMacroExtension license>>
''Browsers:'' <<getPlugin _ListMacroExtension browsers>>
''~CoreVersion:'' <<getPlugin _ListMacroExtension coreVersion>>
''Dependencies:'' <<getPlugin _ListMacroExtension dependencies>>
''Summary:'' <<getPlugin _ListMacroExtension summary>>
''Description:'' <<getPlugin _ListMacroExtension description>>
----
!Dependencies
<<<
<<getPlugin _ListMacroExtension dependencies>>
|Dependency |Author |Type |Version |Code URL |Comments |h
|[[.TwHelperLib]] |DawnAhukanna |Lib |<<getPlugin _TwHelperLib version>> |<<getPlugin _TwHelperLib code>> |<<getPlugin _TwHelperLib description>> |
|[[_GetPluginInfo]] |DawnAhukanna |Macro |<<getPlugin _GetPluginInfo version>> |<<getPlugin _GetPluginInfo code>> |<<getPlugin _GetPluginInfo description>> |
<<<
!Usage
<<<
<<getPlugin _GetPluginInfo description>>
<<<
!Installation
<<<
Import (or copy/paste) the following tiddler into your document:
''_ListMacroExtension'' (tagged with <<tag systemConfig>>)
<<<
!Configuration
<<<
''Syntax''
{{{
<<list tagged [existingTag] [sortField]>>
<<list tagged [config.options.txtListEmpty]>> or <<list tagged "">> or <<list tagged null>> or <<list tagged none>>
<<list whatsNew [existingTag] [sortField]>>
<<list whatsNew [itemList] [existingTag] [sortField]>>
}}}
Where ''[existingTag]'' is the name of an existing tag present and being used in your TiddlyWiki.
Where ''[sortField]'' is the name of a tiddler attribute. If none or incorrect attribute supplied, ''title'' is used as the default.
*title
*text
*modifier
*modified
*created
*links
*tags
Where ''[config.options.txtListEmpty]'' is the keyword for creating a list with no tags set in [[listExtensionOptions]].
Where ''[itemList]'' is the maximum number of items for the list but it must be less than ''config.optionstxtListWhatsNewItems'' set in [[listExtensionOptions]].
!!Examples :
Creates a list of tiddlers tagged by [tag], using supplied [sort field] or ''title'' tiddler field (which is the default case) to sort tiddler list result.
|{{{<<list tagged systemConfig>>}}} |<<list tagged systemConfig>> |[sub-macro name] [tag] |
|{{{<<list tagged systemConfig modified>>}}} |<<list tagged systemConfig modified>> |[sub-macro name] [tag] [sort field] |
Creates a list of tiddlers with no tags. The keyword used is ''\"\"'', ''null'', ''none'' or can be set by ''config.options.txtListEmpty'' in [[listExtensionOptions]].
|{{{<<list tagged "">>}}} |<<list tagged "">> |[sub-macro name] "" |
|{{{<<list tagged null>>}}} |<<list tagged null>> |[sub-macro name] null |
|{{{<<list tagged none>>}}} |<<list tagged none>> |[sub-macro name] none |
|{{{<<list tagged [config.options.txtListEmpty]>>}}} |<<list tagged null>> |[sub-macro name] [config.options.txtListEmpty] |
Creates a list of latest tiddlers modified in the last x days, tagged by [tag] using supplied [sort field] or ''modified'' tiddler field (which is the default case) to sort tiddler list result. ( x = config.options.txtListWhatsNewDays set in [[listExtensionOptions]]).
|{{{<<list whatsNew>>>}}} |<<list whatsNew>> |[sub-macro name] |
|{{{<<list whatsNew systemConfig>>}}} |<<list whatsNew systemConfig>> |[sub-macro name] [tag] |
|{{{<<list whatsNew systemConfig title>>}}} |<<list whatsNew systemConfig title>> |[sub-macro name] [tag] [sort field] |
Creates a list of the latest tiddlers the size of [number of items] modified in the last x days, tagged by [tag] using supplied [sort field] or ''modified'' tiddler field (which is the default case) to sort tiddler list result. ( x = config.options.txtListWhatsNewDays and [number of items] must be less than ''config.options.txtListWhatsNewItems'' both set in [[listExtensionOptions]]).
|{{{<<list whatsNew 5>>>}}} |<<list whatsNew 5>> |[sub-macro name] [number of items] |
|{{{<<list whatsNew 5 systemConfig>>>}}} |<<list whatsNew 5 systemConfig>> |[sub-macro name] [number of items] [tag] |
|{{{<<list whatsNew 5 systemConfig title>>>}}} |<<list whatsNew 5 systemConfig title>> |[sub-macro name] [number of items] [tag] [sort field] |
|{{{<<list whatsNew 10 systemConfig>>>}}} |<<list whatsNew 10 systemConfig>> |[sub-macro name] [number of items] [tag] |
<<<
!Revision History
<<<
|Release |Date |Description |h
|2.2.0 |27 May 2007 |Updated and tested with version 2.2.0. Also uses the TwHelper object. |
|2.1.0 |2 Jan 2007 |Updated and tested with version 2.1.3. |
|1.0.2 |3 Mar 2006 |Added sortField as a parameter. |
|1.0.1 |3 Mar 2006 |Fixed alphabetical listing by adding sort field to getTaggedTiddlers() and removing the tagged.sort() call. |
|1.0.0 |26 Jan 2006 |Tested with TW 2.0.4 |
<<<
!Known Issues
<<<
None.
<<<
!To Do
<<<
Sort out List title using the "prompt" attribute.
<<<
!Credits
<<<
This extension was produced by DawnAhukanna.
<<<
----
!Code
{{{
***/
var pluginName="_ListMacroExtension"; //Plugin name.
var coreVersion="2.2.0"; //Tiddlywiki version.
if(!version.extensions._ListMacroExtension)
{ //Ensure that is only installed once.
version.extensions._ListMacroExtension=
{
major: 2,
minor: 2,
revision: 0,
date: new Date("May 27, 2007"),
code: "http://project.dahukanna.net/tiddlywiki/twextensions.htm#_ListMacroExtension",
doc: "http://project.dahukanna.net/tiddlywiki/twextensions.htm#_ListMacroExtensionDoc",
author: "DawnAhukanna dawn[at]dahukanna[dot]net",
coreVersion: coreVersion,
dependencies: "[[.TwHelperLib]], [[_GetPluginInfo]] ",
license: "[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]",
browsers: "InternetExplorer 6.0, InternetExplorer 7.0, FireFox 1.5.x, FireFox 2.0.x",
summary: "[["+ pluginName + "]] for TiddlyWiki version "+coreVersion+" or above.",
description: "Creates a bulleted list of tiddlers, optionally sorted by a tiddler field (default config.options.txtListSort). Creates a tiddler list using the following options: \n 1.Using a tag - {{{<<list tagged ''[tag]'' ''[sortfield]''>>}}}. For tiddlers that have no tags use the words ''null'' or ''none'' or ''\"\"'' or the word defined by ''config.options.txtListEmpty'' - {{{<<list tagged null>>}}}.\n 2. From the last x days - {{{<<list whatsNew ''[tag]'' ''[sortfield]''>>}}}, x is defined by ''config.options.txtListWhatsNewDays''. \n 3. From the lastest items - {{{<<list whatsNew ''[noOfItems]'' ''[sortfield]''>>}}}. \n 4. From the lastest tagged items - {{{<<list whatsNew ''[noOfItems]'' ''[tag]'' ''[sortfield]''>>}}}. \n \n Static class \n ''~TwListHelper'' \n whatsNewLatestItems: function(items, tag, sortField) \n whatsNewTagged: function(tag, sortField) \n",
name: pluginName,
installed: true
}
if(version.major < 2 && version.minor < 2)
alertAndThrow(version.extensions[pluginName].summary);
if(!version.extensions._TwHelperLib)
alertAndThrow(wikify(pluginName +' requires '+version.extensions[pluginName].dependencies+'. Please import '+version.extensions[pluginName].dependencies+'.'));
merge(config.options, //Options.
{
txtListEmpty:"null",
txtListSort:"title",
txtListWhatsNewDays:7,
txtListWhatsNewItems:10,
txtListWhatsNewDefine:"modified"
}
);
merge(config.optionsDesc, //Options descriptions.
{
txtListEmpty:"Keyword for retrieving tiddlers with no tags. Can also use 'none'.",
txtListSort:"Tiddler field for ordering the resulting tiddlers.",
txtListWhatsNewDays:"Get latest tiddlers from last x days, where x=config.options.txtListWhatsNewDays.",
txtListWhatsNewItems:"Get latest x tiddlers, where x=config.options.txtListWhatsNewItems.",
txtListWhatsNewDefine:"Tiddler date field used for extracting tiddlers from the store. Can also use 'created'."
}
);
merge(config.shadowTiddlers, //Set options shadow Tiddler.
{
listExtensionOptions:"<<option txtListEmpty>> Word for retrieving tiddlers with no tags.\n <<option txtListSort>> Tiddler field for ordering the resulting tiddlers.\n <<option txtListWhatsNewDays>> Get latest tiddlers from last x days, where x=config.options.txtListWhatsNewDays.\n <<option txtListWhatsNewItems>> Get latest x tiddlers, where x=config.options.txtListWhatsNewItems.\n <<option txtListWhatsNewDefine>> Tiddler date field used for extracting tiddlers from the store. Can also use 'created'.\n"
}
);
merge(config.annotations, //Options shadow Tiddler descriptions.
{
listExtensionOptions:"Configuratioin options for _ListMacroExtension Plugin"
}
);
//Macro
config.macros.lister={prompt: ""};
config.macros.lister.handler=function(place,macroName,params)
{
/*
params[0]: tag used to retrieve tiddlers (String).
params[1]: sortField for ording resulting tiddlers (String) e.g "title". If not supplied then ''config.options.txtListSort'' is used by default.
*/
/*DNA:Debug- TwDebug.params("list-"+params[0], params);*/
var tag=params[0];
var sortField=params[1]||config.options.txtListSort; //Default sort field.
var tids;
switch (sortField)
{
case "modified":
case "created":
// Create list in descending order.
tids=TwHelper.getTiddlersByTag(tag,sortField,true);
break;
default:
tids=TwHelper.getTiddlersByTag(tag,sortField,false);
break;
}
if (tids)
{
var theList=TwHelper.createTiddlyElement(place,"ul");
//var theList=createTiddlyElement(place,"ul");
for (i=0; i<tids.length; i++)
{
TwHelper.createTiddlyElement(theList,"li",null,"listTitle",tids[i].title);
TwHelper.createTiddlyText(theList," ");
}
}
}
//Macro
config.macros.list["tagged"]={prompt: ""};
config.macros.list.tagged.handler=function(params)
{
/*
params[0]: list sub-macro name (String).
params[1]: tag used to retrieve tiddlers (String).
params[2]: sortField for ording resulting tiddlers (String) e.g "title". If not supplied then ''config.options.txtListSort'' is used by default.
*/
/*DNA:Debug- TwDebug.params("list-"+params[0], params);*/
var tag=params[1];
var sortField=params[2]||config.options.txtListSort; //Default sort field.
//Prompt is displayed in the next call, URGH!!!!
//this.prompt="Tagged with "+ params[1];
var tids;
switch (sortField)
{
case "modified":
case "created":
// Create list in descending order.
tids=TwHelper.getTiddlersByTag(tag,sortField,true);
break;
default:
tids=TwHelper.getTiddlersByTag(tag,sortField,false);
break;
}
return tids;
}
//Macro
config.macros.list["whatsNew"]={prompt: ""};
config.macros.list.whatsNew.handler=function(params)
{
/*
params[0]: list sub-macro name (String)
params[1]: tag used to retrieve tiddlers (String)
params[2]: sortField for ording resulting tiddlers (String) e.g "title". If not supplied then ''config.options.txtListSort'' is used by default.
*/
/*
params[0]: list sub-macro name (String)
params[1]: number of latest items (Integer)
params[2]: tag used to retrieve tiddlers (String)
params[3]: sortField for ording resulting tiddlers (String) e.g "title". If not supplied then ''config.options.txtListSort'' is used by default.
*/
/*DNA:Debug- TwDebug.params("list-"+params[0], params);*/
var results;
//DNA: Test if it's a string or number.
if (params[1] > 0)
{
var sortField=params[3]||config.options.txtListSort; //Default sort field.
results=TwListHelper.whatsNewLatestItems(params[1], params[2], sortField);
}
else
{
var sortField=params[2]||config.options.txtListSort; //Default sort field.
results=TwListHelper.whatsNewTagged(params[1], sortField);
}
return results;
}
/***
}}}
!TwListHelper static class.
{{{
***/
//Helper functions.
var TwListHelper=
{
whatsNewLatestItems: function(items, tag, sortField)
{
var result=[];
var limit=items||config.options.txtListWhatsNewItems; //Number of items to return.
var sortBy=sortField||config.options.txtListSort; //Default sort field.
var tids;
if (tag)
{
tids=TwHelper.getTiddlersByTag(tag,config.options.txtListWhatsNewDefine,true);
}
else
{
tids=TwHelper.getTiddlers(config.options.txtListWhatsNewDefine,true);
}
if (limit>tids.length) limit=tids.length;
for (i=0; i<limit; i++)
{
result.push(tids[i]);
}
//DNA-TODO: Order with sortBy.
return TwHelper.sortTiddlers(result,sortBy);
},
whatsNewTagged: function(tag, sortField)
{
//Use a date field?
//DNA:TODO-check that field is a date type, otherwise use "modified".
var tids;
var result=[];
var now=new Date();
var sortBy=sortField||config.options.txtListSort; //Default sort field.
var timeLimit=1000*60*60*24*config.options.txtListWhatsNewDays; //Days converted to milliseconds.
if (tag)
{
tids=TwHelper.getTiddlersByTag(tag,config.options.txtListWhatsNewDefine,true);
}
else
{
tids=TwHelper.getTiddlers(config.options.txtListWhatsNewDefine,true);
}
/*DNA:Debug- TwDebug.length("whatsNewTagged-tids", tids);*/
for (i=0; i<tids.length; i++)
{
if (now-tids[i].modified>timeLimit)
{
break;
}
else
{
result.push(tids[i]);
}
}
/*DNA:Debug- TwDebug.length("result", result);*/
//DNA-TODO: Order with sortBy.
return TwHelper.sortTiddlers(result,sortBy);
}
}
}
/***
}}}
***/
Uses TiddlyWiki <<version>> with
# [[Saq's|http://tw.lewcid.org/]] Presentation plugin V1.0
# [[Eric's|http://www.tiddlytools.com/]] CommentScript V1.0.1.
# [[Dawn's|http://project.dahukanna.net/tiddlywiki/twextensions.htm]] [[_ListMacroExtension]] V2.2.0
!!To set up the slides/pages/sections/items
# Set up DefaultTiddlers to display the first tiddler on opening the document.
# Set up MainMenu to display a menu on the left handside of the page.
# Set Slide tiddlers (using TemplateSlide or TemplateSlideWithComment) and tag them <<tag slides>>. This document already has the [[1-Introduction]] tiddler created to make it easy.
# Set up slide deck in PresentationIndex by listing in order the tiddlers created in the step above.
developed and documented by Dawn Ahukanna using TiddlyWiki <<version>>
/* Disable backstage button */
#backstageButton {display:none !important;}
//Ensure this is run last by prefixing with ''z''. This can then override plugin settings etc.
//''Code''
//{{{
/*
==============================================================================
Set core objects. Should be the same for every TiddlyWiki (configuration).
==============================================================================
*/
//=== Set configuration options.
//General
config.options.chkAutoSave=true;
config.options.chkHttpReadOnly=true;
config.numRssItems=50;
config.options.chkGenerateAnRssFeed=false;
config.options.txtBackupFolder= "zbackup";
//Presentaion
config.options.chkAnimate=false;
config.options.chkSinglePageMode=true;
config.options.chkTopOfPageMode = false;
//}}}
//Ensure this is run last by prefixing with ''zextension''. This can then override plugin, [[configuration|zconfiguration]], [[customisation|zcustomisation]] and [[extension|zextension]] settings etc.
//''Code''
//{{{
/*
==============================================================================
Create new objects for Tabs extension.
==============================================================================
*/
//=== New Shadow Tiddlers for Slide Tiddlers Tab.
config.shadowTiddlers.tabSlides="<<list tagged slides>>";
/*
==============================================================================
Modify core objects for Tabs extension.
==============================================================================
*/
//=== Set Slide Tiddlers Tab in the SideBarTabs shadow Tiddler.
config.shadowTiddlers.SideBarTabs='<<tabs txtMainTab "Slides" "Slides" [[tabSlides]] "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>';
//}}}