window.oldDisplayMessage = displayMessage;\ndisplayMessage = function (text,linkText)\n{ oldDisplayMessage(text,linkText);\nsetTimeout( 'clearMessage()', 5000 );\n}
/***\n|''Name:''|AlternateBackupPlugin|\n|''Version:''|1.0.1 (3-Mar-2006)|\n|''Source:''||\n|''Author:''|KyleHale|\n|''Type:''|Plugin|\n!Description\nHijacks core backupPath function, replacing the datetime naming system\nwith a rotating set of backups, whose number is limited by the user.\n\n!Issues/Todos\n* Possible to insert an option into the AdvancedOptions Tiddler? That'd\nmake editing the number of backups that much easier.\n\n!Revision History\n* 1.0.1 (3-Mar-2006)\n** Wrote code, totally stole [[Simon|SimonBaird]]'s documentation\nsystem\n\n!Code\n***/\n//{{{\nconfig.options.txtBackupFolder = "twBackups";\n\nif (!config.options.txtMaxBackups) config.options.txtMaxBackups="10";\nif (!config.options.txtCurrentBackup)\nconfig.options.txtCurrentBackup="1";\n\ngetBackupPath = function(localPath)\n{\n var backSlash = true;\n var dirPathPos = localPath.lastIndexOf("\s\s");\n if(dirPathPos == -1)\n {\n dirPathPos = localPath.lastIndexOf("/");\n backSlash = false;\n }\n var backupFolder = config.options.txtBackupFolder;\n if(!backupFolder || backupFolder == "")\n backupFolder = ".";\n var backupPath = localPath.substr(0,dirPathPos) + (backSlash ? "\s\s" :\n"/") + backupFolder + localPath.substr(dirPathPos);\n backupNum = config.options["txtCurrentBackup"];\n backupNum++;\n if (backupNum>config.options["txtMaxBackups"]) {\n backupNum=1;\n }\n backupPath = backupPath.substr(0,backupPath.lastIndexOf(".")) + "." +\nbackupNum + ".html";\n config.options["txtCurrentBackup"]=backupNum;\n saveOptionCookie("txtCurrentBackup");\n return backupPath;\n}\n\n//}}}
/***\n<!--.movietable {text-align: right;}-->\n***/\n/*{{{*/\n\n.movietable, .movietable td, .movietable tr, .movietable th,\n.movietable tbody\n { border:0px solid #000 } \n\n.movietable table {border:1px solid #3A4856}\n\n\n\n/*the margin auto for both sides, below, centers the table*/\n.movietable table {font: 100% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif; padding: 0; border-spacing:0; margin:0 auto; border-collapse: separate; color: #333; background: #F9FAFC; text-align: left;}\n\n.movietable table a, .movietable table a:visited {color: #3A4856; text-decoration: none;}\n\n.movietable table a:hover {color: #000; background: transparent; border-bottom: 1px solid #3A4856;}\n\n\n\n\n.movietable table caption {font: 150% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif; margin: 0 auto; background: #3A4856; padding: 12px 10px 4px 10px; color: #FFFFFF; }\n\n.movietable table thead th, .movietable table tbody th {background: #3A4856; padding: 10px 13px 15px 13px; color: #FFFFFF; font-weight: bold; font-size: 100%; text-align: center;}\n\n.movietable table thead th a, .movietable table thead th a:visited{color: #FFFFFF; background: transparent; text-decoration:none; border-bottom: 0px;}\n\n.movietable table thead th a:hover{color: #FFFFFF; background: transparent; text-decoration:none;}\n\n.movietable table tbody, .movietable table thead {border-left: 1px solid #EAECEE; border-right: 1px solid #EAECEE;}\n\n.movietable table tbody, .movietable tbody {border-bottom: 1px solid #EAECEE !important;}\n\n.movietable table tbody td, .movietable table tbody th {padding: 10px; background: url("http://strony.aster.pl/drsaq/td_back.gif") repeat-x;}\n\n.movietable table tbody td {padding: 10px 14px;}\n\n.movietable table tbody tr:hover td,\n.movietable table tbody tr:hover th {\n border-top: 1px solid !important; border-bottom:1px solid !important;\n border-color:#3A4856; !important;\n }\n\n.movietable tbody td,\n.movietable tbody th {\n border:1px solid #F3F5F7;\n border-width:1px 0; !important;\n }\n\n.movietable tbody tr.oddRow td {\n border:1px solid #F0F2F4;\n border-width:1px 0; !important;\n }\n\n.movietable table tbody th a, .movietable table tbody th a:visited{color: #FFFFFF; background: transparent; text-decoration:none; border-bottom: 0px}\n\n.movietable table tbody th a:hover{color: #FFFFFF; background: transparent; text-decoration:underline;}\n\n.movietable table tbody tr {background: #F9FAFC;}\n\n.movietable table tbody tr.oddRow {background: #F0F2F4;}\n\n.movietable table tbody tr:hover {background: #EAECEE; color: #111;}\n\n.movietable table tfoot td, .movietable table tfoot th, .movietable table tfoot tr {font: 120% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif; text-transform: uppercase; background: #fff; padding: 10px;}\n/*}}}*/
updated moviemanager (incomplete) with click for movierating\n return false if no rating entered, or cancelled.\n\nupdated sortit macro\n\nsetRating\n\nupdated addremove tag\n\n\nupdated moviemanger tab tiddlers with set rating\n\nupdated paramifier\n\nupdated movie tools\ntabtimeline\ntimelinehack\nautoclear message\nDropTags\nViewTemplate\nTabEditPlugin
/***\n''CheckboxPlugin for TiddlyWiki version 2.0''\n^^author: Eric Shulman\nsource: http://www.TiddlyTools.com/#CheckboxPlugin \nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nAdd checkboxes to your tiddler content. Checkbox states can be preserved in the document by either automatically modifying the tiddler content or setting/removing tags on specified tiddlers, or they may be saved as local cookies by assigning an optional 'chkID' to the checkbox. Add custom javascript for programmatic initialization and onClick handling for any checkbox. Also provides access to checkbox DOM element data and tracks the checkbox state in TiddlyWiki's config.options[] internal data.\n\n!!!!!Usage\n<<<\nThe checkbox syntax, including all optional parameters, is contained inside a matched set of [ and ] brackets.\n{{{ [x=id(title:tag){init_script}{onclick_script}] }}}\n\nAn alternative syntax lets you place the optional parameters ''outside'' the [ and ] brackets, and is provided for backward-compatibility with existing content that may include checkbox definitions based on earlier releases of this plugin:\n{{{ [x]=id(title:tag){init_script}{onclick_script} }}}\n\n//{{{\n[ ]or[_] and [x]or[X]\n//}}}\nSimple checkboxes. 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\n//{{{\n[x=id]\n//}}}\nAssign 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.\n//{{{\n[x(title:tag)]\n//}}}\nInitializes and tracks the current checkbox state by setting or removing ("TogglyTagging") a particular tag value from a specified tiddler. If you omit the tiddler title (and the ":" 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 //unselected//. When the checkbox is subsequently changed to //selected//, it will automatically (and silently) create the missing tiddler and then add the tag to it.\n//{{{\n[x{javascript}{javascript}]\n//}}}\nYou can define optional javascript code segments to add custom initialization and/or 'onClick' handling 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 the default context-object, 'this'.\n\nThe 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, so that you can perform programmed responses or intercept and override the checkbox state based on complex logic using the TW core API or custom functions defined in plugins (e.g. testing a particular tiddler title to see if certain tags are set or setting some tags when the checkbox is clicked).\n\nNote: if you want to use the default checkbox initialization processing with a custom onclick function, use this syntax: {{{ [x=id{}{javascript}] }}} \n<<<\n!!!!!Configuration\n<<<\nNormally, 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.\n*''container'': the tiddler in which the checkbox is displayed. (e.g., this tiddler)\n*''tagged'': the tiddler that is being tagged (e.g., "~MyTask" when tagging "~MyTask:done")\n*''tagging'': the "tag tiddler" (e.g., "~done" when tagging "~MyTask:done")\nYou 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):\n{{{config.checkbox.refresh = { tagged:true, tagging:true, container:true };}}}\n\nYou 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:\n{{{[_{this.refresh.container=false}]}}}\n<<<\n!!!!!Examples\n<<<\n//{{{\n[X] label\n[_] label\n//}}}\n>checked and unchecked static default values\n>[X] label\n>[_] label\n//{{{\n[_=demo] label\n//}}}\n>document-based value (id='demo', no cookie)\n>[_=demo] label\n//{{{\n[_=chkDemo] label\n//}}}\n>cookie-based value (id='chkDemo')\n>[_=chkDemo] label\n//{{{\n[_(CheckboxPlugin:demotag)]\n[_(CheckboxPlugin:demotag){this.refresh.tagged=this.refresh.container=false}]\n//}}}\n>tag-based value (TogglyTagging)\n>[_(CheckboxPlugin:demotag)] toggle 'demotag' (and refresh tiddler display)\n>[_(CheckboxPlugin:demotag){this.refresh.tagged=this.refresh.container=false}] toggle 'demotag' (no refresh)\n>current tags: <script>return store.getTiddler(story.findContainingTiddler(place).id.substr(7)).tags.toString();</script>\n><script label="click to view current tags">alert(store.getTiddler(story.findContainingTiddler(place).id.substr(7)).tags.toString());</script>\n//{{{\n[X{this.checked=true}{alert(this.checked?"on":"off")}] message box with checkbox state\n//}}}\n>custom init and onClick functions\n>[X{this.checked=true}{alert(this.checked?"on":"off")}] message box with checkbox state\nRetrieving option values:\nconfig.options['demo']=<script>return config.options['demo']?"true":"false";</script>\nconfig.options['chkDemo']=<script>return config.options['chkDemo']?"true":"false";</script>\n\n!!!!!Installation\nimport (or copy/paste) the following tiddlers into your document:\n''CheckboxPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n2006.02.25 - 2.1.0\nadded configuration options to enable/disable forced refresh of tiddlers when toggling tags\n\n2006.02.23 - 2.0.4\nwhen toggling tags, force refresh of the tiddler containing the checkbox.\n\n2006.02.23 - 2.0.3\nwhen toggling tags, force refresh of the 'tagged tiddler' so that tag-related tiddler content (such as "to-do" lists) can be re-rendered.\n\n2006.02.23 - 2.0.2\nwhen using tag-based storage, allow use [[ and ]] to quote tiddler or tag names that contain spaces:\n"""[x([[Tiddler with spaces]]:[[tag with spaces]])]"""\n\n2006.01.10 - 2.0.1\nwhen 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.\n\n2006.01.04 - 2.0.0\nupdate for ~TW2.0\n\n2005.12.27 - 1.1.2\nFix lookAhead regExp handling for """[x=id]""", which had been including the "]" in the extracted ID. \nAdded check for "chk" prefix on ID before calling saveOptionCookie()\n\n2005.12.26 - 1.1.2\nCorrected 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.\n\n2005.12.26 - 1.1.0\nRevise 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\n\n2005.12.25 - 1.0.0\nadded support for tracking checkbox state using tags ("TogglyTagging")\nRevised version number for official post-beta release.\n\n2005.12.08 - 0.9.3\nsupport separate 'init' and 'onclick' function definitions.\n\n2005.12.08 - 0.9.2\nclean up lookahead pattern\n\n2005.12.07 - 0.9.1\nonly update tiddler source content if checkbox state is actually different. Eliminates unnecessary tiddler changes (and 'unsaved changes' warnings)\n\n2005.12.07 - 0.9.0\ninitial BETA release\n<<<\n!!!!!Credits\n<<<\nThis feature was created by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.CheckboxPlugin = {major: 2, minor: 1, revision:0 , date: new Date(2006,2,25)};\n//}}}\n\n// // 1.2.x compatibility\n//{{{\nif (!window.story) window.story=window;\nif (!store.getTiddler) store.getTiddler=function(title){return store.tiddlers[title]}\nif (!store.addTiddler) store.addTiddler=function(tiddler){store.tiddlers[tiddler.title]=tiddler}\nif (!store.deleteTiddler) store.deleteTiddler=function(title){delete store.tiddlers[title]}\n//}}}\n\n//{{{\nconfig.checkbox = { refresh: { tagged:true, tagging:true, container:true } };\nconfig.formatters.push( {\n name: "checkbox",\n match: "\s\s[[xX_ ][\s\s]\s\s=\s\s(\s\s{]",\n lookahead: "\s\s[([xX_ ])(\s\s])?(=[^\s\ss\s\s(\s\s]{]+)?(\s\s([^\s\s)]*\s\s))?({[^}]*})?({[^}]*})?(\s\s])?",\n handler: function(w)\n {\n var lookaheadRegExp = new RegExp(this.lookahead,"mg");\n lookaheadRegExp.lastIndex = w.matchStart;\n var lookaheadMatch = lookaheadRegExp.exec(w.source)\n if(lookaheadMatch && lookaheadMatch.index == w.matchStart)\n {\n // get params\n var checked=lookaheadMatch[1];\n var id=lookaheadMatch[3];\n var tag=lookaheadMatch[4];\n var fn_init=lookaheadMatch[5];\n var fn_click=lookaheadMatch[6];\n // create checkbox element\n var c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick=onClickCheckbox;\n c.srcpos=w.matchStart+1; // remember location of "X"\n c.container=story.findContainingTiddler(w.output).id.substr(7); // tiddler containing checkbox\n c.refresh = { };\n c.refresh.container=config.checkbox.refresh.container;\n c.refresh.tagged=config.checkbox.refresh.tagged;\n c.refresh.tagging=config.checkbox.refresh.tagging;\n w.output.appendChild(c);\n // set default state\n c.checked=(checked.toUpperCase()=="X");\n // get/set state by ID\n if (id) {\n c.id=id.substr(1); // trim off leading "="\n if (config.options[c.id]!=undefined)\n c.checked=config.options[c.id];\n else\n config.options[c.id]=c.checked;\n }\n // get/set state by tag\n if (tag) {\n c.tiddler=c.container;\n c.tag=tag.substr(1,tag.length-2).trim(); // trim off parentheses\n var pos=c.tag.indexOf(":");\n if (pos==0) { c.tag=tag.substr(1); }\n if (pos>0) { c.tiddler=c.tag.substr(0,pos).replace(/\s[\s[/g,"").replace(/\s]\s]/g,""); c.tag=c.tag.substr(pos+1); }\n c.tag.replace(/\s[\s[/g,"").replace(/\s]\s]/g,"");\n if (!c.tag.length) c.tag="checked";\n var t=store.getTiddler(c.tiddler);\n c.checked = (t && t.tags)?(t.tags.find(c.tag)!=null):false;\n }\n if (fn_init) c.fn_init=fn_init.trim().substr(1,fn_init.length-2); // trim off surrounding { and } delimiters\n if (fn_click) c.fn_click=fn_click.trim().substr(1,fn_click.length-2);\n c.init=true; c.onclick(); c.init=false; // compute initial state and save in tiddler/config/cookie\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n }\n)\n//}}}\n\n//{{{\nfunction onClickCheckbox()\n{\n if (this.fn_init)\n // custom function hook to set initial state (run only once)\n { try { eval(this.fn_init); this.fn_init=null; } catch(e) { displayMessage("Checkbox init error: "+e.toString()); } }\n else if (this.fn_click)\n // custom function hook to override or react to changes in checkbox state\n { try { eval(this.fn_click) } catch(e) { displayMessage("Checkbox click error: "+e.toString()); } }\n if (this.id)\n // save state in config AND cookie (only when ID starts with 'chk')\n { config.options[this.id]=this.checked; if (this.id.substr(0,3)=="chk") saveOptionCookie(this.id); }\n if ((!this.id || this.id.substr(0,3)!="chk") && !this.tag) {\n // save state in tiddler content only if not using cookie or tag tracking\n var t=store.getTiddler(story.findContainingTiddler(this).id.substr(7));\n if (this.checked!=(t.text.substr(this.srcpos,1).toUpperCase()=="X")) { // if changed\n t.set(null,t.text.substr(0,this.srcpos)+(this.checked?"X":"_")+t.text.substr(this.srcpos+1),null,null,t.tags);\n store.setDirty(true);\n }\n }\n if (this.tag) {\n var t=store.getTiddler(this.tiddler);\n if (!t) { t=(new Tiddler()); t.set(this.tiddler,"",config.options.txtUserName,(new Date()),null); store.addTiddler(t); } \n var tagged=(t.tags && t.tags.find(this.tag)!=null);\n if (this.checked && !tagged) { t.tags.push(this.tag); store.setDirty(true); }\n if (!this.checked && tagged) { t.tags.splice(t.tags.find(this.tag),1); store.setDirty(true); }\n // if tag state has been changed, force a display update\n if (this.checked!=tagged) {\n if (this.refresh.tagged) story.refreshTiddler(this.tiddler,null,true); // the TAGGED tiddler\n if (this.refresh.tagging) story.refreshTiddler(this.tag,null,true); // the TAGGING tiddler\n }\n }\n // refresh containing tiddler (but not during initial rendering, or we get an infinite loop!)\n if (!this.init && this.refresh.container && this.container!=this.tiddler)\n story.refreshTiddler(this.container,null,true); // the tiddler CONTAINING the checkbox\n return true;\n}\n//}}}
config.checkbox.refresh = { tagged:true, tagging:true, container:false };
/***\n|''Name:''|DataTiddlerPlugin|\n|''Version:''|1.0.4 (2006-02-05)|\n|''Source:''|http://tiddlywiki.abego-software.de/#DataTiddlerPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license]]|\n|''TiddlyWiki:''|1.2.38+, 2.0|\n|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|\n!Description\nEnhance your tiddlers with structured data (such as strings, booleans, numbers, or even arrays and compound objects) that can be easily accessed and modified through named fields (in JavaScript code).\n\nSuch tiddler data can be used in various applications. E.g. you may create tables that collect data from various tiddlers. \n\n''//Example: "Table with all December Expenses"//''\n{{{\n<<forEachTiddler\n where\n 'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'\n write\n '"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\sn"'\n>>\n}}}\n//(This assumes that expenses are stored in tiddlers tagged with "expense".)//\n<<forEachTiddler\n where\n 'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'\n write\n '"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\sn"'\n>>\nFor other examples see DataTiddlerExamples.\n\n\n\n\n''Access and Modify Tiddler Data''\n\nYou can "attach" data to every tiddler by assigning a JavaScript value (such as a string, boolean, number, or even arrays and compound objects) to named fields. \n\nThese values can be accessed and modified through the following Tiddler methods:\n|!Method|!Example|!Description|\n|{{{data(field)}}}|{{{t.data("age")}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|\n|{{{data(field,defaultValue)}}}|{{{t.data("isVIP",false)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|\n|{{{data()}}}|{{{t.data()}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|\n|{{{setData(field,value)}}}|{{{t.setData("age",42)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|\n|{{{setData(field,value,defaultValue)}}}|{{{t.setData("isVIP",flag,false)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|\n\nAlternatively you may use the following functions to access and modify the data. In this case the tiddler argument is either a tiddler or the name of a tiddler.\n|!Method|!Description|\n|{{{DataTiddler.getData(tiddler,field)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|\n|{{{DataTiddler.getData(tiddler,field,defaultValue)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|\n|{{{DataTiddler.getDataObject(tiddler)}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|\n|{{{DataTiddler.setData(tiddler,field,value)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|\n|{{{DataTiddler.setData(tiddler,field,value,defaultValue)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|\n//(For details on the various functions see the detailed comments in the source code.)//\n\n\n''Data Representation in a Tiddler''\n\nThe data of a tiddler is stored as plain text in the tiddler's content/text, inside a "data" section that is framed by a {{{<data>...</data>}}} block. Inside the data section the information is stored in the [[JSON format|http://www.crockford.com/JSON/index.html]]. \n\n//''Data Section Example:''//\n{{{\n<data>{"isVIP":true,"user":"John Brown","age":34}</data>\n}}}\n\nThe data section is not displayed when viewing the tiddler (see also "The showData Macro").\n\nBeside the data section a tiddler may have all kind of other content.\n\nTypically you will not access the data section text directly but use the methods given above. Nevertheless you may retrieve the text of the data section's content through the {{{DataTiddler.getDataText(tiddler)}}} function.\n\n\n''Saving Changes''\n\nThe "setData" methods respect the "ForceMinorUpdate" and "AutoSave" configuration values. I.e. when "ForceMinorUpdate" is true changing a value using setData will not affect the "modifier" and "modified" attributes. With "AutoSave" set to true every setData will directly save the changes after a setData.\n\n\n''Notifications''\n\nNo notifications are sent when a tiddler's data value is changed through the "setData" methods. \n\n''Escape Data Section''\nIn case that you want to use the text {{{<data>}}} or {{{</data>}}} in a tiddler text you must prefix the text with a tilde ('~'). Otherwise it may be wrongly considered as the data section. The tiddler text {{{~<data>}}} is displayed as {{{<data>}}}.\n\n\n''The showData Macro''\n\nBy default the data of a tiddler (that is stored in the {{{<data>...</data>}}} section of the tiddler) is not displayed. If you want to display this data you may used the {{{<<showData ...>>}}} macro:\n\n''Syntax:'' \n|>|{{{<<}}}''showData '' [''JSON''] [//tiddlerName//] {{{>>}}}|\n|''JSON''|By default the data is rendered as a table with a "Name" and "Value" column. When defining ''JSON'' the data is rendered in JSON format|\n|//tiddlerName//|Defines the tiddler holding the data to be displayed. When no tiddler is given the tiddler containing the showData macro is used. When the tiddler name contains spaces you must quote the name (or use the {{{[[...]]}}} syntax.)|\n|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|\n\n\n!Revision history\n* v1.0.4 (2006-02-05)\n** Bugfix: showData fails in TiddlyWiki 2.0\n* v1.0.3 (2006-01-06)\n** Support TiddlyWiki 2.0\n* v1.0.2 (2005-12-22)\n** Enhancements:\n*** Handle texts "<data>" or "</data>" more robust when used in a tiddler text or as a field value.\n*** Improved (JSON) error messages.\n** Bugs fixed: \n*** References are not updated when using the DataTiddler.\n*** Changes to compound objects are not always saved.\n*** "~</data>" is not rendered correctly (expected "</data>")\n* v1.0.1 (2005-12-13)\n** Features: \n*** The showData macro supports an optional "tiddlername" argument to specify the tiddler containing the data to be displayed\n** Bugs fixed: \n*** A script immediately following a data section is deleted when the data is changed. (Thanks to GeoffS for reporting.)\n* v1.0.0 (2005-12-12)\n** initial version\n\n!Code\n***/\n//{{{\n//============================================================================\n//============================================================================\n// DataTiddlerPlugin\n//============================================================================\n//============================================================================\n\n// Ensure that the DataTiddler Plugin is only installed once.\n//\nif (!version.extensions.DataTiddlerPlugin) {\n\n\n\nversion.extensions.DataTiddlerPlugin = {\n major: 1, minor: 0, revision: 4,\n date: new Date(2006, 2, 5), \n type: 'plugin',\n source: "http://tiddlywiki.abego-software.de/#DataTiddlerPlugin"\n};\n\n// For backward compatibility with v1.2.x\n//\nif (!window.story) window.story=window; \nif (!TiddlyWiki.prototype.getTiddler) TiddlyWiki.prototype.getTiddler = function(title) { return t = this.tiddlers[title]; return (t != undefined && t instanceof Tiddler) ? t : null; } \n\n//============================================================================\n// DataTiddler Class\n//============================================================================\n\n// ---------------------------------------------------------------------------\n// Configurations and constants \n// ---------------------------------------------------------------------------\n\nfunction DataTiddler() {\n}\n\nDataTiddler = {\n // Function to stringify a JavaScript value, producing the text for the data section content.\n // (Must match the implementation of DataTiddler.parse.)\n //\n stringify : null,\n \n\n // Function to parse the text for the data section content, producing a JavaScript value.\n // (Must match the implementation of DataTiddler.stringify.)\n //\n parse : null\n};\n\n// Ensure access for IE\nwindow.DataTiddler = DataTiddler;\n\n// ---------------------------------------------------------------------------\n// Data Accessor and Mutator\n// ---------------------------------------------------------------------------\n\n\n// Returns the value of the given data field of the tiddler.\n// When no such field is defined or its value is undefined\n// the defaultValue is returned.\n// \n// @param tiddler either a tiddler name or a tiddler\n//\nDataTiddler.getData = function(tiddler, field, defaultValue) {\n var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;\n if (!(t instanceof Tiddler)) {\n throw "Tiddler expected. Got "+tiddler;\n }\n\n return DataTiddler.getTiddlerDataValue(t, field, defaultValue);\n}\n\n\n// Sets the value of the given data field of the tiddler to\n// the value. When the value is equal to the defaultValue\n// no value is set (and the field is removed)\n//\n// Changing data of a tiddler will not trigger notifications.\n// \n// @param tiddler either a tiddler name or a tiddler\n//\nDataTiddler.setData = function(tiddler, field, value, defaultValue) {\n var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;\n if (!(t instanceof Tiddler)) {\n throw "Tiddler expected. Got "+tiddler+ "("+t+")";\n }\n\n DataTiddler.setTiddlerDataValue(t, field, value, defaultValue);\n}\n\n\n// Returns the data object of the tiddler, with a property for every field.\n//\n// The properties of the returned data object may only be read and\n// not be modified. To modify the data use DataTiddler.setData(...) \n// or the corresponding Tiddler method.\n//\n// If no data section is defined a new (empty) object is returned.\n//\n// @param tiddler either a tiddler name or a Tiddler\n//\nDataTiddler.getDataObject = function(tiddler) {\n var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;\n if (!(t instanceof Tiddler)) {\n throw "Tiddler expected. Got "+tiddler;\n }\n\n return DataTiddler.getTiddlerDataObject(t);\n}\n\n// Returns the text of the content of the data section of the tiddler.\n//\n// When no data section is defined for the tiddler null is returned \n//\n// @param tiddler either a tiddler name or a Tiddler\n// @return [may be null]\n//\nDataTiddler.getDataText = function(tiddler) {\n var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;\n if (!(t instanceof Tiddler)) {\n throw "Tiddler expected. Got "+tiddler;\n }\n\n return DataTiddler.readDataSectionText(t);\n}\n\n\n// ---------------------------------------------------------------------------\n// Internal helper methods (must not be used by code from outside this plugin)\n// ---------------------------------------------------------------------------\n\n// Internal.\n//\n// The original JSONError is not very user friendly, \n// especially it does not define a toString() method\n// Therefore we extend it here.\n//\nDataTiddler.extendJSONError = function(ex) {\n if (ex.name == 'JSONError') {\n ex.toString = function() {\n return ex.name + ": "+ex.message+" ("+ex.text+")";\n }\n }\n return ex;\n}\n\n// Internal.\n//\n// @param t a Tiddler\n//\nDataTiddler.getTiddlerDataObject = function(t) {\n if (t.dataObject == undefined) {\n var data = DataTiddler.readData(t);\n t.dataObject = (data) ? data : {};\n }\n \n return t.dataObject;\n}\n\n\n// Internal.\n//\n// @param tiddler a Tiddler\n//\nDataTiddler.getTiddlerDataValue = function(tiddler, field, defaultValue) {\n var value = DataTiddler.getTiddlerDataObject(tiddler)[field];\n return (value == undefined) ? defaultValue : value;\n}\n\n\n// Internal.\n//\n// @param tiddler a Tiddler\n//\nDataTiddler.setTiddlerDataValue = function(tiddler, field, value, defaultValue) {\n var data = DataTiddler.getTiddlerDataObject(tiddler);\n var oldValue = data[field];\n \n if (value == defaultValue) {\n if (oldValue != undefined) {\n delete data[field];\n DataTiddler.save(tiddler);\n }\n return;\n }\n data[field] = value;\n DataTiddler.save(tiddler);\n}\n\n// Internal.\n//\n// Reads the data section from the tiddler's content and returns its text\n// (as a String).\n//\n// Returns null when no data is defined.\n//\n// @param tiddler a Tiddler\n// @return [may be null]\n//\nDataTiddler.readDataSectionText = function(tiddler) {\n var matches = DataTiddler.getDataTiddlerMatches(tiddler);\n if (matches == null || !matches[2]) {\n return null;\n }\n return matches[2];\n}\n\n// Internal.\n//\n// Reads the data section from the tiddler's content and returns it\n// (as an internalized object).\n//\n// Returns null when no data is defined.\n//\n// @param tiddler a Tiddler\n// @return [may be null]\n//\nDataTiddler.readData = function(tiddler) {\n var text = DataTiddler.readDataSectionText(tiddler);\n try {\n return text ? DataTiddler.parse(text) : null;\n } catch(ex) {\n throw DataTiddler.extendJSONError(ex);\n }\n}\n\n// Internal.\n// \n// Returns the serialized text of the data of the given tiddler, as it\n// should be stored in the data section.\n//\n// @param tiddler a Tiddler\n//\nDataTiddler.getDataTextOfTiddler = function(tiddler) {\n var data = DataTiddler.getTiddlerDataObject(tiddler);\n return DataTiddler.stringify(data);\n}\n\n\n// Internal.\n// \nDataTiddler.indexOfNonEscapedText = function(s, subString, startIndex) {\n var index = s.indexOf(subString, startIndex);\n while ((index > 0) && (s[index-1] == '~')) { \n index = s.indexOf(subString, index+1);\n }\n return index;\n}\n\n// Internal.\n//\nDataTiddler.getDataSectionInfo = function(text) {\n // Special care must be taken to handle "<data>" and "</data>" texts inside\n // a data section. \n // Also take care not to use an escaped <data> (i.e. "~<data>") as the start \n // of a data section. (Same for </data>)\n\n // NOTE: we are explicitly searching for a data section that contains a JSON\n // string, i.e. framed with braces. This way we are little bit more robust in\n // case the tiddler contains unescaped texts "<data>" or "</data>". This must\n // be changed when using a different stringifier.\n\n var startTagText = "<data>{";\n var endTagText = "}</data>";\n\n var startPos = 0;\n\n // Find the first not escaped "<data>".\n var startDataTagIndex = DataTiddler.indexOfNonEscapedText(text, startTagText, 0);\n if (startDataTagIndex < 0) {\n return null;\n }\n\n // Find the *last* not escaped "</data>".\n var endDataTagIndex = text.indexOf(endTagText, startDataTagIndex);\n if (endDataTagIndex < 0) {\n return null;\n }\n var nextEndDataTagIndex;\n while ((nextEndDataTagIndex = text.indexOf(endTagText, endDataTagIndex+1)) >= 0) {\n endDataTagIndex = nextEndDataTagIndex;\n };\n\n return {\n prefixEnd: startDataTagIndex, \n dataStart: startDataTagIndex+(startTagText.length)-1, \n dataEnd: endDataTagIndex, \n suffixStart: endDataTagIndex+(endTagText.length)\n };\n}\n\n// Internal.\n// \n// Returns the "matches" of a content of a DataTiddler on the\n// "data" regular expression. Return null when no data is defined\n// in the tiddler content.\n//\n// Group 1: text before data section (prefix)\n// Group 2: content of data section\n// Group 3: text behind data section (suffix)\n//\n// @param tiddler a Tiddler\n// @return [may be null] null when the tiddler contains no data section, otherwise see above.\n//\nDataTiddler.getDataTiddlerMatches = function(tiddler) {\n var text = tiddler.text;\n var info = DataTiddler.getDataSectionInfo(text);\n if (!info) {\n return null;\n }\n\n var prefix = text.substr(0,info.prefixEnd);\n var data = text.substr(info.dataStart, info.dataEnd-info.dataStart+1);\n var suffix = text.substr(info.suffixStart);\n \n return [text, prefix, data, suffix];\n}\n\n\n// Internal.\n//\n// Saves the data in a <data> block of the given tiddler (as a minor change). \n//\n// The "chkAutoSave" and "chkForceMinorUpdate" options are respected. \n// I.e. the TiddlyWiki *file* is only saved when AutoSave is on.\n//\n// Notifications are not send. \n//\n// This method should only be called when the data really has changed. \n//\n// @param tiddler\n// the tiddler to be saved.\n//\nDataTiddler.save = function(tiddler) {\n\n var matches = DataTiddler.getDataTiddlerMatches(tiddler);\n\n var prefix;\n var suffix;\n if (matches == null) {\n prefix = tiddler.text;\n suffix = "";\n } else {\n prefix = matches[1];\n suffix = matches[3];\n }\n\n var dataText = DataTiddler.getDataTextOfTiddler(tiddler);\n var newText = \n (dataText != null) \n ? prefix + "<data>" + dataText + "</data>" + suffix\n : prefix + suffix;\n if (newText != tiddler.text) {\n // make the change in the tiddlers text\n \n // ... see DataTiddler.MyTiddlerChangedFunction\n tiddler.isDataTiddlerChange = true;\n \n // ... do the action change\n tiddler.set(\n tiddler.title,\n newText,\n config.options.txtUserName, \n config.options.chkForceMinorUpdate? undefined : new Date(),\n tiddler.tags);\n\n // ... see DataTiddler.MyTiddlerChangedFunction\n delete tiddler.isDataTiddlerChange;\n\n // Mark the store as dirty.\n store.dirty = true;\n \n // AutoSave if option is selected\n if(config.options.chkAutoSave) {\n saveChanges();\n }\n }\n}\n\n// Internal.\n//\nDataTiddler.MyTiddlerChangedFunction = function() {\n // Remove the data object from the tiddler when the tiddler is changed\n // by code other than DataTiddler code. \n //\n // This is necessary since the data object is just a "cached version" \n // of the data defined in the data section of the tiddler and the \n // "external" change may have changed the content of the data section.\n // Thus we are not sure if the data object reflects the data section \n // contents. \n // \n // By deleting the data object we ensure that the data object is \n // reconstructed the next time it is needed, with the data defined by\n // the data section in the tiddler's text.\n \n // To indicate that a change is a "DataTiddler change" a temporary\n // property "isDataTiddlerChange" is added to the tiddler.\n if (this.dataObject && !this.isDataTiddlerChange) {\n delete this.dataObject;\n }\n \n // call the original code.\n DataTiddler.originalTiddlerChangedFunction.apply(this, arguments);\n}\n\n\n//============================================================================\n// Formatters\n//============================================================================\n\n// This formatter ensures that "~<data>" is rendered as "<data>". This is used to \n// escape the "<data>" of a data section, just in case someone really wants to use\n// "<data>" as a text in a tiddler and not start a data section.\n//\n// Same for </data>.\n//\nconfig.formatters.push( {\n name: "data-escape",\n match: "~<\s\s/?data>",\n\n handler: function(w) {\n w.outputText(w.output,w.matchStart + 1,w.nextMatch);\n }\n} )\n\n\n// This formatter ensures that <data>...</data> sections are not rendered.\n//\nconfig.formatters.push( {\n name: "data",\n match: "<data>",\n\n handler: function(w) {\n var info = DataTiddler.getDataSectionInfo(w.source);\n if (info && info.prefixEnd == w.matchStart) {\n w.nextMatch = info.suffixStart;\n } else {\n w.outputText(w.output,w.matchStart,w.nextMatch);\n }\n }\n} )\n\n\n//============================================================================\n// Tiddler Class Extension\n//============================================================================\n\n// "Hijack" the changed method ---------------------------------------------------\n\nDataTiddler.originalTiddlerChangedFunction = Tiddler.prototype.changed;\nTiddler.prototype.changed = DataTiddler.MyTiddlerChangedFunction;\n\n// Define accessor methods -------------------------------------------------------\n\n// Returns the value of the given data field of the tiddler. When no such field \n// is defined or its value is undefined the defaultValue is returned.\n//\n// When field is undefined (or null) the data object is returned. (See \n// DataTiddler.getDataObject.)\n//\n// @param field [may be null, undefined]\n// @param defaultValue [may be null, undefined]\n// @return [may be null, undefined]\n//\nTiddler.prototype.data = function(field, defaultValue) {\n return (field) \n ? DataTiddler.getTiddlerDataValue(this, field, defaultValue)\n : DataTiddler.getTiddlerDataObject(this);\n}\n\n// Sets the value of the given data field of the tiddler to the value. When the \n// value is equal to the defaultValue no value is set (and the field is removed).\n//\n// @param value [may be null, undefined]\n// @param defaultValue [may be null, undefined]\n//\nTiddler.prototype.setData = function(field, value, defaultValue) {\n DataTiddler.setTiddlerDataValue(this, field, value, defaultValue);\n}\n\n\n//============================================================================\n// showData Macro\n//============================================================================\n\nconfig.macros.showData = {\n // Standard Properties\n label: "showData",\n prompt: "Display the values stored in the data section of the tiddler"\n}\n\nconfig.macros.showData.handler = function(place,macroName,params) {\n // --- Parsing ------------------------------------------\n\n var i = 0; // index running over the params\n // Parse the optional "JSON"\n var showInJSONFormat = false;\n if ((i < params.length) && params[i] == "JSON") {\n i++;\n showInJSONFormat = true;\n }\n \n var tiddlerName = story.findContainingTiddler(place).id.substr(7);\n if (i < params.length) {\n tiddlerName = params[i]\n i++;\n }\n\n // --- Processing ------------------------------------------\n try {\n if (showInJSONFormat) {\n this.renderDataInJSONFormat(place, tiddlerName);\n } else {\n this.renderDataAsTable(place, tiddlerName);\n }\n } catch (e) {\n this.createErrorElement(place, e);\n }\n}\n\nconfig.macros.showData.renderDataInJSONFormat = function(place,tiddlerName) {\n var text = DataTiddler.getDataText(tiddlerName);\n if (text) {\n createTiddlyElement(place,"pre",null,null,text);\n }\n}\n\nconfig.macros.showData.renderDataAsTable = function(place,tiddlerName) {\n var text = "|!Name|!Value|\sn";\n var data = DataTiddler.getDataObject(tiddlerName);\n if (data) {\n for (var i in data) {\n var value = data[i];\n text += "|"+i+"|"+DataTiddler.stringify(value)+"|\sn";\n }\n }\n \n wikify(text, place);\n}\n\n\n// Internal.\n//\n// Creates an element that holds an error message\n// \nconfig.macros.showData.createErrorElement = function(place, exception) {\n var message = (exception.description) ? exception.description : exception.toString();\n return createTiddlyElement(place,"span",null,"showDataError","<<showData ...>>: "+message);\n}\n\n// ---------------------------------------------------------------------------\n// Stylesheet Extensions (may be overridden by local StyleSheet)\n// ---------------------------------------------------------------------------\n//\nsetStylesheet(\n ".showDataError{color: #ffffff;background-color: #880000;}",\n "showData");\n\n\n} // of "install only once"\n//}}}\n\n\n\n/***\n!JSON Code, used to serialize the data\n//(embedded in the plugin tiddler to make it selfcontained)//\n***/\n//{{{\n/*\nCopyright (c) 2005 JSON.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe Software shall be used for Good, not Evil.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\n/*\n The global object JSON contains two methods.\n\n JSON.stringify(value) takes a JavaScript value and produces a JSON text.\n The value must not be cyclical.\n\n JSON.parse(text) takes a JSON text and produces a JavaScript value. It will\n throw a 'JSONError' exception if there is an error.\n*/\nvar JSON = {\n copyright: '(c)2005 JSON.org',\n license: 'http://www.crockford.com/JSON/license.html',\n/*\n Stringify a JavaScript value, producing a JSON text.\n*/\n stringify: function (v) {\n var a = [];\n\n/*\n Emit a string.\n*/\n function e(s) {\n a[a.length] = s;\n }\n\n/*\n Convert a value.\n*/\n function g(x) {\n var c, i, l, v;\n\n switch (typeof x) {\n case 'object':\n if (x) {\n if (x instanceof Array) {\n e('[');\n l = a.length;\n for (i = 0; i < x.length; i += 1) {\n v = x[i];\n if (typeof v != 'undefined' &&\n typeof v != 'function') {\n if (l < a.length) {\n e(',');\n }\n g(v);\n }\n }\n e(']');\n return;\n } else if (typeof x.toString != 'undefined') {\n e('{');\n l = a.length;\n for (i in x) {\n v = x[i];\n if (x.hasOwnProperty(i) &&\n typeof v != 'undefined' &&\n typeof v != 'function') {\n if (l < a.length) {\n e(',');\n }\n g(i);\n e(':');\n g(v);\n }\n }\n return e('}');\n }\n }\n e('null');\n return;\n case 'number':\n e(isFinite(x) ? +x : 'null');\n return;\n case 'string':\n l = x.length;\n e('"');\n for (i = 0; i < l; i += 1) {\n c = x.charAt(i);\n if (c >= ' ') {\n if (c == '\s\s' || c == '"') {\n e('\s\s');\n }\n e(c);\n } else {\n switch (c) {\n case '\sb':\n e('\s\sb');\n break;\n case '\sf':\n e('\s\sf');\n break;\n case '\sn':\n e('\s\sn');\n break;\n case '\sr':\n e('\s\sr');\n break;\n case '\st':\n e('\s\st');\n break;\n default:\n c = c.charCodeAt();\n e('\s\su00' + Math.floor(c / 16).toString(16) +\n (c % 16).toString(16));\n }\n }\n }\n e('"');\n return;\n case 'boolean':\n e(String(x));\n return;\n default:\n e('null');\n return;\n }\n }\n g(v);\n return a.join('');\n },\n/*\n Parse a JSON text, producing a JavaScript value.\n*/\n parse: function (text) {\n var p = /^\ss*(([,:{}\s[\s]])|"(\s\s.|[^\sx00-\sx1f"\s\s])*"|-?\sd+(\s.\sd*)?([eE][+-]?\sd+)?|true|false|null)\ss*/,\n token,\n operator;\n\n function error(m, t) {\n throw {\n name: 'JSONError',\n message: m,\n text: t || operator || token\n };\n }\n\n function next(b) {\n if (b && b != operator) {\n error("Expected '" + b + "'");\n }\n if (text) {\n var t = p.exec(text);\n if (t) {\n if (t[2]) {\n token = null;\n operator = t[2];\n } else {\n operator = null;\n try {\n token = eval(t[1]);\n } catch (e) {\n error("Bad token", t[1]);\n }\n }\n text = text.substring(t[0].length);\n } else {\n error("Unrecognized token", text);\n }\n } else {\n token = operator = undefined;\n }\n }\n\n\n function val() {\n var k, o;\n switch (operator) {\n case '{':\n next('{');\n o = {};\n if (operator != '}') {\n for (;;) {\n if (operator || typeof token != 'string') {\n error("Missing key");\n }\n k = token;\n next();\n next(':');\n o[k] = val();\n if (operator != ',') {\n break;\n }\n next(',');\n }\n }\n next('}');\n return o;\n case '[':\n next('[');\n o = [];\n if (operator != ']') {\n for (;;) {\n o.push(val());\n if (operator != ',') {\n break;\n }\n next(',');\n }\n }\n next(']');\n return o;\n default:\n if (operator !== null) {\n error("Missing value");\n }\n k = token;\n next();\n return k;\n }\n }\n next();\n return val();\n }\n};\n//}}}\n/***\n!Setup the data serialization\n***/\n//{{{\nDataTiddler.format = "JSON";\nDataTiddler.stringify = JSON.stringify;\nDataTiddler.parse = JSON.parse;\n\n//}}}\n\n
/***\n|''Name:''|''dropTags''|\n|''Version:''|0.5 (12-May-2006)|\n|''Created by:''|SaqImtiaz|\n|''Location:''|http://lewcid.googlepages.com/lewcid.html#DropTagsMacro|\n|''Description:''|provides a drop down list of tags in the current tiddler,<<br>> a replacement for the core tags macro.|\n|''Documentation:''|DropTagsMacroDocumentation |\n|''Source Code:''|DropTagsMacroSource |\n|''Requires:''|~TW2.07|\n\n***/\n// /%\nconfig.macros.dropTags={};config.macros.dropTags.dropdownchar=(document.all?"▼":"▾");config.macros.dropTags.handler=function(_1,_2,_3,_4,_5,_6){var _7=config.macros.dropTags.dropdownchar;var _8=(_3[0]&&_3[0]!=".")?_3[0]+_7:"tags"+_7;var _9="current tags for this tiddler";var _a=function(e){if(!e){var e=window.event;}var _d=Popup.create(this);var _e=config.views.wikified.tag;if(_6.tags.length==0){createTiddlyElement(_d,"li",null,"listTitle",_e.labelNoTags);}else{for(var t=0;t<_6.tags.length;t++){createTagButton(createTiddlyElement(_d,"li"),_6.tags[t],_6.title);}}if(version.extensions.IntelliTaggerPlugin){createTiddlyElement(createTiddlyElement(_d,"li"),"hr");abego.IntelliTagger.createEditTagsButton(_6,createTiddlyElement(_d,"li"),"[IntelliEdit]","Edit tags with Intellitagger");}Popup.show(_d,false);e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}return (false);};createTiddlyButton(_1,_8,_8,_a,"button","dropTagBtn");};setStylesheet(".popup .highlight{background: #fe8; color:#000;}\sn"+"#nestedtagger {background:#2E5ADF; border: 1px solid #0331BF;}\sn"+"","DropTagsStyles");if(!config.macros.tagger){window.onClickTag=function(e){if(!e){var e=window.event;}var _12=resolveTarget(e);var _13=(!isNested(_12));if((Popup.stack.length>1)&&(_13==true)){Popup.removeFrom(1);}else{if(Popup.stack.length>0&&_13==false){Popup.removeFrom(0);}}var _14=(_13==false)?"popup":"nestedtagger";var _15=createTiddlyElement(document.body,"ol",_14,"popup",null);Popup.stack.push({root:this,popup:_15});var tag=this.getAttribute("tag");var _17=this.getAttribute("tiddler");if(_15&&tag){var _18=store.getTaggedTiddlers(tag);var _19=[];var li,r;for(r=0;r<_18.length;r++){if(_18[r].title!=_17){_19.push(_18[r].title);}}var _1b=config.views.wikified.tag;if(_19.length>0){var _1c=createTiddlyButton(createTiddlyElement(_15,"li"),_1b.openAllText.format([tag]),_1b.openAllTooltip,onClickTagOpenAll);_1c.setAttribute("tag",tag);createTiddlyElement(createTiddlyElement(_15,"li"),"hr");for(r=0;r<_19.length;r++){createTiddlyLink(createTiddlyElement(_15,"li"),_19[r],true);}}else{createTiddlyText(createTiddlyElement(_15,"li",null,"disabled"),_1b.popupNone.format([tag]));}createTiddlyElement(createTiddlyElement(_15,"li"),"hr");var h=createTiddlyLink(createTiddlyElement(_15,"li"),tag,false);createTiddlyText(h,_1b.openTag.format([tag]));}Popup.show(_15,false);e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}return (false);};}if(!window.isNested){window.isNested=function(e){while(e!=null){var _1f=document.getElementById("contentWrapper");if(_1f==e){return true;}e=e.parentNode;}return false;};};config.shadowTiddlers.DropTagsMacroDocumentation="The documentation is available [[here.|http://lewcid.googlepages.com/lewcid.html#DropTagsMacroDocumentation]]";config.shadowTiddlers.DropTagsMacroSource="The documentation is available [[here.|http://lewcid.googlepages.com/lewcid.html#DropTagsMacroDocumentation]]";\n// %/
/***\n|''Name:''|ForEachTiddlerPlugin|\n|''Version:''|1.0.5 (2006-02-05)|\n|''Source:''|http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license]]|\n|''Macros:''|[[ForEachTiddlerMacro]] v1.0.5|\n|''TiddlyWiki:''|1.2.38+, 2.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n!Description\n\nCreate customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.\n\n''Syntax:'' \n|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|\n|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|\n|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|\n|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|\n|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|\n|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]] is used.|\n|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|\n|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|\n\nSee details see [[ForEachTiddlerMacro]] and [[ForEachTiddlerExamples]].\n\n!Revision history\n* v1.0.5\n** Pass tiddler containing the macro with wikify, context object also holds reference to tiddler containing the macro ("inTiddler"). Thanks to SimonBaird.\n** Support Firefox 1.5.0.1\n** Internal\n*** Make "JSLint" conform\n*** "Only install once"\n* v1.0.4 (2006-01-06)\n** Support TiddlyWiki 2.0\n* v1.0.3 (2005-12-22)\n** Features: \n*** Write output to a file supports multi-byte environments (Thanks to Bram Chen) \n*** Provide API to access the forEachTiddler functionality directly through JavaScript (see getTiddlers and performMacro)\n** Enhancements:\n*** Improved error messages on InternetExplorer.\n* v1.0.2 (2005-12-10)\n** Features: \n*** context object also holds reference to store (TiddlyWiki)\n** Fixed Bugs: \n*** ForEachTiddler 1.0.1 has broken support on win32 Opera 8.51 (Thanks to BrunoSabin for reporting)\n* v1.0.1 (2005-12-08)\n** Features: \n*** Access tiddlers stored in separated TiddlyWikis through the "in" option. I.e. you are no longer limited to only work on the "current TiddlyWiki".\n*** Write output to an external file using the "toFile" option of the "write" action. With this option you may write your customized tiddler exports.\n*** Use the "script" section to define "helper" JavaScript functions etc. to be used in the various JavaScript expressions (whereClause, sortClause, action arguments,...).\n*** Access and store context information for the current forEachTiddler invocation (through the build-in "context" object) .\n*** Improved script evaluation (for where/sort clause and write scripts).\n* v1.0.0 (2005-11-20)\n** initial version\n\n!Code\n***/\n//{{{\n\n \n//============================================================================\n//============================================================================\n// ForEachTiddlerPlugin\n//============================================================================\n//============================================================================\n\n// Only install once\nif (!version.extensions.ForEachTiddlerPlugin) {\n\nversion.extensions.ForEachTiddlerPlugin = {major: 1, minor: 0, revision: 5, date: new Date(2006,2,5), source: "http://tiddlywiki.abego-software.de/#ForEachTiddlergPlugin"};\n\n// For backward compatibility with TW 1.2.x\n//\nif (!TiddlyWiki.prototype.forEachTiddler) {\n TiddlyWiki.prototype.forEachTiddler = function(callback) {\n for(var t in this.tiddlers) {\n callback.call(this,t,this.tiddlers[t]);\n }\n };\n}\n\n//============================================================================\n// forEachTiddler Macro\n//============================================================================\n\nversion.extensions.forEachTiddler = {major: 1, minor: 0, revision: 5, date: new Date(2006,2,5), provider: "http://tiddlywiki.abego-software.de"};\n\n// ---------------------------------------------------------------------------\n// Configurations and constants \n// ---------------------------------------------------------------------------\n\nconfig.macros.forEachTiddler = {\n // Standard Properties\n label: "forEachTiddler",\n prompt: "Perform actions on a (sorted) selection of tiddlers",\n\n // actions\n actions: {\n addToList: {},\n write: {}\n }\n};\n\n// ---------------------------------------------------------------------------\n// The forEachTiddler Macro Handler \n// ---------------------------------------------------------------------------\n\nconfig.macros.forEachTiddler.getContainingTiddler = function(e) {\n while(e && !hasClass(e,"tiddler"))\n e = e.parentNode;\n var title = e ? e.getAttribute("tiddler") : null; \n return title ? store.getTiddler(title) : null;\n};\n\nconfig.macros.forEachTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {\n // config.macros.forEachTiddler.traceMacroCall(place,macroName,params,wikifier,paramString,tiddler);\n\n if (!tiddler) tiddler = config.macros.forEachTiddler.getContainingTiddler(place);\n // --- Parsing ------------------------------------------\n\n var i = 0; // index running over the params\n // Parse the "in" clause\n var tiddlyWikiPath = undefined;\n if ((i < params.length) && params[i] == "in") {\n i++;\n if (i >= params.length) {\n this.handleError(place, "TiddlyWiki path expected behind 'in'.");\n return;\n }\n tiddlyWikiPath = this.paramEncode((i < params.length) ? params[i] : "");\n i++;\n }\n\n // Parse the where clause\n var whereClause ="true";\n if ((i < params.length) && params[i] == "where") {\n i++;\n whereClause = this.paramEncode((i < params.length) ? params[i] : "");\n i++;\n }\n\n // Parse the sort stuff\n var sortClause = null;\n var sortAscending = true; \n if ((i < params.length) && params[i] == "sortBy") {\n i++;\n if (i >= params.length) {\n this.handleError(place, "sortClause missing behind 'sortBy'.");\n return;\n }\n sortClause = this.paramEncode(params[i]);\n i++;\n\n if ((i < params.length) && (params[i] == "ascending" || params[i] == "descending")) {\n sortAscending = params[i] == "ascending";\n i++;\n }\n }\n\n // Parse the script\n var scriptText = null;\n if ((i < params.length) && params[i] == "script") {\n i++;\n scriptText = this.paramEncode((i < params.length) ? params[i] : "");\n i++;\n }\n\n // Parse the action. \n // When we are already at the end use the default action\n var actionName = "addToList";\n if (i < params.length) {\n if (!config.macros.forEachTiddler.actions[params[i]]) {\n this.handleError(place, "Unknown action '"+params[i]+"'.");\n return;\n } else {\n actionName = params[i]; \n i++;\n }\n } \n \n // Get the action parameter\n // (the parsing is done inside the individual action implementation.)\n var actionParameter = params.slice(i);\n\n\n // --- Processing ------------------------------------------\n try {\n this.performMacro({\n place: place, \n inTiddler: tiddler,\n whereClause: whereClause, \n sortClause: sortClause, \n sortAscending: sortAscending, \n actionName: actionName, \n actionParameter: actionParameter, \n scriptText: scriptText, \n tiddlyWikiPath: tiddlyWikiPath});\n\n } catch (e) {\n this.handleError(place, e);\n }\n};\n\n// Returns an object with properties "tiddlers" and "context".\n// tiddlers holds the (sorted) tiddlers selected by the parameter,\n// context the context of the execution of the macro.\n//\n// The action is not yet performed.\n//\n// @parameter see performMacro\n//\nconfig.macros.forEachTiddler.getTiddlersAndContext = function(parameter) {\n\n var context = config.macros.forEachTiddler.createContext(parameter.place, parameter.whereClause, parameter.sortClause, parameter.sortAscending, parameter.actionName, parameter.actionParameter, parameter.scriptText, parameter.tiddlyWikiPath, parameter.inTiddler);\n\n var tiddlyWiki = parameter.tiddlyWikiPath ? this.loadTiddlyWiki(parameter.tiddlyWikiPath) : store;\n context["tiddlyWiki"] = tiddlyWiki;\n \n // Get the tiddlers, as defined by the whereClause\n var tiddlers = this.findTiddlers(parameter.whereClause, context, tiddlyWiki);\n context["tiddlers"] = tiddlers;\n\n // Sort the tiddlers, when sorting is required.\n if (parameter.sortClause) {\n this.sortTiddlers(tiddlers, parameter.sortClause, parameter.sortAscending, context);\n }\n\n return {tiddlers: tiddlers, context: context};\n};\n\n// Returns the (sorted) tiddlers selected by the parameter.\n//\n// The action is not yet performed.\n//\n// @parameter see performMacro\n//\nconfig.macros.forEachTiddler.getTiddlers = function(parameter) {\n return this.getTiddlersAndContext(parameter).tiddlers;\n};\n\n// Performs the macros with the given parameter.\n//\n// @param parameter holds the parameter of the macro as separate properties.\n// The following properties are supported:\n//\n// place\n// whereClause\n// sortClause\n// sortAscending\n// actionName\n// actionParameter\n// scriptText\n// tiddlyWikiPath\n//\n// All properties are optional. \n// For most actions the place property must be defined.\n//\nconfig.macros.forEachTiddler.performMacro = function(parameter) {\n var tiddlersAndContext = this.getTiddlersAndContext(parameter);\n\n // Perform the action\n var actionName = parameter.actionName ? parameter.actionName : "addToList";\n var action = config.macros.forEachTiddler.actions[actionName];\n if (!action) {\n this.handleError(parameter.place, "Unknown action '"+actionName+"'.");\n return;\n }\n\n var actionHandler = action.handler;\n actionHandler(parameter.place, tiddlersAndContext.tiddlers, parameter.actionParameter, tiddlersAndContext.context);\n};\n\n// ---------------------------------------------------------------------------\n// The actions \n// ---------------------------------------------------------------------------\n\n// Internal.\n//\n// --- The addToList Action -----------------------------------------------\n//\nconfig.macros.forEachTiddler.actions.addToList.handler = function(place, tiddlers, parameter, context) {\n // Parse the parameter\n var p = 0;\n\n // Check for extra parameters\n if (parameter.length > p) {\n config.macros.forEachTiddler.createExtraParameterErrorElement(place, "addToList", parameter, p);\n return;\n }\n\n // Perform the action.\n var list = document.createElement("ul");\n place.appendChild(list);\n for (var i = 0; i < tiddlers.length; i++) {\n var tiddler = tiddlers[i];\n var listItem = document.createElement("li");\n list.appendChild(listItem);\n createTiddlyLink(listItem, tiddler.title, true);\n }\n};\n\n// Internal.\n//\n// --- The write Action ---------------------------------------------------\n//\nconfig.macros.forEachTiddler.actions.write.handler = function(place, tiddlers, parameter, context) {\n // Parse the parameter\n var p = 0;\n if (p >= parameter.length) {\n this.handleError(place, "Missing expression behind 'write'.");\n return;\n }\n\n var textExpression = config.macros.forEachTiddler.paramEncode(parameter[p]);\n p++;\n\n // Parse the "toFile" option\n var filename = null;\n var lineSeparator = undefined;\n if ((p < parameter.length) && parameter[p] == "toFile") {\n p++;\n if (p >= parameter.length) {\n this.handleError(place, "Filename expected behind 'toFile' of 'write' action.");\n return;\n }\n \n filename = config.macros.forEachTiddler.getLocalPath(config.macros.forEachTiddler.paramEncode(parameter[p]));\n p++;\n if ((p < parameter.length) && parameter[p] == "withLineSeparator") {\n p++;\n if (p >= parameter.length) {\n this.handleError(place, "Line separator text expected behind 'withLineSeparator' of 'write' action.");\n return;\n }\n lineSeparator = config.macros.forEachTiddler.paramEncode(parameter[p]);\n p++;\n }\n }\n \n // Check for extra parameters\n if (parameter.length > p) {\n config.macros.forEachTiddler.createExtraParameterErrorElement(place, "write", parameter, p);\n return;\n }\n\n // Perform the action.\n var func = config.macros.forEachTiddler.getEvalTiddlerFunction(textExpression, context);\n var count = tiddlers.length;\n var text = "";\n for (var i = 0; i < count; i++) {\n var tiddler = tiddlers[i];\n text += func(tiddler, context, count, i);\n }\n \n if (filename) {\n if (lineSeparator !== undefined) {\n lineSeparator = lineSeparator.replace(/\s\sn/mg, "\sn").replace(/\s\sr/mg, "\sr");\n text = text.replace(/\sn/mg,lineSeparator);\n }\n saveFile(filename, convertUnicodeToUTF8(text));\n } else {\n var wrapper = createTiddlyElement(place, "span");\n wikify(text, wrapper, null/* highlightRegExp */, context.inTiddler);\n }\n};\n\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n// Internal.\n//\nconfig.macros.forEachTiddler.createContext = function(placeParam, whereClauseParam, sortClauseParam, sortAscendingParam, actionNameParam, actionParameterParam, scriptText, tiddlyWikiPathParam, inTiddlerParam) {\n return {\n place : placeParam, \n whereClause : whereClauseParam, \n sortClause : sortClauseParam, \n sortAscending : sortAscendingParam, \n script : scriptText,\n actionName : actionNameParam, \n actionParameter : actionParameterParam,\n tiddlyWikiPath : tiddlyWikiPathParam,\n inTiddler : inTiddlerParam\n };\n};\n\n// Internal.\n//\n// Returns a TiddlyWiki with the tiddlers loaded from the TiddlyWiki of \n// the given path.\n//\nconfig.macros.forEachTiddler.loadTiddlyWiki = function(path, idPrefix) {\n if (!idPrefix) {\n idPrefix = "store";\n }\n var lenPrefix = idPrefix.length;\n \n // Read the content of the given file\n var content = loadFile(this.getLocalPath(path));\n if(content === null) {\n throw "TiddlyWiki '"+path+"' not found.";\n }\n \n // Locate the storeArea div's\n var posOpeningDiv = content.indexOf(startSaveArea);\n var posClosingDiv = content.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1)) {\n throw "File '"+path+"' is not a TiddlyWiki.";\n }\n var storageText = content.substr(posOpeningDiv + startSaveArea.length, posClosingDiv);\n \n // Create a "div" element that contains the storage text\n var myStorageDiv = document.createElement("div");\n myStorageDiv.innerHTML = storageText;\n myStorageDiv.normalize();\n \n // Create all tiddlers in a new TiddlyWiki\n // (following code is modified copy of TiddlyWiki.prototype.loadFromDiv)\n var tiddlyWiki = new TiddlyWiki();\n var store = myStorageDiv.childNodes;\n for(var t = 0; t < store.length; t++) {\n var e = store[t];\n var title = null;\n if(e.getAttribute)\n title = e.getAttribute("tiddler");\n if(!title && e.id && e.id.substr(0,lenPrefix) == idPrefix)\n title = e.id.substr(lenPrefix);\n if(title && title !== "") {\n var tiddler = tiddlyWiki.createTiddler(title);\n tiddler.loadFromDiv(e,title);\n }\n }\n tiddlyWiki.dirty = false;\n\n return tiddlyWiki;\n};\n\n\n \n// Internal.\n//\n// Returns a function that has a function body returning the given javaScriptExpression.\n// The function has the parameters:\n// \n// (tiddler, context, count, index)\n//\nconfig.macros.forEachTiddler.getEvalTiddlerFunction = function (javaScriptExpression, context) {\n var script = context["script"];\n var functionText = "var theFunction = function(tiddler, context, count, index) { return "+javaScriptExpression+"}";\n var fullText = (script ? script+";" : "")+functionText+";theFunction;";\n return eval(fullText);\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.findTiddlers = function(whereClause, context, tiddlyWiki) {\n var result = [];\n var func = config.macros.forEachTiddler.getEvalTiddlerFunction(whereClause, context);\n tiddlyWiki.forEachTiddler(function(title,tiddler) {\n if (func(tiddler, context, undefined, undefined)) {\n result.push(tiddler);\n }\n });\n return result;\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.createExtraParameterErrorElement = function(place, actionName, parameter, firstUnusedIndex) {\n var message = "Extra parameter behind '"+actionName+"':";\n for (var i = firstUnusedIndex; i < parameter.length; i++) {\n message += " "+parameter[i];\n }\n this.handleError(place, message);\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.sortAscending = function(tiddlerA, tiddlerB) {\n var result = \n (tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) \n ? 0\n : (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)\n ? -1 \n : +1; \n return result;\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.sortDescending = function(tiddlerA, tiddlerB) {\n var result = \n (tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) \n ? 0\n : (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)\n ? +1 \n : -1; \n return result;\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.sortTiddlers = function(tiddlers, sortClause, ascending, context) {\n // To avoid evaluating the sortClause whenever two items are compared \n // we pre-calculate the sortValue for every item in the array and store it in a \n // temporary property ("forEachTiddlerSortValue") of the tiddlers.\n var func = config.macros.forEachTiddler.getEvalTiddlerFunction(sortClause, context);\n var count = tiddlers.length;\n var i;\n for (i = 0; i < count; i++) {\n var tiddler = tiddlers[i];\n tiddler.forEachTiddlerSortValue = func(tiddler,context, undefined, undefined);\n }\n\n // Do the sorting\n tiddlers.sort(ascending ? this.sortAscending : this.sortDescending);\n\n // Delete the temporary property that holds the sortValue. \n for (i = 0; i < tiddlers.length; i++) {\n delete tiddlers[i].forEachTiddlerSortValue;\n }\n};\n\n\n// Internal.\n//\nconfig.macros.forEachTiddler.trace = function(message) {\n displayMessage(message);\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.traceMacroCall = function(place,macroName,params) {\n var message ="<<"+macroName;\n for (var i = 0; i < params.length; i++) {\n message += " "+params[i];\n }\n message += ">>";\n displayMessage(message);\n};\n\n\n// Internal.\n//\n// Creates an element that holds an error message\n// \nconfig.macros.forEachTiddler.createErrorElement = function(place, exception) {\n var message = (exception.description) ? exception.description : exception.toString();\n return createTiddlyElement(place,"span",null,"forEachTiddlerError","<<forEachTiddler ...>>: "+message);\n};\n\n// Internal.\n//\n// @param place [may be null]\n//\nconfig.macros.forEachTiddler.handleError = function(place, exception) {\n if (place) {\n this.createErrorElement(place, exception);\n } else {\n throw exception;\n }\n};\n\n// Internal.\n//\n// Encodes the given string.\n//\n// Replaces \n// "$))" to ">>"\n// "$)" to ">"\n//\nconfig.macros.forEachTiddler.paramEncode = function(s) {\n var reGTGT = new RegExp("\s\s$\s\s)\s\s)","mg");\n var reGT = new RegExp("\s\s$\s\s)","mg");\n return s.replace(reGTGT, ">>").replace(reGT, ">");\n};\n\n// Internal.\n//\n// Returns the given original path (that is a file path, starting with "file:")\n// as a path to a local file, in the systems native file format.\n//\n// Location information in the originalPath (i.e. the "#" and stuff following)\n// is stripped.\n// \nconfig.macros.forEachTiddler.getLocalPath = function(originalPath) {\n // Remove any location part of the URL\n var hashPos = originalPath.indexOf("#");\n if(hashPos != -1)\n originalPath = originalPath.substr(0,hashPos);\n // Convert to a native file format assuming\n // "file:///x:/path/path/path..." - pc local file --> "x:\spath\spath\spath..."\n // "file://///server/share/path/path/path..." - FireFox pc network file --> "\s\sserver\sshare\spath\spath\spath..."\n // "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."\n // "file://server/share/path/path/path..." - pc network file --> "\s\sserver\sshare\spath\spath\spath..."\n var localPath;\n if(originalPath.charAt(9) == ":") // pc local file\n localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\s\s");\n else if(originalPath.indexOf("file://///") === 0) // FireFox pc network file\n localPath = "\s\s\s\s" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\s\s");\n else if(originalPath.indexOf("file:///") === 0) // mac/unix local file\n localPath = unescape(originalPath.substr(7));\n else if(originalPath.indexOf("file:/") === 0) // mac/unix local file\n localPath = unescape(originalPath.substr(5));\n else // pc network file\n localPath = "\s\s\s\s" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\s\s"); \n return localPath;\n};\n\n// ---------------------------------------------------------------------------\n// Stylesheet Extensions (may be overridden by local StyleSheet)\n// ---------------------------------------------------------------------------\n//\nsetStylesheet(\n ".forEachTiddlerError{color: #ffffff;background-color: #880000;}",\n "forEachTiddler");\n\n//============================================================================\n// End of forEachTiddler Macro\n//============================================================================\n\n\n//============================================================================\n// String.startsWith Function\n//============================================================================\n//\n// Returns true if the string starts with the given prefix, false otherwise.\n//\nversion.extensions["String.startsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nString.prototype.startsWith = function(prefix) {\n var n = prefix.length;\n return (this.length >= n) && (this.slice(0, n) == prefix);\n};\n\n\n\n//============================================================================\n// String.endsWith Function\n//============================================================================\n//\n// Returns true if the string ends with the given suffix, false otherwise.\n//\nversion.extensions["String.endsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nString.prototype.endsWith = function(suffix) {\n var n = suffix.length;\n return (this.length >= n) && (this.right(n) == suffix);\n};\n\n\n//============================================================================\n// String.contains Function\n//============================================================================\n//\n// Returns true when the string contains the given substring, false otherwise.\n//\nversion.extensions["String.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nString.prototype.contains = function(substring) {\n return this.indexOf(substring) >= 0;\n};\n\n//============================================================================\n// Array.indexOf Function\n//============================================================================\n//\n// Returns the index of the first occurance of the given item in the array or \n// -1 when no such item exists.\n//\n// @param item [may be null]\n//\nversion.extensions["Array.indexOf"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.indexOf = function(item) {\n for (var i = 0; i < this.length; i++) {\n if (this[i] == item) {\n return i;\n }\n }\n return -1;\n};\n\n//============================================================================\n// Array.contains Function\n//============================================================================\n//\n// Returns true when the array contains the given item, otherwise false. \n//\n// @param item [may be null]\n//\nversion.extensions["Array.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.contains = function(item) {\n return (this.indexOf(item) >= 0);\n};\n\n//============================================================================\n// Array.containsAny Function\n//============================================================================\n//\n// Returns true when the array contains at least one of the elements \n// of the item. Otherwise (or when items contains no elements) false is returned.\n//\nversion.extensions["Array.containsAny"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.containsAny = function(items) {\n for(var i = 0; i < items.length; i++) {\n if (this.contains(items[i])) {\n return true;\n }\n }\n return false;\n};\n\n\n//============================================================================\n// Array.containsAll Function\n//============================================================================\n//\n// Returns true when the array contains all the items, otherwise false.\n// \n// When items is null false is returned (even if the array contains a null).\n//\n// @param items [may be null] \n//\nversion.extensions["Array.containsAll"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.containsAll = function(items) {\n for(var i = 0; i < items.length; i++) {\n if (!this.contains(items[i])) {\n return false;\n }\n }\n return true;\n};\n\n\n} // of "install only once"\n\n// Used Globals (for JSLint) ==============\n// ... DOM\n/*global document */\n// ... TiddlyWiki Core\n/*global convertUnicodeToUTF8, createTiddlyElement, createTiddlyLink, \n displayMessage, endSaveArea, hasClass, loadFile, saveFile, \n startSaveArea, store, wikify */\n//}}}\n\n\n/***\n!Licence and Copyright\nCopyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\nNeither the name of abego Software nor the names of its contributors may be\nused to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\nSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n***/\n\n
/***\n<<checkForDataTiddlerPlugin>>\n|''Name:''|FormTiddlerPlugin|\n|''Version:''|1.0.5 (2006-02-24)|\n|''Source:''|http://tiddlywiki.abego-software.de/#FormTiddlerPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license]]|\n|''Macros:''|formTiddler, checkForDataTiddlerPlugin, newTiddlerWithForm|\n|''Requires:''|DataTiddlerPlugin|\n|''TiddlyWiki:''|1.2.38+, 2.0|\n|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|\n!Description\nUse form-based tiddlers to enter your tiddler data using text fields, listboxes, checkboxes etc. (All standard HTML Form input elements supported).\n\n''Syntax:'' \n|>|{{{<<}}}''formTiddler'' //tiddlerName//{{{>>}}}|\n|//tiddlerName//|The name of the FormTemplate tiddler to be used to edit the data of the tiddler containing the macro.|\n\n|>|{{{<<}}}''newTiddlerWithForm'' //formTemplateName// //buttonLabel// [//titleExpression// [''askUser'']] {{{>>}}}|\n|//formTemplateName//|The name of the tiddler that defines the form the new tiddler should use.|\n|//buttonLabel//|The label of the button|\n|//titleExpression//|A (quoted) JavaScript String expression that defines the title (/name) of the new tiddler.|\n|''askUser''|Typically the user is not asked for the title when a title is specified (and not yet used). When ''askUser'' is given the user will be asked in any case. This may be used when the calculated title is just a suggestion that must be confirmed by the user|\n|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|\n\nFor details and how to use the macros see the [[introduction|FormTiddler Introduction]] and the [[examples|FormTiddler Examples]].\n\n!Revision history\n* v1.0.5 (2006-02-24)\n** Removed "debugger;" instruction\n* v1.0.4 (2006-02-07)\n** Bug: On IE no data is written to data section when field values changed (thanks to KenGirard for reporting)\n* v1.0.3 (2006-02-05)\n** Bug: {{{"No form template specified in <<formTiddler>>"}}} when using formTiddler macro on InternetExplorer (thanks to KenGirard for reporting)\n* v1.0.2 (2006-01-06)\n** Support TiddlyWiki 2.0\n* v1.0.1 (2005-12-22)\n** Features: \n*** Support InternetExplorer\n*** Added newTiddlerWithForm Macro\n* v1.0.0 (2005-12-14)\n** initial version\n\n!Code\n***/\n//{{{\n\n//============================================================================\n//============================================================================\n// FormTiddlerPlugin\n//============================================================================\n//============================================================================\n\n\nversion.extensions.FormTiddlerPlugin = {\n major: 1, minor: 0, revision: 5,\n date: new Date(2006, 2, 24), \n type: 'plugin',\n source: "http://tiddlywiki.abego-software.de/#FormTiddlerPlugin"\n};\n\n// For backward compatibility with v1.2.x\n//\nif (!window.story) window.story=window; \nif (!TiddlyWiki.prototype.getTiddler) TiddlyWiki.prototype.getTiddler = function(title) { return t = this.tiddlers[title]; return (t != undefined && t instanceof Tiddler) ? t : null; } \n\n//============================================================================\n// formTiddler Macro\n//============================================================================\n\n// -------------------------------------------------------------------------------\n// Configurations and constants \n// -------------------------------------------------------------------------------\n\nconfig.macros.formTiddler = {\n // Standard Properties\n label: "formTiddler",\n version: {major: 1, minor: 0, revision: 4, date: new Date(2006, 2, 7)},\n prompt: "Edit tiddler data using forms",\n\n // Define the "setters" that set the values of INPUT elements of a given type\n // (must match the corresponding "getter")\n setter: { \n button: function(e, value) {/*contains no data */ },\n checkbox: function(e, value) {e.checked = value;},\n file: function(e, value) {try {e.value = value;} catch(e) {/* ignore, possibly security error*/}},\n hidden: function(e, value) {e.value = value;},\n password: function(e, value) {e.value = value;},\n radio: function(e, value) {e.checked = (e.value == value);},\n reset: function(e, value) {/*contains no data */ },\n "select-one": function(e, value) {config.macros.formTiddler.setSelectOneValue(e,value);},\n "select-multiple": function(e, value) {config.macros.formTiddler.setSelectMultipleValue(e,value);},\n submit: function(e, value) {/*contains no data */},\n text: function(e, value) {e.value = value;},\n textarea: function(e, value) {e.value = value;}\n },\n\n // Define the "getters" that return the value of INPUT elements of a given type\n // Return undefined to not store any data.\n getter: { \n button: function(e, value) {return undefined;},\n checkbox: function(e, value) {return e.checked;},\n file: function(e, value) {return e.value;},\n hidden: function(e, value) {return e.value;},\n password: function(e, value) {return e.value;},\n radio: function(e, value) {return e.checked ? e.value : undefined;},\n reset: function(e, value) {return undefined;},\n "select-one": function(e, value) {return config.macros.formTiddler.getSelectOneValue(e);},\n "select-multiple": function(e, value) {return config.macros.formTiddler.getSelectMultipleValue(e);},\n submit: function(e, value) {return undefined;},\n text: function(e, value) {return e.value;},\n textarea: function(e, value) {return e.value;}\n }\n};\n\n\n// -------------------------------------------------------------------------------\n// The formTiddler Macro Handler \n// -------------------------------------------------------------------------------\n\nconfig.macros.formTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {\n if (!config.macros.formTiddler.checkForExtensions(place, macroName)) {\n return;\n }\n \n // --- Parsing ------------------------------------------\n\n var i = 0; // index running over the params\n\n // get the name of the form template tiddler\n var formTemplateName = undefined;\n if (i < params.length) {\n formTemplateName = params[i];\n i++;\n }\n\n if (!formTemplateName) {\n config.macros.formTiddler.createErrorElement(place, "No form template specified in <<" + macroName + ">>.");\n return;\n }\n\n\n // --- Processing ------------------------------------------\n\n // Get the form template text. \n // (This contains the INPUT elements for the form.)\n var formTemplateTiddler = store.getTiddler(formTemplateName);\n if (!formTemplateTiddler) {\n config.macros.formTiddler.createErrorElement(place, "Form template '" + formTemplateName + "' not found.");\n return;\n }\n var templateText = formTemplateTiddler.text;\n if(!templateText) {\n // Shortcut: when template text is empty we do nothing.\n return;\n }\n\n // Get the name of the tiddler containing this "formTiddler" macro\n // (i.e. the tiddler, that will be edited and that contains the data)\n var tiddlerName = config.macros.formTiddler.getContainingTiddlerName(place);\n\n // Append a "form" element. \n var formName = "form"+formTemplateName+"__"+tiddlerName;\n var e = document.createElement("form");\n e.setAttribute("name", formName);\n place.appendChild(e);\n\n // "Embed" the elements defined by the templateText (i.e. the INPUT elements) \n // into the "form" element we just created\n wikify(templateText, e);\n\n // Initialize the INPUT elements.\n config.macros.formTiddler.initValuesAndHandlersInFormElements(formName, DataTiddler.getDataObject(tiddlerName));\n}\n\n\n// -------------------------------------------------------------------------------\n// Form Data Access \n// -------------------------------------------------------------------------------\n\n// Internal.\n//\n// Initialize the INPUT elements of the form with the values of their "matching"\n// data fields in the tiddler. Also setup the onChange handler to ensure that\n// changes in the INPUT elements are stored in the tiddler's data.\n//\nconfig.macros.formTiddler.initValuesAndHandlersInFormElements = function(formName, data) {\n // config.macros.formTiddler.trace("initValuesAndHandlersInFormElements(formName="+formName+", data="+data+")");\n\n // find the form\n var form = config.macros.formTiddler.findForm(formName);\n if (!form) {\n return;\n }\n\n try {\n var elems = form.elements;\n for (var i = 0; i < elems.length; i++) {\n var c = elems[i];\n \n var setter = config.macros.formTiddler.setter[c.type];\n if (setter) {\n var value = data[c.name];\n if (value != null) {\n setter(c, value);\n }\n c.onchange = onFormTiddlerChange;\n } else {\n config.macros.formTiddler.displayFormTiddlerError("No setter defined for INPUT element of type '"+c.type+"'. (Element '"+c.name+"' in form '"+formName+"')");\n }\n }\n } catch(e) {\n config.macros.formTiddler.displayFormTiddlerError("Error when updating elements with new formData. "+e);\n }\n}\n\n\n// Internal.\n//\n// @return [may be null]\n//\nconfig.macros.formTiddler.findForm = function(formName) {\n // We must manually iterate through the document's forms, since\n // IE does not support the "document[formName]" approach\n\n var forms = window.document.forms;\n for (var i = 0; i < forms.length; i++) {\n var form = forms[i];\n if (form.name == formName) {\n return form;\n }\n }\n\n return null;\n}\n\n\n// Internal.\n//\nconfig.macros.formTiddler.setSelectOneValue = function(element,value) {\n var n = element.options.length;\n for (var i = 0; i < n; i++) {\n element.options[i].selected = element.options[i].value == value;\n }\n}\n\n// Internal.\n//\nconfig.macros.formTiddler.setSelectMultipleValue = function(element,value) {\n var values = {};\n for (var i = 0; i < value.length; i++) {\n values[value[i]] = true;\n }\n \n var n = element.length;\n for (var i = 0; i < n; i++) {\n element.options[i].selected = !(!values[element.options[i].value]);\n }\n}\n\n// Internal.\n//\nconfig.macros.formTiddler.getSelectOneValue = function(element) {\n var i = element.selectedIndex;\n return (i >= 0) ? element.options[i].value : null;\n}\n\n// Internal.\n//\nconfig.macros.formTiddler.getSelectMultipleValue = function(element) {\n var values = [];\n var n = element.length;\n for (var i = 0; i < n; i++) {\n if (element.options[i].selected) {\n values.push(element.options[i].value);\n }\n }\n return values;\n}\n\n\n\n// -------------------------------------------------------------------------------\n// Helpers \n// -------------------------------------------------------------------------------\n\n// Internal.\n//\nconfig.macros.formTiddler.checkForExtensions = function(place,macroName) {\n if (!version.extensions.DataTiddlerPlugin) {\n config.macros.formTiddler.createErrorElement(place, "<<" + macroName + ">> requires the DataTiddlerPlugin. (You can get it from http://tiddlywiki.abego-software.de/#DataTiddlerPlugin)");\n return false;\n }\n return true;\n}\n\n// Internal.\n//\n// Displays a trace message in the "TiddlyWiki" message pane.\n// (used for debugging)\n//\nconfig.macros.formTiddler.trace = function(s) {\n displayMessage("Trace: "+s);\n}\n\n// Internal.\n//\n// Display some error message in the "TiddlyWiki" message pane.\n//\nconfig.macros.formTiddler.displayFormTiddlerError = function(s) {\n alert("FormTiddlerPlugin Error: "+s);\n}\n\n// Internal.\n//\n// Creates an element that holds an error message\n// \nconfig.macros.formTiddler.createErrorElement = function(place, message) {\n return createTiddlyElement(place,"span",null,"formTiddlerError",message);\n}\n\n// Internal.\n//\n// Returns the name of the tiddler containing the given element.\n// \nconfig.macros.formTiddler.getContainingTiddlerName = function(element) {\n return story.findContainingTiddler(element).id.substr(7);\n}\n\n// -------------------------------------------------------------------------------\n// Event Handlers \n// -------------------------------------------------------------------------------\n\n// This function must be called by the INPUT elements whenever their\n// data changes. Typically this is done through an "onChange" handler.\n//\nfunction onFormTiddlerChange (e) {\n // config.macros.formTiddler.trace("onFormTiddlerChange "+e);\n\n if (!e) var e = window.event;\n\n var target = resolveTarget(e);\n var tiddlerName = config.macros.formTiddler.getContainingTiddlerName(target);\n var getter = config.macros.formTiddler.getter[target.type];\n if (getter) {\n var value = getter(target);\n DataTiddler.setData(tiddlerName, target.name, value);\n } else {\n config.macros.formTiddler.displayFormTiddlerError("No getter defined for INPUT element of type '"+target.type+"'. (Element '"+target.name+"' used in tiddler '"+tiddlerName+"')");\n }\n}\n\n// ensure that the function can be used in HTML event handler\nwindow.onFormTiddlerChange = onFormTiddlerChange;\n\n\n// -------------------------------------------------------------------------------\n// Stylesheet Extensions (may be overridden by local StyleSheet)\n// -------------------------------------------------------------------------------\n\nsetStylesheet(\n ".formTiddlerError{color: #ffffff;background-color: #880000;}",\n "formTiddler");\n\n\n//============================================================================\n// checkForDataTiddlerPlugin Macro\n//============================================================================\n\nconfig.macros.checkForDataTiddlerPlugin = {\n // Standard Properties\n label: "checkForDataTiddlerPlugin",\n version: {major: 1, minor: 0, revision: 0, date: new Date(2005, 12, 14)},\n prompt: "Check if the DataTiddlerPlugin exists"\n}\n\nconfig.macros.checkForDataTiddlerPlugin.handler = function(place,macroName,params) {\n config.macros.formTiddler.checkForExtensions(place, config.macros.formTiddler.label);\n}\n\n\n\n//============================================================================\n// newTiddlerWithForm Macro\n//============================================================================\n\nconfig.macros.newTiddlerWithForm = {\n // Standard Properties\n label: "newTiddlerWithForm",\n version: {major: 1, minor: 0, revision: 1, date: new Date(2006, 1, 6)},\n prompt: "Creates a new Tiddler with a <<formTiddler ...>> macro"\n}\n\nconfig.macros.newTiddlerWithForm.handler = function(place,macroName,params) {\n // --- Parsing ------------------------------------------\n\n var i = 0; // index running over the params\n\n // get the name of the form template tiddler\n var formTemplateName = undefined;\n if (i < params.length) {\n formTemplateName = params[i];\n i++;\n }\n\n if (!formTemplateName) {\n config.macros.formTiddler.createErrorElement(place, "No form template specified in <<" + macroName + ">>.");\n return;\n }\n\n // get the button label\n var buttonLabel = undefined;\n if (i < params.length) {\n buttonLabel = params[i];\n i++;\n }\n\n if (!buttonLabel) {\n config.macros.formTiddler.createErrorElement(place, "No button label specified in <<" + macroName + ">>.");\n return;\n }\n\n // get the (optional) tiddlerName script and "askUser"\n var tiddlerNameScript = undefined;\n var askUser = false;\n if (i < params.length) {\n tiddlerNameScript = params[i];\n i++;\n\n if (i < params.length && params[i] == "askUser") {\n askUser = true;\n i++;\n }\n }\n\n // --- Processing ------------------------------------------\n\n if(!readOnly) {\n var onClick = function() {\n var tiddlerName;\n if (tiddlerNameScript) {\n try {\n tiddlerName = eval(tiddlerNameScript);\n } catch (ex) {\n }\n }\n if (!tiddlerName || askUser) {\n tiddlerName = prompt("Please specify a tiddler name.", askUser ? tiddlerName : "");\n }\n while (tiddlerName && store.getTiddler(tiddlerName)) {\n tiddlerName = prompt("A tiddler named '"+tiddlerName+"' already exists.\sn\sn"+"Please specify a tiddler name.", tiddlerName);\n }\n\n // tiddlerName is either null (user canceled) or a name that is not yet in the store.\n if (tiddlerName) {\n var body = "<<formTiddler [["+formTemplateName+"]]>>";\n var tags = [];\n store.saveTiddler(tiddlerName,tiddlerName,body,config.options.txtUserName,new Date(),tags);\n story.displayTiddler(null,tiddlerName,1);\n }\n }\n\n createTiddlyButton(place,buttonLabel,buttonLabel,onClick);\n }\n}\n\n//}}}\n\n\n/***\n!Licence and Copyright\nCopyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\nNeither the name of abego Software nor the names of its contributors may be\nused to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\nSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n***/\n
/***\n''HTML Formatting Plugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#HTMLFormattingPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nThe shorthand Wiki-style formatting syntax of ~TiddlyWiki is very convenient and enables most content to be reasonably well presented. However, there are times when tried-and-true HTML formatting syntax allows more more precise control of the content display.\n\nWhen HTML formatting syntax is embedded within a tiddler (in between {{{<}}}{{{html>}}} and {{{<}}}{{{/html>}}} markers) TiddlyWiki passes this content to the browser for processing as 'native' HTML. However, TiddlyWiki does not also process the HTML source content for any embedded wiki-formatting syntax it may contain. This means that while you can use HTML formatted content, you cannot mix wiki-formatted content within the HTML formatting.\n!!!!!Usage\n<<<\nThe ~HTMLFormatting plugin allows you to freely ''mix wiki-style formatting syntax within HTML formatted content'' by extending the action of the standard TiddlyWiki formatting handler.\n\nWhen a tiddler is about to be displayed, ~TiddlyWiki looks for tiddler content contained within ''<{{{html}}}>'' and ''<{{{/html}}}>'' HTML tags. This content (if any) is passed directly to the browser's internal "rendering engine" to process as ~HTML-formatted content. Once the HTML formatting has been processed, all the pieces of text occuring in between the HTML formatting are then processed by the ~TiddlyWiki rendering engine, one piece at a time, so that normal wiki-style formatting can be applied to the individual text pieces.\n<<<\n!!!!!Line breaks\n<<<\nOne major difference between Wiki formatting and HTML formatting is how "line breaks" are processed. Wiki formatting treats all line breaks as literal content to be displayed //as-is//. However, because HTML normally ignores line breaks and actually processes them as simple "word separators" instead, many people who write HTML include extra line breaks in their documents, just to make the "source code" easier to read.\n\nEven though you can use HTML tags within your tiddler content, the default treatment for line breaks still follows the Wiki-style rule (i.e., all new lines are displayed as-is). When adding HTML content to a tiddler (especially if you cut-and-paste it from another web page), you should take care to avoid adding extra line breaks to the text.\n\nIf removing all the extra line breaks from your HTML content would be a big hassle, you can quickly //override the default Wiki-style line break rule// so that the line breaks use the standard HTML rules instead. Placing a ''<{{{hide linebreaks}}}>'' tag within the tiddler's HTML content changes all line breaks to spaces before rendering the content, so that the literal line breaks will be processed as simple word-breaks instead.\n\nNote: this does //not// alter the actual tiddler content that is stored in the document, just the manner in which it is displayed. Any line breaks contained in the tiddler will still be there when you edit its content. Also, to include a literal line break when the ''<{{{hide linebreaks}}}>'' tag is present, you will need to use a ''<{{{br}}}>'' or ''<{{{p}}}>'' HTML tag instead of simply typing a line break.\n<<<\n!!!!!How it works\n<<<\nThe TW core support for HTML does not let you put ANY wiki-style syntax (including TW macros) *inside* the <html>...</html> block. Everything\nbetween <html> and </html> is handed to the browser for processing and that is it. Fortunately, this plugin ADDS the ability to let you put wiki-syntax (including macros) inside the html. It does this by first giving the tiddler source content to the browser to process the HTML, and then handling any wiki-based syntax that remains afterward.\n\nHowever, not all wiki syntax can be safely passed through the browser's parser. Specifically, any TW macros inside the HTML will get 'eaten' by the browser since the macro brackets, """<<...>>""" use the "<" and ">" that normally delimit the HTML/XML syntax recognized by the browser's parser.\n\nSimilarly, you can't use InlineJavascript within the HTML because the """<script>...</script>""" syntax will also be consumed by the browser and there will be nothing left to process afterward. Note: unfortunately, even though the browser removes the """<script>...</script>""" sequence, it doesn't actually execute the embedded javascript code that it removes, so any scripts contained inside of <html> blocks in TW are currently being ignored. :-(\n\nAs a work-around to allow TW *macros* (but not inline scripts) to exist inside of <html> formatted blocks of content, the plugin first converts the """<<""" and """>>""" into "%%(" and ")%%", making them "indigestible" so they can pass unchanged through the belly of the beast (the browser's HTML parser).\n\nAfter the browser has done its job, the wiki syntax sequences (including the "undigested" macros) are contained in #text nodes in the browser-generated DOM elements. The plugin then recursively locates and processes each #text node, converts the %%( and )%% back into """<< and >>""", passes the result to wikify() for further rendering of the wiki-formatted syntax into a containing SPAN that replaces the previous #text node. At the end of this process, none of the encoded %%( and )%% sequences remain in the rendered tiddler output.\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''HTMLFormattingPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for HTMLFormatting handling^^\n<<<\n!!!!!Revision History\n<<<\n''2006.02.19 [2.1.2]''\nin wikifyTextNodes(), put SPAN element into tiddler DOM (replacing text node), BEFORE wikifying the text content. This ensures that the 'place' passed to any macros is correctly defined when the macro is evaluated, so that calls to story.findContainingTiddler(place) will work as expected. (Thanks for bug report from GeoffSlocock)\n''2006.02.05 [2.1.1]''\nwrapped wikifier hijack in init function to eliminate globals and avoid FireFox 1.5.0.1 crash bug when referencing globals\n''2005.12.01 [2.1.0]''\ndon't wikify #TEXT nodes inside SELECT and TEXTAREA elements\n''2005.11.06 [2.0.1]''\ncode cleanup\n''2005.10.31 [2.0.0]''\nreplaced hijack wikify() with hijack config.formatters["html"] and simplified recursive WikifyTextNodes() code\n''2005.10.09 [1.0.2]''\ncombined documentation and code into a single tiddler\n''2005.08.05 [1.0.1]''\nmoved HTML and CSS definitions into plugin code instead of using separate tiddlers\n''2005.07.26 [1.0.1]''\nRe-released as a plugin.\nAdded <{{{html}}}>...</{{{nohtml}}}> and <{{{hide newlines}}}> handling\n''2005.07.20 [1.0.0]''\nInitial Release (as code adaptation)\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.HTMLFormatting = {major: 2, minor: 1, revision: 2, date: new Date(2006,2,19)};\n\n// find the formatter for HTML and replace the handler\ninitHTMLFormatter();\nfunction initHTMLFormatter()\n{\n for (var i=0; i<config.formatters.length && config.formatters[i].name!="html"; i++);\n if (i<config.formatters.length) config.formatters[i].handler=function(w) {\n var lookaheadRegExp = new RegExp(this.lookahead,"mg");\n lookaheadRegExp.lastIndex = w.matchStart;\n var lookaheadMatch = lookaheadRegExp.exec(w.source)\n if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {\n var html=lookaheadMatch[1];\n // optionally suppress wiki-style literal handling of newlines\n // strip any carriage returns added by Internet Explorer's textarea edit field\n // encode newlines as \sn so Internet Explorer's HTML parser won't eat them\n // encode macro brackets (<< and >>) so HTML parser won't eat them\n if (html.indexOf('<hide linebreaks>')!=-1) html=html.replace(regexpNewLine,' ');\n html=html.replace(regexpCarriageReturn,'');\n html=html.replace(regexpNewLine,'\s\sn');\n html=html.replace(/<</g,'%%(').replace(/>>/g,')%%');\n // create span to hold HTML\n // parse HTML and normalize the results\n // walk node tree and call wikify() on each text node\n var e = createTiddlyElement(w.output,"span");\n e.innerHTML=html;\n e.normalize(); \n wikifyTextNodes(e);\n // advance to next parse position\n w.nextMatch=lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n}\n\n// wikify text nodes remaining after HTML content is processed (pre-order recursion)\nfunction wikifyTextNodes(theNode)\n{\n for (var i=0;i<theNode.childNodes.length;i++) {\n var theChild=theNode.childNodes.item(i);\n if (theChild.nodeName.toLowerCase()=='option') continue;\n if (theChild.nodeName.toLowerCase()=='select') continue;\n wikifyTextNodes(theChild);\n if (theChild.nodeName=='#text') {\n var txt=theChild.nodeValue;\n // decode macro brackets and newlines\n txt=txt.replace(/\s%%\s(/g,'<<').replace(/\s)\s%%/g,'>>').replace(regexpBackSlashEn,'\sn');\n // replace text node with wikified() span\n var newNode=createTiddlyElement(null,"span");\n theNode.replaceChild(newNode,theChild);\n wikify(txt,newNode);\n }\n }\n}\n//}}}\n
/***\n|!Name|ImdbLinkMacro|\n|!Created by|Saq|\n|!Source||\n|!Version|1.5|\n!Description\nTurns a movie reference into a link on IMDB. Basically a quick hack of JeremyCowgar 's EsvLinkMacro. All credit belongs to him.\nIt basically appends the movie title at the end of the url {{{http://www.imdb.com/find?q=}}}\n\n!Examples\n{{{<<imdb Institute Benjamenta, or This Dream People Call Human Life>>}}}\n<<imdb Institute Benjamenta, or This Dream People Call Human Life>>\n\n{{{<<imdb "middle" "Institute Benjamenta, or This Dream People Call Human Life">>}}}\n<<imdb "middle" "Institute Benjamenta, or This Dream People Call Human Life">>\n\n{{{<<imdb "right" "Institute Benjamenta, or This Dream People Call Human Life">>}}}\n<<imdb "right" "Institute Benjamenta, or This Dream People Call Human Life">>\n\n!Notes\nTo make the macro work you have to give this tiddler a tag of systemConfig then save and reload.\n\nAlso, what this essentially does is search for the movie on Imdb. So if you want to to be taken directly to the movie and not a search page, change your search preferences at http://www.imdb.com/find/preferences and choose 'Always redirect to first result'.\n\nIf anyone knows a better way to do this, please let me know.\n\n!Todo\n\n!Code\n***/\n//{{{\nconfig.macros.imdb = {};\nconfig.macros.imdb.handler= function(place,macroName,params) {\nif ((params.length==2) && ((params[0]=="right") || (params[0]=="middle")))\n{\n var searchterm = params[1];\n var mode = params[0];}\nelse\n var searchterm = params.join(' ');\n // the maximum length of the links\n var mustlength=30;\n // the string added to or in the middle of the link text after shortening\n var connector='...';\n \n\nif ((searchterm.length>mustlength) && (mode!=null)) {\n switch(mode){\n case 'middle':\n var searchtitle =searchterm.substr(0,mustlength/2)+connector+searchterm.substr(searchterm.length-mustlength/2-connector.length,searchterm.length);\n break;\n case 'right':\n var searchtitle =searchterm.substr(0,mustlength-connector.length)+connector;\n break;\n }\n}\nelse\nsearchtitle = searchterm;\nvar x = 'http://imdb.com/find?q=';\nvar x2 = ' on IMDB';\n var theLink = document.createElement("a");\n theLink.className = "externalLink";\n theLink.target = "_blank";\n theLink.href = x+searchterm.replace(/ /g, '+') +';tt=on;nm=on;mx=20;';\n theLink.title = searchterm + x2;\n place.appendChild(theLink);\n theLink.appendChild(document.createTextNode(searchtitle))\n}\n\n\n\n//}}}\n
/***\n''Import Tiddlers Plugin for TiddlyWiki version 1.2.x, 2.0 and 2.1beta''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#ImportTiddlersPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nWhen many people share and edit copies of the same TiddlyWiki document, the ability to quickly collect all these changes back into a single, updated document that can then be redistributed to the entire group is very important. This plugin lets you selectively combine tiddlers from any two TiddlyWiki documents. It can also be very useful when moving your own tiddlers from document to document (e.g., when upgrading to the latest version of TiddlyWiki, or 'pre-loading' your favorite stylesheets into a new 'empty' TiddlyWiki document.)\n\n!!!!!Interactive interface\n<<<\n{{{<<importTiddlers>>}}}\ncreates "import tiddlers" link. click to show/hide import control panel\n\n{{{<<importTiddlers inline>>}}}\ncreates import control panel directly in tiddler content\n\n<<importTiddlers inline>>\n\nPress ''[browse]'' to select a TiddlyWiki document file to import. You can also type in the path/filename or a remote document URL (starting with http://)and press ''[open]''. //Note: There may be some delay to permit the browser time to access and load the document before updating the listbox with the titles of all tiddlers that are available to be imported.//\n\nSelect one or more titles from the listbox (hold CTRL or SHIFT while clicking to add/remove the highlight from individual list items). You can press ''[select all]'' to quickly highlight all tiddler titles in the list. Use the ''[-]'', ''[+]'', or ''[=]'' links to adjust the listbox size so you can view more (or less) tiddler titles at one time. When you have chosen the tiddlers you want to import and entered any extra tags, press ''[import]'' to begin copying them to the current TiddlyWiki document.\n\n''select: all, new, changes, or differences''\n\nYou can click on ''all'', ''new'', ''changes'', or ''differences'' to automatically select a subset of tiddlers from the list. This makes it very quick and easy to find and import just the updated tiddlers you are interested in:\n>''"all"'' selects ALL tiddlers from the import source document, even if they have not been changed.\n>''"new"'' selects only tiddlers that are found in the import source document, but do not yet exist in the destination document\n>''"changes"'' selects only tiddlers that exist in both documents but that are newer in the source document\n>''"differences"'' selects all new and existing tiddlers that are different from the destination document (even if destination tiddler is newer)\n\n''Import Tagging:''\n\nTiddlers that have been imported can be automatically tagged, so they will be easier to find later on, after they have been added to your document. New tags are entered into the "add tags" input field, and then //added// to the existing tags for each tiddler as it is imported.\n\n''Skip, Rename, Merge, or Replace:''\n\nWhen importing a tiddler whose title is identical to one that already exists, the import process pauses and the tiddler title is displayed in an input field, along with four push buttons: ''[skip]'', ''[rename]'', ''[merge]'' and ''[replace]''.\n\nTo bypass importing this tiddler, press ''[skip]''. To import the tiddler with a different name (so that both the tiddlers will exist when the import is done), enter a new title in the input field and then press ''[rename]''. Press ''[merge]'' to combine the content from both tiddlers into a single tiddler. Press ''[replace]'' to overwrite the existing tiddler with the imported one, discarding the previous tiddler content.\n\n//Note: if both the title ''and'' modification date/////time match, the imported tiddler is assumed to be identical to the existing one, and will be automatically skipped (i.e., not imported) without asking.//\n\n''Import Report History''\n\nWhen tiddlers are imported, a report is generated into ImportedTiddlers, indicating when the latest import was performed, the number of tiddlers successfully imported, from what location, and by whom. It also includes a list with the title, date and author of each tiddler that was imported.\n\nWhen the import process is completed, the ImportedTiddlers report is automatically displayed for your review. If more tiddlers are subsequently imported, a new report is //added// to ImportedTiddlers, above the previous report (i.e., at the top of the tiddler), so that a reverse-chronological history of imports is maintained.\n\nIf a cumulative record is not desired, the ImportedTiddlers report may be deleted at any time. A new ImportedTiddlers report will be created the next time tiddlers are imported.\n\nNote: You can prevent the ImportedTiddlers report from being generated for any given import activity by clearing the "create a report" checkbox before beginning the import processing.\n\n<<<\n!!!!!non-interactive 'load tiddlers' macro\n<<<\nUseful for automated installation/update of plugins and other tiddler content.\n\n{{{<<loadTiddlers "label:load tiddlers from %0" http://www.tiddlytools.com/example.html confirm>>}}}\n<<loadTiddlers "label:load tiddlers from %0" http://www.tiddlytools.com/example.html confirm>>\n\nSyntax:\n{{{<<loadTiddlers label:text prompt:text filter source quiet confirm>>}}}\n\n''label:text'' and ''prompt:text''\n>defines link text and tooltip (prompt) that can be clicked to trigger the load tiddler processing. If a label is NOT provided, then no link is created and loadTiddlers() is executed whenever the containing tiddler is rendered.\n''filter'' (optional) determines which tiddlers will be automatically selected for importing. Use one of the following keywords:\n>''"all"'' retrieves ALL tiddlers from the import source document, even if they have not been changed.\n>''"new"'' retrieves only tiddlers that are found in the import source document, but do not yet exist in the destination document\n>''"changes"'' retrieves only tiddlers that exist in both documents for which the import source tiddler is newer than the existing tiddler\n>''"updates"'' retrieves both ''new'' and ''changed'' tiddlers (this is the default action when none is specified)\n>''"tiddler:~TiddlerName"'' retrieves only the specific tiddler named in the parameter.\n>''"tag:text"'' retrieves only the tiddlers tagged with the indicated text.\n''source'' (required) is the location of the imported document. It can be either a local document path/filename in whatever format your system requires, or a remote web location (starting with "http://" or "https://")\n>use the keyword ''ask'' to prompt for a source location whenever the macro is invoked\n''"quiet"'' (optional)\n>supresses all status message during the import processing (e.g., "opening local file...", "found NN tiddlers..." etc). Note that if ANY tiddlers are actualy imported, a final information message will still be displayed (along with the ImportedTiddlers report), even when 'quiet' is specified. This ensures that changes to your document cannot occur without any visible indication at all.\n''"confirm"'' (optional)\n>adds interactive confirmation. A browser message box (OK/Cancel) is displayed for each tiddler that will be imported, so that you can manually bypass any tiddlers that you do not want to import.\n<<<\n!!!!!Installation\n<<<\ncopy/paste the following tiddlers into your document:\n''ImportTiddlersPlugin'' (tagged with <<tag systemConfig>>)\n\ncreate/edit ''SideBarOptions'': (sidebar menu items) \n^^Add "< < ImportTiddlers > >" macro^^\n\n''Quick Installation Tip #1:''\nIf you are using an unmodified version of TiddlyWiki (core release version <<version>>), you can get a new, empty TiddlyWiki with the Import Tiddlers plugin pre-installed (''[[download from here|TW+ImportExport.html]]''), and then simply import all your content from your old document into this new, empty document.\n<<<\n!!!!!Revision History\n<<<\n''2006.04.12 [3.0.3]''\nmoved many display messages to macro properties for easier L10N translations via 'lingo' definitions.\n''2006.04.12 [3.0.2]''\nadditional refactoring of 'core candidate' code. Proposed API now defines "loadRemoteFile()" for XMLHttpRequest processing with built in fallback for handling local filesystem access, and readTiddlersFromHTML() to process the resulting source HTML content.\n''2006.04.04 [3.0.1]''\nin refreshImportList(), when using [by tags], tiddlers without tags are now included in a new "untagged" psuedo-tag list section\n''2006.04.04 [3.0.0]''\nSeparate non-interactive {{{<<importTiddlers...>>}}} macro functionality for incorporation into TW2.1 core and renamed as {{{<<loadTiddlers>>}}} macro. New parameters for loadTiddlers: ''label:text'' and ''prompt:text'' for link creation, ''ask'' for filename/URL, ''tag:text'' for filtering, "confirm" for accept/reject of individual inbound tiddlers. Also, ImportedTiddlers report generator output has been simplified and "importReplace/importPublic" tags and associated "force" param (which were rarely, if ever, used) has been dropped.\n''2006.03.30 [2.9.1]''\nwhen extracting store area from remote URL, look for "</body>" instead of "</body>\sn</html>" so it will match even if the "\sn" is absent from the source.\n''2006.03.30 [2.9.0]''\nadded optional 'force' macro param. When present, autoImportTiddlers() bypasses the checks for importPublic and importReplace. Based on a request from Tom Otvos.\n''2006.03.28 [2.8.1]''\nin loadImportFile(), added checks to see if 'netscape' and 'x.overrideMimeType()' are defined (IE does *not* define these values, so we bypass this code)\nAlso, when extracting store area from remote URL, explicitly look for "</body>\sn</html>" to exclude any extra content that may have been added to the end of the file by hosting environments such as GeoCities. Thanks to Tom Otvos for finding these bugs and suggesting some fixes.\n''2006.02.21 [2.8.0]''\nadded support for "tiddler:TiddlerName" filtering parameter in auto-import processing\n''2006.02.21 [2.7.1]''\nClean up layout problems with IE. (Use tables for alignment instead of SPANs styled with float:left and float:right)\n''2006.02.21 [2.7.0]''\nAdded "local file" and "web server" radio buttons for selecting dynamic import source controls in ImportPanel. Default file control is replaced with URL text input field when "web server" is selected. Default remote document URL is defined in SiteURL tiddler. Also, added option for prepending SiteProxy URL as prefix to remote URL to mask cross-domain document access (requires compatible server-side script)\n''2006.02.17 [2.6.0]''\nRemoved "differences only" listbox display mode, replaced with selection filter 'presets': all/new/changes/differences. Also fixed initialization handling for "add new tags" so that checkbox state is correctly tracked when panel is first displayed.\n''2006.02.16 [2.5.4]''\nadded checkbox options to control "import remote tags" and "keep existing tags" behavior, in addition to existing "add new tags" functionality.\n''2006.02.14 [2.5.3]''\nFF1501 corrected unintended global 't' (loop index) in importReport() and autoImportTiddlers()\n''2006.02.10 [2.5.2]''\ncorrected unintended global variable in importReport().\n''2006.02.05 [2.5.1]''\nmoved globals from window.* to config.macros.importTiddlers.* to avoid FireFox 1.5.0.1 crash bug when referencing globals\n''2006.01.18 [2.5.0]''\nadded checkbox for "create a report". Default is to create/update the ImportedTiddlers report. Clear the checkbox to skip this step.\n''2006.01.15 [2.4.1]''\nadded "importPublic" tag and inverted default so that auto sharing is NOT done unless tagged with importPublic\n''2006.01.15 [2.4.0]''\nAdded support for tagging individual tiddlers with importSkip, importReplace, and/or importPrivate to control which tiddlers can be overwritten or shared with others when using auto-import macro syntax. Defaults are to SKIP overwriting existing tiddlers with imported tiddlers, and ALLOW your tiddlers to be auto-imported by others.\n''2006.01.15 [2.3.2]''\nAdded "ask" parameter to confirm each tiddler before importing (for use with auto-importing)\n''2006.01.15 [2.3.1]''\nStrip TW core scripts from import source content and load just the storeArea into the hidden IFRAME. Makes loading more efficient by reducing the document size and by preventing the import document from executing its TW initialization (including plugins). Seems to resolve the "Found 0 tiddlers" problem. Also, when importing local documents, use convertUTF8ToUnicode() to convert the file contents so support international characters sets.\n''2006.01.12 [2.3.0]''\nReorganized code to use callback function for loading import files to support event-driven I/O via an ASYNCHRONOUS XMLHttpRequest. Let's processing continue while waiting for remote hosts to respond to URL requests. Added non-interactive 'batch' macro mode, using parameters to specify which tiddlers to import, and from what document source. Improved error messages and diagnostics, plus an optional 'quiet' switch for batch mode to eliminate //most// feedback.\n''2006.01.11 [2.2.0]''\nAdded "[by tags]" to list of tiddlers, based on code submitted by BradleyMeck\n''2006.01.09 [2.1.1]''\nWhen a URL is typed in, and then the "open" button is pressed, it generates both an onChange event for the file input and a click event for open button. This results in multiple XMLHttpRequest()'s which seem to jam things up quite a bit. I removed the onChange handling for file input field. To open a file (local or URL), you must now explicitly press the "open" button in the control panel.\n''2006.01.08 [2.1.0]''\nIMPORT FROM ANYWHERE!!! re-write getImportedTiddlers() logic to either read a local file (using local I/O), OR... read a remote file, using a combination of XML and an iframe to permit cross-domain reading of DOM elements. Adapted from example code and techniques courtesy of Jonny LeRoy.\n''2006.01.06 [2.0.2]''\nWhen refreshing list contents, fixed check for tiddlerExists() when "show differences only" is selected, so that imported tiddlers that don't exist in the current file will be recognized as differences and included in the list.\n''2006.01.04 [2.0.1]''\nWhen "show differences only" is NOT checked, import all tiddlers that have been selected even when they have a matching title and date.\n''2005.12.27 [2.0.0]''\nUpdate for TW2.0\nDefer initial panel creation and only register a notification function when panel first is created\n''2005.12.22 [1.3.1]''\ntweak formatting in importReport() and add 'discard report' link to output\n''2005.12.03 [1.3.0]''\nDynamically create/remove importPanel as needed to ensure only one instance of interface elements exists, even if there are multiple instances of macro embedding. Also, dynamically create/recreate importFrame each time an external TW document is loaded for importation (reduces DOM overhead and ensures a 'fresh' frame for each document)\n''2005.11.29 [1.2.1]''\nfixed formatting of 'detail info' in importReport()\n''2005.11.11 [1.2.0]''\nadded 'inline' param to embed controls in a tiddler\n''2005.11.09 [1.1.0]''\nonly load HTML and CSS the first time the macro handler is called. Allows for redundant placement of the macro without creating multiple instances of controls with the same ID's.\n''2005.10.25 [1.0.5]''\nfixed typo in importReport() that prevented reports from being generated\n''2005.10.09 [1.0.4]''\ncombined documentation with plugin code instead of using separate tiddlers\n''2005.08.05 [1.0.3]''\nmoved CSS and HTML definitions into plugin code instead of using separate tiddlers\n''2005.07.27 [1.0.2]''\ncore update 1.2.29: custom overlayStyleSheet() replaced with new core setStylesheet()\n''2005.07.23 [1.0.1]''\nadded parameter checks and corrected addNotification() usage\n''2005.07.20 [1.0.0]''\nInitial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n// // ''MACRO DEFINITION''\n//{{{\n// Version\nversion.extensions.importTiddlers = {major: 3, minor: 0, revision: 3, date: new Date(2006,4,12)};\n\n// IE needs explicit global scoping for functions/vars called from browser events\nwindow.onClickImportButton=onClickImportButton;\nwindow.refreshImportList=refreshImportList;\n\n// default cookie/option values\nif (!config.options.chkImportReport) config.options.chkImportReport=true;\n\nconfig.macros.importTiddlers = { };\nconfig.macros.importTiddlers = {\n label: "import tiddlers",\n prompt: "Copy tiddlers from another document",\n foundMsg: "Found %0 tiddlers in %1",\n countMsg: "%0 tiddlers selected for import",\n importedMsg: "Imported %0 of %1 tiddlers from %2",\n src: "", // path/filename or URL of document to import (retrieved from SiteUrl tiddler)\n proxy: "", // URL for remote proxy script (retrieved from SiteProxy tiddler)\n useProxy: false, // use specific proxy script in front of remote URL\n inbound: null, // hash-indexed array of tiddlers from other document\n newTags: "", // text of tags added to imported tiddlers\n addTags: true, // add new tags to imported tiddlers\n listsize: 8, // # of lines to show in imported tiddler list\n importTags: true, // include tags from remote source document when importing a tiddler\n keepTags: true, // retain existing tags when replacing a tiddler\n index: 0, // current processing index in import list\n sort: "" // sort order for imported tiddler listbox\n};\n\nconfig.macros.importTiddlers.handler = function(place,macroName,params) {\n if (!config.macros.loadTiddlers.handler)\n { alert("importTiddlers error: this plugin requires LoadTiddlersPlugin or TiddlyWiki 2.1+"); return; }\n if (!params[0]) // LINK TO FLOATING PANEL\n createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);\n else if (params[0]=="inline") {// // INLINE TIDDLER CONTENT\n createImportPanel(place);\n document.getElementById("importPanel").style.position="static";\n document.getElementById("importPanel").style.display="block";\n }\n else config.macros.loadTiddlers.handler(place,macroName,params); // FALLBACK: PASS TO LOADTIDDLERS\n}\n//}}}\n\n// // ''INTERFACE DEFINITION''\n\n// // Handle link click to create/show/hide control panel\n//{{{\nfunction onClickImportMenu(e)\n{\n if (!e) var e = window.event;\n var parent=resolveTarget(e).parentNode;\n var panel = document.getElementById("importPanel");\n if (panel==undefined || panel.parentNode!=parent)\n panel=createImportPanel(parent);\n var isOpen = panel.style.display=="block";\n if(config.options.chkAnimate)\n anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,"none"));\n else\n panel.style.display = isOpen ? "none" : "block" ;\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return(false);\n}\n//}}}\n\n// // Create control panel: HTML, CSS, register for notification\n//{{{\nfunction createImportPanel(place) {\n var panel=document.getElementById("importPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n setStylesheet(config.macros.importTiddlers.css,"importTiddlers");\n panel=createTiddlyElement(place,"span","importPanel",null,null)\n panel.innerHTML=config.macros.importTiddlers.html;\n store.addNotification(null,refreshImportList); // refresh listbox after every tiddler change\n refreshImportList();\n var siteURL=store.getTiddlerText("SiteUrl"); if (!siteURL) siteURL="";\n document.getElementById("importSourceURL").value=siteURL;\n config.macros.importTiddlers.src=siteURL;\n var siteProxy=store.getTiddlerText("SiteProxy"); if (!siteProxy) siteProxy="SiteProxy";\n document.getElementById("importSiteProxy").value=siteProxy;\n config.macros.importTiddlers.proxy=siteProxy;\n return panel;\n}\n//}}}\n\n// // CSS\n//{{{\nconfig.macros.importTiddlers.css = '\s\n#importPanel {\s\n display: none; position:absolute; z-index:11; width:35em; right:105%; top:3em;\s\n background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\s\n border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\s\n padding: 0.5em; margin:0em; -moz-border-radius:1em;\s\n}\s\n#importPanel a, #importPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\s\n#importPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\s\n#importPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\s\n#importPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\s\n#importPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\s\n#importPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\s\n#importPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px;}\s\n#importPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\s\n#importPanel .rad { width:auto; }\s\n#importPanel .chk { width:auto; margin:1px; }\s\n#importPanel .btn { width:auto; }\s\n#importPanel .btn1 { width:98%; }\s\n#importPanel .btn2 { width:48%; }\s\n#importPanel .btn3 { width:32%; }\s\n#importPanel .btn4 { width:24%; }\s\n#importPanel .btn5 { width:19%; }\s\n#importPanel .importButton { padding: 0em; margin: 0px; font-size:8pt; }\s\n#importPanel .importListButton { padding:0em 0.25em 0em 0.25em; color: #000000; display:inline }\s\n#importCollisionPanel { display:none; margin:0.5em 0em 0em 0em; }\s\n';\n//}}}\n\n// // HTML \n//{{{\nconfig.macros.importTiddlers.html = '\s\n<!-- source and report -->\s\n<table><tr><td align=left>\s\n import from\s\n <input type="radio" class="rad" name="importFrom" value="file" CHECKED\s\n onClick="document.getElementById(\s'importLocalPanel\s').style.display=this.checked?\s'block\s':\s'none\s';\s\n document.getElementById(\s'importHTTPPanel\s').style.display=!this.checked?\s'block\s':\s'none\s'"> local file\s\n <input type="radio" class="rad" name="importFrom" value="http"\s\n onClick="document.getElementById(\s'importLocalPanel\s').style.display=!this.checked?\s'block\s':\s'none\s';\s\n document.getElementById(\s'importHTTPPanel\s').style.display=this.checked?\s'block\s':\s'none\s'"> web server\s\n</td><td align=right>\s\n <input type=checkbox class="chk" id="chkImportReport" checked\s\n onClick="config.options[\s'chkImportReport\s']=this.checked;"> create a report\s\n</td></tr></table>\s\n<!-- import from local file -->\s\n<div id="importLocalPanel" style="display:block;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999">\s\nlocal document path/filename:<br>\s\n<input type="file" id="fileImportSource" size=57 style="width:100%"\s\n onKeyUp="config.macros.importTiddlers.src=this.value"\s\n onChange="config.macros.importTiddlers.src=this.value;">\s\n</div><!--panel-->\s\n\s\n<!-- import from http server -->\s\n<div id="importHTTPPanel" style="display:none;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999">\s\n<table><tr><td align=left>\s\n remote document URL:<br>\s\n</td><td align=right>\s\n <input type="checkbox" class="chk" id="importUseProxy"\s\n onClick="config.macros.importTiddlers.useProxy=this.checked;\s\n document.getElementById(\s'importSiteProxy\s').style.display=this.checked?\s'block\s':\s'none\s'"> use a proxy script\s\n</td></tr></table>\s\n<input type="text" id="importSiteProxy" style="display:none;margin-bottom:1px" onfocus="this.select()" value="SiteProxy"\s\n onKeyUp="config.macros.importTiddlers.proxy=this.value"\s\n onChange="config.macros.importTiddlers.proxy=this.value;">\s\n<input type="text" id="importSourceURL" onfocus="this.select()" value="SiteUrl"\s\n onKeyUp="config.macros.importTiddlers.src=this.value"\s\n onChange="config.macros.importTiddlers.src=this.value;">\s\n</div><!--panel-->\s\n\s\n<table><tr><td align=left>\s\n select:\s\n <a href="JavaScript:;" id="importSelectAll"\s\n onclick="onClickImportButton(this)" title="select all tiddlers">\s\n all </a>\s\n <a href="JavaScript:;" id="importSelectNew"\s\n onclick="onClickImportButton(this)" title="select tiddlers not already in destination document">\s\n added </a> \s\n <a href="JavaScript:;" id="importSelectChanges"\s\n onclick="onClickImportButton(this)" title="select tiddlers that have been updated in source document">\s\n changes </a> \s\n <a href="JavaScript:;" id="importSelectDifferences"\s\n onclick="onClickImportButton(this)" title="select tiddlers that have been added or are different from existing tiddlers">\s\n differences </a> \s\n <a href="JavaScript:;" id="importToggleFilter"\s\n onclick="onClickImportButton(this)" title="show/hide selection filter">\s\n filter </a> \s\n</td><td align=right>\s\n <a href="JavaScript:;" id="importListSmaller"\s\n onclick="onClickImportButton(this)" title="reduce list size">\s\n – </a>\s\n <a href="JavaScript:;" id="importListLarger"\s\n onclick="onClickImportButton(this)" title="increase list size">\s\n + </a>\s\n <a href="JavaScript:;" id="importListMaximize"\s\n onclick="onClickImportButton(this)" title="maximize/restore list size">\s\n = </a>\s\n</td></tr></table>\s\n<select id="importList" size=8 multiple\s\n onchange="setTimeout(\s'refreshImportList(\s'+this.selectedIndex+\s')\s',1)">\s\n <!-- NOTE: delay refresh so list is updated AFTER onchange event is handled -->\s\n</select>\s\n<input type=checkbox class="chk" id="chkAddTags" checked\s\n onClick="config.macros.importTiddlers.addTags=this.checked;">add new tags \s\n<input type=checkbox class="chk" id="chkImportTags" checked\s\n onClick="config.macros.importTiddlers.importTags=this.checked;">import source tags \s\n<input type=checkbox class="chk" id="chkKeepTags" checked\s\n onClick="config.macros.importTiddlers.keepTags=this.checked;">keep existing tags<br>\s\n<input type=text id="txtNewTags" size=15 onKeyUp="config.macros.importTiddlers.newTags=this.value" autocomplete=off>\s\n<div align=center>\s\n <input type=button id="importOpen" class="importButton" style="width:32%" value="open"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importStart" class="importButton" style="width:32%" value="import"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importClose" class="importButton" style="width:32%" value="close"\s\n onclick="onClickImportButton(this)">\s\n</div>\s\n<div id="importCollisionPanel">\s\n tiddler already exists:\s\n <input type=text id="importNewTitle" size=15 autocomplete=off">\s\n <div align=center>\s\n <input type=button id="importSkip" class="importButton" style="width:23%" value="skip"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importRename" class="importButton" style="width:23%" value="rename"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importMerge" class="importButton" style="width:23%" value="merge"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importReplace" class="importButton" style="width:23%" value="replace"\s\n onclick="onClickImportButton(this)">\s\n </div>\s\n</div>\s\n';\n//}}}\n\n// // Control interactions\n//{{{\nfunction onClickImportButton(which)\n{\n // DEBUG alert(which.id);\n var theList = document.getElementById('importList');\n if (!theList) return;\n var thePanel = document.getElementById('importPanel');\n var theCollisionPanel = document.getElementById('importCollisionPanel');\n var theNewTitle = document.getElementById('importNewTitle');\n var count=0;\n switch (which.id)\n {\n case 'fileImportSource':\n case 'importOpen': // load import source into hidden frame\n importReport(); // if an import was in progress, generate a report\n config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer\n refreshImportList(); // reset/resize the listbox\n if (config.macros.importTiddlers.src=="") break;\n // Load document into hidden iframe so we can read it's DOM and fill the list\n loadRemoteFile(config.macros.importTiddlers.src, function(src,txt) {\n var tiddlers = readTiddlersFromHTML(txt);\n var count=tiddlers?tiddlers.length:0;\n displayMessage(config.macros.importTiddlers.foundMsg.format([count,src]));\n config.macros.importTiddlers.inbound=tiddlers;\n window.refreshImportList(0);\n });\n break;\n case 'importSelectAll': // select all tiddler list items (i.e., not headings)\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n if (theList.options[t].value=="") continue;\n theList.options[t].selected=true;\n count++;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importSelectNew': // select tiddlers not in current document\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n theList.options[t].selected=false;\n if (theList.options[t].value=="") continue;\n theList.options[t].selected=!store.tiddlerExists(theList.options[t].value);\n count+=theList.options[t].selected?1:0;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importSelectChanges': // select tiddlers that are updated from existing tiddlers\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n theList.options[t].selected=false;\n if (theList.options[t].value==""||!store.tiddlerExists(theList.options[t].value)) continue;\n for (var i=0; i<config.macros.importTiddlers.inbound.length; i++) // find matching inbound tiddler\n { var inbound=config.macros.importTiddlers.inbound[i]; if (inbound.title==theList.options[t].value) break; }\n theList.options[t].selected=(inbound.modified-store.getTiddler(theList.options[t].value).modified>0); // updated tiddler\n count+=theList.options[t].selected?1:0;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importSelectDifferences': // select tiddlers that are new or different from existing tiddlers\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n theList.options[t].selected=false;\n if (theList.options[t].value=="") continue;\n if (!store.tiddlerExists(theList.options[t].value)) { theList.options[t].selected=true; count++; continue; }\n for (var i=0; i<config.macros.importTiddlers.inbound.length; i++) // find matching inbound tiddler\n { var inbound=config.macros.importTiddlers.inbound[i]; if (inbound.title==theList.options[t].value) break; }\n theList.options[t].selected=(inbound.modified-store.getTiddler(theList.options[t].value).modified!=0); // changed tiddler\n count+=theList.options[t].selected?1:0;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importToggleFilter': // show/hide filter\n case 'importFilter': // apply filter\n alert("coming soon!");\n break;\n case 'importStart': // initiate the import processing\n importReport(); // if an import was in progress, generate a report\n config.macros.importTiddlers.index=0;\n config.macros.importTiddlers.index=importTiddlers(0);\n importStopped();\n break;\n case 'importClose': // unload imported tiddlers or hide the import control panel\n // if imported tiddlers not loaded, close the import control panel\n if (!config.macros.importTiddlers.inbound) { thePanel.style.display='none'; break; }\n importReport(); // if an import was in progress, generate a report\n config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer\n refreshImportList(); // reset/resize the listbox\n break;\n case 'importSkip': // don't import the tiddler\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n theImported.status='skipped after asking'; // mark item as skipped\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index+1); // resume with NEXT item\n importStopped();\n break;\n case 'importRename': // change name of imported tiddler\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n theImported.status = 'renamed from '+theImported.title; // mark item as renamed\n theImported.set(theNewTitle.value,null,null,null,null); // change the tiddler title\n theItem.value = theNewTitle.value; // change the listbox item text\n theItem.text = theNewTitle.value; // change the listbox item text\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with THIS item\n importStopped();\n break;\n case 'importMerge': // join existing and imported tiddler content\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n var theExisting = store.getTiddler(theItem.value);\n var theText = theExisting.text+'\sn----\sn^^merged from: ';\n theText +='[['+config.macros.importTiddlers.src+'#'+theItem.value+'|'+config.macros.importTiddlers.src+'#'+theItem.value+']]^^\sn';\n theText +='^^'+theImported.modified.toLocaleString()+' by '+theImported.modifier+'^^\sn'+theImported.text;\n var theDate = new Date();\n var theTags = theExisting.getTags()+' '+theImported.getTags();\n theImported.set(null,theText,null,theDate,theTags);\n theImported.status = 'merged with '+theExisting.title; // mark item as merged\n theImported.status += ' - '+theExisting.modified.formatString("MM/DD/YYYY 0hh:0mm:0ss");\n theImported.status += ' by '+theExisting.modifier;\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with this item\n importStopped();\n break;\n case 'importReplace': // substitute imported tiddler for existing tiddler\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n var theExisting = store.getTiddler(theItem.value);\n theImported.status = 'replaces '+theExisting.title; // mark item for replace\n theImported.status += ' - '+theExisting.modified.formatString("MM/DD/YYYY 0hh:0mm:0ss");\n theImported.status += ' by '+theExisting.modifier;\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with THIS item\n importStopped();\n break;\n case 'importListSmaller': // decrease current listbox size, minimum=5\n if (theList.options.length==1) break;\n theList.size-=(theList.size>5)?1:0;\n config.macros.importTiddlers.listsize=theList.size;\n break;\n case 'importListLarger': // increase current listbox size, maximum=number of items in list\n if (theList.options.length==1) break;\n theList.size+=(theList.size<theList.options.length)?1:0;\n config.macros.importTiddlers.listsize=theList.size;\n break;\n case 'importListMaximize': // toggle listbox size between current and maximum\n if (theList.options.length==1) break;\n theList.size=(theList.size==theList.options.length)?config.macros.importTiddlers.listsize:theList.options.length;\n break;\n }\n}\n//}}}\n\n// // refresh listbox\n//{{{\nfunction refreshImportList(selectedIndex)\n{\n var theList = document.getElementById("importList");\n if (!theList) return;\n // if nothing to show, reset list content and size\n if (!config.macros.importTiddlers.inbound) \n {\n while (theList.length > 0) { theList.options[0] = null; }\n theList.options[0]=new Option('please open a document...',"",false,false);\n theList.size=config.macros.importTiddlers.listsize;\n return;\n }\n // get the sort order\n if (!selectedIndex) selectedIndex=0;\n if (selectedIndex==0) config.macros.importTiddlers.sort='title'; // heading\n if (selectedIndex==1) config.macros.importTiddlers.sort='title';\n if (selectedIndex==2) config.macros.importTiddlers.sort='modified';\n if (selectedIndex==3) config.macros.importTiddlers.sort='tags';\n if (selectedIndex>3) {\n // display selected tiddler count\n for (var t=0,count=0; t < theList.options.length; t++) count+=(theList.options[t].selected&&theList.options[t].value!="")?1:0;\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n return; // no refresh needed\n }\n\n // get the alphasorted list of tiddlers (optionally, filter out unchanged tiddlers)\n var tiddlers=config.macros.importTiddlers.inbound;\n tiddlers.sort(function (a,b) {if(a['title'] == b['title']) return(0); else return (a['title'] < b['title']) ? -1 : +1; });\n // clear current list contents\n while (theList.length > 0) { theList.options[0] = null; }\n // add heading and control items to list\n var i=0;\n var indent=String.fromCharCode(160)+String.fromCharCode(160);\n theList.options[i++]=new Option(tiddlers.length+' tiddler'+((tiddlers.length!=1)?'s are':' is')+' in the document',"",false,false);\n theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="title" )?">":indent)+' [by title]',"",false,false);\n theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="modified")?">":indent)+' [by date]',"",false,false);\n theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="tags")?">":indent)+' [by tags]',"",false,false);\n // output the tiddler list\n switch(config.macros.importTiddlers.sort)\n {\n case "title":\n for(var t = 0; t < tiddlers.length; t++)\n theList.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);\n break;\n case "modified":\n // sort descending for newest date first\n tiddlers.sort(function (a,b) {if(a['modified'] == b['modified']) return(0); else return (a['modified'] > b['modified']) ? -1 : +1; });\n var lastSection = "";\n for(var t = 0; t < tiddlers.length; t++) {\n var tiddler = tiddlers[t];\n var theSection = tiddler.modified.toLocaleDateString();\n if (theSection != lastSection) {\n theList.options[i++] = new Option(theSection,"",false,false);\n lastSection = theSection;\n }\n theList.options[i++] = new Option(indent+indent+tiddler.title,tiddler.title,false,false);\n }\n break;\n case "tags":\n var theTitles = {}; // all tiddler titles, hash indexed by tag value\n var theTags = new Array();\n for(var t=0; t<tiddlers.length; t++) {\n var title=tiddlers[t].title;\n var tags=tiddlers[t].tags;\n if (!tags || !tags.length) {\n if (theTitles["untagged"]==undefined) { theTags.push("untagged"); theTitles["untagged"]=new Array(); }\n theTitles["untagged"].push(title);\n }\n else for(var s=0; s<tags.length; s++) {\n if (theTitles[tags[s]]==undefined) { theTags.push(tags[s]); theTitles[tags[s]]=new Array(); }\n theTitles[tags[s]].push(title);\n }\n }\n theTags.sort();\n for(var tagindex=0; tagindex<theTags.length; tagindex++) {\n var theTag=theTags[tagindex];\n theList.options[i++]=new Option(theTag,"",false,false);\n for(var t=0; t<theTitles[theTag].length; t++)\n theList.options[i++]=new Option(indent+indent+theTitles[theTag][t],theTitles[theTag][t],false,false);\n }\n break;\n }\n theList.selectedIndex=selectedIndex; // select current control item\n if (theList.size<config.macros.importTiddlers.listsize) theList.size=config.macros.importTiddlers.listsize;\n if (theList.size>theList.options.length) theList.size=theList.options.length;\n}\n//}}}\n\n// // re-entrant processing for handling import with interactive collision prompting\n//{{{\nfunction importTiddlers(startIndex)\n{\n if (!config.macros.importTiddlers.inbound) return -1;\n\n var theList = document.getElementById('importList');\n if (!theList) return;\n var t;\n // if starting new import, reset import status flags\n if (startIndex==0)\n for (var t=0;t<config.macros.importTiddlers.inbound.length;t++)\n config.macros.importTiddlers.inbound[t].status="";\n for (var i=startIndex; i<theList.options.length; i++)\n {\n // if list item is not selected or is a heading (i.e., has no value), skip it\n if ((!theList.options[i].selected) || ((t=theList.options[i].value)==""))\n continue;\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==t) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n var theExisting = store.getTiddler(theImported.title);\n // avoid redundant import for tiddlers that are listed multiple times (when 'by tags')\n if (theImported.status=="added")\n continue;\n // don't import the "ImportedTiddlers" history from the other document...\n if (theImported.title=='ImportedTiddlers')\n continue;\n // if tiddler exists and import not marked for replace or merge, stop importing\n if (theExisting && (theImported.status.substr(0,7)!="replace") && (theImported.status.substr(0,5)!="merge"))\n return i;\n // assemble tags (remote + existing + added)\n var newTags = "";\n if (config.macros.importTiddlers.importTags)\n newTags+=theImported.getTags() // import remote tags\n if (config.macros.importTiddlers.keepTags && theExisting)\n newTags+=" "+theExisting.getTags(); // keep existing tags\n if (config.macros.importTiddlers.addTags && config.macros.importTiddlers.newTags.trim().length)\n newTags+=" "+config.macros.importTiddlers.newTags; // add new tags\n theImported.set(null,null,null,null,newTags.trim());\n // set the status to 'added' (if not already set by the 'ask the user' UI)\n theImported.status=(theImported.status=="")?'added':theImported.status;\n // do the import!\n store.addTiddler(theImported);\n store.setDirty(true);\n }\n return(-1); // signals that we really finished the entire list\n}\n//}}}\n\n//{{{\nfunction importStopped()\n{\n var theList = document.getElementById('importList');\n var theNewTitle = document.getElementById('importNewTitle');\n if (!theList) return;\n if (config.macros.importTiddlers.index==-1)\n importReport(); // import finished... generate the report\n else\n {\n // DEBUG alert('import stopped at: '+config.macros.importTiddlers.index);\n // import collision... show the collision panel and set the title edit field\n document.getElementById('importCollisionPanel').style.display='block';\n theNewTitle.value=theList.options[config.macros.importTiddlers.index].value;\n }\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n//{{{\nfunction importReport(quiet)\n{\n if (!config.macros.importTiddlers.inbound) return;\n // DEBUG alert('importReport: start');\n\n // if import was not completed, the collision panel will still be open... close it now.\n var panel=document.getElementById('importCollisionPanel'); if (panel) panel.style.display='none';\n\n // get the alphasorted list of tiddlers\n var tiddlers = config.macros.importTiddlers.inbound;\n // gather the statistics\n var count=0;\n for (var t=0; t<tiddlers.length; t++)\n if (tiddlers[t].status && tiddlers[t].status.trim().length && tiddlers[t].status.substr(0,7)!="skipped") count++;\n\n // generate a report\n if (count && config.options.chkImportReport) {\n // get/create the report tiddler\n var theReport = store.getTiddler('ImportedTiddlers');\n if (!theReport) { theReport= new Tiddler(); theReport.title = 'ImportedTiddlers'; theReport.text = ""; }\n // format the report content\n var now = new Date();\n var newText = "On "+now.toLocaleString()+", "+config.options.txtUserName\n newText +=" imported "+count+" tiddler"+(count==1?"":"s")+" from\sn[["+config.macros.importTiddlers.src+"|"+config.macros.importTiddlers.src+"]]:\sn";\n if (config.macros.importTiddlers.addTags && config.macros.importTiddlers.newTags.trim().length)\n newText += "imported tiddlers were tagged with: \s""+config.macros.importTiddlers.newTags+"\s"\sn";\n newText += "<<<\sn";\n for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status) newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\sn";\n newText += "<<<\sn";\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+theReport.title+"'); store.deleteTiddler('"+theReport.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n theReport.text = newText+((theReport.text!="")?'\sn----\sn':"")+theReport.text;\n theReport.modifier = config.options.txtUserName;\n theReport.modified = new Date();\n store.addTiddler(theReport);\n if (!quiet) { story.displayTiddler(null,theReport.title,1,null,null,false); story.refreshTiddler(theReport.title,1,true); }\n }\n\n // reset status flags\n for (var t=0; t<config.macros.importTiddlers.inbound.length; t++) config.macros.importTiddlers.inbound[t].status="";\n\n // refresh display if tiddlers have been loaded\n if (count) { store.setDirty(true); store.notifyAll(); }\n\n // always show final message when tiddlers were actually loaded\n if (count) displayMessage(config.macros.importTiddlers.importedMsg.format([count,tiddlers.length,config.macros.importTiddlers.src]));\n}\n//}}}\n\n/***\n!!!!!TW 2.1beta Core Code Candidate\n//The following section is a preliminary 'code candidate' for incorporation of non-interactive 'load tiddlers' functionality into TW2.1beta. //\n***/\n//{{{\n// default cookie/option values\nif (!config.options.chkImportReport) config.options.chkImportReport=true;\n\nconfig.macros.loadTiddlers = {\n label: "",\n prompt: "add/update tiddlers from '%0'",\n askMsg: "Please enter a local path/filename or a remote URL",\n openMsg: "Opening %0",\n openErrMsg: "Could not open %0 - error=%1",\n readMsg: "Read %0 bytes from %1",\n foundMsg: "Found %0 tiddlers in %1",\n loadedMsg: "Loaded %0 of %1 tiddlers from %2"\n};\n\nconfig.macros.loadTiddlers.handler = function(place,macroName,params) {\n var label=(params[0].substr(0,6)=='label:')?params.shift().substr(6):this.label;\n var prompt=(params[0].substr(0,7)=='prompt:')?params.shift().substr(6):this.prompt;\n var filter="updates";\n if (params[0]=='all' || params[0]=='new' || params[0]=='changes' || params[0]=='updates'\n || params[0].substr(0,8)=='tiddler:' || params[0].substr(0,4)=='tag:')\n filter=params.shift();\n var src=params.shift(); if (!src || !src.length) return; // filename is required\n var quiet=(params[0]=="quiet"); if (quiet) params.shift();\n var ask=(params[0]=="confirm"); if (ask) params.shift();\n if (label.trim().length) {\n // link triggers load tiddlers from another file/URL and then applies filtering rules to add/replace tiddlers in the store\n createTiddlyButton(place,label.format([src]),prompt.format([src]), function() {\n if (src=="ask") src=prompt(config.macros.loadTiddlers.askMsg);\n loadRemoteFile(src,loadTiddlers,quiet,ask,filter);\n })\n }\n else {\n // load tiddlers from another file/URL and then apply filtering rules to add/replace tiddlers in the store\n if (src=="ask") src=prompt(config.macros.loadTiddlers.askMsg);\n loadRemoteFile(src,loadTiddlers,quiet,ask,filter);\n }\n}\n\nfunction loadTiddlers(src,html,filter,quiet,ask)\n{\n var tiddlers = readTiddlersFromHTML(html);\n var count=tiddlers?tiddlers.length:0;\n if (!quiet) displayMessage(config.macros.loadTiddlers.foundMsg.format([count,src]));\n var count=0;\n if (tiddlers) for (var t=0;t<tiddlers.length;t++) {\n var theInbound = tiddlers[t];\n var theExisting = store.getTiddler(theInbound.title);\n if (theInbound.title=='ImportedTiddlers')\n continue; // skip "ImportedTiddlers" history from the other document...\n\n // apply the all/new/changes/updates filter (if any)\n if (filter && filter!="all") {\n if ((filter=="new") && theExisting) // skip existing tiddlers\n continue;\n if ((filter=="changes") && !theExisting) // skip new tiddlers\n continue;\n if ((filter.substr(0,4)=="tag:") && theInbound.tags.find(filter.substr(4))==null) // must match specific tag value\n continue;\n if ((filter.substr(0,8)=="tiddler:") && theInbound.title!=filter.substr(8)) // must match specific tiddler name\n continue;\n if (store.tiddlerExists(theInbound.title) && ((theExisting.modified.getTime()-theInbound.modified.getTime())>=0)) // tiddler is unchanged\n continue;\n }\n // get confirmation if required\n if (ask && !confirm((theExisting?"Update":"Add")+" tiddler '"+theInbound.title+"'\snfrom "+src))\n { tiddlers[t].status="skipped - cancelled by user"; continue; }\n // DO IT!\n store.addTiddler(theInbound);\n tiddlers[t].status=theExisting?"updated":"added"\n count++;\n }\n if (count) {\n // refresh display\n store.setDirty(true);\n store.notifyAll();\n // generate a report\n if (config.options.chkImportReport) {\n // get/create the report tiddler\n var theReport = store.getTiddler('ImportedTiddlers');\n if (!theReport) { theReport= new Tiddler(); theReport.title = 'ImportedTiddlers'; theReport.text = ""; }\n // format the report content\n var now = new Date();\n var newText = "On "+now.toLocaleString()+", "+config.options.txtUserName+" loaded "+count+" tiddlers from\sn[["+src+"|"+src+"]]:\sn";\n newText += "<<<\sn";\n for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status) newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\sn";\n newText += "<<<\sn";\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+theReport.title+"'); store.deleteTiddler('"+theReport.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n theReport.text = newText+((theReport.text!="")?'\sn----\sn':"")+theReport.text;\n theReport.modifier = config.options.txtUserName;\n theReport.modified = new Date();\n store.addTiddler(theReport);\n if (!quiet) { story.displayTiddler(null,theReport.title,1,null,null,false); story.refreshTiddler(theReport.title,1,true); }\n }\n }\n // always show final message when tiddlers were actually loaded\n if (!quiet||count) displayMessage(config.macros.loadTiddlers.loadedMsg.format([count,tiddlers.length,src]));\n}\n\nfunction loadRemoteFile(src,callback,quiet,ask,filter) {\n if (src==undefined || !src.length) return null; // filename is required\n if (!quiet) clearMessage();\n if (!quiet) displayMessage(config.macros.loadTiddlers.openMsg.format([src]));\n if (src.substr(0,4)!="http") { // fallback to read from local filesystem\n var txt=loadFile(src);\n if ((txt==null)||(txt==false)) // file didn't load\n { if (!quiet) displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,"(unknown)"])); }\n else {\n if (!quiet) displayMessage(config.macros.loadTiddlers.readMsg.format([txt.length,src]));\n if (callback) callback(src,convertUTF8ToUnicode(txt),quiet,ask,filter);\n }\n }\n else {\n var x; // XML object\n try {x = new XMLHttpRequest()}\n catch(e) {\n try {x = new ActiveXObject("Msxml2.XMLHTTP")}\n catch (e) {\n try {x = new ActiveXObject("Microsoft.XMLHTTP")}\n catch (e) { return }\n }\n }\n x.onreadystatechange = function() {\n if (x.readyState == 4) {\n if (x.status == 200) {\n if (!quiet) displayMessage(config.macros.loadTiddlers.readMsg.format([x.responseText.length,src]));\n if (callback) callback(src,x.responseText,quiet,ask,filter);\n }\n else {\n if (!quiet) displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,x.status]));\n }\n }\n }\n if ((document.location.protocol=="file:") && (typeof(netscape)!="undefined")) { // UniversalBrowserRead only works from a local file context\n try { netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead')}\n catch (e) { if (!quiet) displayMessage(e.description?e.description:e.toString()); }\n }\n try {\n var url=src+(src.indexOf('?')<0?'?':'&')+'nocache='+Math.random();\n x.open("GET",url,true);\n if (x.overrideMimeType) x.overrideMimeType('text/html');\n x.send(null);\n }\n catch (e) {\n if (!quiet) {\n displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,"(unknown)"]));\n displayMessage(e.description?e.description:e.toString());\n }\n }\n }\n}\n\nfunction readTiddlersFromHTML(html)\n{\n // extract store area from html \n var start=html.indexOf('<div id="storeArea">');\n var end=html.indexOf('</body>',start);\n var sa="<html><body>"+html.substring(start,end)+"</body></html>";\n\n // load html into iframe document\n var f=document.getElementById("loaderFrame"); if (f) document.body.removeChild(f);\n f=document.createElement("iframe"); f.id="loaderFrame";\n f.style.width="0px"; f.style.height="0px"; f.style.border="0px";\n document.body.appendChild(f);\n var d=f.document;\n if (f.contentDocument) d=f.contentDocument; // For NS6\n else if (f.contentWindow) d=f.contentWindow.document; // For IE5.5 and IE6\n d.open(); d.writeln(sa); d.close();\n\n // read tiddler DIVs from storeArea DOM element \n var sa = d.getElementById("storeArea");\n if (!sa) return null;\n sa.normalize();\n var nodes = sa.childNodes;\n if (!nodes || !nodes.length) return null;\n var tiddlers = [];\n for(var t = 0; t < nodes.length; t++) {\n var title = null;\n if(nodes[t].getAttribute)\n title = nodes[t].getAttribute("tiddler");\n if(!title && nodes[t].id && (nodes[t].id.substr(0,5) == "store"))\n title = nodes[t].id.substr(5);\n if(title && title != "")\n tiddlers.push((new Tiddler()).loadFromDiv(nodes[t],title));\n }\n return tiddlers;\n}\n//}}}
\nMovieManager\n\n<<newMovie NewMovieForm "New Movie" '"Movies - MovieNameHere"' askUser "Movie">>\n\nToDo\nChangeLog \nMainMenu\nStyleSheet\n[[CSS-movietable]]\nMovieTools\n
/***\n<<DateSeen>>\n\n<<SetRating>>\n***/\n//{{{\nconfig.macros.DateSeen={};\nconfig.macros.DateSeen.handler=function(place,macroName,params,wikifier,paramString,tiddler){\n\n var onClick=function(){\n var taggedtiddlers = store.getTaggedTiddlers("MovSeen");\n for (var t=0; t<taggedtiddlers.length; t++){\n var tiddler= taggedtiddlers[t];\n if (!tiddler.data("movieDateSeen"))\n var thedate= (tiddler.modified)?tiddler.modified:tiddler.created;\n\n var timeFormat= 'YY0MMDD';\n var thedate2= (thedate).formatString(timeFormat);\n tiddler.setData("movieDateSeen",thedate2);\n}\n\n}\n\ncreateTiddlyButton(place,"Set Date Seen","Set Date Seen",onClick);\n\n}\n//}}}\n\n//{{{\nconfig.macros.SetRating={};\nconfig.macros.SetRating.handler=function(place,macroName,params,wikifier,paramString,tiddler){\n\n var onClick=function(){\n var taggedtiddlers = store.getTaggedTiddlers("Movie");\n for (var t=0; t<taggedtiddlers.length; t++){\n var tiddler= taggedtiddlers[t];\n if (!tiddler.data("movieRating"))\ntiddler.setData("movieRating","");\n}\n\n\n}\n\ncreateTiddlyButton(place,"Set Blank Rating","Set Blank Rating",onClick);\n\n}\n//}}}
config.macros.movielink = {};\nconfig.macros.movielink.handler= function(place,macroName,params) {\n\nvar t=store.getTiddler(story.findContainingTiddler(place).id.substr(7));\nvar mTitle=t.data("movieName");\nvar x= 'http://imdb.com/find?q=';\n\n var theMLink = document.createElement("a");\n theMLink.className = "externalLink";\n theMLink.target = "_blank";\n theMLink.href = x+mTitle.replace(/ /g, '+');\n theMLink.title = mTitle + ' ' + 'on IMDB';\n place.appendChild(theMLink);\n theMLink.appendChild(document.createTextNode('IMDB'));\n }
<<forEachTiddler\n where \n 'tiddler.tags.contains("Movie") && ! tiddler.tags.containsAny(["MovToSee","MovFav","MovSeen","MovWatchAgain"])'\n sortBy \n '(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index==0?"!!There are \s'\s'@@color:red;"+count+"@@\s'\s' movies not on any list.":"")'\n>><<tabs txtMovMan\n'Movies To See' "Movies to see" MoviesToSee\n'Movies Seen' "Movies Seen" MoviesSeen\n'Top Movies' "Top Movies" MoviesTop\n'Watch Again' "Watch Again" MoviesWatchAgain\n'Tools' "MovieManager Tools" MovieTools \n>>
{{movietable{\n!Movies not on any list\n{{boxtext{<<forEachTiddler \n where \n 'tiddler.tags.contains("Movie") && ! tiddler.tags.containsAny(["MovToSee","MovFav","MovSeen","MovWatchAgain"])'\n sortBy \n '(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index == 0 ? "There are \s'\s'@@color:red;"+count+"@@\s'\s' movies not on any list.+++...\sn<html><br><table id=\s"MoviesNotOnList\s" cellspacing=\s"0\s" ><caption align=\s"top\s">Movies Not On Any Lists</caption><thead><tr><th> # </th><th>Title</th><th></th><th>Seen</th><th>Top Movie</th><th>Watch Again</th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center > [_("+tiddler.title+":MovSeen){(this.fn_init)}{movieMarkSeen(this.tiddler,\s'MovToSee\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center > [_("+tiddler.title+":MovSeen){(this.fn_init)}{movieMarkSeen(this.tiddler,\s'MovToSee\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>") +\n(index == count-1 ? "</tbody></table><br></html>\sn===" : "")'\n>>}}}\n!Movies seen but not rated\n{{boxtext{<<forEachTiddler \n where \n 'tiddler.tags.containsAny(["MovFav","MovSeen","MovWatchAgain"]) && ! tiddler.data("movieRating")'\n sortBy \n '(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index == 0 ? "There are \s'\s'@@color:red;"+count+"@@\s'\s' movies seen but not rated.+++...\sn<html><table id=\s"MoviesSeenNotRated\s" cellspacing=\s"0\s" ><caption align=\s"top\s">Movies Seen But Not Rated</caption><thead><tr><th> # </th><th>Title</th><th></th><th>Enter Rating</th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td></tr>") +\n(index == count-1 ? "</tbody></table><br></html>\sn===" : "")'\n>>}}}\n!Official List of Movies (Top Movies + Movies To See)\n{{boxtext{<<forEachTiddler \n where \n 'tiddler.tags.containsAny(["MovFav","MovToSee"])'\n sortBy \n '(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index == 0 ? "There are \s'\s'"+count+"\s'\s' movies on this list.+++...\sn<html><table id=\s"MoviesOfficialList\s" cellspacing=\s"0\s" width=\s"380\s"><caption align=\s"top\s">Official List of Movies (Top + To See)</caption><thead><tr><th> # </th><th>Title</th><th></th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>") +\n(index == count-1 ? "</tbody></table><br></html>\sn===" : "")'\n>>}}}\n!Recent Imported Movies\n{{boxtext{<<forEachTiddler\n where \n 'tiddler.tags.contains("MovImported")&& (((tiddler.created).formatString("MMM"))==((new Date()).formatString("MMM")))'\n sortBy \n '(tiddler.created)'\ndescending\nwrite\n'(index == 0 ? "There are \s'\s'"+count+"\s'\s' movies imported this month.+++...\sn<html><table id=\s"MoviesImportedThisMonth\s" cellspacing=\s"0\s" width=\s"320\s"><caption align=\s"top\s">Movies Imported This Month</caption><thead><tr><th> # </th><th>Title</th><th></th></tr></thead><tbody>": "") +((index%2== 0)? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>" : "") +((index%2 == 1)? "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>":"") + (index == count-1 ? "</tbody></table></html>\sn===" : "")'\n>>\nLast ''15'' imported movies.+++...<<forEachTiddler\n where\n 'tiddler.tags.contains("MovImported")'\n sortBy\n '(tiddler.created)'\ndescending\nwrite\n'(index == 0 ? "<html><table id=\s"MoviesImported15\s" cellspacing=\s"0\s" width=\s"320\s"><caption align=\s"top\s">Movies Recently Imported</caption><thead><tr><th> # </th><th>Title</th><th></th></tr></thead><tbody>": "") +((index%2== 0)&&(index<15) ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>" : "") +((index%2 == 1)&&(index<15) ? "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>":"") + (index == count-1 ? "</tbody></table><br></html>\sn" : "")'\n>>===}}}\n!Recent Manually Added Movies.\n{{boxtext{Last ''15'' manually added movies.+++...<<forEachTiddler\n where\n 'tiddler.tags.contains("Movie") && ! tiddler.tags.contains("MovImported")'\n sortBy\n '(tiddler.created)'\ndescending\nwrite\n'(index == 0 ? "<html><table id=\s"MoviesAdded15\s" cellspacing=\s"0\s" width=\s"320\s"><caption align=\s"top\s">Movies Recently Added</caption><thead><tr><th> # </th><th>Title</th><th></th></tr></thead><tbody>": "") +((index%2== 0)&&(index<15) ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>" : "") +((index%2 == 1)&&(index<15) ? "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td></tr>":"") + (index == count-1 ? "</tbody></table><br></html>\sn" : "")'\n>>===}}}}}}\n!Save Movie Lists to File.\n{{boxtext{\n*Choose a movie list from the drop down menu.<<writeMovieList>>\n*The text file will be saved in current <<dynamicLink>>.\n}}}\n
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"12 Monkeys","movieRating":"7.5"}</data>\n\n
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Cars","movieRating":"","movieDateSeen":"06063"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Death to Smoochy","movieDateSeen":"060417"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Erin Brockovich","movieRating":"","movieDateSeen":"06063"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Fight Club"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Finding Nemo","movieRating":"7.5","movieDateSeen":"06063"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Institute Benjamenta, or This Dream People Call Human Life","movieRating":"8.0","movieDateSeen":"06063"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Kinky Boots","movieRating":"7.0","movieDateSeen":"06063"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Kiss Kiss Bang Bang","movieRating":"9.1","movieReview":"Best comedy I have seen in a long time.","movieNotes":"Dont quit your gay job!","movieDateSeen":"060415"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"London","movieRating":"9.0","movieDateSeen":"06063"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"The Matador","movieRating":"8.5","movieDateSeen":"060418"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Mission: Impossible III","movieRating":""}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Munich","movieRating":""}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Proof","movieRating":""}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Reservoir Dogs","movieRating":""}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Syriana","movieRating":""}</data>\n\n
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"The Benchwarmers","movieRating":""}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"The Break-Up","movieRating":""}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Titus","movieReview":"A brilliant Shakespeare adaptation","movieRating":"9.2"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"Wolf Creek","movieDateSeen":"060417","movieRating":"6.0"}</data>
<<formTiddler [[NewMovieForm]]>><data>{"movieName":"animatrix","movieRating":"6.6"}</data>
\n{{movietable{\n<<forEachTiddler \n where \n 'tiddler.tags.containsAny(["MovSeen","MovSeenAgain"])'\n sortBy \n 'tiddler.data("movieDateSeen")'\ndescending\nwrite\n'(index == 0 ? "<html><table id=\s"MoviesSeenTable\s" cellspacing=\s"0\s"><caption align=\s"top\s">Movies Seen - 2006</caption><thead><tr><th> # </th><th>Title</th><th></th><th>Rating</th><th>Seen</th><th>Top Movie</th><th>Watch Again</th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td><td align=center> [_("+tiddler.title+":MovSeen){(this.fn_init)}{removeTag(this.tiddler,\s'MovToSee\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td><td align=center> [_("+tiddler.title+":MovSeen){(this.fn_init)}{removeTag(this.tiddler,\s'MovToSee\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>") +\n(index == count-1 ? "</tbody></table></html>" : "")'\n>>\n<<sortit "MoviesSeenTable">>\n}}}
\n{{movietable{\n<<forEachTiddler \n where \n 'tiddler.tags.contains("MovToSee") && ! tiddler.tags.contains("MovSeen")'\n sortBy \n '(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index == 0 ? "<html><table id=\s"MoviesToSeeTable\s" cellspacing=\s"0\s"><caption align=\s"top\s">Movies To See</caption><thead><tr><th> # </th><th>Title</th><th></th><th>Seen</th><th>Top Movie</th><th>Watch Again</th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center > [_("+tiddler.title+":MovSeen){(this.fn_init)}{movieMarkSeen(this.tiddler,\s'MovToSee\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center> [_("+tiddler.title+":MovSeen){(this.fn_init)}{movieMarkSeen(this.tiddler,\s'MovToSee\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>") +\n(index == count-1 ? "</tbody></table></html>" : "")'\n>>\n<<sortit "MoviesToSeeTable">>\n}}}
\n{{movietable{\n<<forEachTiddler \n where \n 'tiddler.tags.contains("MovFav")'\n sortBy \n '(9.99-tiddler.data("movieRating"))+(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index == 0 ? "<html><table id=\s"TopMoviesTable\s" cellspacing=\s"0\s"><caption align=\s"top\s">Top Movies</caption><thead><tr><th> # </th><th>Title</th><th></th><th>Rating</th><th>Top Movie</th><th>Watch Again</th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td><td align=center>[_("+tiddler.title+":MovFav)]</td><td align=center>[_("+tiddler.title+":MovWatchAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovSeenAgain\s')}]</td></tr>") +\n(index == count-1 ? "</tbody></table></html>" : "")'\n>>\n<<sortit TopMoviesTable>>\n}}}
\n{{movietable{\n<<forEachTiddler \n where \n 'tiddler.tags.contains("MovWatchAgain")'\n sortBy \n '(9.9-tiddler.data("movieRating"))+(tiddler.data("movieName").toLowerCase())'\nwrite\n'(index == 0 ? "<html><table id=\s"MoviesWatchAgainTable\s" cellspacing=\s"0\s"><caption align=\s"top\s">Movies to Watch Again</caption><thead><tr><th> # </th><th>Title</th><th></th><th>Rating</th><th>Watch Again</th><th>Seen Again</th><th>Top Movie</th></tr></thead><tbody>": "") +(index%2 == 0 ? "<tr class=\s"evenRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td><td align=center>[_("+tiddler.title+":MovWatchAgain)]</td><td align=center>[_("+tiddler.title+":MovSeenAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovWatchAgain\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td></tr>" : "<tr class=\s"oddRow\s"><td align=center>"+(index+1)+"</td><td><<imdb \s"right\s" \s""+tiddler.data("movieName")+"\s"$))</td><td align=center>[[>$))|"+tiddler.title+"]]</td><td align=center onclick=\s"setRating(\s'"+tiddler.title+"\s',\s'"+config.macros.forEachTiddler.getContainingTiddler(context.place).title+"\s')\s" class=\s"adjustable\s" title=\s"Click to change rating\s">"+tiddler.data("movieRating","---")+"</td><td align=center>[_("+tiddler.title+":MovWatchAgain)]</td><td align=center>[_("+tiddler.title+":MovSeenAgain){(this.fn_init)}{removeTag(this.tiddler,\s'MovWatchAgain\s')}]</td><td align=center>[_("+tiddler.title+":MovFav)]</td></tr>") +\n(index == count-1 ? "</tbody></table></html>" : "")'\n>>\n<<sortit "MoviesWatchAgainTable">>\n}}}
/***\n''NestedSlidersPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman\nsource: http://www.TiddlyTools.com/#NestedSlidersPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nQuickly make any tiddler content into an expandable 'slider' panel, without needing to create a separate tiddler to contain the slider content. Optional syntax allows ''default to open'', ''custom button label/tooltip'' and ''automatic blockquote formatting.''\n\nYou can also 'nest' these sliders as deep as you like (see complex nesting example below), so that expandable 'tree-like' hierarchical displays can be created. This is most useful when converting existing in-line text content to create in-line annotations, footnotes, context-sensitive help, or other subordinate information displays.\n\nFor more details, please click on a section headline below:\n++++!!!!![Configuration]>\nDebugging messages for 'lazy sliders' deferred rendering:\n<<option chkDebugLazySliderDefer>> show debugging alert when deferring slider rendering\n<<option chkDebugLazySliderRender>> show debugging alert when deferred slider is actually rendered\n===\n++++!!!!![Usage]>\nWhen installed, this plugin adds new wiki syntax for embedding 'slider' panels directly into tiddler content. Use {{{+++}}} and {{{===}}} to delimit the slider content. Additional optional syntax elements let you specify\n*default to open\n*cookiename\n*heading level\n*floater\n*rollover\n*custom label/tooltip\n*automatic blockquote\n*deferred rendering\nThe complete syntax, using all options, is:\n//{{{\n++++(cookiename)!!!!!^*[label|tooltip]>...\ncontent goes here\n===\n//}}}\nwhere:\n* {{{+++}}} (or {{{++++}}}) and {{{===}}}^^\nmarks the start and end of the slider definition, respectively. When the extra {{{+}}} is used, the slider will be open when initially displayed.^^\n* {{{(cookiename)}}}^^\nsaves the slider opened/closed state, and restores this state whenever the slider is re-rendered.^^\n* {{{!}}} through {{{!!!!!}}}^^\ndisplays the slider label using a formatted headline (Hn) style instead of a button/link style^^\n* {{{"^"}}} //(without the quotes)//^^\nmakes the slider 'float' on top of other content rather than shifting that content downward^^\n* {{{"*"}}} //(without the quotes)//^^\nautomatically opens/closes slider on "rollover" as well as when clicked^^\n* {{{[label]}}} or {{{[label|tooltip]}}}^^\nuses custom label/tooltip. (defaults are: ">" (more) and "<" (less)^^\n* {{{">"}}} //(without the quotes)//^^\nautomatically adds blockquote formatting to slider content^^\n* {{{"..."}}} //(without the quotes)//^^\ndefers rendering of closed sliders until the first time they are opened. //Note: deferred rendering may produce unexpected results in some cases. Use with care.//^^\n\n//Note: to make slider definitions easier to read and recognize when editing a tiddler, newlines immediately following the {{{+++}}} 'start slider' or preceding the {{{===}}} 'end slider' sequence are automatically supressed so that excess whitespace is eliminated from the output.//\n===\n++++!!!!![Examples]>\nsimple in-line slider: \n{{{\n+++\n content\n===\n}}}\n+++\n content\n===\n----\nuse a custom label and tooltip: \n{{{\n+++[label|tooltip]\n content\n===\n}}}\n+++[label|tooltip]\n content\n===\n----\ncontent automatically blockquoted: \n{{{\n+++>\n content\n===\n}}}\n+++>\n content\n===\n----\nall options combined //(default open, cookie, heading, floater, rollover, label/tooltip, blockquoted, deferred)//\n{{{\n++++(testcookie)!!!^*[label|tooltip]>...\n content\n===\n}}}\n++++(testcookie)!!!^*[label|tooltip]>...\n content\n===\n----\ncomplex nesting example:\n{{{\n+++^[get info...|click for information]\n put some general information here, plus a floating slider with more specific info:\n +++^[view details...|click for details]\n put some detail here, which could include a rollover with a +++^*[glossary definition]explaining technical terms===\n ===\n===\n}}}\n+++^[get info...|click for information]\n put some general information here, plus a floating slider with more specific info:\n +++^[view details...|click for details]\n put some detail here, which could include a rollover with a +++^*[glossary definition]explaining technical terms===\n ===\n===\n----\nnested floaters\n>menu: <<tiddler NestedSlidersExample>>\n(see [[NestedSlidersExample]] for definition)\n----\n===\n+++!!!!![Installation]>\nimport (or copy/paste) the following tiddlers into your document:\n''NestedSlidersPlugin'' (tagged with <<tag systemConfig>>)\n===\n+++!!!!![Revision History]>\n\n++++[2006.02.16 - 1.7.7]\ncorrected deferred rendering to account for use-case where show/hide state is tracked in a cookie\n===\n\n++++[2006.02.15 - 1.7.6]\nin adjustSliderPos(), ensure that floating panel is positioned completely within the browser window (i.e., does not go beyond the right edge of the browser window)\n===\n\n++++[2006.02.04 - 1.7.5]\nadd 'var' to unintended global variable declarations to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n===\n\n++++[2006.01.18 - 1.7.4]\nonly define adjustSliderPos() function if it has not already been provided by another plugin. This lets other plugins 'hijack' the function even when they are loaded first.\n===\n\n++++[2006.01.16 - 1.7.3]\nadded adjustSliderPos(place,btn,panel,panelClass) function to permit specialized logic for placement of floating panels. While it provides improved placement for many uses of floating panels, it exhibits a relative offset positioning error when used within *nested* floating panels. Short-term workaround is to only adjust the position for 'top-level' floaters.\n===\n\n++++[2006.01.16 - 1.7.2]\nadded button property to slider panel elements so that slider panel can tell which button it belongs to. Also, re-activated and corrected animation handling so that nested sliders aren't clipped by hijacking Slider.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends\n===\n\n++++[2006.01.14 - 1.7.1]\nadded optional "^" syntax for floating panels. Defines new CSS class, ".floatingPanel", as an alternative for standard in-line ".sliderPanel" styles.\n===\n\n++++[2006.01.14 - 1.7.0]\nadded optional "*" syntax for rollover handling to show/hide slider without requiring a click (Based on a suggestion by tw4efl)\n===\n\n+++[2006.01.03 - 1.6.2]\nWhen using optional "!" heading style, instead of creating a clickable "Hn" element, create an "A" element inside the "Hn" element. (allows click-through in SlideShowPlugin, which captures nearly all click events, except for hyperlinks)\n===\n\n+++[2005.12.15 - 1.6.1]\nadded optional "..." syntax to invoke deferred ('lazy') rendering for initially hidden sliders\nremoved checkbox option for 'global' application of lazy sliders\n===\n\n+++[2005.11.25 - 1.6.0]\nadded optional handling for 'lazy sliders' (deferred rendering for initially hidden sliders)\n===\n\n+++[2005.11.21 - 1.5.1]\nrevised regular expressions: if present, a single newline //preceding// and/or //following// a slider definition will be suppressed so start/end syntax can be place on separate lines in the tiddler 'source' for improved readability. Similarly, any whitespace (newlines, tabs, spaces, etc.) trailing the 'start slider' syntax or preceding the 'end slider' syntax is also suppressed.\n===\n\n+++[2005.11.20 - 1.5.0]\n added (cookiename) syntax for optional tracking and restoring of slider open/close state\n===\n\n+++[2005.11.11 - 1.4.0]\n added !!!!! syntax to render slider label as a header (Hn) style instead of a button/link style\n===\n\n+++[2005.11.07 - 1.3.0]\n removed alternative syntax {{{(((}}} and {{{)))}}} (so they can be used by other\n formatting extensions) and simplified/improved regular expressions to trim multiple excess newlines\n===\n\n+++[2005.11.05 - 1.2.1]\n changed name to NestedSlidersPlugin\n more documentation\n===\n\n+++[2005.11.04 - 1.2.0]\n added alternative character-mode syntax {{{(((}}} and {{{)))}}}\n tweaked "eat newlines" logic for line-mode {{{+++}}} and {{{===}}} syntax\n===\n\n+++[2005.11.03 - 1.1.1]\n fixed toggling of default tooltips ("more..." and "less...") when a non-default button label is used\n code cleanup, added documentation\n===\n\n+++[2005.11.03 - 1.1.0]\n changed delimiter syntax from {{{(((}}} and {{{)))}}} to {{{+++}}} and {{{===}}}\n changed name to EasySlidersPlugin\n===\n\n+++[2005.11.03 - 1.0.0]\n initial public release\n===\n\n===\n+++!!!!![Credits]>\nThis feature was implemented by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]] with research, programming and suggestions from RodneyGomes, GeoffSlocock, and PaulPetterson\n===\n***/\n// //+++!!!!![Code]\n//{{{\nversion.extensions.nestedSliders = {major: 1, minor: 7, revision: 7, date: new Date(2006,2,16)};\n//}}}\n\n//{{{\n// options for deferred rendering of sliders that are not initially displayed\nif (config.options.chkDebugLazySliderDefer==undefined) config.options.chkDebugLazySliderDefer=false;\nif (config.options.chkDebugLazySliderRender==undefined) config.options.chkDebugLazySliderRender=false;\n\n// default styles for 'floating' class\nsetStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \s\n background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");\n//}}}\n\n//{{{\nconfig.formatters.push( {\n name: "nestedSliders",\n match: "\s\sn?\s\s+{3}",\n terminator: "\s\ss*\s\s={3}\s\sn?",\n lookahead: "\s\sn?\s\s+{3}(\s\s+)?(\s\s([^\s\s)]*\s\s))?(\s\s!*)?(\s\s^)?(\s\s*)?(\s\s[[^\s\s]]*\s\s])?(\s\s>)?(\s\s.\s\s.\s\s.)?\s\ss*",\n handler: function(w)\n {\n var lookaheadRegExp = new RegExp(this.lookahead,"mg");\n lookaheadRegExp.lastIndex = w.matchStart;\n var lookaheadMatch = lookaheadRegExp.exec(w.source)\n if(lookaheadMatch && lookaheadMatch.index == w.matchStart)\n {\n // location for rendering button and panel\n var place=w.output;\n\n // default to closed, no cookie\n var show="none"; var title=">"; var tooltip="show"; var cookie="";\n\n // extra "+", default to open\n if (lookaheadMatch[1])\n { show="block"; title="<"; tooltip="hide"; }\n\n // cookie, use saved open/closed state\n if (lookaheadMatch[2]) {\n cookie=lookaheadMatch[2].trim().substr(1,lookaheadMatch[2].length-2);\n cookie="chkSlider"+cookie;\n if (config.options[cookie]==undefined)\n { config.options[cookie] = (show=="block") }\n if (config.options[cookie])\n { show="block"; title="<"; tooltip="hide"; }\n else\n { show="none"; title=">"; tooltip="show"; }\n }\n\n // custom label/tooltip\n if (lookaheadMatch[6]) {\n title = lookaheadMatch[6].trim().substr(1,lookaheadMatch[6].length-2);\n var pos=title.indexOf("|");\n if (pos!=-1)\n { tooltip = title.substr(pos+1,title.length); title = title.substr(0,pos); }\n else\n { tooltip += " "+title; }\n }\n\n // create the button\n if (lookaheadMatch[3]) { // use "Hn" header format instead of button/link\n var lvl=(lookaheadMatch[3].length>6)?6:lookaheadMatch[3].length;\n var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,null,title);\n btn.onclick=onClickNestedSlider;\n btn.setAttribute("href","javascript:;");\n btn.setAttribute("title",tooltip);\n }\n else\n var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider);\n btn.sliderCookie = cookie; // save the cookiename (if any) in the button object\n\n // "non-click" MouseOver open/close slider\n if (lookaheadMatch[5]) btn.onmouseover=onClickNestedSlider;\n\n // create slider panel\n var panelClass=lookaheadMatch[4]?"floatingPanel":"sliderPanel";\n var panel=createTiddlyElement(place,"div",null,panelClass,null);\n panel.style.display = show;\n panel.button = btn; // so the slider panel know which button it belongs to\n btn.sliderPanel=panel;\n\n // render slider (or defer until shown) \n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n if ((show=="block")||!lookaheadMatch[8]) {\n // render now if panel is supposed to be shown or NOT deferred rendering\n w.subWikify(lookaheadMatch[7]?createTiddlyElement(panel,"blockquote"):panel,this.terminator);\n // align slider/floater position with button\n adjustSliderPos(place,btn,panel,panelClass);\n }\n else {\n var src = w.source.substr(w.nextMatch);\n var endpos=findMatchingDelimiter(src,"+++","===");\n panel.setAttribute("raw",src.substr(0,endpos));\n panel.setAttribute("blockquote",lookaheadMatch[7]?"true":"false");\n panel.setAttribute("rendered","false");\n w.nextMatch += endpos+3;\n if (w.source.substr(w.nextMatch,1)=="\sn") w.nextMatch++;\n if (config.options.chkDebugLazySliderDefer) alert("deferred '"+title+"':\sn\sn"+panel.getAttribute("raw"));\n }\n }\n }\n }\n)\n\n// TBD: ignore 'quoted' delimiters (e.g., "{{{+++foo===}}}" isn't really a slider)\nfunction findMatchingDelimiter(src,starttext,endtext) {\n var startpos = 0;\n var endpos = src.indexOf(endtext);\n // check for nested delimiters\n while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {\n // count number of nested 'starts'\n var startcount=0;\n var temp = src.substring(startpos,endpos-1);\n var pos=temp.indexOf(starttext);\n while (pos!=-1) { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }\n // set up to check for additional 'starts' after adjusting endpos\n startpos=endpos+endtext.length;\n // find endpos for corresponding number of matching 'ends'\n while (startcount && endpos!=-1) {\n endpos = src.indexOf(endtext,endpos+endtext.length);\n startcount--;\n }\n }\n return (endpos==-1)?src.length:endpos;\n}\n//}}}\n\n//{{{\nfunction onClickNestedSlider(e)\n{\n if (!e) var e = window.event;\n var theTarget = resolveTarget(e);\n var theLabel = theTarget.firstChild.data;\n var theSlider = theTarget.sliderPanel\n var isOpen = theSlider.style.display!="none";\n // if using default button labels, toggle labels\n if (theLabel==">") theTarget.firstChild.data = "<";\n else if (theLabel=="<") theTarget.firstChild.data = ">";\n // if using default tooltips, toggle tooltips\n if (theTarget.getAttribute("title")=="show")\n theTarget.setAttribute("title","hide");\n else if (theTarget.getAttribute("title")=="hide")\n theTarget.setAttribute("title","show");\n if (theTarget.getAttribute("title")=="show "+theLabel)\n theTarget.setAttribute("title","hide "+theLabel);\n else if (theTarget.getAttribute("title")=="hide "+theLabel)\n theTarget.setAttribute("title","show "+theLabel);\n // deferred rendering (if needed)\n if (theSlider.getAttribute("rendered")=="false") {\n if (config.options.chkDebugLazySliderRender)\n alert("rendering '"+theLabel+"':\sn\sn"+theSlider.getAttribute("raw"));\n var place=theSlider;\n if (theSlider.getAttribute("blockquote")=="true")\n place=createTiddlyElement(place,"blockquote");\n wikify(theSlider.getAttribute("raw"),place);\n theSlider.setAttribute("rendered","true");\n }\n // show/hide the slider\n if(config.options.chkAnimate)\n anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));\n else\n theSlider.style.display = isOpen ? "none" : "block";\n if (this.sliderCookie && this.sliderCookie.length)\n { config.options[this.sliderCookie]=!isOpen; saveOptionCookie(this.sliderCookie); }\n // align slider/floater position with target button\n adjustSliderPos(theSlider.parentNode,theTarget,theSlider,theSlider.className);\n return false;\n}\n\n// hijack animation handler 'stop' handler so overflow is visible after animation has completed\nSlider.prototype.coreStop = Slider.prototype.stop;\nSlider.prototype.stop = function() { this.coreStop(); this.element.style.overflow = "visible"; }\n\n// adjust panel position based on button position\nif (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel,panelClass) {\n ///////////////////////////////////////////////////////////////////////////////\n /// EXPERIMENTAL HACK - WORKS IN SOME CASES, NOT IN OTHERS\n ///////////////////////////////////////////////////////////////////////////////\n // "if this panel is floating and the parent is not also a floating panel"...\n if (panelClass=="floatingPanel" && place.className!="floatingPanel") {\n var left=0; var top=btn.offsetHeight;\n if (place.style.position!="relative") { left+=findPosX(btn); top+=findPosY(btn); }\n if (left+panel.offsetWidth > getWindowWidth()) left=getWindowWidth()-panel.offsetWidth-10;\n panel.style.left=left+"px"; panel.style.top=top+"px";\n }\n}\n\nfunction getWindowWidth() {\n if(document.width!=undefined)\n return document.width; // moz (FF)\n if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )\n return document.documentElement.clientWidth; // IE6\n if(document.body && ( document.body.clientWidth || document.body.clientHeight ) )\n return document.body.clientWidth; // IE4\n if(window.innerWidth!=undefined)\n return window.innerWidth; // IE - general\n return 0; // unknown\n}\n//}}}\n// //===
|outerborderonly|k\n|<html><b>Title:</b><br><input name=movieName type=text /></html>||>| |>|[x(MovToSee)] - Movie to see|\n|~| <<movielink>> ||>|[x(MovSeen)] - Movie seen|\n|<html><b>Rating:</b><br><input name=movieRating type=text /></html>|||>|[x(MovFav)] - Top Movie|\n|~|||>|[x(MovWatchAgain)] - Watch Again|\n|>|>|>|>|<html><br><b>Review:</b><br><TEXTAREA name=movieReview rows=8 cols=80 ></TEXTAREA></html>|\n|>|>|>|>|<html><br><b>Other Notes:</b><br><TEXTAREA name=movieNotes rows=4 cols=80 ></TEXTAREA></html>|\n<data>{"movieName":"orm"}</data>
/***\nTo Do:\n*adding more than one tag (will need to convert string into array i think)\n** add tags from template, any point in this case?\n*incorporate imdb ratings set, if ever working!\n!Code\n***/\n\n//{{{\nconfig.macros.newMovie = {\n // Standard Properties\n label: "newTiddlerWithForm",\n version: {major: 1, minor: 0, revision: 1, date: new Date(2006, 1, 6)},\n prompt: "Creates a new Tiddler with a <<formTiddler ...>> macro"\n}\n\nconfig.macros.newMovie.handler = function(place,macroName,params) {\n // --- Parsing ------------------------------------------\n\n var i = 0; // index running over the params\n\n // get the name of the form template tiddler\n var formTemplateName = undefined;\n if (i < params.length) {\n formTemplateName = params[i];\n i++;\n }\n\n if (!formTemplateName) {\n config.macros.formTiddler.createErrorElement(place, "No form template specified in <<" + macroName + ">>.");\n return;\n }\n\n // get the button label\n var buttonLabel = undefined;\n if (i < params.length) {\n buttonLabel = params[i];\n i++;\n }\n\n if (!buttonLabel) {\n config.macros.formTiddler.createErrorElement(place, "No button label specified in <<" + macroName + ">>.");\n return;\n }\n\n // get the (optional) tiddlerName script and "askUser"\n var tiddlerNameScript = undefined;\n var askUser = false;\n if (i < params.length) {\n tiddlerNameScript = params[i];\n i++;\n\n if (i < params.length && params[i] == "askUser") {\n askUser = true;\n i++;\n }\n }\n var tempTag = undefined;\n if (i < params.length) {\n tempTag = params[i];\n i++;\n }\n\n // --- Processing ------------------------------------------\n\n if(!readOnly) {\n var onClick = function() {\n var movieTitle;\n var tiddlerName = 'Movies - ' + movieTitle;\n\n if (tiddlerNameScript) {\n try {\n tiddlerName = eval(tiddlerNameScript);\n } catch (ex) {\n }\n }\n if (!tiddlerName || askUser) {\n movieTitle = prompt("Please specify a movie name.", "");\n var tiddlerName = 'Movies - ' + movieTitle;}\n while (tiddlerName && store.getTiddler(tiddlerName)) {\n movieTitle = prompt("A movie named '"+movieTitle+"' already exists.\sn\sn"+"Please specify a movie name.", movieTitle); var tiddlerName = 'Movies - ' + movieTitle;\n }\n\n // tiddlerName is either null (user canceled) or a name that is not yet in the store.\n if ((tiddlerName)&&(movieTitle!=null)) {\n var body = "<<formTiddler [["+formTemplateName+"]]>>";\n var tags = tempTag;\n store.saveTiddler(tiddlerName,tiddlerName,body,config.options.txtUserName,new Date(),tags);\n DataTiddler.setData(tiddlerName,"movieName",movieTitle);\n DataTiddler.setData(tiddlerName,"movieRating","");\n story.displayTiddler(null,tiddlerName,1);\n if(config.options.chkAutoSave)\n saveChanges();\n }\n else\n {return false;}\n }\n\n createTiddlyButton(place,buttonLabel,buttonLabel,onClick);\n }\n\n}\n//}}}
<!---\nI've just tweaked my gradient colours and the topMenu bit. See HorizontalMainMenu.\n--->\n<!--{{{-->\n\n<div id='topMenu' refresh='content' tiddler='MainMenu'></div>\n</div>\n<div id='sidebar'>\n<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>\n<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>\n</div>\n<div id='displayArea'>\n<div id='messageArea'></div>\n<div id='tiddlerDisplay'></div>\n</div>\n<!--}}}-->\n
/***\n***/\n\n//{{{\n\nconfig.commands.refresh = {\n text: 'refresh',\n tooltip: 'Refresh this tiddler',\n handler: function(e,src,title) {\n clearMessage();\n story.refreshTiddler(title,false,true); // force=true\n return false;\n }\n};\n\n//}}}
/***\nThis CSS by DaveBirss.\n***/\n/*{{{*/\n\n.tabSelected {\n background: #fff;\n}\n\n.tabUnselected {\n background: #eee;\n}\n\n#sidebar {\n color: #000;\n background: transparent; \n}\n\n#sidebarOptions {\n background: #fff;\n}\n\n#sidebarOptions .button {\n color: #999;\n}\n\n#sidebarOptions .button:hover {\n color: #000;\n background: #fff;\n border-color:white;\n}\n\n#sidebarOptions .button:active {\n color: #000;\n background: #fff;\n}\n\n#sidebarOptions .sliderPanel {\n background: transparent;\n}\n\n#sidebarOptions .sliderPanel A {\n color: #999;\n}\n\n#sidebarOptions .sliderPanel A:hover {\n color: #000;\n background: #fff;\n}\n\n#sidebarOptions .sliderPanel A:active {\n color: #000;\n background: #fff;\n}\n\n.sidebarSubHeading {\n color: #000;\n}\n\n#sidebarTabs {`\n background: #fff\n}\n\n#sidebarTabs .tabSelected {\n color: #000;\n background: #fff;\n border-top: solid 1px #ccc;\n border-left: solid 1px #ccc;\n border-right: solid 1px #ccc;\n border-bottom: none;\n}\n\n#sidebarTabs .tabUnselected {\n color: #999;\n background: #eee;\n border-top: solid 1px #ccc;\n border-left: solid 1px #ccc;\n border-right: solid 1px #ccc;\n border-bottom: none;\n}\n\n#sidebarTabs .tabContents {\n background: #fff;\n}\n\n\n#sidebarTabs .txtMoreTab .tabSelected {\n background: #fff;\n}\n\n#sidebarTabs .txtMoreTab .tabUnselected {\n background: #eee;\n}\n\n#sidebarTabs .txtMoreTab .tabContents {\n background: #fff;\n}\n\n#sidebarTabs .tabContents .tiddlyLink {\n color: #999;\n}\n\n#sidebarTabs .tabContents .tiddlyLink:hover {\n background: #fff;\n color: #000;\n}\n\n#sidebarTabs .tabContents {\n color: #000;\n}\n\n#sidebarTabs .button {\n color: #666;\n}\n\n#sidebarTabs .tabContents .button:hover {\n color: #000;\n background: #fff;\n}\n\n\n/*}}}*/
config.macros.sortit = {}\nconfig.macros.sortit.handler = function(place,macroName,params,wikifier,paramString,callingTiddler){\n var tableId = params[0];\nif (document.getElementById(tableId))\n{config.macros.sortableGridPlugin.ts_makeSortable(document.getElementById(tableId))}\n}
// Begin SORTABLE.JS//\n// This Code is://\n// Code downloaded from the Browser Experiments section of kryogenix.org is licenced under the so-called MIT licence. The license is below.//\n////\n// Copyright (c) 1997-date Stuart Langridge//\n////\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this //\n// software and associated documentation files (the "Software"), to deal in the Software //\n// without restriction, including without limitation the rights to use, copy, modify, merge, //\n// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons //\n// to whom the Software is furnished to do so, subject to the following conditions://\n////\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, //\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR //\n// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE //\n// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR //\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER //\n// DEALINGS IN THE SOFTWARE.//\n// //\n// //\n// Modified under the same aforementioned terms by Demian Johnston, 2006//\n/*\n! Test Cases\nSortable\nGrid requires the header row to be marked "|h"\n\n|Name |Salary|Extension |Start date|h\n|Bloggs, Fred |$12000.00 |1353|08/19/2003|\n|Bloggs, Fred |$12000.00 |1353|09/18/2003|\n|Bloggs, Fred |$12000.00 |1353|08/18/2003|\n|Bloggs, Fred |$12000.00 |1353|07/18/2003|\n|Bloggs, Fred |$12000.00 |1353|08/17/2003|\n|Turvey, Kevin |$191200.00 |2342 |02/05/1979|\n|Mbogo, Arnold |$32010.12 |2755 |09/08/1998|\n|Shakespeare, Bill |$122000.00|3211 |12/11/1961|\n|Shakespeare, Hamnet |$9000 |9005|01/01/2002|\n|Fitz, Marvin |$3300 |5554 |05/22/1995|\n\nUnsortableGrid (doesn't mark header row)\n\n|Name |Salary|Extension |Start date|\n|Bloggs, Fred |$12000.00 |1353|08/19/2003|\n|Bloggs, Fred |$12000.00 |1353|09/18/2003|\n|Bloggs, Fred |$12000.00 |1353|08/18/2003|\n|Bloggs, Fred |$12000.00 |1353|07/18/2003|\n|Bloggs, Fred |$12000.00 |1353|08/17/2003|\n|Turvey, Kevin |$191200.00 |2342 |02/05/1979|\n|Mbogo, Arnold |$32010.12 |2755 |09/08/1998|\n|Shakespeare, Bill |$122000.00|3211 |12/11/1961|\n|Shakespeare, Hamnet |$9000 |9005|01/01/2002|\n|Fitz, Marvin |$3300 |5554 |05/22/1995|\n\nCredit to Stuart Langridge,November 2003\nhttp://www.kryogenix.org/code/browser/sorttable/\n*/\n//{{{\nversion.extensions.sortableGrid= {major: 1, minor: 0, revision: 0, date: new Date(2006,2,14)};\n//}}}\n//{{{\nconfig.macros.sortableGridPlugin = {SORT_COLUMN_INDEX: 0};\n\nconfig.macros.sortableGridPlugin.ts_makeSortable=function(table) {\n var firstRow;\n if (table.rows && table.rows.length > 0) {\n firstRow = table.rows[0];\n }\n if (!firstRow) return;\n \n // We have a first row: assume it's the header, and make its contents clickable links\n for (var i=0;i<firstRow.cells.length;i++) {\n var cell = firstRow.cells[i];\n var txt = config.macros.sortableGridPlugin.ts_getInnerText(cell);\n cell.innerHTML = '<a href="#" class="sortheader" onclick="config.macros.sortableGridPlugin.ts_resortTable(this);return false;">'+txt+'<span class="sortarrow"> </span></a>';\n }\n};\n//}}}\n\n//{{{\nconfig.macros.sortableGridPlugin.ts_getInnerText=function(el) {\n if (typeof el == "string") return el;\n if (typeof el == "undefined") { return el };\n if (el.innerText) return el.innerText; //Not needed but it is faster\n var str = "";\n \n var cs = el.childNodes;\n var l = cs.length;\n for (var i = 0; i < l; i++) {\n switch (cs[i].nodeType) {\n case 1: //ELEMENT_NODE\n str += config.macros.sortableGridPlugin.ts_getInnerText(cs[i]);\n break;\n case 3: //TEXT_NODE\n str += cs[i].nodeValue;\n break;\n }\n }\n return str;\n};\n\nconfig.macros.sortableGridPlugin.getParent=function(el, pTagName) {\n if (el == null) return null;\n else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase\n return el;\n else\n return config.macros.sortableGridPlugin.getParent(el.parentNode, pTagName);\n};\n//}}}\n\n//{{{\nconfig.macros.sortableGridPlugin.ts_resortTable=function(lnk) {\n // get the span\n var span;\n for (var ci=0;ci<lnk.childNodes.length;ci++) {\n if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];\n }\n var td = lnk.parentNode;\n var column = td.cellIndex;\n var table = config.macros.sortableGridPlugin.getParent(td,'TABLE');\n \n // Work out a type for the column\n if (table.rows.length <= 1) return;\n var itm = config.macros.sortableGridPlugin.ts_getInnerText(table.rows[1].cells[column]);\n var sortfn = config.macros.sortableGridPlugin.ts_sort_caseinsensitive;\n if (itm.match(/^\sd\sd[\s/-]\sd\sd[\s/-]\sd\sd\sd\sd$/)) sortfn = config.macros.sortableGridPlugin.ts_sort_date;\n if (itm.match(/^\sd\sd[\s/-]\sd\sd[\s/-]\sd\sd$/)) sortfn = config.macros.sortableGridPlugin.ts_sort_date;\n if (itm.match(/^[?$]/)) sortfn = config.macros.sortableGridPlugin.ts_sort_currency;\n if (itm.match(/^[\sd\s.]+$/)) sortfn = config.macros.sortableGridPlugin.ts_sort_numeric;\n config.macros.sortableGridPlugin.SORT_COLUMN_INDEX = column;\n var firstRow = new Array();\n var newRows = new Array();\n for (var i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; }\n for (var j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; }\n\n newRows.sort(sortfn);\n var ARROW;\n if (span.getAttribute("sortdir") == 'down') {\n ARROW = ' ↑';\n newRows.reverse();\n span.setAttribute('sortdir','up');\n } else {\n ARROW = ' ↓';\n span.setAttribute('sortdir','down');\n }\n \n // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones\n // don't do sortbottom rows\n for ( i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);}\n // do sortbottom rows only\n for ( i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);}\n \n // Delete any other arrows there may be showing\n var allspans = document.getElementsByTagName("span");\n for ( ci=0;ci<allspans.length;ci++) {\n if (allspans[ci].className == 'sortarrow') {\n if (config.macros.sortableGridPlugin.getParent(allspans[ci],"table") == config.macros.sortableGridPlugin.getParent(lnk,"table")) { // in the same table as us?\n allspans[ci].innerHTML = ' ';\n }\n }\n }\n \n span.innerHTML = ARROW;\n};\n//}}}\n\n//{{{\n config.macros.sortableGridPlugin.ts_sort_date=function(a,b) {\n // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX\n var mmdd=1; // US Mode (set to 0) for dd/mm/yyyy\n\n var aa = config.macros.sortableGridPlugin.ts_getInnerText(a.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]);\n var bb = config.macros.sortableGridPlugin.ts_getInnerText(b.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]);\n var dt1;\n var dt2;\n var yr;\n if (aa.length == 10) {\n if (mmdd)\n dt1 = aa.substr(6,4)+aa.substr(0,2)+aa.substr(3,2);\n else\n dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);\n } else {\n yr = aa.substr(6,2);\n if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }\n if (mmdd)\n dt1 = yr+aa.substr(0,2)+aa.substr(3,2);\n else\n dt1 = yr+aa.substr(3,2)+aa.substr(0,2);\n }\n if (bb.length == 10) {\n if (mmdd)\n dt2 = bb.substr(6,4)+bb.substr(0,2)+bb.substr(3,2);\n else\n dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);\n } else {\n yr = bb.substr(6,2);\n if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }\n if (mmdd)\n dt2 = yr+bb.substr(0,2)+bb.substr(3,2);\n else\n dt2 = yr+bb.substr(3,2)+bb.substr(0,2);\n }\n if (dt1==dt2) return 0;\n if (dt1<dt2) return -1;\n return 1;\n};\n\n config.macros.sortableGridPlugin.ts_sort_currency=function(a,b) { \n var aa = config.macros.sortableGridPlugin.ts_getInnerText(a.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');\n var bb = config.macros.sortableGridPlugin.ts_getInnerText(b.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');\n return parseFloat(aa) - parseFloat(bb);\n};\n\n config.macros.sortableGridPlugin.ts_sort_numeric=function(a,b) { \n var aa = parseFloat(config.macros.sortableGridPlugin.ts_getInnerText(a.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]));\n if (isNaN(aa)) aa = 0;\n var bb = parseFloat(config.macros.sortableGridPlugin.ts_getInnerText(b.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX])); \n if (isNaN(bb)) bb = 0;\n return aa-bb;\n};\n\n config.macros.sortableGridPlugin.ts_sort_caseinsensitive=function(a,b) {\n var aa = config.macros.sortableGridPlugin.ts_getInnerText(a.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]).toLowerCase();\n var bb = config.macros.sortableGridPlugin.ts_getInnerText(b.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]).toLowerCase();\n if (aa==bb) return 0;\n if (aa<bb) return -1;\n return 1;\n};\n\n config.macros.sortableGridPlugin.ts_sort_default=function(a,b) {\n var aa = config.macros.sortableGridPlugin.ts_getInnerText(a.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]);\n var bb = config.macros.sortableGridPlugin.ts_getInnerText(b.cells[config.macros.sortableGridPlugin.SORT_COLUMN_INDEX]);\n if (aa==bb) return 0;\n if (aa<bb) return -1;\n return 1;\n};\n//}}}\n\n// end Code downloaded from the Browser Experiments section of kryogenix.org is licenced under the so-called MIT licence. The license is below.//\n// //\n// end Copyright (c) 1997-date Stuart Langridge//\n// END SORTABLE.JS//\n\n\n\n//{{{\nconfig.formatters[0].handler=function(w)\n {\n var table = createTiddlyElement(w.output,"table");\n w.nextMatch = w.matchStart;\n var lookaheadRegExp = new RegExp(this.lookahead,"mg");\n var currRowType = null, nextRowType;\n var rowContainer, rowElement;\n var prevColumns = [];\n var rowCount = 0;\n var want_sortable=0;\n do {\n lookaheadRegExp.lastIndex = w.nextMatch;\n var lookaheadMatch = lookaheadRegExp.exec(w.source);\n var matched = lookaheadMatch && lookaheadMatch.index == w.nextMatch;\n if(matched)\n {\n nextRowType = lookaheadMatch[2];\nif(nextRowType == "k")\n {\n table.className = lookaheadMatch[1];\n w.nextMatch += lookaheadMatch[0].length+1;\n continue;\n }\n if(nextRowType != currRowType)\n rowContainer = createTiddlyElement(table,this.rowTypes[nextRowType]);\n currRowType = nextRowType;\n if(currRowType == "c")\n {\n if(rowCount == 0)\n rowContainer.setAttribute("align","top");\n else\n rowContainer.setAttribute("align","bottom");\n w.nextMatch = w.nextMatch + 1;\n w.subWikify(rowContainer,this.rowTerminator);\n table.insertBefore(rowContainer,table.firstChild);\n }\n else\n {\n var rowClass = (rowCount & 1) ? "oddRow" : "evenRow";\n rowElement = createTiddlyElement(rowContainer,"tr",null,rowClass);\n this.rowHandler(w,rowElement,prevColumns);\n }\n if(currRowType == "h") {\n want_sortable=1;\n }\n rowCount++;\n }\n } while(matched);\n if (want_sortable) {\n table.setAttribute("class","sortable");\n config.macros.sortableGridPlugin.ts_makeSortable(table);\n }\n };\n\n//}}}
<<forEachTiddler\nwhere\n'tiddler'\nsortBy\n'tiddler.text.length'\ndescending\nwrite\n'"|[["+tiddler.title+"]]|"+tiddler.text.length+"|\sn"'\n>>
/***\n\n***/\n/*{{{*/\n[[CSS-movietable]]\n[[SideBarCSS]]\n/***\nClint's fix for weird IE behaviours\n***/\n/*{{{*/\nbody {position:static;}\n.tagClear{margin-top:1em;clear:both;}\n/*}}}*/\n/***\nJust colours, fonts, tweaks etc. See SideBarWhiteAndGrey\n***/\n/*{{{*/\n\n.adjustable {\n cursor: pointer; \n}\n\n.boxtext {background:#eee;\ndisplay:block;margin:1em 1em 1em 1em;padding:3px 3px;border:1px solid #ccc;\n}\n\n\nbody {background:#eee; /* font-size:103%; */}\na{ color: #3A4880; }\na:hover{ background: #3A4856; color: #fff; }\n.popup { background:#3A4856; border: 1px solid #3A4856; }\n.popup li a:hover {\n background: #F0F2F4;\n color: #3A4856;\n border: none;\n}\n.viewer .button {\n color: white;\n background:#3A4856;\n border: 1px solid #EAECEE;\n\n}\n\n\n\n\n.button:hover, .button:active {\n color: #111;\n background: #EAECEE;\n border-color: #3A4856;\n}\n\n\n\n.highlight, .marked {\n background: #EAECEE;\n}\n\n.writemovie{\n font-weight: bold; margin-left: 8.5em;\n}\n\n.writemovie .button { padding:1px;}\n\n.headerForeground a { color: #6fc;}\n.headerShadow { left: 2px; top: 2px; }\n.title { padding:0px; margin:0px; }\n.siteSubtitle { padding:0px; margin:0px; padding-left:1.5em; }\n.subtitle { font-size:90%; color:#ccc; padding-left:0.25em; }\nh1,h2,h3,h4,h5 { color: #000; background: transparent; }\n.title {color:black; font-size:2em;}\n.shadow .title {color:#999; }\n.viewer pre { background-color:#f8f8ff; border-color:#ddf; }\n.viewer { padding-top:0px; }\n.editor textarea { font-family:monospace; }\n#sidebarOptions { border:1px #ccc solid; }\n.tiddler {\n border-bottom:1px solid #ccc; border-right:1px solid #ccc; padding-bottom:1em; margin-bottom:1em; \n background:#fff; padding-right:1.5em; }\n#messageArea { background-color:#EAECEE; border-color:#3A4856; font-size:90%; }\n#messageArea .button { text-decoration:none; font-weight:bold; background:transparent; border:0px; }\n\n\n\n\n/*New Movie Form*/\ntable.outerborderonly {\n border-width: 1px 1px 1px 1px;\n border-spacing: 0px;\n border-style: solid solid solid solid;\n border-color: black black black black;\n border-collapse: collapse;\n background-color: ;\n}\ntable.outerborderonly td, table.outerborderonly tr, table.outerborderonly th {\n border-width: 0px 0px 0px 0px;\n padding: 5px 5px 5px 5px;\n background-color: #EEEEEE;}\n\n/*tabs*/\n.tabSelected{\n color: #014;\n background: #eee;\n border-left: 1px solid #ccc;\n border-top: 1px solid #ccc;\n border-right: 1px solid #ccc;\n}\n\n.tabUnselected {\n color: #fff;\n background: #999;\n}\n\n.tabContents {\n color: #014;\n background: #fff;\n border: 1px solid #ccc;\n}\n\n\n\n\n#topMenu br {display:none; }\n#topMenu { background: #3A4856; }\n#topMenu { padding:5px 2px 1px 2px; }\n#topMenu .button, #topMenu .tiddlyLink {\n margin-left:0.5em; margin-right:0.5em;\n padding-left:3px; padding-right:3px;\n color:white; font-size:125%;\n}\n\n\n#displayArea { margin: 1em 15.7em 0em 1em; } /* so we use the freed up space */\n#topMenu .button:hover, #topMenu .tiddlyLink:hover { background:#F0F2F4; color:#3A4856;}\n}\n\n\n/*}}}*/\n\n
/***\n|Name|TabEditPlugin|\n|Created by|SaqImtiaz|\n|Location|http://lewcid.googlepages.com/lewcid.html#TabEditPlugin|\n|Version|0.32|\n|Requires|~TW2.x|\n\n!Description\nMakes editing of tabs easier.\n\n!Usage\n*Double click a tab to edit the source tiddler\n*Double click outside the tabset to edit the containing tiddler. \n\n!Demo\nTestTabs\n\n!History\n*28-04-06, v0.32 - fixed previous bug fix!\n*27-04-06, v0.31 - fixed conflicts with tabs created using PartTiddler.\n*26-04-06, v0.30 - first public release\n\n***/\n\n//{{{\n\n//tab on double click event handler\nStory.prototype.onTabDblClick = function(e){\n if (!e) var e = window.event;\n var theTarget = resolveTarget(e);\n var title= this.getAttribute("source");\n if ((version.extensions.PartTiddlerPlugin)&&(title.indexOf("/")!=-1))\n {if (!oldFetchTiddler.call(this, [title]))\n {return false;}} \n story.displayTiddler(theTarget,title,2,false,null)\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return false;\n }\n\nconfig.macros.tabs.switchTab = function(tabset,tab)\n{\n var cookie = tabset.getAttribute("cookie");\n var theTab = null\n var nodes = tabset.childNodes;\n for(var t=0; t<nodes.length; t++)\n if(nodes[t].getAttribute && nodes[t].getAttribute("tab") == tab)\n {\n theTab = nodes[t];\n theTab.className = "tab tabSelected";\n }\n else\n nodes[t].className = "tab tabUnselected"\n if(theTab)\n {\n if(tabset.nextSibling && tabset.nextSibling.className == "tabContents")\n tabset.parentNode.removeChild(tabset.nextSibling);\n var tabContent = createTiddlyElement(null,"div",null,"tabContents",null);\n tabset.parentNode.insertBefore(tabContent,tabset.nextSibling);\n var contentTitle = theTab.getAttribute("content");\n\n //set source attribute equal to title of tiddler displayed in tab\n tabContent.setAttribute("source",contentTitle);\n //add dbl click event\n tabContent.ondblclick = story.onTabDblClick;\n\n wikify(store.getTiddlerText(contentTitle),tabContent,null,store.getTiddler(contentTitle));\n if(cookie)\n {\n config.options[cookie] = tab;\n saveOptionCookie(cookie);\n }\n }\n}\n\n//}}}
<<timeline '' '' '' 30>>
/***\nA hack of the core timeline macro. Now you can specify a start date for the timeline, and the max number of days to display\n\n''Syntax:''\n\n{{{<<timeline '' '' '20060512'>>}}}\nWill start the timeline from the 12th of May 2006. Note the start date is the third parameter.\n\n{{{<<timeline '' '' '' '7'>>}}}\nWill display the timeline for the last 7 days. Note the max days is the fourth parameter.\n\nOf course, you can combine the above as well, a start date and the max days.\n\n\n\nThe first two parameters are the same as in the core, the first being the field to sort by (modified or created) and the second being the maximum number of entries.\n\n\n***/\n\n//{{{\nconfig.macros.timeline.handler = function(place,macroName,params)\n{\n var field = params[0] ? params[0] : "modified";\n var tiddlers = store.reverseLookup("tags","excludeLists",false,field);\n var lastDay = "";\n var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1])) : 0;\n var firstDay = params[2]? params[2]: "00010101";\n var maxDays = params[3]? params[3]*24*60*60*1000: (new Date()).getTime() ;\n\n\n for(var t=tiddlers.length-1; t>=last; t--)\n {\nif (tiddlers[t].tags.contains('Movie')==false)\n {var tiddler = tiddlers[t];\n var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8);\n if ((theDay>=firstDay)&& (tiddler[field].getTime()> (new Date()).getTime() - maxDays))\n {\n if(theDay != lastDay)\n {\n var theDateList = document.createElement("ul");\n place.appendChild(theDateList);\n createTiddlyElement(theDateList,"li",null,"listTitle",tiddler[field].formatString(this.dateFormat));\n lastDay = theDay;\n }\n var theDateListItem = createTiddlyElement(theDateList,"li",null,"listLink",null);\n theDateListItem.appendChild(createTiddlyLink(place,tiddler.title,true));\n }\n }}\n}\n//}}}
!extension\nauto add backuptweaks optios to advancedoptios\n----\n*reduce timeline/sidebar size\n*movies tab in timeline?\n*reduce number of entries in timeline?\n*keep divided lists?\n----\n*droptagging\n----\ntiddlytools, new document plugin for creating clean distribution versions?\nTW 2.0.9\n----\nset search defaults?\n----\n*''replace plugin documentation with links ''\n----\nstats\n----\n\n----\n----\n*sortable grids changes run by squishy\n**try padd table rows a lot, remove padding from header, and then remove default nbsp but keep on mouseover\n***add nbsp to the smaller content columns to make equal width as header\n***sortable header mouse overs\n*embed css image file?\n*constant table widths?\n*scroll to top command?\n*Movies Seen, make2006 specific\n*clean up css\n*NewMovieForm\n**css!\n----\n----\n----\n\n----\n----\n*enable backuptweaks\n*delete ImportTiddlers?\n*remove stats,changelog, todo\n*set DefaultTiddlers\n*edit MainMenu\n*exclude movies from tabs? excludeLists\n*check excludeLists\n*need to add MovieManagerTiddlers tags?\n*run Maintenance\n*delete Maintenance\n\n==========\n==========\n==========\n----\n----\n\n{{{ for making a movies tab\n<<forEachTiddler\nwhere\ntiddler.tags.contains("Movie")\n sortBy "tiddler.modified"\ndescending\nwrite\n'"*[["+tiddler.data("movieName")+"|"+tiddler.title+"]]\sn"'>>\n}}}
<div class='toolbar'>\n<span style="padding-right:1.75em;" macro='dropTags'></span>\n<span macro='toolbar -closeTiddler closeOthers +editTiddler refresh permalink references jump'></span>\n</div>\n<div class='title' macro='view title'></div>\n<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (created <span macro='view created date [[DD MMM YYYY]]'></span>)</div>\n<div class='tagging' macro='tagging'></div>\n\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div>
/***\n\n***/\n//{{{\nwindow.getTiddlyWikiDir=getTiddlyWikiDir;\n\nfunction getTiddlyWikiDir() {\n var path = document.location.toString();\n var i = path.lastIndexOf("/");\n return (i >= 0) ? path.substr(0, i+1) : path;\n}\n\nconfig.macros.dynamicLink={};\nconfig.macros.dynamicLink.handler= function(place,macroName,params,wikifier,paramString,tiddler){\n\n var link=getTiddlyWikiDir();\n var text='TW folder';\n wikify(('[['+text+'|'+link+']]'),place);\n \n }\n\nfunction writeMovieList(e){\n if (!e) var e = window.event;\n var theTarget = resolveTarget(e);\n var theLink = theTarget;\n var list= theLink.getAttribute("list");\n theLink = theLink.parentNode.parentNode;\n var theMacro = eval("config.macros.writeMovieList."+list);\n wikify(theMacro,theLink);\n displayMessage("Movie List Saved",(getTiddlyWikiDir()));\n return(false);\n}\n\n\nconfig.macros.writeMovieList={\n\n MovToSee: '<<forEachTiddler where \s'tiddler.tags.contains("MovToSee") && ! tiddler.tags.contains("MovSeen")\s' sortBy \s'(tiddler.data("movieName").toLowerCase())\s' write \s'tiddler.data("movieName")+"\s\sn"\s' toFile {{getTiddlyWikiDir()+"Movies To See.txt"}} withLineSeparator \s'\sr\sn\s' >>',\n\n MovSeen: '<<forEachTiddler where \s'tiddler.tags.containsAny(["MovSeen","MovSeenAgain"])\s' sortBy \s'tiddler.data("movieDateSeen")\s' write \s'tiddler.data("movieName")+"\s\sn"\s' toFile {{getTiddlyWikiDir()+"Movies Seen 2006.txt"}} withLineSeparator \s'\sr\sn\s' >>',\n\n MovTop: '<<forEachTiddler where \s'tiddler.tags.contains("MovFav")\s' sortBy \s'(9.9-tiddler.data("movieRating"))+(tiddler.data("movieName").toLowerCase())\s' write \s'tiddler.data("movieName")+"\s\sn"\s' toFile {{getTiddlyWikiDir()+"Top Movies.txt"}} withLineSeparator \s'\sr\sn\s' >>',\n\n MovAgain: '<<forEachTiddler where \s'tiddler.tags.contains("MovWatchAgain")\s' sortBy \s'(9.9-tiddler.data("movieRating"))+(tiddler.data("movieName").toLowerCase())\s' write \s'tiddler.data("movieName")+"\s\sn"\s' toFile {{getTiddlyWikiDir()+"Movies Watch Again.txt"}} withLineSeparator \s'\sr\sn\s' >>',\n\n MovOfficial: '<<forEachTiddler where \s'tiddler.tags.containsAny(["MovFav","MovToSee"])\s' sortBy \s'(tiddler.data("movieName").toLowerCase())\s' write \s'tiddler.data("movieName")+"\s\sn"\s' toFile {{getTiddlyWikiDir()+"Official List of Movies.txt"}} withLineSeparator \s'\sr\sn\s' >>'\n};\n\nconfig.macros.writeMovieList.dropdownchar = "▼";\nconfig.macros.writeMovieList.handler = function(place,macroName,params,wikifier,paramString,tiddler){\n var arrow = ': '+ config.macros.writeMovieList.dropdownchar;\n var label = 'Save to File'+arrow;\n var tooltip = 'Save Movie List To File';\n\n var listNames= new Array("Movies To See","Movies Seen 2006","Top Movies","Movies Watch Again","Official List");\n var listValues= new Array("MovToSee","MovSeen","MovTop","MovAgain","MovOfficial");\n\n var onclick = function(e)\n { if (!e) var e = window.event;\n var popup = Popup.create(this);\n var lingo = config.views.wikified.tag;\n for(var t=0; t<listValues.length; t++)\n { var theButton = createTiddlyButton(createTiddlyElement(popup,"li"),listNames[t],null,writeMovieList,"tiddlyLinkExisting");\n theButton.setAttribute("list",listValues[t]);}\n Popup.show(popup,false);\n e.cancelBubble = true;\n if (e.stopPropagation)\n e.stopPropagation();\n return(false);\n };\n\n var createdropperButton = function(place){\n var sp = createTiddlyElement(place,"span",null,"writemovie");\n var theDropDownBtn = createTiddlyButton(sp,label,tooltip,onclick);\n };\n\ncreatedropperButton(place);\n};\n//}}}
/***\n|''Name:''|YourSearchPlugin|\n|''Version:''|2.0.2 (2006-02-13)|\n|''Source:''|http://tiddlywiki.abego-software.de/#YourSearchPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license]]|\n|''TiddlyWiki:''|2.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n<<tiddler [[YourSearch Introduction]]>>\nFor more information see [[Help|YourSearch Help]].\n\n!Compatibility\nThis plugin requires TiddlyWiki 2.0. \nUse http://tiddlywiki.abego-software.de/#YourSearchPlugin-1.0.1 for older TiddlyWiki versions.\n\n!Revision history\n* v2.0.2 (2006-02-13)\n** Bugfix for Firefox 1.5.0.1 related to the "Show prefix" checkbox. Thanks to Ted Pavlic for reporting and to BramChen for fixing. \n** Internal\n*** Make "JSLint" conform\n* v2.0.1 (2006-02-05)\n** Support "Exact Word Match" (use '=' to prefix word)\n** Support default filter settings (when no filter flags are given in search term)\n** Rework on the "less than 3 chars search text" feature (thanks to EricShulman)\n** Better support SinglePageMode when doing "Open all tiddlers" (thanks to EricShulman)\n** Support Firefox 1.5.0.1\n** Bug: Fixed a hilite bug in "classic search mode" (thanks to EricShulman)\n* v2.0.0 (2006-01-16)\n** Add User Interface\n* v1.0.1 (2006-01-06)\n** Support TiddlyWiki 2.0\n* v1.0.0 (2005-12-28)\n** initial version\n!Code\nThe code is compressed. \n\nYou can retrieve a readable source code version from http://tiddlywiki.abego-software.de/#YourSearchPlugin-src.\n/%\n***/\nif(!version.extensions.YourSearchPlugin){version.extensions.YourSearchPlugin={major:2,minor:0,revision:2,date:new Date(2006,2,13),type:"plugin",source:"http://tiddlywiki.abego-software.de/#YourSearchPlugin"};var alertAndThrow=function(_1){alert(_1);throw _1;};if(!window.abego){window.abego={};}if(abego.YourSearch){alertAndThrow("abego.YourSearch already defined");}abego.YourSearch={};if(version.major<2){alertAndThrow("YourSearchPlugin requires TiddlyWiki 2.0 or newer.\sn\snGet YourSearch 1.0.1 to use YourSearch with older versions of TiddlyWiki.\sn\snhttp://tiddlywiki.abego-software.de/#YourSearchPlugin-1.0.1");}var STQ=function(_2,_3,_4,_5){this.queryText=_2;this.caseSensitive=_3;if(_5){this.regExp=new RegExp(_2,_3?"mg":"img");return;}this.terms=[];var re=/\ss*(\s-)?([#%!=]*)(?:(?:("(?:(?:\s\s")|[^"])*")|(\sS+)))(?:\ss+((?:[aA][nN][dD])|(?:[oO][rR]))(?!\sS))?/mg;var _7=re.exec(_2);while(_7!=null&&_7.length==6){var _8="-"==_7[1];var _9=_7[2];var _a=_9.indexOf("!")>=0;var _b=_9.indexOf("%")>=0;var _c=_9.indexOf("#")>=0;var _d=_9.indexOf("=")>=0;if(!_a&&!_b&&!_c){_a=config.options.chkSearchInTitle;_b=config.options.chkSearchInText;_c=config.options.chkSearchInTags;if(!_a&&!_b&&!_c){_a=_b=_c=true;}}if(_4){_b=false;_c=false;}var _e;if(_7[3]){try{_e=eval(_7[3]);}catch(ex){}}else{_e=_7[4];}if(!_e){throw "Invalid search expression: %0".format([_2]);}var _f=_7[5]&&_7[5].charAt(0).toLowerCase()=="o";this.terms.push(new STQ.Term(_e,_a,_b,_c,_8,_f,_3,_d));_7=re.exec(_2);}};var me=STQ.prototype;me.getMatchingTiddlers=function(_10){var _11=[];for(var i in _10){var t=_10[i];if((t instanceof Tiddler)&&this.matchesTiddler(t)){_11.push(t);}}return _11;};me.matchesTiddler=function(_14){if(this.regExp){return this.regExp.test(_14.title)||this.regExp.test(_14.text);}var n=this.terms.length;if(n==0){return false;}var _16=this.terms[0].matchesTiddler(_14);for(var i=1;i<this.terms.length;i++){if(this.terms[i-1].orFollows){if(!_16){_16|=this.terms[i].matchesTiddler(_14);}}else{if(_16){_16&=this.terms[i].matchesTiddler(_14);}}}return _16;};me.getOnlyMatchTitleQuery=function(){if(!this.onlyMatchTitleQuery){this.onlyMatchTitleQuery=new STQ(this.queryText,this.caseSensitive,true,this.useRegExp);}return this.onlyMatchTitleQuery;};me.getMarkRegExp=function(){if(this.regExp){return "".search(this.regExp)>=0?null:this.regExp;}var _18={};var n=this.terms.length;for(var i=0;i<this.terms.length;i++){var _1b=this.terms[i];if(!_1b.negate){_18[_1b.text]=true;}}var _1c=[];for(var t in _18){_1c.push("("+t.escapeRegExp()+")");}if(_1c.length==0){return null;}var _1e=_1c.join("|");return new RegExp(_1e,this.caseSensitive?"mg":"img");};me.toString=function(){if(this.regExp){return this.regExp.toString();}var _1f="";for(var i=0;i<this.terms.length;i++){_1f+=this.terms[i].toString();}return _1f;};STQ.Term=function(_21,_22,_23,_24,_25,_26,_27,_28){this.text=_21;this.inTitle=_22;this.inText=_23;this.inTag=_24;this.negate=_25;this.orFollows=_26;this.caseSensitive=_27;this.wordMatch=_28;var _29=_21.escapeRegExp();if(this.wordMatch){_29="\s\sb"+_29+"\s\sb";}this.regExp=new RegExp(_29,"m"+(_27?"":"i"));};STQ.Term.prototype.toString=function(){return (this.negate?"-":"")+(this.inTitle?"!":"")+(this.inText?"%":"")+(this.inTag?"#":"")+(this.wordMatch?"=":"")+"\s""+this.text+"\s""+(this.orFollows?" OR ":" AND ");};STQ.Term.prototype.matchesTiddler=function(_2a){if(!_2a){return false;}if(this.inTitle&&this.regExp.test(_2a.title)){return !this.negate;}if(this.inText&&this.regExp.test(_2a.text)){return !this.negate;}if(this.inTag){var _2b=_2a.tags;if(_2b){for(var i=0;i<_2b.length;i++){if(this.regExp.test(_2b[i])){return !this.negate;}}}}return this.negate;};var stringToInt=function(s,_2e){if(!s){return _2e;}var n=parseInt(s);return (n==NaN)?_2e:n;};var getIntAttribute=function(_30,_31,_32){return stringToInt(_30.getAttribute(_31));};var isDescendantOrSelf=function(_33,e){while(e!=null){if(_33==e){return true;}e=e.parentNode;}return false;};var getMatchCount=function(s,re){var m=s.match(re);return m?m.length:0;};var createEllipsis=function(_38){var e=createTiddlyElement(_38,"span");e.innerHTML="…";};var isWordChar=function(c){return (c>="a"&&c<="z")||(c>="A"&&c<="Z")||c=="_";};var getWordBounds=function(s,_3c){if(!isWordChar(s[_3c])){return null;}for(var i=_3c-1;i>=0&&isWordChar(s[i]);i--){}var _3e=i+1;var n=s.length;for(i=_3c+1;i<n&&isWordChar(s[i]);i++){}return {start:_3e,end:i};};var removeTextDecoration=function(s){var _41=["''","{{{","}}}","//","<<<","/***","***/"];var _42="";for(var i=0;i<_41.length;i++){if(i!=0){_42+="|";}_42+="("+_41[i].escapeRegExp()+")";}return s.replace(new RegExp(_42,"mg"),"").trim();};var logText="";var lastLogTime=null;var logMessage=function(_44,s){var now=new Date();var _47=lastLogTime?(now-lastLogTime).toString():"";logText+="<tr><td>"+now.convertToYYYYMMDDHHMMSSMMM()+"</td><td align='right'>"+_47+"</td><td>"+_44+"</td><td>"+s.htmlEncode()+"</td></tr>\sn";lastLogTime=now;};function writeLog(){var t=" <<JsDoIt 'WriteLog' 'WriteLog' 'javascript:writeLog();story.closeTiddler(\s"Log\s");story.displayTiddler(null,\s"Log\s");'>>"+"<html><table><tbody><tr><th>Time</th><th>Delta (ms)</th><th>Kind</th><th>Message</th></tr>\sn"+logText+"</tbody></table></html>";store.saveTiddler("Log","Log",t,config.options.txtUserName,new Date(),["System","Log"]);logText="";lastLogTime=null;}var yourSearchResultID="yourSearchResult";var yourSearchResultItemsID="yourSearchResultItems";var maxCharsInTitle=80;var maxCharsInTags=50;var maxCharsInText=250;var maxPagesInNaviBar=10;var itemsPerPageDefault=25;var itemsPerPageWithPreviewDefault=10;var minMatchWithContextSize=40;var maxMovementForWordCorrection=4;var matchInTitleWeight=4;var precisionInTitleWeight=10;var matchInTagsWeight=2;var resultElement;var lastResults;var lastQuery;var lastSearchText;var searchInputField;var searchButton;var firstIndexOnPage=0;var currentTiddler;var indexInPage;var indexInResult;var getItemsPerPage=function(){var n=(config.options.chkPreviewText)?stringToInt(config.options.txtItemsPerPageWithPreview,itemsPerPageWithPreviewDefault):stringToInt(config.options.txtItemsPerPage,itemsPerPageDefault);return (n>0)?n:1;};var standardRankFunction=function(_4a,_4b){var _4c=_4b.getMarkRegExp();if(!_4c){return 1;}var _4d=_4a.title.match(_4c);var _4e=_4d?_4d.length:0;var _4f=getMatchCount(_4a.getTags(),_4c);var _50=_4d?_4d.join("").length:0;var _51=_4a.title.length>0?_50/_4a.title.length:0;var _52=_4e*matchInTitleWeight+_4f*matchInTagsWeight+_51*precisionInTitleWeight+1;return _52;};var findMatches=function(_53,_54,_55,_56,_57,_58){lastSearchText=_54;var _59=_53.reverseLookup("tags",_58,false);var _5a=new STQ(_54,_55,false,_56);lastQuery=_5a;var _5b=_5a.getMatchingTiddlers(_59);var _5c=abego.YourSearch.getRankFunction();for(var i=0;i<_5b.length;i++){var _5e=_5b[i];var _5f=_5c(_5e,_5a);_5e.searchRank=_5f;}if(!_57){_57="title";}var _60=function(a,b){var _63=a.searchRank-b.searchRank;if(_63==0){if(a[_57]==b[_57]){return (0);}else{return (a[_57]<b[_57])?-1:+1;}}else{return (_63>0)?-1:+1;}};_5b.sort(_60);lastResults=_5b;return _5b;};var moveToWordBorder=function(s,_65,_66){var _67;if(_66){_67=getWordBounds(s,_65);}else{if(_65<=0){return _65;}_67=getWordBounds(s,_65-1);}if(!_67){return _65;}if(_66){if(_67.start>=_65-maxMovementForWordCorrection){return _67.start;}if(_67.end<=_65+maxMovementForWordCorrection){return _67.end;}}else{if(_67.end<=_65+maxMovementForWordCorrection){return _67.end;}if(_67.start>=_65-maxMovementForWordCorrection){return _67.start;}}return _65;};var getContextRangeAround=function(s,_69,_6a,_6b,_6c){var _6d=Math.max(Math.floor(_6c/(_6b+1)),minMatchWithContextSize);var _6e=Math.max(_6d-(_6a-_69),0);var _6f=Math.min(Math.floor(_6a+_6e/3),s.length);var _70=Math.max(_6f-_6d,0);_70=moveToWordBorder(s,_70,true);_6f=moveToWordBorder(s,_6f,false);return {start:_70,end:_6f};};var getTextAndMatchArray=function(s,_72){var _73=[];if(_72){var _74=0;var n=s.length;var _76=0;do{_72.lastIndex=_74;var _77=_72.exec(s);if(_77){if(_74<_77.index){var t=s.substring(_74,_77.index);_73.push({text:t});}_73.push({text:_77[0],isMatch:true});_74=_77.index+_77[0].length;}else{_73.push({text:s.substr(_74)});break;}}while(true);}else{_73.push({text:s});}return _73;};var simpleCreateLimitedTextWithMarks=function(_79,s,_7b){if(!lastQuery){return;}var _7c=getTextAndMatchArray(s,lastQuery.getMarkRegExp());var _7d=0;for(var i=0;i<_7c.length&&_7d<_7b;i++){var t=_7c[i];var _80=t.text;if(t.isMatch){createTiddlyElement(_79,"span",null,"marked",_80);}else{var _81=_7b-_7d;if(_81<_80.length){_80=_80.substring(0,_81)+"...";}createTiddlyText(_79,_80);}_7d+=_80.length;}};var addRange=function(_82,_83,_84){var n=_82.length;if(n==0){_82.push({start:_83,end:_84});return;}var i=0;for(;i<n;i++){var _87=_82[i];if(_87.start<=_84&&_83<=_87.end){var r;var _89=i+1;for(;_89<n;_89++){r=_82[_89];if(r.start>_84||_83>_87.end){break;}}var _8a=_83;var _8b=_84;for(var j=i;j<_89;j++){r=_82[j];_8a=Math.min(_8a,r.start);_8b=Math.max(_8b,r.end);}_82.splice(i,_89-i,{start:_8a,end:_8b});return;}if(_87.start>_84){break;}}_82.splice(i,0,{start:_83,end:_84});};var getTotalRangesSize=function(_8d){var _8e=0;for(var i=0;i<_8d.length;i++){var _90=_8d[i];_8e+=_90.end-_90.start;}return _8e;};var writeTextAndMatchRange=function(_91,s,_93,_94,_95){var t;var _97;var pos=0;var i=0;var _9a=0;for(;i<_93.length;i++){t=_93[i];_97=t.text;if(_94<pos+_97.length){_9a=_94-pos;break;}pos+=_97.length;}var _9b=_95-_94;for(;i<_93.length&&_9b>0;i++){t=_93[i];_97=t.text.substr(_9a);_9a=0;if(_97.length>_9b){_97=_97.substr(0,_9b);}if(t.isMatch){createTiddlyElement(_91,"span",null,"marked",_97);}else{createTiddlyText(_91,_97);}_9b-=_97.length;}if(_95<s.length){createEllipsis(_91);}};var getMatchedTextCount=function(_9c){var _9d=0;for(var i=0;i<_9c.length;i++){if(_9c[i].isMatch){_9d++;}}return _9d;};var getMatchedTextWithContextRanges=function(_9f,s,_a1){var _a2=[];var _a3=getMatchedTextCount(_9f);var pos=0;for(var i=0;i<_9f.length;i++){var t=_9f[i];var _a7=t.text;if(t.isMatch){var _a8=getContextRangeAround(s,pos,pos+_a7.length,_a3,_a1);addRange(_a2,_a8.start,_a8.end);}pos+=_a7.length;}return _a2;};var fillUpRanges=function(s,_aa,_ab){var _ac=_ab-getTotalRangesSize(_aa);while(_ac>0){if(_aa.length==0){addRange(_aa,0,moveToWordBorder(s,_ab,false));return;}else{var _ad=_aa[0];var _ae;var _af;if(_ad.start==0){_ae=_ad.end;if(_aa.length>1){_af=_aa[1].start;}else{addRange(_aa,_ae,moveToWordBorder(s,_ae+_ac,false));return;}}else{_ae=0;_af=_ad.start;}var _b0=Math.min(_af,_ae+_ac);addRange(_aa,_ae,_b0);_ac-=(_b0-_ae);}}};var writeRanges=function(_b1,s,_b3,_b4,_b5){if(_b4.length==0){return;}if(_b4[0].start>0){createEllipsis(_b1);}var _b6=_b5;for(var i=0;i<_b4.length&&_b6>0;i++){var _b8=_b4[i];var len=Math.min(_b8.end-_b8.start,_b6);writeTextAndMatchRange(_b1,s,_b3,_b8.start,_b8.start+len);_b6-=len;}};var createLimitedTextWithMarksAndContext=function(_ba,s,_bc){if(!lastQuery){return;}if(s.length<_bc){_bc=s.length;}var _bd=getTextAndMatchArray(s,lastQuery.getMarkRegExp());var _be=getMatchedTextWithContextRanges(_bd,s,_bc);fillUpRanges(s,_be,_bc);writeRanges(_ba,s,_bd,_be,_bc);};var createLimitedTextWithMarks=function(_bf,s,_c1){return createLimitedTextWithMarksAndContext(_bf,s,_c1);};var myStorySearch=function(_c2,_c3,_c4){highlightHack=new RegExp(_c4?_c2:_c2.escapeRegExp(),_c3?"mg":"img");var _c5=findMatches(store,_c2,_c3,_c4,"title","excludeSearch");firstIndexOnPage=0;showResult();highlightHack=null;};var myMacroSearchHandler=function(_c6,_c7,_c8){var _c9="";var _ca=null;var _cb=function(txt){if(config.options.chkUseYourSearch){myStorySearch(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);}else{story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);}_c9=txt.value;};var _cd=function(e){_cb(searchInputField);return false;};var _cf=function(e){if(!e){var e=window.event;}switch(e.keyCode){case 13:_cb(this);break;case 27:if(isResultOpen()){closeResult();}else{this.value="";clearMessage();}break;}if(String.fromCharCode(e.keyCode)==this.accessKey||e.altKey){reopenResultIfApplicable();}if(this.value.length<3&&_ca){clearTimeout(_ca);}if((this.value.length>2)&&(this.value!=_c9)){if(!config.options.chkUseYourSearch||config.options.chkSearchAsYouType){if(_ca){clearTimeout(_ca);}var txt=this;_ca=setTimeout(function(){_cb(txt);},500);}}if(this.value.length==0){closeResult();}};var _d3=function(e){this.select();reopenResultIfApplicable();};var btn=createTiddlyButton(_c6,this.label,this.prompt,_cd);var txt=createTiddlyElement(_c6,"input",null,null,null);if(_c8[0]){txt.value=_c8[0];}txt.onkeyup=_cf;txt.onfocus=_d3;txt.setAttribute("size",this.sizeTextbox);txt.setAttribute("accessKey",this.accessKey);txt.setAttribute("autocomplete","off");if(config.browser.isSafari){txt.setAttribute("type","search");txt.setAttribute("results","5");}else{txt.setAttribute("type","text");}searchInputField=txt;searchButton=btn;};var isResultOpen=function(){return resultElement!=null&&resultElement.parentNode==document.body;};var closeResult=function(){if(isResultOpen()){document.body.removeChild(resultElement);}};var openAllFoundTiddlers=function(){closeResult();if(lastResults){var _d7=[];for(var i=0;i<lastResults.length;i++){_d7.push(lastResults[i].title);}story.displayTiddlers(null,_d7);}};var refreshResult=function(){if(!resultElement||!searchInputField){return;}var _d9=store.getTiddlerText("YourSearchResultTemplate");if(!_d9){_d9="<b>Tiddler YourSearchResultTemplate not found</b>";}resultElement.innerHTML=_d9;firstIndexOnPage=Math.floor(firstIndexOnPage/getItemsPerPage())*getItemsPerPage();applyHtmlMacros(resultElement,null);refreshElements(resultElement,null);if(lastResults&&lastResults.length>0){var _da=store.getTiddlerText("YourSearchItemTemplate");if(!_da){alertAndThrow("YourSearchItemTemplate not found");}var _db=document.getElementById(yourSearchResultItemsID);if(!_db){_db=createTiddlyElement(resultElement,"div",yourSearchResultItemsID);}var _dc=Math.min(firstIndexOnPage+getItemsPerPage(),lastResults.length);indexInPage=-1;for(var i=firstIndexOnPage;i<_dc;i++){currentTiddler=lastResults[i];indexInPage++;indexInResult=i;var _de=createTiddlyElement(_db,"div",null,"yourSearchItem");_de.innerHTML=_da;applyHtmlMacros(_de,null);refreshElements(_de,null);}}currentTiddler=null;ensureResultIsDisplayedNicely();};var ensureResultIsDisplayedNicely=function(){adjustResultPositionAndSize();scrollVisible();};var scrollVisible=function(){if(resultElement){window.scrollTo(0,ensureVisible(resultElement));}if(searchInputField){window.scrollTo(0,ensureVisible(searchInputField));}};var adjustResultPositionAndSize=function(){if(!searchInputField){return;}var _df=searchInputField;var _e0=findPosX(_df);var _e1=findPosY(_df);var _e2=_df.offsetHeight;var _e3=_e0;var _e4=_e1+_e2;var _e5=findWindowWidth();if(_e5<resultElement.offsetWidth){resultElement.style.width=(_e5-100)+"px";_e5=findWindowWidth();}var _e6=resultElement.offsetWidth;if(_e3+_e6>_e5){_e3=_e5-_e6-30;}if(_e3<0){_e3=0;}resultElement.style.left=_e3+"px";resultElement.style.top=_e4+"px";resultElement.style.display="block";};var showResult=function(){if(!resultElement){resultElement=createTiddlyElement(document.body,"div",yourSearchResultID,"yourSearchResult");}else{if(resultElement.parentNode!=document.body){document.body.appendChild(resultElement);}}refreshResult();};var reopenResultIfApplicable=function(){if(searchInputField==null||!config.options.chkUseYourSearch){return;}if((searchInputField.value==lastSearchText)&&lastSearchText&&!isResultOpen()){if(resultElement&&(resultElement.parentNode!=document.body)){document.body.appendChild(resultElement);ensureResultIsDisplayedNicely();}else{showResult();}}};var setFirstIndexOnPage=function(_e7){if(!lastResults||lastResults.length==0){return;}firstIndexOnPage=Math.min(Math.max(0,_e7),lastResults.length-1);refreshResult();};var onDocumentClick=function(e){if(e.target==searchInputField){return;}if(e.target==searchButton){return;}if(resultElement&&isDescendantOrSelf(resultElement,e.target)){return;}closeResult();};var onDocumentKeyup=function(e){if(e.keyCode==27){closeResult();}};addEvent(document,"click",onDocumentClick);addEvent(document,"keyup",onDocumentKeyup);config.macros.yourSearch={label:"yourSearch",prompt:"Gives access to the current/last YourSearch result",funcs:{},tests:{"true":function(){return true;},"false":function(){return false;},"found":function(){return lastResults&&lastResults.length>0;},"previewText":function(){return config.options.chkPreviewText;}}};config.macros.yourSearch.handler=function(_ea,_eb,_ec,_ed,_ee,_ef){if(_ec.length==0){return;}var _f0=_ec[0];var _f1=config.macros.yourSearch.funcs[_f0];if(_f1){_f1(_ea,_eb,_ec,_ed,_ee,_ef);}};config.macros.yourSearch.funcs.itemRange=function(_f2){if(lastResults){var _f3=Math.min(firstIndexOnPage+getItemsPerPage(),lastResults.length);var s="%0 - %1".format([firstIndexOnPage+1,_f3]);createTiddlyText(_f2,s);}};config.macros.yourSearch.funcs.count=function(_f5){if(lastSearchText){createTiddlyText(_f5,lastResults.length.toString());}};config.macros.yourSearch.funcs.query=function(_f6){if(lastResults){createTiddlyText(_f6,lastSearchText);}};config.macros.yourSearch.funcs.version=function(_f7){var t="YourSearch %0.%1.%2".format([version.extensions.YourSearchPlugin.major,version.extensions.YourSearchPlugin.minor,version.extensions.YourSearchPlugin.revision]);var e=createTiddlyElement(_f7,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de/#YourSearchPlugin");e.innerHTML="<font color=\s"black\s" face=\s"Arial, Helvetica, sans-serif\s">"+t+"<font>";};config.macros.yourSearch.funcs.copyright=function(_fa){var e=createTiddlyElement(_fa,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de");e.innerHTML="<font color=\s"black\s" face=\s"Arial, Helvetica, sans-serif\s">© 2005-2006 <b><font color=\s"red\s">abego</font></b> Software<font>";};config.macros.yourSearch.funcs.linkButton=function(_fc,_fd,_fe,_ff,_100,_101){if(_fe<2){return;}var _102=_fe[1];var text=_fe<3?_102:_fe[2];var _104=_fe<4?text:_fe[3];var _105=_fe<5?null:_fe[4];var btn=createTiddlyButton(_fc,text,_104,closeResultAndDisplayTiddler,null,null,_105);btn.setAttribute("tiddlyLink",_102);};config.macros.yourSearch.funcs.closeButton=function(_107,_108,_109,_10a,_10b,_10c){var _10d=createTiddlyButton(_107,"close","Close the Search Results (Shortcut: ESC)",closeResult);};config.macros.yourSearch.funcs.openAllButton=function(_10e,_10f,_110,_111,_112,_113){if(!lastResults){return;}var n=lastResults.length;if(n==0){return;}var _115=n==1?"open tiddler":"open all %0 tiddlers".format([n]);var _116=createTiddlyButton(_10e,_115,"Open all found tiddlers (Shortcut: Alt-O)",openAllFoundTiddlers);_116.setAttribute("accessKey","O");};var onNaviButtonClick=function(e){if(!e){var e=window.event;}var _119=getIntAttribute(this,"page");setFirstIndexOnPage(_119*getItemsPerPage(),0);};config.macros.yourSearch.funcs.naviBar=function(_11a,_11b,_11c,_11d,_11e,_11f){if(!lastResults||lastResults.length==0){return;}var _120;var _121=Math.floor(firstIndexOnPage/getItemsPerPage());var _122=Math.floor((lastResults.length-1)/getItemsPerPage());if(_121>0){_120=createTiddlyButton(_11a,"Previous","Go to previous page (Shortcut: Alt-'<')",onNaviButtonClick,"prev");_120.setAttribute("page",(_121-1).toString());_120.setAttribute("accessKey","<");}for(var i=-maxPagesInNaviBar;i<maxPagesInNaviBar;i++){var _124=_121+i;if(_124<0){continue;}if(_124>_122){break;}var _125=(i+_121+1).toString();var _126=_124==_121?"currentPage":"otherPage";_120=createTiddlyButton(_11a,_125,"Go to page %0".format([_125]),onNaviButtonClick,_126);_120.setAttribute("page",(_124).toString());}if(_121<_122){_120=createTiddlyButton(_11a,"Next","Go to next page (Shortcut: Alt-'>')",onNaviButtonClick,"next");_120.setAttribute("page",(_121+1).toString());_120.setAttribute("accessKey",">");}};config.macros.yourSearch.funcs["if"]=function(_127,_128,_129,_12a,_12b,_12c){if(_129.length<2){return;}var _12d=_129[1];var _12e=(_12d=="not");if(_12e){if(_129.length<3){return;}_12d=_129[2];}var test=config.macros.yourSearch.tests[_12d];var _130=false;try{if(test){_130=test(_127,_128,_129,_12a,_12b,_12c)!=_12e;}else{_130=(!eval(_12d))==_12e;}}catch(ex){}if(!_130){_127.style.display="none";}};var createOptionWithRefresh=function(_131,_132,_133,_134){invokeMacro(_131,"option",_132,_133,_134);var elem=_131.lastChild;var _136=elem.onclick;elem.onclick=function(e){var _138=_136.apply(this,arguments);refreshResult();return _138;};return elem;};config.macros.yourSearch.funcs.chkPreviewText=function(_139,_13a,_13b,_13c,_13d,_13e){var _13f=_13b.slice(1).join(" ");var elem=createOptionWithRefresh(_139,"chkPreviewText",_13c,_13e);elem.setAttribute("accessKey","P");elem.title="Show text preview of found tiddlers (Shortcut: Alt-P)";return elem;};config.macros.foundTiddler={label:"foundTiddler",prompt:"Provides information on the tiddler currently processed on the YourSearch result page",funcs:{}};config.macros.foundTiddler.handler=function(_141,_142,_143,_144,_145,_146){if(!currentTiddler){return;}var name=_143[0];var func=config.macros.foundTiddler.funcs[name];if(func){func(_141,_142,_143,_144,_145,_146);}};var closeResultAndDisplayTiddler=function(e){closeResult();var _14a=this.getAttribute("tiddlyLink");if(_14a){var _14b=this.getAttribute("withHilite");var _14c=highlightHack;if(_14b&&_14b=="true"&&lastQuery){highlightHack=lastQuery.getMarkRegExp();}story.displayTiddler(this,_14a);highlightHack=_14c;}return (false);};var getShortCutNumber=function(){if(!currentTiddler){return -1;}if(indexInPage>=0&&indexInPage<=9){return indexInPage<9?(indexInPage+1):0;}else{return -1;}};config.macros.foundTiddler.funcs.title=function(_14d,_14e,_14f,_150,_151,_152){if(!currentTiddler){return;}var _153=getShortCutNumber();var _154=_153>=0?"Open tiddler (Shortcut: Alt-%0)".format([_153.toString()]):"Open tiddler";var btn=createTiddlyButton(_14d,null,_154,closeResultAndDisplayTiddler,null);btn.setAttribute("tiddlyLink",currentTiddler.title);btn.setAttribute("withHilite","true");createLimitedTextWithMarks(btn,currentTiddler.title,maxCharsInTitle);if(_153>=0){btn.setAttribute("accessKey",_153.toString());}};config.macros.foundTiddler.funcs.tags=function(_156,_157,_158,_159,_15a,_15b){if(!currentTiddler){return;}createLimitedTextWithMarks(_156,currentTiddler.getTags(),maxCharsInTags);};config.macros.foundTiddler.funcs.text=function(_15c,_15d,_15e,_15f,_160,_161){if(!currentTiddler){return;}createLimitedTextWithMarks(_15c,removeTextDecoration(currentTiddler.text),maxCharsInText);};config.macros.foundTiddler.funcs.number=function(_162,_163,_164,_165,_166,_167){var _168=getShortCutNumber();if(_168>=0){var text="%0)".format([_168.toString()]);createTiddlyElement(_162,"span",null,"shortcutNumber",text);}};function scrollToAnchor(name){return false;}if(config.options.chkUseYourSearch==undefined){config.options.chkUseYourSearch=true;}if(config.options.chkPreviewText==undefined){config.options.chkPreviewText=true;}if(config.options.chkSearchAsYouType==undefined){config.options.chkSearchAsYouType=true;}if(config.options.chkSearchInTitle==undefined){config.options.chkSearchInTitle=true;}if(config.options.chkSearchInText==undefined){config.options.chkSearchInText=true;}if(config.options.chkSearchInTags==undefined){config.options.chkSearchInTags=true;}if(config.options.txtItemsPerPage==undefined){config.options.txtItemsPerPage=itemsPerPageDefault;}if(config.options.txtItemsPerPageWithPreview==undefined){config.options.txtItemsPerPageWithPreview=itemsPerPageWithPreviewDefault;}config.shadowTiddlers.AdvancedOptions+="\sn<<option chkUseYourSearch>> Use 'Your Search' //([[more options|YourSearch Options]])//";config.shadowTiddlers["YourSearch Introduction"]="!About YourSearch\sn"+"\sn"+"YourSearch gives you a bunch of new features to simplify and speed up your daily searches in TiddlyWiki. It seamlessly integrates into the standard TiddlyWiki search: just start typing into the 'search' field and explore!\sn"+"\sn"+"''May the '~Alt-F' be with you.''\sn"+"\sn"+"\sn"+"!Features\sn"+"* YourSearch searches for tiddlers that match your query ''as you type'' into the 'search' field. It presents a list of the ''\s"Top Ten\s"'' tiddlers in a ''popup-like window'': the ''[[YourSearch Result]]''. The tiddlers currently displayed in your TiddlyWiki are not affected.\sn"+"* Using ''~TiddlerRank technology'' the [[YourSearch Result]] lists the ''most interesting tiddlers first''.\sn"+"* Through ''Filtered Search'' and ''Boolean Search'' you can easily refining your search, like excluding words or searching for multiple words. This way less tiddlers are displayed in the [[YourSearch Result]] and you can faster scan the result for the tiddler you are looking for.\sn"+"* The [[YourSearch Result]] lists the found tiddlers ''page-wise'', e.g. 10 per page. Use the ''Result Page Navigation Bar'' to navigate between pages if the result does not fit on one page.\sn"+"* The [[YourSearch Result]] states the ''total number of found tiddlers''. This way you can quickly decide if you want to browse the result list or if you want to refine your search first to shorten the result list.\sn"+"* Beside the ''title of the found tiddlers'' the [[YourSearch Result]] also ''displays tags'' and ''tiddler text previews''. The ''tiddler text preview'' is an extract of the tiddler's content, showing the most interesting parts related to your query (e.g. the texts around the words you are looking for).\sn"+"* The words you are looking for are hilited in the titles, tags and text previews of the [[YourSearch Result]].\sn"+"* If you are not interested in the tiddler text previews but prefer to get longer lists of tiddlers on one result page you may ''switch of the text preview''.\sn"+"* If the [[YourSearch Result]] contains the tiddler you are looking for you can just ''click its title to display'' it in your TiddlyWiki. Alternatively you may also ''open all found tiddlers'' at once. \sn"+"* Use [[YourSearch Options]] to customize YourSearch to your needs. E.g. depending on the size of your screen you may change the number of tiddlers displayed in the [[YourSearch Result]]. In the [[YourSearch Options]] and the AdvancedOptions you may also switch off YourSearch in case you temporarily want to use the standard search.\sn"+"* For the most frequently actions ''access keys'' are defined so you can perform your search without using the mouse.\sn"+"\sn";config.shadowTiddlers["YourSearch Help"]="<<tiddler [[YourSearch Introduction]]>>"+"\sn"+"!Filtered Search<html><a name='Filtered'/></html>\sn"+"Using the Filtered Search you can restrict your search to certain parts of a tiddler, e.g only search the tags or only the titles.\sn"+"|!What you want|!What you type|!Example|\sn"+"|Search ''titles only''|start word with ''!''|{{{!jonny}}}|\sn"+"|Search ''contents only''|start word with ''%''|{{{%football}}}|\sn"+"|Search ''tags only''|start word with ''#''|{{{#Plugin}}}|\sn"+"\sn"+"You may use more than one filter for a word. E.g. {{{!#Plugin}}} finds tiddlers containing \s"Plugin\s" either in the title or in the tags (but does not look for \s"Plugin\s" in the content).\sn"+"\sn"+"!Boolean Search<html><a name='Boolean'/></html>\sn"+"The Boolean Search is useful when searching for multiple words.\sn"+"|!What you want|!What you type|!Example|\sn"+"|''All words'' must exist|List of words|{{{jonny jeremy}}}|\sn"+"|''At least one word'' must exist|Separate words by ''or''|{{{jonny or jeremy}}}|\sn"+"|A word ''must not exist''|Start word with ''-''|{{{-jonny}}}|\sn"+"\sn"+"''Note:'' When you specify two words, separated with a space, YourSearch finds all tiddlers that contain both words, but not necessarily next to each other. If you want to find a sequence of word, e.g. '{{{John Brown}}}', you need to put the words into quotes. I.e. you type: {{{\s"john brown\s"}}}.\sn"+"\sn"+"!'Exact Word' Search<html><a name='Exact'/></html>\sn"+"By default a search result all matches that 'contain' the searched text. \sn"+" E.g. if you search for 'Task' you will get all tiddlers containing 'Task', but also 'CompletedTask', 'TaskForce' etc.\sn"+"\sn"+"If you only want to get the tiddlers that contain 'exactly the word' you need to prefix it with a '='. E.g. typing '=Task' will the tiddlers that contain the word 'Task', ignoring words that just contain 'Task' as a substring.\sn"+"\sn"+"!Combined Search<html><a name='Combined'/></html>\sn"+"You are free to combine the various search options. \sn"+"\sn"+"''Examples''\sn"+"|!What you type|!Result|\sn"+"|{{{!jonny !jeremy -%football}}}| all tiddlers with both {{{jonny}}} and {{{jeremy}}} in its titles, but no {{{football}}} in content.|\sn"+"|{{{#=Task}}}|All tiddlers tagged with 'Task' (the exact word). Tags named 'CompletedTask', 'TaskForce' etc. are not considered.|\sn"+"\sn"+"!~CaseSensitiveSearch and ~RegExpSearch<html><a name='Case'/></html>\sn"+"The standard search options ~CaseSensitiveSearch and ~RegExpSearch are fully supported by YourSearch. However when ''~RegExpSearch'' is on Filtered and Boolean Search are disabled.\sn"+"\sn"+"!Access Keys<html><a name='Access'/></html>\sn"+"You are encouraged to use the access keys (also called \s"shortcut\s" keys) for the most frequently used operations. For quick reference these shortcuts are also mentioned in the tooltip for the various buttons etc.\sn"+"\sn"+"|!Key|!Operation|\sn"+"|{{{Alt-F}}}|''The most important keystroke'': It moves the cursor to the search input field so you can directly start typing your query. Pressing {{{Alt-F}}} will also display the previous search result. This way you can quickly display multiple tiddlers using \s"Press {{{Alt-F}}}. Select tiddler.\s" sequences.|\sn"+"|{{{ESC}}}|Closes the [[YourSearch Result]]. When the [[YourSearch Result]] is already closed and the cursor is in the search input field the field's content is cleared so you start a new query.|\sn"+"|{{{Alt-1}}}, {{{Alt-2}}},... |Pressing these keys opens the first, second etc. tiddler from the result list.|\sn"+"|{{{Alt-O}}}|Opens all found tiddlers.|\sn"+"|{{{Alt-P}}}|Toggles the 'Preview Text' mode.|\sn"+"|{{{Alt-'<'}}}, {{{Alt-'>'}}}|Displays the previous or next page in the [[YourSearch Result]].|\sn"+"|{{{Return}}}|When you have turned off the 'as you type' search mode pressing the {{{Return}}} key actually starts the search (as does pressing the 'search' button).|\sn"+"\sn";config.shadowTiddlers["YourSearch Options"]="|>|!YourSearch Options|\sn"+"|>|<<option chkUseYourSearch>> Use 'Your Search'|\sn"+"|!|<<option chkPreviewText>> Show Text Preview|\sn"+"|!|<<option chkSearchAsYouType>> 'Search As You Type' Mode (No RETURN required to start search)|\sn"+"|!|Default Search Filter:<<option chkSearchInTitle>>Titles ('!') <<option chkSearchInText>>Texts ('%') <<option chkSearchInTags>>Tags ('#') <html><br><font size=\s"-2\s">The parts of a tiddlers that are searched when you don't explicitly specify a filter in the search text (using a '!', '%' or '#' prefix).</font></html>|\sn"+"|!|Number of items on search result page: <<option txtItemsPerPage>>|\sn"+"|!|Number of items on search result page with preview text: <<option txtItemsPerPageWithPreview>>|\sn";config.shadowTiddlers["YourSearchStyleSheet"]="/***\sn"+"!~YourSearchResult Stylesheet\sn"+"***/\sn"+"/*{{{*/\sn"+".yourSearchResult {\sn"+"\stposition: absolute;\sn"+"\stwidth: 800px;\sn"+"\sn"+"\stpadding: 0.2em;\sn"+"\stlist-style: none;\sn"+"\stmargin: 0;\sn"+"\sn"+"\stbackground: White;\sn"+"\stborder: 1px solid DarkGray;\sn"+"}\sn"+"\sn"+"/*}}}*/\sn"+"/***\sn"+"!!Summary Section\sn"+"***/\sn"+"/*{{{*/\sn"+".yourSearchResult .summary {\sn"+"\stborder-bottom-width: thin;\sn"+"\stborder-bottom-style: solid;\sn"+"\stborder-bottom-color: #999999;\sn"+"\stpadding-bottom: 4px;\sn"+"}\sn"+"\sn"+".yourSearchRange, .yourSearchCount, .yourSearchQuery {\sn"+"\stfont-weight: bold;\sn"+"}\sn"+"\sn"+".yourSearchResult .summary .button {\sn"+"\stfont-size: 10px;\sn"+"\sn"+"\stpadding-left: 0.3em;\sn"+"\stpadding-right: 0.3em;\sn"+"}\sn"+"\sn"+".yourSearchResult .summary .chkBoxLabel {\sn"+"\stfont-size: 10px;\sn"+"\sn"+"\stpadding-right: 0.3em;\sn"+"}\sn"+"\sn"+"/*}}}*/\sn"+"/***\sn"+"!!Items Area\sn"+"***/\sn"+"/*{{{*/\sn"+".yourSearchResult .marked {\sn"+"\stbackground: none;\sn"+"\stfont-weight: bold;\sn"+"}\sn"+"\sn"+".yourSearchItem {\sn"+"\stmargin-top: 2px;\sn"+"}\sn"+"\sn"+".yourSearchNumber {\sn"+"\stcolor: #808080;\sn"+"}\sn"+"\sn"+"\sn"+".yourSearchTags {\sn"+"\stcolor: #008000;\sn"+"}\sn"+"\sn"+".yourSearchText {\sn"+"\stcolor: #808080;\sn"+"\stmargin-bottom: 6px;\sn"+"}\sn"+"\sn"+"/*}}}*/\sn"+"/***\sn"+"!!Footer\sn"+"***/\sn"+"/*{{{*/\sn"+".yourSearchFooter {\sn"+"\stmargin-top: 8px;\sn"+"\stborder-top-width: thin;\sn"+"\stborder-top-style: solid;\sn"+"\stborder-top-color: #999999;\sn"+"}\sn"+"\sn"+".yourSearchFooter a:hover{\sn"+"\stbackground: none;\sn"+"\stcolor: none;\sn"+"}\sn"+"/*}}}*/\sn"+"/***\sn"+"!!Navigation Bar\sn"+"***/\sn"+"/*{{{*/\sn"+".yourSearchNaviBar a {\sn"+"\stfont-size: 16px;\sn"+"\stmargin-left: 4px;\sn"+"\stmargin-right: 4px;\sn"+"\stcolor: black;\sn"+"\sttext-decoration: underline;\sn"+"}\sn"+"\sn"+".yourSearchNaviBar a:hover {\sn"+"\stbackground-color: none;\sn"+"}\sn"+"\sn"+".yourSearchNaviBar .prev {\sn"+"\stfont-weight: bold;\sn"+"\stcolor: blue;\sn"+"}\sn"+"\sn"+".yourSearchNaviBar .currentPage {\sn"+"\stcolor: #FF0000;\sn"+"\stfont-weight: bold;\sn"+"\sttext-decoration: none;\sn"+"}\sn"+"\sn"+".yourSearchNaviBar .next {\sn"+"\stfont-weight: bold;\sn"+"\stcolor: blue;\sn"+"}\sn"+"/*}}}*/\sn";config.shadowTiddlers["YourSearchResultTemplate"]="<!--\sn"+"{{{\sn"+"-->\sn"+"<span macro=\s"yourSearch if found\s">\sn"+"<!-- The Summary Header ============================================ -->\sn"+"<table class=\s"summary\s" border=\s"0\s" width=\s"100%\s" cellspacing=\s"0\s" cellpadding=\s"0\s"><tbody>\sn"+" <tr>\sn"+"\st<td align=\s"left\s">\sn"+"\st\stYourSearch Result <span class=\s"yourSearchRange\s" macro=\s"yourSearch itemRange\s"></span>\sn"+"\st\st of <span class=\s"yourSearchCount\s" macro=\s"yourSearch count\s"></span>\sn"+"\st\stfor <span class=\s"yourSearchQuery\s" macro=\s"yourSearch query\s"></span>\sn"+"\st</td>\sn"+"\st<td class=\s"yourSearchButtons\s" align=\s"right\s">\sn"+"\st\st<span macro=\s"yourSearch chkPreviewText\s"></span><span class=\s"chkBoxLabel\s">preview text</span>\sn"+"\st\st<span macro=\s"yourSearch openAllButton\s"></span>\sn"+"\st\st<span macro=\s"yourSearch linkButton 'YourSearch Options' options 'Configure YourSearch'\s"></span>\sn"+"\st\st<span macro=\s"yourSearch linkButton 'YourSearch Help' help 'Get help how to use YourSearch'\s"></span>\sn"+"\st\st<span macro=\s"yourSearch closeButton\s"></span>\sn"+"\st</td>\sn"+" </tr>\sn"+"</tbody></table>\sn"+"\sn"+"<!-- The List of Found Tiddlers ============================================ -->\sn"+"<div id=\s"yourSearchResultItems\s" itemsPerPage=\s"25\s" itemsPerPageWithPreview=\s"10\s"></div>\sn"+"\sn"+"<!-- The Footer (with the Navigation) ============================================ -->\sn"+"<table class=\s"yourSearchFooter\s" border=\s"0\s" width=\s"100%\s" cellspacing=\s"0\s" cellpadding=\s"0\s"><tbody>\sn"+" <tr>\sn"+"\st<td align=\s"left\s">\sn"+"\st\stResult page: <span class=\s"yourSearchNaviBar\s" macro=\s"yourSearch naviBar\s"></span>\sn"+"\st</td>\sn"+"\st<td align=\s"right\s"><span macro=\s"yourSearch version\s"></span>, <span macro=\s"yourSearch copyright\s"></span>\sn"+"\st</td>\sn"+" </tr>\sn"+"</tbody></table>\sn"+"<!-- end of the 'tiddlers found' case =========================================== -->\sn"+"</span>\sn"+"\sn"+"\sn"+"<!-- The \s"No tiddlers found\s" case =========================================== -->\sn"+"<span macro=\s"yourSearch if not found\s">\sn"+"<table class=\s"summary\s" border=\s"0\s" width=\s"100%\s" cellspacing=\s"0\s" cellpadding=\s"0\s"><tbody>\sn"+" <tr>\sn"+"\st<td align=\s"left\s">\sn"+"\st\stYourSearch Result: No tiddlers found for <span class=\s"yourSearchQuery\s" macro=\s"yourSearch query\s"></span>.\sn"+"\st</td>\sn"+"\st<td class=\s"yourSearchButtons\s" align=\s"right\s">\sn"+"\st\st<span macro=\s"yourSearch linkButton 'YourSearch Options' options 'Configure YourSearch'\s"></span>\sn"+"\st\st<span macro=\s"yourSearch linkButton 'YourSearch Help' help 'Get help how to use YourSearch'\s"></span>\sn"+"\st\st<span macro=\s"yourSearch closeButton\s"></span>\sn"+"\st</td>\sn"+" </tr>\sn"+"</tbody></table>\sn"+"</span>\sn"+"\sn"+"\sn"+"<!--\sn"+"}}}\sn"+"-->\sn";config.shadowTiddlers["YourSearchItemTemplate"]="<!--\sn"+"{{{\sn"+"-->\sn"+"<span class='yourSearchNumber' macro='foundTiddler number'></span>\sn"+"<span class='yourSearchTitle' macro='foundTiddler title'/></span> - \sn"+"<span class='yourSearchTags' macro='foundTiddler tags'/></span>\sn"+"<span macro=\s"yourSearch if previewText\s"><div class='yourSearchText' macro='foundTiddler text'/></div></span>\sn"+"<!--\sn"+"}}}\sn"+"-->";config.shadowTiddlers["YourSearch"]="<<tiddler [[YourSearch Help]]>>";config.shadowTiddlers["YourSearch Result"]="The popup-like window displaying the result of a YourSearch query.";setStylesheet(store.getTiddlerText("YourSearchStyleSheet"),"yourSearch");var origMacros_search_handler=config.macros.search.handler;config.macros.search.handler=myMacroSearchHandler;var ownsOverwrittenFunctions=function(){var _16b=(config.macros.search.handler==myMacroSearchHandler);return _16b;};var checkForOtherHijacker=function(){if(!ownsOverwrittenFunctions()){alert("Message from YourSearchPlugin:\sn\sn\sn"+"Another plugin has disabled the 'Your Search' features.\sn\sn\sn"+"You may disable the other plugin or change the load order of \sn"+"the plugins (by changing the names of the tiddlers)\sn"+"to enable the 'Your Search' features.");}};setTimeout(checkForOtherHijacker,5000);abego.YourSearch.getStandardRankFunction=function(){return standardRankFunction;};abego.YourSearch.getRankFunction=function(){return abego.YourSearch.getStandardRankFunction();};abego.YourSearch.getCurrentTiddler=function(){return currentTiddler;};}\n/***\n%/\n!Licence and Copyright\nCopyright (c) abego Software ~GmbH, 2005-2006 ([[www.abego-software.de|http://www.abego-software.de]])\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\nNeither the name of abego Software nor the names of its contributors may be\nused to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\nSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n***/\n\n
//{{{\n config.paramifiers.movie = {\n onstart: function(v) {\n \n var movieparams = v.split("$|$");\n\n\n var movieTitle = movieparams[0];\n var movieMode = movieparams[1];\n\n var tiddlerName;\n tiddlerName = 'Movies - ' + movieTitle;\n\n while (tiddlerName && store.getTiddler(tiddlerName)) {\n movieTitle = prompt("A movie named '"+movieTitle+"' already exists.\sn\sn"+"Please specify a movie name.", movieTitle); var tiddlerName = 'Movies - ' + movieTitle;\n }\n\n // tiddlerName is either null (user canceled) or a name that is not yet in the store.\n if ((tiddlerName)&&(movieTitle!=null)) {\n var body = "<<formTiddler [[NewMovieForm]]>>";\n var tags = "Movie MovImported";\n \n switch (movieMode){\n case 'tosee': tags+=" MovToSee"; break;\n case 'seen': tags+=" MovSeen"; break;\n case 'top': tags+=" MovFav MovSeen"; break;\n case 'again': tags+=" MovWatchAgain MovSeen"; break;\n }\n\n store.saveTiddler(tiddlerName,tiddlerName,body,config.options.txtUserName,new Date(),tags);\n DataTiddler.setData(tiddlerName,"movieName",movieTitle);\n DataTiddler.setData(tiddlerName,"movieRating","");\n story.displayTiddler(null,tiddlerName,1);\n if(config.options.chkAutoSave)\n {saveChanges();}\n\n\n }\n\n }\n};\n//}}}
//{{{\nwindow.removeTag=function(title,tag)\n{\n var t=store.getTiddler(title);\n if (!t || !t.tags) return;\n if (t.tags.find(tag)!==null)\n t.tags.splice(t.tags.find(tag),1)\n}\n\nwindow.addTag=function(title,tag)\n{\n var t=store.getTiddler(title);\n if (!t || !t.tags) return;\n if (t.tags.find(tag)==null)\n t.tags.push(tag)\n\n}\n\nwindow.movieMarkSeen=function(title,tag)\n{setRating(title);\n var t=store.getTiddler(title);\n if (!t || !t.tags) return;\n if (t.tags.find(tag)!==null)\n t.tags.splice(t.tags.find(tag),1);\n var now = new Date();\n var timeFormat= 'YY0MMDD';\n var formattednow= now.formatString(timeFormat);\n//alert(formattednow);\nDataTiddler.setData(title,"movieDateSeen",formattednow);\n\n}\n//}}}
window.setRating = function(title,containerTitle){\n var newRating=prompt("Enter new rating for this movie","");\n if (newRating==null){return false;}\n var tiddler = store.getTiddler(title);\n tiddler.setData("movieRating",newRating);\n if (containerTitle)\n {story.refreshTiddler(containerTitle,false,true);}\n return false;\n}