Skip to content

Instantly share code, notes, and snippets.

@psd
Created March 24, 2010 09:37
Show Gist options
  • Save psd/342126 to your computer and use it in GitHub Desktop.
Save psd/342126 to your computer and use it in GitHub Desktop.
myOpenBritain
set -xe
server="http://openbritain.labs.osmosoft.com/"
for bag in team4_public tim
do
curl $server/bags/$bag/tiddlers.txt | while read tiddler
do
curl -s "$server/bags/$bag/tiddlers/${tiddler}.txt" > "$bag/${tiddler}.tid"
done
done
modifier: None
created: 20100329150536
modified: 20100329150536
type: text/javascript
tags:
//javascript:(function(){var uri="http://openbritain.labs.osmosoft.com/bags/team4_public/tiddlers/bookmarklet.js";var el=document.createElement("script");el.type="text/javascript";el.src=uri;document.getElementsByTagName("head")[0].appendChild(el);})();
(function() {
var HOST = "http://openbritain.labs.osmosoft.com";
var BAG = "tim"; // XXX: hardcoded
var $;
var jquery_uri = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
var jsonlib_uri = HOST + "/bags/team4_public/tiddlers/jquery-json.js";
var chrjs_uri = HOST + "/bags/team4_public/tiddlers/chrjs.js";
var main = function() {
loadScript(jquery_uri, function() {
jQuery.noConflict(); // XXX: useless at this point?
$ = jQuery;
loadScript(jsonlib_uri, function() {
loadScript(chrjs_uri, createUI);
});
});
};
var createUI = function() { // TODO: valid HTML
var selection = getSelection ? getSelection().toString() :
document.selection.createRange().htmlText;
var form = $('<form action="" method="GET" />');
$('<input type="text" name="title" />').val(document.title).appendTo(form);
$('<textarea name="text" />').text(selection || "...").appendTo(form);
$('<input type="text" name="tags" />').val("web snippet").appendTo(form);
$('<input type="submit" value="Save" />').appendTo(form);
form.appendTo(document.body);
};
var onClick = function(ev) {
var form = $(this).closest("form");
var title = form.find("[name=title]").val();
var tiddler = new TiddlyWeb.Tiddler(title);
tiddler.bag = new TiddlyWeb.Bag(BAG, HOST);
tiddler.tags = form.find("[name=tags]").val().split(" "); // TODO: CSV?
tiddler.text = form.find("[name=text]").text();
//tiddler.put(onSuccess, onError);
form.attr("action", "http://whatfettle.com/2010/03/TiddlySpace/note.cgi?title=" + title + "&tags=" + tiddler.tags + "&text=" + tiddler.text);
};
var onSuccess = function(resource, status, xhr) {
alert("success"); // TODO
};
var onError = function(xhr, error, exc) {
alert("failure"); // TODO
};
var loadScript = function(src, callback) {
var complete = false;
var el = document.createElement("script");
el.setAttribute("type", "text/javascript");
el.setAttribute("src", src);
if(callback) {
el.onload = el.onreadystatechange = function() {
var status = this.readyState;
if(!complete && (!status || status == "loaded" || status == "complete")) {
complete = true;
callback();
}
};
}
document.getElementsByTagName("head")[0].appendChild(el);
};
main();
})();
404 Not Found: (u"Brentwood Toilets not found, no tiddler for Brentwood Toilets: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/tim/tiddlers/Brentwood%20Toilets'",)
modifier: Tim
created: 20100324152615
modified: 20100324152615
type: None
tags: MediaPackage TaskPackage systemConfig InputPackage
/***
|Name|CheckboxPlugin|
|Source|http://www.TiddlyTools.com/#CheckboxPlugin|
|Documentation|http://www.TiddlyTools.com/#CheckboxPluginInfo|
|Version|2.4.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|Add checkboxes to your tiddler content|
This plugin extends the TiddlyWiki syntax to allow definition of checkboxes that can be embedded directly in tiddler content. Checkbox states are preserved by:
* by setting/removing tags on specified tiddlers,
* or, by setting custom field values on specified tiddlers,
* or, by saving to a locally-stored cookie ID,
* or, automatically modifying the tiddler content (deprecated)
When an ID is assigned to the checkbox, it enables direct programmatic access to the checkbox DOM element, as well as creating an entry in TiddlyWiki's config.options[ID] internal data. In addition to tracking the checkbox state, you can also specify custom javascript for programmatic initialization and onClick event handling for any checkbox, so you can provide specialized side-effects in response to state changes.
!!!!!Documentation
>see [[CheckboxPluginInfo]]
!!!!!Revisions
<<<
2008.01.08 [*.*.*] plugin size reduction: documentation moved to [[CheckboxPluginInfo]]
2008.01.05 [2.4.0] set global "window.place" to current checkbox element when processing checkbox clicks. This allows init/beforeClick/afterClick handlers to reference RELATIVE elements, including using "story.findContainingTiddler(place)". Also, wrap handlers in "function()" so "return" can be used within handler code.
|please see [[CheckboxPluginInfo]] for additional revision details|
2005.12.07 [0.9.0] initial BETA release
<<<
!!!!!Code
***/
//{{{
version.extensions.CheckboxPlugin = {major: 2, minor: 4, revision:0 , date: new Date(2008,1,5)};
//}}}
//{{{
config.checkbox = { refresh: { tagged:true, tagging:true, container:true } };
config.formatters.push( {
name: "checkbox",
match: "\\[[xX_ ][\\]\\=\\(\\{]",
lookahead: "\\[([xX_ ])(=[^\\s\\(\\]{]+)?(\\([^\\)]*\\))?({[^}]*})?({[^}]*})?({[^}]*})?\\]",
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) {
// get params
var checked=(lookaheadMatch[1].toUpperCase()=="X");
var id=lookaheadMatch[2];
var target=lookaheadMatch[3];
if (target) target=target.substr(1,target.length-2).trim(); // trim off parentheses
var fn_init=lookaheadMatch[4];
var fn_clickBefore=lookaheadMatch[5];
var fn_clickAfter=lookaheadMatch[6];
var tid=story.findContainingTiddler(w.output); if (tid) tid=tid.getAttribute("tiddler");
var srctid=w.tiddler?w.tiddler.title:null;
config.macros.checkbox.create(w.output,tid,srctid,w.matchStart+1,checked,id,target,config.checkbox.refresh,fn_init,fn_clickBefore,fn_clickAfter);
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} );
config.macros.checkbox = {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
if(!(tiddler instanceof Tiddler)) { // if no tiddler passed in try to find one
var here=story.findContainingTiddler(place);
if (here) tiddler=store.getTiddler(here.getAttribute("tiddler"))
}
var srcpos=0; // "inline X" not applicable to macro syntax
var target=params.shift(); if (!target) target="";
var defaultState=params[0]=="checked"; if (defaultState) params.shift();
var id=params.shift(); if (id && !id.length) id=null;
var fn_init=params.shift(); if (fn_init && !fn_init.length) fn_init=null;
var fn_clickBefore=params.shift();
if (fn_clickBefore && !fn_clickBefore.length) fn_clickBefore=null;
var fn_clickAfter=params.shift();
if (fn_clickAfter && !fn_clickAfter.length) fn_clickAfter=null;
var refresh={ tagged:true, tagging:true, container:false };
this.create(place,tiddler.title,tiddler.title,0,defaultState,id,target,refresh,fn_init,fn_clickBefore,fn_clickAfter);
},
create: function(place,tid,srctid,srcpos,defaultState,id,target,refresh,fn_init,fn_clickBefore,fn_clickAfter) {
// create checkbox element
var c = document.createElement("input");
c.setAttribute("type","checkbox");
c.onclick=this.onClickCheckbox;
c.srctid=srctid; // remember source tiddler
c.srcpos=srcpos; // remember location of "X"
c.container=tid; // containing tiddler (may be null if not in a tiddler)
c.tiddler=tid; // default target tiddler
c.refresh = {};
c.refresh.container = refresh.container;
c.refresh.tagged = refresh.tagged;
c.refresh.tagging = refresh.tagging;
place.appendChild(c);
// set default state
c.checked=defaultState;
// track state in config.options.ID
if (id) {
c.id=id.substr(1); // trim off leading "="
if (config.options[c.id]!=undefined)
c.checked=config.options[c.id];
else
config.options[c.id]=c.checked;
}
// track state in (tiddlername|tagname) or (fieldname@tiddlername)
if (target) {
var pos=target.indexOf("@");
if (pos!=-1) {
c.field=pos?target.substr(0,pos):"checked"; // get fieldname (or use default "checked")
c.tiddler=target.substr(pos+1); // get specified tiddler name (if any)
if (!c.tiddler || !c.tiddler.length) c.tiddler=tid; // if tiddler not specified, default == container
if (store.getValue(c.tiddler,c.field)!=undefined)
c.checked=(store.getValue(c.tiddler,c.field)=="true"); // set checkbox from saved state
} else {
var pos=target.indexOf("|"); if (pos==-1) var pos=target.indexOf(":");
c.tag=target;
if (pos==0) c.tag=target.substr(1); // trim leading "|" or ":"
if (pos>0) { c.tiddler=target.substr(0,pos); c.tag=target.substr(pos+1); }
if (!c.tag.length) c.tag="checked";
var t=store.getTiddler(c.tiddler);
if (t && t.tags)
c.checked=t.isTagged(c.tag); // set checkbox from saved state
}
}
// trim off surrounding { and } delimiters from init/click handlers
if (fn_init) c.fn_init="(function(){"+fn_init.trim().substr(1,fn_init.length-2)+"})()";
if (fn_clickBefore) c.fn_clickBefore="(function(){"+fn_clickBefore.trim().substr(1,fn_clickBefore.length-2)+"})()";
if (fn_clickAfter) c.fn_clickAfter="(function(){"+fn_clickAfter.trim().substr(1,fn_clickAfter.length-2)+"})()";
c.init=true; c.onclick(); c.init=false; // compute initial state and save in tiddler/config/cookie
},
onClickCheckbox: function(event) {
window.place=this;
if (this.init && this.fn_init) // custom function hook to set initial state (run only once)
{ try { eval(this.fn_init); } catch(e) { displayMessage("Checkbox init error: "+e.toString()); } }
if (!this.init && this.fn_clickBefore) // custom function hook to override changes in checkbox state
{ try { eval(this.fn_clickBefore) } catch(e) { displayMessage("Checkbox onClickBefore error: "+e.toString()); } }
if (this.id)
// save state in config AND cookie (only when ID starts with 'chk')
{ config.options[this.id]=this.checked; if (this.id.substr(0,3)=="chk") saveOptionCookie(this.id); }
if (this.srctid && this.srcpos>0 && (!this.id || this.id.substr(0,3)!="chk") && !this.tag && !this.field) {
// save state in tiddler content only if not using cookie, tag or field tracking
var t=store.getTiddler(this.srctid); // put X in original source tiddler (if any)
if (t && this.checked!=(t.text.substr(this.srcpos,1).toUpperCase()=="X")) { // if changed
t.set(null,t.text.substr(0,this.srcpos)+(this.checked?"X":"_")+t.text.substr(this.srcpos+1),null,null,t.tags);
if (!story.isDirty(t.title)) story.refreshTiddler(t.title,null,true);
store.setDirty(true);
}
}
if (this.field) {
if (this.checked && !store.tiddlerExists(this.tiddler))
store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
// set the field value in the target tiddler
store.setValue(this.tiddler,this.field,this.checked?"true":"false");
// DEBUG: displayMessage(this.field+"@"+this.tiddler+" is "+this.checked);
}
if (this.tag) {
if (this.checked && !store.tiddlerExists(this.tiddler))
store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
var t=store.getTiddler(this.tiddler);
if (t) {
var tagged=(t.tags && t.tags.indexOf(this.tag)!=-1);
if (this.checked && !tagged) { t.tags.push(this.tag); store.setDirty(true); }
if (!this.checked && tagged) { t.tags.splice(t.tags.indexOf(this.tag),1); store.setDirty(true); }
}
// if tag state has been changed, update display of corresponding tiddlers (unless they are in edit mode...)
if (this.checked!=tagged) {
if (this.refresh.tagged) {
if (!story.isDirty(this.tiddler)) // the TAGGED tiddler in view mode
story.refreshTiddler(this.tiddler,null,true);
else // the TAGGED tiddler in edit mode (with tags field)
config.macros.checkbox.refreshEditorTagField(this.tiddler,this.tag,this.checked);
}
if (this.refresh.tagging)
if (!story.isDirty(this.tag)) story.refreshTiddler(this.tag,null,true); // the TAGGING tiddler
}
}
if (!this.init && this.fn_clickAfter) // custom function hook to react to changes in checkbox state
{ try { eval(this.fn_clickAfter) } catch(e) { displayMessage("Checkbox onClickAfter error: "+e.toString()); } }
// refresh containing tiddler (but not during initial rendering, or we get an infinite loop!) (and not when editing container)
if (!this.init && this.refresh.container && this.container!=this.tiddler)
if (!story.isDirty(this.container)) story.refreshTiddler(this.container,null,true); // the tiddler CONTAINING the checkbox
return true;
},
refreshEditorTagField: function(title,tag,set) {
var tagfield=story.getTiddlerField(title,"tags");
if (!tagfield||tagfield.getAttribute("edit")!="tags") return; // if no tags field in editor (i.e., custom template)
var tags=tagfield.value.readBracketedList();
if (tags.contains(tag)==set) return; // if no change needed
if (set) tags.push(tag); // add tag
else tags.splice(tags.indexOf(tag),1); // remove tag
for (var t=0;t<tags.length;t++) tags[t]=String.encodeTiddlyLink(tags[t]);
tagfield.value=tags.join(" "); // reassemble tag string (with brackets as needed)
return;
}
}
//}}}
modifier: Tim
created: 20100324152545
modified: 20100324152545
type: None
tags: pluginInfo
|Name|CheckboxPluginInfo|
|Source|http://www.TiddlyTools.com/#CheckboxPlugin|
|Documentation|http://www.TiddlyTools.com/#CheckboxPluginInfo|
|Version|2.4.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|documentation|
|Description|documentation for CheckboxPlugin|
This plugin extends the TiddlyWiki syntax to allow definition of checkboxes that can be embedded directly in tiddler content. Checkbox states are preserved by:
* setting/removing tags on specified tiddlers,
* or, setting custom field values on specified tiddlers,
* or, saving to a locally-stored cookie ID,
* or, automatically modifying the tiddler source content (deprecated).
When an ID is assigned to the checkbox, it enables direct programmatic access to the checkbox DOM element, as well as creating an entry in TiddlyWiki's config.options[ID] internal data. In addition to tracking the checkbox state, you can also specify custom javascript for programmatic initialization and onClick event handling for any checkbox, so you can provide specialized side-effects in response to state changes.
!!!!!Inline (wiki syntax) Usage
<<<
//{{{
[ ]or[_] and [x]or[X]
//}}}
Simple checkboxes using 'Inline X' storage. The current unchecked/checked state is indicated by the character between the {{{[}}} and {{{]}}} brackets ("_" means unchecked, "X" means checked). When you click on a checkbox, the current state is retained by directly modifying the tiddler content to place the corresponding "_" or "X" character in between the brackets.
>//''NOTE: 'Inline X' syntax has been deprecated...'' This storage format only works properly for checkboxes that are directly embedded and accessed from content in a single tiddler. However, if that tiddler is 'transcluded' into another (by using the {{{<<tiddler TiddlerName>>}}} macro), the 'Inline X' will be ''erroneously stored in the containing tiddler's source content, resulting in corrupted content in that tiddler.'' For anything but the most simple of "to do list" uses, you should select from the various alternative storage methods described below...//
//{{{
[x=id]
//}}}
Assign an optional ID to the checkbox so you can use {{{document.getElementByID("id")}}} to manipulate the checkbox DOM element, as well as tracking the current checkbox state in {{{config.options["id"]}}}. If the ID starts with "chk" the checkbox state will also be saved in a cookie, so it can be automatically restored whenever the checkbox is re-rendered (overrides any default {{{[x]}}} or {{{[_]}}} value). If a cookie value is kept, the "_" or "X" character in the tiddler content remains unchanged, and is only applied as the default when a cookie-based value is not currently defined.
//{{{
[x(title|tag)] or [x(title:tag)]
//}}}
Initializes and tracks the current checkbox state by setting or removing a particular tag value from a specified tiddler. If you omit the tiddler title (and the | or : separator), the specified tag is assigned to the current tiddler. If you omit the tag value, as in {{{(title|)}}}, the default tag, {{{checked}}}, is assumed. Omitting both the title and tag, {{{()}}}, tracks the checkbox state by setting the "checked" tag on the current tiddler. When tag tracking is used, the "_" or "X" character in the tiddler content remains unchanged, and is not used to set or track the checkbox state. If a tiddler title named in the tag does not exist, the checkbox state defaults to the "inline X" value. If this value is //checked//, or is subsequently changed to //checked//, it will automatically create the missing tiddler and then add the tag to it. //''NOTE: beginning with version 2.1.2 of this plugin, the "|" separator is the preferred separator between the title and tag name, as it avoids syntactic ambiguity when ":" is used within tiddler titles or tag names.''//
//{{{
[x(field@tiddler)]
//}}}
Initializes and tracks the current checkbox state by setting a particular custom field value from a specified tiddler. If you omit the tiddler title (but not the "@" separator), the specified field on the current tiddler is used. If you omit the field name, as in {{{(@tiddler)}}}, a default fieldname of {{{checked}}} is assumed. Omitting both the field and the tiddler title, {{{(@)}}}, defaults to setting the "checked" field on the current tiddler. When field tracking is used, the "_" or "X" character in the tiddler content remains unchanged, and is not used to set or track the checkbox state. If the tiddler title named in the parameter does not exist, the checkbox state defaults to the "inline X" value. If this value is //checked// or is subsequently changed to //checked//, it will automatically create the missing tiddler and then add the field to it.
//{{{
[x{javascript}{javascript}{javascript}]
//}}}
You can define optional javascript code segments to add custom initialization and/or 'onClick' handlers to a checkbox. The current checkbox state (and it's other DOM attributes) can be set or read from within these code segments by reference to a globally-defined context object, "place" (which can also be referenced as "window.place").
The first code segment will be executed when the checkbox is initially displayed, so that you can programmatically determine it's starting checked/unchecked state. The second code segment (if present) is executed whenever the checkbox is clicked, but //before the regular checkbox processing in performed// ("onClickBefore"), so that you can apply programmed responses or intercept and override the checkbox state based on custom logic. The third code segment (if present) is executed whenver the checkbox is clicked, //after the regular checkbox processing has completed// ("onClickAfter"), so that you can include "side-effect" processing based on the checkbox state just applied.
>Note: if you want to use the default checkbox initialization processing with a custom onClickBefore/After function, use this syntax:
>{{{[x(tag){}{javascript}]}}} or {{{[x(tag){}{}{javascript}]}}}
<<<
!!!!!Macro usage
<<<
In addition to embedded checkboxes using the wiki syntax described above, a ''macro-based syntax'' is also provided, for use in templates where wiki syntax cannot be directly used. This macro syntax can also be used in tiddler content, as an alternative to the wiki syntax. When embedded in [[PageTemplate]], [[ViewTemplate]], or [[EditTemplate]] (or custom alternative templates), use the following macro syntax:
//{{{
<span macro="checkbox target checked id onInit onClickBefore onClickAfter"></span>
//}}}
or, when embedded in tiddler content, use the following macro syntax:
//{{{
<<checkbox target checked id onInit onClickBefore onClickAfter>>
//}}}
where:
''target''
>is either a tag reference (e.g., ''tagname|tiddlername'') or a field reference (e.g. ''fieldname@tiddlername''), as described above.
''checked'' (optional)
>is a keyword that sets the initial state of the checkbox to "checked". When omitted, the default checkbox state is "unchecked".
''id'' (optional)
>specifies an internal config.options.* ID, as described above. If the ID begins with "chk", a cookie-based persistent value will be created to track the checkbox state in between sessions.
''onInit'' (optional)
>contains a javascript event handler to be performed when the checkbox is initially rendered (see details above).
''onClickBefore'' and/or ''onClickAfter'' (optional)
>contains a javascript event handler to be performed each time the checkbox is clicked (see details above). //note: to use the default onInit handler with a custom onClickBefore/After handler, use "" (empty quotes) or {} (empty function) as a placeholder for the onInit and/or onClickBefore parameters//
<<<
!!!!!Examples
<<<
''checked and unchecked static default ("inline X") values:''
//{{{
[X] label
[_] label
//}}}
>[X] label
>[_] label
''document-based value (id='demo', no cookie):''
//{{{
[_=demo] label
//}}}
>[_=demo] label
''cookie-based value (id='chkDemo'):''
//{{{
[_=chkDemo] label
//}}}
>[_=chkDemo] label
''tag-based value (TogglyTagging):''
//{{{
[_(CheckboxPluginInfo|demotag)]
[_(CheckboxPluginInfo|demotag){place.refresh.tagged=place.refresh.container=false}]
//}}}
>[_(CheckboxPluginInfo|demotag)] toggle 'demotag' (and refresh tiddler display)
>[_(CheckboxPluginInfo|demotag){place.refresh.tagged=place.refresh.container=false}] toggle 'demotag' (no refresh)
''field-based values:''
//{{{
[_(demofield@CheckboxPluginInfo)] demofield@CheckboxPluginInfo
[_(demofield@)] demofield@ (equivalent to demonfield@ current tiddler)
[_(checked@CheckboxPluginInfo)] checked@CheckboxPluginInfo
[_(@CheckboxPluginInfo)] @CheckboxPluginInfo
[_(@)] @ (equivalent to checked@ current tiddler)
//}}}
>[_(demofield@CheckboxPluginInfo)] demofield@CheckboxPluginInfo
>[_(demofield@)] demofield@ (current tiddler)
>[_(checked@CheckboxPluginInfo)] checked@CheckboxPluginInfo
>[_(@CheckboxPluginInfo)] @CheckboxPluginInfo
>[_(@)] toggle field: @ (defaults to "checked@here")
>click to view current: <<toolbar fields>>
''custom init and onClick functions:''
//{{{
[X{place.checked=true}{alert(place.checked?"on":"off")}] message box with checkbox state
//}}}
>[X{place.checked=true}{alert(place.checked?"on":"off")}] message box with checkbox state
''retrieving option values:''
>config.options['demo']=<script>return config.options['demo']?"true":"false";</script>
>config.options['chkDemo']=<script>return config.options['chkDemo']?"true":"false";</script>
<<<
!!!!!Configuration
<<<
Normally, when a checkbox state is changed, the affected tiddlers are automatically re-rendered, so that any checkbox-dependent dynamic content can be updated. There are three possible tiddlers to be re-rendered, depending upon where the checkbox is placed, and what kind of storage method it is using.
*''container'': the tiddler in which the checkbox is displayed. (e.g., this tiddler)
*''tagged'': the tiddler that is being tagged (e.g., "~MyTask" when tagging "~MyTask:done")
*''tagging'': the "tag tiddler" (e.g., "~done" when tagging "~MyTask:done")
You can set the default refresh handling for all checkboxes in your document by using the following javascript syntax either in a systemConfig plugin, or as an inline script. (Substitute true/false values as desired):
{{{config.checkbox.refresh = { tagged:true, tagging:true, container:true };}}}
You can also override these defaults for any given checkbox by using an initialization function to set one or more of the refresh options. For example:
{{{[_{place.refresh.container=false}]}}}
<<<
!!!!!Revisions
<<<
2008.01.08 [*.*.*] plugin size reduction: documentation moved to [[CheckboxPluginInfo]]
2008.01.05 2.4.0 set global "window.place" to current checkbox element when processing checkbox clicks. This allows init/beforeClick/afterClick handlers to reference RELATIVE elements, including using "story.findContainingTiddler(place)". Also, wrap handlers in "function()" so "return" can be used within handler code.
2008.01.02 2.3.0 split optional custom onClick handling into separate onClickBefore and onClickAfter handlers. The onClickBefore handler permits interception of the click BEFORE the checkbox is set. onClickAfter allows follow-on 'side-effect' processing to occur AFTER the checkbox is set.
2007.12.04 [*.*.*] update for TW2.3.0: replaced deprecated core functions, regexps, and macros
2007.08.06 2.2.5 supress automatic refresh of any tiddler that is currently being edited. Ensures that current tiddler edit sessions are not prematurely discarded (losing any changes). However, if checkbox changes a tag on a tiddler being edited, update the "tags" input field (if any) so that saving the edited tiddler correctly reflects any changes due to checkbox activity... see refreshEditorTagField().
2007.07.13 - 2.2.4 in handler(), fix srctid reference (was "w.tiddler", should have been "w.tiddler.title"). This fixes broken 'inline X' plus fatal macro error when using PartTiddlerPlugin. Thanks to cmari for reporting the problem and UdoBorkowski for finding the code error.
2007.06.21 - 2.2.3 suppress automatic refresh of tiddler when using macro-syntax to prevent premature end of tiddler editing session.
2007.06.20 - 2.2.2 fixed handling for 'inline X' when checkboxes are contained in a 'trancluded' tiddler. Now, regardless of where an inline X checkbox appears, the X will be placed in the originating source tiddler, rather than the tiddler in which the checkbox appears.
2007.06.17 - 2.2.1 Refactored code to add checkbox //macro// syntax for use in templates (e.g., {{{macro="checkbox ..."}}}. Also, code cleanup of existing tag handling.
2007.06.16 - 2.2.0 added support for tracking checkbox states using tiddler fields via "(fieldname@tiddlername)" syntax.
2006.05.04 - 2.1.3 fix use of findContainingTiddler() to check for a non-null return value, so that checkboxes won't crash when used outside of tiddler display context (such as in header, sidebar or mainmenu)
2006.03.11 - 2.1.2 added "|" as delimiter to tag-based storage syntax (e.g. "tiddler|tag") to avoid parsing ambiguity when tiddler titles or tag names contain ":". Using ":" as a delimiter is still supported but is deprecated in favor of the new "|" usage. Based on a problem reported by JeffMason.
2006.02.25 - 2.1.0 added configuration options to enable/disable forced refresh of tiddlers when toggling tags
2006.02.23 - 2.0.4 when toggling tags, force refresh of the tiddler containing the checkbox.
2006.02.23 - 2.0.3 when toggling tags, force refresh of the 'tagged tiddler' so that tag-related tiddler content (such as "to-do" lists) can be re-rendered.
2006.02.23 - 2.0.2 when using tag-based storage, allow use [[ and ]] to quote tiddler or tag names that contain spaces:
{{{[x([[Tiddler with spaces]]:[[tag with spaces]])]}}}
2006.01.10 - 2.0.1 when toggling tags, force refresh of the 'tagging tiddler'. For example, if you toggle the "systemConfig" tag on a plugin, the corresponding "systemConfig" TIDDLER will be automatically refreshed (if currently displayed), so that the 'tagged' list in that tiddler will remain up-to-date.
2006.01.04 - 2.0.0 update for ~TW2.0
2005.12.27 - 1.1.2 Fix lookAhead regExp handling for {{{[x=id]}}}, which had been including the "]" in the extracted ID.
Added check for "chk" prefix on ID before calling saveOptionCookie()
2005.12.26 - 1.1.2 Corrected use of toUpperCase() in tiddler re-write code when comparing {{{[X]}}} in tiddler content with checkbox state. Fixes a problem where simple checkboxes could be set, but never cleared.
2005.12.26 - 1.1.0 Revise syntax so all optional parameters are included INSIDE the [ and ] brackets. Backward compatibility with older syntax is supported, so content changes are not required when upgrading to the current version of this plugin. Based on a suggestion by GeoffSlocock
2005.12.25 - 1.0.0 added support for tracking checkbox state using tags ("TogglyTagging")
Revised version number for official post-beta release.
2005.12.08 - 0.9.3 support separate 'init' and 'onclick' function definitions.
2005.12.08 - 0.9.2 clean up lookahead pattern
2005.12.07 - 0.9.1 only update tiddler source content if checkbox state is actually different. Eliminates unnecessary tiddler changes (and 'unsaved changes' warnings)
2005.12.07 - 0.9.0 initial BETA release
<<<
modifier: GUEST
created: 20100324163813
modified: 20100324174032
type: None
tags:
Do you like this? Yes [_] or No [_]
[X] CHECK
Dimensions of wheel chair:'' <<edit foo>>
modifier: None
created: 20100324091602
modified: 20100324091839
type: text/javascript
tags:
// TiddlyWeb adaptor
// v0.7.0
//
// 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 (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;
$.ajax({
url: uri,
type: "GET",
dataType: "json",
success: function(data, status, xhr) {
var resource = self.parse(data);
callback(resource, status, xhr);
},
error: errback
});
},
// sends resource to server
// callback is passed data, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception (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;
}
});
$.ajax({
url: uri,
type: "PUT",
contentType: "application/json",
data: $.toJSON(data),
success: callback, // XXX: pre-OO chrjs used jQuery.ajax complete for some (valid) reason
error: errback
});
},
// deletes resource on server
// callback is passed data, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception (cf. jQuery.ajax error)
"delete": function(callback, errback) {
var uri = this.route();
$.ajax({
url: uri,
type: "DELETE",
success: callback,
error: errback
});
},
// 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];
return typeof r === "string" || typeof r === "number" ? r : a;
});
};
})(jQuery);
modifier: None
created: 20100324091602
modified: 20100324091839
type: text/javascript
tags:
// TiddlyWeb adaptor
// v0.7.0
//
// 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 (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;
$.ajax({
url: uri,
type: "GET",
dataType: "json",
success: function(data, status, xhr) {
var resource = self.parse(data);
callback(resource, status, xhr);
},
error: errback
});
},
// sends resource to server
// callback is passed data, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception (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;
}
});
$.ajax({
url: uri,
type: "PUT",
contentType: "application/json",
data: $.toJSON(data),
success: callback, // XXX: pre-OO chrjs used jQuery.ajax complete for some (valid) reason
error: errback
});
},
// deletes resource on server
// callback is passed data, status, XHR (cf. jQuery.ajax success)
// errback is passed XHR, error, exception (cf. jQuery.ajax error)
"delete": function(callback, errback) {
var uri = this.route();
$.ajax({
url: uri,
type: "DELETE",
success: callback,
error: errback
});
},
// 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];
return typeof r === "string" || typeof r === "number" ? r : a;
});
};
})(jQuery);
modifier: PaulDowney
created: 20100325100029
modified: 20100325100310
type: None
tags:
Background: #fff
Foreground: #000
PrimaryPale: #e8e8e8
PrimaryLight: #747474
PrimaryMid: #333
PrimaryDark: #111
SecondaryPale: #f8f8f8
SecondaryLight: #dddddd
SecondaryMid: #5B6D6E
SecondaryDark: #000
TertiaryPale: #e8e8e8
TertiaryLight: #dddddd
TertiaryMid: #404040
TertiaryDark: #000
Error: #faa
SelectedPale: #dafaff
SelectedLight: #459BF9
SelectedDark: #07f
TiddlySlidyLight: #50a0fc
TiddlySlidyMid: #2d00ff
TiddlySlidyDark: #0069dd
modifier: PaulDowney
created: 20100324180226
modified: 20100324180226
type: None
tags:
[[profile]]
bag=tim
for i in SimplesTheme settings.js ColorPalette StyleSheet
do
curl -X PUT -H 'Content-Type: text/plain' --data-binary @${i}.tid http://openbritain.labs.osmosoft.com/bags/$bag/tiddlers/${i}
done
modifier: GUEST
created: 20100324170647
modified: 20100324170752
type: None
tags:
[[DisabledGo|http://new.disabledgo.com/?profile=tim]]
modifier: Tim
created: 20100324152653
modified: 20100324152653
type: None
tags: systemConfig InputPackage
/***
|Name|EditFieldPlugin|
|Source|http://www.TiddlyTools.com/#EditFieldPlugin|
|Version|1.5.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|extend core edit macro for use in ViewTemplates or direct embedding in tiddler content|
!!!!!Usage
<<<
Normally, when a tiddler is edited, a set of input fields is displayed (as defined by the [[EditTemplate]]), and any changes you make are only saved when you press the "done" (or "cancel") command in the tiddler editor's toolbar. However, you can also ''embed an input field directly in //viewed// tiddler content'' by writing:
{{{
<<edit fieldname numberOfLines defaultValue>>
<<edit fieldname@TiddlerName numberOfLines defaultValue>>
}}}
or in the [[ViewTemplate]] (to add it to every tiddler):
{{{
<span macro='edit fieldname numberOfLines defaultValue'></span>
<span macro='edit fieldname@TiddlerName numberOfLines defaultValue'></span>
}}}
Unfortunately, while the input field will be displayed, the "done" command item is not available when //viewing// a tiddler, so the 'save/discard' handling cannot be invoked once you have decided that your input activities are complete, and any changes you make will not stored anywhere. To address this, the plugin extends the input field handler so that when a field is embedded in normal tiddler content and you make changes, it can automatically save/discard your changes as soon as you press ENTER or move away ('onBlur' handling) from that input field. You can also abandon your changes to input field content by pressing ESCAPE.
The plugin also adds support for an optional 'remote field reference' syntax: "{{{fieldname@TiddlerName}}}" so you can display and edit fields stored in other tiddlers. This allows you to create, for example, 'summary' tiddlers for reviewing/editing field values from several tiddlers at the same time. Note: whenever a remote field reference is used (even within the [[EditTemplate]]), the automatic save/discard behavior described above will be applied to that field, so that any changes will be saved immediately, and will not be saved again when the "done" command is pressed.
<<<
!!!!!Examples
<<<
*"""<<edit foobar>>"""<br><<edit foobar>>
*"""<<edit foobar@SomeTiddler>>"""<br><<edit foobar@SomeTiddler>>
*"""<<edit tags>>"""<br><<edit tags>>
*"""<<edit text 15>>"""<br>{{editor{<<edit text 15>>}}}
<<<
!!!!!Revisions
<<<
2009.09.16 [1.5.1] fixed 'onblur' handling for local fields (fieldname@here). Added support for '@here' syntax
2009.09.05 [1.5.0] code refactored. added handling for fieldname@tiddlername
2007.08.22 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.EditFieldPlugin= {major: 1, minor: 5, revision: 1, date: new Date(2009,9,16)};
config.macros.edit.editFieldPlugin_savedHandler=config.macros.edit.handler;
config.macros.edit.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
// let core render input/textarea, then get resulting element
config.macros.edit.editFieldPlugin_savedHandler.apply(this,arguments);
var fieldType=params[0]=="text"||params[1]?'textarea':'input';
var elems=place.getElementsByTagName(fieldType); var e=elems[elems.length-1];
// extended fieldname@tiddlername handling
var parts=e.getAttribute("edit").split('@');
var field=parts[0];
var title=parts[1]||tiddler.title;
if (title=='here') title=tiddler.title;
// stop field from being saved with 'done' button
if (parts[1]) { e.setAttribute("edit",null); e.setAttribute("field",field); }
// save starting value and target tiddler
e.setAttribute("currval",store.getValue(title,field)||''); // save starting value
e.setAttribute("tiddler",title);
// force height for textarea field
if (fieldType=="textarea" && params[1]) e.style.height=params[1]+"em";
// if viewing tiddler, add autosave handlers
var here=story.findContainingTiddler(place);
var isViewed=here&&here.getAttribute("template").indexOf("ViewTemplate")!=-1;
if (parts[1]||isViewed) { // remote reference or view mode editing...
story.setDirty(tiddler.title,false); // clear tiddler ("dirty") flag (set by core)
e.onkeydown=function(ev) { // ENTER key=save (for single-line input)
var event=ev?ev:window.event;
this.setAttribute("keyCode",event.keyCode); // save last keyCode (for blur)
if (event.keyCode==13 && this.nodeName.toUpperCase()!="TEXTAREA")
this.saveField(); // save input to tiddler field
}
e.onblur=function(ev) { // confirm input when focus moves away
var event=ev?ev:window.event;
var tid=this.getAttribute("tiddler"); if (!tid || !tid.length) return;
var field=this.getAttribute("edit")||this.getAttribute("field");
if (this.value==this.getAttribute("currval")) return; // no change
if (this.getAttribute("keyCode")=="27") { // if user pressed ESC
var msg="Abandon changes to %0@%1?".format([field,tid]);
if (confirm(msg)) this.value=this.getAttribute("currval"); // reset value
this.id=new Date().getTime(); // set unique ID for delayed re-focus after blur
setTimeout("document.getElementById('"+this.id+"').focus()",1);
} else { // other focus change events
var msg="Save changes to %0@%1?".format([field,tid]);
if (confirm(msg)) this.saveField();
else this.value=this.getAttribute("currval");
}
};
e.saveField=function() { // unpack/validate attribs and then save the field
var tid=this.getAttribute("tiddler"); if (!tid || !tid.length) return;
var field=this.getAttribute("edit")||this.getAttribute("field");
var title=(field=="title")?this.value:tid;
if (!title.length) { // error: blank tiddler title
this.value=this.getAttribute("currval"); // reset value
this.id=new Date().getTime(); // set unique ID for delayed messages/refocus
setTimeout("displayMessage('Please enter a non-blank value')",1);
setTimeout("document.getElementById('"+this.id+"').focus()",2);
return;
}
config.macros.edit.saveField(tid,title,field,this.value);
this.setAttribute("currval",this.value); // remember new starting value
};
}
}
//}}}
//{{{
// save input value to tiddler field (create/touch/rename tiddler as needed)
config.macros.edit.saveField = function(tid,title,field,val) {
var t=store.getTiddler(tid);
store.suspendNotifications();
var anim=config.options.chkAnimate; config.options.chkAnimate=false; // suspend animation
var who=t&&config.options.chkForceMinorUpdate?t.modifier:config.options.txtUserName;
var when=t&&config.options.chkForceMinorUpdate?t.modified:new Date();
store.saveTiddler(t?tid:title,title,t?t.text:"",who,when,t?t.tags:[],t?t.fields:null);
store.setValue(title,field,val); // save field
if (tid!=title) // new title... show renamed tiddler in place of current one
{ story.displayTiddler(story.getTiddler(tid),title); story.closeTiddler(tid); }
if (field=="text") // content changed, refresh tiddler display
{ story.refreshTiddler(title,null,true); }
config.options.chkAnimate=anim; // resume animation
store.resumeNotifications();
store.notify(title,true);
}
//}}}
modifier: PaulDowney
created: 20100325101810
modified: 20100325101810
type: None
tags: systemConfig
/***
|''Name:''|FadingMessagesPlugin|
|''Description:''|Automatically clear a displayed message after an interval |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/FadingMessagesPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/FadingMessagesPlugin/ |
|''Version:''|0.2|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
|''Overrides:''|displayMessage|
|''Requires:''|WikifiedMessagesPlugin|
!!Documentation
Displayed messages automatically fade away after a short interval.
!!Options
|<<option txtFadingMessagesTimeout>>|<<message config.optionsDesc.txtFadingMessagesTimeout>>|
|<<option chkAnimate>>|<<message config.optionsDesc.chkAnimate>>|
!!Code
***/
//{{{
if(!version.extensions.FadingMessagesPlugin) {
version.extensions.FadingMessagesPlugin = {installed:true};
config.options.txtFadingMessagesTimeout = 5;
config.optionsDesc.txtFadingMessagesTimeout = "seconds before a displayed message clears itself";
config.animDurationFade = 900;
config.extensions.FadingMessages = {
Fader: function(e,done)
{
e.style.overflow = 'hidden';
e.style.display = 'block';
var p = [];
p.push({style: 'display', atEnd: 'none'});
p.push({style: 'opacity', start: 1, end: 0, template: '%0'});
p.push({style: 'filter', start: 100, end: 0, template: 'alpha(opacity:%0)'});
return new Morpher(e,config.animDurationFade,p,done);
},
clearMessageBox: function(e)
{
try { removeNode(e); } catch(ex) {}
var msgArea = document.getElementById("messageArea");
var n = msgArea.getElementsByTagName('div');
if(!(n&&n.length)){
msgArea.style.display = "none";
}
},
fadeMessageBox: function(e)
{
var me = config.extensions.FadingMessages;
if(config.options.chkAnimate && anim){
anim.startAnimating(new me.Fader(e,me.clearMessageBox));
}else{
me.clearMessageBox(e);
}
},
createClearAllButton: function(e)
{
return null;
},
createClearMessageButton: function(e)
{
var me = config.extensions.FadingMessages;
return createTiddlyButton(createTiddlyElement(e,"span",null,"messageClear"),
"×","",
function(){me.clearMessageBox(e);});
},
_displayMessage: displayMessage,
displayMessage: function(text,linkText)
{
var me = config.extensions.FadingMessages;
var e = me._displayMessage(text,linkText);
if(e){
window.setTimeout(function(){me.fadeMessageBox(e);},config.options.txtFadingMessagesTimeout*1000);
}
return e;
}
};
displayMessage = config.extensions.FadingMessages.displayMessage;
config.extensions.WikifiedMessages.createClearMessageButton = config.extensions.FadingMessages.createClearMessageButton;
config.extensions.WikifiedMessages.createClearAllButton = config.extensions.FadingMessages.createClearAllButton;
}
//}}}
404 Not Found: (u"Feedback not found, no tiddler for Feedback: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/team4_public/tiddlers/Feedback'",)
modifier: PaulDowney
created: 20100324174407
modified: 20100324184936
type: None
tags: systemConfig excludeLists excludeSearch
/***
|''Name:''|FieldGeneratorPlugin|
|''Description:''| generate field edit using checkboxes, text, etc |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/FieldGeneratorPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/FieldGeneratorPlugin/ |
|''Version:''|0.1|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
!!Documentation
depends upon CheckBoxPlugin
!!Code
***/
//{{{
/*jslint onevar: false nomen: false plusplus: false */
/*global jQuery config store */
(function ($) {
version.extensions.FieldGeneratorPlugin = {installed: true};
config.macros.FieldGenerator = {
handler: function (place, macroName, params, wikifier, paramString, tiddler) {
var names = params[0] || "fields";
var target = params[1] || tiddler.title;
var fields = store.getTiddler(names).text.split("\n");
var t = "";
for (var i = 1; i < fields.length; i++) {
var f = fields[i].split("|");
if (f[3] == "checkbox") {
var name = f[2];
name = f[1] + (name ? ".":"") + f[2];
t = t + "[" + (tiddler.fields[name] ? "X" : "_") + "(" + name + "@" + target + ")" + "] " + f[4] + "\n";
} else if (f[3] == "text") {
t = t + f[4] + ": <<edit " + name + tiddler.fields[name] + ">>\n";
}
}
wikify(t, place, null, tiddler);
}
};
}(jQuery));
//}}}
modifier: GUEST
created: 20100324133528
modified: 20100324185351
type: None
tags:
|!Area|!Label|!Type|!Description|
|visual||checkbox|I consider myself to be visually impaired|
|visual|nav_independently|checkbox|I have enough sight to navigate independently in a restaurant|
|visual|vis_assistance_dog|checkbox|I own an assistance dog|
|visual|braille|checkbox|I require use of Braille or audio tapes within the facility|
|visual|noise_level|checkbox|I require a low level of background noise|
|visual|accessible_parking|checkbox|I shall need access to accessible parking|
|visual|vis_alarms|checkbox|I require visual alarms in public facilities|
|visual|vis_trained_assistance|checkbox|I am visually impaired and require assistance from trained staff|
|mobility||checkbox|I consider myself to be mobility impaired|
|mobility|climb_stairs|checkbox|I am able to climb a flight of stairs provided there are hand rails|
|mobility|temp_wheelchair|checkbox|I am able to get around with handrails but have temporary use of a wheel chair|
|mobility|own_wheelchair|checkbox|I use a wheel chair occasionally and have my own wheel chair|
|mobility|chair_dimensions|text|The dimensions of my wheel chair are|
|mobility|turning_circle|text|The turning circle of my wheel chair is|
|mobility|wheelchair_independent|checkbox|I depend on the use of a wheel chair but I am able to get around independently|
|mobility|wheelchair_perm_assistance|checkbox|I depend on the use of a wheel chair and I require permenant assistance|
|mobility|mob_trained_assistance|checkbox|I am mobility impaired and require assistance from trained staff|
|hearing||checkbox|I consider myself to be hearing impaired|
|hearing|text_phone|checkbox|I require a text phone|
|hearing|counter_loop|checkbox|I require use of a counter loop system / inductive coupler at the premises|
|hearing|vis_indicators|checkbox|I require strong visual indications (i.e flashing lights)|
|hearing|hearing_assistance_dog|checkbox|I own a service dog|
|hearing|bsl|checkbox|I require a BSL interpreter|
|hearing|hearing_trained_assistance|checkbox|I am hearing impaired and require assistance from trained staff|
|general|interest_city|checkbox|I am interested in cities / city breaks|
|general|interest_countryside|checkbox|I am interested in countryside|
|general|interest_his|checkbox|I am interested in history and heritage|
|general|interest_museums|checkbox|I am interested in museums and galleries|
|general|interest_music|checkbox|I am interested in music|
|general|interest_restaurant|checkbox|I am interested in restaurants and dining|
|general|interest_shopping|checkbox|I am interested in shopping|
|general|interest_sightseeing|checkbox|I am interested in sight-seeing|
|general|interest_sport|checkbox|I am interested in sport|
|general|interest_theatre|checkbox|I am interested in theatre, musicals and shows|
modifier: None
created: 20100323171226
modified: 20100323185043
type: text/html
tags:
<!DOCTYPE html>
<html>
<head>
<title>myOpenBritain</title>
<style type="text/css">
#submit,
label {
display: block;
padding: 1em 1em 0 1em;
}
</style>
</head>
<body>
<div id="">
<h1>myOpenBritain</h1>
<p>I'd like to update my <a href="profile">profile</a> or <a href="search">search</a> for stuff.</p>
</div>
</body>
</html>
modifier: None
created: 20100323171226
modified: 20100323185043
type: text/html
tags:
<!DOCTYPE html>
<html>
<head>
<title>myOpenBritain</title>
<style type="text/css">
#submit,
label {
display: block;
padding: 1em 1em 0 1em;
}
</style>
</head>
<body>
<div id="">
<h1>myOpenBritain</h1>
<p>I'd like to update my <a href="profile">profile</a> or <a href="search">search</a> for stuff.</p>
</div>
</body>
</html>
404 Not Found: (u"Hotel not found, no tiddler for Hotel: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/team4_public/tiddlers/Hotel'",)
modifier: None
created: 20100329150535
modified: 20100329150535
type: text/javascript
tags:
(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(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.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{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+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);
modifier: Tim
created: 20100324152804
modified: 20100324152804
type: None
tags: MediaPackage TaskPackage systemConfig InputPackage
/***
|Name|ListboxPlugin|
|Source|http://www.TiddlyTools.com/#ListboxPlugin|
|Documentation|http://www.TiddlyTools.com/#ListboxPluginInfo|
|Version|1.4.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|set custom field or tiddler tags by selecting from listbox/droplist|
The {{{<<select>>}}} macro allows you to set tiddler field values by selecting pre-configured values from a listbox/droplist control.
!!!!!Documentation
>see [[ListboxPluginInfo]]
!!!!!Revisions
<<<
2010.03.14 1.4.1 use filterTiddlers() instead of getTaggedTiddlers() - use MatchTagsPlugin for tag expressions
|please see [[ListboxPluginInfo]] for additional revision details|
2007.05.12 0.5.0 started
<<<
!!!!!Code
***/
//{{{
version.extensions.ListboxPlugin= {major: 1, minor: 4, revision: 1, date: new Date(2010,3,14)};
config.macros.select = {
tooltip: "select a value for %0@%1",
blankTooltip: "set %0@%1=[no value]",
valueTooltip: "set %0@%1=%2",
otherLabel: "other",
otherTooltip: "set %0@%1=[enter a value...]",
otherPrompt: "enter a value for '%0'",
editLabel: "edit list...",
editTooltip: "edit '%0' list definition (%1)",
changeMsg: "setting %0@%1=%2",
verbose: false,
hereKeyword: "here",
defaultTarget: "SiteFields",
handler:
function(place,macroName,params,wikifier,paramString,tiddler) {
// default to containing tiddler or "SiteFields" catch-all
var here=story.findContainingTiddler(place);
var targetID=here?here.getAttribute("tiddler"):this.defaultTarget;
// get field name and non-default target (if any)
var field=params.shift();
var pos=field.indexOf("@"); // if non-default target ("field@tiddler" syntax)
if(pos!=-1) { // split field into field and tiddlername.
if (field.substr(pos+1)!=this.hereKeyword) // "here" == use default target
targetID=field.substr(pos+1); // use different target tiddler
field=field.substr(0,pos);
}
if(!field || !field.length) return; // no field name... do nothing
if (field.substr(0,1)=="=") targetID="(system)"; // internal option value
var items=[]; var listsrc='';
var autosave=false; var allowBlank=false; var allowOther=false; var allowEdit=false;
var allowMultiple=false; var wikifyData=false; var rows=0; var width='';
var p=params.shift();
while (p) {
if (p.toLowerCase()=='autosave') // autosave on change
autosave=true;
else if (p.toLowerCase()=='allowblank') // add empty item
var allowBlank=true;
else if (p.toLowerCase()=='allowother') // add "other: ____" item
var allowOther=true;
else if (p.toLowerCase()=='allowedit') // add "edit list..." item
var allowEdit=true;
else if (p.toLowerCase()=='allowmultiple') // multi-select
var allowMultiple=true;
else if (p.startsWith('rows:')) // 0=autosize listbox, 1=droplist, n=listbox
var rows=p.substr(5);
else if (p.startsWith('width:')) // CSS width of list
var width=p.substr(6);
else if (p.startsWith('prompt:')) // prompt text (1st item in list)
var ptext=p.substr(7);
else if (p.substr(0,1)=="+"||p.substr(0,1)=="*") { // read HR-separated tiddler
var listsrc=p.substr(1);
var listtxt=store.getTiddlerText(listsrc,'');
var wikifyData=p.substr(0,1)=="*";
if (listtxt.length && wikifyData) // wikify source to handle macros/scripts
listtxt=this.getWikifiedData(listtxt);
if (listtxt.length)
items=items.concat(listtxt.split(listtxt.indexOf('\n----\n')!=-1?'\n----\n':'\n'));
}
else if (p.startsWith("=")) { // get items from tagged tiddlers
var filter=p.substr(1);
if (!filter.startsWith('[')) filter='[tag['+filter+']]';
var tids=store.filterTiddlers(filter);
for (var t=0; t<tids.length; t++) items.push(tids[t].title);
}
else { // param is item value or 'label=value'
var parts=p.split("=");
var label=parts[0]; var v=parts[1]?parts[1]:parts[0];
items.push(label+"="+v);
}
p=params.shift();
}
if (rows==1) allowMultiple=false; // droplist cannot do multi-select
if (tiddler && !story.isDirty(tiddler.title)) autosave=true; // tiddler is in VIEW mode, force autosave
this.render(createTiddlyElement(place,"span"), null,
targetID, field, ptext, items, listsrc, wikifyData,
rows, width, autosave, allowBlank, allowOther, allowEdit, allowMultiple);
store.addNotification(null,this.refresh); // syncs lists when tiddlers are changed
},
getWikifiedData: // wikify tiddler content, then extract text WITH newlines and HRs included
function(txt) {
var e=createTiddlyElement(document.body,"div"); wikify(txt,e);
var breaks=e.getElementsByTagName("br");
for (var b=0; b<breaks.length; b++) breaks[b].parentNode.insertBefore(document.createTextNode("\n"),breaks[b]);
var lines=e.getElementsByTagName("hr");
for (var l=0; l<lines.length; l++) lines[l].parentNode.insertBefore(document.createTextNode("----\n"),lines[l]);
var items=e.getElementsByTagName("li");
for (var i=0; i<items.length; i++) items[i].parentNode.insertBefore(document.createTextNode("\n"),items[i]);
var txt=getPlainText(e); removeNode(e); return txt;
},
refresh:
function (title) { // re-render dependent lists
var lists=document.getElementsByTagName('select');
for (var i=0; i<lists.length; i++) { var list=lists[i];
if (list.getAttribute('listsrc')!=title) continue; // no sync needed
var listtxt=store.getTiddlerText(list.getAttribute('listsrc')||'','');
if (listtxt.length && list.getAttribute("wikifyData")=="true")
listtxt=this.getWikifiedData(listtxt);
if (listtxt.length)
var items=listtxt.split(listtxt.indexOf('\n----\n')!=-1?'\n----\n':'\n');
config.macros.select.render(list.parentNode, list,
list.getAttribute('tiddler'),
list.getAttribute('edit'),
list.getAttribute('ptext'),
items||[],
list.getAttribute('listsrc'),
list.getAttribute("wikifyData")=="true",
list.getAttribute("rows"),
list.getAttribute("width"),
list.getAttribute("autosave")=="true",
list.getAttribute("allowBlank")=="true",
list.getAttribute("allowOther")=="true",
list.getAttribute("allowEdit")=="true",
list.getAttribute("allowMultiple")=="true");
}
},
render:
function (place, here, targetID, field, ptext, items, listsrc, wikifyData,
rows, width, autosave, allowBlank, allowOther, allowEdit, allowMultiple) {
var values=[]; var opts=[];
// use current selection(s) (if any) (except for "edit list..." item)
if (here) for (var i=0; i<here.options.length; i++) {
var opt=here.options[i];
if (opt.selected && opt.text!=config.macros.select.editLabel) values.push(opt.value);
}
// no listbox or no selections... get value(s) from field (if any)
if (!values.length) {
var v=(field.substr(0,1)=='=')?config.options[field.substr(1)]:store.getValue(targetID,field);
if (v) values=(field=='tags'||allowMultiple)?v.readBracketedList():[v];
}
// add prompt item
if (ptext&&ptext.length)
opts.push('<option value="_ptext" title="">'+ptext+'</option>');
// add 'no value' item
if ((!allowMultiple && !values.length) || allowBlank)
opts.push('<option value="" title="'+this.blankTooltip.format([field,targetID])+'"></option>');
// add enumerated items
var isOther=values.length; // assume no matching value
for (var opt=0; opt<items.length; opt++) {
var lines=items[opt].split("\n"); var parts=lines[0].split("=");
var label=parts[0];
var v=parts[1]?parts[1]:parts[0];
var title=lines[1]?lines[1]:this.valueTooltip.format([field,targetID,v]);
var sel=values.contains(v); if (sel) isOther=false; // found matching value
opts.push('<option value="'+v+'" '+(sel?'selected':'')+' title="'+title+'">'+label+'</option>');
}
// add 'other...'
if (field=='tags') isOther=false;
if (isOther||allowOther) {
var label="other"+(isOther?(": "+values[0]):"...");
var v=isOther?values[0]:'';
var t=this.otherTooltip.format([field,targetID]);
opts.push('<option value="'+v+'" '+(isOther?'selected':'')+' title="'+t+'">'+label+'</option>');
}
// add 'edit list...'
if (listsrc && (!store.getTiddlerText(listsrc) || allowEdit)) {
var title=this.editTooltip.format([field,listsrc]);
opts.push('<option value="'+listsrc+'" title="'+title+'">'+this.editLabel+'</option>');
}
// render listbox
var html='<select '+(values[0]?'value="'+values[0]+'" ':' ')
+' title="'+this.tooltip.format([field,targetID])+'"'
+' rows="'+rows+'"'+' size="'+(rows!=0?rows:opts.length)+'"'+' style="width:'+width+'"'
+' tiddler="'+targetID+'"'+' edit="'+field+'"'+' ptext="'+ptext+'"'
+' listsrc="'+listsrc+'"'+' wikifyData="'+wikifyData+'"'
+' autosave="'+autosave+'"'+' allowBlank="'+allowBlank+'"'+' allowOther="'+allowOther+'"'
+' allowEdit="'+allowEdit+'"'+' allowMultiple="'+allowMultiple+'"'+(allowMultiple?' multiple':'')
+' onclick="return config.macros.select.onClick(this,event)"'
+' onchange="return config.macros.select.onChange(this,event)"'
+' ondblclick="return false">'+opts.join('')+'</select>';
place.innerHTML=html;
},
onClick:
function(here,event) {
var sel=here.selectedIndex;
if (sel!=-1 && here.options[sel].text.startsWith(config.macros.select.otherLabel))
here.onchange.apply(here,arguments);
},
onChange:
function(here,event) {
var cms=config.macros.select; // abbrev
var sel=here.selectedIndex;
if (sel!=-1) {
if (here.options[sel].text==cms.editLabel) {
story.displayTiddler(story.findContainingTiddler(here),here.value,DEFAULT_EDIT_TEMPLATE);
return false;
}
if (here.options[sel].text.startsWith(cms.otherLabel)) {
var newval=prompt(cms.otherPrompt.format([here.getAttribute("edit")]),here.value);
if (!newval) {// user cancelled
var v=store.getValue(here.getAttribute("tiddler"),here.getAttribute("edit"));
{ here.value=v; if (v==undefined) here.selectedIndex=0; return false; }
};
here.options[sel].value=newval;
here.options[sel].text=cms.otherLabel+": "+newval;
here.value=newval;
}
if (here.options[sel].value=='_ptext')
for (var i=0; i<here.options.length; i++)
here.options[i].selected=false;
}
if (here.getAttribute("autosave")=="true") config.macros.select.setFieldValue(here);
return false;
},
setFieldValue: function(here) {
var tid=here.getAttribute("tiddler"); if (!tid || !tid.length) return; // no target, do nothing
var field=here.getAttribute("edit");
if (field.substr(0,1)=='=') { // option cookie instead of tiddler field
config.macros.option.propagateOption(field.substr(1),"value",here.value,"input");
return;
}
// ensure tiddler exists
if (!store.tiddlerExists(tid)) store.saveTiddler(tid,tid,"",config.options.txtUserName,new Date(),[]);
if (field=='tags') {
store.suspendNotifications();
for (var i=0; i<here.options.length; i++) {
var opt=here.options[i];
if (opt.text==config.macros.select.editLabel) continue;
store.setTiddlerTag(tid,opt.selected,opt.value);
}
store.resumeNotifications();
} else {
// get multi-select items
var values=[];
for (var i=0; i<here.options.length; i++) {
var opt=here.options[i];
if (opt.text==config.macros.select.editLabel) continue;
if (opt.selected) values.pushUnique(String.encodeTiddlyLink(opt.value));
}
if (values.length==1) values=[here.value]; // remove unneeded brackets around single value
store.setValue(tid,field,values.length?values.join(' '):null); // if no selections, delete field
}
// 'touch' tiddler and report to user
var t=store.getTiddler(tid);
var who=config.options.chkForceMinorUpdate?t.modifier:config.options.txtUserName;
var when=config.options.chkForceMinorUpdate?t.modified:new Date();
store.saveTiddler(tid,tid,t.body,who,when,t.tags,t.fields);
if (config.macros.select.verbose)
{ clearMessage(); displayMessage(config.macros.select.changeMsg.format([field,tid,here.value])); }
}
}
//}}}
modifier: Tim
created: 20100324152737
modified: 20100324152737
type: None
tags: pluginInfo
|Name|ListboxPlugin|
|Source|http://www.TiddlyTools.com/#ListboxPlugin|
|Documentation|http://www.TiddlyTools.com/#ListboxPluginInfo|
|Version|1.4.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|documentation|
|Description|documentation for ListboxPlugin|
The {{{<<select>>}}} macro allows you to set tiddler field values by selecting pre-configured enumerated values from a listbox/droplist control.
!!!!!Usage
<<<
in tiddler content:
{{{
<<select fieldname@tiddlername value value value ...
rows:nn width:xxx "prompt:..." autoSave allowBlank allowOther allowMultiple>>
<<select fieldname@tiddlername label=value label=value label=value ...
rows:nn width:xxx "prompt:..." autoSave allowBlank allowOther allowMultiple>>
<<select fieldname@tiddlername =tagvalue allowEdit
rows:nn width:xxx "prompt:..." autoSave allowBlank allowOther allowMultiple>>
<<select fieldname@tiddlername "=tag expression" allowEdit
rows:nn width:xxx "prompt:..." autoSave allowBlank allowOther allowMultiple>>
<<select fieldname@tiddlername +TiddlerName allowEdit
rows:nn width:xxx "prompt:..." autoSave allowBlank allowOther allowMultiple>>
<<select fieldname@tiddlername *TiddlerName allowEdit
rows:nn width:xxx "prompt:..." autoSave allowBlank allowOther allowMultiple>>
}}}
in a custom [[EditTemplate]] or [[ViewTemplate]]:
{{{
<div class="editor" macro="select ..."></div>
}}}
//where://
*''fieldname@tiddlername'' (or ''=cookiename''){{block{
<<<
Specifies the tiddler field associated with the list display. The "@tiddlername" portion is optional and, when omitted (or the special keyword, "@here" is used), the current tiddler is assumed. Alternatively, if the fieldname begins with an equal sign (=), then it will be used as a TiddlyWiki option cookie reference and the selected value will be ''assigned to that cookiename //instead// of being stored in a tiddler field''. Note: when a cookie reference is used, any "@tiddlername" portion that may be present in the syntax will be //ignored//.
<<<
}}}
*{{block{
''value value value ...'' //or// ''label=value label=value label=value ...'' //(inline list definition)//
''+~TiddlerName'' //or// ''*~TiddlerName'' //(tiddler-based list definition)//
''=tagvalue'' //or// ''"=tag expression"'' //(tag-based list definition)//
<<<
Specifies list items as simple values or label/value pairs.
You can use the ''+~TiddlerName'' or ''*~TiddlerName'' syntax to define the values or label/value pairs using a tiddler containing an "HR-separated" list, where each list item is one or two lines of text, separated from the next item by a horizontal rule: """----""". The first line of each item contains the value or label=value that will appear in the list. The second, optional line allows you to specify custom tooltip help text for that list item.
The default tooltip for a list item is: "{{{set fieldname@tiddlername=itemvalue}}}". Note: if all list entries are single-line (i.e., you are not defining ANY custom tooltips), you can omit the horizontal rule between entries... each line of text will be treated as a separate list entry.
If you use "*" preceding the ~TiddlerName, the contents of the tiddler will first be processed by the TiddlyWiki parser and that output will then be used as the list definition. This allows you to apply macros and scripts to //dynamically generate list definitions// based on the current document contents (such as available tag names).
You can also use the ''=tagvalue'' syntax to generate a list whose items are the names of tiddlers tagged with that value (e.g., "=systemConfig" to list all plugins, or "=friends" to list all tiddlers tagged as "friends"). If you have MatchTagsPlugin installed, you can use Boolean tag //expressions// (e.g., "=friends or (lovers and not crazy)", to list only tiddlers that have a suitable combination of tags.
<<<
}}}
*''allowEdit'' //(for use with +~TiddlerName or *~TiddlerName param only)//{{block{
<<<
adds optional "edit list..." item to the end of the list, to enable quick editing of a tiddler-based list definition. Note: if the ''+~TiddlerName'' parameter refers to a tiddler that does not yet exist, the "edit list..." item is automatically added to the list, even if ''allowEdit'' was not specified. This allows you to place an 'empty' tiddler-based list into your content (e.g., """<<select fieldname =NewTiddlerName>>"""), and then create and define the tiddler-based list later on.
<<<
}}}
*''rows:nn''{{block{
<<<
specifies the number of lines to display in the list. If rows=1, a 'droplist' is displayed. If rows>1 a fixed-height listbox is used. By default (or if rows=0 is used), the listbox is displayed with enough lines to show all items without scrolling (i.e., "fit to contents - vertically")
<<<
}}}
*''width:xxx''{{block{
<<<
specifies the width of the list, using a CSS dimension value (px, em, in, cm, or %). The default is auto (i.e., "fit to contents - horizontally").
<<<
}}}
*''"prompt:..."''{{block{
<<<
specifies 'guide text' to display as the first item in the list. Selecting this item does not change the value stored in the field.
<<<
}}}
*''autoSave''{{block{
<<<
when used in EditTemplate, this keyword forces selection changes to be applied immediately rather than waiting for the "done" command to be invoked. Note: because the standard ViewTemplate toolbar does not have a "done" command to signal the end of the editing activity, ''autoSave'' is always enabled when working with a selection list that is being displayed in 'view mode'.
<<<
}}}
*''allowBlank''{{block{
<<<
when the value of a tiddler field is "undefined", a 'blank' item is added at the beginning of the list to represent the undefined field value. When a field value is subsequently selected, the blank item is removed from the list. Use the ''allowBlank'' keyword to always include the blank item in the list. Selecting the blank item sets the field value back to "undefined" (i.e., deletes the field).
<<<
}}}
*''allowOther''{{block{
<<<
when the value of a tiddler field does not match any of the values in the list, a special 'other' item is added at the end of the list so that the unrecognized field value can be shown. If another field value is subsequently selected, the 'other' item is removed from the list. Use the ''allowOther'' keyword to always include the 'other item in the list. When this item is selected, you will be prompted to enter a custom value to assign to the field.
<<<
}}}
*''allowMultiple''{{block{
<<<
when used with a listbox (e.g, rows>1), permits selection of multiple items using ctrl-click and shift-click. Selected values are stored in the tiddler field as a space-separated list, with brackets ({{{[[...]]}}}}) used as needed around values containing spaces. //note: multiple selection is not supported by droplists (rows=1)//
<<<
}}}
<<<
!!!!!Examples
<<<
''inline list definition:''
{{{<<select thing rows:1 eenie meenie miney moe>>}}}
<<select thing rows:1 eenie meenie miney moe>>
{{{<<select size rows:1 "prompt:select a show size..." xsmall=30 small=32 medium=34 large=36 xlarge=38>>}}}
<<select size rows:1 "prompt:select a show size..." xsmall=30 small=32 medium=34 large=36 xlarge=38>>
{{{<<select size allowOther "prompt:select a shoe size..." xsmall=30 small=32 medium=34 large=36 xlarge=38>>}}}
<<select size allowOther "prompt:select a shoe size..." xsmall=30 small=32 medium=34 large=36 xlarge=38>>
{{{<<select gender Male Female>>}}}
<<select gender Male Female>>
''tiddler-based list definition:''
{{{<<select color rows:1 +ListboxSample>>}}}
<<select color rows:1 +ListboxSample>>
{{{<<select color allowBlank allowOther allowMultiple +ListboxSample allowEdit>>}}}
<<select color allowBlank allowOther allowMultiple +ListboxSample allowEdit>>
{{{<<select demo@ListboxDemoTarget +ListboxNewSample>>}}}
<<select demo@ListboxDemoTarget +ListboxNewSample>>
''tag-based list definition:''
{{{<<select plugins rows:1 =systemConfig>>}}}
<<select plugins rows:1 allowBlank =systemConfig>>
{{{<<select samples rows:1 allowBlank =sample>>}}}
<<select samples rows:1 =sample>>
<<<
!!!!!Revisions
<<<
2010.03.14 1.4.1 use filterTiddlers() instead of getTaggedTiddlers() - use MatchTagsPlugin for tag expressions
2009.09.02 1.4.0 added 'prompt:...' param
2009.09.02 1.3.0 added special handling for tags field
2009.06.15 1.2.3 in setFieldValue(), eliminate extra brackets around single value selections
2009.06.15 1.2.2 fixed infinite loop problem in refresh()
2009.06.15 1.2.1 if not allowMultiple, handle field values containing space-separated lists as single values
2009.05.31 1.2.0 added allowMultiple flag. Rewrote handler to allow option params in any order. Corrected handling of blank/other values.
2008.07.22 1.1.0 added "=cookiename" syntax for storing selected value in cookie instead of a tiddler field
2008.04.28 1.0.1 added "=tagvalue" syntax for generating lists of tiddlers tagged with a given value
2007.08.31 0.8.2 corrected handling for "@tiddlername" syntax for non-default 'target' tiddler.
2007.08.06 0.8.1 added support for "@here" keyword syntax and cleaned up handling for identifying 'target' tiddler. Also added 'onclick' handler for "other:" item, so that prompt dialog is presented even if "other" was already selected (and hence, no "onchange" event)
2007.07.29 0.8.0 added getWikifiedData() and use of "*" prefix on TiddlerName so macros or inline scripts embedded in listbox definitions can generate dynamic lists based on current document content.
2007.07.26 0.7.3 fixed call to config.macros.select.setFieldValue()
2007.07.24 0.7.2 in setFieldValue(), 'touch' target tiddler AFTER setting value to avoid early refresh event that steps on listbox attributes, causing a fatal error (in IE only).
2007.06.28 0.7.1 in render(), retrieve current val from tiddler editor control (when editing) or use stored field (when viewing).
2007.05.29 0.7.0 split render() logic from handler(), added refresh() notification to auto sync lists that use +TiddlerName definition
2007.05.15 0.6.1 code/documentation cleanup
2007.05.14 0.6.0 lots more options
2007.05.12 0.5.0 started
<<<
modifier: PaulDowney
created: 20100324150219
modified: 20100325133303
type: None
tags:
[[Register]]
[[My Profile|profile]]
[[My DisabledGo|http://new.disabledgo.com/?profile=tim]]
[[Search Britain|http://openbritain.labs.osmosoft.com/bags/team4_public/tiddlers/search]]
[[My Notes|note]]
[[Feedback Form]]
[[myBookmarklet|javascript:(function(){var%20uri="http://openbritain.labs.osmosoft.com/bags/team4_public/tiddlers/bookmarklet.js";var%20el=document.createElement("script");el.type="text/javascript";el.src=uri;document.getElementsByTagName("head")[0].appendChild(el);})();]]
modifier: PaulDowney
created: 20100325101814
modified: 20100325114805
type: None
tags:
<<themeButton DefaultTheme PowerMode>>
404 Not Found: (u"My not found, no tiddler for My: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/tim/tiddlers/My'",)
404 Not Found: (u"My not found, no tiddler for My: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/team4_public/tiddlers/My'",)
modifier: GUEST
created: 20100325101814
modified: 201003251331
type: None
tags:
javascript:(function(){var%20uri="http://openbritain.labs.osmosoft.com/bags/team4_public/tiddlers/bookmarklet.js";var%20el=document.createElement("script");el.type="text/javascript";el.src=uri;document.getElementsByTagName("head")[0].appendChild(el);})();
404 Not Found: (u"New not found, no tiddler for New: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/tim/tiddlers/New'",)
#!/bin/sh
# hack!
tags=$(echo $QUERY_STRING|sed -e 's/^.*tags=//' -e 's/\&.*$//')
text=$(echo $QUERY_STRING|sed -e 's/^.*text=//' -e 's/\&.*$//')
title=$(echo $QUERY_STRING|sed -e 's/^.*title=//' -e 's/\&.*$//')
{
echo "title: $title"
echo "tags: $tags"
echo
echo $text
} > text.tid
curl -X PUT -H 'Content-Type: text/plain' --data-binary @text.tid http://openbritain.labs.osmosoft.com/bags/tim/tiddlers/$title
{
echo "Content-type: text/hml"
echo "Location: http://openbritain.labs.osmosoft.com/recipes/tim/tiddlers.wiki#$title"
echo
cat text.tid
}
exit 0
modifier: GUEST
created: 20100325090532
modified: 20100325090532
type: None
tags:
404 Not Found: (u"Office not found, no tiddler for Office: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/team4_public/tiddlers/Office'",)
modifier: GUEST
created: 20100324174442
modified: 20100324174442
type: None
tags:
<<FieldGenerator>>
modifier: PaulDowney
created: 20100325101814
modified: 20100325114842
type: None
tags:
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
<div class="modeSwitch" refresh='content' tiddler='PowerModeSwitch'></div>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
404 Not Found: (u"Places not found, no tiddler for Places: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/team4_public/tiddlers/Places'",)
modifier: PaulDowney
created: 20100325101814
modified: 20100325115011
type: None
tags:
<<themeButton SimplesTheme SimpleMode>>
modifier: GUEST
created: 20100323170151
modified: 20100325113503
type: None
tags:
<html><a href="http://openbritain.labs.osmosoft.com/recipes/team4_public/tiddlers/profile">profile</a></html>
modifier: PaulDowney
created: 20100323170151
modified: 20100325101644
type: None
tags:
mobility: false
hearing: false
mobility.wheelchair_independent: false
sight: 1
hearing.hearing_trained_assistance: false
general.interest_museums: false
hearing.counter_loop: false
mobility.temp_wheelchair: false
hearing.hearing_assistance_dog: false
general.interest_restaurant: false
visual.accessible_parking: true
general.interest_countryside: false
general.interest_sport: false
mobility.turning_circle: false
general.interest_theatre: false
general.interest_his: false
hearing.bsl: false
mobility.chair_dimensions: false
visual.vis_alarms: false
mobility.mob_trained_assistance: false
visual.vis_trained_assistance: false
mobility.wheelchair_perm_assistance: false
visual: true
general.interest_city: false
general.interest_shopping: false
general.interest_music: false
fn: Tim
visual.vis_assistance_dog: true
visual.braille: true
visual.noise_level: false
mobility.climb_stairs: false
hearing.vis_indicators: false
visual.nav_independently: false
general.interest_sightseeing: false
hearing.text_phone: false
mobility.own_wheelchair: false
<<FieldGenerator>>
modifier: GUEST
created: 20100324152137
modified: 20100324153127
type: None
tags: systemConfig
/***
|''Name''|RadioButtonMacro|
|''Description''|macro to generate radio button elements|
|''Author''|FND|
|''Version''|0.1.0|
|''Status''|@@experimental@@|
|''Source''|http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/RadioButtonMacro.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/contributors/FND/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''Keywords''|forms|
!Usage
{{{
<<radio label value1 value2 [value3 value4 ... ]>>
}}}
!!Examples
<<radio "Sample Selection" foo bar baz>>
!Revision History
!!v0.1 (2010-03-18)
* initial release
!To Do
* persistence
* selection initialization
!Code
***/
//{{{
(function($) {
config.macros.radio = {
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
var label = params.shift();
var group = label.replace(/\s/g, "_");
var container = $("<fieldset />");
$("<legend />").text(label).appendTo(container);
$.each(params, function(i, item) {
var radio = $('<input type="radio" />').
attr("name", group).val(item);
container.append(radio).append(item);
});
$("<form />").append(container).appendTo(place);
}
};
})(jQuery);
//}}}
modifier: PaulDowney
created: 20100325113438
modified: 20100325115303
type: None
tags:
If you signup to myOpenBritain you'll be able to You can do this in the following ways:
using your Facebook account
[img[facebookconnect|http://img.skitch.com/20100325-bph4b2rp3nbd1jc75pwb2ixjym.jpg]]<br>
''or'' using your ~OpenID account
[img[openid|http://img.skitch.com/20100325-mww37ib9hybrxa6e7c35tt17y9.jpg]]
''or'' using email:
<<edit email email "email address">>
<<edit username username "preferred username">>
<<edit password password password>>
404 Not Found: (u"Sample not found, no tiddler for Sample: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/team4_public/tiddlers/Sample'",)
modifier: None
created: 20100323171307
modified: 20100323185043
type: text/html
tags:
<!DOCTYPE html>
<html>
<head>
<title>myOpenBritain - search</title>
<style type="text/css">
#submit,
label {
display: block;
padding: 1em 1em 1em 1em;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#search').submit(function() {
var term = $('#term').val();
var location = $('#location').val();
var distance = $('#distance').val();
var symbols = "";
var url = 'http://www.disabledgo.com/templates/search2.php?term=' + escape(term) + '&location=' + escape(location) + '&symbols=' + symbols + '&distance=' + escape(distance);
window.open(url, "_self");
return false;
});
});
</script>
</head>
<body>
<div id="">
<h1>myOpenBritain - Welcome back Tim!</h1>
<form id='search'>
<fieldset>
<label for="">Look for:
<input type="text" id="term" width="20" tabindex="1">
</label>
<label for="distance">Within:
<select title="Distance from location" name="distance" id="distance">
<option value="1">1 Mile</option>
<option value="2">2 Miles</option>
<option value="5" selected="selected">5 Miles</option>
<option value="10">10 Miles</option>
<option value="20">20 Miles</option>
<option value="50">50 Miles</option>
</select>
</label>
<label for="">Town:
<input title="Town" type="text" id="location" name="location" />
</label>
<input type="submit" value="Search!" id="submit"/>
</fieldset>
</form>
</div>
</body>
</html>
modifier: None
created: 20100323171307
modified: 20100323185043
type: text/html
tags:
<!DOCTYPE html>
<html>
<head>
<title>myOpenBritain - search</title>
<style type="text/css">
#submit,
label {
display: block;
padding: 1em 1em 1em 1em;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#search').submit(function() {
var term = $('#term').val();
var location = $('#location').val();
var distance = $('#distance').val();
var symbols = "";
var url = 'http://www.disabledgo.com/templates/search2.php?term=' + escape(term) + '&location=' + escape(location) + '&symbols=' + symbols + '&distance=' + escape(distance);
window.open(url, "_self");
return false;
});
});
</script>
</head>
<body>
<div id="">
<h1>myOpenBritain - Welcome back Tim!</h1>
<form id='search'>
<fieldset>
<label for="">Look for:
<input type="text" id="term" width="20" tabindex="1">
</label>
<label for="distance">Within:
<select title="Distance from location" name="distance" id="distance">
<option value="1">1 Mile</option>
<option value="2">2 Miles</option>
<option value="5" selected="selected">5 Miles</option>
<option value="10">10 Miles</option>
<option value="20">20 Miles</option>
<option value="50">50 Miles</option>
</select>
</label>
<label for="">Town:
<input title="Town" type="text" id="location" name="location" />
</label>
<input type="submit" value="Search!" id="submit"/>
</fieldset>
</form>
</div>
</body>
</html>
modifier: PaulDowney
created: 20100325100050
modified: 20100325100310
type: None
tags: systemConfig
//{{{
/*
* Theme
*/
config.options.txtTheme = "SimplesTheme";
/*
* Animations
*/
config.options.chkAnimate = 0;
/*
* SinglePagedMode
*/
config.options.chkSinglePageMode = 1; //Display one tiddler at a time
config.options.chkSinglePagePermalink = 1; //Automatically permalink current tiddler
config.options.chkSinglePageKeepFoldedTiddlers = 0; //Don't close tiddlers that are folded
config.options.chkSinglePageKeepEditedTiddlers = 1; //Don't close tiddlers that are being edited
config.options.chkTopOfPageMode = 1; //Open tiddlers at the top of the page
/*
* Lingo
*/
merge(config.macros.newTiddler,{
label: "new note",
prompt: "Create a new note",
title: "New Note",
accessKey: "N"
});
merge(config.views.wikified,{
defaultText: "The tiddler '%0' doesn't yet exist. Edit to create it."
});
//}}}
modifier: PaulDowney
created: 20100324182624
modified: 20100324182624
type: None
tags:
<<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
modifier: PaulDowney
created: 20100324182710
modified: 20100325113530
type: None
tags:
<<search>>
<<newTiddler>>
modifier: PaulDowney
created: 20100325130308
modified: 20100325130805
type: None
tags:
<<tabs txtMainTab Notes "Notes" TabNotes "More" "More lists" TabDetails>>
modifier: PaulDowney
created: 20100325100029
modified: 20100325131959
type: None
tags: systemTheme
|''PageTemplate''|##PageTemplate|
|''StyleSheet''|##StyleSheet|
!PageTemplate
<!--{{{-->
<div id='header'>
<p class='siteTitle' refresh='content' tiddler='SiteTitle'></p>
<div class="modeSwitch" refresh='content' tiddler='ModeSwitch'></div>
</div>
<div id='messageArea'></div>
<div id='author'>
<div id="mainNav">
<div id='authorButtons' refresh='content' tiddler='AuthorButtons'></div>
<div id='mainMenu' refresh='content' force='true' tiddler='MainMenu'></div>
</div>
<div id="displayContainer">
<div id='displayArea'>
<div id='tiddlerDisplay'></div>
</div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
</div>
</div>
<div id='footer'></div>
<!--}}}-->
!StyleSheet
[[StyleSheet]]
/*{{{*/
html, body {
padding: 0;
margin:0;
font-family: Helvetica Neue, Arial, Helvetica, sans-serif;
color: [[ColorPalette::PrimaryLight]];
background-color: [[ColorPalette::SecondaryPale]];
}
#header {
height: 4em;
padding: 1.5em 2em 1.5em 2.6em;
background-color: [[ColorPalette::PrimaryPale]];
border: 2px solid [[ColorPalette::SecondaryLight]];
}
#contentWrapper {
background-color: [[ColorPalette::SecondaryPale]];
}
a#backstageShow {
color: [[ColorPalette::PrimaryPale]];
}
#header .siteTitle {
font-family: Georgia, serif;
font-size: 3em;
padding: 0em;
margin: 0em;
}
#header .modeTitle {
font-size: 1.4em;
margin-top: 0.5em;
}
#header .modeSwitch {
float:right;
margin-top: -2.5em;
margin-bottom: 1em;
height: 3em;
}
#displayArea {
margin: 1em auto 1em auto;
width: 50%;
}
#presentation {
border: none;
background-color: [[ColorPalette::SecondaryPale]];
margin: 0 auto 0 0;
}
#tiddlerDisplay {
margin: auto;
width: 100%;
height: 100%;
background-color: [[ColorPalette::Background]];
border: none;
width: 60%;
min-height: 490px;
}
#footer {
height: 4em;
padding: 0 2em 1em 2em;
background-color: [[ColorPalette::SecondaryPale]];
border: none;
}
#slide {
border: 2px solid [[ColorPalette::SecondaryLight]];
background-color: [[ColorPalette::Background]];
margin: 1em auto;
width: 640px;
height: 480px;
_height: auto;
overflow: hidden;
}
#thumbnail {
margin: 1em;
border: 2px solid [[ColorPalette::PrimaryMid]];
}
#contentWrapper .themeButton,
#contentWrapper .button {
width: 5em;
text-align: center;
letter-spacing: 1px;
line-height: 2em;
padding: 0.3em 2em 0.3em 2em;
margin: 2em 1em 0em 1em;
background-color: [[ColorPalette::Background]];
background: [[ColorPalette::SecondaryLight]] url(images/bg-button.gif);
border: 1px solid [[ColorPalette::PrimaryLight]];
color: [[ColorPalette::PrimaryMid]];
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
-webkit-box-shadow: 2px 2px 3px rgba(135, 139, 144, 0.4);
-moz-box-shadow: 2px 2px 3px rgba(135, 139, 144, 0.4);
box-shadow: 2px 2px 3px rgba(135, 139, 144, 0.4);
}
#contentWrapper .themeButton:hover,
#contentWrapper .themeButton:active,
#contentWrapper .button:hover,
#contentWrapper .button:active
{
background: [[ColorPalette::SecondaryLight]] url(images/bg-button.gif);
background-position:0 -400px;
border: 1px solid [[ColorPalette::PrimaryMid]];
color: [[ColorPalette::PrimaryMid]];
outline: none;
}
#contentWrapper .themeButton.selected:hover,
#contentWrapper .themeButton.selected:active,
#contentWrapper .themeButton.selected {
cursor: default;
border: 1px solid [[ColorPalette::PrimaryLight]];
color: [[ColorPalette::Background]];
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, [[ColorPalette::SelectedLight]]), color-stop(1.0, [[ColorPalette::SelectedDark]]));
background: -moz-linear-gradient(top, [[ColorPalette::SelectedLight]] 0%, [[ColorPalette::SelectedDark]] 100%);
background-color: [[ColorPalette::SelectedDark]];
}
#mainMenu {
width: 100%;
position: relative;
margin: 0;
padding: 0;
}
#mainMenu ul {
margin: 0;
padding: 0;
list-style: none;
}
#mainMenu li {
text-align: left;
display: block;
width: 80%;
border: 2px solid [[ColorPalette::PrimaryPale]];
background-color: [[ColorPalette::Background]];
margin-bottom: 0.2em;
padding: 0 2em 0 0;
}
#mainMenu li a {
color: [[ColorPalette::SecondaryMid]];
display: block;
padding-right: 1em;
width: 90%;
}
#mainMenu li a.selected,
#mainMenu li a:hover,
#mainMenu li a.selected:active {
color: [[ColorPalette::Background]];
background-color: [[ColorPalette::SecondaryMid]];
}
h2 {
border: none;
color: [[ColorPalette::TertiaryMid]];
font-size: 2em;
font-weight: normal;
padding-bottom: 0.5em;
margin: 0;
}
.toolbar {
float: right;
padding: 1em 0;
font-size: 1.2em;
}
.toolbarOptions {
padding: 1em 0;
}
/* TBD: refactor */
.toolbarOptions select {
margin-right: 2em;
}
.button {
-moz-border-radius: 4px;
}
#presentation .toolbar,
#presentation .toolbarOptions,
#presentation h2.preview {
display: none;
}
.tiddler,
.viewSlide {
height: 97%;
overflow: hidden;
}
table.twtable {
width: 100%;
border-top: 1px solid [[ColorPalette::PrimaryLight]];
border-bottom: 1px solid [[ColorPalette::PrimaryLight]];
border-left: none;
border-right: none;
margin-left: 0mm;
font-size: 0.5em;
line-height: 1.5em;
}
.wizard table.twtable {
font-size: 1.5em;
}
.twtable th {
background-color: [[ColorPalette::PrimaryDark]];
font-weight: normal;
}
.twtable th,
.twtable tr,
.twtable td {
border: none;
}
.twtable .evenRow {
background-color: [[ColorPalette::PrimaryPale]];
}
.twtable .oddRow {
background-color: [[ColorPalette::SecondaryPale]];
}
[[GrowlStyle]]
[[ControlPanelStyle]]
.editor {
font-size: 1.5em;
padding-top: 0.2em;
padding-bottom: 1em;
}
.editor input,
.editor textarea {
border: 2px solid [[ColorPalette::PrimaryPale]];
}
.editSlide {
padding: 0 1em;
}
#fullframe {
background-color: #000;
}
#fullframe .preview,
#fullframe .toolbar,
#fullframe .toolbarOptions {
display: none;
}
#messageArea a.button {
border: 0;
background: none;
padding-left: 0;
margin-left: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.tiddler .tagged {
clear: both;
}
#contentWrapper {
width: 100%;
max-width: 100%;
}
#author {
width: 100em;
margin: 0 auto;
text-align: left;
}
#mainNav {
width: 10em;
max-width: 20%;
float: left;
margin: 0;
}
#displayContainer {
float: right;
width: 75em;
margin: 0;
}
#tiddlerDisplay {
display: inline-block;
margin: 0;
padding: 0;
}
#displayArea {
width: 50em;
display: inline;
margin: 0;
padding: 0;
}
#sidebar {
width: 18em;
margin: 0;
right: 0;
top: 0;
float: left;
margin: 0;
padding: 0;
margin: 0;
position: static;
float: right;
/* IE6 hack */
_position: absolute;
_top: 8em;
}
#footer {
clear: both;
}
#sidebarTabs .tabContents {
margin: 0 auto;
text-align: left;
}
#sidebarOptions {
padding-top:1em;
}
#sidebarOptions a {
margin:0;
padding:0;
display: inline;
}
#sidebarOptions input {
margin:0.4em 0.5em;
}
#sidebarTabs .tabContents {
width: 15em;
overflow: hidden;
color: [[ColorPalette::SecondaryMid]];
border: 2px solid [[ColorPalette::PrimaryPale]];
background-color: [[ColorPalette::Background]];
margin: 0;
}
#sidebar .tabUnselected {
background-color: [[ColorPalette::SecondaryMid]];
color: [[ColorPalette::Background]];
margin: 0;
}
#sidebar .tiddlyLinkExisting {
color: [[ColorPalette::SecondaryMid]];
margin: 0;
}
#authorButtons {
height: 3.5em;
padding: 0 auto;
}
#sidebar a.button,
#authorButtons a.button {
text-align: center;
font-size: 1.2em;
}
/* ie6.0 hack */
div#tiddlerDisplay div.viewSlide {
_height: 475px;
}
/*}}}*/
modifier: PaulDowney
created: 20100325101322
modified: 20100325101400
type: None
tags: systemConfig
/***
|''Name:''|SingleTiddlerPlugin|
|''Description:''|Display one tiddler at one time |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/SingleTiddlerPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/SingleTiddlerPlugin/ |
|''Version:''|0.1|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
!!Documentation
This plugin closes all tiddlers and displays one tiddler at one time.·
The URL is updated to point to the current tiddler.
!!Code
***/
//{{{
/*jslint onevar: false nomen: false plusplus: false */
/*global jQuery window config Story story Tiddler */
(function ($) {
version.extensions.SingleTiddlerPlugin = {installed: true};
Story.prototype._displayTiddler = Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function (src, t) {
var title = t instanceof Tiddler ? t.title : t;
story.closeAllTiddlers();
this._displayTiddler.apply(this, arguments);
window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));
};
}(jQuery));
//}}}
modifier: GUEST
created: 20100323184729
modified: 20100324141908
type: None
tags: user wheelchair
wheelchair_turning_circle: 1500mm
wheelchair: 1
wheelchair_width: 635mm
fn: Sir William
Hello!
modifier: PaulDowney
created: 20100323184729
modified: 20100325112356
type: None
tags: user wheelchair
wheelchair_turning_circle: 1500mm
wheelchair: 1
wheelchair_width: 635mm
fn: Sir William
modifier: PaulDowney
created: 20100324150238
modified: 20100325080740
type: None
tags:
personal profile
modifier: PaulDowney
created: 20100325080813
modified: 20100325080813
type: None
tags:
welcome back, Tim!
modifier: Tim
created: 20100324114147
modified: 20100324151029
type: None
tags:
myOpenBritain
modifier: PaulDowney
created: 20100325130901
modified: 20100325130901
type: None
tags:
<<tabs txtTabDetails "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>
modifier: PaulDowney
created: 20100325130347
modified: 20100325130728
type: None
tags:
<<list filter [tag[note]]>>
modifier: PaulDowney
created: 20100324090906
modified: 20100324091839
type: None
tags:
<div id="profile">
<h1>myOpenBritain Profile</h1>
<form>
<label for="name">Name:
<input type="text" id="name" width="20" tabindex="1" value="<%= fn %>">
</label>
<fieldset>
<legend>Mobility</legend>
<br/><input type="checkbox" <%= wheelchair ? "checked" : "" %> id='symbol-1' title='Wheelchair User' > Wheelchair User
<br/>Width: <input type="text" title="width" value="<%= wheelchair_width %>">
<br/>Turning Circle: <input type="text" title="turning" value="<%= wheelchair_turning_circle %>">
</fieldset>
<input type="submit" value="Done" id="submit"/>
</form>
</div>
</body>
</html>
modifier: PaulDowney
created: 20100324090906
modified: 20100324091839
type: None
tags:
<div id="profile">
<h1>myOpenBritain Profile</h1>
<form>
<label for="name">Name:
<input type="text" id="name" width="20" tabindex="1" value="<%= fn %>">
</label>
<fieldset>
<legend>Mobility</legend>
<br/><input type="checkbox" <%= wheelchair ? "checked" : "" %> id='symbol-1' title='Wheelchair User' > Wheelchair User
<br/>Width: <input type="text" title="width" value="<%= wheelchair_width %>">
<br/>Turning Circle: <input type="text" title="turning" value="<%= wheelchair_turning_circle %>">
</fieldset>
<input type="submit" value="Done" id="submit"/>
</form>
</div>
</body>
</html>
modifier: None
created: 20100324100327
modified: 20100324100327
type: text/javascript
tags:
(function($) {
var host = "";
var base_uri = host + "/bags/team4_public/tiddlers/";
var chrjs_uri = base_uri + "chrjs.js";
var util_uri = base_uri + "util.js";
var callback = function(data, status, xhr) {
var template = new TiddlyWeb.Tiddler("template");
template.bag = new TiddlyWeb.Bag("team4_public", host);
template.get(function(resource, status, xhr) {
applyTemplate(resource, document.body);
});
};
var applyTemplate = function(tiddler, root) {
var el = document.createElement("script"); // native method required due to faux jQuery cleverness
el = $(el).attr("type", "text/html").attr("id", "template_container").
text(tiddler.text).
text("<div> <em> <%= foo %> </em> </div>"). // XXX: DEBUG
appendTo(document.body);
tiddler.fields = { foo: "lipsum" }; // XXX: DEBUG
el.template(tiddler.fields).appendTo(root); // XXX: note that jQuery makes this fail silently if there are errors
el.remove();
};
// load dependencies (chrjs, jQuery templating method)
jQuery.getScript(chrjs_uri, function(data, status, xhr) {
jQuery.getScript(util_uri, callback);
});
})(jQuery);
modifier: None
created: 20100324100327
modified: 20100324100327
type: text/javascript
tags:
(function($) {
var host = "";
var base_uri = host + "/bags/team4_public/tiddlers/";
var chrjs_uri = base_uri + "chrjs.js";
var util_uri = base_uri + "util.js";
var callback = function(data, status, xhr) {
var template = new TiddlyWeb.Tiddler("template");
template.bag = new TiddlyWeb.Bag("team4_public", host);
template.get(function(resource, status, xhr) {
applyTemplate(resource, document.body);
});
};
var applyTemplate = function(tiddler, root) {
var el = document.createElement("script"); // native method required due to faux jQuery cleverness
el = $(el).attr("type", "text/html").attr("id", "template_container").
text(tiddler.text).
text("<div> <em> <%= foo %> </em> </div>"). // XXX: DEBUG
appendTo(document.body);
tiddler.fields = { foo: "lipsum" }; // XXX: DEBUG
el.template(tiddler.fields).appendTo(root); // XXX: note that jQuery makes this fail silently if there are errors
el.remove();
};
// load dependencies (chrjs, jQuery templating method)
jQuery.getScript(chrjs_uri, function(data, status, xhr) {
jQuery.getScript(util_uri, callback);
});
})(jQuery);
modifier: None
created: 20100324143739
modified: 20100324145712
type: text/html
tags:
<!DOCTYPE html>
<html>
<head>
<title>myOpenBritain - search</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="/bags/team4_public/tiddlers/chrjs.js" ></script>
<script src="/bags/team4_public/tiddlers/util.js" ></script>
<script>
$(function() {
var host = "";
var user = document.location.toString().split("/")[4];
var template = new TiddlyWeb.Tiddler("template");
template.bag = new TiddlyWeb.Bag("team4_public", host);
template.get(function(resource, status, xhr) {
var template = resource.text;
var profile = new TiddlyWeb.Tiddler("profile");
profile.bag = new TiddlyWeb.Recipe(user, host);
profile.get(function(resource, status, xhr) {
applyTemplate(template, resource.fields, document.body);
});
});
var applyTemplate = function(template, data, root) {
var el = document.createElement("script"); // native method required due to faux jQuery cleverness
el = $(el).attr("type", "text/html").attr("id", "template_container").
text(template).
appendTo(root);
var ctx = { // prevents ReferenceErrors
data: data
};
el = $("#myTemplate"); // XXX: DEBUG
el.template(ctx).appendTo(root);
el.remove();
};
});
</script>
</head>
<body>
<script type="text/html" id="myTemplate">
<div> name: <%= data.fn %> </div>
<div> mobility: <%= data.mobility %> </div>
<div> sight: <%= data.sight %> </div>
<div> hearing: <%= data.hearing %> </div>
</script>
</body>
</html>
modifier: GUEST
created: 20100324152941
modified: 20100325121059
type: None
tags:
!Text Input
''Foo:'' <<edit foo>>
''Bar:'' <<edit bar 5>>
!Selection
''Alpha:'' <<select alpha rows:1 foo bar baz>>
<<radio Bravo foo bar baz>>
modifier: PaulDowney
created: 20100325101814
modified: 201003251129
type: None
tags: systemConfig
/***
|''Name:''|ThemeButtonPlugin|
|''Description:''|Macro to provide a button to switch to a named theme |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/ThemeButtonPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/ThemeButtonPlugin/ |
|''Version:''|0.2|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
!!Documentation
Macro to provide a theme switch button, used as follows:
<<themeButton DefaultTheme>> {{{<<themeButton DefaultTheme>>}}}
<<themeButton DarkTheme "Dark Theme">> {{{<<themeButton DarkTheme "Dark Theme">>}}}
<<themeButton DarkTheme "Dark Theme (Again)" "switch to the Dark Theme">> {{{<<themeButton DarkTheme "Dark Theme (Again)" "switch to the Dark Theme">>}}}
A class of "selected" is provided for styling the selected button as follows:
!!StyleSheet
{{{
.themeButton.selected {
border: 5px solid red;
}
}}}
!!Code
***/
//{{{
/*jslint onevar: false nomen: false plusplus: false */
/*global jQuery config story createTiddlyButton createTiddlyElement addClass */
if (!version.extensions.ThemeButtonPlugin) {
version.extensions.ThemeButtonPlugin = {installed: true};
config.macros.themeButton = {
label: "Switch Theme",
prompt: "switch the theme"
};
config.macros.themeButton.handler = function (place, macroName, params) {
var theme = params[0];
var btn = createTiddlyButton(place, params[1] || this.label, params[2] || this.prompt,
function (ev) {
story.switchTheme(theme);
jQuery('.themeButton').removeClass('selected');
jQuery('.themeButton[theme="' + theme + '"]').addClass('selected');
return false;
});
btn.setAttribute('theme', theme);
addClass(btn, 'themeButton', theme);
if (theme === config.options.txtTheme) {
addClass(btn, 'selected');
}
};
}
//}}}
modifier: GUEST
created: 20100325101814
modified: 201003251030
type: None
tags: systemConfig
/***
|''Name:''|ThemeSwitcherPlugin|
|''Description:''|Theme Switcher|
|''Author:''|Martin Budden|
|''Source:''|http://www.martinswiki.com/#ThemeSwitcherPlugin |
|''~CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/plugins/ThemeSwitcherPlugin.js |
|''Version:''|0.0.10|
|''Status:''|Not for release - still under development|
|''Date:''|Oct 31, 2007|
|''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.3|
!!Description
This plugin defines a theme selector button that allows you to select a theme from a list of tiddlers tagged with "systemTheme".
!!Usage
Include
{{{<<selectTheme>>}}}
in any tiddler to create a select theme button.
***/
//{{{
//# Ensure that the plugin is only installed once.
if(!version.extensions.ThemeSwitcherPlugin) {
version.extensions.ThemeSwitcherPlugin = {installed:true};
config.macros.selectTheme = {
label: "select theme",
prompt: "Select the current theme"
};
config.macros.selectTheme.handler = function(place)
{
createTiddlyButton(place,this.label,this.prompt,this.onClick);
};
config.macros.selectTheme.onClick = function(ev)
{
var e = ev ? ev : window.event;
var popup = Popup.create(this);
var tiddlers = store.getTaggedTiddlers('systemTheme');
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 className = config.options.txtTheme==t ? 'selected' : null;
var btn = createTiddlyButton(createTiddlyElement(popup,'li',null,className),name ? name : t,desc ? desc : config.macros.selectTheme.label,config.macros.selectTheme.onClickTheme); btn.setAttribute('theme',t);
}
Popup.show();
return stopEvent(e);
};
config.macros.selectTheme.onClickTheme = function(ev)
{
story.switchTheme(this.getAttribute('theme'));
return false;
};
} //# end of 'install only once'
//}}}
404 Not Found: (u"TiddlyWeb not found, no tiddler for TiddlyWeb: unable to list revisions in tiddler: [Errno 2] No such file or directory: '/data/vhost/openbritain.labs.osmosoft.com/tiddlyweb/store/bags/tim/tiddlers/TiddlyWeb'",)
modifier: PaulDowney
created: 20100325085704
modified: 20100325085858
type: None
tags:
|~ViewToolbar|closeTiddler > closeOthers +editTiddler fields syncing permalink references jump|
|~EditToolbar|deleteTiddler +saveTiddler -cancelTiddler|
modifier: None
created: 20100324092329
modified: 20100324092411
type: text/javascript
tags:
(function($) {
// creates and then select elements
// useful in combination with jQuery's end method for dynamically generating
// nested elements within a chain of operations
$.fn.attach = function(html) {
return this.append(html).children(":last");
};
// appends multiple elements generated from data array
// generator function is invoked for each item; it is passed item and index as
// arguments and must return jQuery object
$.fn.multipend = function(items, generator) { // TODO: rename
return this.append($.map(items, function(item, i) {
return generator.apply(this, arguments)[0];
}));
};
// templating using "<% ... %>" (expressions) and "<%= ... %>" (values)
// adapted from John Resig and Jeremy Ashkenas (MIT License)
// http://ejohn.org/blog/javascript-micro-templating/
// http://github.com/documentcloud/underscore
$.fn.template = function(data) {
var str = this.text();
var fn = new Function("obj",
"var p=[];" +
"with(obj){p.push(\'" +
str
.replace(/[\r\t\n]/g, " ")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
.split("\t").join("');")
.split("%>").join("p.push('")
.split("\r").join("\\'") +
"');}return jQuery(p.join(''));");
return data ? fn(data) : fn;
};
})(jQuery);
modifier: None
created: 20100324092329
modified: 20100324092411
type: text/javascript
tags:
(function($) {
// creates and then select elements
// useful in combination with jQuery's end method for dynamically generating
// nested elements within a chain of operations
$.fn.attach = function(html) {
return this.append(html).children(":last");
};
// appends multiple elements generated from data array
// generator function is invoked for each item; it is passed item and index as
// arguments and must return jQuery object
$.fn.multipend = function(items, generator) { // TODO: rename
return this.append($.map(items, function(item, i) {
return generator.apply(this, arguments)[0];
}));
};
// templating using "<% ... %>" (expressions) and "<%= ... %>" (values)
// adapted from John Resig and Jeremy Ashkenas (MIT License)
// http://ejohn.org/blog/javascript-micro-templating/
// http://github.com/documentcloud/underscore
$.fn.template = function(data) {
var str = this.text();
var fn = new Function("obj",
"var p=[];" +
"with(obj){p.push(\'" +
str
.replace(/[\r\t\n]/g, " ")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
.split("\t").join("');")
.split("%>").join("p.push('")
.split("\r").join("\\'") +
"');}return jQuery(p.join(''));");
return data ? fn(data) : fn;
};
})(jQuery);
modifier: PaulDowney
created: 20100325085317
modified: 20100325085703
type: None
tags:
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
modifier: PaulDowney
created: 20100325101814
modified: 20100325102022
type: None
tags: systemConfig
/***
|''Name:''|WikifiedMessagesPlugin|
|''Description:''|Wikify displayMessage text |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/WikifiedMessagesPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/WikifiedMessagesPlugin/ |
|''Version:''|0.3|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
!!Documentation
A plugin to replace the core displayMessage function with a version which wikifies the message text.
The construction of the [close] single message and [close all] buttons has been seperated to be overrideable and the created message div is returned by displayMessage, for extensibility by other plugins.
!!Code
***/
//{{{
if(!version.extensions.WikifiedMessagesPlugin) {
version.extensions.WikifiedMessagesPlugin = {installed:true};
if(!config.extensions){
config.extensions = {};
}
config.extensions.WikifiedMessages = {
createClearAllButton: function(msgArea)
{
return (msgArea.hasChildNodes())? null :
createTiddlyButton(createTiddlyElement(msgArea,"div",null,"messageToolbar"),
config.messages.messageClose.text,
config.messages.messageClose.tooltip,
clearMessage);
},
createClearMessageButton: function(e)
{
return null;
},
getMessageDiv: function()
{
var msgArea = document.getElementById("messageArea");
var me = config.extensions.WikifiedMessages;
if(!msgArea){
return null;
}
msgArea.style.display = "block";
me.createClearAllButton(msgArea);
e = createTiddlyElement(msgArea,"div",null,"messageBox");
me.createClearMessageButton(e);
return e;
},
displayMessage: function(text,linkText)
{
var e = getMessageDiv();
if(!e) {
alert(wikifyPlain(text));
return null;
}
if(linkText) {
text = "[["+text+"|"+linkText+"]]";
}
t = createTiddlyElement(e,"span",null,"messageText");
t.innerHTML = wikifyStatic(text);
return e;
}
};
displayMessage = config.extensions.WikifiedMessages.displayMessage;
getMessageDiv = config.extensions.WikifiedMessages.getMessageDiv;
// macro, useful for testing
config.macros.DisplayMessage = {
handler: function(place,macroName,params,wikifier,paramString,tiddler){
displayMessage(paramString);
}
};
}
//}}}
modifier: None
created: 20100325125601
modified: 20100325125630
type: None
tags: xx
sddd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment