/***\n''AliasPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#AliasPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nCreate text-substitution macros that define abbreviations and other "aliases", and then embed them in the rest of your tiddler content to quickly insert common terms, phrases and links without a lot of repetitive typing.\n\n!!!!!Usage\n<<<\nFirst, decide upon a suitable "alias" for the text to be substituted. This is usually a short keyword or other abbreviated term that is easily input with just a few keystrokes. You can use any alias you like, but don't include any spaces in the alias name, since it will be used as the name of the 'alias macro' that is created, and macro names cannot contain spaces.\n\n//Note: If you use an alias name that ''does'' contain spaces, they will be automatically replaced with underscores ("_"), so that the resulting alias name will still be a valid macro name//\n\nTo create alias definitions, embed << {{{alias //newname// //"text to display"//}}} >> macros in a tiddler. These macros don't actually produce any visible output, but simply define the alias macros that you want to use in your document, and thus they can be safely added to practically any tiddler without producing a change in that tiddler's appearance.\n\nIn order to ensure that your aliases are defined and available for use throughout your document, you should add your definitions to a tiddler that you are certain will be displayed when your TW is first loaded, such as MainMenu or SiteTitle (or, any tiddler listed in DefaultTiddlers).\n<<<\n!!!!!Examples\n<<<\n<<alias>> {{{<<alias>>}}}\nmissing alias name: fail safe, do nothing\n\n<<alias alias1>> {{{<<alias alias1>>}}}\nmissing text params, default to text=name (e.g., "<<alias1>>")\n\n<<alias alias2 simple multi-word text substitution>> {{{<<alias alias2 simple multi-word text substitution>>}}}\n<<alias2>>\n\n<<alias "alias3 with spaces" "spaces in aliasname converted to _">> {{{<<alias "alias3 with spaces" "spaces in aliasname converted to _ ">>}}}\n<<alias3_with_spaces>>\n\n<<alias alias4 "multi-line \ntext\nsubstitution">> {{{<<alias alias4 "multi-line\ntext\nsubstitution">>}}}\n<<alias4>>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''AliasPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for this plugin^^\n<<<\n!!!!!Revision History\n<<<\n''2005.10.09 [1.0.3]''\ncombined documentation and code into a single tiddler\n''2005.08.12 [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//{{{\nversion.extensions.alias= {major: 1, minor: 0, revision: 3, date: new Date(2005,10,9)};\nconfig.macros.alias= { };\nconfig.macros.alias.handler = function(place,macroName,params) {\n var alias=params.shift(); if (!alias) return; alias=alias.replace(/ /g,"_"); // don't allow spaces in alias\n if (config.macros[alias]==undefined) // create new macro (as needed)\n { \n config.macros[alias] = { };\n config.macros[alias].handler =\n function (place,macroName,params)\n { wikify(config.macros[macroName].text,place,null,null); }\n }\n config.macros[alias].text = params[0]?params.join(' '):alias; // set alias text\n}\n//}}}\n
/***\n''Attach File Plugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#AttachFilePlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nStore binary files (such as jpg, gif, pdf or even mp3) directly in your TiddlyWiki document, and then use them as embedded images or links in your tiddlers. Let's you create truly self-contained documents!\n!!!!!Inline interface (live)\n<<<\n<<attach inline>>\n<<<\n!!!!!Usage\n<<<\n# select ''attach file'' sidebar menu\n# press "Browse..." on the attach file control panel\n# select a file from the system-specific 'file picker' dialog and press OK\n# MIME type //(see below)// is automatically selected based on the filename\n# optionally, change the suggested MIME type\n# optionally, enter tiddler tags to add to the attachment\n# press OK\n\nAn 'attachment tiddler' is created, using the filename of the attachment as it's title. The contents of this tidder includes a standard header with a clickable link to the attachment as well as an embedded image of the attachment (if applicable). Below the attachment header are the MIME type and "base64" declarations for the attached file, followed by a base64 text-encoded block of binary data.\n\nAlthough you can edit an attachment tiddler, ''don't change any of the encoded content below the attachment header'', as it has been prepared for use in the rest of your document, and even changing a single character can make it unusable by the browser. //If needed, you ''can'' edit the MIME type declaration in the attachment data, but be very careful not to change anything else, including punctuation!//\n<<<\n!!!!!Known Limitations\nNote: ''This feature does not currently work with Internet Explorer... sorry.''\n*''problem #1:'' while it is easy to read text files, reading binary files is not supported by IE's FileSystemObject (FSO) methods, and other file I/O techniques are subject to security barriers or require additional MS proprietary technologies (like ASP or VB) that make implementation more difficult.\n*''problem #2:'' IE does not support the data: URI scheme, and cannot render the embedded images or links. This would seem to be an insurmountable shortcoming in the browser. Let's hope it is added in the next version...\n!!!!!Example\n<<<\nTo embed attached files as images or link to them from other tiddlers, use the standard TiddlyWiki image syntax or //external// link syntax, substituting a tiddler attachment title in place of the filename or URL that is normally entered.\n# Attachment as an embedded image:^^\n[img[Meow|AttachFileSample]]^^\n# Attachment as an external link:^^\n[[click here to view attachment|AttachFileSample]]^^\n# Regular TiddlyWiki link to an attachment tiddler:^^\n[[AttachFileSample]]^^\n<<<\n!!!!!MIME Types\n<<<\nThe following ''[[MIME|http://en.wikipedia.org/wiki/MIME]]'' file types are automatically suggested (based on filename extension) when using the [[Attach File|AttachFileHelp]] plug-in:\n|>|!text|\n|^^TXT TEXT JS VBS ASP CGI PL^^|text/plain|\n|^^HTM HTML HTA HTX MHT^^|text/html|\n|^^CSV^^|text/comma-separated-values|\n|^^JS^^|text/javascript|\n|^^CSS^^|text/css|\n|^^XML XSL XSLT^^|text/xml|\n|>|!images|\n|^^GIF^^|image/gif|\n|^^JPG JPE JPEG^^|image/jpeg|\n|^^PNG^^|image/png|\n|^^BMP^^|image/bmp|\n|^^TIF TIFF^^|image/tiff|\n|>|!sounds|\n|^^AU SND^^|audio/basic|\n|^^WAV^^|audio/wav|\n|^^RA RM RAM^^|audio/x-pn-realaudio|\n|^^MID MIDI^^|audio/x-midi|\n|^^MP3^^|audio/mp3|\n|^^M3U^^|audio/m3u|\n|>|!video|\n|^^ASF^^|video/x-ms-asf|\n|^^AVI^^|video/avi|\n|^^MPG MPEG^^|video/mpeg|\n|^^QT MOV QTVR^^|video/quicktime|\n|>|!formatted documents|\n|^^PDF^^|application/pdf|\n|^^RTF^^|application/rtf|\n|^^AI EPS PS^^|application/postscript|\n|^^WPD^^|application/wordperfect|\n|^^WRI^^|application/mswrite|\n|^^XLS XLS3 XLS4 XLS5 XLW^^|application/msexcel|\n|^^DOC^^|application/msword|\n|^^PPT PPS^^|application/mspowerpoint|\n|^^SWA^^|application/x-director|\n|^^SWF^^|application/x-shockwave-flash|\n|>|!compressed storage/download|\n|^^ZIP^^|application/x-zip-compressed|\n|^^GZ^^|application/x-gzip|\n|^^RAR^^|application/x-rar-compressed|\n|>|!programs|\n|^^COM EXE DLL OCX^^|application/octet-stream|\n|>|!WAP enabled content|\n|^^WML^^|text/vnd.wap.wml|\n|^^WMLS^^|text/vnd.wap.wmlscript|\n|^^WBMP^^|image/vnd.wap.wbmp|\n|^^WMLC^^|application/vnd.wap.wmlc|\n|^^WMLSC^^|application/vnd.wap.wmlscriptc|\n<<<\n!!!!!Installation\n<<<\nImport (or copy/paste) the following tiddlers into your document:\n''AttachFilePlugin'' (tagged with <<tag systemConfig>>)\n''AttachFileSample'' //(sample attachment tiddler containing an image file)//\n\ncreate/edit ''SideBarOptions'': (sidebar menu items) \n^^Add {{{<<attach>>}}} macro^^\n<<<\n!!!!!Revision History\n<<<\n''2006.02.05 [3.0.1]''\nwrapped wikifier hijacks in initAttachmentFormatters() function to eliminate globals and avoid FireFox 1.5.0.1 crash bug when referencing globals\n''2005.12.27 [3.0.0]''\nUpdate for TW2.0\nAutomatically add 'excludeMissing' tag to attachments\n''2005.12.16 [2.2.0]''\nDynamically create/remove attachPanel as needed to ensure only one instance of interface elements exists, even if there are multiple instances of macro embedding.\n''2005.11.20 [2.1.0]''\nadded wikifier handler extensions for "image" and "prettyLink" to render tiddler attachments\n''2005.11.09 [2.0.0]''\nbegin port from old ELS Design plugin/adaptation hybrid based on ~TW1.2.33\n''2005.08.05 [1.1.0]''\nmoved CSS and HTML definitions into plugin code tiddler 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// // +++[version]\n//{{{\nversion.extensions.attach = {major: 3, minor: 0, revision: 1, date: new Date(2006,2,5)};\n//}}}\n// // ===\n\n// // +++[1.2.x compatibility]\n//{{{\nif (!window.story) window.story=window; // for v1.2.x\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\n// // +++[messages and macro definition]\n//{{{\nconfig.messages.attachmentLinkTooltip="Attachment: ";\nconfig.macros.attach = { label: "attach file", prompt: "Attach a file to this document" };\nconfig.macros.attach.handler = function(place,macroName,params) {\n if (params[0]!="inline")\n { createTiddlyButton(place,this.label,this.prompt,onClickAttachMenu); return; }\n createAttachPanel(place);\n document.getElementById("attachPanel").style.position="static";\n document.getElementById("attachPanel").style.display="block";\n}\n\nfunction createAttachPanel(place) {\n var panel=document.getElementById("attachPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n setStylesheet(config.macros.attach.css,"attachFile");\n panel=createTiddlyElement(place,"span","attachPanel",null,null)\n panel.innerHTML=config.macros.attach.html;\n var theList = document.getElementById("attachMIMEType");\n if (theList) for (var i=0;i<config.MIMETypes.length; i++)\n theList.options[i] = new Option(config.MIMETypes[i][1],config.MIMETypes[i][1],false,false);\n return panel;\n}\n\nfunction onClickAttachMenu(e)\n{\n if (!e) var e = window.event;\n var parent=resolveTarget(e).parentNode;\n var panel = document.getElementById("attachPanel");\n if (panel==undefined || panel.parentNode!=parent)\n panel=createAttachPanel(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\n// // +++[CSS for attach file control panel]\n//{{{\nconfig.macros.attach.css = '\s\n#attachPanel {\s\n display: none; position:absolute; z-index:10; width:35em; right:105%; top:0em;\s\n background-color: #eeeeee; color:#000000; 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;\s\n -moz-border-radius:1em;\s\n}\s\n#attachPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\s\n#attachPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\s\n#attachPanel .btn { width:auto; }\s\n#attachPanel .btn1 { width:98%; }\s\n#attachPanel .btn2 { width:48%; }\s\n#attachPanel .btn3 { width:32%; }\s\n#attachPanel .btn4 { width:24%; }\s\n#attachPanel .btn5 { width:19%; }\s\n';\n//}}}\n// // ===\n\n// // +++[HTML for attach file control panel]\n//{{{\nconfig.macros.attach.html = '\s\nattach from source file:\s\n<input type="file" id="attachSource" size=56 onChange="onChangeAttachSource()">\s\nsource file type:\s\n<select size=1 id="attachMIMEType"></select>\s\nadd tags:\s\n<input type=text id="attachTags" size=15 autocomplete=off>\s\n<div style="text-align:center">\s\n <input type=button style="width:30%" value="ok" onclick="onClickAttachOK()">\s\n <input type=button style="width:30%" value="cancel" onclick="onClickAttachCancel()">\s\n</div>\s\n';\n//}}}\n// // ===\n\n// // +++[wikifiers for rendering attachments as images or links]\n//{{{\ninitAttachmentFormatters();\nfunction initAttachmentFormatters() {\n // find the formatter for "image" and replace the handler\n for (var i=0; i<config.formatters.length && config.formatters[i].name!="image"; 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) // Simple bracketted link\n {\n var e = w.output;\n if(lookaheadMatch[5])\n {\n if(store.tiddlerExists(lookaheadMatch[5]))\n e = createTiddlyLink(w.output,lookaheadMatch[5],false);\n else\n e = createExternalLink(w.output,lookaheadMatch[5]);\n }\n var img = createTiddlyElement(e,"img");\n if(lookaheadMatch[1])\n img.align = "left";\n else if(lookaheadMatch[2])\n img.align = "right";\n if(lookaheadMatch[3])\n img.title = lookaheadMatch[3];\n img.src = lookaheadMatch[4];\n // ELS: ADDED\n if (isAttachment(lookaheadMatch[4])) img.src=getAttachment(lookaheadMatch[4]);\n // ELS: END\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n\n // find the formatter for "prettyLink" and replace the handler\n for (var i=0; i<config.formatters.length && config.formatters[i].name!="prettyLink"; 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 && lookaheadMatch[2])\n { // Simple bracketted link\n var link = createTiddlyLink(w.output,lookaheadMatch[1],false);\n w.outputText(link,w.nextMatch,w.nextMatch + lookaheadMatch[1].length);\n w.nextMatch += lookaheadMatch[1].length + 2;\n }\n else if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[3])\n { // Pretty bracketted link\n var e;\n if(store.tiddlerExists(lookaheadMatch[4]))\n // ELS: ADDED\n if (isAttachment(lookaheadMatch[4]))\n {\n e = createExternalLink(w.output,lookaheadMatch[4]);\n e.href=getAttachment(lookaheadMatch[4]);\n e.title = config.messages.attachmentLinkTooltip + lookaheadMatch[4];\n }\n else\n // ELS: END\n e = createTiddlyLink(w.output,lookaheadMatch[4],false);\n else\n e = createExternalLink(w.output,lookaheadMatch[4]);\n w.outputText(e,w.nextMatch,w.nextMatch + lookaheadMatch[1].length);\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n}\n//}}}\n// // ===\n\n// // +++[Utility API]\n//{{{\nfunction isAttachment(title)\n{\n var tiddler = store.getTiddler(title);\n if (tiddler==undefined || tiddler.tags==undefined) return false;\n return (tiddler.tags.find("attachment")!=null);\n}\n\nfunction getAttachment(title)\n{\n var theData = store.getTiddlerText(title);\n // remove header and embedded newlines from attachment text\n return "data:"+(theData.split('\sn----\sn'))[1].replace(/\s\sn/,'');\n}\n//}}}\n// // ===\n\n// // +++[explict global scoping for IE]\n//{{{\n// for functions/vars called from browser events\nwindow.onChangeAttachSource=onChangeAttachSource;\nwindow.onClickAttachCancel=onClickAttachCancel;\nwindow.onClickAttachOK=onClickAttachOK;\nwindow.isAttachment=isAttachment;\nwindow.getAttachment=getAttachment;\n//}}}\n// // ===\n\n// // +++[MIME Types]\n//{{{\nconfig.MIMETypes = [\n [" ", ""],\n [" txt text js vbs asp cgi pl ","text/plain"],\n [" htm html hta htx mht ", "text/html"],\n [" csv ", "text/comma-separated-values"],\n [" js ", "text/javascript"],\n [" css ", "text/css"],\n [" xml xsl xslt ", "text/xml"],\n [" ", ""],\n [" gif ", "image/gif"],\n [" jpg jpe jpeg ", "image/jpeg"],\n [" png ", "image/png"],\n [" bmp ", "image/bmp"],\n [" tif tiff ", "image/tiff"],\n [" ", ""],\n [" au snd ", "audio/basic"],\n [" wav ", "audio/wav"],\n [" ra rm ram ", "audio/x-pn-realaudio"],\n [" mid midi ", "audio/x-midi"],\n [" mp3 ", "audio/mp3"],\n [" m3u ", "audio/m3u"],\n [" ", ""],\n [" asf ", "video/x-ms-asf"],\n [" avi ", "video/avi"],\n [" mpg mpeg ", "video/mpeg"],\n [" qt mov qtvr ", "video/quicktime"],\n [" ", ""],\n [" pdf ", "application/pdf"],\n [" rtf ", "application/rtf"],\n [" ai eps ps ", "application/postscript"],\n [" ", ""],\n [" wpd ", "application/wordperfect"],\n [" wri ", "application/mswrite"],\n [" xls xls3 xls4 xls5 xlw ", "application/msexcel"],\n [" doc ", "application/msword"],\n [" ppt pps ", "application/mspowerpoint"],\n [" swa ", "application/x-director"],\n [" swf ", "application/x-shockwave-flash"],\n [" ", ""],\n [" zip ", "application/x-zip-compressed"],\n [" gz ", "application/x-gzip"],\n [" rar ", "application/x-rar-compressed"],\n [" com exe dll ocx ", "application/octet-stream"],\n [" ", ""],\n [" wml ", "text/vnd.wap.wml"],\n [" wmls ", "text/vnd.wap.wmlscript"],\n [" wbmp ", "image/vnd.wap.wbmp"],\n [" wmlc ", "application/vnd.wap.wmlc"],\n [" wmlsc ", "application/vnd.wap.wmlscriptc"]];\n//}}}\n// // ===\n\n// // +++[control panel interaction]\n//{{{\nfunction onChangeAttachSource()\n{\n var theFilename = document.getElementById("attachSource").value;\n var theExtension = theFilename.substr(theFilename.lastIndexOf('.')+1).toLowerCase();\n for (var i=0; i<config.MIMETypes.length; i++)\n if (config.MIMETypes[i][0].indexOf(theExtension)!=-1)\n {\n document.getElementById("attachMIMEType").value = config.MIMETypes[i][1];\n document.getElementById("attachMIMEType").selectedIndex = i;\n break;\n }\n}\n\nfunction onClickAttachCancel()\n{\n document.getElementById("attachPanel").style.display="none";\n}\n\nfunction onClickAttachOK()\n{\n var theSource = document.getElementById("attachSource").value;\n var theTags = "attachment excludeMissing "+document.getElementById("attachTags").value;\n var theMIMEType = document.getElementById("attachMIMEType").value;\n if (theMIMEType=="") return;\n var theData = loadBinaryFile(theSource); if (!theData) return;\n var theEncoded = encodeBase64(theData);\n var theTiddler = new Tiddler();\n var theTitle = theSource.replace(/\s\s/g,"/");\n var theTitle = theTitle.substr(theTitle.lastIndexOf('/')+1);\n var theText = "";\n if (theMIMEType.substr(0,5)=="image") theText+='[img['+theTitle+'|'+theTitle+']]\sn';\n theText += 'attachment: [['+theTitle+'|'+theTitle+']]\sn';\n theText += 'original size: '+theData.length+' bytes, encoded size: '+theEncoded.length+' bytes\sn';\n theText += '//{{{\sn';\n theText += '\sn----\sn';\n theText += theMIMEType + ";base64,\sn" + theEncoded;\n theText += '\sn----\sn';\n theText += '\sn//}}}\sn';\n theTiddler.set(theTitle,theText,config.options.txtUserName,new Date(),theTags);\n store.addTiddler(theTiddler);\n store.setDirty(true)\n clearMessage(); displayMessage('Attached '+theTitle);\n document.getElementById("attachPanel").style.display="none";\n story.displayTiddler(null,theTiddler.title,1,null,null,false);\n store.notifyAll();\n}\n//}}}\n// // ===\n\n// // +++[Binary to text encoding]\n//{{{\nfunction encodeBase64(theData)\n{\n if (!theData) return null;\n // encode as base64\n var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";\n var out = ""; //This is the output\n var chr1, chr2, chr3 = ""; //These are the 3 bytes to be encoded\n var enc1, enc2, enc3, enc4 = ""; //These are the 4 encoded bytes\n for (var count=0,i=0; i<theData.length; )\n {\n chr1 = theData.charCodeAt(i++); //Grab the first byte\n chr2 = theData.charCodeAt(i++); //Grab the second byte\n chr3 = theData.charCodeAt(i++); //Grab the third byte\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n if (isNaN(chr2))\n enc3 = enc4 = 64;\n else if (isNaN(chr3))\n enc4 = 64;\n out += keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);\n chr1 = chr2 = chr3 = "";\n enc1 = enc2 = enc3 = enc4 = "";\n count+=4; if (count>60) { out+='\sn'; count=0; } // add line break every 60 chars for readability\n }\n return out;\n}\n//}}}\n// // ===\n\n// // +++[Binary File I/O]\n//{{{\nfunction loadBinaryFile(fileUrl)\n{\n var r = mozillaLoadBinaryFile(fileUrl);\n if((r == null) || (r == false))\n r = ieLoadBinaryFile(fileUrl);\n return(r);\n}\n\nfunction mozillaLoadBinaryFile(filePath)\n{\n if(window.Components)\n try \n {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\n file.initWithPath(filePath);\n if (!file.exists())\n return(null);\n var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);\n inputStream.init(file, 0x01, 00004, null);\n var bInputStream = Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);\n bInputStream.setInputStream(inputStream);\n return(bInputStream.readBytes(inputStream.available()));\n }\n catch(e)\n {\n alert("Exception while attempting to attach\sn\sn" + e);\n return(false);\n }\n return(null);\n}\n\nfunction ieLoadBinaryFile(filePath)\n{\n // TBD: load BINARY, not TEXT file\n // return(ieLoadFile(filePath));\n // alert("ieLoadBinaryFile(): not yet implemented...sorry");\n // return(null);\n try\n {\n var stream = new ActiveXObject("ADODB.Stream");\n }\n catch(e)\n {\n alert("Exception while attempting to attach\sn\sn" + e.toString());\n return(null);\n }\n stream.Type = 'adTypeBinary';\n stream.Open();\n stream.LoadFromFile(filePath);\n var content = stream.Read();\n stream.Close();\n return(content);\n\n}\n//}}}\n// // ===\n
/***\n''AutoSync Plugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#AutoSyncPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nLive Publishing! "Simul-cast" changes in your document by ''automatically submitting tiddler data to a web server'' whenever you complete editing of a tiddler. AutoSyncPlugin requires installation of compatible server-side scripting to transmit, receive and store the updated tiddler data on the server. The plugin can be configured for use with different server-side scripts by setting the contents of specially-named tiddlers to match your web server ([[SiteHost]]) and script location ([[SitePost]]), as well as provide any flags, keywords, etc. ([[SiteParams]]) that may be required by the server-side scripting.\n\nSee //Usage// below for more information.\n\n!!!!!Configuration\n<<<\n<<option chkAutoSync>> incrementally auto-post tiddler changes to remote server\n<<option chkAutoSyncConfirm>> confirm before posting each change\n<script>\nvar t="SiteHost";\nconfig.options.txtSiteHost=store.getTiddlerText(t);\nif (!config.options.txtSiteHost) config.options.txtSiteHost=t;\nvar t="SitePost";\nconfig.options.txtSitePost=store.getTiddlerText(t);\nif (!config.options.txtSitePost) config.options.txtSitePost=t;\nvar t="SiteParams";\nconfig.options.txtSiteParams=store.getTiddlerText(t);\nif (!config.options.txtSiteParams) config.options.txtSiteParams=t;\n</script>\nSiteHost\n<<option txtSiteHost>><script>var s=place.lastChild.style;s.width="100%"</script>\nSitePost\n<<option txtSitePost>><script>var s=place.lastChild.style;s.width="100%"</script>\nSiteParams\n<<option txtSiteParams>><script>var s=place.lastChild.style;s.width="100%"</script>\n<<<\n!!!!!Usage\n<<<\nThe following "special tiddlers" are used by this plugin to assemble the URL to the remote server.\n* SiteHost\nhost name/address for remote server\nexample: {{{www.server.com}}} or {{{192.168.1.1}}}\n* SitePost\nremote path/filename for submitting changes\nexample: {{{/cgi-bin/submit.cgi}}}\n* SiteParams\nextra arguments (if any) needed for server-side receiving script.\nexample: {{{id=jsmith@server.com}}}\n\nIn addition to the above URL pieces, the constructed URL automatically incorporates parameters for title, modifier, modified, tags, and, of course, the data itself. When fully assembled, the resulting URL will be something like:\n{{{http://192.168.1.1/cgi-bin/submit.cgi\n?title=TiddlerTitle\n&modifier=YourName\n&modified=2005.12.07\n&tags=whatever\n&id=jsmith@server.com\n&data=...}}}\n\n<<<\n!!!!!Installation\n<<<\nImport (or copy/paste) the following tiddlers into your document:\n''AutoSyncPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2005.12.04 [0.0.5]''^^\ninitial BETA release\n^^\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\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//{{{\n\nif (config.options.chkAutoSync==undefined)\n config.options.chkAutoSync=false;\nif (config.options.chkAutoSyncConfirm==undefined)\n config.options.chkAutoSyncConfirm=true;\n\nstore.autoSync_SaveTiddler=store.saveTiddler;\nstore.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags) {\n\n // call the core TW function\n var result = store.autoSync_SaveTiddler(title,newTitle,newBody,modifier,modified,tags);\n var tiddler=store.getTiddler(newTitle);\n if (!config.options.chkAutoSync) return result;\n\n // PROTOCOL\n var theProtocol="http:";\n // HOST\n var theHost=store.getTiddlerText("SiteHost");\n if (!theHost || !theHost.length) theHost=document.location.host;\n if (!theHost || !theHost.length) theHost="SiteHost";\n // POST\n var thePost=store.getTiddlerText("SitePost");\n if (!thePost || !thePost.length) thePost="/SitePost";\n // PARAMS\n var theParams = "title="+encodeURIComponent(newTitle);\n theParams += "&modifier="+encodeURIComponent(modifier);\n theParams += "&modified="+encodeURIComponent(modified);\n theParams += "&tags="+encodeURIComponent(tiddler.getTags());\n // EXTRA PARAMS\n var theExtraParams="";\n var t=store.getTiddlerText("SiteParams"); if (t && t.length) theExtraParams = "&"+t;\n // DATA\n var theData = "&data="+encodeURIComponent(tiddler.saveToDiv());\n // construct URL\n var theURL=theProtocol+"//"+theHost+thePost+"?"+theParams+theExtraParams+theData\n // CONFIRM\n var OK=!config.options.chkAutoSyncConfirm;\n if (!OK) {\n // confirmation message\n var msg="Is it OK to send '"+newTitle+"' to "+theProtocol+"//"+theHost+thePost+"\sn";\n msg += "size: "+theData.length+" bytes\sn";\n msg += "modifier: "+modifier+"\sn";\n msg += "modified: "+modified+"\sn";\n msg += "tags: "+tiddler.getTags()+"\sn";\n msg += "extra parameters: "+(theExtraParams.length?theExtraParams:"(none)")+"\sn";\n OK = confirm(msg);\n }\n if (!OK) return;\n\n // create fresh hidden FRAME\n var f=document.getElementById("autoSyncFrame");\n if (f) document.body.removeChild(f);\n f=document.createElement("iframe"); f.id="autoSyncFrame";\n f.style.width="0px"; f.style.height="0px"; f.style.border="0px";\n document.body.appendChild(f);\n\n // load the FRAME to submit the URL to the server\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.location.replace(theURL);\n}\n//}}}\n
/***\n''Auto Tagger Plugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#AutoTaggerPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nAutomatically tag tiddlers with their original creation date and author and optionally scan the tiddler content for any tags that are embedded as text. Makes cross-referencing your tiddlers a snap!\n\n!!!!!Usage\n<<<\nWhen ~AutoTagger is present, it automatically ''generates 'creation date' and 'creator' tag values'' for all newly created tiddlers, so that this information is retained even after a tiddler has been updated many times. In addition, if you enter ''//auto//'' as a tiddler tag value, ~AutoTagger ''scans the tiddler content'' (including title) for all existing tags, and ''automatically adds any embedded tags that it finds''.\n\nAfter they have been added to the tiddler, the new tags are treated just as if you had entered them by hand and can be edited to make any changes you want. Of course, as long as the "auto" tag is still present on a tiddler, ~AutoTagger will re-scan that tiddler's content each time it is edited. If you DO edit the generated tags, you can remove the "auto" tag from the tiddler to prevent it from being re-scanned when you press 'done' to finish editing.\n\n//Note: the special-purpose ''"systemConfig" and "systemTiddler" tags are not added automatically, even if matched in the tiddler content'', since these tags should be added manually to ensure they are always used appropriately)//\n\n//Note: if you have set the "auto" tag on a tiddler, and then add several tags to your document, those tags will ''not'' be automatically added to the tiddler until you actually edit that tiddler and press 'done' to trigger an AutoTagger scan.//\n<<<\n!!!!!Configuration\n<<<\nThe ~AutoTagger plugin comes with a ''self-contained control panel''. Use these controls to enable or disable automatic 'creation date' or 'creator' tagging, modify the default date formatting, or redefine the special 'scan trigger' tag value (so you can use "auto" as a normal tag value in your document).\n\n<<option chkAutoTagAuthor>> add 'created by' tag //(when a tiddler is first created)//\n<<option chkAutoTagDate>> add 'creation date' tag, using date format: <<option txtAutoTagFormat>>\n<<option chkAutoTagEditor>> add 'edited by' tag //(when a tiddler is updated)//\nscan tiddler content for new tags when tagged with: <<option txtAutoTagTrigger>>\n----\n//date formatting syntax://\n^^//''DDD'' - day of week in full (eg, "Monday"), ''DD'' - day of month, ''0DD'' - adds leading zero//^^\n^^//''MMM'' - month in full (eg, "July"), ''MM'' - month number, ''0MM'' - adds leading zero//^^\n^^//''YYYY'' - full year, ''YY'' - two digit year//^^\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''AutoTaggerPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2005.10.09 [1.3.0]''\nAdded 'edited by' tagging\nCombined documentation and code into a single tiddler\n''2005.08.16 [1.2.0]''\nAdded optional scanning for tags in tiddler content (based on suggestion from Jacques Turbé)\n''2005.08.15 [1.1.0]''\nAdded 'created by' tag generation (based on suggestion from Elise Springer)\nRenamed from DateTag to AutoTagger\n''2005.08.15 [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// // 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//{{{\nversion.extensions.autoTagger = {major: 1, minor: 3, revision: 0, date: new Date(2005,10,9)};\n\nif (config.options.chkAutoTagDate==undefined)\n config.options.chkAutoTagDate=false;\nif (config.options.chkAutoTagEditor==undefined)\n config.options.chkAutoTagEditor=false;\nif (config.options.chkAutoTagAuthor==undefined)\n config.options.chkAutoTagAuthor=false;\nif (config.options.txtAutoTagTrigger==undefined)\n config.options.txtAutoTagTrigger="auto";\nif (config.options.txtAutoTagFormat==undefined)\n config.options.txtAutoTagFormat="YYYY.0MM.0DD";\n\n// hijack store.saveTiddler()\nstore.coreSaveTiddler = store.saveTiddler;\nstore.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags)\n{\n // get the tags as passed from the tiddler editor\n var newTags = [];\n if (tags) newTags = (typeof tags == "string") ? tags.readBracketedList() : tags;\n\n // if saving a new tiddler, add 'creation date' tag\n if (config.options.chkAutoTagDate && (store.getTiddler(title)==undefined))\n newTags.pushUnique(new Date().formatString(config.options.txtAutoTagFormat));\n // if saving a new tiddler, add 'created by' tag\n if (config.options.chkAutoTagAuthor && (store.getTiddler(title)==undefined))\n newTags.pushUnique(config.options.txtUserName);\n // if saving an existing tiddler, add 'edited by' tag\n if (config.options.chkAutoTagEditor && (store.getTiddler(title)))\n newTags.pushUnique(config.options.txtUserName);\n\n // if tagged for scanning, find tags embedded in text of tiddler title/body\n var allTags = store.getTags();\n if ((config.options.txtAutoTagTrigger!="") && (newTags.find(config.options.txtAutoTagTrigger)!=null))\n for (var t=0; t<allTags.length; t++)\n {\n // note: don't automatically tag a tiddler with 'systemConfig' or 'systemTiddler'\n if ((allTags[t][0]=='systemConfig') || (allTags[t][0]=='systemTiddler'))\n continue;\n if ((newBody.indexOf(allTags[t][0])!=-1) || (newTitle.indexOf(allTags[t][0])!=-1))\n newTags.pushUnique(allTags[t][0]);\n }\n\n // pass it all on to the core TW to be saved in the data store.\n return store.coreSaveTiddler(title,newTitle,newBody,modifier,modified,newTags);\n}\n//}}}
/***\nBreadcrumbsPlugin\nauthor: Alan Hecht (with 2.0 update from 'jack' and revisions by Bram Chen)\nsource: http://groups.google.com/group/TiddlyWikiDev/msg/c23edb5f3c0d8b7e\n***/\n//{{{\nversion.extensions.breadCrumbs = {major: 1, minor: 0, revision: 1,\ndate: new Date("Feb 4, 2006")};\nconfig.breadCrumbs = [];\n\nwindow.onClickTiddlerLink_orig_breadCrumbs = window.onClickTiddlerLink;\nwindow.onClickTiddlerLink = function(e){\n window.onClickTiddlerLink_orig_breadCrumbs(e);\n addCrumb(e);\n\n}\n\nfunction addCrumb(e){\n if (!e) var e = window.event;\n var thisCrumb = "[[" + resolveTarget(e).getAttribute("tiddlyLink") + "]]";\n var ind = config.breadCrumbs.find(thisCrumb);\n if(ind == null)\n config.breadCrumbs.push(thisCrumb);\n else\n config.breadCrumbs.length = ind++;\n refreshCrumbs();\n\n}\n\nfunction refreshCrumbs(){\n var crumbArea = document.getElementById("breadCrumbs");\n if (!crumbArea) {\n var crumbArea = document.createElement("div");\n crumbArea.id = "breadCrumbs";\n crumbArea.style.visibility= "hidden";\n var targetArea = document.getElementById("tiddlerDisplay");\n targetArea.parentNode.insertBefore(crumbArea,targetArea);\n }\n crumbArea.style.visibility = "visible";\n removeChildren(crumbArea);\n createTiddlyButton(crumbArea,"Home",null,restartHome);\n wikify(" || " + config.breadCrumbs.join(' > '),crumbArea)\n\n}\n\nfunction restartHome(){\n story.closeAllTiddlers();\n restart();\n config.breadCrumbs = [];\n var crumbArea = document.getElementById("breadCrumbs");\n crumbArea.style.visibility = "hidden";\n}\n//}}}
// // override cookie settings for CalendarPlugin:\n//{{{\nconfig.options.txtCalFirstDay=6;\nconfig.options.txtCalStartOfWeekend=5;\n//}}}
/***\n''Name:'' Calendar plugin\n''Version:'' <<getversion calendar>> (<<getversiondate calendar "DD MMM YYYY">>)\n''Author:'' SteveRumsby\n\n// // updated by Jeremy Sheeley to add cacheing for reminders\n// // see http://www.geocities.com/allredfaq/reminderMacros.html\n\n''Configuration:''\n\n|''First day of week:''|<<option txtCalFirstDay>>|(Monday = 0, Sunday = 6)|\n|''First day of weekend:''|<<option txtCalStartOfWeekend>>|(Monday = 0, Sunday = 6)|\n\n''Syntax:'' \n|{{{<<calendar>>}}}|Produce a full-year calendar for the current year|\n|{{{<<calendar year>>}}}|Produce a full-year calendar for the given year|\n|{{{<<calendar year month>>}}}|Produce a one-month calendar for the given month and year|\n|{{{<<calendar thismonth>>}}}|Produce a one-month calendar for the current month|\n|{{{<<calendar lastmonth>>}}}|Produce a one-month calendar for last month|\n|{{{<<calendar nextmonth>>}}}|Produce a one-month calendar for next month|\n\n***/\n// //Modify this section to change the text displayed for the month and day names, to a different language for example. You can also change the format of the tiddler names linked to from each date, and the colours used.\n\n// // ''Changes by ELS 2005.10.30:''\n// // config.macros.calendar.handler()\n// // ^^use "tbody" element for IE compatibility^^\n// // ^^IE returns 2005 for current year, FF returns 105... fix year adjustment accordingly^^\n// // createCalendarDays()\n// // ^^use showDate() function (if defined) to render autostyled date with linked popup^^\n// // calendar stylesheet definition\n// // ^^use .calendar class-specific selectors, add text centering and margin settings^^\n\n//{{{\nconfig.macros.calendar = {};\n\nconfig.macros.calendar.monthnames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];\nconfig.macros.calendar.daynames = ["M", "T", "W", "T", "F", "S", "S"];\n\nconfig.macros.calendar.weekendbg = "#c0c0c0";\nconfig.macros.calendar.monthbg = "#e0e0e0";\nconfig.macros.calendar.holidaybg = "#ffc0c0";\n\n//}}}\n// //''Code section:''\n// (you should not need to alter anything below here)//\n//{{{\nif(config.options.txtCalFirstDay == undefined)\n config.options.txtCalFirstDay = 0;\nif(config.options.txtCalStartOfWeekend == undefined)\n config.options.txtCalStartOfWeekend = 5;\n\nconfig.macros.calendar.tiddlerformat = "0DD/0MM/YYYY"; // This used to be changeable - for now, it isn't// <<smiley :-(>> \n\nversion.extensions.calendar = { major: 0, minor: 6, revision: 0, date: new Date(2006, 1, 22)};\nconfig.macros.calendar.monthdays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\nconfig.macros.calendar.holidays = [ ]; // Not sure this is required anymore - use reminders instead\n//}}}\n\n// //Is the given date a holiday?\n//{{{\nfunction calendarIsHoliday(date)\n{\n var longHoliday = date.formatString("0DD/0MM/YYYY");\n var shortHoliday = date.formatString("0DD/0MM");\n\n for(var i = 0; i < config.macros.calendar.holidays.length; i++) {\n if(config.macros.calendar.holidays[i] == longHoliday || config.macros.calendar.holidays[i] == shortHoliday) {\n return true;\n }\n }\n return false;\n}\n//}}}\n\n// //The main entry point - the macro handler.\n// //Decide what sort of calendar we are creating (month or year, and which month or year)\n// // Create the main calendar container and pass that to sub-ordinate functions to create the structure.\n// ELS 2005.10.30: added creation and use of "tbody" for IE compatibility and fixup for year >1900//\n// ELS 2005.10.30: fix year calculation for IE's getYear() function (which returns '2005' instead of '105')//\n//{{{\nconfig.macros.calendar.handler = function(place,macroName,params)\n{\n var calendar = createTiddlyElement(place, "table", null, "calendar", null);\n var tbody = createTiddlyElement(calendar, "tbody", null, null, null);\n var today = new Date();\n var year = today.getYear();\n if (year<1900) year+=1900;\n if (params[0] == "thismonth")\n {\n cacheReminders(new Date(year, today.getMonth(), 1, 0, 0), 31);\n createCalendarOneMonth(tbody, year, today.getMonth());\n } \n else if (params[0] == "lastmonth") {\n var month = today.getMonth()-1; if (month==-1) { month=11; year--; }\n cacheReminders(new Date(year, month, 1, 0, 0), 31);\n createCalendarOneMonth(tbody, year, month);\n }\n else if (params[0] == "nextmonth") {\n var month = today.getMonth()+1; if (month>11) { month=0; year++; }\n cacheReminders(new Date(year, month, 1, 0, 0), 31);\n createCalendarOneMonth(tbody, year, month);\n }\n else {\n if (params[0]) year = params[0];\n if(params[1])\n {\n cacheReminders(new Date(year, params[1]-1, 1, 0, 0), 31);\n createCalendarOneMonth(tbody, year, params[1]-1);\n }\n else\n {\n cacheReminders(new Date(year, 0, 1, 0, 0), 366);\n createCalendarYear(tbody, year);\n }\n }\n window.reminderCacheForCalendar = null;\n}\n//}}}\n//{{{\n//This global variable is used to store reminders that have been cached\n//while the calendar is being rendered. It will be renulled after the calendar is fully rendered.\nwindow.reminderCacheForCalendar = null;\n//}}}\n//{{{\nfunction cacheReminders(date, leadtime)\n{\n if (window.findTiddlersWithReminders == null)\n return;\n window.reminderCacheForCalendar = {};\n var leadtimeHash = [];\n leadtimeHash [0] = 0;\n leadtimeHash [1] = leadtime;\n var t = findTiddlersWithReminders(date, leadtimeHash, null, 1);\n for(var i = 0; i < t.length; i++) {\n //just tag it in the cache, so that when we're drawing days, we can bold this one.\n window.reminderCacheForCalendar[t[i]["matchedDate"]] = "reminder:" + t[i]["params"]["title"]; \n }\n}\n//}}}\n//{{{\nfunction createCalendarOneMonth(calendar, year, mon)\n{\n var row = createTiddlyElement(calendar, "tr", null, null, null);\n createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon] + " " + year, true, year, mon);\n row = createTiddlyElement(calendar, "tr", null, null, null);\n createCalendarDayHeader(row, 1);\n createCalendarDayRowsSingle(calendar, year, mon);\n}\n//}}}\n\n//{{{\nfunction createCalendarMonth(calendar, year, mon)\n{\n var row = createTiddlyElement(calendar, "tr", null, null, null);\n createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon] + " " + year, false, year, mon);\n row = createTiddlyElement(calendar, "tr", null, null, null);\n createCalendarDayHeader(row, 1);\n createCalendarDayRowsSingle(calendar, year, mon);\n}\n//}}}\n\n//{{{\nfunction createCalendarYear(calendar, year)\n{\n var row;\n row = createTiddlyElement(calendar, "tr", null, null, null);\n var back = createTiddlyElement(row, "td", null, null, null);\n var backHandler = function() {\n removeChildren(calendar);\n createCalendarYear(calendar, year-1);\n };\n createTiddlyButton(back, "<", "Previous year", backHandler);\n back.align = "center";\n\n var yearHeader = createTiddlyElement(row, "td", null, "calendarYear", year);\n yearHeader.align = "center";\n yearHeader.setAttribute("colSpan", 19);\n\n var fwd = createTiddlyElement(row, "td", null, null, null);\n var fwdHandler = function() {\n removeChildren(calendar);\n createCalendarYear(calendar, year+1);\n };\n createTiddlyButton(fwd, ">", "Next year", fwdHandler);\n fwd.align = "center";\n\n createCalendarMonthRow(calendar, year, 0);\n createCalendarMonthRow(calendar, year, 3);\n createCalendarMonthRow(calendar, year, 6);\n createCalendarMonthRow(calendar, year, 9);\n}\n//}}}\n\n//{{{\nfunction createCalendarMonthRow(cal, year, mon)\n{\n var row = createTiddlyElement(cal, "tr", null, null, null);\n createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon], false, year, mon);\n createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+1], false, year, mon);\n createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+2], false, year, mon);\n row = createTiddlyElement(cal, "tr", null, null, null);\n createCalendarDayHeader(row, 3);\n createCalendarDayRows(cal, year, mon);\n}\n//}}}\n\n//{{{\nfunction createCalendarMonthHeader(cal, row, name, nav, year, mon)\n{\n var month;\n if(nav) {\n var back = createTiddlyElement(row, "td", null, null, null);\n back.align = "center";\n back.style.background = config.macros.calendar.monthbg;\n\n/*\n back.setAttribute("colSpan", 2);\n\n var backYearHandler = function() {\n var newyear = year-1;\n removeChildren(cal);\n cacheReminders(new Date(newyear, mon , 1, 0, 0), 31);\n createCalendarOneMonth(cal, newyear, mon);\n };\n createTiddlyButton(back, "<<", "Previous year", backYearHandler);\n*/\n var backMonHandler = function() {\n var newyear = year;\n var newmon = mon-1;\n if(newmon == -1) { newmon = 11; newyear = newyear-1;}\n removeChildren(cal);\n cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);\n createCalendarOneMonth(cal, newyear, newmon);\n };\n createTiddlyButton(back, "<", "Previous month", backMonHandler);\n\n\n month = createTiddlyElement(row, "td", null, "calendarMonthname", name)\n// month.setAttribute("colSpan", 3);\n month.setAttribute("colSpan", 5);\n\n var fwd = createTiddlyElement(row, "td", null, null, null);\n fwd.align = "center";\n fwd.style.background = config.macros.calendar.monthbg; \n\n// fwd.setAttribute("colSpan", 2);\n var fwdMonHandler = function() {\n var newyear = year;\n var newmon = mon+1;\n if(newmon == 12) { newmon = 0; newyear = newyear+1;}\n removeChildren(cal);\n cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);\n createCalendarOneMonth(cal, newyear, newmon);\n };\n createTiddlyButton(fwd, ">", "Next month", fwdMonHandler);\n/*\n var fwdYear = createTiddlyElement(row, "td", null, null, null);\n var fwdYearHandler = function() {\n var newyear = year+1;\n removeChildren(cal);\n cacheReminders(new Date(newyear, mon , 1, 0, 0), 31);\n createCalendarOneMonth(cal, newyear, mon);\n };\n createTiddlyButton(fwd, ">>", "Next year", fwdYearHandler);\n*/\n } else {\n month = createTiddlyElement(row, "td", null, "calendarMonthname", name)\n month.setAttribute("colSpan", 7);\n }\n month.align = "center";\n month.style.background = config.macros.calendar.monthbg;\n}\n//}}}\n\n//{{{\nfunction createCalendarDayHeader(row, num)\n{\n var cell;\n for(var i = 0; i < num; i++) {\n for(var j = 0; j < 7; j++) {\n var d = j + (config.options.txtCalFirstDay - 0);\n if(d > 6) d = d - 7;\n cell = createTiddlyElement(row, "td", null, null, config.macros.calendar.daynames[d]);\n\n if(d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))\n cell.style.background = config.macros.calendar.weekendbg;\n }\n }\n}\n//}}}\n\n//{{{\nfunction createCalendarDays(row, col, first, max, year, mon)\n{\n var i;\n for(i = 0; i < col; i++) {\n createTiddlyElement(row, "td", null, null, null);\n }\n var day = first;\n for(i = col; i < 7; i++) {\n var d = i + (config.options.txtCalFirstDay - 0);\n if(d > 6) d = d - 7;\n var daycell = createTiddlyElement(row, "td", null, null, null);\n var isaWeekend = ((d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))? true:false);\n\n if(day > 0 && day <= max) {\n var celldate = new Date(year, mon, day);\n // ELS 2005.10.30: use <<date>> macro's showDate() function to create popup\n if (window.showDate) {\n showDate(daycell,celldate,"popup","DD","DD-MMM-YYYY",true, isaWeekend); \n } else {\n if(isaWeekend) daycell.style.background = config.macros.calendar.weekendbg;\n var title = celldate.formatString(config.macros.calendar.tiddlerformat);\n if(calendarIsHoliday(celldate)) {\n daycell.style.background = config.macros.calendar.holidaybg;\n }\n if(window.findTiddlersWithReminders == null) {\n var link = createTiddlyLink(daycell, title, false);\n link.appendChild(document.createTextNode(day));\n } else {\n var button = createTiddlyButton(daycell, day, title, onClickCalendarDate);\n }\n }\n }\n day++;\n }\n}\n//}}}\n\n// //We've clicked on a day in a calendar - create a suitable pop-up of options.\n// //The pop-up should contain:\n// // * a link to create a new entry for that date\n// // * a link to create a new reminder for that date\n// // * an <hr>\n// // * the list of reminders for that date\n//{{{\nfunction onClickCalendarDate(e)\n{\n var button = this;\n var date = button.getAttribute("title");\n var dat = new Date(date.substr(6,4), date.substr(3,2)-1, date.substr(0, 2));\n\n date = dat.formatString(config.macros.calendar.tiddlerformat);\n var popup = createTiddlerPopup(this);\n popup.appendChild(document.createTextNode(date));\n var newReminder = function() {\n var t = store.getTiddlers(date);\n displayTiddler(null, date, 2, null, null, false, false);\n if(t) {\n document.getElementById("editorBody" + date).value += "\sn<<reminder day:" + dat.getDate() +\n " month:" + (dat.getMonth()+1) +\n " year:" + (dat.getYear()+1900) + " title: >>";\n } else {\n document.getElementById("editorBody" + date).value = "<<reminder day:" + dat.getDate() +\n " month:" + (dat.getMonth()+1) +\n " year:" + (dat.getYear()+1900) + " title: >>";\n }\n };\n var link = createTiddlyButton(popup, "New reminder", null, newReminder); \n popup.appendChild(document.createElement("hr"));\n\n var t = findTiddlersWithReminders(dat, [0,14], null, 1);\n for(var i = 0; i < t.length; i++) {\n link = createTiddlyLink(popup, t[i].tiddler, false);\n link.appendChild(document.createTextNode(t[i].tiddler));\n }\n}\n//}}}\n\n//{{{\nfunction calendarMaxDays(year, mon)\n{\n var max = config.macros.calendar.monthdays[mon];\n if(mon == 1 && (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0)) {\n max++;\n }\n return max;\n}\n//}}}\n\n//{{{\nfunction createCalendarDayRows(cal, year, mon)\n{\n var row = createTiddlyElement(cal, "tr", null, null, null);\n\n var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);\n if(first1 < 0) first1 = first1 + 7;\n var day1 = -first1 + 1;\n var first2 = (new Date(year, mon+1, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);\n if(first2 < 0) first2 = first2 + 7;\n var day2 = -first2 + 1;\n var first3 = (new Date(year, mon+2, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);\n if(first3 < 0) first3 = first3 + 7;\n var day3 = -first3 + 1;\n\n var max1 = calendarMaxDays(year, mon);\n var max2 = calendarMaxDays(year, mon+1);\n var max3 = calendarMaxDays(year, mon+2);\n\n while(day1 <= max1 || day2 <= max2 || day3 <= max3) {\n row = createTiddlyElement(cal, "tr", null, null, null);\n createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;\n createCalendarDays(row, 0, day2, max2, year, mon+1); day2 += 7;\n createCalendarDays(row, 0, day3, max3, year, mon+2); day3 += 7;\n }\n}\n//}}}\n\n//{{{\nfunction createCalendarDayRowsSingle(cal, year, mon)\n{\n var row = createTiddlyElement(cal, "tr", null, null, null);\n\n var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);\n if(first1 < 0) first1 = first1+ 7;\n var day1 = -first1 + 1;\n var max1 = calendarMaxDays(year, mon);\n\n while(day1 <= max1) {\n row = createTiddlyElement(cal, "tr", null, null, null);\n createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;\n }\n}\n//}}}\n\n// //ELS 2005.10.30: added styles\n//{{{\nsetStylesheet(".calendar, .calendar table, .calendar th, .calendar tr, .calendar td { text-align:center; } .calendar, .calendar a { margin:0px !important; padding:0px !important; }", "calendarStyles");\n//}}}\n
/***\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)] or [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 | or : separator), the specified tag is assigned to the current tiddler. If you omit the tag value, as in {{{(title|)}}}, the default tag, {{{checked}}}, is assumed. Omitting both the title and tag, {{{()}}}, tracks the checkbox state by setting the "checked" tag on the current tiddler. When tag tracking is used, the "_" or "X" character in the tiddler content remains unchanged, and is not used to set or track the checkbox state. If a tiddler title named in the tag does not exist, the checkbox state defaults to //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. //''NOTE: beginning with version 2.1.2 of this plugin, the "|" separator is the preferred separator between the title and tag name, as it avoids syntactic ambiguity when ":" is used within tiddler titles or tag names.''//\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.03.11 - 2.1.2\nadded "|" as delimiter to tag-based storage syntax (e.g. "tiddler|tag") to avoid parsing ambiguity when tiddler titles or tag names contain ":". Using ":" as a delimiter is still supported but is deprecated in favor of the new "|" usage. Based on a problem reported by JeffMason.\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:2 , date: new Date(2006,3,11)};\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("|"); if (pos==-1) 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//}}}
/***\n!! CollapseTiddlersPlugin\n^^Author: Bradley Meck^^\n^^Source: http://gensoft.revhost.net/Collapse.html^^\n\n|ELS 2/24/2006: added fallback to "CollapsedTemplate if "WebCollapsedTemplate" is not found |\n|ELS 2/6/2006: added check for 'readOnly' flag to use alternative "WebCollapsedTemplate" |\n\n***/\n\nconfig.commands.collapseTiddler = {\ntext: "fold",\ntooltip: "Collapse this tiddler",\nhandler: function(event,src,title)\n{\nvar e = story.findContainingTiddler(src);\nif(e.getAttribute("template") != config.tiddlerTemplates[DEFAULT_EDIT_TEMPLATE]){\nvar t = (readOnly&&store.tiddlerExists("WebCollapsedTemplate"))?"WebCollapsedTemplate":"CollapsedTemplate";\nif (!store.tiddlerExists(t)) { alert("Can't find 'CollapsedTemplate'"); return; }\nif(e.getAttribute("template") != t ){\ne.setAttribute("oldTemplate",e.getAttribute("template"));\nstory.displayTiddler(null,title,t);\n}\n}\n}\n}\n\nconfig.commands.expandTiddler = {\ntext: "unfold",\ntooltip: "Expand this tiddler",\nhandler: function(event,src,title)\n{\nvar e = story.findContainingTiddler(src);\nstory.displayTiddler(null,title,e.getAttribute("oldTemplate"));\n}\n}\n\nconfig.macros.collapseAll = {\nhandler: function(place,macroName,params,wikifier,paramString,tiddler){\ncreateTiddlyButton(place,"Collapse All","",function(){\nstory.forEachTiddler(function(title,tiddler){\nif(tiddler.getAttribute("template") != config.tiddlerTemplates[DEFAULT_EDIT_TEMPLATE])\nvar t = (readOnly&&store.tiddlerExists("WebCollapsedTemplate"))?"WebCollapsedTemplate":"CollapsedTemplate";\nif (!store.tiddlerExists(t)) { alert("Can't find 'CollapsedTemplate'"); return; }\nstory.displayTiddler(null,title,t);\n})})\n}\n}\n\nconfig.macros.expandAll = {\nhandler: function(place,macroName,params,wikifier,paramString,tiddler){\ncreateTiddlyButton(place,"Expand All","",function(){\nstory.forEachTiddler(function(title,tiddler){\nvar t = (readOnly&&store.tiddlerExists("WebCollapsedTemplate"))?"WebCollapsedTemplate":"CollapsedTemplate";\nif (!store.tiddlerExists(t)) { alert("Can't find 'CollapsedTemplate'"); return; }\nif(tiddler.getAttribute("template") == t) story.displayTiddler(null,title,tiddler.getAttribute("oldTemplate"));\n})})\n}\n}\n\nconfig.commands.collapseOthers = {\ntext: "focus",\ntooltip: "Expand this tiddler and collapse all others",\nhandler: function(event,src,title)\n{\nvar e = story.findContainingTiddler(src);\nstory.forEachTiddler(function(title,tiddler){\nif(tiddler.getAttribute("template") != config.tiddlerTemplates[DEFAULT_EDIT_TEMPLATE]){\nvar t = (readOnly&&store.tiddlerExists("WebCollapsedTemplate"))?"WebCollapsedTemplate":"CollapsedTemplate";\nif (!store.tiddlerExists(t)) { alert("Can't find 'CollapsedTemplate'"); return; }\nif (e==tiddler) t=e.getAttribute("oldTemplate");\n//////////\n// ELS 2006.02.22 - removed this line. if t==null, then the *current* view template, not the default "ViewTemplate", will be used.\n// if (!t||!t.length) t=!readOnly?"ViewTemplate":"WebViewTemplate";\n//////////\nstory.displayTiddler(null,title,t);\n}\n})\n}\n}
<div class='toolbar' macro='toolbar expandTiddler collapseOthers -closeTiddler closeOthers +editTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div><span macro='tiddler DoubleClickForFocus'></span>
config.options.chkAnimate=false; // // no animation\nconfig.commands.saveTiddler.hideReadOnly = true; // // fixup for 'view' mode toolbar in 2.0.6\nconfig.commands.cancelTiddler.hideReadOnly = false;\nconfig.commands.deleteTiddler.hideReadOnly = true;
/***\n''ConfirmExitPlugin for ~TiddlyWiki version 1.2.x and 2.0''\n^^source: http://groups.google.com/group/TiddlyWikiDev/msg/e969118b48d14420^^\n***/\n//{{{\nconfig.messages.confirmExit = "There are unsaved changes in TiddlyWiki."\nwindow.onbeforeunload = function(e){if(store&&store.isDirty&&store.isDirty())return config.messages.confirmExit;};\n//}}}
/***\nCopyTiddlerPlugin\nAuthor: TimMorgan\nSource: http://ziddlywiki.org/#CopyTiddlerPlugin\n\nadds a "copy" option to duplicate a tiddler\n***/\n//{{{\nconfig.shadowTiddlers.EditTemplate = "<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler copyTiddler deleteTiddler'></div>\sn<div class='title' macro='view title'></div>\sn<div class='editor' macro='edit title'></div>\sn<div class='editor' macro='edit text'></div>\sn<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>";\n\nconfig.commands.copyTiddler = {\n text: 'copy',\n hideReadOnly: true,\n tooltip: 'Make a copy of this tiddler',\n handler: function(event,src,title) {\n story.displayTiddler(null,title,DEFAULT_VIEW_TEMPLATE);\n var tiddler = store.fetchTiddler(title);\n var newTitle = 'Copy of ' + title;\n var newTiddler = store.createTiddler(newTitle);\n newTiddler.text = tiddler.text;\n newTiddler.tags = tiddler.tags;\n story.displayTiddler(null,newTitle,DEFAULT_EDIT_TEMPLATE);\n story.focusTiddler(newTitle,"title");\n return false;\n }\n};\n//}}}
/***\n''Date Plugin for TiddlyWiki version 2.x''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#DatePlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n^^last update: <<date tiddler "DDD, MMM DDth, YYYY hh:0mm:0ss">>^^\n\nThere are quite a few calendar generators, reminders, to-do lists, 'dated tiddlers' journals, blog-makers and GTD-like schedule managers that have been built around TW. While they all have different purposes, and vary in format, interaction, and style, in one way or another each of these plugins displays and/or uses date-based information to make finding, accessing and managing relevant tiddlers easier. This plugin provides a general approach to embedding dates and date-based links/menus within tiddler content.\n\nYou can ''specify a date using a combination of year, month, and day number values or mathematical expressions (such as "Y+1" or "D+30")'', and then just display it as formatted date text, or create a ''link to a 'dated tiddler''' for quick blogging, or create a ''popup menu'' containing the dated tiddler link plus links to ''tiddlers that were changed'' as well as any ''scheduled reminders'' for that date.\n!!!!!Usage\n<<<\nWhen installed, this plugin defines a macro: {{{<<date [mode] [date] [format] [linkformat]>>}}}. All of the macro parameters are optional and, in it's simplest form, {{{<<date>>}}}, it is equivalent to the ~TiddlyWiki core macro, {{{<<today>>}}}.\n\nHowever, where {{{<<today>>}}} simply inserts the current date/time in a predefined format (or custom format, using {{{<<today [format]>>}}}), the {{{<<date>>}}} macro's parameters take it much further than that:\n* [mode] is either ''display'', ''link'' or ''popup''. If omitted, it defaults to ''display''. This param let's you select between simply displaying a formatted date, or creating a link to a specific 'date titled' tiddler or a popup menu containing a dated tiddler link, plus links to changes and reminders.\n* [date] lets you enter ANY date (not just today) as ''year, month, and day values or simple mathematical expressions'' using pre-defined variables, Y, M, and D for the current year, month and day, repectively. You can display the modification date of the current tiddler by using the keyword: ''tiddler'' in place of the year, month and day parameters. Use ''tiddler://name-of-tiddler//'' to display the modification date of a specific tiddler. You can also use keywords ''today'' or ''filedate'' to refer to these //dynamically changing// date/time values. \n* [format] and [linkformat] uses standard ~TiddlyWiki date formatting syntax. The default is "YYYY.0MM.0DD"\n>^^''DDD'' - day of week in full (eg, "Monday"), ''DD'' - day of month, ''0DD'' - adds leading zero^^\n>^^''MMM'' - month in full (eg, "July"), ''MM'' - month number, ''0MM'' - adds leading zero^^\n>^^''YYYY'' - full year, ''YY'' - two digit year, ''hh'' - hours, ''mm'' - minutes, ''ss'' - seconds^^\n>^^//note: use of hh, mm or ss format codes is only supported with ''tiddler'', ''today'' or ''filedate'' values//^^\n* [linkformat] - specify an alternative date format so that the title of a 'dated tiddler' link can have a format that differs from the date's displayed format\n\nIn addition to the macro syntax, DatePlugin also provides a public javascript API so that other plugins that work with dates (such as calendar generators, etc.) can quickly incorporate date formatted links or popups into their output:\n\n''{{{showDate(place, date, mode, format, linkformat, autostyle, weekend)}}}'' \n\nNote that in addition to the parameters provided by the macro interface, the javascript API also supports two optional true/false parameters:\n* [autostyle] - when true, the font/background styles of formatted dates are automatically adjusted to show the date's status: 'today' is boxed, 'changes' are bold, 'reminders' are underlined, while weekends and holidays (as well as changes and reminders) can each have a different background color to make them more visibly distinct from each other.\n* [weekend] - true indicates a weekend, false indicates a weekday. When this parameter is omitted, the plugin uses internal defaults to automatically determine when a given date falls on a weekend.\n<<<\n!!!!!Examples\n<<<\nThe current date: <<date>>\nThe current time: <<date today "0hh:0mm:0ss">>\nToday's blog: <<date link today "DDD, MMM DDth, YYYY">>\nRecent blogs/changes/reminders: <<date popup Y M D-1 "yesterday">> <<date popup today "today">> <<date popup Y M D+1 "tomorrow">>\nThe first day of next month will be a <<date Y M+1 1 "DDD">>\nThis tiddler (DatePlugin) was last updated on: <<date tiddler "DDD, MMM DDth, YYYY">>\nThe SiteUrl was last updated on: <<date tiddler:SiteUrl "DDD, MMM DDth, YYYY">>\nThis document was last saved on <<date filedate "DDD, MMM DDth, YYYY at 0hh:0mm:0ss">>\n<<date 2006 07 24 "MMM DDth, YYYY">> will be a <<date 2006 07 24 "DDD">>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''DatePlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.03.08 [2.1.2]''\nadd 'override leadtime' flag param in call to findTiddlersWithReminders(), and add "Enter a title" default text to new reminder handler. Thanks to Jeremy Sheeley for these additional tweaks.\n''2006.03.06 [2.1.0]''\nhasReminders() nows uses window.reminderCacheForCalendar[] when present. If calendar cache is not present, indexReminders() now uses findTiddlersWithReminders() with a 90-day look ahead to check for reminders. Also, switched default background colors for autostyled dates: reminders are now greenish ("c0ffee") and holidays are now reddish ("ffaace").\n''2006.02.14 [2.0.5]''\nwhen readOnly is set (by TW core), omit "new reminders..." popup menu item and, if a "dated tiddler" does not already exist, display the date as simple text instead of a link.\n''2006.02.05 [2.0.4]''\nadded var to variables that were unintentionally global. Avoids FireFox 1.5.0.1 crash bug when referencing global variables\n''2006.01.18 [2.0.3]''\nIn 1.2.x the tiddler editor's text area control was given an element ID=("tiddlerBody"+title), so that it was easy to locate this field and programmatically modify its content. With the addition of configuration templates in 2.x, the textarea no longer has an ID assigned. To find this control we now look through all the child nodes of the tiddler editor to locate a "textarea" control where attribute("edit") equals "text", and then append the new reminder to the contents of that control.\n''2006.01.11 [2.0.2]''\ncorrect 'weekend' override detection logic in showDate()\n''2006.01.10 [2.0.1]''\nallow custom-defined weekend days (default defined in config.macros.date.weekend[] array)\nadded flag param to showDate() API to override internal weekend[] array\n''2005.12.27 [2.0.0]''\nUpdate for TW2.0\nAdded parameter handling for 'linkformat'\n''2005.12.21 [1.2.2]''\nFF's date.getYear() function returns 105 (for the current year, 2005). When calculating a date value from Y M and D expressions, the plugin adds 1900 to the returned year value get the current year number. But IE's date.getYear() already returns 2005. As a result, plugin calculated date values on IE were incorrect (e.g., 3905 instead of 2005). Adding +1900 is now conditional so the values will be correct on both browsers.\n''2005.11.07 [1.2.1]''\nadded support for "tiddler" dynamic date parameter\n''2005.11.06 [1.2.0]''\nadded support for "tiddler:title" dynamic date parameter\n''2005.11.03 [1.1.2]''\nwhen a reminder doesn't have a specified title parameter, use the title of the tiddler that contains the reminder as "fallback" text in the popup menu. Based on a suggestion from BenjaminKudria.\n''2005.11.03 [1.1.1]''\nTemporarily bypass hasReminders() logic to avoid excessive overhead from generating the indexReminders() cache. While reminders can still appear in the popup menu, they just won't be indicated by auto-styling the date number that is displayed. This single change saves approx. 60% overhead (5 second delay reduced to under 2 seconds).\n''2005.11.01 [1.1.0]''\ncorrected logic in hasModifieds() and hasReminders() so caching of indexed modifieds and reminders is done just once, as intended. This should hopefully speed up calendar generators and other plugins that render multiple dates...\n''2005.10.31 [1.0.1]''\ndocumentation and code cleanup\n''2005.10.31 [1.0.0]''\ninitial public release\n''2005.10.30 [0.9.0]''\npre-release\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.date = {major: 2, minor: 1, revision: 2, date: new Date(2006,3,8)};\n//}}}\n\n//{{{\n// 1.2.x compatibility\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.macros.date = {\n format: "YYYY.0MM.0DD", // default date display format\n linkformat: "YYYY.0MM.0DD", // 'dated tiddler' link format\n weekendbg: "#c0c0c0", // "cocoa"\n holidaybg: "#ffaace", // "face"\n modifiedsbg: "#bbeeff", // "beef"\n remindersbg: "#c0ffee", // "coffee"\n holidays: [ "01/01", "07/04", "07/24", "11/24" ], // NewYearsDay, IndependenceDay(US), Eric's Birthday (hooray!), Thanksgiving(US)\n weekend: [ 1,0,0,0,0,0,1 ] // [ day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6 ]\n};\n//}}}\n\n//{{{\nconfig.macros.date.handler = function(place,macroName,params)\n{\n // do we want to see a link, a popup, or just a formatted date?\n var mode="display";\n if (params[0]=="display") { mode=params[0]; params.shift(); }\n if (params[0]=="popup") { mode=params[0]; params.shift(); }\n if (params[0]=="link") { mode=params[0]; params.shift(); }\n // get the date\n var now = new Date();\n var date = now;\n if (!params[0] || params[0]=="today")\n { params.shift(); }\n else if (params[0]=="filedate")\n { date=new Date(document.lastModified); params.shift(); }\n else if (params[0]=="tiddler")\n { date=store.getTiddler(story.findContainingTiddler(place).id.substr(7)).modified; params.shift(); }\n else if (params[0].substr(0,8)=="tiddler:")\n { var t; if ((t=store.getTiddler(params[0].substr(8)))) date=t.modified; params.shift(); }\n else {\n var y = eval(params.shift().replace(/Y/ig,(now.getYear()<1900)?now.getYear()+1900:now.getYear()));\n var m = eval(params.shift().replace(/M/ig,now.getMonth()+1));\n var d = eval(params.shift().replace(/D/ig,now.getDate()+0));\n date = new Date(y,m-1,d);\n }\n // date format with optional custom override\n var format=this.format; if (params[0]) format=params.shift();\n var linkformat=this.linkformat; if (params[0]) linkformat=params.shift();\n showDate(place,date,mode,format,linkformat);\n}\n//}}}\n\n//{{{\nwindow.showDate=showDate;\nfunction showDate(place,date,mode,format,linkformat,autostyle,weekend)\n{\n if (!mode) mode="display";\n if (!format) format=config.macros.date.format;\n if (!linkformat) linkformat=config.macros.date.linkformat;\n if (!autostyle) autostyle=false;\n\n // format the date output\n var title = date.formatString(format);\n var linkto = date.formatString(linkformat);\n\n // just show the formatted output\n if (mode=="display") { place.appendChild(document.createTextNode(title)); return; }\n\n // link to a 'dated tiddler'\n var link = createTiddlyLink(place, linkto, false);\n link.appendChild(document.createTextNode(title));\n link.title = linkto;\n link.date = date;\n link.format = format;\n link.linkformat = linkformat;\n\n // if using a popup menu, replace click handler for dated tiddler link\n // with handler for popup and make link text non-italic (i.e., an 'existing link' look)\n if (mode=="popup") {\n link.onclick = onClickDatePopup;\n link.style.fontStyle="normal";\n }\n\n // format the popup link to show what kind of info it contains (for use with calendar generators)\n if (!autostyle) return;\n if (hasModifieds(date))\n { link.style.fontStyle="normal"; link.style.fontWeight="bold"; }\n if (hasReminders(date))\n { link.style.textDecoration="underline"; }\n if(isToday(date))\n { link.style.border="1px solid black"; }\n\n if( (weekend!=undefined?weekend:isWeekend(date)) && (config.macros.date.weekendbg!="") )\n { place.style.background = config.macros.date.weekendbg; }\n if(isHoliday(date)&&(config.macros.date.holidaybg!=""))\n { place.style.background = config.macros.date.holidaybg; }\n if (hasModifieds(date)&&(config.macros.date.modifiedsbg!=""))\n { place.style.background = config.macros.date.modifiedsbg; }\n if (hasReminders(date)&&(config.macros.date.remindersbg!=""))\n { place.style.background = config.macros.date.remindersbg; }\n}\n//}}}\n\n//{{{\nfunction isToday(date) // returns true if date is today\n { var now=new Date(); return ((now-date>=0) && (now-date<86400000)); }\n\nfunction isWeekend(date) // returns true if date is a weekend\n { return (config.macros.date.weekend[date.getDay()]); }\n\nfunction isHoliday(date) // returns true if date is a holiday\n{\n var longHoliday = date.formatString("0MM/0DD/YYYY");\n var shortHoliday = date.formatString("0MM/0DD");\n for(var i = 0; i < config.macros.date.holidays.length; i++) {\n var holiday=config.macros.date.holidays[i];\n if (holiday==longHoliday||holiday==shortHoliday) return true;\n }\n return false;\n}\n//}}}\n\n//{{{\n// Event handler for clicking on a day popup\nfunction onClickDatePopup(e)\n{\n if (!e) var e = window.event;\n var theTarget = resolveTarget(e);\n var popup = createTiddlerPopup(this);\n if(popup) {\n // always show dated tiddler link (or just date, if readOnly) at the top...\n if (!readOnly || store.tiddlerExists(this.date.formatString(this.linkformat)))\n createTiddlyLink(popup,this.date.formatString(this.linkformat),true);\n else\n createTiddlyText(popup,this.date.formatString(this.linkformat));\n addModifiedsToPopup(popup,this.date,this.format);\n addRemindersToPopup(popup,this.date,this.linkformat);\n }\n scrollToTiddlerPopup(popup,false);\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return(false);\n}\n//}}}\n\n//{{{\nfunction indexModifieds() // build list of tiddlers, hash indexed by modification date\n{\n var modifieds= { };\n var tiddlers = store.getTiddlers("title");\n for (var t = 0; t < tiddlers.length; t++) {\n var date = tiddlers[t].modified.formatString("YYYY0MM0DD")\n if (!modifieds[date])\n modifieds[date]=new Array();\n modifieds[date].push(tiddlers[t].title);\n }\n return modifieds;\n}\nfunction hasModifieds(date) // returns true if date has modified tiddlers\n{\n if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();\n return (config.macros.date.modifieds[date.formatString("YYYY0MM0DD")]!=undefined);\n}\n\nfunction addModifiedsToPopup(popup,when,format)\n{\n if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();\n var indent=String.fromCharCode(160)+String.fromCharCode(160);\n var mods = config.macros.date.modifieds[when.formatString("YYYY0MM0DD")];\n if (mods) {\n mods.sort();\n var e=createTiddlyElement(popup,"div",null,null,"changes:");\n for(var t=0; t<mods.length; t++) {\n var link=createTiddlyLink(popup,mods[t],false);\n link.appendChild(document.createTextNode(indent+mods[t]));\n createTiddlyElement(popup,"br",null,null,null);\n }\n }\n}\n//}}}\n\n//{{{\nfunction indexReminders(date,leadtime) // build list of tiddlers with reminders, hash indexed by reminder date\n{\n var reminders = { };\n if(window.findTiddlersWithReminders!=undefined) { // reminder plugin is installed\n // DEBUG var starttime=new Date();\n var t = findTiddlersWithReminders(date, [0,leadtime], null, null, 1);\n for(var i=0; i<t.length; i++) reminders[t[i].matchedDate]=true;\n // DEBUG var out="Found "+t.length+" reminders in "+((new Date())-starttime+1)+"ms\sn";\n // DEBUG out+="startdate: "+date.toLocaleDateString()+"\sn"+"leadtime: "+leadtime+" days\sn\sn";\n // DEBUG for(var i=0; i<t.length; i++) { out+=t[i].matchedDate.toLocaleDateString()+" "+t[i].params.title+"\sn"; }\n // DEBUG alert(out);\n }\n return reminders;\n}\n\nfunction hasReminders(date) // returns true if date has reminders\n{\n if (window.reminderCacheForCalendar)\n return window.reminderCacheForCalendar[date]; // use calendar cache\n if (!config.macros.date.reminders)\n config.macros.date.reminders = indexReminders(date,90); // create a 90-day leadtime reminder cache\n return (config.macros.date.reminders[date]);\n}\n\nfunction addRemindersToPopup(popup,when,format)\n{\n if(window.findTiddlersWithReminders==undefined) return; // reminder plugin not installed\n\n var indent = String.fromCharCode(160)+String.fromCharCode(160);\n var reminders=findTiddlersWithReminders(when, [0,31],null,null,1);\n var e=createTiddlyElement(popup,"div",null,null,"reminders:"+(!reminders.length?" none":""));\n for(var t=0; t<reminders.length; t++) {\n link = createTiddlyLink(popup,reminders[t].tiddler,false);\n var diff=reminders[t].diff;\n diff=(!diff)?"Today":((diff==1)?"Tomorrow":diff+" days");\n var txt=(reminders[t].params["title"])?reminders[t].params["title"]:reminders[t].tiddler;\n link.appendChild(document.createTextNode(indent+diff+" - "+txt));\n createTiddlyElement(popup,"br",null,null,null);\n }\n if (readOnly) return; // omit "new reminder..." link\n var link = createTiddlyLink(popup,indent+"new reminder...",true); createTiddlyElement(popup,"br");\n var title = when.formatString(format);\n link.title="add a reminder to '"+title+"'";\n link.onclick = function() {\n // show tiddler editor\n story.displayTiddler(null, title, 2, null, null, false, false);\n // find body 'textarea'\n var c =document.getElementById("tiddler" + title).getElementsByTagName("*");\n for (var i=0; i<c.length; i++) if ((c[i].tagName.toLowerCase()=="textarea") && (c[i].getAttribute("edit")=="text")) break;\n // append reminder macro to tiddler content\n if (i<c.length) {\n if (store.tiddlerExists(title)) c[i].value+="\sn"; else c[i].value="";\n c[i].value += "<<reminder";\n c[i].value += " day:"+when.getDate();\n c[i].value += " month:"+(when.getMonth()+1);\n c[i].value += " year:"+when.getFullYear();\n c[i].value += ' title:"Enter a title" >>';\n }\n };\n}\n//}}}\n
/***\n''DisableWikiLinksPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#DisableWikiLinksPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nThis plugin allows you to disable TiddlyWiki's automatic WikiWord linking behavior, so that WikiWords embedded in tiddler content will be rendered as regular text, instead of being automatically converted to tiddler links. To create a tiddler link when automatic linking is disabled, you must enclose the link text within {{{[[}}} and {{{]]}}}.\n\n!!!!!Configuration\n<<<\nSelf-contained control panel:\n<<option chkDisableWikiLinks>> Disable automatic WikiWord tiddler links\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''DisableWikiLinksPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.02.05 [1.0.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.09 [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//{{{\nversion.extensions.disableWikiLinks= {major: 1, minor: 0, revision: 0, date: new Date(2005,12,9)};\n\nif (config.options.chkDisableWikiLinks==undefined) config.options.chkDisableWikiLinks= false;\n\n// find the formatter for wikiLink and replace handler with 'pass-thru' rendering\ninitDisableWikiLinksFormatter();\nfunction initDisableWikiLinksFormatter() {\n for (var i=0; i<config.formatters.length && config.formatters[i].name!="wikiLink"; i++);\n config.formatters[i].coreHandler=config.formatters[i].handler;\n config.formatters[i].handler=function(w) {\n // if not enabled, just do standard WikiWord link formatting\n if (!config.options.chkDisableWikiLinks) return this.coreHandler(w);\n // supress any leading "~" (if present)\n var skip=(w.matchText.substr(0,1)==config.textPrimitives.unWikiLink)?1:0;\n w.outputText(w.output,w.matchStart+skip,w.nextMatch)\n }\n}\n//}}}\n
Type the text for 'New Tiddler'
Recent Changes to this ~TiddleLog\n@@display:block;<script>\n var field="modified";\n var dir=-1; // +1==ascending, -1==descending\n var tiddlers=store.getTiddlers(field);\n tiddlers.sort(function(a,b){if(a[field]==b[field])return(0);else return(a[field]<b[field])?-dir:dir;});\n var limit=25; // set to tiddlers.length to list *all* tiddlers\n var clipsize=500; // # of chars to display from each tiddler\n var out="";\n for (var i=0; i<limit; i++) {\n var title=tiddlers[i].title;\n var author=tiddlers[i].modifier\n var size=tiddlers[i].text.length;\n var mod=tiddlers[i].modified.formatString("0MM/0DD/YY 0hh:0mm:0ss");\n var clip=tiddlers[i].text.substr(0,clipsize);\n var edit='<html><a href="javascript:;" onclick="story.displayTiddler(null,\s''+title+'\s',2);return false;">'+(readOnly?'view':'edit')+' source...</a></html>';\n out+='* '+mod+'+++['+title+']>[['+title+']] ('+size+' bytes) '+edit+'\sn^^modified on '+mod+' by '+author+'^^\sn';\n out+='//'+clipsize+' character source excerpt://\sn----\sn'+'@@font-size:7pt;"""'+clip+'"""@@'+'===\sn'+((i!=limit-1)?'\sn':'');\n }\n return(out);\n</script><<tiddler InlineGroupbox>>@@
/***\n''Export Tiddlers Plugin for TiddlyWiki version 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#ExportTiddlersPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nWhen many people edit copies of the same TiddlyWiki document, the ability to easily copy and share these changes so they can then be redistributed to the entire group is very important. This ability is also 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\nExportTiddlersPlugin let you ''select and extract tiddlers from your ~TiddlyWiki documents and save them to a local file'' or a remote server (requires installation of compatible server-side scripting, still under development...). An interactive control panel lets you specify a destination, and then select which tiddlers to export. A convenient 'selection filter' helps you pick desired tiddlers by specifying a combination of modification dates, tags, or tiddler text to be matched or excluded. ''Tiddler data can be output as ~TiddlyWiki "storeArea ~DIVs" that can be imported into another ~TiddlyWiki or as ~RSS-compatible XML that can be published for RSS syndication.''\n\n!!!!!Inline interface (live)\n<<<\n<<exportTiddlers inline>>\n<<<\n!!!!!Usage\n<<<\nOptional "special tiddlers" used by this plugin:\n* SiteUrl^^\nURL for official server-published version of document being viewed (used in XML export)\ndefault: //none//^^\n* SiteHost^^\nhost name/address for remote server (e.g., "www.server.com" or "192.168.1.27")\ndefault: //none//^^\n* SitePost^^\nremote path/filename for submitting changes (e.g., "/cgi-bin/submit.cgi")\ndefault: //none//^^\n* SiteParams^^\narguments (if any) for server-side receiving script\ndefault: //none//^^\n* SiteNotify^^\naddresses (if any) for sending automatic server-side email notices\ndefault: //none//^^\n* SiteID^^\nusername or other authorization identifier for login-controlled access to remote server\ndefault: current TiddlyWiki username (e.g., "YourName")^^\n* SiteDate^^\nstored date/time stamp for most recent published version of document\ndefault: current document.modified value (i.e., the 'file date')^^\n<<<\n!!!!!Example\n<<<\n<<exportTiddlers>>\n<<<\n!!!!!Installation\n<<<\nImport (or copy/paste) the following tiddlers into your document:\n''ExportTiddlersPlugin'' (tagged with <<tag systemConfig>>)\n\ncreate/edit ''SideBarOptions'': (sidebar menu items) \n^^Add {{{<<exportTiddlers>>}}} macro^^\n<<<\n!!!!!Revision History\n<<<\n''2006.05.11 [2.2.2]''\nin createExportPanel, removed call to addNotification() to no longer auto-refresh the list every time a tiddler is changed. Instead, call refreshExportList(0) only when the panel is first rendered and each time it is made visible. Prevents unneeded feedback messages from being displayed and increases overall document performance, since the listbox is no longer being updated each time a tiddler is saved.\n''2006.05.02 [2.2.1]''\nUse displayMessage() to show number of selected tiddlers instead of updating listbox 'header' item after each selection. Prevents awkward 'scroll-to-top' behavior that made multi-select via ctrl-click nearly impossible. Reported by Paul Reiber.\n''2006.04.29 [2.2.0]''\nNew features: "Notes" are free-form text that is inserted in the header of a TWDIV export file. When exporting to a server, the "notify" checkbox indicates that server-side script processing should send an email message when the export file is stored on the server. Comma-separated addresses may be typed in, or pre-defined in the SiteNotify tiddler.\n''2006.03.29 [2.1.3]''\nadded calls to convertUnicodeToUTF8() for generated output, so it better handles international characters.\n''2006.02.12 [2.1.2]''\nadded var to unintended global 'tags' in matchTags(). Avoids FF1501 bug when filtering by tags. (based on report by TedPavlic)\n''2006.02.04 [2.1.1]''\nadded var to variables that were unintentionally global. Avoids FireFox 1.5.0.1 crash bug when referencing global variables\n''2006.02.02 [2.1.0]''\nAdded support for output of complete TiddlyWiki documents. Let's you use ExportTiddlers to generate 'starter' documents from selected tiddlers.\n''2006.01.21 [2.0.1]''\nDefer initial panel creation and only register a notification function when panel first is created\nin saveChanges 'hijack', create panel as needed. Note: if window.event is not available to identify the click location, the export panel is positioned relative to the 'tiddlerDisplay' element of the TW document.\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.24 [0.9.5]''\nMinor adjustments to CSS to force correct link colors regardless of TW stylesheet selection\n''2005.12.16 [0.9.4]''\nDynamically create/remove exportPanel as needed to ensure only one instance of interface elements exists, even if there are multiple instances of macro embedding.\n''2005.11.15 [0.9.2]''\nadded non-Ajax post function to bypass javascript security restrictions on cross-domain I/O. Moved AJAX functions to separate tiddler (no longer needed here). Generalized HTTP server to support UnaWiki servers\n''2005.11.08 [0.9.1]''\nmoved HTML, CSS and control initialization into exportInit() function and call from macro handler instead of at load time. This allows exportPanel to be placed within the same containing element as the "export tiddlers" button, so that relative positioning can be achieved.\n''2005.10.28 [0.9.0]''\nadded 'select opened tiddlers' feature\nBased on a suggestion by Geoff Slocock\n''2005.10.24 [0.8.3]''\nCorrected hijack of 'save changes' when using http:\n''2005.10.18 [0.8.2]''\nadded AJAX functions\n''2005.10.18 [0.8.1]''\nCorrected timezone handling when filtering for date ranges.\nImproved error checking/reporting for invalid filter values and filters that don't match any tiddlers.\nExporting localfile-to-localfile is working for IE and FF\nExporting server-to-localfile works in IE (after ActiveX warnings), but has security issues in FF\nCross-domain exporting (localfile/server-to-server) is under development\nCookies to remember filter settings - coming soon\nMore style tweaks, minor text changes and some assorted layout cleanup.\n''2005.10.17 [0.8.0]''\nFirst pre-release.\n''2005.10.16 [0.7.0]''\nfilter by tags\n''2005.10.15 [0.6.0]''\nfilter by title/text\n''2005.10.14 [0.5.0]''\nexport to local file (DIV or XML)\n''2005.10.14 [0.4.0]''\nfilter by start/end date\n''2005.10.13 [0.3.0]''\npanel interaction\n''2005.10.11 [0.2.0]''\npanel layout\n''2005.10.10 [0.1.0]''\ncode framework\n''2005.10.09 [0.0.0]''\ndevelopment started\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n// // +++[version]\n//{{{\nversion.extensions.exportTiddlers = {major: 2, minor: 2, revision: 2, date: new Date(2006,5,2)};\n//}}}\n// //===\n\n// // +++[macro handler]\n//{{{\nconfig.macros.exportTiddlers = {\n label: "export tiddlers",\n prompt: "Copy selected tiddlers to an export document",\n datetimefmt: "0MM/0DD/YYYY 0hh:0mm:0ss" // for "filter date/time" edit fields\n};\n\nconfig.macros.exportTiddlers.handler = function(place,macroName,params) {\n if (params[0]!="inline")\n { createTiddlyButton(place,this.label,this.prompt,onClickExportMenu); return; }\n var panel=createExportPanel(place);\n panel.style.position="static";\n panel.style.display="block";\n}\n\nfunction createExportPanel(place) {\n var panel=document.getElementById("exportPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n setStylesheet(config.macros.exportTiddlers.css,"exportTiddlers");\n panel=createTiddlyElement(place,"span","exportPanel",null,null)\n panel.innerHTML=config.macros.exportTiddlers.html;\n exportShowPanel(document.location.protocol);\n exportInitFilter();\n refreshExportList(0);\n return panel;\n}\n\nfunction onClickExportMenu(e)\n{\n if (!e) var e = window.event;\n var parent=resolveTarget(e).parentNode;\n var panel = document.getElementById("exportPanel");\n if (panel==undefined || panel.parentNode!=parent)\n panel=createExportPanel(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 if (panel.style.display!="none") refreshExportList(0); // update list when panel is made visible\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return(false);\n}\n//}}}\n// //===\n\n// // +++[Hijack saveChanges] diverts 'notFileUrlError' to display export control panel instead\n//{{{\nwindow.coreSaveChanges=window.saveChanges;\nwindow.saveChanges = function()\n{\n if (document.location.protocol=="file:") { coreSaveChanges(); return; }\n var e = window.event;\n var parent=e?resolveTarget(e).parentNode:document.body;\n var panel = document.getElementById("exportPanel");\n if (panel==undefined || panel.parentNode!=parent) panel=createExportPanel(parent);\n exportShowPanel(document.location.protocol);\n if (parent==document.body) { panel.style.left="30%"; panel.style.top="30%"; }\n panel.style.display = "block" ;\n}\n//}}}\n// //===\n\n// // +++[IE needs explicit scoping] for functions called by browser events\n//{{{\nwindow.onClickExportMenu=onClickExportMenu;\nwindow.onClickExportButton=onClickExportButton;\nwindow.exportShowPanel=exportShowPanel;\nwindow.exportShowFilterFields=exportShowFilterFields;\nwindow.refreshExportList=refreshExportList;\n//}}}\n// //===\n\n// // +++[CSS] for floating export control panel\n//{{{\nconfig.macros.exportTiddlers.css = '\s\n#exportPanel {\s\n display: none; position:absolute; z-index:12; width:35em; right:105%; top:6em;\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#exportPanel a, #exportPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\s\n#exportPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\s\n#exportPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\s\n#exportPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\s\n#exportPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\s\n#exportPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%; }\s\n#exportPanel textarea { width:98%;padding:0px;margin:0px;overflow:auto;font-size:8pt; }\s\n#exportPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px; }\s\n#exportPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\s\n#exportPanel .rad { width:auto;border:0 }\s\n#exportPanel .chk { width:auto;border:0 }\s\n#exportPanel .btn { width:auto; }\s\n#exportPanel .btn1 { width:98%; }\s\n#exportPanel .btn2 { width:48%; }\s\n#exportPanel .btn3 { width:32%; }\s\n#exportPanel .btn4 { width:24%; }\s\n#exportPanel .btn5 { width:19%; }\s\n';\n//}}}\n// //===\n\n// // +++[HTML] for export control panel interface\n//{{{\nconfig.macros.exportTiddlers.html = '\s\n<!-- output target and format -->\s\n<table cellpadding="0" cellspacing="0"><tr><td width=50%>\s\n export to\s\n <select size=1 id="exportTo" onchange="exportShowPanel(this.value);">\s\n <option value="file:" SELECTED>this computer</option>\s\n <option value="http:">web server (http)</option>\s\n <option value="https:">secure web server (https)</option>\s\n <option value="ftp:">file server (ftp)</option>\s\n </select>\s\n</td><td width=50%>\s\n output format\s\n <select id="exportFormat" size=1>\s\n <option value="DIV">TiddlyWiki export file</option>\s\n <option value="TW">TiddlyWiki document</option>\s\n <option value="XML">RSS feed (XML)</option>\s\n </select>\s\n</td></tr></table>\s\n\s\n<!-- export to local file -->\s\n<div id="exportLocalPanel" style="margin-top:5px;">\s\nlocal path/filename<br>\s\n<input type="file" id="exportFilename" size=57 style="width:100%"><br>\s\n</div><!--panel-->\s\n\s\n<!-- export to http server -->\s\n<div id="exportHTTPPanel" style="display:none;margin-top:5px;">\s\n<table><tr><td align=left>\s\n server location, script, and parameters<br>\s\n</td><td align=right>\s\n <input type="checkbox" class="chk" id="exportNotify"\s\n onClick="document.getElementById(\s'exportSetNotifyPanel\s').style.display=this.checked?\s'block\s':\s'none\s'"> notify\s\n</td></tr></table>\s\n<input type="text" id="exportHTTPServerURL" onfocus="this.select()"><br>\s\n<div id="exportSetNotifyPanel" style="display:none">\s\n send email notices to<br>\s\n <input type="text" id="exportNotifyTo" onfocus="this.select()"><br>\s\n</div>\s\n</div><!--panel-->\s\n\s\n<!-- export to ftp server -->\s\n<div id="exportFTPPanel" style="display:none;margin-top:5px;">\s\n<table cellpadding="0" cellspacing="0" width="32%"><tr valign="top"><td>\s\n host server<br>\s\n <input type="text" id="exportFTPHost" onfocus="this.select()"><br>\s\n</td><td width="32%">\s\n username<br>\s\n <input type="text" id="exportFTPID" onfocus="this.select()"><br>\s\n</td><td width="32%">\s\n password<br>\s\n <input type="password" id="exportFTPPW" onfocus="this.select()"><br>\s\n</td></tr></table>\s\nFTP path/filename<br>\s\n<input type="text" id="exportFTPFilename" onfocus="this.select()"><br>\s\n</div><!--panel-->\s\n\s\n<!-- notes -->\s\nnotes<br>\s\n<textarea id="exportNotes" rows=3 cols=40 style="height:4em;margin-bottom:5px;" onfocus="this.select()"></textarea> \s\n\s\n<!-- list of tiddlers -->\s\n<table><tr align="left"><td>\s\n select:\s\n <a href="JavaScript:;" id="exportSelectAll"\s\n onclick="onClickExportButton(this)" title="select all tiddlers">\s\n &nbsp;all&nbsp;</a>\s\n <a href="JavaScript:;" id="exportSelectChanges"\s\n onclick="onClickExportButton(this)" title="select tiddlers changed since last save">\s\n &nbsp;changes&nbsp;</a> \s\n <a href="JavaScript:;" id="exportSelectOpened"\s\n onclick="onClickExportButton(this)" title="select tiddlers currently being displayed">\s\n &nbsp;opened&nbsp;</a> \s\n <a href="JavaScript:;" id="exportToggleFilter"\s\n onclick="onClickExportButton(this)" title="show/hide selection filter">\s\n &nbsp;filter&nbsp;</a> \s\n</td><td align="right">\s\n <a href="JavaScript:;" id="exportListSmaller"\s\n onclick="onClickExportButton(this)" title="reduce list size">\s\n &nbsp;&#150;&nbsp;</a>\s\n <a href="JavaScript:;" id="exportListLarger"\s\n onclick="onClickExportButton(this)" title="increase list size">\s\n &nbsp;+&nbsp;</a>\s\n</td></tr></table>\s\n<select id="exportList" multiple size="10" style="margin-bottom:5px;"\s\n onchange="refreshExportList(this.selectedIndex)">\s\n</select><br>\s\n</div><!--box-->\s\n\s\n<!-- selection filter -->\s\n<div id="exportFilterPanel" style="display:none">\s\n<table><tr align="left"><td>\s\n selection filter\s\n</td><td align="right">\s\n <a href="JavaScript:;" id="exportHideFilter"\s\n onclick="onClickExportButton(this)" title="hide selection filter">hide</a>\s\n</td></tr></table>\s\n<div class="box">\s\n<input type="checkbox" class="chk" id="exportFilterStart" value="1"\s\n onclick="exportShowFilterFields(this)"> starting date/time<br>\s\n<table cellpadding="0" cellspacing="0"><tr valign="center"><td width="50%">\s\n <select size=1 id="exportFilterStartBy" onchange="exportShowFilterFields(this);">\s\n <option value="0">today</option>\s\n <option value="1">yesterday</option>\s\n <option value="7">a week ago</option>\s\n <option value="30">a month ago</option>\s\n <option value="site">SiteDate</option>\s\n <option value="file">file date</option>\s\n <option value="other">other (mm/dd/yyyy hh:mm)</option>\s\n </select>\s\n</td><td width="50%">\s\n <input type="text" id="exportStartDate" onfocus="this.select()"\s\n onchange="document.getElementById(\s'exportFilterStartBy\s').value=\s'other\s';">\s\n</td></tr></table>\s\n<input type="checkbox" class="chk" id="exportFilterEnd" value="1"\s\n onclick="exportShowFilterFields(this)"> ending date/time<br>\s\n<table cellpadding="0" cellspacing="0"><tr valign="center"><td width="50%">\s\n <select size=1 id="exportFilterEndBy" onchange="exportShowFilterFields(this);">\s\n <option value="0">today</option>\s\n <option value="1">yesterday</option>\s\n <option value="7">a week ago</option>\s\n <option value="30">a month ago</option>\s\n <option value="site">SiteDate</option>\s\n <option value="file">file date</option>\s\n <option value="other">other (mm/dd/yyyy hh:mm)</option>\s\n </select>\s\n</td><td width="50%">\s\n <input type="text" id="exportEndDate" onfocus="this.select()"\s\n onchange="document.getElementById(\s'exportFilterEndBy\s').value=\s'other\s';">\s\n</td></tr></table>\s\n<input type="checkbox" class="chk" id=exportFilterTags value="1"\s\n onclick="exportShowFilterFields(this)"> match tags<br>\s\n<input type="text" id="exportTags" onfocus="this.select()">\s\n<input type="checkbox" class="chk" id=exportFilterText value="1"\s\n onclick="exportShowFilterFields(this)"> match titles/tiddler text<br>\s\n<input type="text" id="exportText" onfocus="this.select()">\s\n</div> <!--box-->\s\n</div> <!--panel-->\s\n\s\n<!-- action buttons -->\s\n<div style="text-align:center">\s\n<input type=button class="btn3" onclick="onClickExportButton(this)"\s\n id="exportFilter" value="apply filter">\s\n<input type=button class="btn3" onclick="onClickExportButton(this)"\s\n id="exportStart" value="export tiddlers">\s\n<input type=button class="btn3" onclick="onClickExportButton(this)"\s\n id="exportClose" value="close">\s\n</div><!--center-->\s\n';\n//}}}\n// //===\n\n// // +++[initialize interface]>\n// // +++[exportShowPanel(which)]\n//{{{\nfunction exportShowPanel(which) {\n var index=0; var panel='exportLocalPanel';\n switch (which) {\n case 'file:':\n case undefined:\n index=0; panel='exportLocalPanel'; break;\n case 'http:':\n index=1; panel='exportHTTPPanel'; break;\n case 'https:':\n index=2; panel='exportHTTPPanel'; break;\n case 'ftp:':\n index=3; panel='exportFTPPanel'; break;\n default:\n alert("Sorry, export to "+which+" is not yet available");\n break;\n }\n exportInitPanel(which);\n document.getElementById('exportTo').selectedIndex=index;\n document.getElementById('exportLocalPanel').style.display='none';\n document.getElementById('exportHTTPPanel').style.display='none';\n document.getElementById('exportFTPPanel').style.display='none';\n document.getElementById(panel).style.display='block';\n}\n//}}}\n// //===\n\n// // +++[exportInitPanel(which)]\n//{{{\nfunction exportInitPanel(which) {\n switch (which) {\n case "file:": // LOCAL EXPORT PANEL: file/path:\n // ** no init - security issues in IE **\n break;\n case "http:": // WEB EXPORT PANEL\n case "https:": // SECURE WEB EXPORT PANEL\n // url\n if (store.tiddlerExists("unawiki_download")) {\n var theURL=store.getTiddlerText("unawiki_download");\n theURL=theURL.replace(/\s[\s[download\s|/,'').replace(/\s]\s]/,'');\n var title=(store.tiddlerExists("unawiki_host"))?"unawiki_host":"SiteHost";\n var theHost=store.getTiddlerText(title);\n if (!theHost || !theHost.length) theHost=document.location.host;\n if (!theHost || !theHost.length) theHost=title;\n }\n // server script/params\n var title=(store.tiddlerExists("unawiki_host"))?"unawiki_host":"SiteHost";\n var theHost=store.getTiddlerText(title);\n if (!theHost || !theHost.length) theHost=document.location.host;\n if (!theHost || !theHost.length) theHost=title;\n // get POST\n var title=(store.tiddlerExists("unawiki_post"))?"unawiki_post":"SitePost";\n var thePost=store.getTiddlerText(title);\n if (!thePost || !thePost.length) thePost="/"+title;\n // get PARAMS\n var title=(store.tiddlerExists("unawiki_params"))?"unawiki_params":"SiteParams";\n var theParams=store.getTiddlerText(title);\n if (!theParams|| !theParams.length) theParams=title;\n var serverURL = which+"//"+theHost+thePost+"?"+theParams;\n document.getElementById("exportHTTPServerURL").value=serverURL;\n // get NOTIFY\n var theAddresses=store.getTiddlerText("SiteNotify");\n if (!theAddresses|| !theAddresses.length) theAddresses="SiteNotify";\n document.getElementById("exportNotifyTo").value=theAddresses;\n break;\n case "ftp:": // FTP EXPORT PANEL\n // host\n var siteHost=store.getTiddlerText("SiteHost");\n if (!siteHost || !siteHost.length) siteHost=document.location.host;\n if (!siteHost || !siteHost.length) siteHost="SiteHost";\n document.getElementById("exportFTPHost").value=siteHost;\n // username\n var siteID=store.getTiddlerText("SiteID");\n if (!siteID || !siteID.length) siteID=config.options.txtUserName;\n document.getElementById("exportFTPID").value=siteID;\n // password\n document.getElementById("exportFTPPW").value="";\n // file/path\n document.getElementById("exportFTPFilename").value="";\n break;\n }\n}\n//}}}\n// //===\n\n// // +++[exportInitFilter()]\n//{{{\nfunction exportInitFilter() {\n // start date\n document.getElementById("exportFilterStart").checked=false;\n document.getElementById("exportStartDate").value="";\n // end date\n document.getElementById("exportFilterEnd").checked=false;\n document.getElementById("exportEndDate").value="";\n // tags\n document.getElementById("exportFilterTags").checked=false;\n document.getElementById("exportTags").value="";\n // text\n document.getElementById("exportFilterText").checked=false;\n document.getElementById("exportText").value="";\n // show/hide filter input fields\n exportShowFilterFields();\n}\n//}}}\n// //===\n\n// // +++[exportShowFilterFields(which)]\n//{{{\nfunction exportShowFilterFields(which) {\n var show;\n\n show=document.getElementById('exportFilterStart').checked;\n document.getElementById('exportFilterStartBy').style.display=show?"block":"none";\n document.getElementById('exportStartDate').style.display=show?"block":"none";\n var val=document.getElementById('exportFilterStartBy').value;\n document.getElementById('exportStartDate').value\n =getFilterDate(val,'exportStartDate').formatString(config.macros.exportTiddlers.datetimefmt);\n if (which && (which.id=='exportFilterStartBy') && (val=='other'))\n document.getElementById('exportStartDate').focus();\n\n show=document.getElementById('exportFilterEnd').checked;\n document.getElementById('exportFilterEndBy').style.display=show?"block":"none";\n document.getElementById('exportEndDate').style.display=show?"block":"none";\n var val=document.getElementById('exportFilterEndBy').value;\n document.getElementById('exportEndDate').value\n =getFilterDate(val,'exportEndDate').formatString(config.macros.exportTiddlers.datetimefmt);\n if (which && (which.id=='exportFilterEndBy') && (val=='other'))\n document.getElementById('exportEndDate').focus();\n\n show=document.getElementById('exportFilterTags').checked;\n document.getElementById('exportTags').style.display=show?"block":"none";\n\n show=document.getElementById('exportFilterText').checked;\n document.getElementById('exportText').style.display=show?"block":"none";\n}\n//}}}\n// //===\n// //===\n\n// // +++[onClickExportButton(which): control interactions]\n//{{{\nfunction onClickExportButton(which)\n{\n // DEBUG alert(which.id);\n var theList=document.getElementById('exportList'); if (!theList) return;\n var count = 0;\n var total = store.getTiddlers('title').length;\n switch (which.id)\n {\n case 'exportFilter':\n count=filterExportList();\n var panel=document.getElementById('exportFilterPanel');\n if (count==-1) { panel.style.display='block'; break; }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage("filtered "+formatExportMessage(count,total));\n if (count==0) { alert("No tiddlers were selected"); panel.style.display='block'; }\n break;\n case 'exportStart':\n exportTiddlers();\n break;\n case 'exportHideFilter':\n case 'exportToggleFilter':\n var panel=document.getElementById('exportFilterPanel')\n panel.style.display=(panel.style.display=='block')?'none':'block';\n break;\n case 'exportSelectChanges':\n var lastmod=new Date(document.lastModified);\n for (var t = 0; t < theList.options.length; t++) {\n if (theList.options[t].value=="") continue;\n var tiddler=store.getTiddler(theList.options[t].value); if (!tiddler) continue;\n theList.options[t].selected=(tiddler.modified>lastmod);\n count += (tiddler.modified>lastmod)?1:0;\n }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage(formatExportMessage(count,total));\n if (count==0) alert("There are no unsaved changes");\n break;\n case 'exportSelectAll':\n for (var t = 0; t < theList.options.length; t++) {\n if (theList.options[t].value=="") continue;\n theList.options[t].selected=true;\n count += 1;\n }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage(formatExportMessage(count,count));\n break;\n case 'exportSelectOpened':\n for (var t = 0; t < theList.options.length; t++) theList.options[t].selected=false;\n var tiddlerDisplay = document.getElementById("tiddlerDisplay");\n for (var t=0;t<tiddlerDisplay.childNodes.length;t++) {\n var tiddler=tiddlerDisplay.childNodes[t].id.substr(7);\n for (var i = 0; i < theList.options.length; i++) {\n if (theList.options[i].value!=tiddler) continue;\n theList.options[i].selected=true; count++; break;\n }\n }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage(formatExportMessage(count,total));\n if (count==0) alert("There are no tiddlers currently opened");\n break;\n case 'exportListSmaller': // decrease current listbox size\n var min=5;\n theList.size-=(theList.size>min)?1:0;\n break;\n case 'exportListLarger': // increase current listbox size\n var max=(theList.options.length>25)?theList.options.length:25;\n theList.size+=(theList.size<max)?1:0;\n break;\n case 'exportClose':\n document.getElementById('exportPanel').style.display='none';\n break;\n }\n}\n//}}}\n// //===\n\n// // +++[list display]\n//{{{\nfunction formatExportMessage(count,total)\n{\n var txt=total+' tiddler'+((total!=1)?'s':'')+" - ";\n txt += (count==0)?"none":(count==total)?"all":count;\n txt += " selected for export";\n return txt;\n}\n\nfunction refreshExportList(selectedIndex)\n{\n var theList = document.getElementById("exportList");\n var sort;\n if (!theList) return;\n // get the sort order\n if (!selectedIndex) selectedIndex=0;\n if (selectedIndex==0) sort='modified';\n if (selectedIndex==1) sort='title';\n if (selectedIndex==2) sort='modified';\n if (selectedIndex==3) sort='modifier';\n\n // get the alphasorted list of tiddlers\n var tiddlers = store.getTiddlers('title');\n // unselect headings and count number of tiddlers actually selected\n var count=0;\n for (var i=0; i<theList.options.length; i++) {\n if (theList.options[i].value=="") theList.options[i].selected=false;\n count+=theList.options[i].selected?1:0;\n }\n // disable "export" button if no tiddlers selected\n document.getElementById("exportStart").disabled=(count==0);\n // update listbox heading to show selection count\n if (theList.options.length) { clearMessage(); displayMessage(formatExportMessage(count,tiddlers.length)); }\n\n // if a [command] item, reload list... otherwise, no further refresh needed\n if (selectedIndex>3) return;\n\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++]=\n new Option(tiddlers.length+" tiddlers in document", "",false,false);\n theList.options[i++]=\n new Option(((sort=="title" )?">":indent)+' [by title]', "",false,false);\n theList.options[i++]=\n new Option(((sort=="modified")?">":indent)+' [by date]', "",false,false);\n theList.options[i++]=\n new Option(((sort=="modifier")?">":indent)+' [by author]', "",false,false);\n // output the tiddler list\n switch(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 "modifier":\n case "modified":\n var tiddlers = store.getTiddlers(sort);\n // sort descending for newest date first\n tiddlers.sort(function (a,b) {if(a[sort] == b[sort]) return(0); else return (a[sort] > b[sort]) ? -1 : +1; });\n var lastSection = "";\n for(var t = 0; t < tiddlers.length; t++)\n {\n var tiddler = tiddlers[t];\n var theSection = "";\n if (sort=="modified") theSection=tiddler.modified.toLocaleDateString();\n if (sort=="modifier") theSection=tiddler.modifier;\n if (theSection != lastSection)\n {\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 }\n theList.selectedIndex=selectedIndex; // select current control item\n}\n//}}}\n// //===\n\n// // +++[list filtering]\n//{{{\nfunction getFilterDate(val,id)\n{\n var result=0;\n switch (val) {\n case 'site':\n var timestamp=store.getTiddlerText("SiteDate");\n if (!timestamp) timestamp=document.lastModified;\n result=new Date(timestamp);\n break;\n case 'file':\n result=new Date(document.lastModified);\n break;\n case 'other':\n result=new Date(document.getElementById(id).value);\n break;\n default: // today=0, yesterday=1, one week=7, two weeks=14, a month=31\n var now=new Date(); var tz=now.getTimezoneOffset()*60000; now-=tz;\n var oneday=86400000;\n if (id=='exportStartDate')\n result=new Date((Math.floor(now/oneday)-val)*oneday+tz);\n else\n result=new Date((Math.floor(now/oneday)-val+1)*oneday+tz-1);\n break;\n }\n // DEBUG alert('getFilterDate('+val+','+id+')=='+result+"\snnow="+now);\n return result;\n}\n\nfunction filterExportList()\n{\n var theList = document.getElementById("exportList"); if (!theList) return -1;\n\n var filterStart=document.getElementById("exportFilterStart").checked;\n var val=document.getElementById("exportFilterStartBy").value;\n var startDate=getFilterDate(val,'exportStartDate');\n\n var filterEnd=document.getElementById("exportFilterEnd").checked;\n var val=document.getElementById("exportFilterEndBy").value;\n var endDate=getFilterDate(val,'exportEndDate');\n\n var filterTags=document.getElementById("exportFilterTags").checked;\n var tags=document.getElementById("exportTags").value;\n\n var filterText=document.getElementById("exportFilterText").checked;\n var text=document.getElementById("exportText").value;\n\n if (!(filterStart||filterEnd||filterTags||filterText)) {\n alert("Please set the selection filter");\n document.getElementById('exportFilterPanel').style.display="block";\n return -1;\n }\n if (filterStart&&filterEnd&&(startDate>endDate)) {\n var msg="starting date/time:\sn"\n msg+=startDate.toLocaleString()+"\sn";\n msg+="is later than ending date/time:\sn"\n msg+=endDate.toLocaleString()\n alert(msg);\n return -1;\n }\n\n // scan list and select tiddlers that match all applicable criteria\n var total=0;\n var count=0;\n for (var i=0; i<theList.options.length; i++) {\n // get item, skip non-tiddler list items (section headings)\n var opt=theList.options[i]; if (opt.value=="") continue;\n // get tiddler, skip missing tiddlers (this should NOT happen)\n var tiddler=store.getTiddler(opt.value); if (!tiddler) continue; \n var sel=true;\n if ( (filterStart && tiddler.modified<startDate)\n || (filterEnd && tiddler.modified>endDate)\n || (filterTags && !matchTags(tiddler,tags))\n || (filterText && (tiddler.text.indexOf(text)==-1) && (tiddler.title.indexOf(text)==-1)))\n sel=false;\n opt.selected=sel;\n count+=sel?1:0;\n total++;\n }\n return count;\n}\n//}}}\n\n//{{{\nfunction matchTags(tiddler,cond)\n{\n if (!cond||!cond.trim().length) return false;\n\n // build a regex of all tags as a big-old regex that \n // OR's the tags together (tag1|tag2|tag3...) in length order\n var tgs = store.getTags();\n if ( tgs.length == 0 ) return results ;\n var tags = tgs.sort( function(a,b){return (a[0].length<b[0].length)-(a[0].length>b[0].length);});\n var exp = "(" + tags.join("|") + ")" ;\n exp = exp.replace( /(,[\sd]+)/g, "" ) ;\n var regex = new RegExp( exp, "ig" );\n\n // build a string such that an expression that looks like this: tag1 AND tag2 OR NOT tag3\n // turns into : /tag1/.test(...) && /tag2/.test(...) || ! /tag2/.test(...)\n cond = cond.replace( regex, "/$1\s\s|/.test(tiddlerTags)" );\n cond = cond.replace( /\ssand\ss/ig, " && " ) ;\n cond = cond.replace( /\ssor\ss/ig, " || " ) ;\n cond = cond.replace( /\ss?not\ss/ig, " ! " ) ;\n\n // if a boolean uses a tag that doesn't exist - it will get left alone \n // (we only turn existing tags into actual tests).\n // replace anything that wasn't found as a tag, AND, OR, or NOT with the string "false"\n // if the tag doesn't exist then /tag/.test(...) will always return false.\n cond = cond.replace( /(\ss|^)+[^\s/\s|&!][^\ss]*/g, "false" ) ;\n\n // make a string of the tags in the tiddler and eval the 'cond' string against that string \n // if it's TRUE then the tiddler qualifies!\n var tiddlerTags = (tiddler.tags?tiddler.tags.join("|"):"")+"|" ;\n try { if ( eval( cond ) ) return true; }\n catch( e ) { displayMessage("Error in tag filter '" + e + "'" ); }\n return false;\n}\n//}}}\n// //===\n\n// // +++[output data formatting]>\n// // +++[exportHeader(format)]\n//{{{\nfunction exportHeader(format)\n{\n switch (format) {\n case "TW": return exportTWHeader();\n case "DIV": return exportDIVHeader();\n case "XML": return exportXMLHeader();\n }\n}\n//}}}\n// //===\n\n// // +++[exportFooter(format)]\n//{{{\nfunction exportFooter(format)\n{\n switch (format) {\n case "TW": return exportDIVFooter();\n case "DIV": return exportDIVFooter();\n case "XML": return exportXMLFooter();\n }\n}\n//}}}\n// //===\n\n// // +++[exportTWHeader()]\n//{{{\nfunction exportTWHeader()\n{\n // Get the URL of the document\n var originalPath = document.location.toString();\n // Check we were loaded from a file URL\n if(originalPath.substr(0,5) != "file:")\n { alert(config.messages.notFileUrlError); return; }\n // Remove any location part of the URL\n var hashPos = originalPath.indexOf("#"); if(hashPos != -1) 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 // Load the original file\n var original = loadFile(localPath);\n if(original == null)\n { alert(config.messages.cantSaveError); return; }\n // Locate the storeArea div's\n var posOpeningDiv = original.indexOf(startSaveArea);\n var posClosingDiv = original.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1))\n { alert(config.messages.invalidFileError.format([localPath])); return; }\n return original.substr(0,posOpeningDiv+startSaveArea.length)\n}\n//}}}\n// //===\n\n// // +++[exportDIVHeader()]\n//{{{\nfunction exportDIVHeader()\n{\n var out=[];\n var now = new Date();\n var title = convertUnicodeToUTF8(wikifyPlain("SiteTitle").htmlEncode());\n var subtitle = convertUnicodeToUTF8(wikifyPlain("SiteSubtitle").htmlEncode());\n var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());\n var twver = version.major+"."+version.minor+"."+version.revision;\n var pver = version.extensions.exportTiddlers.major+"."\n +version.extensions.exportTiddlers.minor+"."+version.extensions.exportTiddlers.revision;\n out.push("<html><body>");\n out.push("<style type=\s"text/css\s">");\n out.push("#storeArea {display:block;margin:1em;}");\n out.push("#storeArea div");\n out.push("{padding:0.5em;margin:1em;border:2px solid black;height:10em;overflow:auto;}");\n out.push("#javascriptWarning");\n out.push("{width:100%;text-align:left;background-color:#eeeeee;padding:1em;}");\n out.push("</style>");\n out.push("<div id=\s"javascriptWarning\s">");\n out.push("TiddlyWiki export file<br>");\n out.push("Source: <b>"+convertUnicodeToUTF8(document.location.toString())+"</b><br>");\n out.push("Title: <b>"+title+"</b><br>");\n out.push("Subtitle: <b>"+subtitle+"</b><br>");\n out.push("Created: <b>"+now.toLocaleString()+"</b> by <b>"+user+"</b><br>");\n out.push("TiddlyWiki "+twver+" / "+"ExportTiddlersPlugin "+pver+"<br>");\n out.push("Notes:<hr><pre>"+document.getElementById("exportNotes").value.replace(regexpNewLine,"<br>")+"</pre>");\n out.push("</div>");\n out.push("<div id=\s"storeArea\s">");\n return out;\n}\n//}}}\n// //===\n\n// // +++[exportDIVFooter()]\n//{{{\nfunction exportDIVFooter()\n{\n var out=[];\n out.push("</div></body></html>");\n return out;\n}\n//}}}\n// //===\n\n// // +++[exportXMLHeader()]\n//{{{\nfunction exportXMLHeader()\n{\n var out=[];\n var now = new Date();\n var u = store.getTiddlerText("SiteUrl",null);\n var title = convertUnicodeToUTF8(wikifyPlain("SiteTitle").htmlEncode());\n var subtitle = convertUnicodeToUTF8(wikifyPlain("SiteSubtitle").htmlEncode());\n var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());\n var twver = version.major+"."+version.minor+"."+version.revision;\n var pver = version.extensions.exportTiddlers.major+"."\n +version.extensions.exportTiddlers.minor+"."+version.extensions.exportTiddlers.revision;\n out.push("<" + "?xml version=\s"1.0\s"?" + ">");\n out.push("<rss version=\s"2.0\s">");\n out.push("<channel>");\n out.push("<title>" + title + "</title>");\n if(u) out.push("<link>" + convertUnicodeToUTF8(u.htmlEncode()) + "</link>");\n out.push("<description>" + subtitle + "</description>");\n out.push("<language>en-us</language>");\n out.push("<copyright>Copyright " + now.getFullYear() + " " + user + "</copyright>");\n out.push("<pubDate>" + now.toGMTString() + "</pubDate>");\n out.push("<lastBuildDate>" + now.toGMTString() + "</lastBuildDate>");\n out.push("<docs>http://blogs.law.harvard.edu/tech/rss</docs>");\n out.push("<generator>TiddlyWiki "+twver+" plus ExportTiddlersPlugin "+pver+"</generator>");\n return out;\n}\n//}}}\n// //===\n\n// // +++[exportXMLFooter()]\n//{{{\nfunction exportXMLFooter()\n{\n var out=[];\n out.push("</channel></rss>");\n return out;\n}\n//}}}\n// //===\n\n// // +++[exportData()]\n//{{{\nfunction exportData(theList,theFormat)\n{\n // scan export listbox and collect DIVs or XML for selected tiddler content\n var out=[];\n for (var i=0; i<theList.options.length; i++) {\n // get item, skip non-selected items and section headings\n var opt=theList.options[i]; if (!opt.selected||(opt.value=="")) continue;\n // get tiddler, skip missing tiddlers (this should NOT happen)\n var thisTiddler=store.getTiddler(opt.value); if (!thisTiddler) continue; \n if (theFormat=="TW") out.push(convertUnicodeToUTF8(thisTiddler.saveToDiv()));\n if (theFormat=="DIV") out.push(convertUnicodeToUTF8(thisTiddler.title+"\sn"+thisTiddler.saveToDiv()));\n if (theFormat=="XML") out.push(convertUnicodeToUTF8(thisTiddler.saveToRss()));\n }\n return out;\n}\n//}}}\n// //===\n// //===\n\n// // +++[exportTiddlers(): output selected data to local or server]\n//{{{\nfunction exportTiddlers()\n{\n var theList = document.getElementById("exportList"); if (!theList) return;\n\n // get the export settings\n var theProtocol = document.getElementById("exportTo").value;\n var theFormat = document.getElementById("exportFormat").value;\n\n // assemble output: header + tiddlers + footer\n var theData=exportData(theList,theFormat);\n var count=theData.length;\n var out=[]; var txt=out.concat(exportHeader(theFormat),theData,exportFooter(theFormat)).join("\sn");\n var msg="";\n switch (theProtocol) {\n case "file:":\n var theTarget = document.getElementById("exportFilename").value.trim();\n if (!theTarget.length) msg = "A local path/filename is required\sn";\n if (!msg && saveFile(theTarget,txt))\n msg=count+" tiddler"+((count!=1)?"s":"")+" exported to local file";\n else if (!msg)\n msg+="An error occurred while saving to "+theTarget;\n break;\n case "http:":\n case "https:":\n var theTarget = document.getElementById("exportHTTPServerURL").value.trim();\n if (!theTarget.length) msg = "A server URL is required\sn";\n if (document.getElementById('exportNotify').checked)\n theTarget+="&notify="+encodeURIComponent(document.getElementById('exportNotifyTo').value);\n if (document.getElementById('exportNotes').value.trim().length)\n theTarget+="&notes="+encodeURIComponent(document.getElementById('exportNotes').value);\n if (!msg && exportPost(theTarget+encodeURIComponent(txt)))\n msg=count+" tiddler"+((count!=1)?"s":"")+" exported to "+theProtocol+" server";\n else if (!msg)\n msg+="An error occurred while saving to "+theTarget;\n break;\n case "ftp:":\n default:\n msg="Sorry, export to "+theLocation+" is not yet available";\n break;\n }\n clearMessage(); displayMessage(msg,theTarget);\n}\n//}}}\n// //===\n\n// // +++[exportPost(url): cross-domain post] uses hidden iframe to submit url and capture responses\n//{{{\nfunction exportPost(url)\n{\n var f=document.getElementById("exportFrame"); if (f) document.body.removeChild(f);\n f=document.createElement("iframe"); f.id="exportFrame";\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.location.replace(url);\n return true;\n}\n//}}}\n// //===\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
// // ''~GetVersion&Date'' Plugin\n// //Wordt gebruikt om de versie en datum van een plugin te bepalen.\n// //Maakt gebruik van 'version.extensions.xxx' in de plugin waarin deze macro gebruikt wordt\n\n/*\n{{{\n*/\n\nconfig.macros.getversion = {}\nconfig.macros.getversion.handler = function(place,macroName,params)\n{\nvar versionData = version.extensions[params].major + "." + version.extensions[params].minor + "." + version.extensions[params].revision;\ncreateTiddlyElement(place,"span",null,null,versionData);\n}\n\nconfig.macros.getversiondate = {}\nconfig.macros.getversiondate.handler = function(place,macroName,params)\n{\nvar versionDate = version.extensions[params[0]].date.formatString(params[1].trim());\ncreateTiddlyElement(place,"span",null,null,versionDate);\n}\n\n/*\n}}}\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
To upload a TiddlyWiki on your web server :\n\n#Import all tiddlers tagged with Upload from http://TiddlyWiki.bidix.info/#Upload\n#Install UploadPlugin //as usual//\n#Configure and upload [[store.php]] on your webserver\n#set a {{{<<upload>>}}} button for example in your SideBarOptions\n#Set UploadOptions in conformity with [[store.php]]\n#click on <<upload>> button\n
/***\n''Import Tiddlers Plugin for TiddlyWiki version 1.2.x and 2.0''\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!!!!!Inline interface (live)\n<<<\n<<importTiddlers inline>>\n<<<\n!!!!!Macro Syntax\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 filter source quiet ask force>>}}}\nnon-interactive 'automatic' import.\n''filter'' determines which tiddlers will be automatically selected for importing. Use one of the following keywords:\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>''"all"'' retrieves ALL tiddlers from the import source document, even if they have not been changed.\n''source'' is the location of the imported document. It can be either a local document or an URL:\n>filename is any local path/file, in whatever format your system requires\n>URL is any remote web location that starts with "http://" or "https://"\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''"ask"'' (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''"force"'' (optional)\n>ignores the importReplace and importPublic special tags (see below). Allows automatic importing and overwriting of tiddlers even when they have not been tagged accordingly. This is intended for use with TW files for which you have complete control of the content and can therefore be certain that importing all tiddlers into your document is 'safe'.\n\n''Special tag values: importReplace and importPublic''\n\nBy adding these special tags to an existing tiddler, you can precisely control whether or not to allow updates to that tiddler as well as decide which tiddlers in your document can be automatically imported by others.\n*''For maximum safety, the default action is to prevent existing tiddlers from being unintentionally overwritten by incoming tiddlers.'' To allow an existing tiddler to be overwritten by an imported tiddler, you must tag the existing tiddler with ''<<tag importReplace>>''\n*''For maximum privacy, the default action for //outgoing// tiddlers is to NOT automatically share your tiddlers with others.'' To allow a tiddler in your document to be shared via auto-import actions by others, you must tag it with ''<<tag importPublic>>''\n//Note: these tags are only applied when using the auto-import processing. When using the interactive control panel, all tiddlers in the imported document are available in the listbox, regardless of their tag values.//\n<<<\n!!!!!Interactive Usage\n<<<\nWhen used interactively, a control panel is displayed consisting of an "import source document" filename input (text field plus a ''[Browse...]'' button), a listbox of available tiddlers, a "differences only" checkbox, an "add tags" input field and four push buttons: ''[open]'', ''[select all]'', ''[import]'' and ''[close]''.\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!!!!!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.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\n// // Version\n//{{{\nversion.extensions.importTiddlers = {major: 2, minor: 9, revision: 1, date: new Date(2006,3,30)};\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// // IE needs explicit global scoping for functions/vars called from browser events\n//{{{\nwindow.onClickImportButton=onClickImportButton;\nwindow.loadImportFile=loadImportFile;\nwindow.refreshImportList=refreshImportList;\n//}}}\n\n// // default cookie/option values\n//{{{\nif (!config.options.chkImportReport) config.options.chkImportReport=true;\n//}}}\n\n\n// // ''MACRO DEFINITION''\n\n//{{{\nconfig.macros.importTiddlers = { };\nconfig.macros.importTiddlers = {\n label: "import tiddlers",\n prompt: "Copy tiddlers from another document",\n countMsg: "%0 tiddlers selected for import",\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 // LINK WITH FLOATING PANEL\n if (!params[0]) {\n createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);\n return;\n }\n // INLINE TIDDLER CONTENT\n if (params[0]=="inline") {\n createImportPanel(place);\n document.getElementById("importPanel").style.position="static";\n document.getElementById("importPanel").style.display="block";\n return;\n }\n // NON-INTERACTIVE BATCH MODE\n switch (params[0].substr(0,7)) {\n case 'all':\n case 'new':\n case 'changes':\n case 'updates':\n case 'tiddler':\n var filter=params.shift();\n break;\n default:\n var filter="updates";\n break;\n } \n if (!params[0]||!params[0].length) return; // filename is required\n config.macros.importTiddlers.src=params.shift();\n var quiet=(params[0]=="quiet"); if (quiet) params.shift();\n var ask=(params[0]=="ask"); if (ask) params.shift();\n var force=(params[0]=="force"); if (force) params.shift();\n config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer\n // load storeArea from a hidden IFRAME, then apply import rules and add/replace tiddlers\n loadImportFile(config.macros.importTiddlers.src,filter,quiet,ask,force,autoImportTiddlers);\n}\n//}}}\n\n// // ''READ TIDDLERS FROM ANOTHER DOCUMENT''\n\n//{{{\nfunction loadImportFile(src,filter,quiet,ask,force,callback) {\n if (!quiet) clearMessage();\n // LOCAL FILE\n if ((src.substr(0,7)!="http://")&&(src.substr(0,8)!="https://")) {\n if (!quiet) displayMessage("Opening local document: "+ src);\n var txt=loadFile(src);\n if(!txt) { if (!quiet) displayMessage("Could not open local document: "+src); }\n else {\n var start=txt.indexOf('<div id="storeArea">');\n var end=txt.indexOf('</body>');\n var sa="<html><body>"+txt.substring(start,end)+"</body></html>";\n if (!quiet) displayMessage(txt.length+" bytes in document. ("+sa.length+" bytes used for tiddler storage)");\n config.macros.importTiddlers.inbound = readImportedTiddlers(convertUTF8ToUnicode(sa));\n var count=config.macros.importTiddlers.inbound?config.macros.importTiddlers.inbound.length:0;\n if (!quiet) displayMessage("Found "+count+" tiddlers in "+src);\n if (callback) callback(src,filter,quiet,ask,force);\n }\n return;\n }\n // REMOTE FILE\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 var start=x.responseText.indexOf('<div id="storeArea">');\n var end=x.responseText.indexOf('</body>',start);\n var sa="<html><body>"+x.responseText.substring(start,end)+"</body></html>";\n if (!quiet) displayMessage(x.responseText.length+" bytes in document. ("+sa.length+" bytes used for tiddler storage)");\n config.macros.importTiddlers.inbound = readImportedTiddlers(sa);\n var count=config.macros.importTiddlers.inbound?config.macros.importTiddlers.inbound.length:0;\n if (!quiet) displayMessage("Found "+count+" tiddlers in "+src);\n if (callback) callback(src,filter,quiet,ask,force);\n }\n else\n if (!quiet) displayMessage("Could not open remote document:"+ src+" (error="+x.status+")");\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 if (config.macros.importTiddlers.useProxy) src=config.macros.importTiddlers.proxy+src;\n if (!quiet) displayMessage("Opening remote document: "+ src);\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("Could not open remote document: "+src);\n displayMessage(e.description?e.description:e.toString());\n }\n }\n}\n\nfunction readImportedTiddlers(txt)\n{\n var importedTiddlers = [];\n // create frame\n var f=document.getElementById("importFrame");\n if (f) document.body.removeChild(f);\n f=document.createElement("iframe");\n f.id="importFrame";\n f.style.width="0px"; f.style.height="0px"; f.style.border="0px";\n document.body.appendChild(f);\n // get document\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 // load source into document\n d.open(); d.writeln(txt); d.close();\n // read tiddler DIVs from storeArea DOM element \n var importStore = [];\n var importStoreArea = d.getElementById("storeArea");\n if (!importStoreArea || !(importStore=importStoreArea.childNodes) || (importStore.length==0)) { return null; }\n importStoreArea.normalize();\n for(var t = 0; t < importStore.length; t++) {\n var e = importStore[t];\n var title = null;\n if(e.getAttribute)\n title = e.getAttribute("tiddler");\n if(!title && e.id && (e.id.substr(0,5) == "store"))\n title = e.id.substr(5);\n if(title && title != "") {\n var theImported = new Tiddler();\n theImported.loadFromDiv(e,title);\n importedTiddlers.push(theImported);\n }\n }\n return importedTiddlers;\n}\n//}}}\n\n// // ''NON-INTERACTIVE IMPORT''\n\n// // import all/new/changed tiddlers into store, replacing or adding tiddlers as needed\n//{{{\nfunction autoImportTiddlers(src,filter,quiet,ask,force)\n{\n var count=0;\n if (config.macros.importTiddlers.inbound) for (var t=0;t<config.macros.importTiddlers.inbound.length;t++) {\n var theImported = config.macros.importTiddlers.inbound[t];\n var theExisting = store.getTiddler(theImported.title);\n\n // only import tiddlers if tagged with "importPublic"\n if (!force && theImported.tags && theImported.tags.find("importPublic")==null)\n { config.macros.importTiddlers.inbound[t].status=""; continue; } // status=="" means don't show in report\n\n // never import the "ImportedTiddlers" history from the other document...\n if (theImported.title=='ImportedTiddlers')\n { config.macros.importTiddlers.inbound[t].status=""; continue; } // status=="" means don't show in report\n\n // check existing tiddler for importReplace, or systemConfig tags\n config.macros.importTiddlers.inbound[t].status="added"; // default - add any tiddlers not filtered out\n if (store.tiddlerExists(theImported.title)) {\n config.macros.importTiddlers.inbound[t].status="replaced";\n if (!force && (!theExisting.tags||(theExisting.tags.find("importReplace")==null)))\n { config.macros.importTiddlers.inbound[t].status="not imported - tiddler already exists (use importReplace to allow changes)"; continue; }\n if ((theExisting.tags.find("systemConfig")!=null)||(theImported.tags.find("systemConfig")!=null))\n config.macros.importTiddlers.inbound[t].status+=" - WARNING: an active systemConfig plugin has been added or updated";\n }\n\n // apply the all/new/changes/updates filter \n if (filter!="all") {\n if ((filter=="new") && store.tiddlerExists(theImported.title))\n { config.macros.importTiddlers.inbound[t].status="not imported - tiddler already exists"; continue; }\n if ((filter=="changes") && !store.tiddlerExists(theImported.title))\n { config.macros.importTiddlers.inbound[t].status="not imported - new tiddler"; continue; }\n if ((filter.substr(0,8)=="tiddler:") && theImported.title!=filter.substr(8))\n { config.macros.importTiddlers.inbound[t].status=""; continue; }\n if (store.tiddlerExists(theImported.title) && ((theExisting.modified.getTime()-theImported.modified.getTime())>=0))\n { config.macros.importTiddlers.inbound[t].status="not imported - tiddler is unchanged"; continue; }\n }\n\n // get confirmation if required\n if (ask && !confirm("Import "+(theExisting?"updated":"new")+" tiddler '"+theImported.title+"'\snfrom "+src))\n { config.macros.importTiddlers.inbound[t].status="skipped - cancelled by user"; continue; }\n\n // DO THE IMPORT!!\n store.addTiddler(theImported); count++;\n }\n importReport(quiet); // generate a report (as needed) and display it if not 'quiet'\n if (count) store.setDirty(true); \n // always show final message when tiddlers were actually imported\n if (!quiet||count) displayMessage("Imported "+count+" tiddler"+(count!=1?"s":"")+" from "+src);\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n\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 Ask panel will still be open... close it now.\n var askpanel=document.getElementById('importAskPanel'); if (askpanel) askpanel.style.display='none'; \n // get the alphasorted list of 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 // gather the statistics\n var count=tiddlers.length;\n var added=0; var replaced=0; var renamed=0; var skipped=0; var merged=0;\n for (var t=0; t<count; t++)\n if (tiddlers[t].status)\n {\n if (tiddlers[t].status=='added') added++;\n if (tiddlers[t].status.substr(0,7)=='skipped') skipped++;\n if (tiddlers[t].status.substr(0,6)=='rename') renamed++;\n if (tiddlers[t].status.substr(0,7)=='replace') replaced++;\n if (tiddlers[t].status.substr(0,6)=='merged') merged++;\n }\n var omitted=count-(added+replaced+renamed+skipped+merged);\n // DEBUG alert('stats done: '+count+' total, '+added+' added, '+skipped+' skipped, '+renamed+' renamed, '+replaced+' replaced, '+merged+' merged');\n // skip the report if nothing was imported\n if (added+replaced+renamed+merged==0) return;\n // skip the report if not desired by user\n if (!config.options.chkImportReport) {\n // reset status flags\n for (var t=0; t<count; t++) config.macros.importTiddlers.inbound[t].status="";\n // refresh display since tiddlers have been imported\n store.notifyAll();\n // quick message area summary report\n var msg=(added+replaced+renamed+merged)+' of '+count+' tiddler'+((count!=1)?'s':"");\n msg+=' imported from '+config.macros.importTiddlers.src.replace(/\s\s/g,'/')\n displayMessage(msg);\n return;\n }\n // create the report tiddler (if not already present)\n var tiddler = store.getTiddler('ImportedTiddlers');\n if (!tiddler) // create new report tiddler if it doesn't exist\n {\n tiddler = new Tiddler();\n tiddler.title = 'ImportedTiddlers';\n tiddler.text = "";\n }\n // format the report header\n var now = new Date();\n var newText = "";\n newText += "On "+now.toLocaleString()+", "+config.options.txtUserName+" imported tiddlers from\sn";\n newText += "[["+config.macros.importTiddlers.src+"|"+config.macros.importTiddlers.src+"]]:\sn";\n newText += "<"+"<"+"<\sn";\n newText += "Out of "+count+" tiddler"+((count!=1)?"s ":" ")+" in {{{"+config.macros.importTiddlers.src.replace(/\s\s/g,'/')+"}}}:\sn";\n if (added+renamed>0)\n newText += (added+renamed)+" new tiddler"+(((added+renamed)!=1)?"s were":" was")+" added to your document.\sn";\n if (merged>0)\n newText += merged+" tiddler"+((merged!=1)?"s were":" was")+" merged with "+((merged!=1)?"":"an ")+"existing tiddler"+((merged!=1)?"s":"")+".\sn"; \n if (replaced>0)\n newText += replaced+" existing tiddler"+((replaced!=1)?"s were":" was")+" replaced.\sn"; \n if (skipped>0)\n newText += skipped+" tiddler"+((skipped!=1)?"s were":" was")+" skipped after asking.\sn"; \n if (omitted>0)\n newText += omitted+" tiddler"+((omitted!=1)?"s":"")+((omitted!=1)?" were":" was")+" not imported.\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 // output the tiddler detail and reset status flags\n for (var t=0; t<count; t++)\n if (tiddlers[t].status!="")\n {\n newText += "#["+"["+tiddlers[t].title+"]"+"]";\n newText += ((tiddlers[t].status!="added")?("^^\sn"+tiddlers[t].status+"^^"):"")+"\sn";\n config.macros.importTiddlers.inbound[t].status="";\n }\n newText += "<"+"<"+"<\sn";\n // output 'discard report' link\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+tiddler.title+"'); store.deleteTiddler('"+tiddler.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n tiddler.text = newText+((tiddler.text!="")?'\sn----\sn':"")+tiddler.text;\n tiddler.modifier = config.options.txtUserName;\n tiddler.modified = new Date();\n store.addTiddler(tiddler);\n if (!quiet) story.displayTiddler(null,"ImportedTiddlers",1,null,null,false);\n story.refreshTiddler("ImportedTiddlers",1,true);\n // refresh the display\n store.notifyAll();\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#importAskPanel { 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 &nbsp;all&nbsp;</a>\s\n <a href="JavaScript:;" id="importSelectNew"\s\n onclick="onClickImportButton(this)" title="select tiddlers not already in destination document">\s\n &nbsp;added&nbsp;</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 &nbsp;changes&nbsp;</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 &nbsp;differences&nbsp;</a> \s\n <a href="JavaScript:;" id="importToggleFilter"\s\n onclick="onClickImportButton(this)" title="show/hide selection filter">\s\n &nbsp;filter&nbsp;</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 &nbsp;&#150;&nbsp;</a>\s\n <a href="JavaScript:;" id="importListLarger"\s\n onclick="onClickImportButton(this)" title="increase list size">\s\n &nbsp;+&nbsp;</a>\s\n <a href="JavaScript:;" id="importListMaximize"\s\n onclick="onClickImportButton(this)" title="maximize/restore list size">\s\n &nbsp;=&nbsp;</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 &nbsp;\s\n<input type=checkbox class="chk" id="chkImportTags" checked\s\n onClick="config.macros.importTiddlers.importTags=this.checked;">import source tags &nbsp;\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="importAskPanel">\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// // 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 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// // 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 theAskPanel = document.getElementById('importAskPanel');\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 loadImportFile(config.macros.importTiddlers.src,"all",null,null,null,function(){window.refreshImportList(0);});\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 theAskPanel.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 theAskPanel.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: [['+config.macros.importTiddlers.src+'#'+theItem.value+'|'+config.macros.importTiddlers.src+'#'+theItem.value+']]^^\sn^^'+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 hh:mm:ss");\n theImported.status += ' by '+theExisting.modifier;\n theAskPanel.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 hh:mm:ss");\n theImported.status += ' by '+theExisting.modifier;\n theAskPanel.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// // 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 ask panel and set the title edit field\n document.getElementById('importAskPanel').style.display='block';\n theNewTitle.value=theList.options[config.macros.importTiddlers.index].value;\n }\n}\n//}}}\n
/***\n''Import Tiddlers Plugin for TiddlyWiki version 1.2.x and 2.0''\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!!!!!Inline interface (live)\n<<<\n<<importTiddlers inline>>\n<<<\n!!!!!Macro Syntax\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 filter source quiet ask>>}}}\nnon-interactive 'automatic' import.\n''filter'' determines which tiddlers will be automatically selected for importing. Use one of the following keywords:\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>''"all"'' retrieves ALL tiddlers from the import source document, even if they have not been changed.\n''source'' is the location of the imported document. It can be either a local document or an URL:\n>filename is any local path/file, in whatever format your system requires\n>URL is any remote web location that starts with "http://" or "https://"\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''"ask"'' (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''Special tag values: importReplace and importPublic''\n\nBy adding these special tags to an existing tiddler, you can precisely control whether or not to allow updates to that tiddler as well as decide which tiddlers in your document can be automatically imported by others.\n*''For maximum safety, the default action is to prevent existing tiddlers from being unintentionally overwritten by incoming tiddlers.'' To allow an existing tiddler to be overwritten by an imported tiddler, you must tag the existing tiddler with ''<<tag importReplace>>''\n*''For maximum privacy, the default action for //outgoing// tiddlers is to NOT automatically share your tiddlers with others.'' To allow a tiddler in your document to be shared via auto-import actions by others, you must tag it with ''<<tag importPublic>>''\n//Note: these tags are only applied when using the auto-import processing. When using the interactive control panel, all tiddlers in the imported document are available in the listbox, regardless of their tag values.//\n<<<\n!!!!!Interactive Usage\n<<<\nWhen used interactively, a control panel is displayed consisting of an "import source document" filename input (text field plus a ''[Browse...]'' button), a listbox of available tiddlers, a "differences only" checkbox, an "add tags" input field and four push buttons: ''[open]'', ''[select all]'', ''[import]'' and ''[close]''.\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!!!!!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.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\n// // Version\n//{{{\nversion.extensions.importTiddlers = {major: 2, minor: 8, revision: 0, date: new Date(2006,3,12)};\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// // IE needs explicit global scoping for functions/vars called from browser events\n//{{{\nwindow.onClickImportButton=onClickImportButton;\nwindow.loadImportFile=loadImportFile;\nwindow.refreshImportList=refreshImportList;\n//}}}\n\n// // default cookie/option values\n//{{{\nif (!config.options.chkImportReport) config.options.chkImportReport=true;\n//}}}\n\n\n// // ''MACRO DEFINITION''\n\n//{{{\nconfig.macros.importTiddlers = { };\nconfig.macros.importTiddlers = {\n label: "import tiddlers",\n prompt: "Copy tiddlers from another document",\n countMsg: "%0 tiddlers selected for import",\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 // LINK WITH FLOATING PANEL\n if (!params[0]) {\n createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);\n return;\n }\n // INLINE TIDDLER CONTENT\n if (params[0]=="inline") {\n createImportPanel(place);\n document.getElementById("importPanel").style.position="static";\n document.getElementById("importPanel").style.display="block";\n return;\n }\n // NON-INTERACTIVE BATCH MODE\n switch (params[0].substr(0,7)) {\n case 'all':\n case 'new':\n case 'changes':\n case 'updates':\n case 'tiddler':\n var filter=params.shift();\n break;\n default:\n var filter="updates";\n break;\n } \n if (!params[0]||!params[0].length) return; // filename is required\n config.macros.importTiddlers.src=params.shift();\n var quiet=(params[0]=="quiet"); if (quiet) params.shift();\n var ask=(params[0]=="ask"); if (ask) params.shift();\n config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer\n // load storeArea from a hidden IFRAME, then apply import rules and add/replace tiddlers\n loadImportFile(config.macros.importTiddlers.src,filter,quiet,ask,autoImportTiddlers);\n}\n//}}}\n\n// // ''READ TIDDLERS FROM ANOTHER DOCUMENT''\n\n//{{{\nfunction loadImportFile(src,filter,quiet,ask,callback) {\n if (!quiet) clearMessage();\n // LOCAL FILE\n if ((src.substr(0,7)!="http://")&&(src.substr(0,8)!="https://")) {\n if (!quiet) displayMessage("Opening local document: "+ src);\n var txt=loadFile(src);\n if(!txt) { if (!quiet) displayMessage("Could not open local document: "+src); }\n else {\n var s="<html><body>"+txt.substr(txt.indexOf('<div id="storeArea">'));\n if (!quiet) displayMessage(txt.length+" bytes in document. ("+s.length+" bytes used for tiddler storage)");\n config.macros.importTiddlers.inbound = readImportedTiddlers(convertUTF8ToUnicode(s));\n var count=config.macros.importTiddlers.inbound?config.macros.importTiddlers.inbound.length:0;\n if (!quiet) displayMessage("Found "+count+" tiddlers in "+src);\n if (callback) callback(src,filter,quiet,ask);\n }\n return;\n }\n // REMOTE FILE\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 var sa="<html><body>"+x.responseText.substr(x.responseText.indexOf('<div id="storeArea">'));\n if (!quiet) displayMessage(x.responseText.length+" bytes in document. ("+sa.length+" bytes used for tiddler storage)");\n config.macros.importTiddlers.inbound = readImportedTiddlers(sa);\n var count=config.macros.importTiddlers.inbound?config.macros.importTiddlers.inbound.length:0;\n if (!quiet) displayMessage("Found "+count+" tiddlers in "+src);\n if (callback) callback(src,filter,quiet,ask);\n }\n else\n if (!quiet) displayMessage("Could not open remote document:"+ src+" (error="+x.status+")");\n }\n }\n if (document.location.protocol=="file:") { // 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 if (config.macros.importTiddlers.useProxy) src=config.macros.importTiddlers.proxy+src;\n if (!quiet) displayMessage("Opening remote document: "+ src);\n try {\n var url=src+(src.indexOf('?')<0?'?':'&')+'nocache='+Math.random();\n x.open("GET",url,true);\n x.overrideMimeType('text/html');\n x.send(null);\n }\n catch (e) {\n if (!quiet) {\n displayMessage("Could not open remote document: "+src);\n displayMessage(e.description?e.description:e.toString());\n }\n }\n}\n\nfunction readImportedTiddlers(txt)\n{\n var importedTiddlers = [];\n // create frame\n var f=document.getElementById("importFrame");\n if (f) document.body.removeChild(f);\n f=document.createElement("iframe");\n f.id="importFrame";\n f.style.width="0px"; f.style.height="0px"; f.style.border="0px";\n document.body.appendChild(f);\n // get document\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 // load source into document\n d.open(); d.writeln(txt); d.close();\n // read tiddler DIVs from storeArea DOM element \n var importStore = [];\n var importStoreArea = d.getElementById("storeArea");\n if (!importStoreArea || !(importStore=importStoreArea.childNodes) || (importStore.length==0)) { return null; }\n importStoreArea.normalize();\n for(var t = 0; t < importStore.length; t++) {\n var e = importStore[t];\n var title = null;\n if(e.getAttribute)\n title = e.getAttribute("tiddler");\n if(!title && e.id && (e.id.substr(0,5) == "store"))\n title = e.id.substr(5);\n if(title && title != "") {\n var theImported = new Tiddler();\n theImported.loadFromDiv(e,title);\n importedTiddlers.push(theImported);\n }\n }\n return importedTiddlers;\n}\n//}}}\n\n// // ''NON-INTERACTIVE IMPORT''\n\n// // import all/new/changed tiddlers into store, replacing or adding tiddlers as needed\n//{{{\nfunction autoImportTiddlers(src,filter,quiet,ask)\n{\n var count=0;\n if (config.macros.importTiddlers.inbound) for (var t=0;t<config.macros.importTiddlers.inbound.length;t++) {\n var theImported = config.macros.importTiddlers.inbound[t];\n var theExisting = store.getTiddler(theImported.title);\n\n // only import tiddlers if tagged with "importPublic"\n if (theImported.tags && theImported.tags.find("importPublic")==null)\n { config.macros.importTiddlers.inbound[t].status=""; continue; } // status=="" means don't show in report\n\n // never import the "ImportedTiddlers" history from the other document...\n if (theImported.title=='ImportedTiddlers')\n { config.macros.importTiddlers.inbound[t].status=""; continue; } // status=="" means don't show in report\n\n // check existing tiddler for importReplace, or systemConfig tags\n config.macros.importTiddlers.inbound[t].status="added"; // default - add any tiddlers not filtered out\n if (store.tiddlerExists(theImported.title)) {\n config.macros.importTiddlers.inbound[t].status="replaced";\n if (!theExisting.tags||(theExisting.tags.find("importReplace")==null))\n { config.macros.importTiddlers.inbound[t].status="not imported - tiddler already exists (use importReplace to allow changes)"; continue; }\n if ((theExisting.tags.find("systemConfig")!=null)||(theImported.tags.find("systemConfig")!=null))\n config.macros.importTiddlers.inbound[t].status+=" - WARNING: an active systemConfig plugin has been added or updated";\n }\n\n // apply the all/new/changes/updates filter \n if (filter!="all") {\n if ((filter=="new") && store.tiddlerExists(theImported.title))\n { config.macros.importTiddlers.inbound[t].status="not imported - tiddler already exists"; continue; }\n if ((filter=="changes") && !store.tiddlerExists(theImported.title))\n { config.macros.importTiddlers.inbound[t].status="not imported - new tiddler"; continue; }\n if ((filter.substr(0,8)=="tiddler:") && theImported.title!=filter.substr(8))\n { config.macros.importTiddlers.inbound[t].status=""; continue; }\n if (store.tiddlerExists(theImported.title) && ((theExisting.modified.getTime()-theImported.modified.getTime())>=0))\n { config.macros.importTiddlers.inbound[t].status="not imported - tiddler is unchanged"; continue; }\n }\n\n // get confirmation if required\n if (ask && !confirm("Import "+(theExisting?"updated":"new")+" tiddler '"+theImported.title+"'\snfrom "+src))\n { config.macros.importTiddlers.inbound[t].status="skipped - cancelled by user"; continue; }\n\n // DO THE IMPORT!!\n store.addTiddler(theImported); count++;\n }\n importReport(quiet); // generate a report (as needed) and display it if not 'quiet'\n if (count) store.setDirty(true); \n // always show final message when tiddlers were actually imported\n if (!quiet||count) displayMessage("Imported "+count+" tiddler"+(count!=1?"s":"")+" from "+src);\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n\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 Ask panel will still be open... close it now.\n var askpanel=document.getElementById('importAskPanel'); if (askpanel) askpanel.style.display='none'; \n // get the alphasorted list of 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 // gather the statistics\n var count=tiddlers.length;\n var added=0; var replaced=0; var renamed=0; var skipped=0; var merged=0;\n for (var t=0; t<count; t++)\n if (tiddlers[t].status)\n {\n if (tiddlers[t].status=='added') added++;\n if (tiddlers[t].status.substr(0,7)=='skipped') skipped++;\n if (tiddlers[t].status.substr(0,6)=='rename') renamed++;\n if (tiddlers[t].status.substr(0,7)=='replace') replaced++;\n if (tiddlers[t].status.substr(0,6)=='merged') merged++;\n }\n var omitted=count-(added+replaced+renamed+skipped+merged);\n // DEBUG alert('stats done: '+count+' total, '+added+' added, '+skipped+' skipped, '+renamed+' renamed, '+replaced+' replaced, '+merged+' merged');\n // skip the report if nothing was imported\n if (added+replaced+renamed+merged==0) return;\n // skip the report if not desired by user\n if (!config.options.chkImportReport) {\n // reset status flags\n for (var t=0; t<count; t++) config.macros.importTiddlers.inbound[t].status="";\n // refresh display since tiddlers have been imported\n store.notifyAll();\n // quick message area summary report\n var msg=(added+replaced+renamed+merged)+' of '+count+' tiddler'+((count!=1)?'s':"");\n msg+=' imported from '+config.macros.importTiddlers.src.replace(/\s\s/g,'/')\n displayMessage(msg);\n return;\n }\n // create the report tiddler (if not already present)\n var tiddler = store.getTiddler('ImportedTiddlers');\n if (!tiddler) // create new report tiddler if it doesn't exist\n {\n tiddler = new Tiddler();\n tiddler.title = 'ImportedTiddlers';\n tiddler.text = "";\n }\n // format the report header\n var now = new Date();\n var newText = "";\n newText += "On "+now.toLocaleString()+", "+config.options.txtUserName+" imported tiddlers from\sn";\n newText += "[["+config.macros.importTiddlers.src+"|"+config.macros.importTiddlers.src+"]]:\sn";\n newText += "<"+"<"+"<\sn";\n newText += "Out of "+count+" tiddler"+((count!=1)?"s ":" ")+" in {{{"+config.macros.importTiddlers.src.replace(/\s\s/g,'/')+"}}}:\sn";\n if (added+renamed>0)\n newText += (added+renamed)+" new tiddler"+(((added+renamed)!=1)?"s were":" was")+" added to your document.\sn";\n if (merged>0)\n newText += merged+" tiddler"+((merged!=1)?"s were":" was")+" merged with "+((merged!=1)?"":"an ")+"existing tiddler"+((merged!=1)?"s":"")+".\sn"; \n if (replaced>0)\n newText += replaced+" existing tiddler"+((replaced!=1)?"s were":" was")+" replaced.\sn"; \n if (skipped>0)\n newText += skipped+" tiddler"+((skipped!=1)?"s were":" was")+" skipped after asking.\sn"; \n if (omitted>0)\n newText += omitted+" tiddler"+((omitted!=1)?"s":"")+((omitted!=1)?" were":" was")+" not imported.\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 // output the tiddler detail and reset status flags\n for (var t=0; t<count; t++)\n if (tiddlers[t].status!="")\n {\n newText += "#["+"["+tiddlers[t].title+"]"+"]";\n newText += ((tiddlers[t].status!="added")?("^^\sn"+tiddlers[t].status+"^^"):"")+"\sn";\n config.macros.importTiddlers.inbound[t].status="";\n }\n newText += "<"+"<"+"<\sn";\n // output 'discard report' link\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+tiddler.title+"'); store.deleteTiddler('"+tiddler.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n tiddler.text = newText+((tiddler.text!="")?'\sn----\sn':"")+tiddler.text;\n tiddler.modifier = config.options.txtUserName;\n tiddler.modified = new Date();\n store.addTiddler(tiddler);\n if (!quiet) story.displayTiddler(null,"ImportedTiddlers",1,null,null,false);\n story.refreshTiddler("ImportedTiddlers",1,true);\n // refresh the display\n store.notifyAll();\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#importAskPanel { 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 &nbsp;all&nbsp;</a>\s\n <a href="JavaScript:;" id="importSelectNew"\s\n onclick="onClickImportButton(this)" title="select tiddlers not already in destination document">\s\n &nbsp;added&nbsp;</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 &nbsp;changes&nbsp;</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 &nbsp;differences&nbsp;</a> \s\n <a href="JavaScript:;" id="importToggleFilter"\s\n onclick="onClickImportButton(this)" title="show/hide selection filter">\s\n &nbsp;filter&nbsp;</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 &nbsp;&#150;&nbsp;</a>\s\n <a href="JavaScript:;" id="importListLarger"\s\n onclick="onClickImportButton(this)" title="increase list size">\s\n &nbsp;+&nbsp;</a>\s\n <a href="JavaScript:;" id="importListMaximize"\s\n onclick="onClickImportButton(this)" title="maximize/restore list size">\s\n &nbsp;=&nbsp;</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 &nbsp;\s\n<input type=checkbox class="chk" id="chkImportTags" checked\s\n onClick="config.macros.importTiddlers.importTags=this.checked;">import source tags &nbsp;\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="importAskPanel">\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// // 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 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// // 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 theAskPanel = document.getElementById('importAskPanel');\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 loadImportFile(config.macros.importTiddlers.src,"all",null,null,function(src,filter,quiet,ask){window.refreshImportList(0);});\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 theAskPanel.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 theAskPanel.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: [['+config.macros.importTiddlers.src+'#'+theItem.value+'|'+config.macros.importTiddlers.src+'#'+theItem.value+']]^^\sn^^'+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 hh:mm:ss");\n theImported.status += ' by '+theExisting.modifier;\n theAskPanel.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 hh:mm:ss");\n theImported.status += ' by '+theExisting.modifier;\n theAskPanel.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// // 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 ask panel and set the title edit field\n document.getElementById('importAskPanel').style.display='block';\n theNewTitle.value=theList.options[config.macros.importTiddlers.index].value;\n }\n}\n//}}}\n
On woensdag 28 juni 2006 9:32:34, HaraldvanKesteren imported tiddlers from\n[[C:\sTMP\sTW\sLCMGTiddlelog_v5.htm|C:\sTMP\sTW\sLCMGTiddlelog_v5.htm]]:\n<<<\nOut of 655 tiddlers in {{{C:/TMP/TW/LCMGTiddlelog_v5.htm}}}:\n41 new tiddlers were added to your document.\n614 tiddlers were not imported.\n#[[AliasPlugin]]\n#[[AttachFilePlugin]]\n#[[AutoSyncPlugin]]\n#[[AutoTaggerPlugin]]\n#[[BreadcrumbsPlugin]]\n#[[CalendarConfig]]\n#[[CalendarPlugin]]\n#[[CheckboxPlugin]]\n#[[CollapseTiddlersPlugin]]\n#[[CollapsedTemplate]]\n#[[ConfigTweaks]]\n#[[ConfirmExitPlugin]]\n#[[CopyTiddlerPlugin]]\n#[[DatePlugin]]\n#[[DisableWikiLinksPlugin]]\n#[[DocumentChanges]]\n#[[ExportTiddlersPlugin]]\n#[[ForEachTiddlerPlugin]]\n#[[GetVersion&Date]]\n#[[HTMLFormattingPlugin]]\n#[[ImportTiddlersPlugin]]\n#[[InlineJavascriptPlugin]]\n#[[NederlandsPlugin]]\n#[[NestedSlidersPlugin]]\n#[[NewDocumentPlugin]]\n#[[QuoteOfTheDayPlugin]]\n#[[ReminderMacros]]\n#[[SaveOnExitPlugin]]\n#[[SearchOptionsPlugin]]\n#[[SelectStylesheetPlugin]]\n#[[SinglePageModePlugin]]\n#[[SystemTweaks]]\n#[[TableOfContentsPlugin]]\n#[[TagCloudPlugin]]\n#[[TextAreaPlugin]]\n#[[TiddlerStatsPlugin]]\n#[[TiddlerTemplatesMacros]]\n#[[TiddlerWithParamsPlugin]]\n#[[ToolkitPlugin]]\n#[[UnformattedTextPlugin]]\n#[[WebTemplatePlugin]]\n<<<\n<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
/***\n''InlineJavascriptPlugin for ~TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#InlineJavascriptPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nInsert Javascript executable code directly into your tiddler content. Lets you ''call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.\n!!!!!Usage\n<<<\nWhen installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.\n\n''Deferred execution from an 'onClick' link''\nBy including a label="..." parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered.\n\n''External script source files:''\nYou can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.\n\n''Defining javascript functions and libraries:''\nAlthough the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed. Thus, you cannot load a library and //immediately// use it's functions within the same tiddler. However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).\n\nTo ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened. For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.\n\nSince the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines. Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.\n\n''Creating dynamic tiddler content''\nAn important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:\n* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.\n* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.\n* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.\n\nIf your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display. For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.\n\n//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//\n\n''Accessing the ~TiddlyWiki DOM''\nThe plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.\n\nAccess to this DOM element allows you to create scripts that can:\n* vary their actions based upon the specific location in which they are embedded\n* access 'tiddler-relative' information (use findContainingTiddler(place))\n* perform direct DOM manipulations (when returning wikified text is not enough)\n<<<\n!!!!!Examples\n<<<\nan "alert" message box:\n{{{\n<script>alert('InlineJavascriptPlugin: this is a demonstration message');</script>\n}}}\n<script>alert('InlineJavascriptPlugin: this is a demonstration message');</script>\n\ndynamic output:\n{{{\n<script>return (new Date()).toString();</script>\n}}}\n<script>return (new Date()).toString();</script>\n\nwikified dynamic output:\n{{{\n<script>return "link to current user: [["+config.options.txtUserName+"]]";</script>\n}}}\n<script>return "link to current user: [["+config.options.txtUserName+"]]";</script>\n\ndynamic output using 'place' to get size information for current tiddler\n{{{\n<script>\n if (!window.story) window.story=window;\n var title=story.findContainingTiddler(place).id.substr(7);\n return title+" is using "+store.getTiddlerText(title).length+" bytes";\n</script>\n}}}\n<script>\n if (!window.story) window.story=window;\n var title=story.findContainingTiddler(place).id.substr(7);\n return title+" is using "+store.getTiddlerText(title).length+" bytes";\n</script>\n\ncreating an 'onclick' button/link that runs a script\n{{{\n<script label="click here">\n if (!window.story) window.story=window;\n alert("Hello World!\snlinktext='"+place.firstChild.data+"'\sntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");\n</script>\n}}}\n<script label="click here">\n if (!window.story) window.story=window;\n alert("Hello World!\snlinktext='"+place.firstChild.data+"'\sntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");\n</script>\n\nloading a script from a source url\n{{{\n<script src="demo.js">return "loading demo.js..."</script>\n<script label="click to execute demo() function">demo()</script>\n}}}\nwhere http://www.TiddlyTools.com/demo.js contains:\n>function demo() { alert('this output is from demo(), defined in demo.js') }\n>alert('InlineJavascriptPlugin: demo.js has been loaded');\n<script src="demo.js">return "loading demo.js..."</script>\n<script label="click to execute demo() function">demo()</script>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.01.05 [1.4.0]''\nadded support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.\n''2005.12.13 [1.3.1]''\nwhen catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by UdoBorkowski\n''2005.11.09 [1.3.0]''\nfor 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content\nBased on a suggestion by BradleyMeck\n''2005.11.08 [1.2.0]''\nhandle loading of javascript from an external URL via src="..." syntax\n''2005.11.08 [1.1.0]''\npass 'place' param into scripts to provide direct DOM access \n''2005.11.08 [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//{{{\nversion.extensions.inlineJavascript= {major: 1, minor: 4, revision: 0, date: new Date(2006,1,5)};\n\nconfig.formatters.push( {\n name: "inlineJavascript",\n match: "\s\s<script",\n lookahead: "\s\s<script(?: src=\s\s\s"((?:.|\s\sn)*?)\s\s\s")?(?: label=\s\s\s"((?:.|\s\sn)*?)\s\s\s")?\s\s>((?:.|\s\sn)*?)\s\s</script\s\s>",\n\n 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 if (lookaheadMatch[1]) { // load a script library\n // make script tag, set src, add to body to execute, then remove for cleanup\n var script = document.createElement("script"); script.src = lookaheadMatch[1];\n document.body.appendChild(script); document.body.removeChild(script);\n }\n if (lookaheadMatch[2] && lookaheadMatch[3]) { // create a link to an 'onclick' script\n // add a link, define click handler, save code in link (pass 'place'), set link attributes\n var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);\n link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}\n link.code="function _out(place){"+lookaheadMatch[3]+"};_out(this);"\n link.setAttribute("href","javascript:;"); link.setAttribute("title",""); link.style.cursor="pointer";\n }\n else if (lookaheadMatch[3]) { // run inline script code\n var code="function _out(place){"+lookaheadMatch[3]+"};_out(w.output);"\n code=code.replace(/document.write\s(/gi,'place.innerHTML+=(');\n try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }\n if (out && out.length) wikify(out,w.output);\n }\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n} )\n//}}}\n
http://www.softick.com/bluefiles/ voor een Bluetooth wireless drive op je Palm Treo650 (betaald)\n\nhttp://en.pdassi.com/13639 nog een voorbeeld (freeware)\n\n
{{{\n\nconfig.commands.cancelTiddler.text = "cancel";\nconfig.commands.cancelTiddler.tooltip = "Negeer de gemaakte wijzigingen aan deze tiddler";\nconfig.commands.closeOthers.text = "sluit anderen";\nconfig.commands.closeOthers.tooltip = "Sluit alle andere tiddlers";\nconfig.commands.closeTiddler.text = "sluit";\nconfig.commands.closeTiddler.tooltip = "Sluit deze tiddler";\nconfig.commands.deleteTiddler.text = "verwijder";\nconfig.commands.deleteTiddler.tooltip = "Verwijder deze tiddler";\nconfig.commands.deleteTiddler.warning = "Weet je zeker dat je tiddler '%0' permanent wilt verwijderen?";\nconfig.commands.editTiddler.text = "edit";\nconfig.commands.editTiddler.tooltip = "Maak wijzigingen in de tekst";\nconfig.commands.editTiddler.readOnlyText = "bekijk";\nconfig.commands.editTiddler.readOnlyTooltip = "Bekijk de bron van deze tiddler";\nconfig.commands.jump.text = "spring";\nconfig.commands.jump.tooltip = "Spring naar een andere open tiddler";\nconfig.commands.permalink.text = "permalink";\nconfig.commands.permalink.tooltip = "De permanente verwijzing naar deze tiddler";\nconfig.commands.references.text = "referenties";\nconfig.commands.references.tooltip = "Een lijst van tiddlers die naar deze verwijzen";\nconfig.commands.references.popupNone = "Geen referenties";\nconfig.commands.saveTiddler.text = "bewaar";\nconfig.commands.saveTiddler.tooltip = "Sla de wijzigingen in de tekst op";\nconfig.commands.saveTiddler.readOnlyText = "klaar";\nconfig.commands.saveTiddler.tooltip = "Bekijk deze tiddler weer normaal";\nconfig.commands.StyleSheet = "/***\snMaak op deze plaats je eigen aangepaste CSS \sn***/\sn/*{{{*/\sn\sn/*}}}*/\sn";\nconfig.macros.allTags.noTags = "Er zijn geen tiddlers met tag";\nconfig.macros.allTags.tooltip = "Laat tiddlers zien met de tag:";\nconfig.macros.closeAll.label = "sluit alles";\nconfig.macros.closeAll.prompt = "sluit alle tiddlers in de weergaven (behalve die worden aangepast)";\nconfig.macros.list.all.prompt = "Alle tiddlers op alfabetische volgorde";\nconfig.macros.list.missing.prompt = "Tiddlers met een verwijzing maar die nog gedefineerd moeten worden";\nconfig.macros.list.orphans.prompt = "Tiddlers zonder verwijzing vanuit andere tiddlers";\nconfig.macros.list.shadowed.prompt = "Tiddlers geschaduwd met standaard waarde";\nconfig.macros.newJournal.label = "nieuw log";\nconfig.macros.newJournal.prompt = "Creer een nieuwe tiddler met de datum van vandaag";\nconfig.macros.newTiddler.label = "nieuwe tiddler";\nconfig.macros.newTiddler.prompt = "Maak een nieuwe tiddler";\nconfig.macros.newTiddler.title = "NieuweTiddler";\nconfig.macros.permaview.label = "permaview";\nconfig.macros.permaview.prompt = "Wijzigt de link in de adresbalk zodat er een permanente verwijzing naar alle momenteel geopende tiddlers ontstaat";\nconfig.macros.saveChanges.label = "bewaar wijzigingen";\nconfig.macros.saveChanges.prompt = "Sla alle gewijzigde tiddlers op om een nieuwe TiddlyWiki te creëren";\nconfig.macros.search.label = "zoek";\nconfig.macros.search.prompt = "Zoek binnen deze TiddlyWiki";\nconfig.macros.search.successMsg = "%0 tiddlers gevonden die voldoen aan zoekterm: %1";\nconfig.macros.search.failureMsg = "Geen tiddlers gevonden die voldoen aan: %0";\nconfig.macros.tagging.label = "taggend";\nconfig.macros.tagging.labelNotTag = "niet taggend";\nconfig.macros.tagging.tooltip = "Lijst van tiddlers getagd met'%0'";\nconfig.macros.timeline.dateFormat = "DD MMM YYYY";\n\nconfig.messages.backupFailed = "Fout tijdens opslaan van het backup bestand";\nconfig.messages.backupSaved = "Backup bestand is opgeslagen";\nconfig.messages.cantSaveError = "Het is helaas niet mogelijke de wijzigingen te bewaren. Dit komt mogelijk doordat de gebruikte browser bewaren niet ondersteund (Gebruik indien mogelijk FireFox), of omdat de padnaam naar je TiddlyWiki bestand niet toegestane karakters bevat";\nconfig.messages.confirmExit = "--------------------------------\sn\snEr zijn wijzigingen niet bewaard in TiddlyWiki. Indien je doorgaat zul je deze veranderingen verliezen\sn\sn--------------------------------";\nconfig.messages.customConfigError = "Fout in customConfig '%1' - %0";\nconfig.messages.dates.months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "November","December"];\nconfig.messages.dates.days = ["zondag", "maandag","dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];\nconfig.messages.emptyFailed = "Fout tijdens opslaan van het lege (empty) template bestand";\nconfig.messages.emptySaved = "Empty template opgelsagen";\nconfig.messages.externalLinkTooltip = "Externe link naar %0";\nconfig.messages.invalidFileError = "Het originele bestand '%0' lijkt geen geldige TiddlyWiki te zijn: ";\nconfig.messages.macroError = "Fout bij uitvoeren van macro <<%0>>";\nconfig.messages.macroErrorDetails = "Fout bij uitvoeren van macro <<%0>>:\sn%1";\nconfig.messages.mainFailed = "Fout bij opslaan van het basis TiddlyWiki bestand. De gemaakte wijzigingen zijn niet opgeslagen";\nconfig.messages.mainSaved = "TiddlyWiki basisbestand is opgeslagen";\nconfig.messages.messageClose.text = "sluit";\nconfig.messages.messageClose.tooltip = "Sluit dit bericht";\nconfig.messages.missingMacro = "Die macro bestaat niet";\nconfig.messages.noTags = "Er zijn geen tiddlers met tags";\nconfig.messages.notFileUrlError = "Je zult deze TiddlyWiki eerst locaal moeten opslaan om de wijzigingen te kunnen bewaren";\nconfig.messages.overwriteWarning = "Een tiddler genaamd '%0' bestaat al. Kies OK om deze tiddler te overschrijven";\nconfig.messages.rssFailed = "Fout tijdens opslaan van het RSS feed betand";\nconfig.messages.rssSaved = "RSS feed is opgeslagen";\nconfig.messages.savedSnapshotError = "Het lijkt erop of deze TiddlyWiki incorrect is opgeslagen. Bekijk http://www.tiddlywiki.com/#DownloadSoftware voor meer informatie";\nconfig.messages.shadowedTiddlerToolTip = "De tiddler '%0' bestaat nog niet, maar heeft een vooringestelde schaduw waarde";\nconfig.messages.subtitleUnknown = "(onbekend)";\nconfig.messages.undefinedTiddlerToolTip = "De tiddler '%0' bestaat nog niet";\nconfig.messages.unsavedChangesWarning = "WAARSCHUWING! Er zijn wijzigingen nog niet opgeslagen in TiddlyWiki\sn\snKies OK om te bewaren\snKies CANCEL om wijzigingen te negeren";\n\nconfig.options.txtUserName = "JouwNaam";\n\nconfig.shadowTiddlers.AdvancedOptions = "<<option chkGenerateAnRssFeed>> GenerateAnRssFeed\sn<<option chkOpenInNewWindow>> OpenLinksInNewWindow\sn<<option chkSaveEmptyTemplate>> SaveEmptyTemplate\sn<<option chkToggleLinks>> Door op links van tiddlers dia al open zijn te klikken, zal deze laten sluiten\sn^^(override met Control of andere modificatie toets)^^\sn<<option chkHttpReadOnly>> HideEditingFeatures indien bekeken over HTTP\sn<<option chkForceMinorUpdate>> Beschouw edits als MinorChanges door de datum en tijd te bewaren\sn^^(override met Shift toets tijdens klikken op [klaar] of door pressing Ctrl-Shift-Enter te drukken)^^\sn<<option chkConfirmDelete>> ConfirmBeforeDeleting\snMaximaal aantal regels in een tiddler edit vak: <<option txtMaxEditRows>>\snNaam voor map van de backup bestanden: <<option txtBackupFolder>>\sn";\nconfig.shadowTiddlers.GettingStarted = "Om te beginnen met deze blanco TiddlyWiki, zul je eerst de volgende tiddlers moeten aanpassen:\sn* SiteTitle & SiteSubtitle: De naam en ondertitel van de site, zoals hierboven wordt weergegeven (na het bewaren, zullen ze ook in de titelbalk van de browser verschijnen)\sn* MainMenu: Het menu (gebruikelijk aan de linkerkant)\sn* DefaultTiddlers: Bevat alle namen van de tiddlers die je wilt laten verschijnen zodra deze TiddlyWiki wordt geopend.\snJe zult ook nog je gebruikersnaam voor ondertekenen van de wijzigingen moeten invullen: <<option txtUserName>>";\nconfig.shadowTiddlers.OptionsPanel = "Deze InterfaceOptions zijn voor het instellen van TiddlyWiki en worden door de browser onthouden\sn\snGeef je gebruikersnaam op voor het signeren van de wijzigingen. Noteer het als een WikiWord (bijv. PietKlercks)\sn<<option txtUserName>>\sn<<option chkSaveBackups>> SaveBackups\sn<<option chkAutoSave>> AutoSave\sn<<option chkRegExpSearch>> RegExpSearch\sn<<option chkCaseSensitiveSearch>> CaseSensitiveSearch\sn<<option chkAnimate>> EnableAnimations\sn\snZie ook AdvancedOptions";\nconfig.shadowTiddlers.SideBarOptions = "<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal 'DD MMM YYYY'>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel 'instellingen »' 'Wijzig de geavanceerde TiddlyWiki opties'>>";\nconfig.shadowTiddlers.SideBarTabs = "<<tabs txtMainTab Datum Chronologisch TabTimeline Alle 'Alle tiddlers' TabAll Tags 'Alle tags' TabTags Meer 'Meer lijsten' TabMore>>";\nconfig.shadowTiddlers.SiteSubtitle = "een herbruikbaar non-lineair persoonlijk web notitieblok";\nconfig.shadowTiddlers.SiteTitle = "Mijn TiddlyWiki";\nconfig.shadowTiddlers.TabMore = "<<tabs txtMoreTab Missend 'Missende tiddlers' TabMoreMissing Wezen 'tiddlers zonder ouders' TabMoreOrphans Schaduw 'Schaduw tiddlers' TabMoreShadowed>>";\n\nconfig.views.editor.defaultText = "Typ de tekst in voor '%0'";\nconfig.views.editor.tagChooser.popupNone = "Er zijn geen tags gedefineerd";\nconfig.views.editor.tagChooser.tagTooltip = "Voeg toe de tag: '%0'";\nconfig.views.editor.tagChooser.text = "tags";\nconfig.views.editor.tagChooser.tooltip = "Kies uit de bestaande tags om aan deze tiddler toe te voegen";\nconfig.views.editor.tagPrompt = "Typ tags gescheiden door spaties, [[gebruik dubbele rechte haken]] indien nodig, of";\n\nconfig.views.wikified.defaultText = "De tiddler '%0' bestaat nog niet. Maak hier je tekst. Door dubbelklikken (of knop [edit]) wijzigt de editmodus.";\nconfig.views.wikified.defaultModifier = "Noone";\nconfig.views.wikified.shadowModifier = "Shadow";\nconfig.views.wikified.tag.labelTags = "tags:";\nconfig.views.wikified.tag.labelNoTags = "geen tags";\nconfig.views.wikified.tag.openAllText = "open alle tiddlers";\nconfig.views.wikified.tag.openAllTooltip = "vul het scherm met al deze tiddlers";\nconfig.views.wikified.tag.popupNone = "er zijn geen andere tiddlers met de tag: '%0' ";\nconfig.views.wikified.tag.tooltip = "laat alle tiddlers zien met de tag: '%0' ";\n\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// //===
/***\n''NewDocumentPlugin for TiddlyWiki version 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#NewDocumentPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nQuickly create new TiddlyWiki documents from your existing document, with just one click! Use the {{{<<newDocument>>}}} macro to place a "new document" link into your sidebar/mainmenu/any tiddler (wherever you like). Select this command to automatically create a "new.html" document containing a specific set of tagged tiddlers. Optional parameters let you specify an alternate path/filename for the new file, or different combinations of tags to match (using AND, OR, NOT and parentheses to form complex matches). You can also indicate "ask" for either parameter, which will trigger a prompt for input when the command is selected.\n\n!!!!!Usage\n<<<\n{{{<<newDocument label:text filename tags>>}}}\n{{{<<newDocument label:text filename all>>}}}\n{{{<<newDocument label:text filename snap>>}}}\n where:\n* ''label:text'' defines //optional// alternative link text (replaces default "new document" display)\n* ''filename'' is any local path-and-filename. If no parameters are provided, the default is to create the file "new.htm" in the current directory. If a filename is provided without a path (i.e., there is no "/" in the input), then the current directory is also assumed. Otherwise, this parameter is expected to contain the complete path and filename needed to write the file to your local hard disk. If ''ask'' is used in place of the filename parameter then, when the command link is selected, a message box will be automatically displayed so you can select/enter the path and filename.\n* ''tags'' an //expression// that can be a single tag value, a space-separated list of tags, or a logical formula using AND, OR, NOT and parentheses to create complex matches. The default tag expression includes only tiddlers tagged with <<tag includeNew>>or<<tag systemTiddlers>>. The special tag value ''all'' may be used to match every tiddler (even those without tags). If ''ask'' is used in place of the tags then, when the command link is selected, a message box will be automatically displayed so you can enter the desired tags at that time.\n* When the keyword ''snap'' is used in place of tags to match, the plugin generates a file containing the //rendered// CSS-and-HTML for all tiddlers currently displayed in the document.\n<<<\n!!!!!Examples:\n<<<\n{{{<<newDocument>>}}}\nequivalent to {{{<<newDocument new.htm includeNew systemTiddlers>>}}}\ncreates default "new.htm" containing tiddlers tagged with either<<tag includeNew>>or<<tag systemTiddlers>>\ntry it: <<newDocument>>\n\n{{{<<newDocument empty.html systemTiddlers>>}}}\ncreates "empty.html" containing only tiddlers tagged with<<tag systemTiddlers>>\n//(reproduces old-style (pre 2.0.2) empty file)//\ntry it: <<newDocument empty.html systemTiddlers>>\n\n{{{<<newDocument "label:create Import/Export starter" ask importexport>>}}}\nsave importexport tiddlers to a new file, prompts for path/file\ntry it: <<newDocument "label:create Import/Export starter" ask importexport>>\n\n{{{<<newDocument ask ask>>}}}\nprompts for path/file, prompts for tags to match\ntry it: <<newDocument ask ask>>\n\n{{{<<newDocument ask all>>}}}\nsave all current TiddlyWiki contents to a new file, prompts for path/file\ntry it: <<newDocument ask all>>\n\n{{{<<newDocument ask snap>>}}}\ngenerates snapshot of currently displayed document, prompts for path/file\ntry it: <<newDocument ask snap>>\n\n<<<\n!!!!!Installation\n<<<\nImport (or copy/paste) the following tiddlers into your document:\n''NewDocumentPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.03.15 [1.3.5]''\nadded nsIFilePicker() handler for selecting filename in moz-based browsers. IE and other non-moz browsers still use simple prompt() dialog\n''2006.03.15 [1.3.0]''\nadded "label:text" param for custom link text\nadded special "all" filter parameter for "save as..." handling (writes all tiddlers to output file)\n''2006.03.09 [1.2.0]''\nadded special "snap" filter parameter to generate and write "snapshot" files containing static HTML+CSS for currently rendered document.\n''2006.02.24 [1.1.2]''\nFix incompatiblity with TW 2.0.5 by removing custom definition of getLocalPath() (which is now part of TW core)\n''2006.02.03 [1.1.1]''\nconcatentate 'extra' params so that tag expressions don't have to be quoted\nmoved all text to 'formatted' string definitions for easier translation.\neven better documentation and some minor code cleanup\n''2006.02.03 [1.1.0]''\nadded support for tag EXPRESSIONS\nplus improved documentation and code cleanup\n''2006.02.03 [1.0.0]''\nCreated.\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.newDocument = {major: 1, minor: 3, revision: 5, date: new Date(2006,3,15)};\n\nconfig.macros.newDocument = {\n newlabel: "new document",\n newprompt: "Create a new TiddlyWiki 'starter' document",\n newdefault: "new.htm",\n allparam: "all",\n saveaslabel: "save as...",\n saveasprompt: "Save current TiddlyWiki to a different file",\n snapparam: "snap",\n snaplabel: "create a snapshot",\n snapprompt: "Create a 'snapshot' of the current TiddlyWiki display",\n snapdefault: "snapshot.htm",\n askparam: "ask",\n labelparam: "label:",\n fileprompt: "Please enter a filename",\n filter: "includeNew OR systemTiddlers",\n filterprompt: "Enter tag(s) to match (use AND, OR, NOT)",\n filtererrmsg: "Error in tag filter '%0'",\n snapmsg: "Document snapshot written to %0",\n okmsg: "%0 tiddlers written to %1",\n failmsg: "An error occurred while creating '%0'"\n};\n\nconfig.macros.newDocument.handler = function(place,macroName,params) {\n\n var path=getLocalPath(document.location.toString());\n var slashpos=path.lastIndexOf("/"); if (slashpos==-1) slashpos=path.lastIndexOf("\s\s"); \n if (slashpos!=-1) path = path.substr(0,slashpos+1); // remove filename from path, leave the trailing slash\n\n if (params[0] && params[0].substr(0,config.macros.newDocument.labelparam.length)==config.macros.newDocument.labelparam)\n var label=params.shift().substr(config.macros.newDocument.labelparam.length)\n var filename=params.shift(); if (!filename) filename=config.macros.newDocument.newdefault;\n if (params[0]) var filter=params.join(" ");\n if (filter==config.macros.newDocument.snapparam) {\n if (!label) var label=config.macros.newDocument.snaplabel;\n var prompt=config.macros.newDocument.snapprompt;\n var defaultfile=config.macros.newDocument.snapdefault;\n }\n if (filter==config.macros.newDocument.allparam) {\n if (!label) var label=config.macros.newDocument.saveaslabel;\n var prompt=config.macros.newDocument.saveasprompt;\n var defaultfile=getLocalPath(document.location.toString());\n var slashpos=defaultfile.lastIndexOf("/"); if (slashpos==-1) slashpos=defaultfile.lastIndexOf("\s\s");\n if (slashpos!=-1) defaultfile=defaultfile.substr(slashpos+1); // get filename only\n }\n\n if (!prompt) var prompt=config.macros.newDocument.newprompt;\n if (!label) var label=config.macros.newDocument.newlabel;\n if (!defaultfile) var defaultfile=config.macros.newDocument.newdefault;\n if (!filter) var filter=config.macros.newDocument.filter; \n\n var btn=createTiddlyButton(place,label,prompt,onClickNewDocument);\n btn.path=path;\n btn.file=filename;\n btn.defaultfile=defaultfile;\n btn.filter=filter;\n}\n\n// IE needs explicit global scoping for functions called by browser events\nwindow.onClickNewDocument=function(e)\n{\n if (!e) var e = window.event; var btn=resolveTarget(e);\n\n // get output path/filename\n var filename=btn.file;\n if (filename==config.macros.newDocument.askparam)\n filename=promptForFilename(config.macros.newDocument.fileprompt,btn.path,btn.defaultfile);\n if (!filename) return; // cancelled by user\n // if specified file does not include a path, assemble fully qualified path and filename\n var slashpos=filename.lastIndexOf("/"); if (slashpos==-1) slashpos=filename.lastIndexOf("\s\s");\n if (slashpos==-1) filename=btn.path+filename;\n // assemble document content, write file, report result\n if (btn.filter==config.macros.newDocument.snapparam) { // HTML+CSS snapshot\n var styles=document.getElementsByTagName("style");\n var out="<html>\sn<head>\sn<style>\sn";\n for(var i=0; i < styles.length; i++) out +="/* stylesheet from tiddler:"+styles[i].getAttribute("id")+" */\sn"+styles[i].innerHTML+"\sn\sn";\n out += "</style>\sn</head>\sn<body>\sn\sn"+document.getElementById("contentWrapper").innerHTML+"\sn\sn</body>\sn</html>";\n var msg=saveFile(filename,out)\n ?config.macros.newDocument.snapmsg.format([filename])\n :config.macros.newDocument.failmsg.format([filename]);\n } else { // TW starter document\n // get the TiddlyWiki core code source\n var sourcefile=getLocalPath(document.location.toString());\n var source=loadFile(sourcefile);\n if(source==null) { alert(config.messages.cantSaveError); return null; }\n var posOpeningDiv=source.indexOf(startSaveArea);\n var posClosingDiv=source.lastIndexOf(endSaveArea);\n if((posOpeningDiv==-1)||(posClosingDiv==-1)) { alert(config.messages.invalidFileError.format([sourcefile])); return; }\n // get the matching tiddler divs\n var match=btn.filter;\n if (match==config.macros.newDocument.askparam)\n match=prompt(config.macros.newDocument.filterprompt,config.macros.newDocument.filter);\n if (!match) return; // cancelled by user\n var storeAreaDivs=[];\n var tiddlers=store.getTiddlers('title');\n for (var i=0; i<tiddlers.length; i++)\n if (match==config.macros.newDocument.allparam || matchTags(tiddlers[i],match))\n storeAreaDivs.push(tiddlers[i].saveToDiv());\n var out=source.substr(0,posOpeningDiv+startSaveArea.length)+storeAreaDivs.join("\sn")+"\sn\st\st"+source.substr(posClosingDiv);\n var msg=saveFile(filename,out)\n ?config.macros.newDocument.okmsg.format([storeAreaDivs.length,filename])\n :config.macros.newDocument.failmsg.format([filename]);\n }\n clearMessage(); displayMessage(msg); e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return(false);\n}\n//}}}\n\n//{{{\nfunction promptForFilename(msg,path,file)\n{\n if(!window.Components)\n return prompt(msg,path+file); // fallback for IE and other non-moz browsers\n try {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n var nsIFilePicker = window.Components.interfaces.nsIFilePicker;\n var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);\n picker.init(window, msg, nsIFilePicker.modeSave);\n var thispath = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\n thispath.initWithPath(path);\n picker.displayDirectory=thispath;\n picker.defaultExtension="html";\n picker.defaultString=file;\n picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);\n var result = picker.show();\n if (result == nsIFilePicker.returnOK) return picker.file.persistentDescriptor;\n }\n catch(e) { alert('error during local file access: '+e.toString()) }\n}\n//}}}\n\n//{{{\nif (!window.matchTags) window.matchTags=function(tiddler,cond)\n{\n if (!cond||!cond.trim().length) return false;\n\n // build a regex of all tags as a big-old regex that \n // OR's the tags together (tag1|tag2|tag3...) in length order\n var tgs = store.getTags();\n if ( tgs.length == 0 ) return results ;\n tags = tgs.sort( function(a,b){return (a[0].length<b[0].length)-(a[0].length>b[0].length);});\n var exp = "(" + tags.join("|") + ")" ;\n exp = exp.replace( /(,[\sd]+)/g, "" ) ;\n var regex = new RegExp( exp, "ig" );\n\n // build a string such that an expression that looks like this: tag1 AND tag2 OR NOT tag3\n // turns into : /tag1/.test(...) && /tag2/.test(...) || ! /tag2/.test(...)\n cond = cond.replace( regex, "/$1\s\s|/.test(tiddlerTags)" );\n cond = cond.replace( /\ssand\ss/ig, " && " ) ;\n cond = cond.replace( /\ssor\ss/ig, " || " ) ;\n cond = cond.replace( /\ss?not\ss/ig, " ! " ) ;\n\n // if a boolean uses a tag that doesn't exist - it will get left alone \n // (we only turn existing tags into actual tests).\n // replace anything that wasn't found as a tag, AND, OR, or NOT with the string "false"\n // if the tag doesn't exist then /tag/.test(...) will always return false.\n cond = cond.replace( /(\ss|^)+[^\s/\s|&!][^\ss]*/g, "false" ) ;\n\n // make a string of the tags in the tiddler and eval the 'cond' string against that string \n // if it's TRUE then the tiddler qualifies!\n var tiddlerTags = (tiddler.tags?tiddler.tags.join("|"):"")+"|" ;\n try { if ( eval( cond ) ) return true; }\n catch( e ) { displayMessage(config.macros.newDocument.filtererrmsg.format([e])); }\n return false;\n}\n//}}}\n
/***\n''QuoteOfTheDayPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#QuoteOfTheDayPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nDisplay a randomly selected "quote of the day"\n\n!!!!!Usage\n<<<\n{{{<<QOTD //tiddlername//>>}}}\nPut your quotations into a tiddler (called //tiddlername//). Separate each quote by a horizontal rule (use "----" on a line by itself). Each time the macro is rendered it will display a different quotation, selected at random from the specified tiddler.\n<<<\n!!!!!Example\n<<<\n{{{<<QOTD Quotations>>}}}\n<<QOTD Quotations>>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''QuoteOfTheDayPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for QuoteOfTheDay handling^^\n<<<\n!!!!!Revision History\n<<<\n''2005.10.21 [1.0.0]''\nInitial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nBased on a suggestion by M.Russula\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.QOTD = {major: 1, minor: 0, revision: 0, date: new Date(2005,10,21)};\nconfig.macros.QOTD = {};\nconfig.macros.QOTD.handler= function(place,macroName,params) {\n var txt=store.getTiddlerText(params[0]); if (!txt) return;\n var quotes=txt.split("\sn----\sn");\n // then, get a random index number between 0 and N-1 and wikify that text\n wikify(quotes[Math.floor(Math.random()*quotes.length)],place);\n}\n//}}}
/***\n|''Name:''|ReminderPlugin|\n|''Version:''|2.3.8 (Mar 9, 2006)|\n|''Source:''|http://www.geocities.com/allredfaq/reminderMacros.html|\n|''Author:''|Jeremy Sheeley(pop1280 [at] excite [dot] com)|\n|''Licence:''|[[BSD open source license]]|\n|''Macros:''|reminder, showreminders, displayTiddlersWithReminders, newReminder|\n|''TiddlyWiki:''|2.0+|\n|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|\n\n!Description\nThis plugin provides macros for tagging a date with a reminder. Use the {{{reminder}}} macro to do this. The {{{showReminders}}} and {{{displayTiddlersWithReminder}}} macros automatically search through all available tiddlers looking for upcoming reminders.\n\n!Installation\n* Create a new tiddler in your tiddlywiki titled ReminderPlugin and give it the {{{systemConfig}}} tag. The tag is important because it tells TW that this is executable code.\n* Double click this tiddler, and copy all the text from the tiddler's body.\n* Paste the text into the body of the new tiddler in your TW.\n* Save and reload your TW.\n* You can copy some examples into your TW as well. See [[Simple examples]], [[Holidays]], [[showReminders]] and [[Personal Reminders]]\n\n!Syntax:\n|>|See [[ReminderSyntax]] and [[showRemindersSyntax]]|\n\n!Revision history\n* v2.3.8 (Mar 9, 2006)\n**Bug fix: A global variable had snuck in, which was killing FF 1.5.0.1\n**Feature: You can now use TIDDLER and TIDDLERNAME in a regular reminder format\n* v2.3.6 (Mar 1, 2006)\n**Bug fix: Reminders for today weren't being matched sometimes.\n**Feature: Solidified integration with DatePlugin and CalendarPlugin\n**Feature: Recurring reminders will now return multiple hits in showReminders and the calendar.\n**Feature: Added TIDDLERNAME to the replacements for showReminders format, for plugins that need the title without brackets.\n* v2.3.5 (Feb 8, 2006)\n**Bug fix: Sped up reminders lots. Added a caching mechanism for reminders that have already been matched.\n* v2.3.4 (Feb 7, 2006)\n**Bug fix: Cleaned up code to hopefully prevent the Firefox 1.5.0.1 crash that was causing lots of plugins \nto crash Firefox. Thanks to http://www.jslint.com\n* v2.3.3 (Feb 2, 2006)\n**Feature: newReminder now has drop down lists instead of text boxes.\n**Bug fix: A trailing space in a title would trigger an infinite loop.\n**Bug fix: using tag:"birthday !reminder" would filter differently than tag:"!reminder birthday"\n* v2.3.2 (Jan 21, 2006)\n**Feature: newReminder macro, which will let you easily add a reminder to a tiddler. Thanks to Eric Shulman (http://www.elsdesign.com) for the code to do this.\n** Bug fix: offsetday was not working sometimes\n** Bug fix: when upgrading to 2.0, I included a bit to exclude tiddlers tagged with excludeSearch. I've reverted back to searching through all tiddlers\n* v2.3.1 (Jan 7, 2006)\n**Feature: 2.0 compatibility\n**Feature AlanH sent some code to make sure that showReminders prints a message if no reminders are found.\n* v2.3.0 (Jan 3, 2006)\n** Bug Fix: Using "Last Sunday (-0)" as a offsetdayofweek wasn't working.\n** Bug Fix: Daylight Savings time broke offset based reminders (for example year:2005 month:8 day:23 recurdays:7 would match Monday instead of Tuesday during DST.\n\n!Code\n***/\n//{{{\n\n//============================================================================\n//============================================================================\n// ReminderPlugin\n//============================================================================\n//============================================================================\n\nversion.extensions.ReminderPlugin = {major: 2, minor: 3, revision: 8, date: new Date(2006,3,9), source: "http://www.geocities.com/allredfaq/reminderMacros.html"};\n\n//============================================================================\n// Configuration\n// Modify this section to change the defaults for \n// leadtime and display strings\n//============================================================================\n\nconfig.macros.reminders = {};\nconfig.macros["reminder"] = {};\nconfig.macros["newReminder"] = {};\nconfig.macros["showReminders"] = {};\nconfig.macros["displayTiddlersWithReminders"] = {};\n\nconfig.macros.reminders["defaultLeadTime"] = [0,6000];\nconfig.macros.reminders["defaultReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY";\nconfig.macros.reminders["defaultShowReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY -- TIDDLER";\nconfig.macros.reminders["defaultAnniversaryMessage"] = "(DIFF)";\nconfig.macros.reminders["untitledReminder"] = "Untitled Reminder";\nconfig.macros.reminders["noReminderFound"] = "Couldn't find a match for TITLE in the next LEADTIMEUPPER days."\nconfig.macros.reminders["todayString"] = "Today";\nconfig.macros.reminders["tomorrowString"] = "Tomorrow";\nconfig.macros.reminders["ndaysString"] = "DIFF days";\nconfig.macros.reminders["emtpyShowRemindersString"] = "There are no upcoming events";\n\n\n//============================================================================\n// Code\n// You should not need to edit anything \n// below this. Make sure to edit this tiddler and copy \n// the code from the text box, to make sure that \n// tiddler rendering doesn't interfere with the copy \n// and paste.\n//============================================================================\n\n// This line is to preserve 1.2 compatibility\n if (!story) var story=window; \n//this object will hold the cache of reminders, so that we don't\n//recompute the same reminder over again.\nvar reminderCache = {};\n\nconfig.macros.showReminders.handler = function showReminders(place,macroName,params)\n{\n var now = new Date().getMidnight();\n var paramHash = {};\n var leadtime = [0,14];\n paramHash = getParamsForReminder(params);\n var bProvidedDate = (paramHash["year"] != null) || \n (paramHash["month"] != null) || \n (paramHash["day"] != null) || \n (paramHash["dayofweek"] != null);\n if (paramHash["leadtime"] != null)\n {\n leadtime = paramHash["leadtime"];\n if (bProvidedDate)\n {\n //If they've entered a day, we need to make \n //sure to find it. We'll reset the \n //leadtime a few lines down.\n paramHash["leadtime"] = [-10000, 10000];\n }\n }\n var matchedDate = now;\n if (bProvidedDate)\n {\n var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);\n var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);\n matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); \n }\n\n var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);\n var elem = createTiddlyElement(place,"span",null,null, null);\n var mess = "";\n if (arr.length == 0)\n {\n mess += config.macros.reminders.emtpyShowRemindersString; \n }\n for (var j = 0; j < arr.length; j++)\n {\n if (paramHash["format"] != null)\n {\n arr[j]["params"]["format"] = paramHash["format"];\n }\n else\n {\n arr[j]["params"]["format"] = config.macros.reminders["defaultShowReminderMessage"];\n }\n mess += getReminderMessageForDisplay(arr[j]["diff"], arr[j]["params"], arr[j]["matchedDate"], arr[j]["tiddler"]);\n mess += "\sn";\n }\n wikify(mess, elem, null, null);\n};\n\n\nconfig.macros.displayTiddlersWithReminders.handler = function displayTiddlersWithReminders(place,macroName,params)\n{\n var now = new Date().getMidnight();\n var paramHash = {};\n var leadtime = [0,14];\n paramHash = getParamsForReminder(params);\n var bProvidedDate = (paramHash["year"] != null) || \n (paramHash["month"] != null) || \n (paramHash["day"] != null) || \n (paramHash["dayofweek"] != null);\n if (paramHash["leadtime"] != null)\n {\n leadtime = paramHash["leadtime"];\n if (bProvidedDate)\n {\n //If they've entered a day, we need to make \n //sure to find it. We'll reset the leadtime \n //a few lines down.\n paramHash["leadtime"] = [-10000,10000];\n }\n }\n var matchedDate = now;\n if (bProvidedDate)\n {\n var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);\n var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);\n matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); \n }\n var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);\n for (var j = 0; j < arr.length; j++)\n {\n displayTiddler(null, arr[j]["tiddler"], 0, null, false, false, false);\n }\n};\n\nconfig.macros.reminder.handler = function reminder(place,macroName,params)\n{\n var dateHash = getParamsForReminder(params);\n if (dateHash["hidden"] != null)\n {\n return;\n }\n var leadTime = dateHash["leadtime"];\n if (leadTime == null)\n {\n leadTime = config.macros.reminders["defaultLeadTime"]; \n }\n var leadTimeLowerBound = new Date().getMidnight().addDays(leadTime[0]);\n var leadTimeUpperBound = new Date().getMidnight().addDays(leadTime[1]);\n var matchedDate = findDateForReminder(dateHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound);\n if (!window.story) \n {\n window.story=window; \n }\n if (!store.getTiddler) \n {\n store.getTiddler=function(title) {return this.tiddlers[title];};\n }\n var title = window.story.findContainingTiddler(place).id.substr(7);\n if (matchedDate != null)\n {\n var diff = matchedDate.getDifferenceInDays(new Date().getMidnight());\n var elem = createTiddlyElement(place,"span",null,null, null);\n var mess = getReminderMessageForDisplay(diff, dateHash, matchedDate, title);\n wikify(mess, elem, null, null);\n }\n else\n {\n createTiddlyElement(place,"span",null,null, config.macros.reminders["noReminderFound"].replace("TITLE", dateHash["title"]).replace("LEADTIMEUPPER", leadTime[1]).replace("LEADTIMELOWER", leadTime[0]).replace("TIDDLERNAME", title).replace("TIDDLER", "[[" + title + "]]") );\n }\n};\n\nconfig.macros.newReminder.handler = function newReminder(place,macroName,params)\n{\n var today=new Date().getMidnight();\n var formstring = '<html><form>Year: <select name="year"><option value="">Every year</option>';\n for (var i = 0; i < 5; i++)\n {\n formstring += '<option' + ((i == 0) ? ' selected' : '') + ' value="' + (today.getFullYear() +i) + '">' + (today.getFullYear() + i) + '</option>';\n }\n formstring += '</select>&nbsp;&nbsp;Month:<select name="month"><option value="">Every month</option>';\n for (i = 0; i < 12; i++)\n {\n formstring += '<option' + ((i == today.getMonth()) ? ' selected' : '') + ' value="' + (i+1) + '">' + config.messages.dates.months[i] + '</option>';\n }\n formstring += '</select>&nbsp;&nbsp;Day:<select name="day"><option value="">Every day</option>';\n for (i = 1; i < 32; i++)\n {\n formstring += '<option' + ((i == (today.getDate() )) ? ' selected' : '') + ' value="' + i + '">' + i + '</option>';\n }\n\nformstring += '</select>&nbsp;&nbsp;Reminder Title:<input type="text" size="40" name="title" value="please enter a title" onfocus="this.select();"><input type="button" value="ok" onclick="addReminderToTiddler(this.form)"></form></html>';\n\n var panel = config.macros.slider.createSlider(place,null,"New Reminder","Open a form to add a new reminder to this tiddler");\n wikify(formstring ,panel,null,store.getTiddler(params[1]));\n};\n\n// onclick: process input and insert reminder at 'marker'\nwindow.addReminderToTiddler = function(form) {\n if (!window.story) \n {\n window.story=window; \n }\n if (!store.getTiddler) \n {\n store.getTiddler=function(title) {return this.tiddlers[title];};\n }\n var title = window.story.findContainingTiddler(form).id.substr(7);\n var tiddler=store.getTiddler(title);\n var txt='\sn<<reminder ';\n if (form.year.value != "")\n txt += 'year:'+form.year.value + ' ';\n if (form.month.value != "")\n txt += 'month:'+form.month.value + ' ';\n if (form.day.value != "")\n txt += 'day:'+form.day.value + ' ';\n txt += 'title:"'+form.title.value+'" ';\n txt +='>>';\n tiddler.set(null,tiddler.text + txt);\n window.story.refreshTiddler(title,1,true);\n store.setDirty(true);\n};\n\nfunction hasTag(tiddlerTags, tagFilters)\n{\n //Make sure we respond well to empty tiddlerTaglists or tagFilterlists\n if (tagFilters.length==0 || tiddlerTags.length==0)\n {\n return true;\n }\n\n var bHasTag = false;\n \n /*bNoPos says: "'till now there has been no check using a positive filter"\n Imagine a filterlist consisting of 1 negative filter:\n If the filter isn't matched, we want hasTag to be true.\n Yet bHasTag is still false ('cause only positive filters cause bHasTag to change)\n \n If no positive filters are present bNoPos is true, and no negative filters are matched so we have not returned false\n Thus: hasTag returns true.\n \n If at any time a positive filter is encountered, we want at least one of the tags to match it, so we turn bNoPos to false, which\n means bHasTag must be true for hasTag to return true*/\n var bNoPos=true;\n \nfor (var t3 = 0; t3 < tagFilters.length; t3++)\n {\n for(var t2=0; t2<tiddlerTags.length; t2++)\n {\n if (tagFilters[t3].length > 1 && tagFilters[t3].charAt(0) == '!') \n {\n if (tiddlerTags[t2] == tagFilters[t3].substring(1))\n {\n //If at any time a negative filter is matched, we return false\n return false;\n }\n }\n else \n {\n if (bNoPos)\n {\n //We encountered the first positive filter\n bNoPos=false;\n }\n if (tiddlerTags[t2] == tagFilters[t3])\n {\n //A positive filter is matched. As long as no negative filter is matched, hasTag will return true\n bHasTag=true;\n }\n }\n }\n }\n return (bNoPos || bHasTag);\n};\n\n//This function searches all tiddlers for the reminder //macro. It is intended that other plugins (like //calendar) will use this function to query for \n//upcoming reminders.\n//The arguments to this function filter out reminders //based on when they will fire.\n//\n//ARGUMENTS:\n//baseDate is the date that is used as "now". \n//leadtime is a two element int array, with leadtime[0] \n// as the lower bound and leadtime[1] as the\n// upper bound. A reasonable default is [0,14]\n//tags is a space-separated list of tags to use to filter \n// tiddlers. If a tag name begins with an !, then \n// only tiddlers which do not have that tag will \n// be considered. For example "examples holidays" \n// will search for reminders in any tiddlers that \n// are tagged with examples or holidays and \n// "!examples !holidays" will search for reminders \n// in any tiddlers that are not tagged with \n// examples or holidays. Pass in null to search \n// all tiddlers.\n//limit. If limit is null, individual reminders can \n// override the leadtime specified earlier. \n// Pass in 1 in order to override that behavior.\n\nwindow.findTiddlersWithReminders = function findTiddlersWithReminders(baseDate, leadtime, tags, limit)\n{\n//function(searchRegExp,sortField,excludeTag)\n// var macroPattern = "<<([^>\s\s]+)(?:\s\s*)([^>]*)>>";\n var macroPattern = "<<(reminder)(.*)>>";\n var macroRegExp = new RegExp(macroPattern,"mg");\n var matches = store.search(macroRegExp,"title","");\n var arr = [];\n var tagsArray = null;\n if (tags != null)\n {\n tagsArray = tags.split(" ");\n }\n for(var t=matches.length-1; t>=0; t--)\n {\n if (tagsArray != null)\n {\n //If they specified tags to filter on, and this tiddler doesn't \n //match, skip it entirely.\n if ( ! hasTag(matches[t].tags, tagsArray))\n {\n continue;\n }\n }\n\n var targetText = matches[t].text;\n do {\n // Get the next formatting match\n var formatMatch = macroRegExp.exec(targetText);\n if(formatMatch && formatMatch[1] != null && formatMatch[1].toLowerCase() == "reminder")\n {\n //Find the matching date.\n \n var params = formatMatch[2] != null ? formatMatch[2].readMacroParams() : {};\n var dateHash = getParamsForReminder(params);\n if (limit != null || dateHash["leadtime"] == null)\n {\n if (leadtime == null)\n dateHash["leadtime"] = leadtime;\n else\n {\n dateHash["leadtime"] = [];\n dateHash["leadtime"][0] = leadtime[0];\n dateHash["leadtime"][1] = leadtime[1];\n }\n }\n if (dateHash["leadtime"] == null)\n dateHash["leadtime"] = config.macros.reminders["defaultLeadTime"]; \n var leadTimeLowerBound = baseDate.addDays(dateHash["leadtime"][0]);\n var leadTimeUpperBound = baseDate.addDays(dateHash["leadtime"][1]);\n var matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);\n while (matchedDate != null)\n {\n var hash = {};\n hash["diff"] = matchedDate.getDifferenceInDays(baseDate);\n hash["matchedDate"] = new Date(matchedDate.getFullYear(), matchedDate.getMonth(), matchedDate.getDate(), 0, 0);\n hash["params"] = cloneParams(dateHash);\n hash["tiddler"] = matches[t].title;\n hash["tags"] = matches[t].tags;\n arr.pushUnique(hash);\n if (dateHash["recurdays"] != null || (dateHash["year"] == null))\n {\n leadTimeLowerBound = leadTimeLowerBound.addDays(matchedDate.getDifferenceInDays(leadTimeLowerBound)+ 1);\n matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);\n }\n else matchedDate = null;\n }\n }\n }while(formatMatch);\n }\n if(arr.length > 1) //Sort the array by number of days remaining.\n {\n arr.sort(function (a,b) {if(a["diff"] == b["diff"]) {return(0);} else {return (a["diff"] < b["diff"]) ? -1 : +1; } });\n }\n return arr;\n};\n\n//This function takes the reminder macro parameters and\n//generates the string that is used for display.\n//This function is not intended to be called by \n//other plugins.\n window.getReminderMessageForDisplay= function getReminderMessageForDisplay(diff, params, matchedDate, tiddlerTitle)\n{\n var anniversaryString = "";\n var reminderTitle = params["title"];\n if (reminderTitle == null)\n {\n reminderTitle = config.macros.reminders["untitledReminder"];\n }\n if (params["firstyear"] != null)\n {\n anniversaryString = config.macros.reminders["defaultAnniversaryMessage"].replace("DIFF", (matchedDate.getFullYear() - params["firstyear"]));\n }\n var mess = "";\n var diffString = "";\n if (diff == 0)\n {\n diffString = config.macros.reminders["todayString"];\n }\n else if (diff == 1)\n {\n diffString = config.macros.reminders["tomorrowString"];\n }\n else\n {\n diffString = config.macros.reminders["ndaysString"].replace("DIFF", diff);\n }\n var format = config.macros.reminders["defaultReminderMessage"];\n if (params["format"] != null)\n {\n format = params["format"];\n }\n mess = format;\n//HACK! -- Avoid replacing DD in TIDDLER with the date\n mess = mess.replace(/TIDDLER/g, "TIDELER");\n mess = matchedDate.formatStringDateOnly(mess);\n mess = mess.replace(/TIDELER/g, "TIDDLER");\n if (tiddlerTitle != null)\n {\n mess = mess.replace(/TIDDLERNAME/g, tiddlerTitle);\n mess = mess.replace(/TIDDLER/g, "[[" + tiddlerTitle + "]]");\n }\n \n mess = mess.replace("DIFF", diffString).replace("TITLE", reminderTitle).replace("DATE", matchedDate.formatString("DDD MMM DD, YYYY")).replace("ANNIVERSARY", anniversaryString);\n return mess;\n};\n\n// Parse out the macro parameters into a hashtable. This\n// handles the arguments for reminder, showReminders and \n// displayTiddlersWithReminders.\nwindow.getParamsForReminder = function getParamsForReminder(params)\n{\n var dateHash = {};\n var type = "";\n var num = 0;\n var title = "";\n for(var t=0; t<params.length; t++)\n {\n var split = params[t].split(":");\n type = split[0].toLowerCase();\n var value = split[1];\n for (var i=2; i < split.length; i++)\n {\n value += ":" + split[i];\n }\n if (type == "nolinks" || type == "limit" || type == "hidden")\n {\n num = 1;\n }\n else if (type == "leadtime")\n {\n var leads = value.split("...");\n if (leads.length == 1)\n {\n leads[1]= leads[0];\n leads[0] = 0;\n }\n leads[0] = parseInt(leads[0], 10);\n leads[1] = parseInt(leads[1], 10);\n num = leads;\n }\n else if (type == "offsetdayofweek")\n {\n if (value.substr(0,1) == "-")\n {\n dateHash["negativeOffsetDayOfWeek"] = 1;\n value = value.substr(1);\n }\n num = parseInt(value, 10);\n }\n else if (type != "title" && type != "tag" && type != "format")\n {\n num = parseInt(value, 10);\n }\n else\n {\n title = value;\n t++;\n while (title.substr(0,1) == '"' && title.substr(title.length - 1,1) != '"' && params[t] != undefined)\n {\n title += " " + params[t++];\n }\n //Trim off the leading and trailing quotes\n if (title.substr(0,1) == "\s"" && title.substr(title.length - 1,1)== "\s"")\n {\n title = title.substr(1, title.length - 2);\n t--;\n }\n num = title;\n }\n dateHash[type] = num;\n }\n //date is synonymous with day\n if (dateHash["day"] == null)\n {\n dateHash["day"] = dateHash["date"];\n }\n return dateHash;\n};\n\n//This function finds the date specified in the reminder \n//parameters. It will return null if no match can be\n//found. This function is not intended to be used by\n//other plugins.\nwindow.findDateForReminder= function findDateForReminder( dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound)\n{\n if (baseDate == null)\n {\n baseDate = new Date().getMidnight();\n }\n var hashKey = baseDate.convertToYYYYMMDDHHMM();\n for (var k in dateHash)\n {\n hashKey += "," + k + "|" + dateHash[k];\n }\n hashKey += "," + leadTimeLowerBound.convertToYYYYMMDDHHMM();\n hashKey += "," + leadTimeUpperBound.convertToYYYYMMDDHHMM();\n if (reminderCache[hashKey] == null)\n {\n //If we don't find a match in this run, then we will\n //cache that the reminder can't be matched.\n reminderCache[hashKey] = false;\n }\n else if (reminderCache[hashKey] == false)\n {\n //We've already tried this date and failed\n return null;\n }\n else\n {\n return reminderCache[hashKey];\n }\n \n var bOffsetSpecified = dateHash["offsetyear"] != null || \n dateHash["offsetmonth"] != null || \n dateHash["offsetday"] != null || \n dateHash["offsetdayofweek"] != null || \n dateHash["recurdays"] != null;\n \n // If we are matching the base date for a dayofweek offset, look for the base date a \n //little further back.\n var tmp1leadTimeLowerBound = leadTimeLowerBound; \n if ( dateHash["offsetdayofweek"] != null)\n {\n tmp1leadTimeLowerBound = leadTimeLowerBound.addDays(-6); \n }\n var matchedDate = baseDate.findMatch(dateHash, tmp1leadTimeLowerBound, leadTimeUpperBound);\n if (matchedDate != null)\n {\n var newMatchedDate = matchedDate;\n if (dateHash["recurdays"] != null)\n {\n while (newMatchedDate.getTime() < leadTimeLowerBound.getTime())\n {\n newMatchedDate = newMatchedDate.addDays(dateHash["recurdays"]);\n }\n }\n else if (dateHash["offsetyear"] != null || \n dateHash["offsetmonth"] != null || \n dateHash["offsetday"] != null || \n dateHash["offsetdayofweek"] != null)\n {\n var tmpdateHash = cloneParams(dateHash);\n tmpdateHash["year"] = dateHash["offsetyear"];\n tmpdateHash["month"] = dateHash["offsetmonth"];\n tmpdateHash["day"] = dateHash["offsetday"];\n tmpdateHash["dayofweek"] = dateHash["offsetdayofweek"];\n var tmpleadTimeLowerBound = leadTimeLowerBound;\n var tmpleadTimeUpperBound = leadTimeUpperBound;\n if (tmpdateHash["offsetdayofweek"] != null)\n {\n if (tmpdateHash["negativeOffsetDayOfWeek"] == 1)\n {\n tmpleadTimeLowerBound = matchedDate.addDays(-6);\n tmpleadTimeUpperBound = matchedDate;\n\n }\n else\n {\n tmpleadTimeLowerBound = matchedDate;\n tmpleadTimeUpperBound = matchedDate.addDays(6);\n }\n\n }\n newMatchedDate = matchedDate.findMatch(tmpdateHash, tmpleadTimeLowerBound, tmpleadTimeUpperBound);\n //The offset couldn't be matched. return null.\n if (newMatchedDate == null)\n {\n return null;\n }\n }\n if (newMatchedDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))\n {\n reminderCache[hashKey] = newMatchedDate;\n return newMatchedDate;\n }\n }\n return null;\n};\n\n//This does much the same job as findDateForReminder, but\n//this one doesn't deal with offsets or recurring \n//reminders.\nDate.prototype.findMatch = function findMatch(dateHash, leadTimeLowerBound, leadTimeUpperBound)\n{\n\n var bSpecifiedYear = (dateHash["year"] != null);\n var bSpecifiedMonth = (dateHash["month"] != null);\n var bSpecifiedDay = (dateHash["day"] != null);\n var bSpecifiedDayOfWeek = (dateHash["dayofweek"] != null);\n if (bSpecifiedYear && bSpecifiedMonth && bSpecifiedDay)\n {\n return new Date(dateHash["year"], dateHash["month"]-1, dateHash["day"], 0, 0);\n }\n var bMatchedYear = !bSpecifiedYear;\n var bMatchedMonth = !bSpecifiedMonth;\n var bMatchedDay = !bSpecifiedDay;\n var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;\n if (bSpecifiedDay && bSpecifiedMonth && !bSpecifiedYear && !bSpecifiedDayOfWeek)\n {\n\n //Shortcut -- First try this year. If it's too small, try next year.\n var tmpMidnight = this.getMidnight();\n var tmpDate = new Date(this.getFullYear(), dateHash["month"]-1, dateHash["day"], 0,0);\n if (tmpDate.getTime() < leadTimeLowerBound.getTime())\n {\n tmpDate = new Date((this.getFullYear() + 1), dateHash["month"]-1, dateHash["day"], 0,0);\n }\n if ( tmpDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))\n {\n return tmpDate;\n }\n else\n {\n return null;\n }\n }\n\n var newDate = leadTimeLowerBound; \n while (newDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))\n {\n var tmp = testDate(newDate, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek);\n if (tmp != null)\n return tmp;\n newDate = newDate.addDays(1);\n }\n};\n\nfunction testDate(testMe, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek)\n{\n var bMatchedYear = !bSpecifiedYear;\n var bMatchedMonth = !bSpecifiedMonth;\n var bMatchedDay = !bSpecifiedDay;\n var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;\n if (bSpecifiedYear)\n {\n bMatchedYear = (dateHash["year"] == testMe.getFullYear());\n }\n if (bSpecifiedMonth)\n {\n bMatchedMonth = ((dateHash["month"] - 1) == testMe.getMonth() );\n }\n if (bSpecifiedDay)\n {\n bMatchedDay = (dateHash["day"] == testMe.getDate());\n }\n if (bSpecifiedDayOfWeek)\n {\n bMatchedDayOfWeek = (dateHash["dayofweek"] == testMe.getDay());\n }\n\n if (bMatchedYear && bMatchedMonth && bMatchedDay && bMatchedDayOfWeek)\n {\n return testMe;\n }\n};\n\n//Returns true if the date is in between two given dates\nDate.prototype.isBetween = function isBetween(lowerBound, upperBound)\n{\n return (this.getTime() >= lowerBound.getTime() && this.getTime() <= upperBound.getTime());\n}\n//Return a new date, with the time set to midnight (0000)\nDate.prototype.getMidnight = function getMidnight()\n{\n return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0);\n};\n// Add the specified number of days to a date.\nDate.prototype.addDays = function addDays(numberOfDays)\n{\n return new Date(this.getFullYear(), this.getMonth(), this.getDate() + numberOfDays, 0, 0);\n};\n//Return the number of days between two dates.\nDate.prototype.getDifferenceInDays = function getDifferenceInDays(otherDate)\n{\n//I have to do it this way, because this way ignores daylight savings\n var tmpDate = this.addDays(0);\n if (this.getTime() > otherDate.getTime())\n {\n var i = 0;\n for (i = 0; tmpDate.getTime() > otherDate.getTime(); i++)\n {\n tmpDate = tmpDate.addDays(-1);\n }\n return i;\n }\n else\n {\n var i = 0;\n for (i = 0; tmpDate.getTime() < otherDate.getTime(); i++)\n {\n tmpDate = tmpDate.addDays(1);\n }\n return i * -1;\n }\n return 0;\n};\nfunction cloneParams(what) {\n var tmp = {};\n for (var i in what) {\n tmp[i] = what[i];\n }\n return tmp;\n}\n// Substitute date components into a string\nDate.prototype.formatStringDateOnly = function formatStringDateOnly(template)\n{\n template = template.replace("YYYY",this.getFullYear());\n template = template.replace("YY",String.zeroPad(this.getFullYear()-2000,2));\n template = template.replace("MMM",config.messages.dates.months[this.getMonth()]);\n template = template.replace("0MM",String.zeroPad(this.getMonth()+1,2));\n template = template.replace("MM",this.getMonth()+1);\n template = template.replace("DDD",config.messages.dates.days[this.getDay()]);\n template = template.replace("0DD",String.zeroPad(this.getDate(),2));\n template = template.replace("DD",this.getDate());\n return template;\n};\n\n//}}}
/***\n''SaveOnExitPlugin for ~TiddlyWiki version 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#SaveOnExitPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nAs of TW 2.0.5, when exiting from a TW session with unsaved tiddler changes, an "onbeforeunload" event handler calls upon confirmExit() to display a message box with a warning message and options to stay on the current page or continue exiting and lose all changes.\n\nHowever, not all browsers support the use of the "onbeforeunload" event, so TW still supports the previous "onunload" event handler, which offers a "save-or-discard-before-exiting" option, but cannot stop the browser from exiting the TW session. Normally, when the newer confirmation message is used, the older message box is suppressed, so that only one confirmation message will be displayed.\n\nThis plugin prevents the "Save or Discard" confirmation message from being suppressed, so that the 'save-on-exit' option is still available, even after responding to the default "Exit or Cancel" message. ''This double check procedure adds just a bit more "data safety" to the TW exit process.''\n!!!!!Configuration\n<<<\n<<option chkSaveOnExit>> Enable second "save-before-exiting" confirmation message\n<<<\n!!!!!Revision History\n<<<\n2006.02.24 1.0.0\nInitial release. Replaces ConfirmExitPlugin, which is now included in the TW core functionality.\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n//{{{\nif (config.options.chkSaveOnExit==undefined) config.options.chkSaveOnExit=true; // default to extra safety\n// clear the standard exit message, since the second confirm message will show the "unsaved TiddlyWiki" warning text\nconfig.messages.confirmExit = "There are unsaved changes in TiddlyWiki.";\n// hijack standard confirm to clear flag so that second confirm will occur as well\nconfig.coreConfirmExit=window.confirmExit;\nwindow.confirmExit=function() { var r=config.coreConfirmExit(); window.hadConfirmExit=!config.options.chkSaveOnExit; return r; }\n//}}}\n
/***\n''SearchOptionsPlugin for TiddlyWiki version 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#SearchOptionsPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nThe TiddlyWiki search function normally looks in both tiddler titles and tiddler body content ('text'). However, narrowing the search so that it examines only titles or only text, or expanding the search to include text contained in tiddler tags can be very helpful, especially when searching on common words or phrases. In addition, it is often useful for the search results to show tiddlers with matching titles before tiddlers that contain matching text or tags.\n\n!!!!!Usage\n<<<\nThis plugin adds checkboxes (see below and in AdvancedOptions) to let you selectively configure the TiddlyWiki search function to just examine any combination of tiddler titles, text, or tags. It also provides an option to switch the search results order between 'titles mixed in' (default) and 'titles shown first', as well as an option display the search results as a list of links (in an auto-generated "SearchResults" tiddler), rather than actually displaying all matching tiddlers. You can also enable/disable the "incremental search" (key-by-key searching), so that a search is only initiated when you press the ENTER key or click on the "search:" prompt text.\n<<<\n!!!!!Configuration\n<<<\nIn additional to the checkboxes in AdvancedOptions, a self-contained control panel is included here for your convenience:\n<<option chkSearchTitles>> Search tiddler titles\n<<option chkSearchText>> Search tiddler text\n<<option chkSearchTags>> Search in tiddler tags\n<<option chkSearchTitlesFirst>> Show title matches first\n<<option chkSearchList>> Show list of matching tiddlers\n<<option chkSearchIncremental>> Incremental searching\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''SearchOptionsPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for SearchOptionsPlugin handling^^\n\nWhen installed, this plugin automatically adds checkboxes in the AdvancedOptions shadow tiddler so you can enable/disable the extended search behavior. However, if you have customized your AdvancedOptions, you will need to manually add {{{<<option chkSearchTitles>>}}}, {{{<<option chkSearchText>>}}} and {{{<<option chkSearchTitlesFirst>>}}} (with suitable prompt text) to your customized tiddler.\n<<<\n!!!!!Revision History\n<<<\n''2006.02.03 [2.2.1]''\nrewrite timeout clearing code and blank search text handling to match 2.0.4 core release changes. note that core no longer permits "blank=all" searches, so neither does this plugin. To search for all, use "." with text patterns enabled.\n''2006.02.02 [2.2.0]''\nin search.handler(), KeyHandler() function clears 'left over' timeout when search input is < 3 chars. Prevents searching on shorter text when shortened by rapid backspaces (<500msec)\n''2006.02.01 [2.1.9]''\nin Story.prototype.search(), correct inverted logic for using/not using regular expressions when searching\nalso, blank search text now presents "No search text. Continue anyway?" confirm() message box, so search on blank can still be processed if desired by user.\n''2006.02.01 [2.1.8]''\nin doSearch(), added alert/return if search text is blank\n''2006.01.20 [2.1.7]''\nfixed setting of config.macros.search.reportTitle so that Tweaks can override it.\n''2006.01.19 [2.1.6]''\nimproved SearchResults formatting, added a "search again" form to the report (based on a suggestion from MorrisGray)\ndefine results report title using config.macros.search.reportTitle instead of hard-coding the tiddler title\n''2006.01.18 [2.1.5]''\nCreated separate functions for reportSearchResults(text,matches) and discardSearchResults(), so that other developers can create alternative report generators.\n''2006.01.17 [2.1.4]''\nUse regExp.search() instead of regExp.test() to scan for matches. Correctd the problem where only half the matching tiddlers (the odd-numbered ones) were being reported.\n''2006.01.15 [2.1.3]''\nAdded information (date/time, username, search options used) to SearchResults output\n''2006.01.10 [2.1.2]''\nuse displayTiddlers() to render matched tiddlers. This lets you display multiple matching tiddlers, even if SinglePageModePlugin is enabled.\n''2006.01.08 [2.1.1]''\ncorrected invalid variable reference, "txt.value" to "text" in story.search()\n''2006.01.08 [2.1.0]''\nre-write to match new store.search(), store.search.handler() and story.search() functions.\n''2005.12.30 [2.0.0]''\nUpgraded to TW2.0\nwhen rendering SearchResults tiddler, closeTiddler() first to ensure display is refreshed.\n''2005.12.26 [1.4.0]''\nadded option to search for matching text in tiddler tags\n''2005.12.21 [1.3.7]''\nuse \s\s to 'escape' single quotes in tiddler titles when generating "Open all matching tiddlers" link. Also, added access key: "O", to trigger "open all" link.\nBased on a suggestion by UdoBorkowski.\n''2005.12.18 [1.3.6]''\ncall displayMessage() AFTER showing matching tiddlers so message is not cleared too soon\n''2005.12.17 [1.3.5]''\nif no matches found, just display message and delete any existing SearchResults tiddler.\n''2005.12.17 [1.3.4]''\nuse """{{{""" and """}}}""" to 'escape' display text in SearchResults tiddler to ensure that formatting contained in search string is not rendered \nBased on a suggestion by UdoBorkowski.\n''2005.12.14 [1.3.3]''\ntag SearchResults tiddler with 'excludeSearch' so it won't list itself in subsequent searches\nBased on a suggestion by UdoBorkowski.\n''2005.12.14 [1.3.2]''\nadded "open all matching tiddlers..." link to search results output.\nBased on a suggestion by UdoBorkowski.\n''2005.12.10 [1.3.1]''\nadded "discard search results" link to end of search list tiddler output for quick self-removal of 'SearchResults' tiddler.\n''2005.12.01 [1.3.0]''\nadded chkSearchIncremental to enable/disable 'incremental' searching (i.e., search after each keystroke) (default is ENABLED).\nadded handling for Enter key so it can be used to start a search.\nBased on a suggestion by LyallPearce\n''2005.11.25 [1.2.1]''\nrenamed from SearchTitleOrTextPlugin to SearchOptionsPlugin\n''2005.11.25 [1.2.0]''\nadded chkSearchList option\nBased on a suggestion by RodneyGomes\n''2005.10.19 [1.1.0]''\nadded chkSearchTitlesFirst option.\nBased on a suggestion by ChristianHauck\n''2005.10.18 [1.0.0]''\nInitial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nBased on a suggestion by LyallPearce.\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.SearchTitleOrText = {major: 2, minor: 2, revision: 1, date: new Date(2006,2,3)};\n//}}}\n\n//{{{\nif (config.options.chkSearchTitles==undefined) config.options.chkSearchTitles=true;\nif (config.options.chkSearchText==undefined) config.options.chkSearchText=true;\nif (config.options.chkSearchTags==undefined) config.options.chkSearchTags=true;\nif (config.options.chkSearchTitlesFirst==undefined) config.options.chkSearchTitlesFirst=false;\nif (config.options.chkSearchList==undefined) config.options.chkSearchList=false;\nif (config.options.chkSearchIncremental==undefined) config.options.chkSearchIncremental=true;\n\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSearchTitles>> Search in tiddler titles";\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSearchText>> Search in tiddler text";\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSearchTags>> Search in tiddler tags";\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSearchTitlesFirst>> Search results show title matches first";\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSearchList>> Search results show list of matching tiddlers";\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSearchIncremental>> Incremental searching";\n//}}}\n\n//{{{\nif (config.macros.search.reportTitle==undefined)\n config.macros.search.reportTitle="SearchResults";\n//}}}\n\n//{{{\nconfig.macros.search.handler = function(place,macroName,params)\n{\n var lastSearchText = "";\n var searchTimeout = null;\n var doSearch = function(txt)\n {\n if (txt.value.length>0)\n {\n story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);\n lastSearchText = txt.value;\n }\n };\n var clickHandler = function(e)\n {\n doSearch(this.nextSibling);\n return false;\n };\n var keyHandler = function(e)\n {\n if (!e) var e = window.event;\n switch(e.keyCode)\n {\n case 13: // ELS: handle enter key\n doSearch(this);\n break;\n case 27:\n this.value = "";\n clearMessage();\n break;\n }\n if (config.options.chkSearchIncremental)\n {\n if(this.value.length > 2)\n {\n if(this.value != lastSearchText)\n {\n if(searchTimeout) clearTimeout(searchTimeout);\n var txt = this;\n searchTimeout = setTimeout(function() {doSearch(txt);},500);\n }\n }\n else\n if(searchTimeout) clearTimeout(searchTimeout);\n }\n };\n var focusHandler = function(e)\n {\n this.select();\n };\n var btn = createTiddlyButton(place,this.label,this.prompt,clickHandler);\n var txt = createTiddlyElement(place,"input",null,null,null);\n if(params[0])\n txt.value = params[0];\n txt.onkeyup = keyHandler;\n txt.onfocus = focusHandler;\n txt.setAttribute("size",this.sizeTextbox);\n txt.setAttribute("accessKey",this.accessKey);\n txt.setAttribute("autocomplete","off");\n if(config.browser.isSafari)\n {\n txt.setAttribute("type","search");\n txt.setAttribute("results","5");\n }\n else\n txt.setAttribute("type","text");\n}\n//}}}\n\n//{{{\nStory.prototype.search = function(text,useCaseSensitive,useRegExp)\n{\n highlightHack = new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");\n var matches = store.search(highlightHack,"title","excludeSearch");\n var q = useRegExp ? "/" : "'";\n clearMessage();\n if (!matches.length) {\n if (config.options.chkSearchList) discardSearchResults();\n displayMessage(config.macros.search.failureMsg.format([q+text+q]));\n } else {\n if (config.options.chkSearchList) \n reportSearchResults(text,matches);\n else {\n var titles = []; for(var t=0; t<matches.length; t++) titles.push(matches[t].title);\n this.closeAllTiddlers(); story.displayTiddlers(null,titles);\n displayMessage(config.macros.search.successMsg.format([matches.length, q+text+q]));\n }\n }\n highlightHack = null;\n}\n//}}}\n\n//{{{\nTiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag)\n{\n var candidates = this.reverseLookup("tags",excludeTag,false,sortField);\n\n // scan for matching titles\n var title_results = [];\n if (config.options.chkSearchTitles)\n for(var t=0; t<candidates.length; t++)\n if(candidates[t].title.search(searchRegExp)!=-1)\n title_results.push(candidates[t]);\n\n // scan for matching text\n var text_results = [];\n if (config.options.chkSearchText)\n for(var t=0; t<candidates.length; t++)\n if(candidates[t].text.search(searchRegExp)!=-1)\n text_results.push(candidates[t]);\n\n // scan for matching tags\n var tag_results = [];\n if (config.options.chkSearchTags)\n for(var t=0; t<candidates.length; t++)\n if(candidates[t].tags.join(" ").search(searchRegExp)!=-1)\n tag_results.push(candidates[t]);\n\n // merge the results, eliminating redundant matches\n var results = [];\n for(var t=0; t<title_results.length; t++) results.pushUnique(title_results[t]);\n for(var t=0; t<text_results.length; t++) results.pushUnique(text_results[t]);\n for(var t=0; t<tag_results.length; t++) results.pushUnique(tag_results[t]);\n\n // if not 'titles first', re-sort results to so titles, text and tag matches are mixed together\n if(!sortField) sortField = "title";\n var bySortField=function (a,b) {if(a[sortField] == b[sortField]) return(0); else return (a[sortField] < b[sortField]) ? -1 : +1; }\n if (!config.options.chkSearchTitlesFirst) results.sort(bySortField);\n return results;\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n//{{{\nif (!window.reportSearchResults) window.reportSearchResults=function(text,matches)\n{\n var title=config.macros.search.reportTitle\n var q = config.options.chkRegExpSearch ? "/" : "'";\n var body="\sn";\n\n // summary: nn tiddlers found matching '...', options used\n body+="''"+config.macros.search.successMsg.format([matches.length,q+"{{{"+text+"}}}"+q])+"''\sn";\n body+="^^//searched in:// ";\n body+=(config.options.chkSearchTitles?"''titles'' ":"");\n body+=(config.options.chkSearchText?"''text'' ":"");\n body+=(config.options.chkSearchTags?"''tags'' ":"");\n if (config.options.chkCaseSensitiveSearch||config.options.chkRegExpSearch) {\n body+=" //with options:// ";\n body+=(config.options.chkCaseSensitiveSearch?"''case sensitive'' ":"");\n body+=(config.options.chkRegExpSearch?"''text patterns'' ":"");\n }\n body+="^^";\n\n // numbered list of links to matching tiddlers\n body+="\sn<<<";\n for(var t=0;t<matches.length;t++) body+="\sn# [["+matches[t].title+"]]";\n body+="\sn<<<\sn";\n\n // open all matches button\n body+="<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n body+="onclick=\s"story.displayTiddlers(null,["\n for(var t=0;t<matches.length;t++)\n body+="'"+matches[t].title.replace(/\s'/mg,"\s\s'")+"'"+((t<matches.length-1)?", ":"");\n body+="],1);\s" ";\n body+="accesskey=\s"O\s" ";\n body+="value=\s"open all matching tiddlers\s"></html> ";\n\n // discard search results button\n body+="<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n body+="onclick=\s"story.closeTiddler('"+title+"'); store.deleteTiddler('"+title+"');\s" ";\n body+="value=\s"discard "+title+"\s"></html>";\n\n // search again\n body+="\sn\sn----\sn";\n body+="<<search \s""+text+"\s">> ";\n body+="<<option chkSearchTitles>>titles ";\n body+="<<option chkSearchText>>text ";\n body+="<<option chkSearchTags>>tags";\n body+="<<option chkCaseSensitiveSearch>>case-sensitive ";\n body+="<<option chkRegExpSearch>>text patterns";\n\n // create/update the tiddler\n var tiddler=store.getTiddler(title); if (!tiddler) tiddler=new Tiddler();\n tiddler.set(title,body,config.options.txtUserName,(new Date()),"excludeLists excludeSearch");\n store.addTiddler(tiddler); story.closeTiddler(title);\n\n // use alternate "search again" label in <<search>> macro\n var oldprompt=config.macros.search.label;\n config.macros.search.label="search again";\n\n // render tiddler\n story.displayTiddler(null,title,1); // force refresh\n\n // restore standard search label\n config.macros.search.label=oldprompt;\n\n}\n\nif (!window.discardSearchResults) window.discardSearchResults=function()\n{\n // remove the tiddler\n story.closeTiddler(config.macros.search.reportTitle);\n store.deleteTiddler(config.macros.search.reportTitle);\n}\n//}}}\n\n\n
/***\n''Select Stylesheet Plugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#SelectStylesheetPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nSelect alternative TiddlyWiki CSS stylesheet 'themes' from a list of tiddlers tagged with "stylesheets".\n\n!!!!!Usage\n<<<\nThis plugin defines a macro that creates a stylesheet selection listbox/droplist that can be added to the content of any tiddler (such as the OptionsPanel or MainMenu tiddlers).\n\nFirst, create (or import) a custom style sheet tiddler (i.e, a tiddler containing CSS definitions) and tag it with <<tag stylesheets>> so it will appear in the selection list. Then, add the {{{<<selectStylesheet>>}}} macro to the desired tiddler to display the stylesheet list. Select your desired stylesheet from the droplist:\n** ''[none]'' bypasses all stylesheet tiddlers\n** ''[system]'' uses the built-in CSS definitions\n** ''[default]'' uses "StyleSheet" tiddler (if present)\n** //tiddlername// uses any named stylesheet\nThe currently selected stylesheet is indicated by a '>' symbol.\n\n//Note: If a previously selected stylesheet tiddler no longer exists (i.e, the tiddler was deleted or renamed after it had been selected for use), the [default] CSS tiddler ("StyleSheet") will be used as a fallback. If this tiddler does not exist either, then the built-in CSS definitions are used.//\n<<<\n!!!!!Parameters\n<<<\nThe selectStylesheet macro accepts parameters to control various features and functions. //Note: while each parameter is optional and may be omitted from the macro, the parameters (when present) must appear in the order shown below.//\n* ''size:nnn''\nDetermines the number of lines to display in the stylesheet list. If this parameter is omitted or "size:1" is specified, a single-line droplist is created. When a size > 1 is provided, a standard, fixed-size scrollable listbox is created. You can use "size:0" or "size:auto" to display a varible-height listbox that automatically adjusts to fit the current list contents without scrolling.\n* ''width:nnn[cm|px|em|%]''\nControls the width of the stylesheet list. Overrides the built-in CSS width declaration (=100%). Use standard CSS width units (cm=centimeters, px=pixels, em=M-space, %=proportional to containing area). You can also use a ".selectStylesheet" custom CSS class definition to override the built-in CSS declarations for the stylesheet list.\n<<<\n!!!!!Nested Stylesheets\n<<<\nThe CSS definitions for TiddlyWiki are fairly substantial, and stylesheet tiddlers can include hundreds of lines of CSS statements. Often, these stylesheets will use the exact same CSS for the bulk of their definitions plus several changes or additions to create a difference in appearance. This results in lots of duplicated CSS definitions that can become difficult to keep 'in sync' with each other.\n\nTo make this problem much easier to manage, you can move the common CSS definitions into separate stylesheet tiddlers. Then, embed {{{[[tiddlertitle]]}}} references in the original stylesheet tiddlers to re-combine the CSS definitions into a single stylesheet 'theme' to be applied.\n\nWith some clever division of CSS into separate tiddlers, you can quite easily construct dozens of stylesheet combinations. You can also mark the common CSS tiddlers with tags and use them as overlay stylesheets so you can mix-and-match their styles to create even more 'on-the-fly' stylesheet combinations.\n\nNote: Normally, when rendering tiddler content for display, the {{{[[tiddlertitle]]}}} syntax means "insert a link to this tiddler". However, when applying stylesheets, this syntax means "insert the content of this tiddler"\n<<<\n!!!!!Changing templates or invoking custom javascript from a stylesheet\n<<<\nIn addition to CSS definitions, some TiddlyWiki look-and-feel designs also make adjustments to the TiddlyWiki document structure so that certain document features can be moved, hidden, or otherwise redefined. The default set of templates that control the document structure are called PageTemplate, ViewTemplate, and EditTemplate. To select an alternative set of templates, you can include the special psuedo-macro ''{{{<<template prefix>>}}}'' in your stylesheet. This adds the indicated prefix to the standard template names, and automatically switches to using those templates whenever the stylesheet is selected and applied.\n\nWhenever a document is being viewed in read-only mode (i.e., via http: protocol), an implied template prefix of "Web" is also used, and is inserted between any custom template prefix and the standard template name. For example, ''{{{<<template Custom>>}}}'' will use {{{CustomWebViewTemplate}}} when the document is in read-only mode. You can specify an alternative for this implied prefix by including a second prefix parameter in the pseudo-macro. For example, ''{{{<<template Custom ReadOnly>>}}}'' will use {{{CustomReadOnlyViewTemplate}}}. Note: if a template tiddler with the indicated combination of custom and read-only prefixes is not available, a suitable fallback template is chosen, first by omitting the custom prefix, then by omitting the read-only prefix, and finally by omitting both, and reverting to the appropriate default template.\n\nIn addition to selecting alternative templates, a stylesheet can also include the psuedo-macro ''{{{<<init tiddlertitle>>}}}'' to execute custom javascript that can access TiddlyWiki internal data and 'core' functions or perform direct manipulation of the currently-rendered DOM elements of the document. First, place the desired javascript code into one or more tiddlers (note: //although these tiddlers will contain javascript, ''do NOT tag them as 'systemConfig', since this will cause the javascript to be executed every time TW starts'', rather than only when a specific stylesheet has been selected//). Then, add the ''{{{<<init tiddlertitle>>}}}'' pseudo-macro to your stylesheet so the javascript will be executed when that specific stylesheet is selected and applied.\n\nOf course, when another stylesheet is subsequently selected, other custom javascript functions may be needed to reset whatever TW internal data changes or DOM manipulations were performed by any {{{<<init>>}}} scripts. You can define tiddlers containing these ''reset'' scripts by embedding ''{{{<<reset tiddlertitle>>}}}'' in your stylesheet definition. Unlike {{{<<init>>}}} scripts, any tiddlers declared in this way will NOT be executed when the stylesheet is applied, but will be remembered and automatically executed before applying another stylesheet.\n\nNote: These special-purpose psuedo-macros are only executed when the stylesheet containing them is actually in use. When these macros are rendered as part of the tiddler content (such as when //viewing// a stylesheet definition), the macros simply report their values without performing any actions.\n<<<\n!!!!!Examples\n<<<\n^^single auto-sized listbox^^\n<<selectStylesheet size:auto width:60%>>\n^^droplist for stylesheets^^\n<<selectStylesheet size:1 width:30%>>\n^^stylesheet definitions (tagged with "stylesheets"):^^\n<<tag stylesheets>>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''SelectStylesheetPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for SelectStylesheethandling^^\n\ncreate/edit ''OptionsPanel'':\nAdd "{{{<<selectStylesheet [size:nnn|auto] [width:nnn[cm|px|em|%]>>}}}" macro.\n<<<\n!!!!!Revision History\n<<<\n''2006.03.09 [4.1.4]''\nin refreshSelectStylesheet(), make sure that tiddler named in stylesheet cookie value still exists before attempting to select it in the listbox.\n''2006.02.25 [4.1.3]''\nProblem: the ">" indicator was not always being refreshed, due to event "timing" issues. refreshSelectStylesheet() deferred for 10msec so it will execute *after* onChangeSelectStylesheet event processing has completed.\n''2006.02.24 [4.1.2]''\nProblem: """<<template>>""" macro was not being processed in IE.\nCause: regexp processing creates browser-internal "private globals" used to keep track of the regexp parser's state, including the current 'scan' position within the source string. This lets you use search() and exec() inside loops to scan for successive pattern matches. In applyStyleSheet(), "theCSS.search(templateRegExp)" was called before "theCSS.exec(templateRegExp)". As a result, the regexp parser had already matched the """<<template>>""" macro embedded in the CSS and thus did not actually process the macro and switch the templates.\nFix: use """indexOf("<<template")""" instead of search(templateRegExp) to check for presence of template switching macro in CSS.\n''2006.02.23 [4.1.1]''\nperformance fixes: in switchTemplates(), added default init of 'altTemplate' value to prevent unneeded triggering of refreshPageTemplate() during TW load-time when using standard templates. Saves LOTS of startup time and avoids the dreaded "script is running slowly" FireFox warnings.\nAlso, the forEachTiddler() call to force a "refresh all tiddlers" (needed when view/edit templates are changed) was moved from applyPageTemplate() and is now called directly from switchTemplates(). This eliminates redundant re-rendering of tiddlers while the page template is being refreshed.\n''2006.02.21 [4.1.0]''\nadded """<<template>>""" pseudo-macro with new switchTemplate() function. Allows stylsheets to switch page/view/edit templates by adding a prefix to standard template names. Detects readOnly mode and automatically adds "Web" to template name (e.g. "MyWebViewTemplate"). Defines "Web" shadow templates and "viewSource" toolbar command.\n''2006.02.21 [4.0.3]''\nadded real macro handlers for psuedo-macros "init", "reset" so they will display in the stylesheet tiddler without appearing as an error.\n''2006.01.20 [4.0.2]''\nadd 'var' to unintended global variable declarations and wrapped notification hijack in init function to eliminate globals and avoid FireFox 1.5.0.1 crash bug when referencing globals\n''2006.01.20 [4.0.1]''\nAdded optional "init" keyword for {{{<<init tiddlertitle>>}}} psuedo-macro syntax (note: previous {{{<<tiddlertitle>>}}} syntax still permitted)\nRevised documentation to better describe use of init/reset for custom code invokation.\n''2005.11.05 [4.0.0]''\nEntire plugin simplified in response to new "shadow stylesheet" architecture introduced in TW1.2.37. Concept of separate overlays has been removed. Stylesheet themes are assembled using [[tiddler]] 'nesting' syntax, and tagged as 'stylesheet'. A single listbox/droplist is provided to select themes.\n''2005.10.25 [3.1.0]''\nadded support for embedding {{{<<reset tiddlertitle>>}}} companion code (to declare 'DOM cleanup' routines invoked when a stylesheet is UNloaded)\n//Based on a request from ClintChecketts//\n''2005.10.09 [3.0.1]''\ncombined documentation and code in a single tiddler\n''2005.08.15 [3.0.0]''\nAnother major re-write. Replaced separate "selectOverlays" macro definition with 'overlays' parameter on 'selectStylesheet' macro. Added support for embedding {{{<<tiddlertitle>>}}} companion code. applyStylesheets() completely re-designed to address quirks with loading and combining multiple stylesheets using browser-specific native handling, as well as add support for executing companion code. Stylesheets+overlays+code are now handled in a platform-neutral manner that avoids differences between browser implementations and uses much less overhead in the DOM.\n''2005.08.07 [2.0.0]''\nMajor re-write to not use static ID values for listbox controls, so that multiple macro instances can exist without corrupting each other or the DOM. Moved HTML and CSS definitions into plugin code instead of using separate tiddlers. Added new features: support for multiple groups of overlay stylesheets with collapsible tree display. Added size and width params for listbox display.\n''2005.07.27 [1.0.3]''\ncore update 1.2.29: custom overlayStyleSheet() replaced with new core setStylesheet()\n''2005.07.25 [1.0.2]''\ncorrect 'fallback' handling in selectStyleSheet()\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]]. Thanks to David Jaquith for testing and bug reports and SteveRumsby for feature suggestions.\n<<<\n!!!!!Code\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//{{{\nversion.extensions.selectStylesheet = {major: 4, minor: 1, revision: 4, date: new Date(2006,3,9)};\n\n// IE needs explicit global scoping for functions/vars called from browser events\nwindow.onChangeSelectStylesheet=onChangeSelectStylesheet;\nwindow.refreshSelectStylesheet=refreshSelectStylesheet;\nwindow.applyStylesheets=applyStylesheets;\n\nif (!config.options.txtStyleSheet) config.options.txtStyleSheet="StyleSheet";\n//}}}\n\n//{{{\n// define macro rendering handler\nconfig.macros.selectStylesheet = { };\nconfig.macros.selectStylesheet.reset = [];\nconfig.macros.selectStylesheet.handler = function(place,macroName,params) {\n setStylesheet(".selectStylesheet {width:100%;font-size:8pt;margin:0em}","selectStylesheetPlugin");\n var theList=createTiddlyElement(place,"select",null,"selectStylesheet",null);\n theList.onchange=onChangeSelectStylesheet;\n theList.size=1;\n theList.autosize=1;\n if (params[0] && (params[0]=="size:auto")) { theList.autosize=0; params.shift(); }\n if (params[0] && (params[0].substr(0,5)=="size:")) theList.autosize=(params.shift()).substr(5);\n if (params[0] && (params[0].substr(0,6)=="width:")) theList.style.width=(params.shift()).substr(6);\n theList.extraStyles=params;\n store.addNotification(null,refreshSelectStylesheet);\n refreshSelectStylesheet();\n}\n// set to TRUE to enable debugging status messages when stylesheets are applied\nconfig.macros.selectStylesheet.verbose = false;\n\n// hijack existing notifications for refreshStyles() handler\ninitSelectStylesheetNotification();\nfunction initSelectStylesheetNotification() {\n for (var i=0; i<store.namedNotifications.length; i++)\n if (store.namedNotifications[i].notify==window.refreshStyles)\n store.namedNotifications[i].notify=applyStylesheets;\n}\n\n// hijack refreshStyles() handler\nwindow.refreshStyles=applyStylesheets;\n\nfunction onChangeSelectStylesheet()\n{\n if (this.value=="") return;\n config.options.txtStyleSheet=this.value;\n saveOptionCookie("txtStyleSheet");\n applyStylesheets();\n setTimeout("refreshSelectStylesheet()",10); // delay until after event handler returns\n return;\n}\n\nfunction getElementsByClass(classname)\n{\n var arr=new Array();\n var count=0;\n var all=document.all? document.all : document.getElementsByTagName("*");\n for (var i=0; i<all.length; i++)\n if (all[i].className==classname)\n arr[count++]=all[i];\n return arr;\n}\n\nfunction refreshSelectStylesheet()\n{\n var indent = String.fromCharCode(160)+String.fromCharCode(160)+String.fromCharCode(160);\n // for all instances of the selectStylesheet control\n var allStyleLists=getElementsByClass("selectStylesheet");\n for (var k=0; k<allStyleLists.length; k++) {\n var theList=allStyleLists[k];\n // clear current list contents\n while (theList.length > 0) { theList.options[0] = null; }\n theList.selectedIndex=-1;\n // fill the stylesheet list\n var count=0;\n // prompt text\n theList.options[count++] = new Option("select a stylesheet:","",false,false);\n // option: none (built-in hard-coded CSS only)\n theList.options[count++] = new Option(indent+"[none]","[none]",false,false);\n // option: default (built-in plus shadow stylesheets)\n theList.options[count++] = new Option(indent+"[system]","[system]",false,false);\n // option: StyleSheet tiddler, if present\n if (store.getTiddler("StyleSheet")!=undefined)\n theList.options[count++] = new Option(indent+"[default]","StyleSheet",false,false);\n // options: CSS tiddlers tagged with "stylesheets"\n var theSheets=store.getTaggedTiddlers("stylesheets");\n for (var i=0; i<theSheets.length; i++) {\n var theTitle=theSheets[i].title;\n if (theTitle=="StyleSheet") continue;\n theList.options[count++] = new Option(indent+theTitle,theTitle,false,false);\n }\n // make sure the requested stylesheet exists, fallback if not...\n var theSheet=config.options.txtStyleSheet;\n if (theSheet!="[none]" && theSheet!="[system]" && !store.getTiddler(theSheet)) theSheet="StyleSheet";\n if (!store.getTiddler(theSheet)) theSheet="[system]";\n // set the listbox selection to current stylesheet\n theList.selectedIndex=0; // default to first item\n for (var t=0; t<theList.options.length; t++) \n if (theList.options[t].value==theSheet)\n { theList.selectedIndex=t; break; }\n theList.options[t].text=">"+theList.options[t].text.substr(2);\n // autosize as appropriate\n theList.size=(theList.autosize<1)?theList.options.length:theList.autosize;\n } // end of "for all instances"\n}\n//}}}\n\n//{{{\nconfig.macros.selectStylesheet.templates = { };\nfunction switchTemplates(which,readOnlyPrefix)\n{\n // remember original templates (init only)\n if (!config.macros.selectStylesheet.templates.originalpage)\n config.macros.selectStylesheet.templates.originalpage = "PageTemplate";\n if (!config.macros.selectStylesheet.templates.originalview)\n config.macros.selectStylesheet.templates.originalview = config.tiddlerTemplates[1];\n if (!config.macros.selectStylesheet.templates.originaledit)\n config.macros.selectStylesheet.templates.originaledit = config.tiddlerTemplates[2];\n if (!config.macros.selectStylesheet.altTemplate)\n config.macros.selectStylesheet.altTemplate="";\n\n // define shorthand variables just for code readability \n var page=config.macros.selectStylesheet.templates.originalpage;\n var view=config.macros.selectStylesheet.templates.originalview;\n var edit=config.macros.selectStylesheet.templates.originaledit;\n\n // get 'readOnly' mode... set by TW core, but not until after the plugin is loaded, so we need to do this here as well...\n var loc = document.location.toString();\n if (readOnly==undefined)\n var readOnly = (loc.substr(0,4) == "http" || loc.substr(0,3) == "ftp") ? config.options.chkHttpReadOnly : false;\n\n // get prefix defaults\n if (!which) var which="";\n if (!readOnlyPrefix) var readOnlyPrefix = "Web";\n if (!readOnly) readOnlyPrefix="";\n var alt = which+readOnlyPrefix;\n\n var msg="current template prefix: '%0', requested template prefix '%1'";\n if (config.macros.selectStylesheet.verbose) alert(msg.format([config.macros.selectStylesheet.altTemplate,alt]));\n\n // only switch if really changing templates\n if (alt == config.macros.selectStylesheet.altTemplate) return;\n\n // remember which templates are being used\n config.macros.selectStylesheet.altTemplate = alt;\n\n // set page template, with fallbacks for missing combinations\n var pageTemplate=alt+page;\n if (!store.getTiddlerText(pageTemplate)) pageTemplate=which+page;\n if (!store.getTiddlerText(pageTemplate)) pageTemplate=readOnlyPrefix+page;\n if (!store.getTiddlerText(pageTemplate)) pageTemplate=page;\n config.macros.selectStylesheet.templates.currentpage = pageTemplate;\n\n // set view template, with fallbacks for missing combinations\n var viewTemplate=alt+view;\n if (!store.getTiddlerText(viewTemplate)) viewTemplate=which+view;\n if (!store.getTiddlerText(viewTemplate)) viewTemplate=readOnlyPrefix+view;\n if (!store.getTiddlerText(viewTemplate)) viewTemplate=view;\n config.tiddlerTemplates[1] = config.macros.selectStylesheet.templates.currentview = viewTemplate;\n\n // set edit template, with fallbacks for missing combinations\n var editTemplate=alt+edit;\n if (!store.getTiddlerText(editTemplate)) editTemplate=which+edit;\n if (!store.getTiddlerText(editTemplate)) editTemplate=readOnlyPrefix+edit;\n if (!store.getTiddlerText(editTemplate)) editTemplate=edit;\n config.tiddlerTemplates[2] = config.macros.selectStylesheet.templates.currentedit = editTemplate;\n\n var msg="switching to templates: %0, %1, %2";\n if (config.macros.selectStylesheet.verbose) alert(msg.format([pageTemplate,viewTemplate,editTemplate]));\n\n // apply page template\n window.applyPageTemplate();\n // apply view/edit templates\n story.forEachTiddler(function(title,element) { this.refreshTiddler(title,null,true);});\n\n}\n\n// Hijack the applyPageTemplate so the alternate page template (if any) will refresh correctly\nconfig.macros.selectStylesheet.coreApplyPageTemplate = window.applyPageTemplate;\nwindow.applyPageTemplate = function(template)\n{\n var cw=document.getElementById("contentWrapper");\n cw.style.display="none";\n config.macros.selectStylesheet.coreApplyPageTemplate(config.macros.selectStylesheet.templates.currentpage);\n cw.style.display="block";\n}\n\n// define "viewSource" toolbar command for use in read-only templates\nconfig.commands.viewSource = {text: "source", tooltip: "View this tiddler's wiki markup"},\nconfig.commands.viewSource.handler = function(event,src,title){\n story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE);\n var theTiddler = document.getElementById("tiddler"+title);\n var tiddlerElements = theTiddler.getElementsByTagName("textarea")\n for (var i=0; i<tiddlerElements.length; i++) tiddlerElements[i].setAttribute("readonly","readonly");\n if (tiddlerElements.length) { tiddlerElements[0].focus(); tiddlerElements[0].select(); }\n return false;\n}\n\n/* DISABLED - DON'T CREATE SHADOWS - USE DEFAULT TEMPLATES\n// create shadow tiddlers to ensure that read-only views are available...\nconfig.shadowTiddlers['WebPageTemplate'] = store.getTiddlerText("PageTemplate");\nconfig.shadowTiddlers['Web'+config.tiddlerTemplates[1]] = store.getTiddlerText(config.tiddlerTemplates[1]).replace(/\s+editTiddler/,"+viewSource");\nconfig.shadowTiddlers['Web'+config.tiddlerTemplates[2]] = "<!--{{{-->\sn<div class='toolbar' macro='toolbar -cancelTiddler'></div>\sn<div class='title'><span macro='view title'></span> (source code)</div>\sn<div class='editor' macro='edit text'></div>\sn<!--}}}-->\sn";\n*/\n\n//}}}\n\n//{{{\nfunction applyStylesheets()\n{\n // define pattern to match executable <<tiddlername>> references embedded in CSS text\n var setTiddlerRegExp = new RegExp("(?:<<(?:init )([^>]+)>>)","mg");\n var resetTiddlerRegExp = new RegExp("(?:<<reset ([^>]+)>>)","mg");\n var templateRegExp = new RegExp("(?:<<template ([^\ss>]+)( [^>]+)?>>)","mg");\n\n // make sure the requested stylesheet exists, fallback if not...\n var theSheet=config.options.txtStyleSheet;\n switch (theSheet) {\n case "[none]":\n case "[system]":\n break;\n default:\n if (!store.getTiddler(theSheet)) theSheet="StyleSheet";\n if (!store.getTiddler(theSheet)) theSheet="[system]";\n break;\n }\n\n // When store.NotifyAll() is invoked, it can trigger multiple calls to applyStylesheets(),\n // even though only one is needed to set the styles and render things properly. The extra calls\n // add unnecessary processing overhead by performing multiple re-rendering of entire TW display,\n // often resulting in "slow script" warnings. To avoid this, we can track the last stylesheet that\n // was applied and only apply the current requested sheet if it is really a different sheet, OR\n // if the TW contents have actually changed (which might include changes to the current stylesheet)\n if (theSheet==config.macros.selectStylesheet.current && !store.dirty) return;\n config.macros.selectStylesheet.current=theSheet;\n\n // get the primary stylesheet CSS\n var msg="stylesheet: '%0'";\n if (config.macros.selectStylesheet.verbose) alert(msg.format([theSheet]));\n var theCSS = (theSheet.substr(0,1)=='[')?"":store.getRecursiveTiddlerText(theSheet,"");\n if (theSheet.substr(0,1)!='[') store.addNotification(theSheet,refreshStyles);\n\n // if <<template>> reference is not specified, reset to standard template\n if (theCSS.indexOf("<<template")==-1) switchTemplates();\n\n // execute any embedded <<template>> references\n do {\n var match = templateRegExp.exec(theCSS);\n if(match && match[1]) switchTemplates(match[1],match[2]);\n } while(match);\n // filter out embedded <<template>> references\n theCSS = theCSS.replace(templateRegExp,"");\n\n // execute any saved stylesheet 'reset' code tiddlers\n while (config.macros.selectStylesheet.reset.length) {\n var tiddler=config.macros.selectStylesheet.reset.shift();\n var msg="stylesheet reset macro: '%0'";\n if (config.macros.selectStylesheet.verbose) alert(msg.format([tiddler]));\n var msg="error in '%0': %1";\n try { window.eval(store.getTiddlerText(tiddler)); }\n catch(e) { displayMessage(msg.format([tiddler,e.toString()])); }\n }\n\n // save embedded <<reset tiddlername>> references\n do {\n var match = resetTiddlerRegExp.exec(theCSS);\n if(match && match[1])\n config.macros.selectStylesheet.reset.push(match[1]);\n } while(match);\n // filter out embedded <<reset tiddlername>> references\n theCSS = theCSS.replace(resetTiddlerRegExp,"");\n\n // execute any embedded <<init tiddlername>> references\n do {\n var match = setTiddlerRegExp.exec(theCSS);\n if(match && match[1]) {\n var msg="stylesheet macro: '%0'";\n if (config.macros.selectStylesheet.verbose) alert(msg.format([match[1]]));\n var msg="error in '%0': %1";\n try { window.eval(store.getTiddlerText(match[1])); }\n catch(e) { displayMessage(msg.format([match[1],e.toString()])); }\n }\n } while(match);\n // filter out embedded <<set tiddlername>> references\n theCSS = theCSS.replace(setTiddlerRegExp,"");\n\n // finally, apply the styles\n switch (theSheet) {\n case "[none]":\n setStylesheet("","StyleSheetColors");\n setStylesheet("","StyleSheetLayout");\n setStylesheet("","StyleSheet");\n break;\n case "[system]":\n setStylesheet(store.getTiddlerText("StyleSheetColors"),"StyleSheetColors");\n setStylesheet(store.getTiddlerText("StyleSheetLayout"),"StyleSheetLayout");\n setStylesheet("","StyleSheet");\n break;\n default:\n setStylesheet("/* overridden by [["+theSheet+"]] */","StyleSheetColors");\n setStylesheet("/* overridden by [["+theSheet+"]] */","StyleSheetLayout");\n setStylesheet(theCSS,"StyleSheet");\n break;\n }\n}\n\nconfig.macros.init = { };\nconfig.macros.init.handler = function(place,macroName,params)\n { var out="init: [[%0]]"; wikify(out.format(params),place); }\nconfig.macros.reset = { };\nconfig.macros.reset.handler = function(place,macroName,params)\n { var out="reset: [[%0]]"; wikify(out.format(params),place); }\nconfig.macros.template = { };\nconfig.macros.template.handler = function(place,macroName,params)\n { var out="use template prefix: ''%0 %1''"; wikify(out.format(params),place); }\n\n//}}}
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal 'DD MMM YYYY'>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>><<upload>>
/***\n''Single Page Mode Plugin for TiddlyWiki version 2.0 or above''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#SinglePageModePlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nNormally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.\n\n!!!!!Usage\n<<<\nSinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. You can select a checkbox in the AdvancedOptions tiddler to enable this behavior or revert to the standard TiddlyWiki multiple tiddler display behavior.\n\nWhen SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.\n\n//Note: This feature currently effects ALL tiddler display behavior, including features that normally result in multiple tiddlers being displayed, such as the results of searches or the initial DefaultTiddlers shown when the document is loaded. //\n<<<\n!!!!!Configuration\n<<<\nWhen installed, this plugin automatically adds a checkbox in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. You can also use the following ''control panel'' checkbox to change the current plugin handling:\n\n<<option chkSinglePageMode>> Display one tiddler at a time\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for SinglePageMode handling^^\n\nWhen installed, this plugin automatically adds a checkbox in the AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to manually add ''"<< {{{option chkSinglePageMode}}} >> display one tiddler at a time"'' to your customized tiddler.\n<<<\n!!!!!Revision History\n<<<\n''2006.02.04 [2.1.1]''\nmoved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n''2005.12.27 [2.1.0]''\nhijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list) \nalso, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers\n''2005.12.27 [2.0.0]''\nUpdate for TW2.0\n''2005.11.24 [1.1.2]''\nWhen the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts\n''2005.10.14 [1.1.1]''\npermalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them\n''2005.10.14 [1.1.0]''\nadded automatic setting of window title and location bar ('auto-permalink').\nfeature suggestion by David Dickens.\n''2005.10.09 [1.0.1]''\ncombined documentation and code in a single tiddler\n''2005.08.15 [1.0.0]''\nInitial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nSupport for BACK/FORWARD buttons adapted from code developed by Clint Checketts\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.SinglePageMode= {major: 2, minor: 1, revision: 1, date: new Date(2006,2,4)};\n\nif (config.options.chkSinglePageMode==undefined)\n config.options.chkSinglePageMode=false;\n\nconfig.shadowTiddlers.AdvancedOptions\n += "\sn<<option chkSinglePageMode>> Display one tiddler at a time";\n\nconfig.SPMTimer = 0;\nconfig.lastURL = window.location.hash;\nfunction checkLastURL()\n{\n if (!config.options.chkSinglePageMode)\n { window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }\n if (config.lastURL == window.location.hash)\n return;\n var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));\n tiddlerName=tiddlerName.replace(/\s[\s[/,"").replace(/\s]\s]/,""); // strip any [[ ]] bracketing\n if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);\n}\n\nStory.prototype.coreDisplayTiddler=Story.prototype.displayTiddler;\nStory.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)\n{\n if (config.options.chkSinglePageMode) {\n window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));\n config.lastURL = window.location.hash;\n document.title = wikifyPlain("SiteTitle") + " - " + title;\n story.closeAllTiddlers();\n if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);\n }\n this.coreDisplayTiddler(srcElement,title,template,animate,slowly)\n}\n\nStory.prototype.coreDisplayTiddlers=Story.prototype.displayTiddlers;\nStory.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)\n{\n // suspend single-page mode when displaying multiple tiddlers\n var save=config.options.chkSinglePageMode;\n config.options.chkSinglePageMode=false;\n this.coreDisplayTiddlers(srcElement,titles,template,unused1,unused2,animate,slowly);\n config.options.chkSinglePageMode=save;\n}\n//}}}
SiteUploadVoorbeeld
// // ''[[SystemTweaks|http://www.elsdesign.com/tiddlywiki/#SystemTweaks]] for TiddlyWiki version 1.2.34'' //(and beyond???)//\n// // ''Eric Shulman - ELS Design Studios''\n\n// This systemConfig tiddler contains small patches ("tweaks") to TW core functions, in order to address specific problems or issues. These changes enhance, extend, or correct existing functionality and should be backward-compatible with all current usage of the existing core functions. Hopefully, some (or all) of these changes will eventually be incorporated into the core codebase, making these tweaks obsolete. //\n\n// // ''tweak: createTiddlerEditor()''\n// // ^^ \n// // Limits tiddler editor text area control to a max # of rows\n// // Source: adapted from Dan Haley's KeeperWiki (http://www.bigwhitesatellite.com)\n// // ^^ \n//{{{\n\n// don't want the edit box to be so tall (also overrode stylesheet for width)\nvar maxrows=40;\nvar coreCreateTiddlerEditor = window.createTiddlerEditor;\nwindow.createTiddlerEditor = function(title)\n{\n coreCreateTiddlerEditor(title);\n var box=document.getElementById("body"+title).getElementsByTagName("TEXTAREA")[0];\n var rows=parseInt(box.getAttribute("rows"));\n if (rows>maxrows) box.setAttribute("rows",maxrows.toString());\n}\n//}}}\n\n// // ''tweak: loadSystemConfig()''\n// // ^^ \n// // When an error occurs in a systemConfig tiddler, the message that is currently displayed (version 1.2.34) includes the error text, but doesn't include the name of the tiddler that caused the error. This tweak adds the name of the tiddler to error message output.\n// // ^^ \n/*\n{{{\n*/\nconfig.messages.customConfigError="Error in customConfig '%0' - %1";\nfunction loadSystemConfig()\n{\n var configTiddlers = store.getTaggedTiddlers("systemConfig");\n for(var t=0; t<configTiddlers.length; t++)\n {\n var ex = processConfig(configTiddlers[t].text);\n if(ex)\n displayMessage(config.messages.customConfigError.format([configTiddlers[t].title,ex]));\n }\n}\n/*\n}}}\n*/\n// // ''tweak: store.addNotification()''\n// // ^^ \n// // systemConfig tiddlers may be invoked multiple times (especially true if they define macros used to create dynamic tiddler content). If the tiddler registers notification handlers, it can add redundant entries in the notification array, one for each time the macro is invoked. As a result, the handler may be invoked multiple times in response to a single notify() call. Depending upon the action of the handler, this may produce incorrect or unexpected results. This tweak checks for matching notifications (by title and function) to avoid adding redundant entries.\n// // ^^ \n/*\n{{{\n*/\nstore.addNotification = function(title,fn)\n{\n // don't add redundant notifications\n for (var i=0; i<this.namedNotifications.length; i++)\n if ((this.namedNotifications[i].name==title)&&(this.namedNotifications[i].notify==fn))\n return this;\n this.namedNotifications.push({name: title, notify: fn});\n return this;\n}\n/*\n}}}\n*/\n// // ''tweak: store.notify()''\n// // ^^ \n// // systemConfig tiddlers can have fatal errors during notification handling. Whenever TW exits a tiddler edit-mode (i.e., 'done' is pressed), the notification functions are invoked. If a notification handler has a fatal error, the remainder of the 'saveTiddler()' processing doesn't happen. The visible result is that the tiddler seems to stay in edit mode. Interestingly enough, the tiddler content IS saved to the store before the error occurs, so it is possible to save changes to a tiddler and then reload the page to (hopefully) correct the error. This tweak adds "try... catch" handling in notify() and notifyAll(), so that if a notification function does have an error, an error message can be displayed, instead of stopping dead in its tracks.\n// // ^^ \n/*\n{{{\n*/\nconfig.messages.notifyError="Error during notification function '%1(%0)' - %2";\nstore.notify = function(title,doBlanket)\n{\n var errmsg=config.messages.notifyError;\n for(var t=0; t<this.namedNotifications.length; t++)\n {\n var n = this.namedNotifications[t];\n if((n.name == null && doBlanket) || n.name == title)\n {\n try { n.notify(title); }\n catch(e)\n {\n var fnname=n.notify.toString(this);\n fnname=fnname.substring(10,fnname.indexOf('('));\n displayMessage(errmsg.format([title,fnname,e.toString()]));\n }\n }\n }\n}\nstore.notifyAll = function()\n{\n var errmsg=config.messages.notifyError;\n for(var t=0; t<this.namedNotifications.length; t++)\n {\n var n = this.namedNotifications[t];\n try { n.notify(n.name); }\n catch(e)\n {\n var fnname=n.notify.toString(this);\n fnname=fnname.substring(10,fnname.indexOf('('));\n displayMessage(errmsg.format([n.name,fnname,e.toString()]));\n }\n }\n}\n// Un-comment the next 2 lines to test the error message reporting...\n// function testerror(title){throw "test error"}\n// store.addNotification('SystemTweaks',testerror);\n// after save/reload, make a change to this tiddler (SystemTweaks) to trigger the test\n/*\n}}}\n*/\n\n// // ''tweak: manualConvertUnicodeToUTF8()''\n// // ^^ \n// // Saving a big document in IE can take a lot of time. For example: 250 tiddlers, around 400K, took over 25 seconds! This tweak reduces that time to less than 2 seconds by re-writing the manualConvertUnicodeToUTF8 method to use a regular expression instead of an iterative loop to convert characters outside the ASCII range (above 0x7F) into HTML unicode ("&#FF") format.\n// // ''source:'' Paul Petterson\n// // ^^ \n/*\n{{{\n*/\nwindow.manualConvertUnicodeToUTF8 = function(s) \n{ \n var re=/[^\su0000-\su007F]/g ; \n return( s.replace(re, function($0){return( "&#"+$0.charCodeAt(0).toString()+";" );} ) ); \n} \n/*\n}}}\n*/\n\n// // ''tweak: createTiddlerPopup()''\n// // ^^ \n// // The position of a popup is based on the position of the srcElement it is contained in, using the srcElement.offsetLeft and srcElement.offsetTop values. However, these values only represent the actual position of the srcElement when its containing parent element is a BODY or HTML object, or the srcElement and all of its containing elements (up to and including BODY or HTML) is not styled with 'position:relative' (i.e., the position is undeclared (defaulting to 'static'), or declared as one of 'absolute', 'static', or 'fixed'\n\n// // When the srcElement (or a containing element) DOES have style "position:relative", it is positioned with respect to the origin of the containing element, rather than the top-level BODY or HTML element. Of course, this container can have it's own values for offsetLeft and offsetTop, which in turn, can be relative to the origin of it's container, etc.\n\n// // Currently, the core createTiddlerPopup() only checks srcElement.parentNode to add any offsetLeft and offsetTop values. Clearly, this is not sufficient, since the immediate parent element may not be relatively-positioned, but may be contained within another element that is.\n\n// // So, to find the actual position of a srcElement, we need to total the offsetLeft and offsetTop values from each containing parent element, all the way back to the top BODY or HTML element. Of course, when a containing parent element is not relatively positioned, it has no effect on the origin for the offsetLeft and offsetTop of the children it contains, so the offsetLeft and offsetTop values for that parent should NOT be added when calculating the actual position of the srcElement.\n\n// // Complicating this further is the fact that various browsers use different rules to determine which containing parents will have an effect on the relative origin of their children. So, we cannot simply follow the srcElement.parentNode... branch and add all the offset values we find.\n\n// // Fortunately, the DOM provides an explicit srcElement.offsetParent... branch which connects a given object to only those containing elements whose offsets must be added to determine the actual position of the srcElement, making it easy to 'walk' the offsetParent... branch and add up only the relevant offset values. The existing TW core functions findPosX() and findPosY() use this technique to find the position of a given element.\n\n// // However, while this works very well for most applications, and has been widely used on many different web sites, TiddlyWiki seems to be creating elements whose offsetLeft and offsetTop values are apparently ALREADY based on the page-origin, even if they are contained within a relatively-positioned parent element.\n\n// // This (as yet unexplained) variation from the usual DOM values may be a product of having dynamically created the elements and then moving them around within the DOM. Regardless of the cause, the practical result is that the srcElement.offsetLeft and srcElement.offsetTop values in TiddlyWiki are ALMOST always equal to the actual page-relative position of the srcElement. In this case, adding in the offsets from the offsetParent... branch would be effectively adding the containing offsets multiple times, resulting in the incorrect calculated position for the popup.\n\n// // So, since adding the offsets does not appear to be needed, why not just use the srcElement.offsetLeft and srcElement.offsetTop values and be done with it? Unfortunately, while this would work in many circumstatnces, there is still some cases in TW which the srcElement offsets DO follow the standard DOM usage and the offsets from the offsetParent... branch DO need to be added to find the actual page-relative position of the element.\n\n// // For example, a table cell (TD) element essentially creates a self-contained document fragment and, as such, the cell's offsetLeft and offsetTop values will ALWAYS be relative to the TABLE in which the cell occurs. So, to get the correct position for the child elements contained inside a TD, we MUST add up the offsets from any TABLE elements in the offsetParent... branch but we should NOT add in the offsets from containing nodes of any other type, even if they DO occur in the offsetParent... branch (because of TiddlyWiki's use of page-relative offsetLeft and offsetTop values as noted above).\n\n// // Doing this produces pretty good results that are NEARLY correct, but... it appears that the TABLE marginLeft and marginTop, while affecting the position of the TABLE's child elements, are not included in the offsetLeft and offsetTop values for the TABLE, and need to be added in separately. The problem is that these values don't seem to be stored where I think they are supposed to be...\n\n// // As a temporary workaround until this can be resolved, you can set "margin:0px" for TABLE elements, so that any contained popups will be correctly positioned relative to the table cell display. Even without this workaround, the resultant popup position is very close to accurate and is still usable, since it is only misplaced by the (currently uncounted) marginLeft and marginTop values, which are typically just a few pixels.\n// // ^^ \n/*\n{{{\n*/\nfunction createTiddlerPopup(srcElement)\n{\n var popup = document.getElementById("popup");\n if(popup && popup.nextSibling == srcElement) { hideTiddlerPopup(); return null; }\n if(popup) popup.parentNode.removeChild(popup);\n popup = createTiddlyElement(srcElement,"div","popup",null,null);\n popup.style.display = "block";\n\n // find popup left offset position. add relative offsets for nodes contained in tables\n // note: this is an in-line variation of the core findPosX(srcElement) so that it\n // only adds offsets from TABLE elements\n var left = srcElement.offsetLeft;\n var e=srcElement.offsetParent;\n while (e) {\n if (e.nodeName=="TABLE") left += e.offsetLeft;\n e = e.offsetParent\n }\n popup.style.left = left+"px";\n\n // find popup top offset position. add relative offsets for nodes contained in tables\n // note: this is an in-line variation of the core findPosY(srcElement) so that it\n // only adds offsets from TABLE elements\n var top = srcElement.offsetTop+srcElement.offsetHeight;\n var e=srcElement.offsetParent;\n while (e) {\n if (e.nodeName=="TABLE") top += e.offsetTop;\n e = e.offsetParent\n }\n popup.style.top = top+"px";\n\n srcElement.onmouseout = onMouseOutTiddlerPopup;\n return popup;\n}\n/*\n}}}\n*/\n\n// // ''tweak: adjustPopupWidth() [new function]''\n// // ^^ \n// // The style of the popup is normally "width:auto", so that it fits the widest of it's child elements. When the popup is first created, it has a width=0, which is automatically adjusted as child elements are added. As long as the popup fits completely within its container, the normal "width:auto" CSS rendering produces the desired result.\n\n// // However, if the popup does not fit, the background and border styles of the popup will not overflow past the edge of its containing element, resulting in a 'clipped' appearance, even if "overflow:visible !important" is defined for the #popup style.\n\n// // Curiously, the CONTENTS of the popup are NOT clipped, so all the text is displayed, even though the background and border edge surrounding it have been clipped. EXAMPLE: put a tag in the main menu, and its popup background and border get clipped on the right if it is wide enough, but the links extend beyond this edge are rendered directly on top of whatever content is displayed next to the popup.\n\n// // Empirical experiments reveal that explicitly setting the popup width can prevent the clipping from occuring. But, the popup width cannot be determined until it has been fully populated with content. The adjustPopupWidth() function can be called AFTER a popup has been created and filled with child elements to calculate the width of the largest child element and set the width of the popup to match.\n\n// // TBD: when 'enable animation' is checked, this produces an odd 'artifact': after resizing the popup, the right border edge is drawn to match the height of the popup's containing element, instead of the height of the popup itself. This results in an unwanted vertical line appearing above/below the popup, along the right edge. More investigation is needed to determine a final fix.\n\n// // TBD: add in extra width to account for any padding from the #popup class\n// // ^^ \n/*\n{{{\n*/\nfunction adjustPopupWidth()\n{\n var popup = document.getElementById("popup");\n var maxwidth = 0;\n for (var i=0; i<popup.childNodes.length; i++)\n if (maxwidth<popup.childNodes[i].offsetWidth)\n maxwidth=popup.childNodes[i].offsetWidth;\n popup.style.width=maxwidth+"px";\n}\n/*\n}}}\n*/\n\n// // ''tweak: add #popup styles''\n// // ^^ \n// // Popups inherit some of their styles from their parent element, including text-alignment. However, under most circumstances, the popup text should always be left aligned, regardless of the alignment of the containing element. This tweak sets the default CSS styles for the #popup class.\n// // ^^ \n/*\n{{{\n*/\nsetStylesheet("#popup { text-align:left; overflow:visible !important; }", "popupStyles");\n/*\n}}}\n*/\n
/***\n''Table of Contents Plugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#TableOfContentsPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nWhen there are many tiddlers in a document, the standard 'tabbed list of tiddlers' in the right-hand sidebar can become very long, occupying a lot of page space and requiring a lot scrolling in order to locate and select a tiddler.\n\nThe TableOfContentsPlugin addresses this problem by replacing the standard tabbed list display with a single listbox/droplist control that uses a very small amount of page space, regardless of the number of tiddlers in the document.\n\n!!!!!Usage\n<<<\nTo view a tiddler, simply select (or double-click) its title from the listbox and it will automatically be displayed on the page. The listbox also includes special 'command' items that determine the order and type of tiddlers that are shown in the list:\n\n''[by title]'' displays all tiddlers in the document.\n''[by date/author/tags]'' displays indented sections, sorted accordingly, with headings (indicated by a '+') that can be expanded, one at a time, to view the list of tiddlers in that section.\n''[missing]'' displays tiddlers that have been referenced within the document but do not yet exist.\n''[orphans]'' displays tiddlers that do exist in the document but have not been referenced by a link from anywhere else within the document.\n''[system]'' displays special tiddlers that are used by TiddlyWiki to configure built-in features and add-on macros/extensions. The list includes all tiddlers tagged with <<tag systemTiddlers>> ("templates") or <<tag systemConfig>> (plug-in extensions), plus any 'shadow tiddlers' (built-in default systemTiddlers) that have not been over-ridden by custom tiddler definitions.\n\nThe current list ''display setting is indicated by an arrow (">")'' symbol to the left of command item. Selecting a command item causes the listbox to be reloaded with the appropriate contents and sort order.\n\nWhen you are viewing a list of tiddlers by date/author/tags, ''shift-clicking'' on a section heading or command item causes the listbox display to ''toggle between "show-one-section-at-a-time" and "expand-all-sections"'' display options, allowing you to quickly see all tiddler titles at once without having to view individual indented sections one at a time.\n\nThe ''size of the listbox can be adjusted'' so you can view more (or less) tiddler titles at one time. Select ''[-]'' to reduce the size by one line, ''[+]'' to increase the size by one line, or ''[=]'' to autosize the list to fit the current contents (toggles on/off). //Note: If the listbox is reduced to a single line, it displayed as a droplist instead of a fixed-sized listbox.// You can ''show/hide the entire listbox'' by selecting the "contents" label that appears above the listbox.\n<<<\n!!!!!Control Panel\n<<<\nBy default, tiddlers tagged with <<tag excludeLists>>, are omitted from the TableOfContents so that 'system' tiddlers (e.g. MainMenu, SiteTitle, StyleSheet, etc.) can be hidden, reducing "information overload" and making it easier to select relevant tiddlers when reading your document. However, when //editing// your document, including these hidden tiddlers in the list can be more helpful, so that changes to the menus, titles, styles, etc. can be more quickly accomplished.\n----\n''To include hidden tiddlers in the TableOfContents display, select the following option:''\n<<option chkTOCIncludeHidden>> include hidden tiddlers in TableOfContents(ignores <<tag excludeLists>> tag)\n^^note: this setting is ignored when ''<<option chkHttpReadOnly>> HideEditingFeatures when viewed over HTTP'' is enabled^^\n<<<\n!!!!!Parameters\n<<<\nThe macro accepts optional parameters to control various features and functions:\n* ''label:text''\nReplace the default text ("contents") that appears above the TableOfContents listbox. //Note: to include spaces in the label text, you must enclose the entire parameter in quotes// (e.g., {{{"label:my list of tiddlers"}}})\n* ''sort:fieldtype''\nSets the initial display order for items in the listbox. 'fieldtype' is one of the following pre-defined keywords: ''title'', ''modified'' //(date)//, ''modifier'' //(author)//, ''tags'', ''missing'', ''orphans'', or ''system''\n* ''date:format''\nControls the formatting of dates in TableOfContents display. 'format' is a text-substitution template containing one or more of the following special notations.\n** DDD - day of week in full (eg, "Monday")\n** DD - day of month, 0DD - adds leading zero\n** MMM - month in full (eg, "July")\n** MM - month number, 0MM - adds leading zero\n** YYYY - full year, YY - two digit year\n** hh - hours\n** mm - minutes\n** ss - seconds\n//Note: to include spaces in the formatting template, you must enclose the entire parameter in quotes// (e.g., {{{"date:DDD, DD/MM/YY"}}})\n* ''size:nnn''\nSets the initial number of lines to display in the listbox. If this parameter is omitted or "size:1" is specified, a single-line droplist is created. When a size > 1 is provided, a standard, fixed-size scrollable listbox is created. You can use "size:0" or "size:auto" to display a varible-height listbox that automatically adjusts to fit the current list contents without scrolling.\n* ''width:nnn[cm|px|em|%]''\nSets the width of the listbox control. Overrides the built-in CSS width declaration (=100%). Use standard CSS width units (cm=centimeters, px=pixels, em=M-space, %=proportional to containing area). You can also use a ".TOCList" custom CSS class definition to override the built-in CSS declarations for the listbox.\n* ''hidelist''\nHides the listbox when the TableOfContents is first displayed. Initially, only the listbox label and size controls will appear. Clicking on the listbox label text will alternately show/hide the listbox display. //Note: this setting does not affect the content of the listbox, only whether or not it is initially visible.//\n* ''prompt''\nSets the non-selectable prompt text that is displayed as the first line of the listbox //(note: this feature is not supported by the listbox control on all browsers)//. Let's you include a short text message (such as "select a tiddler"), even when displaying a compact single-line droplist.\n* ''padding:nnn[cm|px|em|%]''\nOverrides default listbox control padding. Sets the CSS padding style.\n* ''margin:nnn[cm|px|em|%]''\nOverrides default listbox control spacing. Sets the CSS margin style.\n* ''inline''\nNormally, the TableOfContents plugin is contained inside a {{{<div>}}} element. This setting causes the plugin to use a {{{<span>}}} instead, allowing for more flexible 'inline' placement when embedded within other content.\n<<<\n!!!!!Examples\n<<<\n<<tableOfContents "label:all tiddlers" sort:title width:40% size:1>>\n<<tableOfContents "label:by date" sort:modified size:1 width:40%>>\n<<tableOfContents "label:tagged tiddlers" sort:tags size:1 width:40%>>\n<<tableOfContents "label:system tiddlers" sort:system size:1 width:40%>>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''TableOfContentsPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for TableOfContents handling^^\n\ncreate/edit ''SideBarOptions'': (sidebar menu items) \n^^Add {{{<<tableOfContents>>}}} macro^^\n\n<<<\n!!!!!Revision History\n<<<\n''2006.02.14 [2.2.6]''\nFF1501 fix: add 'var r' and 'var k' to unintended global variable declarations in refreshTOCList() and getTOCListFromButton(). Thanks for report from AndreasHoefler.\n''2006.02.04 [2.2.5]''\nadd 'var' to unintended global variable declarations to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n''2005.12.21 [2.2.2]''\nin onClickTOCList() and onDblClickTOCList(), prevent mouse events from 'bubbling' up to other handlers\n''2005.10.30 [2.2.1]''\nin refreshTOCList(), fixed calculation of "showHidden" to check for 'readOnly' (i.e., "via HTTP") flag\nbased on a report from LyallPearce\n''2005.10.30 [2.2.0]''\nhide tiddlers tagged with 'excludeLists' (with option to override, i.e., "include hidden tiddlers")\n''2005.10.09 [2.1.0]''\ncombined documentation and code in a single tiddler\nadded click toggle for expand-all vs. show-one-branch\n''2005.08.07 [2.0.0]''\nmajor re-write to not use static ID values for listbox controls, so that multiple macro instances can exist without corrupting each other or the DOM. Moved HTML and CSS definitions into plugin code instead of using separate tiddlers. Added macro parameters for label, sort, date, size, width, hidelist and showtabs\n''2005.08.03 [1.0.3]''\nadded "showtabs" optional parameter\n''2005.07.27 [1.0.2]''\ncore update 1.2.29: custom overlayStyleSheet() replaced with new core setStylesheet(). Added show/hide toggle (click on 'contents' link)\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//{{{\nversion.extensions.tableOfContents = {major: 2, minor: 2, revision: 6, date: new Date(2006,2,14)};\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//{{{\n// define defaults for cookie-based option values\nif (config.options.txtTOCSortBy==undefined) config.options.txtTOCSortBy="modified";\nif (config.options.txtTOCListSize==undefined) config.options.txtTOCListSize=12;\nif (config.options.chkTOCShow==undefined) config.options.chkTOCShow=true;\nif (config.options.chkTOCIncludeHidden==undefined) config.options.chkTOCIncludeHidden=false;\n\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkTOCIncludeHidden>> include hidden tiddlers in TableOfContents";\n\n// define macro "tableOfContents" to render controls\nconfig.macros.tableOfContents = { label: "contents" };\nconfig.macros.tableOfContents.cmdMax=7;\n\nconfig.macros.tableOfContents.css = '\s\n.TOC { padding:0.5em 1em 0.5em 1em; }\s\n.TOC a { padding:0em 0.25em 0em 0.25em; color:inherit; }\s\n.TOCList { width: 100%; font-size:8pt; margin:0em; }\s\n';\n\nconfig.macros.tableOfContents.html = '\s\n<div style="text-align:right">\s\n <span style="float:left">\s\n <a href="JavaScript:;" id="TOCMenu" style="padding: 0em;"\s\n onclick="onClickTOCMenu(this)" title="show/hide table of contents">%label%</a>\s\n </span>\s\n <a href="JavaScript:;" id="TOCSmaller" style="display:inline"\s\n onclick="resizeTOC(this)" title="reduce list size">&#150;</a>\s\n <a href="JavaScript:;" id="TOCLarger"style="display:inline"\s\n onclick="resizeTOC(this)" title="increase list size">+</a>\s\n <a href="JavaScript:;" id="TOCMaximize"style="display:inline"\s\n onclick="resizeTOC(this)" title="maximize/restore list size">=</a>\s\n</div>\s\n';\n\nconfig.macros.tableOfContents.handler = function(place,macroName,params) { \n var parsedParams = new Array();\n parsedParams['label']=this.label;\n parsedParams['inline']=false;\n while (params.length>0) {\n if (params[0]=="label:none")\n parsedParams['label']="";\n else if (params[0].substr(0,6)=="label:")\n parsedParams['label']=params[0].substr(6);\n if (params[0].substr(0,7)=="prompt:")\n parsedParams['prompt']=params[0].substr(7);\n if (params[0].substr(0,8)=="padding:")\n parsedParams['padding']=params[0].substr(8);\n if (params[0].substr(0,7)=="margin:")\n parsedParams['margin']=params[0].substr(7);\n if (params[0].substr(0,5)=="sort:")\n parsedParams['sortby']=params[0].substr(5);\n if (params[0].substr(0,5)=="date:")\n parsedParams['date']=params[0].substr(5);\n if ((params[0]=="size:auto")||(params[0]=="size:0"))\n parsedParams['autosize']=true;\n else if (params[0] && (params[0].substr(0,5)=="size:"))\n parsedParams['requestedSize']=params[0].substr(5);\n if (params[0].substr(0,6)=="width:")\n parsedParams['width']=params[0].substr(6);\n if (params[0]=="hidelist")\n parsedParams['hidelist']=true;\n if (params[0]=="inline")\n parsedParams['inline']=true;\n params.shift(); \n }\n setStylesheet(config.macros.tableOfContents.css,"tableOfContents");\n var newTOC=createTiddlyElement(place,parsedParams['inline']?"span":"div",null,"TOC",null)\n if (parsedParams['margin']) { newTOC.style.margin=parsedParams['margin']; }\n if (parsedParams['padding']) { newTOC.style.padding=parsedParams['padding']; }\n if (parsedParams['label']!="") newTOC.innerHTML=config.macros.tableOfContents.html.replace(/%label%/,parsedParams['label']);\n var newTOCList=createTOCList(newTOC,parsedParams)\n refreshTOCList(newTOCList);\n store.addNotification(null,reloadTOCLists); // reload listbox after every tiddler change\n}\n\n// IE needs explicit global scoping for functions/vars called from browser events\nwindow.onChangeTOCList=onChangeTOCList;\nwindow.onClickTOCList=onClickTOCList;\nwindow.onDblClickTOCList=onDblClickTOCList;\nwindow.reloadTOCLists=reloadTOCLists;\nwindow.refreshTOCList=refreshTOCList;\nwindow.onClickTOCMenu=onClickTOCMenu;\nwindow.resizeTOC=resizeTOC;\n \nfunction createTOCList(place,params)\n{\n var theList = createTiddlyElement(place,"select",null,"TOCList",params['prompt'])\n theList.onchange=onChangeTOCList;\n theList.onclick=onClickTOCList;\n theList.ondblclick=onDblClickTOCList;\n theList.style.display=config.options.chkTOCShow ? "block" : "none" ;\n theList.sortBy=config.options.txtTOCSortBy;\n theList.dateFormat="DD MMM YYYY";\n theList.requestedSize=config.options.txtTOCListSize;\n theList.expandall=false;\n if (params['sortby'])\n { theList.sortBy=params['sortby']; theList.noSortCookie=true; }\n if (params['date'])\n { theList.dateFormat=params['date']; }\n if (params['autosize'])\n { theList.autosize=true; theList.noSizeCookie=true; }\n if (params['requestedSize'])\n { theList.requestedSize=params['requestedSize']; theList.noSizeCookie=true; }\n if (params['width'])\n { theList.style.width=params['width']; }\n if (params['hidelist'])\n { theList.style.display ="none" ; theList.noShowCookie=true; }\n if (params['expandall'])\n { theList.expandall=true; }\n return theList;\n}\n\nfunction onChangeTOCList()\n{\n var thisTiddler=this.options[this.selectedIndex].value;\n if ((this.size==1)&&(thisTiddler!='')) story.displayTiddler(null,thisTiddler,1);\n refreshTOCList(this);\n return false;\n}\n\nfunction onClickTOCList(e)\n{\n\n if (!e) var e = window.event;\n if (this.size==1)\n return; // don't toggle display for droplist\n if (e.shiftKey)\n { this.expandall=!this.expandall; refreshTOCList(this);}\n e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation();\n return true;\n}\n\nfunction onDblClickTOCList(e)\n{\n if (!e) var e = window.event;\n var thisTiddler=this.options[this.selectedIndex].value;\n if (thisTiddler!='') story.displayTiddler(null,thisTiddler,1);\n e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation();\n return false;\n}\n\nfunction reloadTOCLists()\n{\n var all=document.all? document.all : document.getElementsByTagName("*");\n for (var i=0; i<all.length; i++)\n if (all[i].className=="TOCList")\n { all[i].selectedIndex=-1; refreshTOCList(all[i]); }\n}\n\nfunction refreshTOCList(theList)\n{\n // DEBUG var starttime=new Date();\n var selectedIndex = theList.selectedIndex;\n if (selectedIndex==-1) selectedIndex=0;\n var sortBy = theList.sortBy;\n var showHidden = config.options.chkTOCIncludeHidden\n && !(config.options.chkHttpReadOnly && readOnly);\n\n if (selectedIndex==0) sortBy=theList.sortBy; // "nnn tiddlers" heading\n if (selectedIndex==1) sortBy='title';\n if (selectedIndex==2) sortBy='modified';\n if (selectedIndex==3) sortBy='modifier';\n if (selectedIndex==4) sortBy='tags';\n if (selectedIndex==5) sortBy='missing';\n if (selectedIndex==6) sortBy='orphans';\n if (selectedIndex==7) sortBy='system';\n if (selectedIndex>config.macros.tableOfContents.cmdMax)\n {\n if (theList.options[theList.selectedIndex].value=='')\n expandTOC(theList);\n return;\n }\n theList.sortBy = sortBy;\n if (!theList.noSortCookie)\n { config.options.txtTOCSortBy=sortBy; saveOptionCookie("txtTOCSortBy"); }\n\n // get the list of tiddlers and filter out 'hidden' tiddlers (i.e., tagged with "excludeLists")\n var tiddlers = [];\n switch (sortBy) {\n case "missing":\n tiddlers = store.getMissingLinks();\n break;\n case "tags":\n tiddlers = store.getTags();\n break;\n case "orphans":\n var titles = store.getOrphans();\n for (var t = 0; t < titles.length; t++)\n if (showHidden || store.getTiddler(titles[t]).tags.find("excludeLists")==null)\n tiddlers.push(titles[t]);\n break;\n case "system":\n var temp = store.getTaggedTiddlers("systemTiddlers");\n for (var t = 0; t < temp.length; t++)\n if (showHidden || temp[t].tags.find("excludeLists")==null)\n tiddlers.pushUnique(temp[t].title,true);\n var temp = store.getTaggedTiddlers("systemConfig");\n for (var t = 0; t < temp.length; t++)\n if (showHidden || temp[t].tags.find("excludeLists")==null)\n tiddlers.pushUnique(temp[t].title,true);\n for (var t in config.shadowTiddlers) tiddlers.pushUnique(t,true);\n tiddlers.sort();\n break;\n default:\n var temp = store.getTiddlers(sortBy);\n for (var t = 0; t < temp.length; t++)\n if (showHidden || temp[t].tags.find("excludeLists")==null)\n tiddlers.push(temp[t]);\n }\n\n // clear current list contents\n while (theList.length > 0) { theList.options[0] = null; }\n theList.saved=null;\n\n // add heading and control items to list\n var i=0;\n var theHeading=tiddlers.length+' tiddlers:';\n if (sortBy=='missing') theHeading=tiddlers.length+' missing tiddlers:';\n if (sortBy=='orphans') theHeading=tiddlers.length+' orphaned tiddlers:';\n if (sortBy=='tags') theHeading=tiddlers.length+' tags:';\n if (sortBy=='system') theHeading=tiddlers.length+' system tiddlers:';\n var indent=String.fromCharCode(160)+String.fromCharCode(160);\n var sel=">";\n theList.options[i++]=new Option(theHeading,'',false,false);\n theList.options[i++]=new Option(((sortBy=="title")?sel:indent)+' [by title]','',false,false);\n theList.options[i++]=new Option(((sortBy=="modified")?sel:indent)+' [by date]','',false,false);\n theList.options[i++]=new Option(((sortBy=="modifier")?sel:indent)+' [by author]','',false,false);\n theList.options[i++]=new Option(((sortBy=="tags")?sel:indent)+' [by tags]','',false,false);\n theList.options[i++]=new Option(((sortBy=="missing")?sel:indent)+' [missing]','',false,false);\n theList.options[i++]=new Option(((sortBy=="orphans")?sel:indent)+' [orphans]','',false,false);\n theList.options[i++]=new Option(((sortBy=="system")?sel:indent)+' [system]','',false,false);\n // output the tiddler list\n switch(sortBy)\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 // continue with same logic as for 'modifier'...\n case "modifier":\n var lastSection = "";\n for (var t = 0; t < tiddlers.length; t++)\n {\n var tiddler = tiddlers[t];\n var theSection = "";\n if (sortBy=="modified") theSection = tiddler.modified.formatString(theList.dateFormat);\n if (sortBy=="modifier") theSection = tiddler.modifier;\n if (theSection != lastSection)\n {\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 expandTOC(theList);\n break;\n case "tags":\n // tagged tiddlers, by tag\n var tagcount=0;\n var lastTag = null;\n for (var t = 0; t < tiddlers.length; t++) // actually a list of tags, not tiddlers...\n {\n var theTag = tiddlers[t][0];\n var tagged = new Array();\n var temp = store.getTaggedTiddlers(theTag);\n for(var r=0; r<temp.length; r++)\n if (showHidden || temp[r].tags.find("excludeLists")==null)\n tagged.push(temp[r]);\n if (tagged.length)\n {\n tagcount++;\n theList.options[i++]= new\n Option('+ '+theTag+" ("+tagged.length+")","",false,false);\n for(var r=0; r<tagged.length; r++)\n theList.options[i++] = new\n Option(indent+indent+tagged[r].title,tagged[r].title,false,false);\n }\n }\n // count untagged tiddlers\n var temp = store.getTiddlers("title");\n var c=0; for (var r=0; r<temp.length;r++) if (!temp[r].tags.length) c++;\n // create 'pseudo-tag' listing untagged tiddlers (if any)\n if (c>0)\n {\n theList.options[i++] = new Option("+ untagged ("+c+")","",false,false);\n for (var r=0; r<temp.length;r++) if (!temp[r].tags.length)\n theList.options[i++] = new\n Option(indent+indent+temp[r].title,temp[r].title,false,false);\n }\n theList.options[0].text=tagcount+' tags:';\n expandTOC(theList);\n break;\n case "missing":\n case "orphans":\n case "system":\n for (var t = 0; t < tiddlers.length; t++)\n theList.options[i++] = new Option(tiddlers[t],tiddlers[t],false,false);\n break;\n }\n theList.selectedIndex=selectedIndex; // select current control item\n theList.size = (theList.autosize)?theList.options.length:theList.requestedSize;\n // DEBUG var endtime=new Date();\n // DEBUG alert("refreshTOC() elapsed time: "+(endtime-starttime)+" msec");\n}\n\n// show/hide branch of TOCList based on current selection\nfunction expandTOC(theList)\n{\n var selectedIndex = theList.selectedIndex;\n if (selectedIndex==-1) selectedIndex=0;\n var sortBy = theList.sortBy;\n\n // don't collapse/expand list for alpha-sorted "flatlist" TOC contents\n if ((sortBy=="title")||(sortBy=="missing")||(sortBy=="orphans")||(sortBy=="system"))\n return;\n // or list control items\n if ((selectedIndex>0)&&(selectedIndex<=config.macros.tableOfContents.cmdMax))\n return;\n\n var theText = theList.options[selectedIndex].text;\n var theValue = theList.options[selectedIndex].value;\n // save fully expanded list contents (if not already saved)\n if (!theList.saved)\n {\n theList.saved = new Array();\n for (var i=0; i < theList.length; i++)\n {\n opt = theList.options[i];\n theList.saved[i] = new Option(opt.text, opt.value, opt.defaultSelected, opt.selected);\n }\n }\n // clear current list contents\n while (theList.length > 0) { theList.options[0] = null; }\n\n // put back all items \n if (theList.expandall)\n {\n var i=0;\n for (var t=0; t<theList.saved.length; t++)\n {\n var opt=theList.saved[t];\n theList.options[i++] = new Option(opt.text,opt.value,opt.defaultSelected,opt.selected);\n if (opt.text==theText) selectedIndex=i-1;\n }\n theList.selectedIndex = selectedIndex;\n theList.size = (theList.autosize)?theList.options.length:theList.requestedSize;\n return;\n }\n\n // put back heading items until item text matches current selected heading\n var i=0;\n for (var t=0; t<theList.saved.length; t++)\n {\n var opt=theList.saved[t];\n if (opt.value=='')\n theList.options[i++] = new Option(opt.text,opt.value,opt.defaultSelected,opt.selected);\n if (opt.text==theText)\n break;\n }\n selectedIndex=i-1; // this is the NEW index of the current selected heading\n // put back items with value!='' until value==''\n for ( t++; t<theList.saved.length; t++)\n {\n var opt=theList.saved[t];\n if (opt.value!='')\n theList.options[i++] = new Option(opt.text,opt.value,opt.defaultSelected,opt.selected);\n if (opt.value=='')\n break;\n }\n // put back remaining items with value==''\n for ( ; t<theList.saved.length; t++)\n {\n var opt=theList.saved[t];\n if (opt.value=='')\n theList.options[i++] = new Option(opt.text,opt.value,opt.defaultSelected,opt.selected);\n }\n theList.selectedIndex = selectedIndex;\n theList.size = (theList.autosize)?theList.options.length:theList.requestedSize;\n}\n\n// these functions process clicks on the 'control links' that are displayed above the listbox\nfunction getTOCListFromButton(which)\n{\n var theList = null;\n switch (which.id)\n {\n case 'TOCMenu':\n var theSiblings = which.parentNode.parentNode.parentNode.childNodes;\n var thePlace=which.parentNode.parentNode.parentNode.parentNode.parentNode.id;\n break;\n case 'TOCSmaller':\n case 'TOCLarger':\n case 'TOCMaximize':\n var theSiblings = which.parentNode.parentNode.childNodes;\n var thePlace=which.parentNode.parentNode.parentNode.parentNode.id;\n break;\n }\n for (var k=0; k<theSiblings.length; k++)\n if (theSiblings[k].className=="TOCList") { theList=theSiblings[k]; break; }\n // DEBUG if (theList) alert('found '+theList.className+' for '+which.id+' button in '+thePlace);\n return theList;\n}\n\nfunction onClickTOCMenu(which)\n{\n var theList=getTOCListFromButton(which);\n if (!theList) return;\n var opening = theList.style.display=="none";\n if(config.options.chkAnimate)\n anim.startAnimating(new Slider(theList,opening,false,"none"));\n else\n theList.style.display = opening ? "block" : "none" ;\n if (!theList.noShowCookie)\n { config.options.chkTOCShow = opening; saveOptionCookie("chkTOCShow"); }\n return(false);\n}\n\nfunction resizeTOC(which)\n{\n var theList=getTOCListFromButton(which);\n if (!theList) return;\n\n var size = theList.size;\n if (theList.style.display=="none") // make sure list is visible\n if(config.options.chkAnimate)\n anim.startAnimating(new Slider(theList,true,false,"none"));\n else\n theList.style.display = "block" ;\n switch (which.id)\n {\n case 'TOCSmaller': // decrease current listbox size\n if (theList.autosize) { theList.autosize=false; size=config.options.txtTOCListSize; }\n if (size==1) break;\n size -= 1; // shrink by one line\n theList.requestedSize = theList.size = size;\n break;\n case 'TOCLarger': // increase current listbox size\n if (theList.autosize) { theList.autosize=false; size=config.options.txtTOCListSize; }\n if (size>=theList.options.length) break;\n size += 1; // grow by one line\n theList.requestedSize = theList.size = size;\n break;\n case 'TOCMaximize': // toggle autosize\n theList.autosize = (theList.size!=theList.options.length);\n theList.size = (theList.autosize)?theList.options.length:theList.requestedSize;\n break;\n }\n if (!theList.noSizeCookie && !theList.autosize)\n { config.options.txtTOCListSize=size; saveOptionCookie("txtTOCListSize"); }\n}\n//}}}\n
/***\n''Plugin:'' Tag Cloud Macro\n''Author:'' Clint Checketts\n''Source URL:''\n\n!Usage\n<<tagCloud>>\n\n!Code\n***/\n//{{{\nversion.extensions.tagCloud = {major: 1, minor: 0 , revision: 0, date: new Date(2006,2,04)};\n//Created by Clint Checketts, contributions by Jonny Leroy and Eric Shulman\n\nconfig.macros.tagCloud = {\n noTags: "No tag cloud created because there are no tags.",\n tooltip: "%1 tiddlers tagged with '%0'"\n};\n\nconfig.macros.tagCloud.handler = function(place,macroName,params) {\n \nvar tagCloudWrapper = createTiddlyElement(place,"div",null,"tagCloud",null);\n\nvar tags = store.getTags();\nfor (var t=0; t<tags.length; t++) {\n for (var p=0;p<params.length; p++) if (tags[t][0] == params[p]) tags[t][0] = "";\n}\n\n if(tags.length == 0) \n createTiddlyElement(tagCloudWrapper,"span",null,null,this.noTags);\n //Findout the maximum number of tags\n var mostTags = 0;\n for (var t=0; t<tags.length; t++) if (tags[t][0].length > 0){\n if (tags[t][1] > mostTags) mostTags = tags[t][1];\n }\n //divide the mostTags into 4 segments for the 4 different tagCloud sizes\n var tagSegment = mostTags / 4;\n\n for (var t=0; t<tags.length; t++) if (tags[t][0].length > 0){\n var tagCloudElement = createTiddlyElement(tagCloudWrapper,"span",null,null,null);\n tagCloudWrapper.appendChild(document.createTextNode(" "));\n var theTag = createTiddlyButton(tagCloudElement,tags[t][0],this.tooltip.format(tags[t]),onClickTag,"tagCloudtag tagCloud" + (Math.round(tags[t][1]/tagSegment)+1));\n theTag.setAttribute("tag",tags[t][0]);\n }\n\n};\n\nsetStylesheet(".tagCloud span{height: 1.8em;margin: 3px;}.tagCloud1{font-size: 1.2em;}.tagCloud2{font-size: 1.4em;}.tagCloud3{font-size: 1.6em;}.tagCloud4{font-size: 1.8em;}.tagCloud5{font-size: 1.8em;font-weight: bold;}","tagCloudsStyles");\n//}}}
/***\n''TextAreaPlugin for TiddlyWiki version 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#TextAreaPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nThis plugin 'hijacks' the TW core function, ''Story.prototype.focusTiddler()'', so it can add special 'keyDown' handlers to adjust several behaviors associated with the textarea control used in the tiddler editor. Specifically, it:\n* Option to set cursor at top of edit field instead of auto-selecting contents\s\n* Option to disable use of the ESC key to cancel editing\n* Adds text search INSIDE of edit fields.^^\nUse ~CTRL-F for "Find" (prompts for search text), and ~CTRL-G for "Find Next" (uses previous search text)^^\n* Enables TAB characters to be entered into field content^^\n(instead of moving to next field)^^\n\n!!!!!Configuration\n<<<\n<<option chkDisableAutoSelect>> place cursor at start of textarea instead of pre-selecting content\n<<option chkDisableEscapeKey>> don't cancel editor when ''escape'' key is pressed\n<<option chkTextAreaExtensions>> add control-f (find), control-g (find again) and allow TABs as input in textarea\n<<<\n!!!!!Installation\n<<<\nImport (or copy/paste) the following tiddlers into your document:\n''TextAreaPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.02.14 [1.1.0]''\nadded option for chkDisableEscapeKey (default is standard action)\n''2006.01.22 [1.0.1]''\nonly add extra key processing for TEXTAREA elements (not other edit fields).\nadded option to enable/disable textarea keydown extensions (default is "standard keys" only)\n''2006.01.22 [1.0.0]''\nMoved from temporary "System Tweaks" tiddler into 'real' TextAreaPlugin tiddler.\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.textAreaPlugin= {major: 1, minor: 1, revision: 0, date: new Date(2006,2,14)};\n//}}}\n\n//{{{\nif (!config.options.chkDisableAutoSelect) config.options.chkDisableAutoSelect=false; // default to standard action\nif (!config.options.chkTextAreaExtensions) config.options.chkTextAreaExtensions=false; // default to standard action\nif (!config.options.chkDisableEscapeKey) config.options.chkDisableEscapeKey=false; // default to standard action\n\n// Focus a specified tiddler. Attempts to focus the specified field, otherwise the first edit field it finds\nStory.prototype.focusTiddler = function(title,field)\n{\n var tiddler = document.getElementById(this.idPrefix + title);\n if(tiddler != null)\n {\n var children = tiddler.getElementsByTagName("*")\n var e = null;\n for (var t=0; t<children.length; t++)\n {\n var c = children[t];\n if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea")\n {\n if(!e)\n e = c;\n if(c.getAttribute("edit") == field)\n e = c;\n }\n }\n if(e)\n {\n e.focus();\n e.select(); // select entire contents\n\n // TWEAK: add TAB and "find" key handlers\n if (config.options.chkTextAreaExtensions) // add extra key handlers\n addKeyDownHandlers(e);\n\n // TWEAK: option to NOT autoselect contents\n if (config.options.chkDisableAutoSelect) // set cursor to start of field content\n if (e.setSelectionRange) e.setSelectionRange(0,0); // for FF\n else if (e.createTextRange) { var r=e.createTextRange(); r.collapse(true); r.select(); } // for IE\n\n }\n }\n\n tiddler.onkeypress = function(e) {\n if (!e) var e = window.event;\n clearMessage();\n var consume = false;\n switch(e.keyCode)\n {\n case 13: // Ctrl-Enter\n case 10: // Ctrl-Enter on IE PC\n case 77: // Ctrl-Enter is "M" on some platforms\n if(e.ctrlKey)\n {\n story.blurTiddler(this.title);\n config.macros.toolbar.invokeCommand(this,"defaultCommand",e);\n consume = true;\n }\n break;\n case 27: // Escape\n if (config.options.chkDisableEscapeKey) break; // ignore ESCAPE if option is set\n story.blurTiddler(this.title);\n config.macros.toolbar.invokeCommand(this,"cancelCommand",e);\n consume = true;\n break;\n }\n e.cancelBubble = consume;\n if(consume)\n if (e.stopPropagation) e.stopPropagation();\n return(!consume);\n };\n}\n//}}}\n\n//{{{\nfunction addKeyDownHandlers(e)\n{\n // exit if not textarea or element doesn't allow selections\n if (e.tagName.toLowerCase()!="textarea" || !e.setSelectionRange) return;\n\n // utility function: exits keydown handler and prevents browser from processing the keystroke\n var processed=function(ev) { ev.cancelBubble=true; if (ev.stopPropagation) ev.stopPropagation(); return false; }\n\n // capture keypress in edit field\n e.onkeydown = function(ev) { if (!ev) var ev=window.event;\n\n // process TAB\n if (!ev.shiftKey && ev.keyCode==9) { \n // replace current selection with a TAB character\n var start=e.selectionStart; var end=e.selectionEnd;\n e.value=e.value.substr(0,start)+String.fromCharCode(9)+e.value.substr(end);\n // update insertion point, scroll it into view\n e.setSelectionRange(start+1,start+1);\n var linecount=e.value.split('\sn').length;\n var thisline=e.value.substr(0,e.selectionStart).split('\sn').length-1;\n e.scrollTop=Math.floor((thisline-e.rows/2)*e.scrollHeight/linecount);\n return processed(ev);\n }\n\n // process CTRL-F (find matching text) or CTRL-G (find next match)\n if (ev.ctrlKey && (ev.keyCode==70||ev.keyCode==71)) {\n // if ctrl-f or no previous search, prompt for search text (default to previous text or current selection)... if no search text, exit\n if (ev.keyCode==70||!e.find||!e.find.length)\n { var f=prompt("find:",e.find?e.find:e.value.substring(e.selectionStart,e.selectionEnd)); e.focus(); e.find=f?f:e.find; }\n if (!e.find||!e.find.length) return processed(ev);\n // do case-insensitive match with 'wraparound'... if not found, alert and exit \n var newstart=e.value.toLowerCase().indexOf(e.find.toLowerCase(),e.selectionStart+1);\n if (newstart==-1) newstart=e.value.toLowerCase().indexOf(e.find.toLowerCase());\n if (newstart==-1) { alert("'"+e.find+"' not found"); e.focus(); return processed(ev); }\n // set new selection, scroll it into view, and report line position in status bar\n e.setSelectionRange(newstart,newstart+e.find.length);\n var linecount=e.value.split('\sn').length;\n var thisline=e.value.substr(0,e.selectionStart).split('\sn').length;\n e.scrollTop=Math.floor((thisline-1-e.rows/2)*e.scrollHeight/linecount);\n window.status="line: "+thisline+"/"+linecount;\n return processed(ev);\n }\n }\n}\n//}}}
/***\n|''Name:''|TiddlerStatsPlugin|\n|''Version:''|0.8 |\n|''Source:''|http://thePettersons.org/PaulsNotepad.html#%5B%5BTiddlerStatsPlugin%5D%5D |\n|''Author:''|[[Paul Petterson]] |\n|''Type:''|Macro Extension |\n|''Requires:''|TiddlyWiki 1.2.32 or higher |\n!Description\nWant to know how big your TW really is? Want to see how big your biggest tiddler is? TiddlerStats is the answer!\n\nFinds and displays the number of and size of all tiddlers, the biggest, smallest, and average size. Even draws up a sparkline with that info in it!\n\n!Syntax\n{{{<<tiddlerStats>>}}}\n\n!Sample\n<<tiddlerStats>>\n\n!Known issues\n* I added standard deviation and that just can't be right - but I haven't had time to see what I did wrong yet.\n\n!Notes\n* Sparkline isn't showing up if you embed this macro in a tiddler that's displayed via a slider. This doesn't look like an issue with the macro yet...\n\n!Todo\n* Add support for # of tiddlers changed in last 1..7, 14, 30 days\n\n!Revision history\nv0.8 - first public release.\n\n!Code\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/*\n{{{\n*/\nconfig.macros.tiddlerStats = {}\nconfig.macros.tiddlerStats.tiddlerSize = function( tiddler ) {\n var x = 12 ; // Modified is always 12 characters...\n if ( tiddler.text ) x += tiddler.text.length ;\n if ( tiddler.title ) x += tiddler.title.length ;\n if ( tiddler.modifier ) x+= tiddler.modifier.length ;\n\n var tiddlerTags = tiddler.tags.join() ;\n if ( tiddlerTags ) x+= tiddlerTags.length ;\n return x\n}\n\nconfig.macros.tiddlerStats.handler = function( place, macroName, params ) {\n var count = 0, size = 0, min = 999, max = 0, x;\n var xsquared = 0, smallest, largest ;\n\n//////// 1/5/2006 ELS\n// for(var tkey in store.tiddlers) {\n var tiddlers; var i; for(tiddlers=store.getTiddlers("title"),i=0; i<tiddlers.length; i++) { var tkey=tiddlers[i].title;\n////////\n var t = store.getTiddler(tkey);\n count++ ;\n\n x = config.macros.tiddlerStats.tiddlerSize( t ) ;\n size += x ;\n xsquared += (x^2) ;\n if ( min > x ) {\n min = x ;\n smallest = tkey ;\n }\n if ( max < x ) { \n max = x ;\n largest = tkey ;\n }\n }\n \n var average = size / count ;\n //square root of[ (sum of Xsquared -((sum of X)*(sum of X)/N))/ (N-1))\n var ps = (xsquared - ( size * size / count)) / (count - 1) ;\n var sdev = Math.sqrt( Math.abs( ps )) ;\n var incontrol = 0 ;\n var bucket = parseInt( max / sdev ) + 1;\n var data = new Array() ;\n for( var i = 0 ; i < bucket; i++ ) data[i] = 0 ;\n \n//////// 1/5/2006 ELS\n// for(var tkey2 in store.tiddlers) {\n var tiddlers; var i; for(tiddlers=store.getTiddlers("title"),i=0; i<tiddlers.length; i++) { var tkey2=tiddlers[i].title;\n////////\n var t = store.getTiddler(tkey2);\n x = config.macros.tiddlerStats.tiddlerSize( t ) ;\n if (((average - sdev) < x) && (x < (average + sdev))) incontrol++ ;\n bucket = parseInt( x / sdev ) ;\n data[bucket]++ ;\n }\n\n createTiddlyElement( place, "b", null, null, "TiddlyWiki usage statistics" ) ;\n var ul = createTiddlyElement( place, "ul", null, null, null ) ;\n createTiddlyElement( ul, "li", null, null, count + " Tiddlers" ) ;\n createTiddlyElement( ul, "li", null, null, size + " bytes (total content size)" ) ;\n createTiddlyElement( ul, "li", null, null, average + " is the average tiddler size" ) ;\n createTiddlyElement( ul, "li", null, null, sdev + " is the standard deviation" ) ;\n createTiddlyElement( ul, "li", null, null, incontrol + " within 1 standard deviation of the average" ) ;\n var li = createTiddlyElement( ul, "li", null, null, min + " is the smallest tiddler size " ) ;\n createTiddlyLink( li, smallest, true ) ;\n li = createTiddlyElement( ul, "li", null, null, max + " is the largest tiddler size " ) ;\n createTiddlyLink( li, largest, true ) ;\n li = createTiddlyElement( ul, "li", null, null, null ) ;\n config.macros.sparkline.handler( li, "sparkline?", data ) ;\n\n var tbl = createTiddlyElement(place,"table",null,null,"");\n var tb = createTiddlyElement( tbl, "tbody", null, null );\n var tr ;\n for( var i = 0; i < data.length ; i++ ) {\n if ( data[i] > 0 ) {\n tr = createTiddlyElement( tb, "tr", null, null, null );\n createTiddlyElement(tr,"td",null,null, i );\n createTiddlyElement(tr,"td",null,null, (i * sdev) + " < " + ((i+1) * sdev) );\n createTiddlyElement(tr,"td",null,null, data[i] );\n }\n }\n}\n/*\n}}}\n*/\n
/***\n|''Name'' |TiddlerTemplatesMacros|\n|''Version'' |1.0|\n|''Source'' |http://www.kultofbubb.net/tiddlywiki/|\n|''Author'' |[[RichCarrillo|mailto://RichCarrillo@gmail.com]]|\n|''Type'' |Macros|\n|''Required'' |[[TiddlyWiki|http://www.tiddlywiki.com]] 2.0+|\n|''License'' ||\n|''Documentation''| TiddlerTemplatesMacrosDocumentation|\n\n!Code\n***/\n//{{{\n// Drop down indicator for pop-up menu buttons\nvar dropdownchar = (document.all?"▼":"▾") // the fat one is the only one that works in IE\n\nversion.extensions.TiddlerTemplatesMacros = {\n major: 0, minor: 9, revision: 0,\n date: new Date(2006, 2, 21), \n type: 'macro',\n source: "http://www.kultofbubb.net/tiddlywiki/index.html#TiddlerTemplatesMacros"\n};\n\n// shadow tiddler to provide basic syntax and link to full documentation\nconfig.shadowTiddlers.TiddlerTemplatesMacrosDocumentation = "[[Full Documentation|http://www.kultofbubb.net/tiddlywiki/index.html#TiddlerTemplatesMacrosDocumentation]]\sn"; \n\nconfig.macros.newFromTemplate = {}\nconfig.macros.newFromTemplatePopup = {}\nconfig.macros.newFromTemplateButton = {}\n\n// The tiddlerTemplatesMacros object just holds default settings, messages and common functions used by the other macros\nconfig.macros.tiddlerTemplatesMacros = {\n // messages\n label: "New...",\n tooltip: "Create a tiddler from a Template",\n titlePrefix: "New",\n errorNoTemplates: "No templates found! Add the tag '%0' to a tiddler you would like to use as a template",\n errorNoTemplateTiddler: "The template tiddler: '%0', could not be found.",\n errorMissingRequiredParam: "Missing a required parameter: %0 ",\n errorTiddlerAlreadyExists: "The tiddler: %0 already exists!",\n\n // default settings\n templateTag: "TiddlerTemplates",\n\n // common functions used by other macros\n myReadMacroParams: function(paramString){\n var regexpMacroParam = new\n RegExp("(?:\s\ss*)(?:(?:\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][^\s"'\s\ss]*))","mg");\n var params = [];\n do {\n var match = regexpMacroParam.exec(paramString);\n if(match){\n if(match[1]) // Double quoted\n params.push(match[1]);\n else if(match[2]) // Single quoted\n params.push(match[2]);\n else if(match[3]) // Double-square-bracket quoted\n params.push(match[3]);\n else if(match[4]) // Unquoted\n params.push(match[4]);\n }\n } while(match);\n return params;\n }, // closes myReadMacroParams function definition\n\n reparseParams: function( params ) {\n var s = params.join(" ");\n var re = /([^:\ss]*):["]([^"]*)["]/g ;\n var ret = new Array() ;\n var m ;\n while( (m = re.exec( s )) != null ) ret[ m[1] ] = m[2] ;\n return ret ;\n }, // closes reparseParams function definition\n\n getTiddlerEditField: function(title,field){\n var tiddler = document.getElementById(story.idPrefix + title);\n if(tiddler != null){\n var children = tiddler.getElementsByTagName("*")\n var e = null;\n for (var t=0; t<children.length; t++){\n var c = children[t];\n if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea"){\n if(!e) {e = c;}\n if(c.getAttribute("edit") == field){e = c;}\n }\n }\n if(e){return e;}\n }\n }, // closes getTiddlerEditField function definition\n\n newFromTemplate: function(event){\n var title = this.getAttribute("templateTitle");\n if (this.getAttribute("tagToAdd")) {var tagToAdd = this.getAttribute("tagToAdd");}\n if (this.getAttribute("tagToStrip")) {var tagToStrip = this.getAttribute("tagToStrip");}\n\n // get the template and extract its info\n var template = store.getTiddler(title);\n var newTitle = config.macros.tiddlerTemplatesMacros.titlePrefix+template.title;\n var newText = template.text;\n var newTags = template.getTags();\n \n // if a tiddler by this name already exists, show an error message and quit\n if (store.getTiddler(newTitle)) {\n displayMessage(config.macros.tiddlerTemplatesMacros.errorTiddlerAlreadyExists.format([newTitle]));\n story.displayTiddler(null,newTitle,DEFAULT_VIEW_TEMPLATE);\n return;\n }\n // create new tiddler\n story.displayTiddler(null,newTitle,DEFAULT_EDIT_TEMPLATE);\n\n // grab the new Tiddlers text edit box\n var tiddlerTextArea = config.macros.tiddlerTemplatesMacros.getTiddlerEditField(newTitle,"text");\n var tiddlerTagArea = config.macros.tiddlerTemplatesMacros.getTiddlerEditField(newTitle,"tags");\n\n // Stuff template info into newly created tiddler\n tiddlerTextArea.value=newText;\n if (tagToAdd){newTags += " " + String.encodeTiddlyLink(tagToAdd);}\n tiddlerTagArea.value=newTags;\n if (tagToStrip) {story.setTiddlerTag(newTitle,tagToStrip,-1);}\n story.focusTiddler(newTitle,"title");\n return false; //why false?\n } // closes newFromTemplate function definition\n}; // closes tiddlerTemplateMacros object definition\n\nconfig.macros.newFromTemplatePopup.handler = function(place,macroName,params,wikifier,paramString,callingTiddler){\n var makeTemplateList = function(event) {\n if (!event) var event = window.event;\n var templateTag = this.getAttribute("templateTag");\n if (this.getAttribute("tagToAdd")){var tagToAdd = this.getAttribute("tagToAdd");}\n\n var templateList = store.getTaggedTiddlers(templateTag);\n var popup = Popup.create(templateButton);\n\n // pull the titles out of the tiddlers retured by getTaggedTiddlers\n var templateTitles = [];\n var li,r;\n for(r=0;r<templateList.length;r++)\n if(templateList[r].title != templateTitles){templateTitles.push(templateList[r].title);}\n\n // for each one of the titles create a new TiddlyButton in the popup\n for(r=0; r<templateTitles.length; r++){\n var templateListItem = createTiddlyButton(createTiddlyElement(popup,"li"),templateTitles[r],null,config.macros.tiddlerTemplatesMacros.newFromTemplate);\n templateListItem.setAttribute("templateTitle",templateTitles[r]);\n templateListItem.setAttribute("tagToStrip",templateTag);\n if (tagToAdd){templateListItem.setAttribute("tagToAdd",tagToAdd);}\n }\n\n Popup.show(popup,true);\n event.cancelBubble = true;\n if (event.stopPropagation) event.stopPropagation();\n return false; // why false?\n } // closes makeTemplateList function definition\n\n // process params\n var paramsToParse = params;\n var input = config.macros.tiddlerTemplatesMacros.reparseParams( paramsToParse ) ;\n var templateTag = input["templateTag"]?input["templateTag"].trim():config.macros.tiddlerTemplatesMacros.templateTag ;\n var label = input["label"]?input["label"].trim():config.macros.tiddlerTemplatesMacros.label ;\n label = label.replace(/<arrow>/g, dropdownchar) \n var tooltip = input["tooltip"]?input["tooltip"].trim():config.macros.tiddlerTemplatesMacros.tooltip ;\n\n // user can only use hereMode if callingTiddler was passed to the macro\n var hereMode; \n if (input["hereMode"] && callingTiddler) {hereMode = callingTiddler.title;}\n else {hereMode = null;}\n\n // error out if no tiddlers are tagged as templates\n var templateList = store.getTaggedTiddlers(templateTag);\n if(templateList == "") {\n createTiddlyError(place,config.messages.macroError.format([macroName]),config.macros.tiddlerTemplatesMacros.errorNoTemplates.format([templateTag]));\n return;\n }\n\n var templateButton = createTiddlyButton(place,label,tooltip,makeTemplateList);\n templateButton.setAttribute("templateTag",templateTag);\n if (hereMode){templateButton.setAttribute("tagToAdd",hereMode);}\n}; // closes newFromTemplatePopup handler definition\n\n\nconfig.macros.newFromTemplateButton.handler = function(place,macroName,params,wikifier,paramString,callingTiddler){\n\n // process params\n var paramsToParse = params;\n var input = config.macros.tiddlerTemplatesMacros.reparseParams( paramsToParse ) ;\n var templateTiddler = input["templateTiddler"]?input["templateTiddler"].trim():null ;\n var templateTag = input["templateTag"]?input["templateTag"].trim():null ;\n var label = input["label"]?input["label"].trim():config.macros.tiddlerTemplatesMacros.label ;\n var tooltip = input["tooltip"]?input["tooltip"].trim():config.macros.tiddlerTemplatesMacros.tooltip ;\n\n // user can only use hereMode if callingTiddler was passed to the macro\n var hereMode; \n if (input["hereMode"] && callingTiddler) {hereMode = callingTiddler.title;}\n else {hereMode = null;}\n\n // error out if template tiddler was not specified or if it does not exist\n if (templateTiddler == null){\n createTiddlyError(place,config.messages.macroError.format([macroName]),config.macros.tiddlerTemplatesMacros.errorMissingRequiredParam.format(["templateTiddler"]));\n return;\n } // ends if templateTiddler == null (not in params)\n\n var templateTiddlerObj = store.getTiddler(templateTiddler);\n if(templateTiddlerObj == null) {\n createTiddlyError(place,config.messages.macroError.format([macroName]),config.macros.tiddlerTemplatesMacros.errorNoTemplateTiddler.format([templateTiddler]));\n return;\n } // ends if templateTiddlerObj == null (not in store)\n\n var templateButton = createTiddlyButton(place,label,tooltip,config.macros.tiddlerTemplatesMacros.newFromTemplate);\n templateButton.setAttribute("templateTitle",templateTiddlerObj.title);\n if (hereMode){templateButton.setAttribute("tagToAdd",hereMode);}\n if (templateTag){templateButton.setAttribute("tagToStrip",templateTag);}\n\n}; // closes newFromTemplateButton handler definition\n\n// This macro only in here for backward compatibility. I'll problably drop it from the next release\nconfig.macros.newFromTemplate.handler = function(place,macroName,params,wikifier,paramString,callingTiddler){\n\n // juggle params around since this macro does NOT use named parameters and newFromTemplatePopup does\n if (params[0] != null) {paramString = 'templateTag:\s"'+paramString+'\s"';}\n var paramsToPass = paramString.readMacroParams();\n config.macros.newFromTemplatePopup.handler(place,macroName,paramsToPass, wikifier,paramString, callingTiddler);\n\n}; // closes newFromTemplate handler definition\n\n//}}}\n\n
/***\n|''Name:''|TiddlerWithParamsPlugin|\n|''Version:''|1.0.0 (2006-01-20)|\n|''Source:''|http://tiddlywiki.abego-software.de/#TiddlerWithParamsPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license]]|\n!Description\n\nThe TiddlerWithParamsPlugin extends the build-in {{{<<tiddler...>>}}} macro. It replaces placeholders ($1, $2, ...) in the given tiddler by values passed with the macro. Then it inserts the (replaced) text, just like the original {{{<<tiddler...>>}}} macro.\n\n''Syntax:'' \n|>|{{{<<}}}''tiddler '' //tiddlerName// [//className//] [''with:'' //arguments// ] [''prefix:'' //prefixString//] {{{>>}}}|\n|//tiddlerName//|The name of the tiddler to be included. The tiddler may contain placeholders ($1, $2, ... $9) that will be replaced with the values passed with the macro|\n|//className//|The (CSS) class to be used around the embedded tiddler|\n|//arguments//|up to 9 arguments may be passed to the macro, used as the values for the placeholders $1, $2, ... $9 in the referenced template|\n|//prefixString//|By default the placeholders $1, $2, $3,..., $9 are used. But you may change the "prefix" before the placeholder number ("$") to some other text through the "prefix:" option. This may be necessary when you are using the $n in the tiddler you are referencing (e.g. when you are using regular expressions).|\n|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. ~~|\n\n!Example\n\nThe following ''//ProjectTemplate//'' tiddler defines an "Overview" page for a project, that gives access to various "sub-tiddlers" used in the project, that follow a static naming schema (e.g. all Notes for any project are stored in a tiddler called "//projectName// Notes"). $1 holds the name of the Project (e.g. "ForEachTiddler"), $2 holds the type of the published component (e.g. "Plugin", "Macro", "Function").\n{{{\n![[$1Project]] Overview\n* [[$1$2]]\n* [[ToDo|$1 ToDos]]\n* [[Notes|$1 Notes]]\n* [[Examples|$1Examples]]\n* [[Tests|$1 Tests]]\n* [[Open Bugs/CRs|$1 Open Bugs and ChangeRequests]]\n}}}\n\nThis template is now used in the ''//ForEachTiddlerProject//'' tiddler:\n{{{\n<<tiddler ProjectTemplate with: ForEachTiddler Plugin>>\n}}}\n\nThis results in the following tiddler text for the ''//ForEachTiddlerProject//'' tiddler:\n{{{\n![[ForEachTiddlerProject]] Overview\n* [[ForEachTiddlerPlugin]]\n* [[ToDo|ForEachTiddler ToDos]]\n* [[Notes|ForEachTiddler Notes]]\n* [[Examples|ForEachTiddlerExamples]]\n* [[Tests|ForEachTiddler Tests]]\n* [[Open Bugs/CRs|ForEachTiddler Open Bugs and ChangeRequests]]\n}}}\n\n!Revision history\n* v1.0.0 (2006-01-20)\n** initial version\n!Code\n***/\n//{{{\n//============================================================================\n// TiddlerWithParamsPlugin\n//============================================================================\n\n// Ensure that the Plugin is only installed once.\n//\nif (!version.extensions.TiddlerWithParamsPlugin) {\n\nversion.extensions.TiddlerWithParamsPlugin = {\n major: 1, minor: 0, revision: 0, \n date: new Date(2006,1,20), \n type: 'plugin',\n source: "http://tiddlywiki.abego-software.de/#TiddlerWithParamsPlugin"\n};\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nvar indexInArray = function(array, item) {\n for (var i = 0; i < array.length; i++) {\n if (array[i] == item) {\n return i;\n }\n }\n return -1;\n}\n\n// ---------------------------------------------------------------------------\n// The (hijacked) tiddler Macro Handler \n// ---------------------------------------------------------------------------\n\nconfig.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {\n var argsStart;\n var className = params[1];\n if (className == "with:") {\n className = null;\n argsStart = 2;\n } else {\n argsStart = (params[2] == "with:") ? 3 : -1;\n }\n \n var wrapper = createTiddlyElement(place,"span",null,className ? className : null,null);\n var text = store.getTiddlerText(params[0]);\n if(text) {\n if (argsStart >= 0) {\n // The params between the "with:" and the "prefix:" (or the end) are the arguments,\n // The param behind the "prefix:" is the prefix before the placeholder numbers.\n var argsEnd = params.length;\n var prefix = "$";\n var prefixIndex = indexInArray(params, "prefix:");\n if (prefixIndex >= argsStart) {\n argsEnd = prefixIndex;\n if (prefixIndex < (params.length-1)) {\n prefix = params[prefixIndex+1];\n }\n }\n // to avoid any "special RE chars" problems with the prefix string escape all chars.\n prefix = prefix.escapeRegExp();\n \n var arguments = params.slice(argsStart, argsEnd);\n var n = Math.min(arguments.length, 9);\n for (var i = 0; i < n; i++) {\n var value = arguments[i];\n \n var placeholderRE = new RegExp(prefix+(i+1),"mg");\n text = text.replace(placeholderRE, value);\n }\n }\n wikify(text,wrapper,null,store.getTiddler(params[0]));\n }\n}\n\n\n// End of "install only once"\n}\n\n//============================================================================\n// End of TiddlerWithParamsPlugin\n//============================================================================\n//}}}\n/***\n!Licence and Copyright\nCopyright (c) abego Software ~GmbH, 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''ToolkitPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#ToolkitPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nTiddlyWiki uses many different options, messages, shadow tiddlers, styles, notification functions and macro handlers to control a variety of program behaviors and appearances. While many of these values are normally hidden from the TW user, it can be helpful to know this information when diagnosing the behavior of macros that may be interacting with core functions and can even modify or dynamically add to the internal values currently being used.\n\n!!!!!Usage\n<<<\n''{{{<<sysInfo options|messages|shadows|styles|notify|macros>>}}}''\n\nThe ''sysInfo'' macro lets you view many key program values, so you can quickly determine the internal state of the TW core functions and the effect of any macros that may have modified or extended the TW program operating environment. Key values that sysInfo can display includes:\n*''options'' include default values hard-coded into TW, persistent local options stored in cookies, and plugin configuration options defined in systemConfig tiddlers.\n*''messages'' include built-in error text and custom-defined messages from plugins.\n*''shadows'' includes all built-in 'shadow tiddlers'.\n*''styles'' include default hard-coded CSS definitions, custom StyleSheet tiddlers, and plugin-defined styles.\n*''notify'' lists built-in or plugin-defined functions that are triggered whenever changes to tiddlers are made.\n*''macros'' include built-in and plugin-defined handlers for program functions that can be embedded and displayed within tiddler content.\n\n''{{{<<sysConfig options|messages>>}}}''\n\nThe ''sysConfig'' macro generates a form that lets you manually create or update browser cookies that can override ANY of the values currently defined in the config.options[...] array, even if those settings are not normally made visible to the TW user. sysConfig can also be used to display a list of all message text definitions, using a simple "id=text" format.\n\n''{{{<<DOMViewer rows:nn indent:xxxx inline path elementID|tiddlertitle>>}}}''\n\nWhenever TiddlyWiki renders a given tiddler, it creates a 'tree' of DOM (Document Object Model) elements that represent the information that is displayed by the browser. You can use the ''DOMViewer'' macro to examine the internal DOM elements that are produced by TiddlyWiki's formatter (the 'wikifier'), or elements directly produced by embedded macros that create custom formatted output. This can be particularly helpful when trying to fine tune the layout and appearance of your tiddler content.\n\nDOMViewer creates a textarea control and reports the DOM tree for the current 'insertion point' where the DOMViewer macro is being placed. ''inline'' flag uses TiddlyWiki rendering instead of textarea control. ''path'' shows the relative location of each child element in the DOM tree, using subscript notation, ''[elementID or tiddlertitle]'' displays DOM elements starting from the node with the specified ID. If that ID is not found in the DOM tree, the macro attempts to open a tiddler with that title and then displays the "tiddler"+title DOM elements that were rendered.\n<<<\n!!!!!Examples\n<<<\nTiddlyWiki current operating values, styles, and function definitions:\n<<sysInfo options messages shadows styles notify macros>>\n''[[ToolkitExample:DOMViewer]]''\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document\n(each tagged with <<tag systemConfig>>):\n''[[ToolkitPlugin]]''\n^^documentation and javascript for Toolkit macro handling^^\n<<<\n!!!!!Revision History\n<<<\n''2006.02.17 [2.0.1]''\nFF1501 fix: "var theTextArea"\n''2006.01.01 [2.0.0]''\nupdate for TW2.0\n''2005.10.09 [1.0.2]''\ndocumentation and code cleanup only.\n''2005.09.29 [1.0.1]''\ndocumentation and code cleanup only.\nmerged separate Toolkit:* code tiddlers into one tiddler for easier distribution\n''2005.09.27 [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// // 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// // ''{{{<<sysInfo options|messages|shadows|styles|notify|macros>>}}}''\n//{{{\nversion.extensions.sysInfo = {major: 2, minor: 0, revision: 1, date: new Date(2006,2,17)};\n\nconfig.macros.sysInfo = { };\nconfig.macros.sysInfo.handler = function(place,macroName,params) {\n // OPTIONS\n if (!params[0]||(params.find("options")!=null)) {\n var theOptList=createTiddlyElement(place,"select");\n var c=0;\n theOptList.options[c++]=new Option("options...","",false,false);\n var cookies = { };\n if (document.cookie != "") {\n var p = document.cookie.split("; ");\n for (var i=0; i < p.length; i++) {\n var pos=p[i].indexOf("=")\n if (pos==-1)\n cookies[p[i]]="";\n else\n cookies[p[i].substr(0,pos)]=unescape(p[i].slice(pos+1));\n }\n }\n var opt=new Array(); for (var i in config.options) opt.push(i); opt.sort();\n for(var i=0; i < opt.length; i++) {\n var txt = opt[i];\n var val = "config.options."+txt+"\sn"+config.options[opt[i]];\n if (cookies[opt[i]]) txt += " [cookie]";\n theOptList.options[c++]=new Option(txt,val,false,false);\n }\n }\n // MESSAGES\n if (!params[0]||(params.find("messages")!=null)) {\n var theMsgList=createTiddlyElement(place,"select");\n var c=0;\n theMsgList.options[c++]=new Option("messages...","",false,false);\n var msgs=new Array(); for (var i in config.messages) msgs.push(i); msgs.sort();\n for(var i=0; i < msgs.length; i++) {\n var txt = msgs[i];\n var val = "config.messages."+txt+"\sn"+config.messages[msgs[i]];\n theMsgList.options[c++]=new Option(txt,val,false,false);\n }\n }\n // SHADOWS\n if (!params[0]||(params.find("shadows")!=null)) {\n var theShadowList=createTiddlyElement(place,"select");\n var c=0;\n theShadowList.options[c++]=new Option("shadows...","",false,false);\n var shadows=new Array(); for (var i in config.shadowTiddlers) shadows.push(i); shadows.sort();\n for(var i=0; i < shadows.length; i++) {\n var txt = shadows[i];\n var val = "config.shadowTiddlers."+txt+"\sn"+config.shadowTiddlers[shadows[i]];\n theShadowList.options[c++]=new Option(txt,val,false,false);\n }\n }\n // STYLES\n if (!params[0]||(params.find("styles")!=null)) {\n var theStyleList=createTiddlyElement(place,"select");\n var c=0;\n theStyleList.options[c++]=new Option("stylesheets...","",false,false);\n var styles=document.getElementsByTagName("style");\n for(var i=0; i < styles.length; i++) {\n var id=styles[i].getAttribute("id"); if (!id) id="(default)";\n var txt=id;\n var val="/* stylesheet:"+txt+" */\sn"+styles[i].innerHTML;\n theStyleList.options[c++]=new Option(txt,val,false,false);\n }\n }\n // NOTIFY\n if (!params[0]||(params.find("notify")!=null)) {\n var theNotifyList=createTiddlyElement(place,"select");\n var c=0;\n theNotifyList.options[c++]=new Option("notifications...","",false,false);\n for (var i=0; i<store.namedNotifications.length; i++) {\n var n = store.namedNotifications[i];\n var fn = n.notify.toString();\n fn = fn.substring(fn.indexOf("function ")+9,fn.indexOf("{")-1);\n var txt=(n.name?n.name:"any change")+"="+fn;\n var val="/* notify: "+txt+" */"+n.notify.toString();\n theNotifyList.options[c++]=new Option(txt,val,false,false);\n }\n }\n // MACROS\n if (!params[0]||(params.find("macros")!=null)) {\n var theMacroList=createTiddlyElement(place,"select");\n var c=0;\n theMacroList.options[c++]=new Option("macro handlers...","",false,false);\n var macros=new Array();\n for (var m in config.macros) macros.push(m);\n macros.sort();\n for(var i=0; i < macros.length; i++) {\n if (config.macros[macros[i]].handler) {\n var txt=macros[i];\n var val="/* macro:"+txt+" */"+config.macros[macros[i]].handler.toString();\n theMacroList.options[c++]=new Option(txt,val,false,false);\n }\n }\n }\n // TEXTAREA DISPLAY\n var theTextArea=createTiddlyElement(place,"textarea");\n theTextArea.rows=10;\n theTextArea.cols=60;\n theTextArea.style.width="100%";\n theTextArea.style.fontSize="8pt";\n var num=!params[0]?6:params.length; var pct=100/num+"%";\n if (theOptList) {\n theOptList.textarea=theTextArea;\n theOptList.onchange=function() { this.textarea.value=this.value; }\n theOptList.style.fontSize="8pt"; theOptList.style.width=pct;\n }\n if (theMsgList) {\n theMsgList.textarea=theTextArea;\n theMsgList.onchange=function() { this.textarea.value=this.value; }\n theMsgList.style.fontSize="8pt"; theMsgList.style.width=pct;\n }\n if (theShadowList) {\n theShadowList.textarea=theTextArea;\n theShadowList.onchange=function() { this.textarea.value=this.value; }\n theShadowList.style.fontSize="8pt"; theShadowList.style.width=pct;\n }\n if (theStyleList) {\n theStyleList.textarea=theTextArea;\n theStyleList.onchange=function() { this.textarea.value=this.value; }\n theStyleList.style.fontSize="8pt"; theStyleList.style.width=pct;\n }\n if (theNotifyList) {\n theNotifyList.textarea=theTextArea;\n theNotifyList.onchange=function() { this.textarea.value=this.value; }\n theNotifyList.style.fontSize="8pt"; theNotifyList.style.width=pct;\n }\n if (theMacroList) {\n theMacroList.textarea=theTextArea;\n theMacroList.onchange=function() { this.textarea.value=this.value; }\n theMacroList.style.fontSize="8pt"; theMacroList.style.width=pct;\n }\n}\n//}}}\n// // ''{{{<<sysConfig options|messages>>}}}''\n//{{{\nversion.extensions.sysConfig= {major: 2, minor: 0, revision: 0, date: new Date(2006,1,1)};\nconfig.macros.sysConfig = { };\nconfig.macros.sysConfig.handler = function(place,macroName,params) {\n // OPTIONS\n if (!params[0]||(params.find("options")!=null)) {\n var out="";\n var options=new Array(); for (var i in config.options) options.push(i); options.sort();\n for(var i=0; i < options.length; i++)\n if ((options[i].substr(0,3)=="txt")||(options[i].substr(0,3)=="chk"))\n out += "<<option "+options[i]+">> "+options[i]+"\sn";\n else\n out += options[i]+"="+config.options[options[i]]+"\sn";\n }\n // MESSAGES\n if (!params[0]||(params.find("messages")!=null)) {\n var out="";\n var msgs=new Array(); for (var i in config.messages) msgs.push(i); msgs.sort();\n for(var i=0; i < msgs.length; i++)\n out += msgs[i]+"="+config.messages[msgs[i]]+"\sn";\n }\n if (out.length>0) wikify(out,place);\n}\n//}}}\n// // ''{{{<<DOMViewer rows:nn indent:xxxx inline path elementID|tiddlertitle>>}}}''\n//{{{\nversion.extensions.DOMViewer = {major: 2, minor: 0, revision: 0, date: new Date(2006,1,1)};\nconfig.macros.DOMViewer = { };\nconfig.macros.DOMViewer.handler = function(place,macroName,params) {\n // set default params\n var inline=false;\n var theRows=15;\n var theIndent="| ";\n var showPath=false;\n var theTarget=place;\n // unpack options parameters\n if (params[0]=='inline') { inline=true; theIndent=">"; params.shift(); } \n if (params[0]&&(params[0].substr(0,7)=="indent:")) { theIndent=params[0].substr(7); params.shift(); } \n if (params[0]&&(params[0].substr(0,5)=="rows:")) { theRows=params[0].substr(5); params.shift(); } \n if (params[0]=='path') { showPath=true; params.shift(); } \n if (params[0]) {\n theTarget=document.getElementById(params[0]);\n if (!theTarget)\n if (store.getTiddler(params[0])!=undefined) {\n theTarget=document.getElementById("tiddler"+params[0]);\n if (!theTarget && confirm("DOMViewer asks:\sn\snIs it OK to open tiddler '"+params[0]+"' now?")) { \n story.displayTiddler(null,params[0],1,null,null,false);\n theTarget=document.getElementById("tiddler"+params[0]);\n }\n }\n params.shift();\n }\n // generate and display DOM tree\n if (inline) {\n var out=getNodeTree(theTarget,theIndent,showPath,inline);\n wikify(out,place);\n }\n else {\n var out=getNodeTree(theTarget,theIndent,showPath,inline);\n var css=".DOMViewer{width:100%;font-size:8pt;color:inherit;background:transparent;border:0px;}";\n setStylesheet(css,"DOMViewerPlugin");\n var theTextArea=createTiddlyElement(place,"textarea",null,"DOMViewer",out);\n theTextArea.rows=theRows;\n theTextArea.cols=60;\n theTextArea.wrap="off";\n theTextArea.theTarget=theTarget;\n theTextArea.theIndent=theIndent;\n theTextArea.showPath=showPath;\n }\n}\nfunction getNodeTree(theNode,theIndent,showPath,inline,thePrefix,thePath)\n{\n if (!theNode) return "";\n if (!thePrefix) thePrefix="";\n if (!thePath) thePath="";\n var mquote='"'+(inline?"{{{":"");\n var endmquote=(inline?"}}}":"")+'"';\n // generate output for this node\n var out = thePrefix;\n if (showPath && thePath.length)\n out += (inline?"//":"")+thePath.substr(1)+":"+(inline?"//":"")+"\sr\sn"+thePrefix;\n if (theNode.className=="DOMViewer")\n return out+'[DOMViewer]\sr\sn'; // avoid self-referential recursion\n out += (inline?"''":"")+theNode.nodeName.toUpperCase()+(inline?"''":"");\n if (theNode.nodeName=="#text")\n out += ' '+mquote+theNode.nodeValue.replace(/\sn/g,'\s\sn')+endmquote;\n if (theNode.className)\n out += ' class='+mquote+theNode.className+endmquote;\n if (theNode.type)\n out += ' type='+mquote+theNode.type+endmquote;\n if (theNode.id)\n out += ' id='+mquote+theNode.id+endmquote;\n if (theNode.name)\n out += " "+theNode.name+(theNode.value?"="+mquote+theNode.value+endmquote:"");\n if (theNode.href)\n out += ' href='+mquote+theNode.href+endmquote;\n if (theNode.src)\n out += ' src='+mquote+theNode.src+endmquote;\n if (theNode.attributes && theNode.getAttribute("tiddlyLink")!=undefined)\n out += ' tiddler='+mquote+theNode.getAttribute("tiddlyLink")+endmquote;\n out += "\sr\sn";\n // recursively generate output for child nodes\n thePath=thePath+"."+theNode.nodeName.toLowerCase();\n thePrefix=theIndent+thePrefix;\n for (var i=0;i<theNode.childNodes.length;i++)\n {\n var thisChild=theNode.childNodes.item(i);\n var theNum=(inline?"~~":"(")+(i+1)+(inline?"~~":")");\n out += getNodeTree(thisChild,theIndent,showPath,inline,thePrefix,thePath+theNum);\n }\n return out;\n}\n//}}}\n
/***\n''UnformattedTextPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#UnformattedTextPlugin \nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nAdd //extended quotes// around specific tiddler content to prevent any embedded formatting syntax from being processed by TiddlyWiki's rendering engine, so the content will appear exactly as entered into the tiddler (i.e., "raw text"), even when it contains character sequences that would normally be treated as TiddlyWiki formatting instructions.\n!!!!!Usage\n<<<\nWhen installed, this plugin adds new wiki syntax for surrounding tiddler content so that it can be excluded from the TiddlyWiki formatting rules when it is rendered.\n//{{{\n"""content goes here"""\n//}}}\nwhere:\n* {{{"""}}} //(three double-quote characters)//^^\nmarks the start and end of the unformatted content^^\n<<<\n!!!!!Examples\n<<<\nContent containing TiddlyWiki formatting syntax can be shown with the syntax unchanged:\n{{{\n"""this text is //not italic// and <<not a macro>> and [[not a link]]"""\n}}}\n"""this text is //not italic// and <<not a macro>> and [[not a link]]"""\n\nNote that, although formatting syntax contained ''within'' the quoted content does not affect the style of the output, any formatting syntax ''surrounding'' the quoted content will still be applied. For example, the following unformatted output will be underlined:\n{{{\n__"""this text is //not italic// and <<not a macro>> and [[not a link]], but it IS underlined"""__\n}}}\n__"""this text is //not italic// and <<not a macro>> and [[not a link]], but it IS underlined"""__\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''UnformattedTextPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2005.11.07 [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//{{{\nversion.extensions.unformattedText = {major: 0, minor: 5, revision: 0, date: new Date(2005,11,07)};\n\nconfig.formatters.push( {\n name: "rawText",\n match: "\s\s\s"{3}",\n lookahead: "\s\s\s"{3}((?:.|\s\sn)*?)\s\s\s"{3}",\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 var e = createTiddlyElement(w.output,"span",null,null,lookaheadMatch[1]);\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n }\n)\n//}}}\n
Get all this tiddler simply using EricShulman's ImportTiddlersPlugin and selecting all tiddlers tagged [[Upload]].\n\n[[Upload]] is <<tagging Upload>>
This form is provided for uploading any file with the store.php script describe in UploadPlugin\n----\n<html><center>\n<form enctype="multipart/form-data" action="http://web.bidix.info/TiddlyWiki/store2.php" method="post">\n <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />\nThis file : <input name="userfile" type="file" /><p>\nOptions* : <input type="text" name="UploadPlugin" size=70 value="backupDir=backupDir;user=UPLOAD_USER;password=UPLOAD_PASSWORD;" /><p>\n <input type="submit" value="Upload" />\n</form></center>\n</html>\n----\n * Don't save your real username and password in any tiddler
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |\n| 23/6/2006 16:57:33 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|ftp.miracle96.nl\sHTML\sstore.php]] | TW | index | TWB |\n| 23/6/2006 16:58:6 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|ftp.miracle96.nl\sHTML\sstore.php]] | TW | index.html | TWB |\n| 23/6/2006 16:59:5 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|ftp://ftp.miracle96.nl/HTML/store.php]] | TW | index.html | TWB |\n| 26/6/2006 16:34:30 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|ftp://ftp.miracle96.nl/HTML/store.php]] | TW | index.html | TWB |\n| 26/6/2006 16:35:33 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|store.php]] | | index.html | TWB |\n| 26/6/2006 16:36:22 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|store.php]] | | index.html | TWB |\n| 26/6/2006 16:37:11 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|store.php]] | | index.html | |\n| 26/6/2006 16:37:44 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|store.php]] | | index.html | |\n| 26/6/2006 16:58:53 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|store.php]] | | index.html | |\n| 26/6/2006 16:59:42 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|www.miracle96.nl/store.php]] | | index.html | |\n| 28/6/2006 9:35:12 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|http://www.miracle96.nl/store.php]] | | index.html | |\n| 28/6/2006 9:57:3 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|http://www.miracle96.nl/store.php]] | | index.html | |\n| 28/6/2006 12:6:39 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|http://www.miracle96.nl/store.php]] | | index.html | | Ok |\n| 28/6/2006 17:9:8 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|http://www.miracle96.nl/store.php]] | | index.html | |\n| 28/6/2006 17:19:19 | HaraldvanKesteren | [[Update-test.html|file:///C:/TMP/TW/Update-test.html]] | [[store.php|http://www.miracle96.nl/store.php]] | | index.html | |\n| 29/6/2006 15:17:19 | HaraldvanKesteren | [[/|http://www.miracle96.nl/]] | [[store.php|http://www.miracle96.nl/store.php]] | | index.html | |
!Options used by UploadPlugin\nUsername: <<option txtUploadUserName>>\nPassword: <<option pasUploadPassword>>\n\nUrl of the [[store.php]] script^^(1)^^: <<option txtUploadStoreUrl 50>>\nRelative Directory to store the file^^(2)^^: <<option txtUploadDir 50>>\nFilename of the uploaded file^^(3)^^: <<option txtUploadFilename 40>>\nDirectory to backup file on webserver^^(4)^^: <<option txtUploadBackupDir>>\n\n^^(1)^^Mandatory either in UploadOptions or in MacroParameter\n^^(2)^^If empty stores in the [[store.php]] directory\n^^(3)^^If empty takes the actual filename\n^^(4)^^If empty existing the file with same name on webserver will be overwriten\n\n!Upload\n{{{<<upload [[UploadStoreUrl]}}}^^(1)^^{{{ [UploadFilename] [UploadBackupDir]]>>}}}\n\n<<upload>>
/***\n<<tiddler UploadPluginDoc>>\n!Code\n***/\n//{{{\nversion.extensions.UploadPlugin = {\n major: 3, minor: 3, revision: 1, \n date: new Date(2006,3,30),\n type: 'macro',\n source: 'http://tiddlywiki.bidix.info/#UploadPlugin',\n docs: 'http://tiddlywiki.bidix.info/#UploadPluginDoc'\n};\n//}}}\n\n////+++!![config.lib.file]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.file) config.lib.file= {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\nconfig.lib.file.dirname = function (filePath) {\n var lastpos;\n if ((lastpos = filePath.lastIndexOf("/")) != -1) {\n return filePath.substring(0, lastpos);\n } else {\n return filePath.substring(0, filePath.lastIndexOf("\s\s"));\n }\n};\nconfig.lib.file.basename = function (filePath) {\n var lastpos;\n if ((lastpos = filePath.lastIndexOf("#")) != -1) \n filePath = filePath.substring(0, lastpos);\n if ((lastpos = filePath.lastIndexOf("/")) != -1) {\n return filePath.substring(lastpos + 1);\n } else\n return filePath.substring(filePath.lastIndexOf("\s\s")+1);\n};\nwindow.basename = function() {return "@@deprecated@@";};\n//}}}\n////===\n\n////+++!![config.lib.log]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.log) config.lib.log= {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\nconfig.lib.Log = function(tiddlerTitle, logHeader) {\n if (version.major < 2)\n this.tiddler = store.tiddlers[tiddlerTitle];\n else\n this.tiddler = store.getTiddler(tiddlerTitle);\n if (!this.tiddler) {\n this.tiddler = new Tiddler();\n this.tiddler.title = tiddlerTitle;\n this.tiddler.text = "| !date | !user | !location |" + logHeader;\n this.tiddler.created = new Date();\n this.tiddler.modifier = config.options.txtUserName;\n this.tiddler.modified = new Date();\n if (version.major < 2)\n store.tiddlers[tiddlerTitle] = this.tiddler;\n else\n store.addTiddler(this.tiddler);\n }\n return this;\n};\n\nconfig.lib.Log.prototype.newLine = function (line) {\n var now = new Date();\n var newText = "| ";\n newText += now.getDate()+"/"+(now.getMonth()+1)+"/"+now.getFullYear() + " ";\n newText += now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" | ";\n newText += config.options.txtUserName + " | ";\n var location = document.location.toString();\n var filename = config.lib.file.basename(location);\n if (!filename) filename = '/';\n newText += "[["+filename+"|"+location + "]] |";\n this.tiddler.text = this.tiddler.text + "\sn" + newText;\n this.addToLine(line);\n};\n\nconfig.lib.Log.prototype.addToLine = function (text) {\n this.tiddler.text = this.tiddler.text + text;\n this.tiddler.modifier = config.options.txtUserName;\n this.tiddler.modified = new Date();\n if (version.major < 2)\n store.tiddlers[this.tiddler.tittle] = this.tiddler;\n else {\n store.addTiddler(this.tiddler);\n story.refreshTiddler(this.tiddler.title);\n store.notify(this.tiddler.title, true);\n }\n if (version.major < 2)\n store.notifyAll(); \n};\n//}}}\n////===\n\n////+++!![config.lib.options]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.options) config.lib.options = {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\n\nconfig.lib.options.init = function (name, defaultValue) {\n if (!config.options[name]) {\n config.options[name] = defaultValue;\n saveOptionCookie(name);\n }\n};\n//}}}\n////===\n\n////+++!![PasswordTweak]\n\n//{{{\nversion.extensions.PasswordTweak = {\n major: 1, minor: 0, revision: 2, date: new Date(2006,3,11),\n type: 'tweak',\n source: 'http://tiddlywiki.bidix.info/#PasswordTweak'\n};\n//}}}\n/***\n!!config.macros.option\n***/\n//{{{\nconfig.macros.option.passwordCheckboxLabel = "Save this password on this computer";\nconfig.macros.option.passwordType = "password"; // password | text\n\nconfig.macros.option.onChangeOption = function(e)\n{\n var opt = this.getAttribute("option");\n var elementType,valueField;\n if(opt) {\n switch(opt.substr(0,3)) {\n case "txt":\n elementType = "input";\n valueField = "value";\n break;\n case "pas":\n elementType = "input";\n valueField = "value";\n break;\n case "chk":\n elementType = "input";\n valueField = "checked";\n break;\n }\n config.options[opt] = this[valueField];\n saveOptionCookie(opt);\n var nodes = document.getElementsByTagName(elementType);\n for(var t=0; t<nodes.length; t++) {\n var optNode = nodes[t].getAttribute("option");\n if (opt == optNode) \n nodes[t][valueField] = this[valueField];\n }\n }\n return(true);\n};\n\nconfig.macros.option.handler = function(place,macroName,params)\n{\n var opt = params[0];\n var size = 15;\n if (params[1])\n size = params[1];\n if(config.options[opt] === undefined) {\n return;}\n var c;\n switch(opt.substr(0,3)) {\n case "txt":\n c = document.createElement("input");\n c.onkeyup = this.onChangeOption;\n c.setAttribute ("option",opt);\n c.size = size;\n c.value = config.options[opt];\n place.appendChild(c);\n break;\n case "pas":\n // input password\n c = document.createElement ("input");\n c.setAttribute("type",config.macros.option.passwordType);\n c.onkeyup = this.onChangeOption;\n c.setAttribute("option",opt);\n c.size = size;\n c.value = config.options[opt];\n place.appendChild(c);\n // checkbox link with this password "save this password on this computer"\n c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick = this.onChangeOption;\n c.setAttribute("option","chk"+opt);\n place.appendChild(c);\n c.checked = config.options["chk"+opt];\n // text savePasswordCheckboxLabel\n place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));\n break;\n case "chk":\n c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick = this.onChangeOption;\n c.setAttribute("option",opt);\n place.appendChild(c);\n c.checked = config.options[opt];\n break;\n }\n};\n//}}}\n/***\n!! Option cookie stuff\n***/\n//{{{\nwindow.loadOptionsCookie_orig_PasswordTweak = window.loadOptionsCookie;\nwindow.loadOptionsCookie = function()\n{\n var cookies = document.cookie.split(";");\n for(var c=0; c<cookies.length; c++) {\n var p = cookies[c].indexOf("=");\n if(p != -1) {\n var name = cookies[c].substr(0,p).trim();\n var value = cookies[c].substr(p+1).trim();\n switch(name.substr(0,3)) {\n case "txt":\n config.options[name] = unescape(value);\n break;\n case "pas":\n config.options[name] = unescape(value);\n break;\n case "chk":\n config.options[name] = value == "true";\n break;\n }\n }\n }\n};\n\nwindow.saveOptionCookie_orig_PasswordTweak = window.saveOptionCookie;\nwindow.saveOptionCookie = function(name)\n{\n var c = name + "=";\n switch(name.substr(0,3)) {\n case "txt":\n c += escape(config.options[name].toString());\n break;\n case "chk":\n c += config.options[name] ? "true" : "false";\n // is there an option link with this chk ?\n if (config.options[name.substr(3)]) {\n saveOptionCookie(name.substr(3));\n }\n break;\n case "pas":\n if (config.options["chk"+name]) {\n c += escape(config.options[name].toString());\n } else {\n c += "";\n }\n break;\n }\n c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/";\n document.cookie = c;\n};\n//}}}\n/***\n!! Initializations\n***/\n//{{{\n// define config.options.pasPassword\nif (!config.options.pasPassword) {\n config.options.pasPassword = 'defaultPassword';\n window.saveOptionCookie('pasPassword');\n}\n// since loadCookies is first called befor password definition\n// we need to reload cookies\nwindow.loadOptionsCookie();\n//}}}\n////===\n\n////+++!![config.macros.upload]\n\n//{{{\nconfig.macros.upload = {\n accessKey: "U",\n formName: "UploadPlugin",\n contentType: "text/html;charset=UTF-8",\n defaultStoreScript: "store.php"\n};\n\n// only this two configs need to be translated\nconfig.macros.upload.messages = {\n aboutToUpload: "About to upload TiddlyWiki to %0",\n errorDownloading: "Error downloading",\n errorUploadingContent: "Error uploading content",\n fileNotFound: "file to upload not found",\n fileNotUploaded: "File %0 NOT uploaded",\n mainFileUploaded: "Main TiddlyWiki file uploaded to %0",\n urlParamMissing: "url param missing",\n rssFileNotUploaded: "RssFile %0 NOT uploaded",\n rssFileUploaded: "Rss File uploaded to %0"\n};\n\nconfig.macros.upload.label = {\n promptOption: "Save and Upload this TiddlyWiki with UploadOptions",\n promptParamMacro: "Save and Upload this TiddlyWiki in %0",\n saveLabel: "save to web", \n saveToDisk: "save to disk",\n uploadLabel: "upload" \n};\n\nconfig.macros.upload.handler = function(place,macroName,params){\n // parameters initialization\n var storeUrl = params[0];\n var toFilename = params[1];\n var backupDir = params[2];\n var uploadDir = params[3];\n var username = params[4];\n var password; // for security reason no password as macro parameter\n var label;\n if (document.location.toString().substr(0,4) == "http")\n label = this.label.saveLabel;\n else\n label = this.label.uploadLabel;\n var prompt;\n if (storeUrl) {\n prompt = this.label.promptParamMacro.toString().format([this.dirname(storeUrl)]);\n }\n else {\n prompt = this.label.promptOption;\n }\n createTiddlyButton(place, label, prompt, \n function () {\n config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password); \n return false;}, \n null, null, this.accessKey);\n};\nconfig.macros.upload.UploadLog = function() {\n return new config.lib.Log('UploadLog', " !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |" );\n};\nconfig.macros.upload.UploadLog.prototype = config.lib.Log.prototype;\nconfig.macros.upload.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {\n var line = " [[" + config.lib.file.basename(storeUrl) + "|" + storeUrl + "]] | ";\n line += uploadDir + " | " + toFilename + " | " + backupDir + " |";\n this.newLine(line);\n};\nconfig.macros.upload.UploadLog.prototype.endUpload = function() {\n this.addToLine(" Ok |");\n};\nconfig.macros.upload.basename = config.lib.file.basename;\nconfig.macros.upload.dirname = config.lib.file.dirname;\nconfig.macros.upload.upload = function(storeUrl, toFilename, uploadDir, backupDir, username, password)\n{\n // parameters initialization\n storeUrl = (storeUrl ? storeUrl : config.options.txtUploadStoreUrl);\n toFilename = (toFilename ? toFilename : config.options.txtUploadFilename);\n if (toFilename === '') {\n toFilename = config.lib.file.basename(document.location.toString());\n }\n backupDir = (backupDir ? backupDir : config.options.txtUploadBackupDir);\n uploadDir = (uploadDir ? uploadDir : config.options.txtUploadDir);\n username = (username ? username : config.options.txtUploadUserName);\n password = config.options.pasUploadPassword; // for security reason no password as macro parameter\n\n clearMessage();\n // only for forcing the message to display\n if (version.major < 2)\n store.notifyAll();\n if (!storeUrl) {\n alert(config.macros.upload.messages.urlParamMissing);\n return;\n }\n \n var log = new this.UploadLog();\n log.startUpload(storeUrl, toFilename, uploadDir, backupDir);\n if (document.location.toString().substr(0,5) == "file:") {\n saveChanges();\n }\n displayMessage(config.macros.upload.messages.aboutToUpload.format([this.dirname(storeUrl)]), this.dirname(storeUrl));\n this.uploadChanges(storeUrl, toFilename, uploadDir, backupDir, username, password);\n if(config.options.chkGenerateAnRssFeed) {\n //var rssContent = convertUnicodeToUTF8(generateRss());\n var rssContent = generateRss();\n var rssPath = toFilename.substr(0,toFilename.lastIndexOf(".")) + ".xml";\n this.uploadContent(rssContent, storeUrl, rssPath, uploadDir, '', username, password, \n function (responseText) {\n if (responseText.substring(0,1) != '0') {\n displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([rssPath]));\n }\n else {\n if (uploadDir) {\n rssPath = uploadDir + "/" + config.macros.upload.basename(rssPath);\n } else {\n rssPath = config.macros.upload.basename(rssPath);\n }\n displayMessage(config.macros.upload.messages.rssFileUploaded.format(\n [config.macros.upload.dirname(storeUrl)+"/"+rssPath]), config.macros.upload.dirname(storeUrl)+"/"+rssPath);\n }\n // for debugging store.php uncomment last line\n //DEBUG alert(responseText);\n });\n }\n return;\n};\n\nconfig.macros.upload.uploadChanges = function(storeUrl, toFilename, uploadDir, backupDir, \n username, password) {\n var original;\n if (document.location.toString().substr(0,4) == "http") {\n original = this.download(storeUrl, toFilename, uploadDir, backupDir, username, password);\n return;\n }\n else {\n // standard way : Local file\n \n original = loadFile(getLocalPath(document.location.toString()));\n if(window.Components) {\n // it's a mozilla browser\n try {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]\n .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);\n converter.charset = "UTF-8";\n original = converter.ConvertToUnicode(original);\n }\n catch(e) {\n }\n }\n }\n //DEBUG alert(original);\n this.uploadChangesFrom(original, storeUrl, toFilename, uploadDir, backupDir, \n username, password);\n};\n\nconfig.macros.upload.uploadChangesFrom = function(original, storeUrl, toFilename, uploadDir, backupDir, \n username, password) {\n var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it\n var endSaveArea = '</d' + 'iv>';\n // Locate the storeArea div's\n var posOpeningDiv = original.indexOf(startSaveArea);\n var posClosingDiv = original.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1))\n {\n alert(config.messages.invalidFileError.format([document.location.toString()]));\n return;\n }\n var revised = original.substr(0,posOpeningDiv + startSaveArea.length) + \n allTiddlersAsHtml() + "\sn\st\st" +\n original.substr(posClosingDiv);\n var newSiteTitle;\n if(version.major < 2){\n newSiteTitle = (getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode();\n } else {\n newSiteTitle = (wikifyPlain ("SiteTitle") + " - " + wikifyPlain ("SiteSubtitle")).htmlEncode();\n }\n revised = revised.replace(new RegExp("<title>[^<]*</title>", "im"),"<title>"+ newSiteTitle +"</title>");\n var response = this.uploadContent(revised, storeUrl, toFilename, uploadDir, backupDir, \n username, password, function (responseText) {\n if (responseText.substring(0,1) != '0') {\n alert(responseText);\n displayMessage(config.macros.upload.messages.fileNotUploaded.format([getLocalPath(document.location.toString())]));\n }\n else {\n if (uploadDir !== '') {\n toFilename = uploadDir + "/" + config.macros.upload.basename(toFilename);\n } else {\n toFilename = config.macros.upload.basename(toFilename);\n }\n displayMessage(config.macros.upload.messages.mainFileUploaded.format(\n [config.macros.upload.dirname(storeUrl)+"/"+toFilename]), config.macros.upload.dirname(storeUrl)+"/"+toFilename);\n var log = new config.macros.upload.UploadLog();\n log.endUpload();\n store.setDirty(false);\n }\n // for debugging store.php uncomment last line\n //DEBUG alert(responseText);\n }\n );\n};\n\nconfig.macros.upload.uploadContent = function(content, storeUrl, toFilename, uploadDir, backupDir, \n username, password, callbackFn) {\n var boundary = "---------------------------"+"AaB03x"; \n var request;\n try {\n request = new XMLHttpRequest();\n } \n catch (e) { \n request = new ActiveXObject("Msxml2.XMLHTTP"); \n }\n if (window.netscape){\n try {\n if (document.location.toString().substr(0,4) != "http") {\n netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');}\n }\n catch (e) { }\n } \n //DEBUG alert("user["+config.options.txtUploadUserName+"] password[" + config.options.pasUploadPassword + "]");\n // compose headers data\n var sheader = "\sr\sn";\n sheader += "--" + boundary + "\sr\snContent-disposition: form-data;name=\s"";\n sheader += config.macros.upload.formName +"\s"\sr\sn\sr\sn";\n sheader += "backupDir="+backupDir\n +";user=" + username \n +";password=" + password\n +";uploaddir=" + uploadDir\n + ";;\sr\sn"; \n sheader += "\sr\sn" + "--" + boundary + "\sr\sn";\n sheader += "Content-disposition: form-data;name=\s"userfile\s";filename=\s""+toFilename+"\s"\sr\sn";\n sheader += "Content-Type: " + config.macros.upload.contentType + "\sr\sn";\n sheader += "Content-Length: " + content.length + "\sr\sn\sr\sn";\n // compose trailer data\n var strailer = new String();\n strailer = "\sr\sn--" + boundary + "--\sr\sn";\n var data;\n data = sheader + content + strailer;\n //request.open("POST", storeUrl, true, username, password);\n request.open("POST", storeUrl, true);\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if (request.status == 200)\n callbackFn(request.responseText);\n else\n alert(config.macros.upload.messages.errorUploadingContent);\n }\n };\n request.setRequestHeader("Content-Length",data.length);\n request.setRequestHeader("Content-Type","multipart/form-data; boundary="+boundary);\n request.send(data); \n};\n\n\nconfig.macros.upload.download = function(uploadUrl, uploadToFilename, uploadDir, uploadBackupDir, \n username, password) {\n var request;\n try {\n request = new XMLHttpRequest();\n } \n catch (e) { \n request = new ActiveXObject("Msxml2.XMLHTTP"); \n }\n try {\n if (uploadUrl.substr(0,4) == "http") {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");\n }\n else {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n }\n } catch (e) { }\n //request.open("GET", document.location.toString(), true, username, password);\n request.open("GET", document.location.toString(), true);\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if(request.status == 200) {\n config.macros.upload.uploadChangesFrom(request.responseText, uploadUrl, \n uploadToFilename, uploadDir, uploadBackupDir, username, password);\n }\n else\n alert(config.macros.upload.messages.errorDownloading.format(\n [document.location.toString()]));\n }\n };\n request.send(null);\n};\n\n//}}}\n////===\n\n////+++!![Initializations]\n\n//{{{\nconfig.lib.options.init('txtUploadStoreUrl','store.php');\nconfig.lib.options.init('txtUploadFilename','');\nconfig.lib.options.init('txtUploadDir','');\nconfig.lib.options.init('txtUploadBackupDir','');\nconfig.lib.options.init('txtUploadUserName',config.options.txtUserName);\nconfig.lib.options.init('pasUploadPassword','');\nconfig.shadowTiddlers.UploadPluginDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadPluginDoc ]]\sn"; \n\n\n//}}}\n////===\n\n////+++!![Core Hijacking]\n\n//{{{\nconfig.macros.saveChanges.label_orig_UploadPlugin = config.macros.saveChanges.label;\nconfig.macros.saveChanges.label = config.macros.upload.label.saveToDisk;\n//}}}\n////===
/***\n|''Name:''|UploadPlugin|\n|''Type:''|Plugin|\n|''Version:''|3.3.1 (30/03/2006)|\n|''Source:''|[[TiddlyWiki.BidiX.info/#UploadPlugin|http://tiddlywiki.BidiX.info/#UploadPlugin]]|\n|''Documentation:''|[[TiddlyWiki.BidiX.info/#UploadPluginDoc|http://tiddlywiki.BidiX.info/#UploadPluginDoc]]|\n|''Author:''|BidiX[at]BidiX.info |\n|''Required:''| TW 2.0.6 or better, PHP 4.4 (perhaps less but not working on 4.1.2) |\n\n!Description\nUploadPlugin, with [[store.php]], provides @@upload@@ and @@save to web@@ functions. See HowToUpload ([[HowToUpload|http://TiddlyWiki.bidix.info/#HowToUpload]]).\nUploadPlugin uses Username and Password from UploadOptions stored in cookies to authenticate itself to [[store.php]].\nFrench translation available as a separate tiddler UploadPluginMsgFR\n\n!!UploadPlugin\n*If the TiddlyWiki is viewed from @@local disk@@ :\n**{{{<<saveChanges>>}}} \n***display as ''save to disk''\n***work as usual\n**{{{<<upload>>}}}\n***display as ''upload''\n***after saving to disk, upload in the storeUrl directory.\n*If the TiddlyWiki is viewed from @@website@@ and is @@readOnly@@ (in core TiddlyWiki since 2.0.6) :\n**{{{<<saveChanges>>}}} \n***print nothing\n***has been disabled\n**{{{<<upload>>}}}\n***display as '''save to web''\n***save in the uploadDir directory.\n*If GenerateAnRssFeed in AdvancedOptions is set :\n**generate the content of the RSSFeed \n**upload the RssFile in uploadDir directory\n**Caution : use the SiteUrl tiddler to specify the right url of the TiddlyWiki in the generated RssFile\n*DisplayMessage\n*Log upload action in UploadLog\nhint : if UploadLog is the first tiddler in the Timeline Tab, no tiddler has been updated since last upload.\n\n!![[store.php]]\n*UserVariables to set :\n//{{{\n$AUTHENTICATE_USER = true; // true | false\n$USERS = array(\n 'UserName1'=>'Password1', \n 'UserName2'=>'Password2', \n 'UserName3'=>'Password3'); // set usernames and strong passwords\n$DEBUG = false; // true | false\n//}}}\n*method GET\n**display an information page\n*method POST\n**if $~AUTHENTICATE_USER is ''true''\n***presence and value of user and password are checked with $USER and $PASSWORD \n**if toFilename already exists and backDir parameter specified\n***rename toFilename to backupDir/toFilename.AAAAMMDD.HHSS.html\n**copy temporaryUploadedFile to toFilename\n** return status\n\n!Usage : \n{{{\n<<upload>>\n uses UploadOptions saved in cookies :\n txtUploadUserName: username\n pasUploadPassword : password\n txtUploadStoreUrl : store script\n txtUploadDir : relative path for upload directory\n txtUploadFilename : upload filename\n txtUploadBackupDir : relative path for backup directory\n\n<<upload [storeUrl [toFilename [backupDir [uploadDir [username]]]]]>>\n optional positional parameters can be passed to overwrite UploadOptions in this order. \n}}}\n\nInstall the {{{<<upload ... >>}}} macro in SideBarOptions just below {{{<<saveChanges>>}}} macro.\n\n\n!User manual\nSee HowToUpload\n\n!Installation :\n*Install the UploadPlugin as usual\n*Upload the [[store.php]] file on your php aware webserver in your TiddlyWiki directory\n*Protect your server against malicious upload. Two approaches :\n**set $~AUTHENTICATE_USER to true in the [[store.php]] script\n***configure $USER and $PASSWORD in the [[store.php]] script on your webserver\n***set UploadOptions in conformity with [[store.php]]\n**Use server protection :\n***for Apache web server ([[for detail see Apache documentation|http://httpd.apache.org/docs/1.3/howto/htaccess.html]]) : \n****configure and upload the [[.htaccess]] [[.passwd]]\n***for other web servers see the appropriate documentation\n*Configure an upload button, for example in the SideBarOptions\n!Suppported Browser\n*Firefox : tested Ok\n*Internet Explorer : tested Ok\n*Safari : reported ok on OS X\n*Others : Not tested, please report status.\n\n!Revision history\n*V 3.3.1 (30/03/2006)\n**bug in backup folder when uploading rssfile fixed\n*V 3.3.0 (12/03/2006)\n**Code refactoring\n**suppress saveChanges hijacking\n*V3.2.2 (25/02/2006)\n**Use PasswordTweak 1.0.1\n**uploaddir is a relative path\n**backupdir is a relative path\n+++[previous revisions]\n*V3.2.1 (13/02/2006)\n**name and password added to open.request (Thanks to TedPavlic)\n*V3.2.0 (14/02/2006)\n**Use PassworDTweak (http://tiddlyWiki.bidix.info/#PasswordTweak) for password\n*V3.1.0 (12/02/2006)\n**UploadOptions in Cookies\n**Username and password from UploadOptions pass to store.php script for authentification check\n*V3.0.3 (03/02/2006)\n**Firefox 1.5.0.1 crashes due to global var fixed\n*V3.0.2 (25-Jan-2006)\n**HTTPS compatible\n*V3.0.1 (18-Jan-2006)\n**UTF8toUnicode conversion problem in Firefox\n*V3.0.0 (15-Jan-2006)\n**Asynchronous upload\n**Synchronous upload before unload of the page\n**All strings extracted in macro config\n**Compatibility checked with TW 2.0.2 & TW 1.2.39 for both FF 1.5 and IE 6\n*V2.0.2 (8-Jan-2006)\n**conversion of SiteTitle and SiteSubtitle in web page Title\n*V2.0.1 (8-Jan-2006)\n**Compatibilty with TiddlyWiki 2.0.1\n*V2.0.0 (3-Jan-2006)\n**Save to web\n**Compatibilty with TiddlyWiki 1.2.39 and TiddlyWiki 2.0.0 Beta 6\n*v1.1.0 (27-Dec-2005)\n**Upload RSS File\n*v1.0.3 (26-Dec-2005)\n**UploadLog tiddler\n*v1.0.2 (24-Dec-2005)\n**Optional parameter toFilename\n**Optional parameter backupDir\n*v1.0.1 (23-Dec-2005)\n**reformatting code\n* v1.0.0 (17-Dec-2005)\n** first public working version\n===\n\n
/***\n\n\n----\nUploadPluginMsgEN provides the english translation for UploadPlugin.\n----\n\n\n***/\n/***\n|''Name:''|UploadPluginMsgEN|\n|''Type:''|Translation|\n|''Version:''|UploadPlugin 3.1.x (12/02/2006)|\n|''Source:''|[[TiddlyWiki.BidiX.info|http://tiddlywiki.BidiX.info/#UploadPluginEN]]|\n|''Author:''|BidiX[at]BidiX.info with modifications by [[Yann Perrin]]|\n|''Compatibility:''|TW1.2 & TW2|\n!Usage : \nFor an english translation of UploadPlugin Message when using PolyGlotPlugin, import this tiddler in the TiddlyWiki. Make sure it is tagged with {{{en}}} and {{{linguo}}}. \nComments and suggestions are welcome.\n***/\n//{{{\nconfig.macros.upload.messages = {\n aboutToUpload: "About to upload TiddlyWiki to %0",\n errorDownloading: "Error downloading",\n errorUploadingContent: "Error uploading content",\n fileNotFound: "file to upload not found",\n fileNotUploaded: "File %0 NOT uploaded",\n mainFileUploaded: "Main TiddlyWiki file uploaded to %0",\n urlParamMissing: "url param missing",\n rssFileNotUploaded: "RssFile %0 NOT uploaded",\n rssFileUploaded: "Rss File uploaded to %0"\n};\n\nconfig.macros.upload.label = {\n promptOption: "Save and Upload this TiddlyWiki with UploadOptions",\n promptParamMacro: "Save and Upload this TiddlyWiki in %0",\n saveLabel: "save to web", \n saveToDisk: "save to disk",\n uploadLabel: "upload" \n};\nconfig.macros.saveChanges.label = config.macros.upload.label.saveToDisk;\n//}}}\n
|''Name:''|UploadToFileMacro|\n|''Type:''|Macro|\n|''Version:''|1.0.0 (14/03/2006)|\n|''Source:''|[[TiddlyWiki.BidiX.info/#UploadToFileMacro|http://tiddlywiki.BidiX.info/#UploadToFileMacro]]|\n|''Documentation:''|[[TiddlyWiki.BidiX.info/#UploadToFileMacroDoc|http://tiddlywiki.BidiX.info/#UploadToFileMacroDoc]]|\n|''Author:''|BidiX[at]BidiX.info |\n|''Required:''|[[UploadPlugin|http://tiddlywiki.BidiX.info/#UploadPlugin]] |\n\n!Description\nUpload a tiddler as a file using UploadPlugin context. Used with the SimonBaird's RunMacroIfTagged in [[ViewTemplate|BidiXStyleViewTemplate]] provides a new command in the tiddler toolbar.\n\n!Usage\n{{{\n <<uploadToFile>>\n <<uploadTofile [filename [tiddlerTitle]]>>\n \n tiddlerTitle: if omitted the title of the current tiddler \n filename: if omitted the title of the current tiddler\n\n}}}\n\n!Revision history\n* v1.0.0 (14/03/2006)\n** initial release\n
/***\n!WebTemplatePlugin with ViewSourcePlugin and 404TiddlerPlugin\n''Version'': 0.3 (19 Jan 2006)\n''Author'': Clint Checketts\n\n!Instructions\nWebPageTemplate\nWebViewTemplate\nWebEditTemplate\n\n!Code\n***/\n//{{{\nconfig.options.chkHttpReadOnly = true;\nreadOnly = (document.location.toString().substr(0,4) == "http") ? config.options.chkHttpReadOnly : false;\n\nconfig.shadowTiddlers['WebPageTemplate'] = config.shadowTiddlers['PageTemplate'];\nconfig.shadowTiddlers['WebViewTemplate'] = "<!--{{{-->\sn<div class='toolbar' macro='toolbar closeTiddler permalink +viewSource'></div>\sn<div class='title' macro='view title'></div>\sn<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>\sn<div class='tagging' macro='tagging'></div>\sn<div class='tagged' macro='tags'></div>\sn<div class='viewer' macro='view text wikified'></div>\sn<div class='tagClear'></div>\sn<!--}}}-->";\nconfig.shadowTiddlers['WebEditTemplate'] = "<!--{{{-->\sn<div class='toolbar' macro='toolbar -cancelTiddler'></div>\sn<div class='title'><span macro='view title'></span> (source code)</div>\sn<div class='editor' macro='edit text'></div>\sn<!--}}}-->\sn";\n\nif(readOnly){ \n showWebView();\n}\n\nwindow.applyPageTemplateWebTemplate = window.applyPageTemplate;\nwindow.applyPageTemplate = function(title){\n if(readOnly && store.tiddlerExists('WebPageTemplate')) title = 'WebPageTemplate';\n applyPageTemplateWebTemplate(title);\n}\n\nfunction showWebView(){\n config.tiddlerTemplates[1] = "WebViewTemplate";\n config.tiddlerTemplates[2] = "WebEditTemplate";\n}\n\nconfig.macros.testWebView = {}\nconfig.macros.testWebView.handler = function(place,macroName,params)\n{\n createTiddlyButton(place,"ToggleWebTemplates","Toggle the web mode",toggleWebView);\n}\n\nvar toggleWebView = function(){\n readOnly = !readOnly;\n if(readOnly){\n showWebView();\n } else {\n config.tiddlerTemplates[1] = "ViewTemplate";\n config.tiddlerTemplates[2] = "EditTemplate";\n }\n store.notifyAll();\n}\n//}}}\n/***\n!View Source Plugin\n***/\n//{{{\nconfig.commands.viewSource = {text: "view source", tooltip: "View this tiddler's wiki markup"},\nconfig.commands.viewSource.handler = function(event,src,title){\n clearMessage();\n story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE);\n\n var theTiddler = document.getElementById("tiddler"+title);\n var tiddlerElements = theTiddler.getElementsByTagName("textarea")\n\n for (var i = 0; i < tiddlerElements.length; i++){\n tiddlerElements[i].setAttribute("readonly","readonly");\n }\n\n if (tiddlerElements.length > 0){\n tiddlerElements[0].focus(); tiddlerElements[0].select();\n }\n return false;\n}\n//}}}\n/***\n!404 Tiddler Plugin\n***/\n//{{{\n//config.shadowTiddlers['404 Error'] = "The tiddler you were looking for doesn't exist.\sn\snTry a <<search>> for the information you were looking for.";\nconfig.shadowTiddlers['404Template'] = "<div class='toolbar' macro='toolbar -closeTiddler closeOthers'></div><div class='title'>404 Error: <span macro='view title'></span></div><div class='viewer'>The page '<span macro='view title'></span>' doesn't exist.<br /><br />Try a <span macro='search'></span> for the information you were looking for.</div>";\n\n\nStory.prototype.displayTiddler404 = Story.prototype.displayTiddler;\nStory.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)\n{\n// if (readOnly && !store.tiddlerExists(title) && !store.isShadowTiddler(title)){title = '404 Error'}\n if (readOnly && !store.tiddlerExists(title) && !store.isShadowTiddler(title)){template = '404Template';}\n this.displayTiddler404(srcElement,title,template,animate,slowly);\n}\n\n//}}}
<?php\n/***\n! User settings\nEdit these lines according to your need\n***/\n//{{{\n$AUTHENTICATE_USER = true; // true | false\n$USERS = array(\n 'UserName1'=>'Password1', \n 'UserName2'=>'Password2', \n 'UserName3'=>'Password3'); // set usernames and strong passwords\n$DEBUG = false; // true | false\n//}}}\n/***\n!Code\nNo change needed under\n***/\n//{{{\n\n/***\n * store.php - upload a file in this directory\n * version :1.4.1 - 15/03/2006 - BidiX@BidiX.info\n * \n * see : \n * http://tiddlywiki.bidi.info/#UploadPlugin for usage\n * http://www.php.net/manual/en/features.file-upload.php \n * for détails on uploading files\n * usage : \n * POST \n * UploadPlugin[backupDir=<backupdir>;user=<user>;password=<password>;uploadir=<uploaddir>]\n * userfile <file>\n * GET\n *\n * Revision history\n * v 1.4.1 - 15/03/2006\n * add chmo 0664 on the uploadedFile\n * v 1.4 - 23/02/2006 :\n * add uploaddir option : a path for the uploaded file relative to the current directory\n * backupdir is a relative path\n * make recusively directories if necessary for backupDir and uploadDir\n * v 1.3 - 17/02/2006 :\n * presence and value of user are checked with $USERS Array (thanks to PauloSoares)\n * v 1.2 - 12/02/2006 : \n * POST \n * UploadPlugin[backupDir=<backupdir>;user=<user>;password=<password>;]\n * userfile <file>\n * if $AUTHENTICATE_USER\n * presence and value of user and password are checked with \n * $USER and $PASSWORD\n * v 1.1 - 23/12/2005 : \n * POST UploadPlugin[backupDir=<backupdir>] userfile <file>\n * v 1.0 - 12/12/2005 : \n * POST userfile <file>\n *\n * Copyright (c) BidiX@BidiX.info 2005-2006\n ***/\n//}}}\n\n//{{{\n\nif ($_SERVER['REQUEST_METHOD'] == 'GET') {\n /*\n * GET Request\n */\n ?>\n <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n <html>\n <head>\n <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >\n <title>BidiX.info - TiddlyWiki UploadPlugin - Store script</title>\n </head>\n <body>\n <p>\n <p>store.php V 1.4\n <p>BidiX@BidiX.info\n <p>&nbsp;</p>\n <p>&nbsp;</p>\n <p>&nbsp;</p>\n <p align="center">This page is designed to upload a <a href="http://www.tiddlywiki.com/">TiddlyWiki<a>.</p>\n <p align="center">for details see : <a href="http://TiddlyWiki.bidix.info/#HowToUpload">TiddlyWiki.bidix.info/#HowToUpload<a>.</p> \n </body>\n </html>\n <?php\n}\nelse {\n /*\n * POST Request\n */\n \n // Recursive mkdir\n function mkdirs($dir) {\n if( is_null($dir) || $dir === "" ){\n return false;\n }\n if( is_dir($dir) || $dir === "/" ){\n return true;\n }\n if( mkdirs(dirname($dir)) ){\n return mkdir($dir);\n }\n return false;\n }\n \n // var definitions\n $uploadDir = './';\n $uploadDirError = false;\n $backupError = false;\n $optionStr = $_POST['UploadPlugin'];\n $optionArr=explode(';',$optionStr);\n $options = array();\n $backupFilename = '';\n $filename = $_FILES['userfile']['name'];\n \n // get options\n foreach($optionArr as $o) {\n list($key, $value) = split('=', $o);\n $options[$key] = $value;\n }\n \n // authenticate User\n if ((!$AUTHENTICATE_USER) \n || (($options['user']) && ($options['password']) && ($USERS[$options['user']] == $options['password']))) {\n // make uploadDir\n if ($options['uploaddir']) {\n if (! is_dir($options['uploaddir'])) {\n mkdirs($options['uploaddir']);\n }\n if (! is_dir($options['uploaddir'])) {\n $uploadDirError = "uploadDir mkdir error";\n }\n $uploadDir = $uploadDir . $options['uploaddir'];\n if ($uploadDir{strlen($uploadDir)-1} != '/') {\n $uploadDir = $uploadDir . '/';\n }\n }\n if (!$uploadDirError) {\n // backup existing file\n if (file_exists($uploadDir . $_FILES['userfile']['name']) && ($options['backupDir'])) {\n if (! is_dir($options['backupDir'])) {\n mkdirs($options['backupDir']);\n if (! is_dir($options['backupDir'])) {\n $backupError = "backup mkdir error";\n }\n }\n $backupFilename = $options['backupDir'].'/'.substr($filename, 0, strpos($filename, '.'))\n .date('.Ymd.His').substr($filename,strpos($filename,'.'));\n $filename = $uploadDir . $_FILES['userfile']['name'];\n rename($filename, $backupFilename) or ($backupError = "rename error");\n }\n // move uploaded file to to uploadDir\n if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadDir . $_FILES['userfile']['name'])) {\n chmod($uploadDir . $_FILES['userfile']['name'], 0644);\n if (!$backupError) {\n if($DEBUG) {\n echo "debug mode \sn\sn";\n }\n echo "0 - File successfully loaded in " .$uploadDir . $_FILES['userfile']['name']. "\sn";\n if ($backupFilename)\n echo "backupFile=$backupFilename;\sn";\n } else {\n echo "BackupError : $backupError - File successfully loaded in " .$uploadDir . $_FILES['userfile']['name']. "\sn";\n }\n } \n else {\n echo "Error : " . $_FILES['error']." - File NOT uploaded !\sn";\n }\n }\n else {\n echo "UploadDirError : $uploadDirError - File NOT uploaded !\sn";\n }\n }\n else {\n echo "Error : UserName or Password do not match \sn";\n echo "UserName : [".$options['user']. "] Password : [". $options['password'] . "]\sn";\n }\n if ($DEBUG) {\n echo ("\snHere is some debugging info : \sn");\n echo("\s$filename : $filename \sn");\n echo("\s$backupFilename : $backupFilename \sn");\n print ("\s$_FILES : \sn");\n print_r($_FILES);\n print ("\s$options : \sn");\n print_r($options);\n }\n}\n//}}}\n?>