{
"title": "$:/core",
"description": "TiddlyWiki5 core plugin",
"author": "JeremyRuston",
"version": "0.0.0",
"core-version": ">=5.0.0",
"plugin-priority": "0",
"tiddlers": {
"$:/core/copyright.txt": {
"title": "$:/core/copyright.txt",
"type": "text/plain",
"text": "TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\n\nCopyright © Jeremy Ruston 2004-2007\nCopyright © UnaMesa Association 2007-2013\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 the UnaMesa Association 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"
},
"$:/core/images/cancel-button": {
"title": "$:/core/images/cancel-button",
"text": "<svg class=\"tw-image-cancel-button\" viewBox=\"366 150 58 58\" width=\"22pt\" height=\"22pt\"><path d=\"M 414.76236 158.98764 C 403.77887 148.0041 385.97113 148.0041 374.98764 158.98764 C 364.0041 169.97113 364.0041 187.77887 374.98764 198.76236 C 385.97113 209.7459 403.77887 209.7459 414.76236 198.76236 C 425.7459 187.77887 425.7459 169.97113 414.76236 158.98764 M 385.3967 165.32954 L 385.3967 165.32954 L 394.77674 174.7096 L 404.3533 165.13303 C 405.53068 163.95566 407.4396 163.95566 408.61697 165.13303 C 409.79434 166.31041 409.79434 168.21932 408.61697 169.39669 L 399.0404 178.97325 L 408.42046 188.35331 C 409.59783 189.53068 409.59783 191.43959 408.42046 192.61697 L 408.42046 192.61697 C 407.24308 193.79434 405.33417 193.79434 404.1568 192.61697 L 394.77675 183.23692 L 385.5932 192.42046 C 384.41583 193.59783 382.50692 193.59783 381.32954 192.42046 L 381.32954 192.42046 C 380.15217 191.24308 380.15217 189.33417 381.32954 188.1568 C 381.32954 188.1568 381.32954 188.1568 381.32954 188.1568 L 381.32954 188.1568 L 381.32954 188.1568 L 390.51309 178.97326 L 381.13303 169.5932 C 379.95566 168.41583 379.95566 166.50692 381.13303 165.32954 L 381.13303 165.32954 C 382.3104 164.15217 384.21932 164.15217 385.3967 165.32954 C 385.3967 165.32954 385.3967 165.32954 385.3967 165.32954 Z\"/></svg>"
},
"$:/core/images/close-button": {
"title": "$:/core/images/close-button",
"text": "<svg class=\"tw-image-close-button\" viewBox=\"222 150 56 56\" width=\"22pt\" height=\"22pt\"><path d=\"M 249.56668 185.88827 L 267.06757 203.38916 C 269.26427 205.58586 272.82582 205.58586 275.02252 203.38916 L 275.02252 203.38916 C 277.21922 201.19246 277.21922 197.63091 275.02252 195.43421 L 257.52163 177.93332 L 275.38916 160.06579 C 277.58586 157.86909 277.58586 154.30754 275.38916 152.11084 C 273.19246 149.91414 269.63091 149.91414 267.43421 152.11084 L 249.56668 169.97837 L 232.06579 152.47748 L 232.06579 152.47748 C 232.06579 152.47748 232.06579 152.47748 232.06579 152.47748 C 229.86909 150.28078 226.30754 150.28078 224.11084 152.47748 L 224.11084 152.47748 C 221.91414 154.674175 221.91414 158.23573 224.11084 160.43243 L 241.61173 177.93332 L 224.47748 195.06757 L 224.47748 195.06757 L 224.47748 195.06757 C 224.47748 195.06757 224.47748 195.06757 224.47748 195.06757 C 222.28078 197.26427 222.28078 200.82583 224.47748 203.02252 L 224.47748 203.02252 C 226.67418 205.21922 230.23573 205.21922 232.43243 203.02252 Z\"/></svg>\n"
},
"$:/core/images/delete-button": {
"title": "$:/core/images/delete-button",
"text": "<svg class=\"tw-image-delete-button\" viewBox=\"303 155 39 50\" width=\"17pt\" height=\"22pt\"><path d=\"M 333 164.25 L 333 157.25 C 333 156.14543 332.10457 155.25 331 155.25 L 314.75 155.25 C 314.75 155.25 314.75 155.25 314.75 155.25 C 313.64543 155.25 312.75 156.14543 312.75 157.25 L 312.75 164.25 L 303.75 164.25 L 303.75 168.75 L 306 168.75 L 306 201.75 L 306 201.75 L 306 201.75 C 306 203.40685 307.34315 204.75 309 204.75 L 336.75 204.75 C 338.40685 204.75 339.75 203.40685 339.75 201.75 L 339.75 168.75 L 342 168.75 L 342 164.25 Z M 317.25 160.75 L 317.25 160.75 C 317.25 160.19772 317.69772 159.75 318.25 159.75 C 318.25 159.75 318.25 159.75 318.25 159.75 L 327.5 159.75 C 328.05228 159.75 328.5 160.19772 328.5 160.75 L 328.5 164.25 L 317.25 164.25 L 317.25 160.75 Z M 310.5 168.75 L 312.75 168.75 L 312.75 200.25 L 310.5 200.25 Z M 317.25 168.75 L 319.5 168.75 L 319.5 200.25 L 317.25 200.25 Z M 324 168.75 L 326.25 168.75 L 326.25 200.25 L 324 200.25 Z M 330.75 168.75 L 333 168.75 L 333 200.25 L 330.75 200.25 Z\"/></svg>\n"
},
"$:/core/images/done-button": {
"title": "$:/core/images/done-button",
"text": "<svg class=\"tw-image-done-button\" viewBox=\"434 150 68 55\" width=\"22pt\" height=\"18pt\"><path d=\"M 438.49266 178.00797 L 439.00744 177.49319 C 441.35054 175.15008 445.14946 175.15004 447.49262 177.49309 L 452.50734 182.50757 C 454.8505 184.85063 458.6494 184.85058 460.99252 182.50748 L 488.50747 154.99255 C 490.85058 152.64944 494.6495 152.6494 496.99266 154.99246 L 497.50722 155.506995 C 499.8504 157.85009 499.8505 161.64908 497.5074 163.99228 C 497.50738 163.99229 497.50736 163.99231 497.50734 163.99233 L 460.9926 200.5077 C 458.64947 202.85087 454.85048 202.8509 452.50732 200.50778 C 452.5073 200.50777 452.5073 200.50777 452.5073 200.50776 L 438.49268 186.49327 C 436.14952 184.15013 436.1495 180.35114 438.49264 178.00799 C 438.49265 178.00798 438.49265 178.00797 438.49266 178.00797 Z\"/></svg>\n"
},
"$:/core/images/down-arrow": {
"title": "$:/core/images/down-arrow",
"text": "<svg class=\"tw-image-down-arrow\" viewBox=\"441 306 59 45\" width=\"24pt\" height=\"22pt\"><path d=\"M 441 306 L 470.25 351 L 499.5 306 Z\"/></svg>\n"
},
"$:/core/images/edit-button": {
"title": "$:/core/images/edit-button",
"text": "<svg class=\"tw-image-edit-button\" viewBox=\"244 193 20 22\" width=\"20pt\" height=\"22pt\"><path d=\"M 257.33334 196.80951 L 245.90476 207.2857 L 244 212.0476 L 248.7619 210.14284 L 260.19048 199.66665 Z M 259.2381 194.90475 L 258.28566 195.85716 L 261.14284 198.71428 L 262.09522 197.76187 Z M 261.14286 193 L 260.19042 193.95241 L 263.04762 196.80953 L 264 195.85714 Z M 244 213.72882 C 244 213.72882 247.4281 215.43353 250.8572 213.7288 C 254.28599 212.02405 261.14284 214.86531 261.14284 214.86531 L 261.14284 213.72884 C 261.14284 213.72884 254.28577 210.88755 250.8572 212.5923 C 247.42858 214.29712 244 212.59228 244 212.59228 Z\"/></svg>\n"
},
"$:/core/images/info-button": {
"title": "$:/core/images/info-button",
"text": "<svg class=\"tw-image-info-button\" viewBox=\"294 150 58 58\" width=\"22pt\" height=\"22pt\"><path d=\"M 342.76236 158.98764 C 331.77887 148.0041 313.97113 148.0041 302.98764 158.98764 C 292.0041 169.97113 292.0041 187.77887 302.98764 198.76236 C 313.97113 209.7459 331.77887 209.7459 342.76236 198.76236 C 353.7459 187.77887 353.7459 169.97113 342.76236 158.98764 M 326.5425 157.5 L 326.5425 157.5 C 327.72545 157.5 328.72201 157.91022 329.5337 158.73088 C 330.34465 159.55157 330.75 160.54402 330.75 161.7075 C 330.75 162.87172 330.33979 163.86316 329.51911 164.68385 C 328.69842 165.5045 327.70674 165.91501 326.5425 165.91501 C 325.39801 165.91501 324.4153 165.5045 323.5946 164.68385 C 322.77393 163.86316 322.36372 162.87172 322.36372 161.7075 C 322.36372 160.54402 322.76906 159.55157 323.58 158.73088 C 324.39171 157.91022 325.3793 157.5 326.5425 157.5 Z M 327.80211 190.47259 C 324.91945 195.49132 321.85778 198 318.61462 198 C 317.37452 198 316.38691 197.65158 315.65186 196.9555 C 314.9176 196.25866 314.54943 195.37617 314.54943 194.30782 C 314.54943 193.60202 314.71223 192.70572 315.03629 191.61813 L 319.0151 177.93651 C 319.39685 176.61922 319.58735 175.62754 319.58735 174.95991 C 319.58735 174.53996 319.40582 174.16692 319.04356 173.84286 C 318.68052 173.51905 318.18469 173.35701 317.55527 173.35701 C 317.26861 173.35701 316.92506 173.36677 316.5246 173.38548 L 316.89661 172.2407 L 326.59967 170.66627 L 328.31744 170.66627 L 322.44986 191.01638 C 322.12503 192.18064 321.963 192.94337 321.963 193.30666 C 321.963 193.51588 322.04862 193.71121 322.2204 193.89273 C 322.39218 194.07425 322.5737 194.16554 322.7642 194.16477 C 323.08903 194.16554 323.4131 194.02221 323.73792 193.73559 C 324.59605 193.02976 325.6267 191.75142 326.82838 189.90008 Z\"/></svg>\n"
},
"$:/core/images/new-button": {
"title": "$:/core/images/new-button",
"text": "<svg class=\"tw-image-new-button\" viewBox=\"83 81 50 50\" width=\"22pt\" height=\"22pt\"><path d=\"M 101.25 112.5 L 101.25 127.5 C 101.25 127.5 101.25 127.5 101.25 127.5 L 101.25 127.5 C 101.25 129.156855 102.593146 130.5 104.25 130.5 L 111.75 130.5 C 113.406854 130.5 114.75 129.156854 114.75 127.5 L 114.75 112.5 L 129.75 112.5 C 131.406854 112.5 132.75 111.156854 132.75 109.5 L 132.75 102 C 132.75 100.343146 131.406854 99 129.75 99 L 114.75 99 L 114.75 84 C 114.75 82.343146 113.406854 81 111.75 81 L 104.25 81 C 104.25 81 104.25 81 104.25 81 C 102.593146 81 101.25 82.343146 101.25 84 L 101.25 99 L 86.25 99 C 86.25 99 86.25 99 86.25 99 C 84.593146 99 83.25 100.343146 83.25 102 L 83.25 109.5 C 83.25 109.5 83.25 109.5 83.25 109.5 L 83.25 109.5 C 83.25 111.156855 84.593146 112.5 86.25 112.5 Z\"/></svg>\n"
},
"$:/core/images/options-button": {
"title": "$:/core/images/options-button",
"text": "<svg class=\"tw-image-options-button\" viewBox=\"434 218 68 68\" width=\"22pt\" height=\"22pt\"><path d=\"M 478.39696 232.53705 L 478.39696 232.53705 C 477.11453 231.85132 475.77877 231.30146 474.4106 230.88735 L 474.4106 218.24993 L 461.58944 218.24993 L 461.58944 230.88735 C 460.22126 231.30146 458.8855 231.85132 457.60308 232.53705 L 448.66825 223.60214 L 439.6022 232.66814 L 448.53716 241.60304 C 447.8515 242.88541 447.30158 244.22116 446.88747 245.58935 L 434.25 245.58935 L 434.25 258.41052 L 446.88747 258.41052 C 447.30158 259.7787 447.8515 261.11446 448.53716 262.39689 L 439.6022 271.33173 L 448.66825 280.39779 L 457.60308 271.46281 C 458.8855 272.14862 460.22126 272.69847 461.58944 273.11251 L 461.58944 285.74986 L 474.4106 285.74986 L 474.4106 273.11251 C 475.77877 272.69847 477.11453 272.14862 478.39696 271.46281 L 487.3318 280.39779 L 496.3977 271.33173 L 487.46287 262.39689 C 488.14854 261.11446 488.6984 259.7787 489.11257 258.41052 L 501.7499 258.41052 L 501.7499 245.58935 L 489.11257 245.58935 C 488.6984 244.22116 488.14854 242.88541 487.46287 241.60304 L 496.3977 232.66814 L 487.3318 223.60214 Z M 475.3328 244.66714 C 479.38253 248.71698 479.38253 255.2829 475.3328 259.33273 C 471.28297 263.3826 464.71706 263.3826 460.66723 259.33273 C 456.61737 255.2829 456.61737 248.71698 460.66723 244.66714 C 464.71706 240.61734 471.28297 240.61734 475.3328 244.66714\"/></svg>\n"
},
"$:/core/images/save-button": {
"title": "$:/core/images/save-button",
"text": "<svg class=\"tw-image-save-button\" viewBox=\"4 512 64 60\" width=\"22pt\" height=\"21pt\"><path d=\"M 13.5 537.75 L 11.5 537.75 C 11.5 537.75 11.5 537.75 11.5 537.75 C 7.6340064 537.75 4.4999994 540.884 4.5 544.75 L 4.5 564.5 L 4.5 564.5 C 4.5 564.5 4.5 564.5 4.5 564.5 L 4.5 564.5 C 4.5000006 568.366 7.634007 571.5 11.5 571.5 L 60.5 571.5 C 64.365993 571.5 67.5 568.366 67.5 564.5 L 67.5 544.75 C 67.5 540.884 64.365993 537.75 60.5 537.75 L 58.5 537.75 L 49.5 546.75 L 50 546.75 C 52.20914 546.75 54 548.54086 54 550.75 L 54 556.25 C 54 558.45914 52.20914 560.25 50 560.25 L 36 560.25 L 22 560.25 C 19.790861 560.25 18 558.45914 18 556.25 L 18 556.25 C 18 556.25 18 556.25 18 556.25 L 18 550.75 C 18 548.54086 19.790861 546.75 22 546.75 C 22 546.75 22 546.75 22 546.75 L 22.5 546.75 Z\"/><path d=\"M 16.37132 533.87132 L 33.87868 551.37868 C 35.050253 552.55025 36.949747 552.55025 38.12132 551.37868 L 55.62868 533.87132 C 56.800252 532.69975 56.800252 530.80025 55.62868 529.62868 C 55.06607 529.06607 54.30301 528.75 53.50736 528.75 L 48 528.75 C 46.343146 528.75 45 527.40685 45 525.75 L 45 516 C 45 514.34315 43.656854 513 42 513 L 30 513 C 28.343146 513 27 514.34315 27 516 L 27 525.75 C 27 527.40685 25.656854 528.75 24 528.75 L 18.492641 528.75 C 16.835786 528.75 15.492641 530.09315 15.492641 531.75 C 15.492641 532.54565 15.808711 533.3087 16.37132 533.87132 Z\"/></svg>\n"
},
"$:/messages/Download": {
"title": "$:/messages/Download",
"type": "text/vnd.tiddlywiki",
"subtitle": "Download changes",
"footer": "<$button message=\"tw-close-tiddler\" class=\"btn btn-primary\">Close</$button>",
"help": "http://five.tiddlywiki.com/static/DownloadingChanges.html",
"text": "Your browser only supports manual saving.\n\nTo save your modified wiki, right click on the download link below and select \"Download file\" or \"Save file\", and then choose the folder and filename.\n\n//You can marginally speed things up by clicking the link with the control key (Windows) or the options/alt key (Mac OS X). You will not be prompted for the folder or filename, but your browser is likely to give it an unrecognisable name -- you may need to rename the file to include an `.html` extension before you can do anything useful with it.//\n\nOn smartphones that do not allow files to be downloaded you can instead bookmark the link, and then sync your bookmarks to a desktop computer from where the wiki can be saved normally.\n"
},
"$:/messages/EnterEditMode": {
"title": "$:/messages/EnterEditMode",
"type": "text/vnd.tiddlywiki",
"subtitle": "Editing this wiki",
"footer": "<<button close class:\"btn btn-primary\"><Close>>",
"help": "http://five.tiddlywiki.com/static/EditMode",
"text": "You can edit this wiki and save your changes. You are strongly advised to verify that saving is working properly before trusting ~TiddlyWiki with your data.\n\nThe following methods of saving changes are available:\n\n* Using Firefox's built-in file system access\n* Uploading to a simple server script\n* Using HTML5's data URI and download attribute\n\n\n[x] Don't show this message again"
},
"$:/messages/GettingStarted": {
"title": "$:/messages/GettingStarted",
"type": "text/vnd.tiddlywiki",
"subtitle": "Welcome to ~TiddlyWiki",
"footer": "<$button message=\"tw-close-tiddler\" class=\"btn btn-primary\">Close</$button>",
"help": "http://five.tiddlywiki.com/static/GettingStarted",
"text": "This ~TiddlyWiki is empty. \n\nYou can create and edit tiddlers, but before you use ~TiddlyWiki in earnest it is strongly advised that you verify that you can save and retrieve your changes.\n\n~TiddlyWiki5 is currently a preliminary alpha release. Visit http://five.tiddlywiki.com/ for the latest information on how to use it.\n"
},
"$:/messages/SaveInstructions": {
"title": "$:/messages/SaveInstructions",
"type": "text/vnd.tiddlywiki",
"subtitle": "Save your work",
"footer": "<$button message=\"tw-close-tiddler\" class=\"btn btn-primary\">Close</$button>",
"help": "http://five.tiddlywiki.com/static/SavingChanges",
"text": "Your changes to this wiki need to be saved as a ~TiddlyWiki HTML file.\n\n!!! Desktop browsers\n\n# Select ''Save As'' from the ''File'' menu\n# Choose a filename and location\n#* Some browsers also require you to explicitly specify the file saving format as ''Webpage, HTML only'' or similar\n# Close this tab\n\n!!! Smartphone browsers\n\n# Create a bookmark to this page\n#* If you've got iCloud or Google Sync set up then the bookmark will automatically sync to your desktop where you can open it and save it as above\n# Close this tab\n\n//If you open the bookmark again in Mobile Safari you will see this message again. If you want to go ahead and use the file, just click the ''close'' button below//\n"
},
"$:/messages/Saved": {
"title": "$:/messages/Saved",
"text": "Saved wiki\n"
},
"$:/core/modules/commander.js": {
"text": "/*\\\ntitle: $:/core/modules/commander.js\ntype: application/javascript\nmodule-type: global\n\nThe $tw.Commander class is a command interpreter\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParse a sequence of commands\n\tcommandTokens: an array of command string tokens\n\twiki: reference to the wiki store object\n\tstreams: {output:, error:}, each of which has a write(string) method\n\tcallback: a callback invoked as callback(err) where err is null if there was no error\n*/\nvar Commander = function(commandTokens,callback,wiki,streams) {\n\tthis.commandTokens = commandTokens;\n\tthis.nextToken = 0;\n\tthis.callback = callback;\n\tthis.wiki = wiki;\n\tthis.streams = streams;\n};\n\n/*\nExecute the sequence of commands and invoke a callback on completion\n*/\nCommander.prototype.execute = function() {\n\tthis.executeNextCommand();\n};\n\n/*\nExecute the next command in the sequence\n*/\nCommander.prototype.executeNextCommand = function() {\n\tvar self = this;\n\t// Invoke the callback if there are no more commands\n\tif(this.nextToken >= this.commandTokens.length) {\n\t\tthis.callback(null);\n\t} else {\n\t\t// Get and check the command token\n\t\tvar commandName = this.commandTokens[this.nextToken++];\n\t\tif(commandName.substr(0,2) !== \"--\") {\n\t\t\tthis.callback(\"Missing command\");\n\t\t} else {\n\t\t\tcommandName = commandName.substr(2); // Trim off the --\n\t\t\t// Accumulate the parameters to the command\n\t\t\tvar params = [];\n\t\t\twhile(this.nextToken < this.commandTokens.length && \n\t\t\t\tthis.commandTokens[this.nextToken].substr(0,2) !== \"--\") {\n\t\t\t\tparams.push(this.commandTokens[this.nextToken++]);\n\t\t\t}\n\t\t\t// Get the command info\n\t\t\tvar command = $tw.commands[commandName],\n\t\t\t\tc,err;\n\t\t\tif(!command) {\n\t\t\t\tthis.callback(\"Unknown command: \" + commandName);\n\t\t\t} else {\n\t\t\t\tif(this.verbose) {\n\t\t\t\t\tthis.streams.output.write(\"Executing command: \" + commandName + \" \" + params.join(\" \") + \"\\n\");\n\t\t\t\t}\n\t\t\t\tif(command.info.synchronous) {\n\t\t\t\t\t// Synchronous command\n\t\t\t\t\tc = new command.Command(params,this);\n\t\t\t\t\terr = c.execute();\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\tthis.callback(err);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.executeNextCommand();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Asynchronous command\n\t\t\t\t\tc = new command.Command(params,this,function(err) {\n\t\t\t\t\t\tif(err) {\n\t\t\t\t\t\t\tself.callback(err);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tself.executeNextCommand();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\terr = c.execute();\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\tthis.callback(err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nCommander.initCommands = function(moduleType) {\n\tmoduleType = moduleType || \"command\";\n\t$tw.commands = {};\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tvar c = $tw.commands[module.info.name] = {};\n\t\t// Add the methods defined by the module\n\t\tfor(var f in module) {\n\t\t\tif($tw.utils.hop(module,f)) {\n\t\t\t\tc[f] = module[f];\n\t\t\t}\n\t\t}\n\t});\n};\n\nexports.Commander = Commander;\n\n})();\n",
"title": "$:/core/modules/commander.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/commands/dump.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/dump.js\ntype: application/javascript\nmodule-type: command\n\nDump command for inspecting TiddlyWiki internals\n\n\\*/\n(function(){\n\n/*jshint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"dump\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.output = commander.streams.output;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Too few parameters for dump command\";\n\t}\n\tvar subcommand = this.subcommands[this.params[0]];\n\tif(subcommand) {\n\t\treturn subcommand.call(this);\n\t} else {\n\t\treturn \"Unknown subcommand (\" + this.params[0] + \") for dump command\";\n\t}\n};\n\nCommand.prototype.subcommands = {};\n\nCommand.prototype.subcommands.tiddler = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Too few parameters for dump tiddler command\";\n\t}\n\tvar tiddler = this.commander.wiki.getTiddler(this.params[1]);\n\tif(!tiddler) {\n\t\treturn \"No such tiddler as '\" + this.params[1] + \"'\";\n\t}\n\tthis.output.write(\"Tiddler '\" + this.params[1] + \"' contains these fields:\\n\");\n\tfor(var t in tiddler.fields) {\n\t\tthis.output.write(\" \" + t + \": \" + tiddler.getFieldString(t) + \"\\n\");\n\t}\n\treturn null; // No error\n};\n\nCommand.prototype.subcommands.tiddlers = function() {\n\tvar tiddlers = this.commander.wiki.getTiddlers();\n\tthis.output.write(\"Wiki contains these tiddlers:\\n\");\n\tfor(var t=0; t<tiddlers.length; t++) {\n\t\tthis.output.write(tiddlers[t] + \"\\n\");\n\t}\n\treturn null; // No error\n};\n\nCommand.prototype.subcommands.system = function() {\n\tvar tiddlers = this.commander.wiki.getSystemTitles();\n\tthis.output.write(\"Wiki contains these system tiddlers:\\n\");\n\tfor(var t=0; t<tiddlers.length; t++) {\n\t\tthis.output.write(tiddlers[t] + \"\\n\");\n\t}\n\treturn null; // No error\n};\n\nCommand.prototype.subcommands.config = function() {\n\tvar self = this;\n\tvar quotePropertyName = function(p) {\n\t\t\tvar unquotedPattern = /^[A-Za-z0-9_]*$/mg;\n\t\t\tif(unquotedPattern.test(p)) {\n\t\t\t\treturn p;\n\t\t\t} else {\n\t\t\t\treturn \"[\\\"\" + $tw.utils.stringify(p) + \"\\\"]\";\n\t\t\t}\n\t\t},\n\t\tdumpConfig = function(object,prefix) {\n\t\t\tfor(var n in object) {\n\t\t\t\tvar v = object[n];\n\t\t\t\tif(typeof v === \"object\") {\n\t\t\t\t\tdumpConfig(v,prefix + \".\" + quotePropertyName(n));\n\t\t\t\t} else if(typeof v === \"string\") {\n\t\t\t\t\tself.output.write(prefix + \".\" + quotePropertyName(n) + \": \\\"\" + $tw.utils.stringify(v) + \"\\\"\\n\");\n\t\t\t\t} else {\n\t\t\t\t\tself.output.write(prefix + \".\" + quotePropertyName(n) + \": \" + v.toString() + \"\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdumpObject = function(heading,object) {\n\t\t\tself.output.write(heading +\"\\n\");\n\t\t\tfor(var n in object) {\n\t\t\t\tself.output.write(\" \" + n + \"\\n\");\n\t\t\t}\n\t\t};\n\tthis.output.write(\"Configuration:\\n\");\n\tdumpConfig($tw.config,\" $tw.config\");\n\tdumpObject(\"Tiddler field modules:\",$tw.Tiddler.fieldModules);\n\tdumpObject(\"Loaded modules:\",$tw.modules.titles);\n\tdumpObject(\"Command modules:\",$tw.commands);\n\tdumpObject(\"Parser modules:\",$tw.wiki.parsers);\n\tdumpObject(\"Macro modules:\",$tw.wiki.macros);\n\tdumpObject(\"Deserializer modules:\",$tw.Wiki.tiddlerDeserializerModules);\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/dump.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/load.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/load.js\ntype: application/javascript\nmodule-type: command\n\nCommand to load tiddlers from a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"load\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filename\";\n\t}\n\tfs.readFile(this.params[0],\"utf8\",function(err,data) {\n\t\tif(err) {\n\t\t\tself.callback(err);\n\t\t} else {\n\t\t\tvar fields = {title: self.params[0]},\n\t\t\t\ttype = path.extname(self.params[0]);\n\t\t\tvar tiddlers = self.commander.wiki.deserializeTiddlers(type,data,fields);\n\t\t\tif(!tiddlers) {\n\t\t\t\tself.callback(\"No tiddlers found in file \\\"\" + self.params[0] + \"\\\"\");\n\t\t\t} else {\n\t\t\t\tfor(var t=0; t<tiddlers.length; t++) {\n\t\t\t\t\tself.commander.wiki.addTiddler(new $tw.Tiddler(tiddlers[t]));\n\t\t\t\t}\n\t\t\t\tself.callback(null);\t\n\t\t\t}\n\t\t}\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/load.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/password.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/password.js\ntype: application/javascript\nmodule-type: command\n\nSave password for crypto operations\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"password\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing password\";\n\t}\n\t$tw.crypto.setPassword(this.params[0]);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/password.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savetiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/savetiddler.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save a tiddler to a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savetiddler\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\ttitle = this.params[0],\n\t\tfilename = this.params[1],\n\t\ttype = this.params[2] || \"text/html\";\n\tfs.writeFile(filename,this.commander.wiki.renderTiddler(type,title),\"utf8\",function(err) {\n\t\tself.callback(err);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/savetiddler.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savetiddlers.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/savetiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save several tiddlers to a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savetiddlers\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\ttemplate = this.params[1],\n\t\tpathname = this.params[2],\n\t\ttype = this.params[3] || \"text/html\",\n\t\textension = this.params[4] || \".html\",\n\t\tparser = wiki.parseTiddler(template),\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar renderTree = new $tw.WikiRenderTree(parser,{wiki: wiki, context: {tiddlerTitle: title}, document: $tw.document});\n\t\trenderTree.execute();\n\t\tvar container = $tw.document.createElement(\"div\");\n\t\trenderTree.renderInDom(container);\n\t\tvar text = type === \"text/html\" ? container.innerHTML : container.textContent;\n\t\tfs.writeFileSync(path.resolve(pathname,encodeURIComponent(title) + extension),text,\"utf8\");\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/savetiddlers.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/server.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/server.js\ntype: application/javascript\nmodule-type: command\n\nServe tiddlers over http\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nif(!$tw.browser) {\n\tvar util = require(\"util\"),\n\t\tfs = require(\"fs\"),\n\t\turl = require(\"url\"),\n\t\tpath = require(\"path\"),\n\t\thttp = require(\"http\");\t\n}\n\nexports.info = {\n\tname: \"server\",\n\tsynchronous: true\n};\n\n/*\nA simple HTTP server with regexp-based routes\n*/\nfunction SimpleServer(options) {\n\tthis.routes = options.routes || [];\n\tthis.wiki = options.wiki;\n\tthis.variables = options.variables || {};\n}\n\nSimpleServer.prototype.set = function(obj) {\n\tvar self = this;\n\t$tw.utils.each(obj,function(value,name) {\n\t\tself.variables[name] = value;\n\t});\n};\n\nSimpleServer.prototype.get = function(name) {\n\treturn this.variables[name];\n};\n\nSimpleServer.prototype.addRoute = function(route) {\n\tthis.routes.push(route);\n};\n\nSimpleServer.prototype.listen = function(port) {\n\tvar self = this;\n\thttp.createServer(function(request, response) {\n\t\t// Compose the state object\n\t\tvar state = {};\n\t\tstate.wiki = self.wiki;\n\t\tstate.server = self;\n\t\tstate.urlInfo = url.parse(request.url);\n\t\t// Find the route that matches this path\n\t\tvar route;\n\t\tfor(var t=0; t<self.routes.length; t++) {\n\t\t\tvar potentialRoute = self.routes[t],\n\t\t\t\tpathRegExp = potentialRoute.path,\n\t\t\t\tmatch = potentialRoute.path.exec(state.urlInfo.pathname);\n\t\t\tif(request.method === potentialRoute.method && match) {\n\t\t\t\tstate.params = [];\n\t\t\t\tfor(var p=1; p<match.length; p++) {\n\t\t\t\t\tstate.params.push(match[p]);\n\t\t\t\t}\n\t\t\t\troute = potentialRoute;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Return a 404 if we didn't find a route\n\t\tif(!route) {\n\t\t\tresponse.writeHead(404);\n\t\t\tresponse.end();\n\t\t\treturn;\n\t\t}\n\t\t// Dispatch the appropriate method\n\t\tswitch(request.method) {\n\t\t\tcase \"GET\": // Intentional fall-through\n\t\t\tcase \"DELETE\":\n\t\t\t\troute.handler(request,response,state);\n\t\t\t\tbreak;\n\t\t\tcase \"PUT\":\n\t\t\t\tvar data = \"\";\n\t\t\t\trequest.on(\"data\",function(chunk) {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\trequest.on(\"end\",function() {\n\t\t\t\t\tstate.data = data;\n\t\t\t\t\troute.handler(request,response,state);\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\t}).listen(port);\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n\t// Set up server\n\tthis.server = new SimpleServer({\n\t\twiki: this.commander.wiki\n\t});\n\t// Add route handlers\n\tthis.server.addRoute({\n\t\tmethod: \"PUT\",\n\t\tpath: /^\\/recipes\\/default\\/tiddlers\\/(.+)$/,\n\t\thandler: function(request,response,state) {\n\t\t\tvar title = decodeURIComponent(state.params[0]),\n\t\t\t\tfields = JSON.parse(state.data);\n\t\t\t// Pull up any subfields in the `fields` object\n\t\t\tif(fields.fields) {\n\t\t\t\t$tw.utils.each(fields.fields,function(field,name) {\n\t\t\t\t\tfields[name] = field;\n\t\t\t\t});\n\t\t\t\tdelete fields.fields;\n\t\t\t}\n\t\t\t// Remove any revision field\n\t\t\tif(fields[\"revision\"]) {\n\t\t\t\tdelete fields[\"revision\"];\n\t\t\t}\n\t\t\tstate.wiki.addTiddler(new $tw.Tiddler(fields,{title: title}));\n\t\t\tvar changeCount = state.wiki.getChangeCount(title).toString();\n\t\t\tresponse.writeHead(204, \"OK\",{\n\t\t\t\tEtag: \"\\\"default/\" + title + \"/\" + changeCount + \":\\\"\"\n\t\t\t});\n\t\t\tresponse.end();\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"DELETE\",\n\t\tpath: /^\\/bags\\/default\\/tiddlers\\/(.+)$/,\n\t\thandler: function(request,response,state) {\n\t\t\tvar title = decodeURIComponent(state.params[0]);\n\t\t\tstate.wiki.deleteTiddler(title);\n\t\t\tresponse.writeHead(204, \"OK\");\n\t\t\tresponse.end();\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": state.server.get(\"serveType\")});\n\t\t\tvar text = state.wiki.renderTiddler(state.server.get(\"renderType\"),state.server.get(\"rootTiddler\"));\n\t\t\tresponse.end(text,\"utf8\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/status$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\t\t\tvar text = JSON.stringify({\n\t\t\t\tusername: \"ANONYMOUS\",\n\t\t\t\tspace: {\n\t\t\t\t\trecipe: \"default\"\n\t\t\t\t},\n\t\t\t\ttiddlywiki_version: $tw.version\n\t\t\t});\n\t\t\tresponse.end(text,\"utf8\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/recipes\\/default\\/tiddlers.json$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\t\t\tvar tiddlers = [];\n\t\t\tstate.wiki.forEachTiddler(\"title\",function(title,tiddler) {\n\t\t\t\tvar tiddlerFields = {};\n\t\t\t\t$tw.utils.each(tiddler.fields,function(field,name) {\n\t\t\t\t\tif(name !== \"text\") {\n\t\t\t\t\t\ttiddlerFields[name] = tiddler.getFieldString(name);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttiddlerFields[\"revision\"] = state.wiki.getChangeCount(title);\n\t\t\t\ttiddlers.push(tiddlerFields);\n\t\t\t});\n\t\t\tvar text = JSON.stringify(tiddlers);\n\t\t\tresponse.end(text,\"utf8\");\n\t\t}\n\t});\n\tthis.server.addRoute({\n\t\tmethod: \"GET\",\n\t\tpath: /^\\/recipes\\/default\\/tiddlers\\/(.+)$/,\n\t\thandler: function(request,response,state) {\n\t\t\tvar title = decodeURIComponent(state.params[0]),\n\t\t\t\ttiddler = state.wiki.getTiddler(title),\n\t\t\t\ttiddlerFields = {},\n\t\t\t\tknownFields = [\n\t\t\t\t\t\"bag\", \"created\", \"creator\", \"modified\", \"modifier\", \"permissions\", \"recipe\", \"revision\", \"tags\", \"text\", \"title\", \"type\", \"uri\"\n\t\t\t\t];\n\t\t\tif(tiddler) {\n\t\t\t\t$tw.utils.each(tiddler.fields,function(field,name) {\n\t\t\t\t\tvar value = tiddler.getFieldString(name);\n\t\t\t\t\tif(knownFields.indexOf(name) !== -1) {\n\t\t\t\t\t\ttiddlerFields[name] = value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttiddlerFields.fields = tiddlerFields.fields || {};\n\t\t\t\t\t\ttiddlerFields.fields[name] = value;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttiddlerFields[\"revision\"] = state.wiki.getChangeCount(title);\n\t\t\t\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\t\t\t\tresponse.end(JSON.stringify(tiddlerFields),\"utf8\");\n\t\t\t} else {\n\t\t\t\tresponse.writeHead(404);\n\t\t\t\tresponse.end();\n\t\t\t}\n\t\t}\n\t});\n};\n\nCommand.prototype.execute = function() {\n\tvar port = this.params[0] || \"8080\",\n\t\trootTiddler = this.params[1] || \"$:/core/templates/tiddlywiki5.template.html\",\n\t\trenderType = this.params[2] || \"text/plain\",\n\t\tserveType = this.params[3] || \"text/html\";\n\tthis.server.set({\n\t\trootTiddler: rootTiddler,\n\t\trenderType: renderType,\n\t\tserveType: serveType\n\t});\n\tthis.server.listen(port);\n\tif(this.commander.verbose) {\n\t\tconsole.log(\"Serving on port \" + port);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/server.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/verbose.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/verbose.js\ntype: application/javascript\nmodule-type: command\n\nVerbose command\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"verbose\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tthis.commander.verbose = true;\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/verbose.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/version.js": {
"text": "/*\\\ntitle: $:/core/modules/commands/version.js\ntype: application/javascript\nmodule-type: command\n\nVersion command\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"version\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tthis.commander.streams.output.write($tw.version + \"\\n\");\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"title": "$:/core/modules/commands/version.js",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/config.js": {
"text": "/*\\\ntitle: $:/core/modules/config.js\ntype: application/javascript\nmodule-type: config\n\nCore configuration constants\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.preferences = {};\n\nexports.preferences.animationDuration = 400;\nexports.preferences.animationDurationMs = exports.preferences.animationDuration + \"ms\";\nexports.preferences.notificationDuration = 3 * 1000;\nexports.preferences.jsonSpaces = 4;\n\nexports.dateFormats = {\n\tmonths: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\",\"December\"],\n\tdays: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n\tshortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n\tshortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n// suffixes for dates, eg \"1st\",\"2nd\",\"3rd\"...\"30th\",\"31st\"\n\tdaySuffixes: [\"st\",\"nd\",\"rd\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\n\t\t\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\n\t\t\"st\",\"nd\",\"rd\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\"th\",\n\t\t\"st\"],\n\tam: \"am\",\n\tpm: \"pm\"\n};\n\nexports.htmlEntities = {quot:34, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };\n\nexports.htmlVoidElements = \"area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr\".split(\",\");\n\n\n})();\n",
"title": "$:/core/modules/config.js",
"type": "application/javascript",
"module-type": "config"
},
"$:/core/modules/deserializers.js": {
"text": "/*\\\ntitle: $:/core/modules/deserializers.js\ntype: application/javascript\nmodule-type: tiddlerdeserializer\n\nFunctions to deserialise tiddlers from a block of text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nUtility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:\n\n<div title=\"Title\" creator=\"JoeBloggs\" modifier=\"JoeBloggs\" created=\"201102111106\" modified=\"201102111310\" tags=\"myTag [[my long tag]]\">\n<pre>The text of the tiddler (without the expected HTML encoding).\n</pre>\n</div>\n\nNote that the field attributes are HTML encoded, but that the body of the <PRE> tag is not encoded.\n\nWhen these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.\n*/\nvar parseTiddlerDiv = function(text /* [,fields] */) {\n\t// Slot together the default results\n\tvar result = {};\n\tif(arguments.length > 1) {\n\t\tfor(var f=1; f<arguments.length; f++) {\n\t\t\tvar fields = arguments[f];\n\t\t\tfor(var t in fields) {\n\t\t\t\tresult[t] = fields[t];\t\t\n\t\t\t}\n\t\t}\n\t}\n\t// Parse the DIV body\n\tvar divRegExp = /^\\s*<div\\s+([^>]*)>((?:.|\\n)*)<\\/div>\\s*$/gi,\n\t\tsubDivRegExp = /^\\s*<pre>((?:.|\\n)*)<\\/pre>\\s*$/gi,\n\t\tattrRegExp = /\\s*([^=\\s]+)\\s*=\\s*\"([^\"]*)\"/gi,\n\t\tmatch = divRegExp.exec(text);\n\tif(match) {\n\t\tvar subMatch = subDivRegExp.exec(match[2]); // Body of the <DIV> tag\n\t\tif(subMatch) {\n\t\t\tresult.text = subMatch[1];\n\t\t} else {\n\t\t\tresult.text = match[2]; \n\t\t}\n\t\tvar attrMatch;\n\t\tdo {\n\t\t\tattrMatch = attrRegExp.exec(match[1]);\n\t\t\tif(attrMatch) {\n\t\t\t\tvar name = attrMatch[1];\n\t\t\t\tvar value = attrMatch[2];\n\t\t\t\tresult[name] = value;\n\t\t\t}\n\t\t} while(attrMatch);\n\t\treturn result;\n\t} else {\n\t\treturn undefined;\n\t}\n};\n\nexports[\"application/x-tiddler-html-div\"] = function(text,fields) {\n\treturn [parseTiddlerDiv(text,fields)];\n};\n\nexports[\"application/json\"] = function(text,fields) {\n\tvar tiddlers = JSON.parse(text),\n\t\tresult = [],\n\t\tgetKnownFields = function(tid) {\n\t\t\tvar fields = {};\n\t\t\t\"title text created creator modified modifier type tags\".split(\" \").forEach(function(value) {\n\t\t\t\tif(tid[value] !== null) {\n\t\t\t\t\tfields[value] = tid[value];\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn fields;\n\t\t};\n\tfor(var t=0; t<tiddlers.length; t++) {\n\t\tresult.push(getKnownFields(tiddlers[t]));\n\t}\n\treturn result;\n};\n\n/*\nParse an HTML file into tiddlers. There are three possibilities:\n# A TiddlyWiki classic HTML file containing `text/vnd.tiddlywiki2` tiddlers\n# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers\n# An ordinary HTML file\n*/\nexports[\"text/html\"] = function(text,fields) {\n\t// Check if we've got a store area\n\tvar storeAreaMarkerRegExp = /<div id=[\"']?storeArea['\"]?( style=[\"']?display:none;[\"']?)?>/gi,\n\t\tmatch = storeAreaMarkerRegExp.exec(text);\n\tif(match) {\n\t\t// If so, it's either a classic TiddlyWiki file or a TW5 file\n\t\treturn deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);\n\t} else {\n\t\t// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler\n\t\treturn deserializeHtmlFile(text,fields);\n\t}\n};\n\nfunction deserializeHtmlFile(text,fields) {\n\tvar result = {};\n\t$tw.utils.each(fields,function(value,name) {\n\t\tresult[name] = value;\n\t});\n\tresult.text = text;\n\tresult.type = \"text/html\";\n\treturn [result];\n}\n\nfunction deserializeTiddlyWikiFile(text,storeAreaEnd,isTiddlyWiki5,fields) {\n\tvar results = [],\n\t\tendOfDivRegExp = /(<\\/div>\\s*)/gi,\n\t\tstartPos = storeAreaEnd,\n\t\tdefaultType = isTiddlyWiki5 ? \"text/vnd.tiddlywiki\": \"text/vnd.tiddlywiki2\";\n\tendOfDivRegExp.lastIndex = startPos;\n\tvar match = endOfDivRegExp.exec(text);\n\twhile(match) {\n\t\tvar endPos = endOfDivRegExp.lastIndex,\n\t\t\ttiddlerFields = parseTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});\n\t\tif(!tiddlerFields) {\n\t\t\tbreak;\n\t\t}\n\t\tif(tiddlerFields.text !== null) {\n\t\t\ttiddlerFields.text = $tw.utils.htmlDecode(tiddlerFields.text);\n\t\t\tresults.push(tiddlerFields);\n\t\t}\n\t\tstartPos = endPos;\n\t\tmatch = endOfDivRegExp.exec(text);\n\t}\n\treturn results;\n}\n\n})();\n",
"title": "$:/core/modules/deserializers.js",
"type": "application/javascript",
"module-type": "tiddlerdeserializer"
},
"$:/core/modules/filters/backlinks.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/backlinks.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning all the backlinks from a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.backlinks = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/backlinks.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/each.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/each.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects one tiddler for each unique value of the specified field\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.each = function(source,operator,options) {\n\t// Convert the source to an array if necessary\n\tif(!$tw.utils.isArray(source)) {\n\t\tvar copy = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcopy.push(title);\n\t\t});\n\t\tsource = copy;\n\t}\n\t// Collect up the first tiddler with each unique value of the specified field\n\tvar results = [],values = {};\n\t$tw.utils.each(source,function(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar value = tiddler.getFieldString(operator.operand);\n\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\tvalues[value] = true;\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/each.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/eachday.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/eachday.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects one tiddler for each unique day covered by the specified date field\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.eachday = function(source,operator,options) {\n\t// Convert the source to an array if necessary\n\tif(!$tw.utils.isArray(source)) {\n\t\tvar copy = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcopy.push(title);\n\t\t});\n\t\tsource = copy;\n\t}\n\t// Collect up the first tiddler with each unique day value of the specified field\n\tvar results = [],values = {};\n\t$tw.utils.each(source,function(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar value = tiddler.getFieldString(operator.operand).substr(0,8);\n\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\tvalues[value] = true;\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/eachday.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/field.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/field.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for comparing fields for equality\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.field = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.getFieldString(operator.operator) === operator.operand;\n\t\t\tif(operator.prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/field.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/has.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/has.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a tiddler has the specified field\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.has = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = $tw.utils.hop(tiddler.fields,operator.operand);\n\t\t\tif(operator.prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/has.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/is/current.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/current.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[current]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.current = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tif(title !== options.currTiddlerTitle) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\tif(prefix === \"!\") {\n\t\t\t$tw.utils.each(source,function(title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t} else {\n\t\t\tif(source.indexOf(options.currTiddlerTitle) !== -1) {\n\t\t\t\tresults.push(options.currTiddlerTitle);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(prefix === \"!\") {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t} else {\n\t\t\tresults.push(options.currTiddlerTitle);\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/current.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/missing.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/missing.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[missing]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.missing = function(source,prefix,options) {\n\tvar results = [],\n\t\tmissingTitles;\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\tmissingTitles = options.wiki.getMissingTitles();\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tvar match = missingTitles.indexOf(title) !== -1;\n\t\t\tif(prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tif(prefix !== \"!\") {\n\t\t\tmissingTitles = options.wiki.getMissingTitles();\n\t\t\t$tw.utils.each(missingTitles,function(title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/missing.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/orphan.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/orphan.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[orphan]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.orphan = function(source,prefix,options) {\n\tvar results = [],\n\t\torphanTitles = options.wiki.getOrphanTitles();\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tvar match = orphanTitles.indexOf(title) !== -1;\n\t\t\tif(prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tvar match = orphanTitles.indexOf(title) !== -1;\n\t\t\tif(prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/orphan.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/shadow.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/shadow.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[shadow]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadow = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tvar match = options.wiki.isShadowTiddler(title);\n\t\tif(prefix === \"!\") {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\tif(prefix !== \"!\") {\n\t\t\t$tw.utils.each(options.wiki.shadowTiddlers,function(tiddler,title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/shadow.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/system.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is/system.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[system]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.system = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tvar match = options.wiki.isSystemTiddler(title);\n\t\tif(prefix === \"!\") {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t};\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/is/system.js",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/is.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking tiddler properties\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar isFilterOperators;\n\nfunction getIsFilterOperators() {\n\tif(!isFilterOperators) {\n\t\tisFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"isfilteroperator\",isFilterOperators);\n\t}\n\treturn isFilterOperators;\n};\n\n/*\nExport our filter function\n*/\nexports.is = function(source,operator,options) {\n\t// Dispatch to the correct isfilteroperator\n\tvar isFilterOperators = getIsFilterOperators();\n\tvar isFilterOperator = isFilterOperators[operator.operand];\n\tif(isFilterOperator) {\n\t\treturn isFilterOperator(source,operator.prefix,options);\n\t} else {\n\t\treturn [\"Filter Error: Unknown operand for the 'is' filter operator\"];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/filters/is.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/limit.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/limit.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for chopping the results to a specified maximum number of entries\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.limit = function(source,operator,options) {\n\tvar results = [];\n\t// Convert to an array if necessary\n\tif(!$tw.utils.isArray(source)) {\n\t\tvar copy = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcopy.push(title);\n\t\t});\n\t\tsource = copy;\n\t}\n\t// Slice the array if necessary\n\tvar limit = Math.min(source.length,parseInt(operator.operand,10));\n\tif(operator.prefix === \"!\") {\n\t\tresults = source.slice(source.length - limit,limit);\n\t} else {\n\t\tresults = source.slice(0,limit);\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/limit.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/links.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/links.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning all the links from a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.links = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerLinks(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/links.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/list.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/list.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddlers whose title is listed in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.list = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\tfunction checkTiddler(title) {\n\t\tvar match = list.indexOf(title) !== -1;\n\t\tif(operator.prefix === \"!\") {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\tif(operator.prefix !== \"!\") {\n\t\t\tresults = list;\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tcheckTiddler(title);\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/list.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/prefix.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/prefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a title starts with a prefix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.prefix = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar match = title.substr(0,operator.operand.length).toLowerCase() === operator.operand.toLowerCase();\n\t\tif(operator.prefix === \"!\") {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\tresults.push(title);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/prefix.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sameday.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/sameday.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects tiddlers with a modified date field on the same day as the provided value.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sameday = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.getFieldString(\"modified\").substr(0,8) === operator.operand.substr(0,8);\n\t\t\tif(operator.prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/sameday.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/search.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/search.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for searching for the text in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.search = function(source,operator,options) {\n\tvar invert = operator.prefix === \"!\";\n\treturn options.wiki.search(operator.operand,{\n\t\ttitles: source,\n\t\tinvert: invert,\n\t\texclude: [operator.operand]\n\t});\n};\n\n})();\n",
"title": "$:/core/modules/filters/search.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sort.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/sort.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for sorting\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sort = function(source,operator,options) {\n\tvar results;\n\tif($tw.utils.isArray(source)) {\n\t\tresults = source;\n\t} else {\n\t\tresults = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t}\n\toptions.wiki.sortTiddlers(results,operator.operand,operator.prefix === \"!\");\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/sort.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sortcs.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/sortcs.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for case-sensitive sorting\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sortcs = function(source,operator,options) {\n\tvar results;\n\tif($tw.utils.isArray(source)) {\n\t\tresults = source;\n\t} else {\n\t\tresults = [];\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t}\n\toptions.wiki.sortTiddlers(results,operator.operand,operator.prefix === \"!\",true);\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/sortcs.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tag.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/tag.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking for the presence of a tag\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tag = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.hasTag(operator.operand);\n\t\t\tif(operator.prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/tag.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tagging.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/tagging.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers that are tagged with the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tagging = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlersWithTag(title));\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/tagging.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tags.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/tags.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers tagging the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tags = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler && tiddler.fields.tags) {\n\t\t\t$tw.utils.pushTop(results,tiddler.fields.tags);\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/tags.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/title.js": {
"text": "/*\\\ntitle: $:/core/modules/filters/title.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for comparing title fields for equality\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.title = function(source,operator,options) {\n\tvar results = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar match = tiddler.fields[operator.operator] === operator.operand;\n\t\t\tif(operator.prefix === \"!\") {\n\t\t\t\tmatch = !match;\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t}\n\t// Iterate through the source tiddlers\n\tif($tw.utils.isArray(source)) {\n\t\t$tw.utils.each(source,function(title) {\n\t\t\tcheckTiddler(title);\n\t\t});\n\t} else {\n\t\t// If we're filtering a hashmap we change the behaviour to pass through missing tiddlers\n\t\tif(operator.prefix !== \"!\") {\n\t\t\tresults.push(operator.operand);\n\t\t} else {\n\t\t\t$tw.utils.each(source,function(element,title) {\n\t\t\t\tif(title !== operator.operand) {\n\t\t\t\t\tcheckTiddler(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"title": "$:/core/modules/filters/title.js",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters.js": {
"text": "/*\\\ntitle: $:/core/modules/filters.js\ntype: application/javascript\nmodule-type: wikimethod\n\nAdds tiddler filtering to the $tw.Wiki object.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParses an operation within a filter string\n\tresults: Array of array of operator nodes into which results should be inserted\n\tfilterString: filter string\n\tp: start position within the string\nReturns the new start position, after the parsed operation\n*/\nfunction parseFilterOperation(operators,filterString,p) {\n\tvar operator, operand, bracketPos, curlyBracketPos;\n\t// Skip the starting square bracket\n\tif(filterString.charAt(p++) !== \"[\") {\n\t\tthrow \"Missing [ in filter expression\";\n\t}\n\t// Process each operator in turn\n\tdo {\n\t\toperator = {};\n\t\t// Check for an operator prefix\n\t\tif(filterString.charAt(p) === \"!\") {\n\t\t\toperator.prefix = filterString.charAt(p++);\n\t\t}\n\t\t// Get the operator name\n\t\tbracketPos = filterString.indexOf(\"[\",p);\n\t\tcurlyBracketPos = filterString.indexOf(\"{\",p);\n\t\tif((bracketPos === -1) && (curlyBracketPos === -1)) {\n\t\t\tthrow \"Missing [ in filter expression\";\n\t\t}\n\t\tif(bracketPos === -1 || (curlyBracketPos !== -1 && curlyBracketPos < bracketPos)) {\n\t\t\t// Curly brackets\n\t\t\toperator.indirect = true;\n\t\t\toperator.operator = filterString.substring(p,curlyBracketPos);\n\t\t\tp = curlyBracketPos + 1;\n\t\t} else {\n\t\t\t// Square brackets\n\t\t\toperator.operator = filterString.substring(p,bracketPos);\n\t\t\tp = bracketPos + 1;\n\t\t}\n\t\tif(operator.operator === \"\") {\n\t\t\toperator.operator = \"title\";\n\t\t}\n\t\t// Get the operand\n\t\tbracketPos = filterString.indexOf(operator.indirect ? \"}\" : \"]\",p);\n\t\tif(bracketPos === -1) {\n\t\t\tthrow \"Missing closing bracket in filter expression\";\n\t\t}\n\t\toperator.operand = filterString.substring(p,bracketPos);\n\t\tp = bracketPos + 1;\n\t\t// Push this operator\n\t\toperators.push(operator);\n\t} while(filterString.charAt(p) !== \"]\");\n\t// Skip the ending square bracket\n\tif(filterString.charAt(p++) !== \"]\") {\n\t\tthrow \"Missing ] in filter expression\";\n\t}\n\t// Return the parsing position\n\treturn p;\n}\n\n/*\nParse a filter string\n*/\nexports.parseFilter = function(filterString) {\n\tfilterString = filterString || \"\";\n\tvar results = [], // Array of arrays of operator nodes {operator:,operand:}\n\t\tp = 0, // Current position in the filter string\n\t\tmatch;\n\tvar whitespaceRegExp = /(\\s+)/mg,\n\t\toperandRegExp = /((?:\\+|\\-)?)(?:(\\[)|(\"(?:[^\"])*\")|('(?:[^'])*')|([^\\s\\[\\]]+))/mg;\n\twhile(p < filterString.length) {\n\t\t// Skip any whitespace\n\t\twhitespaceRegExp.lastIndex = p;\n\t\tmatch = whitespaceRegExp.exec(filterString);\n\t\tif(match && match.index === p) {\n\t\t\tp = p + match[0].length;\n\t\t}\n\t\t// Match the start of the operation\n\t\tif(p < filterString.length) {\n\t\t\toperandRegExp.lastIndex = p;\n\t\t\tmatch = operandRegExp.exec(filterString);\n\t\t\tif(!match || match.index !== p) {\n\t\t\t\tthrow \"Syntax error in filter expression\";\n\t\t\t}\n\t\t\tvar operation = {\n\t\t\t\tprefix: \"\",\n\t\t\t\toperators: []\n\t\t\t};\n\t\t\tif(match[1]) {\n\t\t\t\toperation.prefix = match[1];\n\t\t\t\tp++;\n\t\t\t}\n\t\t\tif(match[2]) { // Opening square bracket\n\t\t\t\tp = parseFilterOperation(operation.operators,filterString,p);\n\t\t\t} else {\n\t\t\t\tp = match.index + match[0].length;\n\t\t\t}\n\t\t\tif(match[3] || match[4] || match[5]) { // Double quoted string, single quoted string or unquoted title\n\t\t\t\toperation.operators.push(\n\t\t\t\t\t{operator: \"title\", operand: match[3] || match[4] || match[5]}\n\t\t\t\t);\n\t\t\t}\n\t\t\tresults.push(operation);\n\t\t}\n\t}\n\treturn results;\n};\n\nexports.getFilterOperators = function() {\n\tif(!this.filterOperators) {\n\t\t$tw.Wiki.prototype.filterOperators = {};\n\t\t$tw.modules.applyMethods(\"filteroperator\",this.filterOperators);\n\t}\n\treturn this.filterOperators;\n};\n\nexports.filterTiddlers = function(filterString,currTiddlerTitle,tiddlerList) {\n\tvar fn = this.compileFilter(filterString);\n\treturn fn.call(this,tiddlerList || this.tiddlers,currTiddlerTitle);\n};\n\nexports.compileFilter = function(filterString) {\n\tvar filterParseTree = this.parseFilter(filterString);\n\t// Get the hashmap of filter operator functions\n\tvar filterOperators = this.getFilterOperators();\n\t// Assemble array of functions, one for each operation\n\tvar operationFunctions = [];\n\t// Step through the operations\n\tvar self = this;\n\t$tw.utils.each(filterParseTree,function(operation) {\n\t\t// Create a function for the chain of operators in the operation\n\t\tvar operationSubFunction = function(source,currTiddlerTitle) {\n\t\t\tvar accumulator = source,\n\t\t\t\tresults = [];\n\t\t\t$tw.utils.each(operation.operators,function(operator) {\n\t\t\t\tvar operatorFunction = filterOperators[operator.operator] || filterOperators.field || function(source,operator,operations) {\n\t\t\t\t\t\treturn [\"Filter Error: unknown operator '\" + operator.operator + \"'\"];\n\t\t\t\t\t},\n\t\t\t\t\toperand = operator.operand;\n\t\t\t\tif(operator.indirect) {\n\t\t\t\t\toperand = self.getTextReference(operator.operand,\"\",currTiddlerTitle);\n\t\t\t\t}\n\t\t\t\tresults = operatorFunction(accumulator,{\n\t\t\t\t\t\t\toperator: operator.operator,\n\t\t\t\t\t\t\toperand: operand,\n\t\t\t\t\t\t\tprefix: operator.prefix\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\twiki: self,\n\t\t\t\t\t\t\tcurrTiddlerTitle: currTiddlerTitle\n\t\t\t\t\t\t});\n\t\t\t\taccumulator = results;\n\t\t\t});\n\t\t\treturn results;\n\t\t};\n\t\t// Wrap the operator functions in a wrapper function that depends on the prefix\n\t\toperationFunctions.push((function() {\n\t\t\tswitch(operation.prefix || \"\") {\n\t\t\t\tcase \"\": // No prefix means that the operation is unioned into the result\n\t\t\t\t\treturn function(results,source,currTiddlerTitle) {\n\t\t\t\t\t\t$tw.utils.pushTop(results,operationSubFunction(source,currTiddlerTitle));\n\t\t\t\t\t};\n\t\t\t\tcase \"-\": // The results of this operation are removed from the main result\n\t\t\t\t\treturn function(results,source,currTiddlerTitle) {\n\t\t\t\t\t\t$tw.utils.removeArrayEntries(results,operationSubFunction(source,currTiddlerTitle));\n\t\t\t\t\t};\n\t\t\t\tcase \"+\": // This operation is applied to the main results so far\n\t\t\t\t\treturn function(results,source,currTiddlerTitle) {\n\t\t\t\t\t\t// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved\n\t\t\t\t\t\tsource = results.slice(0);\n\t\t\t\t\t\tresults.splice(0,results.length);\n\t\t\t\t\t\t$tw.utils.pushTop(results,operationSubFunction(source,currTiddlerTitle));\n\t\t\t\t\t};\n\t\t\t}\n\t\t})());\n\t});\n\t// Return a function that applies the operations to a source array/hashmap of tiddler titles\n\treturn function(source,currTiddlerTitle) {\n\t\tvar results = [];\n\t\t$tw.utils.each(operationFunctions,function(operationFunction) {\n\t\t\toperationFunction(results,source,currTiddlerTitle);\n\t\t});\n\t\treturn results;\n\t};\n};\n\n})();\n",
"title": "$:/core/modules/filters.js",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/core/modules/hacks.js": {
"text": "/*\\\ntitle: $:/core/modules/hacks.js\ntype: application/javascript\nmodule-type: global\n\nThese functions are designed to be invoked in the browser developer tools or the node.js REPL.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSwitch slowmotion animation mode on or off\n*/\nexports.slowmo = function(status) {\n\tif(status === undefined || status) {\n\t\t$tw.config.preferences.animationDuration = 4000;\n\t} else {\n\t\t$tw.config.preferences.animationDuration = 400;\n\t}\n\t$tw.config.preferences.animationDurationMs = $tw.config.preferences.animationDuration + \"ms\";\n\treturn \"Slowmo is \" + ($tw.config.preferences.animationDuration === 400 ? \"dis\" : \"\") + \"engaged.\"\n};\n\n})();\n",
"title": "$:/core/modules/hacks.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/parsers/htmlparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/htmlparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe HTML parser displays text as raw HTML\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HtmlParser = function(type,text,options) {\n\tthis.tree = [{\n\t\ttype: \"raw\",\n\t\thtml: text\n\t}];\n};\n\nexports[\"text/html\"] = HtmlParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/htmlparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/imageparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/imageparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe image parser parses an image into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ImageParser = function(type,text,options) {\n\tvar element = \"img\",\n\t\tsrc;\n\tif(type === \"application/pdf\" || type === \".pdf\") {\n\t\tsrc = \"data:application/pdf;base64,\" + text;\n\t\telement = \"embed\";\n\t} else if(type === \"image/svg+xml\" || type === \".svg\") {\n\t\tsrc = \"data:image/svg+xml,\" + encodeURIComponent(text);\n\t} else {\n\t\tsrc = \"data:\" + type + \";base64,\" + text;\n\t}\n\tthis.tree = [{\n\t\ttype: \"element\",\n\t\ttag: element,\n\t\tattributes: {\n\t\t\t\"src\": {type: \"string\", value: src}\n\t\t}\n\t}];\n};\n\nexports[\"image/svg+xml\"] = ImageParser;\nexports[\"image/jpg\"] = ImageParser;\nexports[\"image/jpeg\"] = ImageParser;\nexports[\"image/png\"] = ImageParser;\nexports[\"image/gif\"] = ImageParser;\nexports[\"application/pdf\"] = ImageParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/imageparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/textparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/textparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe plain text parser processes blocks of source text into a degenerate parse tree consisting of a single text node\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar TextParser = function(type,text,options) {\n\tthis.tree = [{\n\t\ttype: \"element\",\n\t\ttag: \"pre\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\nexports[\"text/plain\"] = TextParser;\nexports[\"text/vnd.tiddlywiki2\"] = TextParser;\nexports[\"application/javascript\"] = TextParser;\nexports[\"application/json\"] = TextParser;\nexports[\"text/css\"] = TextParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/textparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/wikiparser/rules/codeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/codeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for code blocks. For example:\n\n```\n\t```\n\tThis text will not be //wikified//\n\t```\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"codeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /```\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /(\\r?\\n```$)/mg;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\t// Return the pre element\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"pre\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/codeblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/codeinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/codeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for code runs. For example:\n\n```\n\tThis is a `code run`.\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"codeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /`/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar reEnd = /`/mg;\n\t// Look for the end marker\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the text\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"code\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/codeinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/commentblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/commentblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for HTML comments. For example:\n\n```\n<!-- This is a comment -->\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"commentblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match - HTML comment regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html\n\tthis.matchRegExp = /\\<![ \\r\\n\\t]*(?:--(?:[^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/commentblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/commentinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/commentinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for HTML comments. For example:\n\n```\n<!-- This is a comment -->\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"commentinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match - HTML comment regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html\n\tthis.matchRegExp = /\\<![ \\r\\n\\t]*(?:--(?:[^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/commentinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/dash.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/dash.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for dashes. For example:\n\n```\nThis is an en-dash: --\n\nThis is an em-dash: ---\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"dash\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /-{2,3}(?!-)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar dash = this.match[0].length === 2 ? \"–\" : \"—\";\n\treturn [{\n\t\ttype: \"entity\",\n\t\tentity: dash\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/dash.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis. For example:\n\n```\n\tThis is ''bold'' text\n\n\tThis is //italic// text\n\n\tThis is __underlined__ text\n\n\tThis is ^^superscript^^ text\n\n\tThis is ,,subscript,, text\n\n\tThis is ~~strikethrough~~ text\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"emphasis\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /''|\\/\\/|__|\\^\\^|,,|~~/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Figure out which element and closing regexp to use\n\tvar tag,reEnd;\n\tswitch(this.match[0]) {\n\t\tcase \"''\": // Bold\n\t\t\ttag = \"strong\";\n\t\t\treEnd = /''/mg;\n\t\t\tbreak;\n\t\tcase \"//\": // Italics\n\t\t\ttag = \"em\";\n\t\t\treEnd = /\\/\\//mg;\n\t\t\tbreak;\n\t\tcase \"__\": // Underline\n\t\t\ttag = \"u\";\n\t\t\treEnd = /__/mg;\n\t\t\tbreak;\n\t\tcase \"^^\": // Superscript\n\t\t\ttag = \"sup\";\n\t\t\treEnd = /\\^\\^/mg;\n\t\t\tbreak;\n\t\tcase \",,\": // Subscript\n\t\t\ttag = \"sub\";\n\t\t\treEnd = /,,/mg;\n\t\t\tbreak;\n\t\tcase \"~~\": // Strikethrough\n\t\t\ttag = \"strike\";\n\t\t\treEnd = /~~/mg;\n\t\t\tbreak;\n\t}\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true});\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: tag,\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/entity.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/entity.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for HTML entities. For example:\n\n```\n\tThis is a copyright symbol: ©\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"entity\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(&#?[a-zA-Z0-9]{2,8};)/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar entityString = this.match[1];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Return the entity\n\treturn [{type: \"entity\", entity: this.match[0]}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/entity.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/extlink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/extlink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for external links. For example:\n\n```\nAn external link: http://www.tiddlywiki.com/\n\nA suppressed external link: ~http://www.tiddlyspace.com/\n```\n\nExternal links can be suppressed by preceding them with `~`.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"extlink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /~?(?:file|http|https|mailto|ftp|irc|news|data):[^\\s'\"<>]+(?:\\/|\\b)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Create the link unless it is suppressed\n\tif(this.match[0].substr(0,1) === \"~\") {\n\t\treturn [{type: \"text\", text: this.match[0].substr(1)}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"$link\",\n\t\t\tattributes: {\n\t\t\t\tto: {type: \"string\", value: this.match[0]}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: this.match[0]\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/extlink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for block-level filtered transclusion. For example:\n\n```\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"filteredtranscludeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{\\{([^\\|]+?)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}([^\\}]*)\\}(?:\\.(\\S+))?(?:\\r?\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar filter = this.match[1],\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the list widget\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"$list\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: filter}\n\t\t},\n\t\tisBlock: true\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes[\"itemClass\"] = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for inline filtered transclusion. For example:\n\n```\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"filteredtranscludeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{\\{([^\\|]+?)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}([^\\}]*)\\}(?:\\.(\\S+))?/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar filter = this.match[1],\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the list widget\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"$list\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: filter}\n\t\t}\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes[\"itemClass\"] = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/heading.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/heading.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for headings\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"heading\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(!{1,6})/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar headingLevel = this.match[1].length;\n\t// Move past the !s\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse any classes, whitespace and then the heading itself\n\tvar classes = this.parser.parseClasses();\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar tree = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// Return the heading\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"h\" + this.match[1].length, \n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: classes.join(\" \")}\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/heading.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/horizrule.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/horizrule.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for rules. For example:\n\n```\n---\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"horizrule\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /-{3,}\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\treturn [{type: \"element\", tag: \"hr\"}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/horizrule.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/html.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/html.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for HTML elements and widgets. For example:\n\n{{{\n<aside>\nThis is an HTML5 aside element\n</aside>\n\n<$slider target=\"MyTiddler\">\nThis is a widget invocation\n</$slider>\n\n}}}\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"html\";\nexports.types = {inline: true, block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextTag = this.findNextTag(this.parser.source,startPos,{\n\t\trequireLineBreak: this.is.block\n\t});\n\treturn this.nextTag ? this.nextTag.start : undefined;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Retrieve the most recent match so that recursive calls don't overwrite it\n\tvar tag = this.nextTag;\n\tthis.nextTag = null;\n\t// Advance the parser position to past the tag\n\tthis.parser.pos = tag.end;\n\t// Check for a following linebreak\n\tvar hasLineBreak = !tag.isSelfClosing && !!this.parseTokenRegExp(this.parser.source,this.parser.pos,/(\\r?\\n)/g);\n\t// Set whether we're in block mode\n\ttag.isBlock = this.is.block || hasLineBreak;\n\t// Parse the body if we need to\n\tif(!tag.isSelfClosing && $tw.config.htmlVoidElements.indexOf(tag.tag) === -1) {\n\t\t\tvar reEndString = \"</\" + $tw.utils.escapeRegExp(tag.tag) + \">\",\n\t\t\t\treEnd = new RegExp(\"(\" + reEndString + \")\",\"mg\");\n\t\tif(hasLineBreak) {\n\t\t\ttag.children = this.parser.parseBlocks(reEndString);\n\t\t} else {\n\t\t\ttag.children = this.parser.parseInlineRun(reEnd);\n\t\t}\n\t\treEnd.lastIndex = this.parser.pos;\n\t\tvar endMatch = reEnd.exec(this.parser.source);\n\t\tif(endMatch && endMatch.index === this.parser.pos) {\n\t\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t\t}\n\t}\n\t// Return the tag\n\treturn [tag];\n};\n\n/*\nLook for a whitespace token. Returns null if not found, otherwise returns {type: \"whitespace\", start:, end:,}\n*/\nexports.parseWhiteSpace = function(source,pos) {\n\tvar node = {\n\t\ttype: \"whitespace\",\n\t\tstart: pos\n\t};\n\tvar re = /(\\s)+/g;\n\tre.lastIndex = pos;\n\tvar match = re.exec(source);\n\tif(match && match.index === pos) {\n\t\tnode.end = pos + match[0].length;\n\t\treturn node;\n\t}\n\treturn null;\n};\n\n/*\nConvenience wrapper for parseWhiteSpace\n*/\nexports.skipWhiteSpace = function(source,pos) {\n\tvar whitespace = this.parseWhiteSpace(source,pos);\n\tif(whitespace) {\n\t\treturn whitespace.end;\n\t}\n\treturn pos;\n};\n\n/*\nLook for a given string token. Returns null if not found, otherwise returns {type: \"token\", value:, start:, end:,}\n*/\nexports.parseTokenString = function(source,pos,token) {\n\tvar match = source.indexOf(token,pos) === pos;\n\tif(match) {\n\t\treturn {\n\t\t\ttype: \"token\",\n\t\t\tvalue: token,\n\t\t\tstart: pos,\n\t\t\tend: pos + token.length\n\t\t};\n\t}\n\treturn null;\n};\n\n/*\nLook for a token matching a regex. Returns null if not found, otherwise returns {type: \"regexp\", match:, start:, end:,}\n*/\nexports.parseTokenRegExp = function(source,pos,reToken) {\n\tvar node = {\n\t\ttype: \"regexp\",\n\t\tstart: pos\n\t};\n\treToken.lastIndex = pos;\n\tnode.match = reToken.exec(source);\n\tif(node.match && node.match.index === pos) {\n\t\tnode.end = pos + node.match[0].length;\n\t\treturn node;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLook for a string literal. Returns null if not found, otherwise returns {type: \"string\", value:, start:, end:,}\n*/\nexports.parseStringLiteral = function(source,pos) {\n\tvar node = {\n\t\ttype: \"string\",\n\t\tstart: pos\n\t};\n\tvar reString = /(?:\"([^\"]*)\")|(?:'([^']*)')/g;\n\treString.lastIndex = pos;\n\tvar match = reString.exec(source);\n\tif(match && match.index === pos) {\n\t\tnode.value = match[1] === undefined ? match[2] : match[1];\n\t\tnode.end = pos + match[0].length;\n\t\treturn node;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLook for a macro invocation parameter. Returns null if not found, or {type: \"macro-parameter\", name:, value:, start:, end:}\n*/\nexports.parseMacroParameter = function(source,pos) {\n\tvar node = {\n\t\ttype: \"macro-parameter\",\n\t\tstart: pos\n\t};\n\t// Define our regexp\n\tvar reMacroParameter = /(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\\s>\"'=]+)))/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for the parameter\n\tvar token = this.parseTokenRegExp(source,pos,reMacroParameter);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the parameter details\n\tnode.value = token.match[2] !== undefined ? token.match[2] : (\n\t\t\t\t\ttoken.match[3] !== undefined ? token.match[3] : (\n\t\t\t\t\t\ttoken.match[4] !== undefined ? token.match[4] : (\n\t\t\t\t\t\t\ttoken.match[5] !== undefined ? token.match[5] : (\n\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\tif(token.match[1]) {\n\t\tnode.name = token.match[1];\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for a macro invocation. Returns null if not found, or {type: \"macrocall\", name:, parameters:, start:, end:}\n*/\nexports.parseMacroInvocation = function(source,pos) {\n\tvar node = {\n\t\ttype: \"macrocall\",\n\t\tstart: pos,\n\t\tparams: []\n\t};\n\t// Define our regexps\n\tvar reMacroName = /([^\\s>\"'=]+)/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a double less than sign\n\tvar token = this.parseTokenString(source,pos,\"<<\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the macro name\n\tvar name = this.parseTokenRegExp(source,pos,reMacroName);\n\tif(!name) {\n\t\treturn null;\n\t}\n\tnode.name = name.match[1];\n\tpos = name.end;\n\t// Process parameters\n\tvar parameter = this.parseMacroParameter(source,pos);\n\twhile(parameter) {\n\t\tnode.params.push(parameter);\n\t\tpos = parameter.end;\n\t\t// Get the next parameter\n\t\tparameter = this.parseMacroParameter(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a double greater than sign\n\ttoken = this.parseTokenString(source,pos,\">>\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for an HTML attribute definition. Returns null if not found, otherwise returns {type: \"attribute\", name:, valueType: \"string|indirect|macro\", value:, start:, end:,}\n*/\nexports.parseAttribute = function(source,pos) {\n\tvar node = {\n\t\tstart: pos\n\t};\n\t// Define our regexps\n\tvar reAttributeName = /([^\\/\\s>\"'=]+)/g,\n\t\treUnquotedAttribute = /([^\\/\\s<>\"'=]+)/g,\n\t\treIndirectValue = /\\{\\{([^\\}]+)\\}\\}/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Get the attribute name\n\tvar name = this.parseTokenRegExp(source,pos,reAttributeName);\n\tif(!name) {\n\t\treturn null;\n\t}\n\tnode.name = name.match[1];\n\tpos = name.end;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for an equals sign\n\tvar token = this.parseTokenString(source,pos,\"=\");\n\tif(token) {\n\t\tpos = token.end;\n\t\t// Skip whitespace\n\t\tpos = this.skipWhiteSpace(source,pos);\n\t\t// Look for a string literal\n\t\tvar stringLiteral = this.parseStringLiteral(source,pos);\n\t\tif(stringLiteral) {\n\t\t\tpos = stringLiteral.end;\n\t\t\tnode.type = \"string\";\n\t\t\tnode.value = stringLiteral.value;\n\t\t} else {\n\t\t\t// Look for an indirect value\n\t\t\tvar indirectValue = this.parseTokenRegExp(source,pos,reIndirectValue);\n\t\t\tif(indirectValue) {\n\t\t\t\tpos = indirectValue.end;\n\t\t\t\tnode.type = \"indirect\";\n\t\t\t\tnode.textReference = indirectValue.match[1];\n\t\t\t} else {\n\t\t\t\t// Look for a unquoted value\n\t\t\t\tvar unquotedValue = this.parseTokenRegExp(source,pos,reUnquotedAttribute);\n\t\t\t\tif(unquotedValue) {\n\t\t\t\t\tpos = unquotedValue.end;\n\t\t\t\t\tnode.type = \"string\";\n\t\t\t\t\tnode.value = unquotedValue.match[1];\n\t\t\t\t} else {\n\t\t\t\t\t// Look for a macro invocation value\n\t\t\t\t\tvar macroInvocation = this.parseMacroInvocation(source,pos);\n\t\t\t\t\tif(macroInvocation) {\n\t\t\t\t\t\tpos = macroInvocation.end;\n\t\t\t\t\t\tnode.type = \"macro\";\n\t\t\t\t\t\tnode.value = macroInvocation;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.type = \"string\";\n\t\t\t\t\t\tnode.value = \"true\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tnode.type = \"string\";\n\t\tnode.value = \"true\";\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for an HTML tag. Returns null if not found, otherwise returns {type: \"tag\", name:, attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseTag = function(source,pos,options) {\n\toptions = options || {};\n\tvar token,\n\t\tnode = {\n\t\t\ttype: \"element\",\n\t\t\tstart: pos,\n\t\t\tattributes: {}\n\t\t};\n\t// Define our regexps\n\tvar reTagName = /([a-zA-Z0-9\\-\\$]+)/g;\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a less than sign\n\ttoken = this.parseTokenString(source,pos,\"<\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the tag name\n\ttoken = this.parseTokenRegExp(source,pos,reTagName);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tnode.tag = token.match[1];\n\tpos = token.end;\n\t// Process attributes\n\tvar attribute = this.parseAttribute(source,pos);\n\twhile(attribute) {\n\t\tnode.attributes[attribute.name] = attribute;\n\t\tpos = attribute.end;\n\t\t// Get the next attribute\n\t\tattribute = this.parseAttribute(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = this.skipWhiteSpace(source,pos);\n\t// Look for a closing slash\n\ttoken = this.parseTokenString(source,pos,\"/\");\n\tif(token) {\n\t\tpos = token.end;\n\t\tnode.isSelfClosing = true;\n\t}\n\t// Look for a greater than sign\n\ttoken = this.parseTokenString(source,pos,\">\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Check for a required line break\n\tif(options.requireLineBreak) {\n\t\ttoken = this.parseTokenRegExp(source,pos,/(\\r?\\n)/g);\n\t\tif(!token) {\n\t\t\treturn null;\n\t\t}\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\nexports.findNextTag = function(source,pos,options) {\n\t// A regexp for finding candidate HTML tags\n\tvar reLookahead = /<([a-zA-Z\\-\\$]+)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a tag\n\t\tvar tag = this.parseTag(source,match.index,options);\n\t\t// Return success\n\t\tif(tag) {\n\t\t\treturn tag;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/html.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/list.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/list.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for lists. For example:\n\n```\n* This is an unordered list\n* It has two items\n\n# This is a numbered list\n## With a subitem\n# And a third item\n\n; This is a term that is being defined\n: This is the definition of that term\n```\n\nNote that lists can be nested arbitrarily:\n\n```\n#** One\n#* Two\n#** Three\n#**** Four\n#**# Five\n#**## Six\n## Seven\n### Eight\n## Nine\n```\n\nA CSS class can be applied to a list item as follows:\n\n```\n* List item one\n*.active List item two has the class `active`\n* List item three\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"list\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /([\\*#;:]+)/mg;\n};\n\nvar listTypes = {\n\t\"*\": {listTag: \"ul\", itemTag: \"li\"},\n\t\"#\": {listTag: \"ol\", itemTag: \"li\"},\n\t\";\": {listTag: \"dl\", itemTag: \"dt\"},\n\t\":\": {listTag: \"dl\", itemTag: \"dd\"}\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Array of parse tree nodes for the previous row of the list\n\tvar listStack = [];\n\t// Cycle through the items in the list\n\twhile(true) {\n\t\t// Match the list marker\n\t\tvar reMatch = /([\\*#;:]+)/mg;\n\t\treMatch.lastIndex = this.parser.pos;\n\t\tvar match = reMatch.exec(this.parser.source);\n\t\tif(!match || match.index !== this.parser.pos) {\n\t\t\tbreak;\n\t\t}\n\t\t// Check whether the list type of the top level matches\n\t\tvar listInfo = listTypes[match[0].charAt(0)];\n\t\tif(listStack.length > 0 && listStack[0].tag !== listInfo.listTag) {\n\t\t\tbreak;\n\t\t}\n\t\t// Move past the list marker\n\t\tthis.parser.pos = match.index + match[0].length;\n\t\t// Walk through the list markers for the current row\n\t\tfor(var t=0; t<match[0].length; t++) {\n\t\t\tlistInfo = listTypes[match[0].charAt(t)];\n\t\t\t// Remove any stacked up element if we can't re-use it because the list type doesn't match\n\t\t\tif(listStack.length > t && listStack[t].tag !== listInfo.listTag) {\n\t\t\t\tlistStack.splice(t,listStack.length - t);\n\t\t\t}\n\t\t\t// Construct the list element or reuse the previous one at this level\n\t\t\tif(listStack.length <= t) {\n\t\t\t\tvar listElement = {type: \"element\", tag: listInfo.listTag, children: [\n\t\t\t\t\t{type: \"element\", tag: listInfo.itemTag, children: []}\n\t\t\t\t]};\n\t\t\t\t// Link this list element into the last child item of the parent list item\n\t\t\t\tif(t) {\n\t\t\t\t\tvar prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];\n\t\t\t\t\tprevListItem.children.push(listElement);\n\t\t\t\t}\n\t\t\t\t// Save this element in the stack\n\t\t\t\tlistStack[t] = listElement;\n\t\t\t} else if(t === (match[0].length - 1)) {\n\t\t\t\tlistStack[t].children.push({type: \"element\", tag: listInfo.itemTag, children: []});\n\t\t\t}\n\t\t}\n\t\tif(listStack.length > match[0].length) {\n\t\t\tlistStack.splice(match[0].length,listStack.length - match[0].length);\n\t\t}\n\t\t// Process the body of the list item into the last list item\n\t\tvar lastListChildren = listStack[listStack.length-1].children,\n\t\t\tlastListItem = lastListChildren[lastListChildren.length-1],\n\t\t\tclasses = this.parser.parseClasses();\n\t\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\t\tvar tree = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t\tlastListItem.children.push.apply(lastListItem.children,tree);\n\t\tif(classes.length > 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(\" \"));\n\t\t}\n\t\t// Consume any whitespace following the list item\n\t\tthis.parser.skipWhitespace();\n\t}\n\t// Return the root element of the list\n\treturn [listStack[0]];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/list.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrocallblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for block macro calls\n\n```\n<<name value value2>>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrocallblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /<<([^\\s>]+)\\s*([\\s\\S]*?)>>(?:\\r?\\n|$)/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar macroName = this.match[1],\n\t\tparamString = this.match[2];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar params = [],\n\t\treParam = /\\s*(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))/mg,\n\t\tparamMatch = reParam.exec(paramString);\n\twhile(paramMatch) {\n\t\t// Process this parameter\n\t\tvar paramInfo = {\n\t\t\tvalue: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]\n\t\t};\n\t\tif(paramMatch[1]) {\n\t\t\tparamInfo.name = paramMatch[1];\n\t\t}\n\t\tparams.push(paramInfo);\n\t\t// Find the next match\n\t\tparamMatch = reParam.exec(paramString);\n\t}\n\treturn [{\n\t\ttype: \"macrocall\",\n\t\tname: macroName,\n\t\tparams: params,\n\t\tisBlock: true\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/macrocallblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrocallinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for macro calls\n\n```\n<<name value value2>>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrocallinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /<<([^\\s>]+)\\s*([\\s\\S]*?)>>/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar macroName = this.match[1],\n\t\tparamString = this.match[2];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar params = [],\n\t\treParam = /\\s*(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))/mg,\n\t\tparamMatch = reParam.exec(paramString);\n\twhile(paramMatch) {\n\t\t// Process this parameter\n\t\tvar paramInfo = {\n\t\t\tvalue: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]\n\t\t};\n\t\tif(paramMatch[1]) {\n\t\t\tparamInfo.name = paramMatch[1];\n\t\t}\n\t\tparams.push(paramInfo);\n\t\t// Find the next match\n\t\tparamMatch = reParam.exec(paramString);\n\t}\n\treturn [{\n\t\ttype: \"macrocall\",\n\t\tname: macroName,\n\t\tparams: params\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/macrocallinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrodef.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrodef.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for macro definitions\n\n```\n\\define name(param:defaultvalue,param2:defaultvalue)\ndefinition text, including $param$ markers\n\\end\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrodef\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\define\\s+([^(\\s]+)\\(\\s*([^)]*)\\)(\\r?\\n)?/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Move past the macro name and parameters\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the parameters\n\tvar paramString = this.match[2],\n\t\tparams = [];\n\tif(paramString !== \"\") {\n\t\tvar reParam = /\\s*([A-Za-z0-9\\-_]+)(?:\\s*:\\s*(?:\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))?/mg,\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\twhile(paramMatch) {\n\t\t\t// Save the parameter details\n\t\t\tvar paramInfo = {name: paramMatch[1]},\n\t\t\t\tdefaultValue = paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5];\n\t\t\tif(defaultValue) {\n\t\t\t\tparamInfo[\"default\"] = defaultValue;\n\t\t\t}\n\t\t\tparams.push(paramInfo);\n\t\t\t// Look for the next parameter\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\t}\n\t}\n\t// Is this a multiline definition?\n\tvar reEnd;\n\tif(this.match[3]) {\n\t\t// If so, the end of the body is marked with \\end\n\t\treEnd = /(\\r?\\n\\\\end\\r?\\n)/mg;\n\t} else {\n\t\t// Otherwise, the end of the definition is marked by the end of the line\n\t\treEnd = /(\\r?\\n)/mg;\n\t}\n\t// Find the end of the definition\n\treEnd.lastIndex = this.parser.pos;\n\tvar text,\n\t\tendMatch = reEnd.exec(this.parser.source);\n\tif(endMatch) {\n\t\ttext = this.parser.source.substring(this.parser.pos,endMatch.index);\n\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t} else {\n\t\t// We didn't find the end of the definition, so we'll make it blank\n\t\ttext = \"\";\n\t}\n\t// Save the macro definition\n\treturn [{\n\t\ttype: \"macrodef\",\n\t\tname: this.match[1],\n\t\tparams: params,\n\t\ttext: text\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/macrodef.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/prettylink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/prettylink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for pretty links. For example:\n\n```\n[[Introduction]]\n\n[[Link description|TiddlerTitle]]\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"prettylink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\[\\[(.*?)(?:\\|(.*?))?\\]\\]/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Process the link\n\tvar text = this.match[1],\n\t\tlink = this.match[2] || text;\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"$link\",\n\t\tattributes: {\n\t\t\tto: {type: \"string\", value: link}\n\t\t},\n\t\tchildren: [{\n\t\t\ttype: \"text\", text: text\n\t\t}]\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/prettylink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/rules.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/rules.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for rules specifications\n\n```\n\\rules except ruleone ruletwo rulethree\n\\rules only ruleone ruletwo rulethree\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"rules\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\rules[^\\S\\n]/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Move past the pragma invocation\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse whitespace delimited tokens terminated by a line break\n\tvar reMatch = /[^\\S\\n]*(\\S+)|(\\r?\\n)/mg,\n\t\ttokens = [];\n\treMatch.lastIndex = this.parser.pos;\n\tvar match = reMatch.exec(this.parser.source);\n\twhile(match && match.index === this.parser.pos) {\n\t\tthis.parser.pos = reMatch.lastIndex;\n\t\t// Exit if we've got the line break\n\t\tif(match[2]) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the token\n\t\tif(match[1]) {\n\t\t\ttokens.push(match[1]);\n\t\t}\n\t\t// Match the next token\n\t\tmatch = reMatch.exec(this.parser.source);\n\t}\n\t// Process the tokens\n\tif(tokens.length > 0) {\n\t\tthis.parser.amendRules(tokens[0],tokens.slice(1));\n\t}\n\t// No parse tree nodes to return\n\treturn [];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/rules.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/styleblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/styleblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for assigning styles and classes to paragraphs and other blocks. For example:\n\n```\n@@.myClass\n@@background-color:red;\nThis paragraph will have the CSS class `myClass`.\n\n* The `<ul>` around this list will also have the class `myClass`\n* List item 2\n\n@@\n```\n\nNote that classes and styles can be mixed subject to the rule that styles must precede classes. For example\n\n```\n@@.myFirstClass.mySecondClass\n@@width:100px;.myThirdClass\nThis is a paragraph\n@@\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"styleblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /@@((?:[^\\.\\r\\n\\s:]+:[^\\r\\n;]+;)+)?(?:\\.([^\\r\\n\\s]+))?\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEndString = \"^@@(?:\\\\r?\\\\n)?\";\n\tvar classes = [], styles = [];\n\tdo {\n\t\t// Get the class and style\n\t\tif(this.match[1]) {\n\t\t\tstyles.push(this.match[1]);\n\t\t}\n\t\tif(this.match[2]) {\n\t\t\tclasses.push(this.match[2].split(\".\").join(\" \"));\n\t\t}\n\t\t// Move past the match\n\t\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t\t// Look for another line of classes and styles\n\t\tthis.match = this.matchRegExp.exec(this.parser.source);\n\t} while(this.match && this.match.index === this.parser.pos);\n\t// Parse the body\n\tvar tree = this.parser.parseBlocks(reEndString);\n\tfor(var t=0; t<tree.length; t++) {\n\t\tif(classes.length > 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(tree[t],classes.join(\" \"));\n\t\t}\n\t\tif(styles.length > 0) {\n\t\t\t$tw.utils.addAttributeToParseTreeNode(tree[t],\"style\",styles.join(\"\"));\n\t\t}\n\t}\n\treturn tree;\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/styleblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/styleinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/styleinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for assigning styles and classes to inline runs. For example:\n\n```\n@@.myClass This is some text with a class@@\n@@background-color:red;This is some text with a background colour@@\n@@width:100px;.myClass This is some text with a class and a width@@\n```\n\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"styleinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /@@((?:[^\\.\\r\\n\\s:]+:[^\\r\\n;]+;)+)?(\\.(?:[^\\r\\n\\s]+)\\s+)?/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /@@/g;\n\t// Get the styles and class\n\tvar stylesString = this.match[1],\n\t\tclassString = this.match[2] ? this.match[2].split(\".\").join(\" \") : undefined;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the run up to the terminator\n\tvar tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true});\n\t// Return the classed span\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"span\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: \"tw-inline-style\"}\n\t\t},\n\t\tchildren: tree\n\t};\n\tif(classString) {\n\t\t$tw.utils.addClassToParseTreeNode(node,classString);\n\t}\n\tif(stylesString) {\n\t\t$tw.utils.addAttributeToParseTreeNode(node,\"style\",stylesString);\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/styleinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/table.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/table.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for tables.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"table\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\|(?:[^\\n]*)\\|(?:[fhck]?)\\r?\\n/mg;\n};\n\nvar processRow = function(prevColumns) {\n\tvar cellRegExp = /(?:\\|([^\\n\\|]*)\\|)|(\\|[fhck]?\\r?\\n)/mg,\n\t\tcellTermRegExp = /((?:\\x20*)\\|)/mg,\n\t\ttree = [],\n\t\tcol = 0,\n\t\tcolSpanCount = 1,\n\t\tprevCell;\n\t// Match a single cell\n\tcellRegExp.lastIndex = this.parser.pos;\n\tvar cellMatch = cellRegExp.exec(this.parser.source);\n\twhile(cellMatch && cellMatch.index === this.parser.pos) {\n\t\tif(cellMatch[1] === \"~\") {\n\t\t\t// Rowspan\n\t\t\tvar last = prevColumns[col];\n\t\t\tif(last) {\n\t\t\t\tlast.rowSpanCount++;\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"rowspan\",last.rowSpanCount);\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"valign\",\"center\");\n\t\t\t\tif(colSpanCount > 1) {\n\t\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"colspan\",colSpanCount);\n\t\t\t\t\tcolSpanCount = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[1] === \">\") {\n\t\t\t// Colspan\n\t\t\tcolSpanCount++;\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[2]) {\n\t\t\t// End of row\n\t\t\tif(prevCell && colSpanCount > 1) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\"colspan\",colSpanCount);\n\t\t\t}\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t\tbreak;\n\t\t} else {\n\t\t\t// For ordinary cells, step beyond the opening `|`\n\t\t\tthis.parser.pos++;\n\t\t\t// Look for a space at the start of the cell\n\t\t\tvar spaceLeft = false,\n\t\t\t\tchr = this.parser.source.substr(this.parser.pos,1);\n\t\t\twhile(chr === \" \") {\n\t\t\t\tspaceLeft = true;\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tchr = this.parser.source.substr(this.parser.pos,1);\n\t\t\t}\n\t\t\t// Check whether this is a heading cell\n\t\t\tvar cell;\n\t\t\tif(chr === \"!\") {\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tcell = {type: \"element\", tag: \"th\", children: []};\n\t\t\t} else {\n\t\t\t\tcell = {type: \"element\", tag: \"td\", children: []};\n\t\t\t}\n\t\t\ttree.push(cell);\n\t\t\t// Record information about this cell\n\t\t\tprevCell = cell;\n\t\t\tprevColumns[col] = {rowSpanCount:1,element:cell};\n\t\t\t// Check for a colspan\n\t\t\tif(colSpanCount > 1) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"colspan\",colSpanCount);\n\t\t\t\tcolSpanCount = 1;\n\t\t\t}\n\t\t\t// Parse the cell\n\t\t\tcell.children = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true});\n\t\t\t// Set the alignment for the cell\n\t\t\tif(cellMatch[1].substr(cellMatch[1].length-1,1) === \" \") { // spaceRight\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"align\",spaceLeft ? \"center\" : \"left\");\n\t\t\t} else if(spaceLeft) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"align\",\"right\");\n\t\t\t}\n\t\t\t// Move back to the closing `|`\n\t\t\tthis.parser.pos--;\n\t\t}\n\t\tcol++;\n\t\tcellRegExp.lastIndex = this.parser.pos;\n\t\tcellMatch = cellRegExp.exec(this.parser.source);\n\t}\n\treturn tree;\n};\n\nexports.parse = function() {\n\tvar rowContainerTypes = {\"c\":\"caption\", \"h\":\"thead\", \"\":\"tbody\", \"f\":\"tfoot\"},\n\t\ttable = {type: \"element\", tag: \"table\", children: []},\n\t\trowRegExp = /^\\|([^\\n]*)\\|([fhck]?)\\r?\\n/mg,\n\t\trowTermRegExp = /(\\|(?:[fhck]?)\\r?\\n)/mg,\n\t\tprevColumns = [],\n\t\tcurrRowType,\n\t\trowContainer,\n\t\trowCount = 0;\n\t// Match the row\n\trowRegExp.lastIndex = this.parser.pos;\n\tvar rowMatch = rowRegExp.exec(this.parser.source);\n\twhile(rowMatch && rowMatch.index === this.parser.pos) {\n\t\tvar rowType = rowMatch[2];\n\t\t// Check if it is a class assignment\n\t\tif(rowType === \"k\") {\n\t\t\t$tw.utils.addClassToParseTreeNode(table,rowMatch[1]);\n\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t} else {\n\t\t\t// Otherwise, create a new row if this one is of a different type\n\t\t\tif(rowType != currRowType) {\n\t\t\t\trowContainer = {type: \"element\", tag: rowContainerTypes[rowType], children: []};\n\t\t\t\ttable.children.push(rowContainer);\n\t\t\t\tcurrRowType = rowType;\n\t\t\t}\n\t\t\t// Is this a caption row?\n\t\t\tif(currRowType === \"c\") {\n\t\t\t\t// If so, move past the opening `|` of the row\n\t\t\t\tthis.parser.pos++;\n\t\t\t\t// Move the caption to the first row if it isn't already\n\t\t\t\tif(table.children.length !== 1) {\n\t\t\t\t\ttable.children.pop(); // Take rowContainer out of the children array\n\t\t\t\t\ttable.children.splice(0,0,rowContainer); // Insert it at the bottom\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// Set the alignment - TODO: figure out why TW did this\n//\t\t\t\trowContainer.attributes.align = rowCount === 0 ? \"top\" : \"bottom\";\n\t\t\t\t// Parse the caption\n\t\t\t\trowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});\n\t\t\t} else {\n\t\t\t\t// Create the row\n\t\t\t\tvar theRow = {type: \"element\", tag: \"tr\", children: []};\n\t\t\t\t$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? \"oddRow\" : \"evenRow\");\n\t\t\t\trowContainer.children.push(theRow);\n\t\t\t\t// Process the row\n\t\t\t\ttheRow.children = processRow.call(this,prevColumns);\n\t\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t\t\t// Increment the row count\n\t\t\t\trowCount++;\n\t\t\t}\n\t\t}\n\t\trowMatch = rowRegExp.exec(this.parser.source);\n\t}\n\treturn [table];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/table.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/transcludeblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/transcludeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for block-level transclusion. For example:\n\n```\n{{MyTiddler}}\n{{MyTiddler|tooltip}}\n{{MyTiddler||TemplateTitle}}\n{{MyTiddler|tooltip||TemplateTitle}}\n{{MyTiddler}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"transcludeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{([^\\{\\}\\|]+)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}([^\\}]*)\\}(?:\\.(\\S+))?(?:\\r?\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar textRef = $tw.utils.trim(this.match[1]),\n\t\ttr = $tw.utils.parseTextReference(textRef),\n\t\ttargetTitle = tr.title,\n\t\ttargetField = tr.field,\n\t\ttargetIndex = tr.index,\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the transclude widget\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"$transclude\",\n\t\tattributes: {\n\t\t\ttarget: {type: \"string\", value: targetTitle}\n\t\t},\n\t\tisBlock: true\n\t};\n\tif(targetField) {\n\t\tnode.attributes.field = {type: \"string\", value: targetField};\n\t}\n\tif(targetIndex) {\n\t\tnode.attributes.index = {type: \"string\", value: targetIndex};\n\t}\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes[\"class\"] = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/transcludeblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/transcludeinline.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/transcludeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for inline-level transclusion. For example:\n\n```\n{{MyTiddler}}\n{{MyTiddler|tooltip}}\n{{MyTiddler||TemplateTitle}}\n{{MyTiddler|tooltip||TemplateTitle}}\n{{MyTiddler}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"transcludeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{([^\\{\\}\\|]+)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}([^\\}]*)\\}(?:\\.(\\S+))?/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar textRef = $tw.utils.trim(this.match[1]),\n\t\ttr = $tw.utils.parseTextReference(textRef),\n\t\ttargetTitle = tr.title,\n\t\ttargetField = tr.field,\n\t\ttargetIndex = tr.index,\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the transclude widget\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"$transclude\",\n\t\tattributes: {\n\t\t\ttarget: {type: \"string\", value: targetTitle}\n\t\t}\n\t};\n\tif(targetField) {\n\t\tnode.attributes.field = {type: \"string\", value: targetField};\n\t}\n\tif(targetIndex) {\n\t\tnode.attributes.index = {type: \"string\", value: targetIndex};\n\t}\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes[\"class\"] = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/transcludeinline.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/typedblock.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/typedblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for typed blocks. For example:\n\n```\n$$$.js\nThis will be rendered as JavaScript\n$$$\n\n$$$.svg\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"150\" height=\"100\">\n <circle cx=\"100\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"2\" fill=\"red\" />\n</svg>\n$$$\n\n$$$text/vnd.tiddlywiki>text/html\nThis will be rendered as an //HTML representation// of WikiText\n$$$\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"typedblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\$\\$\\$([^ >\\r\\n]*)(?: *> *([^ \\r\\n]+))?\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /\\r?\\n\\$\\$\\$\\r?\\n/mg;\n\t// Save the type\n\tvar parseType = this.match[1],\n\t\trenderType = this.match[2];\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\t// Parse the block according to the specified type\n\tvar parser = this.parser.wiki.parseText(parseType,text,{defaultType: \"text/plain\"});\n\t// If there's no render type, just return the parse tree\n\tif(!renderType) {\n\t\treturn parser.tree;\n\t} else {\n\t\t// Otherwise, render to the rendertype and return in a <PRE> tag\n\t\tvar renderTree = new $tw.WikiRenderTree(parser,{wiki: $tw.wiki, document: $tw.document});\n\t\trenderTree.execute();\n\t\tvar container = $tw.document.createElement(\"div\");\n\t\trenderTree.renderInDom(container);\n\t\tvar text = renderType === \"text/html\" ? container.innerHTML : container.textContent;\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"pre\",\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/typedblock.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/wikilink.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/wikilink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for wiki links. For example:\n\n```\nAWikiLink\nAnotherLink\n~SuppressedLink\n```\n\nPrecede a camel case word with `~` to prevent it from being recognised as a link.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"wikilink\";\nexports.types = {inline: true};\n\nvar textPrimitives = {\n\tupperLetter: \"[A-Z\\u00c0-\\u00de\\u0150\\u0170]\",\n\tlowerLetter: \"[a-z0-9_\\\\-\\u00df-\\u00ff\\u0151\\u0171]\",\n\tanyLetter: \"[A-Za-z0-9_\\\\-\\u00c0-\\u00de\\u00df-\\u00ff\\u0150\\u0170\\u0151\\u0171]\",\n\tanyLetterStrict: \"[A-Za-z0-9\\u00c0-\\u00de\\u00df-\\u00ff\\u0150\\u0170\\u0151\\u0171]\"\n};\n\ntextPrimitives.unWikiLink = \"~\";\ntextPrimitives.wikiLink = textPrimitives.upperLetter + \"+\" +\n\ttextPrimitives.lowerLetter + \"+\" +\n\ttextPrimitives.upperLetter +\n\ttextPrimitives.anyLetter + \"*\";\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = new RegExp(textPrimitives.unWikiLink + \"?\" + textPrimitives.wikiLink,\"mg\");\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get the details of the match\n\tvar linkText = this.match[0];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// If the link starts with the unwikilink character then just output it as plain text\n\tif(linkText.substr(0,1) === textPrimitives.unWikiLink) {\n\t\treturn [{type: \"text\", text: linkText.substr(1)}];\n\t}\n\t// If the link has been preceded with a letter then don't treat it as a link\n\tif(this.match.index > 0) {\n\t\tvar preRegExp = new RegExp(textPrimitives.anyLetterStrict,\"mg\");\n\t\tpreRegExp.lastIndex = this.match.index-1;\n\t\tvar preMatch = preRegExp.exec(this.parser.source);\n\t\tif(preMatch && preMatch.index === this.match.index-1) {\n\t\t\treturn [{type: \"text\", text: linkText}];\n\t\t}\n\t}\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"$link\",\n\t\tattributes: {\n\t\t\tto: {type: \"string\", value: linkText}\n\t\t},\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: linkText\n\t\t}]\n\t}];\n};\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/wikilink.js",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/wikiparser.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/wikiparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe wiki text parser processes blocks of source text into a parse tree.\n\nThe parse tree is made up of nested arrays of these JavaScript objects:\n\n\t{type: \"element\", tag: <string>, attributes: {}, children: []} - an HTML element\n\t{type: \"text\", text: <string>} - a text node\n\t{type: \"entity\", value: <string>} - an entity\n\t{type: \"raw\", html: <string>} - raw HTML\n\nAttributes are stored as hashmaps of the following objects:\n\n\t{type: \"string\", value: <string>} - literal string\n\t{type: \"array\", value: <string array>} - array of strings\n\t{type: \"styles\", value: <object>} - hashmap of style strings\n\t{type: \"indirect\", textReference: <textReference>} - indirect through a text reference\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar WikiParser = function(type,text,options) {\n\tthis.wiki = options.wiki;\n\t// Initialise the classes if we don't have them already\n\tif(!this.pragmaRuleClasses) {\n\t\tWikiParser.prototype.pragmaRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"pragma\",$tw.WikiRuleBase);\n\t}\n\tif(!this.blockRuleClasses) {\n\t\tWikiParser.prototype.blockRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"block\",$tw.WikiRuleBase);\n\t}\n\tif(!this.inlineRuleClasses) {\n\t\tWikiParser.prototype.inlineRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"inline\",$tw.WikiRuleBase);\n\t}\n\t// Save the parse text\n\tthis.type = type || \"text/vnd.tiddlywiki\";\n\tthis.source = text || \"\";\n\tthis.sourceLength = this.source.length;\n\t// Set current parse position\n\tthis.pos = 0;\n\t// Instantiate the pragma parse rules\n\tthis.pragmaRules = this.instantiateRules(this.pragmaRuleClasses,\"pragma\",0);\n\t// Instantiate the parser block and inline rules\n\tthis.blockRules = this.instantiateRules(this.blockRuleClasses,\"block\",0);\n\tthis.inlineRules = this.instantiateRules(this.inlineRuleClasses,\"inline\",0);\n\t// Parse any pragmas\n\tthis.tree = this.parsePragmas();\n\t// Parse the text into inline runs or blocks\n\tif(options.parseAsInline) {\n\t\tthis.tree.push.apply(this.tree,this.parseInlineRun());\n\t} else {\n\t\tthis.tree.push.apply(this.tree,this.parseBlocks());\n\t}\n\t// Return the parse tree\n};\n\n/*\nInstantiate an array of parse rules\n*/\nWikiParser.prototype.instantiateRules = function(classes,type,startPos) {\n\tvar rulesInfo = [],\n\t\tself = this;\n\t$tw.utils.each(classes,function(RuleClass) {\n\t\t// Instantiate the rule\n\t\tvar rule = new RuleClass(self);\n\t\trule.is = {};\n\t\trule.is[type] = true;\n\t\trule.init(self);\n\t\tvar matchIndex = rule.findNextMatch(startPos);\n\t\tif(matchIndex !== undefined) {\n\t\t\trulesInfo.push({\n\t\t\t\trule: rule,\n\t\t\t\tmatchIndex: matchIndex\n\t\t\t});\n\t\t}\n\t});\n\treturn rulesInfo;\n};\n\n/*\nSkip any whitespace at the current position. Options are:\n\ttreatNewlinesAsNonWhitespace: true if newlines are NOT to be treated as whitespace\n*/\nWikiParser.prototype.skipWhitespace = function(options) {\n\toptions = options || {};\n\tvar whitespaceRegExp = options.treatNewlinesAsNonWhitespace ? /([^\\S\\n]+)/mg : /(\\s+)/mg;\n\twhitespaceRegExp.lastIndex = this.pos;\n\tvar whitespaceMatch = whitespaceRegExp.exec(this.source);\n\tif(whitespaceMatch && whitespaceMatch.index === this.pos) {\n\t\tthis.pos = whitespaceRegExp.lastIndex;\n\t}\n};\n\n/*\nGet the next match out of an array of parse rule instances\n*/\nWikiParser.prototype.findNextMatch = function(rules,startPos) {\n\t// Find the best matching rule by finding the closest match position\n\tvar matchingRule = undefined,\n\t\tmatchingRulePos = this.sourceLength;\n\t// Step through each rule\n\tfor(var t=0; t<rules.length; t++) {\n\t\tvar ruleInfo = rules[t];\n\t\t// Ask the rule to get the next match if we've moved past the current one\n\t\tif(ruleInfo.matchIndex !== undefined && ruleInfo.matchIndex < startPos) {\n\t\t\truleInfo.matchIndex = ruleInfo.rule.findNextMatch(startPos);\n\t\t}\n\t\t// Adopt this match if it's closer than the current best match\n\t\tif(ruleInfo.matchIndex !== undefined && ruleInfo.matchIndex <= matchingRulePos) {\n\t\t\tmatchingRule = ruleInfo;\n\t\t\tmatchingRulePos = ruleInfo.matchIndex;\n\t\t}\n\t}\n\treturn matchingRule;\n};\n\n/*\nParse any pragmas at the beginning of a block of parse text\n*/\nWikiParser.prototype.parsePragmas = function() {\n\tvar tree = [];\n\twhile(true) {\n\t\t// Skip whitespace\n\t\tthis.skipWhitespace();\n\t\t// Check for the end of the text\n\t\tif(this.pos >= this.sourceLength) {\n\t\t\tbreak;\n\t\t}\n\t\t// Check if we've arrived at a pragma rule match\n\t\tvar nextMatch = this.findNextMatch(this.pragmaRules,this.pos);\n\t\t// If not, just exit\n\t\tif(!nextMatch || nextMatch.matchIndex !== this.pos) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the pragma rule\n\t\ttree.push.apply(tree,nextMatch.rule.parse());\n\t}\n\treturn tree;\n};\n\n/*\nParse a block from the current position\n\tterminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis\n*/\nWikiParser.prototype.parseBlock = function(terminatorRegExpString) {\n\tvar terminatorRegExp = terminatorRegExpString ? new RegExp(\"(\" + terminatorRegExpString + \"|\\\\r?\\\\n\\\\r?\\\\n)\",\"mg\") : /(\\r?\\n\\r?\\n)/mg;\n\tthis.skipWhitespace();\n\tif(this.pos >= this.sourceLength) {\n\t\treturn [];\n\t}\n\t// Look for a block rule that applies at the current position\n\tvar nextMatch = this.findNextMatch(this.blockRules,this.pos);\n\tif(nextMatch && nextMatch.matchIndex === this.pos) {\n\t\treturn nextMatch.rule.parse();\n\t}\n\t// Treat it as a paragraph if we didn't find a block rule\n\treturn [{type: \"element\", tag: \"p\", children: this.parseInlineRun(terminatorRegExp)}];\n};\n\n/*\nParse a series of blocks of text until a terminating regexp is encountered or the end of the text\n\tterminatorRegExpString: terminating regular expression\n*/\nWikiParser.prototype.parseBlocks = function(terminatorRegExpString) {\n\tif(terminatorRegExpString) {\n\t\treturn this.parseBlocksTerminated(terminatorRegExpString);\n\t} else {\n\t\treturn this.parseBlocksUnterminated();\n\t}\n};\n\n/*\nParse a block from the current position to the end of the text\n*/\nWikiParser.prototype.parseBlocksUnterminated = function() {\n\tvar tree = [];\n\twhile(this.pos < this.sourceLength) {\n\t\ttree.push.apply(tree,this.parseBlock());\n\t}\n\treturn tree;\n};\n\n/*\nParse blocks of text until a terminating regexp is encountered\n*/\nWikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {\n\tvar terminatorRegExp = new RegExp(\"(\" + terminatorRegExpString + \")\",\"mg\"),\n\t\ttree = [];\n\t// Skip any whitespace\n\tthis.skipWhitespace();\n\t// Check if we've got the end marker\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar match = terminatorRegExp.exec(this.source);\n\t// Parse the text into blocks\n\twhile(this.pos < this.sourceLength && !(match && match.index === this.pos)) {\n\t\tvar blocks = this.parseBlock(terminatorRegExpString);\n\t\ttree.push.apply(tree,blocks);\n\t\t// Skip any whitespace\n\t\tthis.skipWhitespace();\n\t\t// Check if we've got the end marker\n\t\tterminatorRegExp.lastIndex = this.pos;\n\t\tmatch = terminatorRegExp.exec(this.source);\n\t}\n\tif(match && match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t}\n\treturn tree;\n};\n\n/*\nParse a run of text at the current position\n\tterminatorRegExp: a regexp at which to stop the run\n\toptions: see below\nOptions available:\n\teatTerminator: move the parse position past any encountered terminator (default false)\n*/\nWikiParser.prototype.parseInlineRun = function(terminatorRegExp,options) {\n\tif(terminatorRegExp) {\n\t\treturn this.parseInlineRunTerminated(terminatorRegExp,options);\n\t} else {\n\t\treturn this.parseInlineRunUnterminated(options);\n\t}\n};\n\nWikiParser.prototype.parseInlineRunUnterminated = function(options) {\n\tvar tree = [];\n\t// Find the next occurrence of an inline rule\n\tvar nextMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t// Loop around the matches until we've reached the end of the text\n\twhile(this.pos < this.sourceLength && nextMatch) {\n\t\t// Process the text preceding the run rule\n\t\tif(nextMatch.matchIndex > this.pos) {\n\t\t\ttree.push({type: \"text\", text: this.source.substring(this.pos,nextMatch.matchIndex)});\n\t\t\tthis.pos = nextMatch.matchIndex;\n\t\t}\n\t\t// Process the run rule\n\t\ttree.push.apply(tree,nextMatch.rule.parse());\n\t\t// Look for the next run rule\n\t\tnextMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t}\n\t// Process the remaining text\n\tif(this.pos < this.sourceLength) {\n\t\ttree.push({type: \"text\", text: this.source.substr(this.pos)});\n\t}\n\tthis.pos = this.sourceLength;\n\treturn tree;\n};\n\nWikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {\n\toptions = options || {};\n\tvar tree = [];\n\t// Find the next occurrence of the terminator\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar terminatorMatch = terminatorRegExp.exec(this.source);\n\t// Find the next occurrence of a inlinerule\n\tvar inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t// Loop around until we've reached the end of the text\n\twhile(this.pos < this.sourceLength && (terminatorMatch || inlineRuleMatch)) {\n\t\t// Return if we've found the terminator, and it precedes any inline rule match\n\t\tif(terminatorMatch) {\n\t\t\tif(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {\n\t\t\t\tif(terminatorMatch.index > this.pos) {\n\t\t\t\t\ttree.push({type: \"text\", text: this.source.substring(this.pos,terminatorMatch.index)});\n\t\t\t\t}\n\t\t\t\tthis.pos = terminatorMatch.index;\n\t\t\t\tif(options.eatTerminator) {\n\t\t\t\t\tthis.pos += terminatorMatch[0].length;\n\t\t\t\t}\n\t\t\t\treturn tree;\n\t\t\t}\n\t\t}\n\t\t// Process any inline rule, along with the text preceding it\n\t\tif(inlineRuleMatch) {\n\t\t\t// Preceding text\n\t\t\tif(inlineRuleMatch.matchIndex > this.pos) {\n\t\t\t\ttree.push({type: \"text\", text: this.source.substring(this.pos,inlineRuleMatch.matchIndex)});\n\t\t\t\tthis.pos = inlineRuleMatch.matchIndex;\n\t\t\t}\n\t\t\t// Process the inline rule\n\t\t\ttree.push.apply(tree,inlineRuleMatch.rule.parse());\n\t\t\t// Look for the next inline rule\n\t\t\tinlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t\t\t// Look for the next terminator match\n\t\t\tterminatorRegExp.lastIndex = this.pos;\n\t\t\tterminatorMatch = terminatorRegExp.exec(this.source);\n\t\t}\n\t}\n\t// Process the remaining text\n\tif(this.pos < this.sourceLength) {\n\t\ttree.push({type: \"text\", text: this.source.substr(this.pos)});\n\t}\n\tthis.pos = this.sourceLength;\n\treturn tree;\n};\n\n/*\nParse zero or more class specifiers `.classname`\n*/\nWikiParser.prototype.parseClasses = function() {\n\tvar classRegExp = /\\.([^\\s\\.]+)/mg,\n\t\tclassNames = [];\n\tclassRegExp.lastIndex = this.pos;\n\tvar match = classRegExp.exec(this.source);\n\twhile(match && match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t\tclassNames.push(match[1]);\n\t\tvar match = classRegExp.exec(this.source);\n\t}\n\treturn classNames;\n};\n\n/*\nAmend the rules used by this instance of the parser\n\ttype: `only` keeps just the named rules, `except` keeps all but the named rules\n\tnames: array of rule names\n*/\nWikiParser.prototype.amendRules = function(type,names) {\n\tnames = names || [];\n\t// Define the filter function\n\tvar keepFilter;\n\tif(type === \"only\") {\n\t\tkeepFilter = function(name) {\n\t\t\treturn names.indexOf(name) !== -1;\n\t\t};\n\t} else if(type === \"except\") {\n\t\tkeepFilter = function(name) {\n\t\t\treturn names.indexOf(name) === -1;\n\t\t};\n\t} else {\n\t\treturn;\n\t}\n\t// Define a function to process each of our rule arrays\n\tvar processRuleArray = function(ruleArray) {\n\t\tfor(var t=ruleArray.length-1; t>=0; t--) {\n\t\t\tif(!keepFilter(ruleArray[t].rule.name)) {\n\t\t\t\truleArray.splice(t,1);\n\t\t\t}\n\t\t}\n\t};\n\t// Process each rule array\n\tprocessRuleArray(this.pragmaRules);\n\tprocessRuleArray(this.blockRules);\n\tprocessRuleArray(this.inlineRules);\n}\n\nexports[\"text/vnd.tiddlywiki\"] = WikiParser;\n\n})();\n\n",
"title": "$:/core/modules/parsers/wikiparser/wikiparser.js",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/wikiparser/rules/wikirulebase.js": {
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/wikirulebase.js\ntype: application/javascript\nmodule-type: global\n\nBase class for wiki parser rules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nThis constructor is always overridden with a blank constructor, and so shouldn't be used\n*/\nvar WikiRuleBase = function() {\n};\n\n/*\nTo be overridden by individual rules\n*/\nWikiRuleBase.prototype.init = function(parser) {\n\tthis.parser = parser;\n};\n\n/*\nDefault implementation of findNextMatch uses RegExp matching\n*/\nWikiRuleBase.prototype.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\treturn this.match ? this.match.index : undefined;\n};\n\nexports.WikiRuleBase = WikiRuleBase;\n\n})();\n",
"title": "$:/core/modules/parsers/wikiparser/rules/wikirulebase.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/rendertree/renderers/element.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/renderers/element.js\ntype: application/javascript\nmodule-type: wikirenderer\n\nElement renderer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nElement widget. A degenerate widget that renders ordinary HTML elements\n*/\nvar ElementWidget = function(renderer) {\n\tthis.renderer = renderer;\n\tthis.tag = this.renderer.parseTreeNode.tag;\n\tthis.attributes = this.renderer.attributes;\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n\tthis.events = this.renderer.parseTreeNode.events;\n};\n\nElementWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Check if any of our attribute dependencies have changed\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\t// Update our attributes\n\t\tthis.renderer.assignAttributes();\n\t}\n\t// Refresh any child nodes\n\t$tw.utils.each(this.children,function(node) {\n\t\tif(node.refreshInDom) {\n\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t}\n\t});\n};\n\n/*\nElement renderer\n*/\nvar ElementRenderer = function(renderTree,parentRenderer,parseTreeNode) {\n\t// Store state information\n\tthis.renderTree = renderTree;\n\tthis.parentRenderer = parentRenderer;\n\tthis.parseTreeNode = parseTreeNode;\n\t// Initialise widget classes\n\tif(!this.widgetClasses) {\n\t\tElementRenderer.prototype.widgetClasses = $tw.modules.applyMethods(\"widget\");\n\t}\n\t// Select the namespace for the tag\n\tvar tagNameSpaces = {\n\t\tsvg: \"http://www.w3.org/2000/svg\"\n\t};\n\tthis.namespace = tagNameSpaces[this.parseTreeNode.tag];\n\tif(this.namespace) {\n\t\tthis.context = this.context || {};\n\t\tthis.context.namespace = this.namespace;\n\t} else {\n\t\tthis.namespace = this.renderTree.getContextVariable(this.parentRenderer,\"namespace\",\"http://www.w3.org/1999/xhtml\");\n\t}\n\t// Get the context tiddler title\n\tthis.tiddlerTitle = this.renderTree.getContextVariable(this.parentRenderer,\"tiddlerTitle\");\n\t// Compute our dependencies\n\tthis.dependencies = {};\n\tvar self = this;\n\t$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {\n\t\tif(attribute.type === \"indirect\") {\n\t\t\tvar tr = $tw.utils.parseTextReference(attribute.textReference);\n\t\t\tself.dependencies[tr.title ? tr.title : self.tiddlerTitle] = true;\n\t\t}\n\t});\n\t// Compute our attributes\n\tthis.attributes = {};\n\tthis.computeAttributes();\n\t// Create the parasite widget object if required\n\tif(this.parseTreeNode.tag.charAt(0) === \"$\") {\n\t\t// Choose the class\n\t\tvar WidgetClass = this.widgetClasses[this.parseTreeNode.tag.substr(1)];\n\t\t// Instantiate the widget\n\t\tif(WidgetClass) {\n\t\t\tthis.widget = new WidgetClass(this);\n\t\t} else {\n\t\t\tWidgetClass = this.widgetClasses.error;\n\t\t\tif(WidgetClass) {\n\t\t\t\tthis.widget = new WidgetClass(this,\"Unknown widget '<\" + this.parseTreeNode.tag + \">'\");\n\t\t\t}\n\t\t}\n\t}\n\t// If we haven't got a widget, use the generic HTML element widget\n\tif(!this.widget) {\n\t\tthis.widget = new ElementWidget(this);\n\t}\n};\n\nElementRenderer.prototype.computeAttributes = function() {\n\tvar changedAttributes = {},\n\t\tself = this,\n\t\tvalue;\n\t$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {\n\t\tif(attribute.type === \"indirect\") {\n\t\t\tvalue = self.renderTree.wiki.getTextReference(attribute.textReference,\"\",self.tiddlerTitle);\n\t\t} else if(attribute.type === \"macro\") {\n\t\t\t// Get the macro definition\n\t\t\tvar macro = self.renderTree.findMacroDefinition(self.parentRenderer,attribute.value.name);\n\t\t\tif(!macro) {\n\t\t\t\tvalue = \"\";\n\t\t\t} else {\n\t\t\t\t// Substitute the macro parameters\n\t\t\t\tvalue = self.renderTree.substituteParameters(macro,attribute.value);\n\t\t\t\t// Parse the text and render it as text\n\t\t\t\tvalue = self.renderTree.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",value,self.context);\n\t\t\t}\n\t\t} else { // String attribute\n\t\t\tvalue = attribute.value;\n\t\t}\n\t\t// Check whether the attribute has changed\n\t\tif(self.attributes[name] !== value) {\n\t\t\tself.attributes[name] = value;\n\t\t\tchangedAttributes[name] = true;\n\t\t}\n\t});\n\treturn changedAttributes;\n};\n\nElementRenderer.prototype.hasAttribute = function(name) {\n\treturn $tw.utils.hop(this.attributes,name);\n};\n\nElementRenderer.prototype.getAttribute = function(name,defaultValue) {\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\treturn this.attributes[name];\n\t} else {\n\t\treturn defaultValue;\n\t}\n};\n\nElementRenderer.prototype.renderInDom = function() {\n\t// Check if our widget is providing an element\n\tif(this.widget.tag) {\n\t\t// Create the element\n\t\tthis.domNode = this.renderTree.document.createElementNS(this.namespace,this.widget.tag);\n\t\t// Assign any specified event handlers\n\t\t$tw.utils.addEventListeners(this.domNode,this.widget.events);\n\t\t// Assign the attributes\n\t\tthis.assignAttributes();\n\t\t// Render any child nodes\n\t\tvar self = this;\n\t\t$tw.utils.each(this.widget.children,function(node) {\n\t\t\tif(node.renderInDom) {\n\t\t\t\tself.domNode.appendChild(node.renderInDom());\n\t\t\t}\n\t\t});\n\t\t// Call postRenderInDom if the widget provides it and we're in the browser\n\t\tif($tw.browser && this.widget.postRenderInDom) {\n\t\t\tthis.widget.postRenderInDom();\n\t\t}\n\t\t// Return the dom node\n\t\treturn this.domNode;\n\t} else {\n\t\t// If we're not generating an element, just render our first child\n\t\treturn this.widget.children[0].renderInDom();\n\t}\n};\n\nElementRenderer.prototype.assignAttributes = function() {\n\tvar self = this;\n\t$tw.utils.each(this.widget.attributes,function(v,a) {\n\t\tif(v !== undefined) {\n\t\t\tif($tw.utils.isArray(v)) { // Ahem, could there be arrays other than className?\n\t\t\t\tself.domNode.className = v.join(\" \"); \n\t\t\t} else if (typeof v === \"object\") { // ...or objects other than style?\n\t\t\t\tfor(var p in v) {\n\t\t\t\t\tself.domNode.style[$tw.utils.unHyphenateCss(p)] = v[p];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)\n\t\t\t\ttry {\n\t\t\t\t\tself.domNode.setAttributeNS(null,a,v);\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n};\n\nElementRenderer.prototype.refreshInDom = function(changedTiddlers) {\n\t// Update our attributes if required\n\tvar changedAttributes = {};\n\tif($tw.utils.checkDependencies(this.dependencies,changedTiddlers)) {\n\t\tchangedAttributes = this.computeAttributes();\n\t}\n\t// Check if the widget has a refreshInDom method\n\tif(this.widget.refreshInDom) {\n\t\t// Let the widget refresh itself\n\t\tthis.widget.refreshInDom(changedAttributes,changedTiddlers);\n\t} else {\n\t\t// If not, assign the attributes and refresh any child nodes\n\t\tthis.assignAttributes();\n\t\t$tw.utils.each(this.widget.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.element = ElementRenderer\n\n})();\n",
"title": "$:/core/modules/rendertree/renderers/element.js",
"type": "application/javascript",
"module-type": "wikirenderer"
},
"$:/core/modules/rendertree/renderers/entity.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/renderers/entity.js\ntype: application/javascript\nmodule-type: wikirenderer\n\nEntity renderer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nEntity renderer\n*/\nvar EntityRenderer = function(renderTree,parentRenderer,parseTreeNode) {\n\t// Store state information\n\tthis.renderTree = renderTree;\n\tthis.parentRenderer = parentRenderer;\n\tthis.parseTreeNode = parseTreeNode;\n};\n\nEntityRenderer.prototype.renderInDom = function() {\n\treturn this.renderTree.document.createTextNode($tw.utils.entityDecode(this.parseTreeNode.entity));\n};\n\nexports.entity = EntityRenderer\n\n})();\n",
"title": "$:/core/modules/rendertree/renderers/entity.js",
"type": "application/javascript",
"module-type": "wikirenderer"
},
"$:/core/modules/rendertree/renderers/macrocall.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/renderers/macrocall.js\ntype: application/javascript\nmodule-type: wikirenderer\n\nMacro call renderer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nMacro call renderer\n*/\nvar MacroCallRenderer = function(renderTree,parentRenderer,parseTreeNode) {\n\t// Store state information\n\tthis.renderTree = renderTree;\n\tthis.parentRenderer = parentRenderer;\n\tthis.parseTreeNode = parseTreeNode;\n\t// Find the macro definition\n\tvar macro = this.renderTree.findMacroDefinition(this.parentRenderer,this.parseTreeNode.name);\n\t// Insert an error message if we couldn't find the macro\n\tvar childTree;\n\tif(!macro) {\n\t\tchildTree = [{type: \"text\", text: \"<<Undefined macro: \" + this.parseTreeNode.name + \">>\"}];\n\t} else {\n\t\t// Substitute the macro parameters\n\t\tvar text = this.renderTree.substituteParameters(macro,this.parseTreeNode);\n\t\t// Parse the text\n\t\tchildTree = this.renderTree.wiki.parseText(\"text/vnd.tiddlywiki\",text,{parseAsInline: !this.parseTreeNode.isBlock}).tree;\n\t}\n\t// Create the renderers for the child nodes\n\tthis.children = this.renderTree.createRenderers(this,childTree);\n};\n\nMacroCallRenderer.prototype.renderInDom = function() {\n\t// Create the element\n\tthis.domNode = this.renderTree.document.createElement(this.parseTreeNode.isBlock ? \"div\" : \"span\");\n\tthis.domNode.setAttribute(\"data-macro-name\",this.parseTreeNode.name);\n\t// Render any child nodes\n\tvar self = this;\n\t$tw.utils.each(this.children,function(node,index) {\n\t\tif(node.renderInDom) {\n\t\t\tself.domNode.appendChild(node.renderInDom());\n\t\t}\n\t});\n\t// Return the dom node\n\treturn this.domNode;\n};\n\nMacroCallRenderer.prototype.refreshInDom = function(changedTiddlers) {\n\t// Refresh any child nodes\n\t$tw.utils.each(this.children,function(node) {\n\t\tif(node.refreshInDom) {\n\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t}\n\t});\n};\n\nexports.macrocall = MacroCallRenderer\n\n})();\n",
"title": "$:/core/modules/rendertree/renderers/macrocall.js",
"type": "application/javascript",
"module-type": "wikirenderer"
},
"$:/core/modules/rendertree/renderers/macrodef.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/renderers/macrodef.js\ntype: application/javascript\nmodule-type: wikirenderer\n\nMacro definition renderer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nMacro definition renderer\n*/\nvar MacroDefRenderer = function(renderTree,parentRenderer,parseTreeNode) {\n\t// Store state information\n\tthis.renderTree = renderTree;\n\tthis.parentRenderer = parentRenderer;\n\tthis.parseTreeNode = parseTreeNode;\n\t// Save the macro definition into the context of the rendertree\n\tthis.renderTree.context.macroDefinitions = this.renderTree.context.macroDefinitions || {};\n\tthis.renderTree.context.macroDefinitions[this.parseTreeNode.name] = this.parseTreeNode;\n};\n\nexports.macrodef = MacroDefRenderer\n\n})();\n",
"title": "$:/core/modules/rendertree/renderers/macrodef.js",
"type": "application/javascript",
"module-type": "wikirenderer"
},
"$:/core/modules/rendertree/renderers/raw.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/renderers/raw.js\ntype: application/javascript\nmodule-type: wikirenderer\n\nRaw HTML renderer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nRaw HTML renderer\n*/\nvar RawRenderer = function(renderTree,parentRenderer,parseTreeNode) {\n\t// Store state information\n\tthis.renderTree = renderTree;\n\tthis.parentRenderer = parentRenderer;\n\tthis.parseTreeNode = parseTreeNode;\n};\n\nRawRenderer.prototype.renderInDom = function() {\n\tvar domNode = this.renderTree.document.createElement(\"div\");\n\tdomNode.innerHTML = this.parseTreeNode.html;\n\treturn domNode;\n};\n\nexports.raw = RawRenderer\n\n})();\n",
"title": "$:/core/modules/rendertree/renderers/raw.js",
"type": "application/javascript",
"module-type": "wikirenderer"
},
"$:/core/modules/rendertree/renderers/text.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/renderers/text.js\ntype: application/javascript\nmodule-type: wikirenderer\n\nText renderer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nText renderer\n*/\nvar TextRenderer = function(renderTree,parentRenderer,parseTreeNode) {\n\t// Store state information\n\tthis.renderTree = renderTree;\n\tthis.parentRenderer = parentRenderer;\n\tthis.parseTreeNode = parseTreeNode;\n};\n\nTextRenderer.prototype.renderInDom = function() {\n\treturn this.renderTree.document.createTextNode(this.parseTreeNode.text);\n};\n\nexports.text = TextRenderer\n\n})();\n",
"title": "$:/core/modules/rendertree/renderers/text.js",
"type": "application/javascript",
"module-type": "wikirenderer"
},
"$:/core/modules/rendertree/wikirendertree.js": {
"text": "/*\\\ntitle: $:/core/modules/rendertree/wikirendertree.js\ntype: application/javascript\nmodule-type: global\n\nWiki text render tree\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreate a render tree object for a parse tree\n\tparser: reference to the parse tree to be rendered\n\toptions: see below\nOptions include:\n\twiki: mandatory reference to wiki associated with this render tree\n\tcontext: optional hashmap of context variables (see below)\n\tparentRenderer: optional reference to a parent renderer node for the context chain\n\tdocument: optional document object to use instead of global document\nContext variables include:\n\ttiddlerTitle: title of the tiddler providing the context\n\ttemplateTitle: title of the tiddler providing the current template\n\tmacroDefinitions: hashmap of macro definitions\n*/\nvar WikiRenderTree = function(parser,options) {\n\tthis.parser = parser;\n\tthis.wiki = options.wiki;\n\tthis.context = options.context || {};\n\tthis.parentRenderer = options.parentRenderer;\n\tthis.document = options.document;\n\t// Hashmap of the renderer classes\n\tif(!this.rendererClasses) {\n\t\tWikiRenderTree.prototype.rendererClasses = $tw.modules.applyMethods(\"wikirenderer\");\n\t}\n};\n\n/*\nGenerate the full render tree for this parse tree\n*/\nWikiRenderTree.prototype.execute = function() {\n\tthis.rendererTree = this.createRenderers(this,this.parser.tree);\n};\n\n/*\nCreate an array of renderers for an array of parse tree nodes\n*/\nWikiRenderTree.prototype.createRenderers = function(parentRenderer,parseTreeNodes) {\n\tvar rendererNodes = [];\n\tif(parseTreeNodes) {\n\t\tfor(var t=0; t<parseTreeNodes.length; t++) {\n\t\t\trendererNodes.push(this.createRenderer(parentRenderer,parseTreeNodes[t]));\n\t\t}\n\t}\n\treturn rendererNodes;\n};\t\n\n/*\nCreate a renderer node for a parse tree node\n*/\nWikiRenderTree.prototype.createRenderer = function(parentRenderer,parseTreeNode) {\n\tvar RenderNodeClass = this.rendererClasses[parseTreeNode.type];\n\treturn new RenderNodeClass(this,parentRenderer,parseTreeNode);\n};\n\n/*\nRender to the DOM\n*/\nWikiRenderTree.prototype.renderInDom = function(container) {\n\tthis.container = container;\n\t$tw.utils.each(this.rendererTree,function(node) {\n\t\tif(node.renderInDom) {\n\t\t\tcontainer.appendChild(node.renderInDom());\n\t\t}\n\t});\n};\n\n/*\nUpdate the DOM rendering in the light of a set of changes\n*/\nWikiRenderTree.prototype.refreshInDom = function(changes) {\n\t$tw.utils.each(this.rendererTree,function(node) {\n\t\tif(node.refreshInDom) {\n\t\t\tnode.refreshInDom(changes);\n\t\t}\n\t});\n};\n\n/*\nFind the value of a given context variable for a particular renderer node\n*/\nWikiRenderTree.prototype.getContextVariable = function(renderer,name,defaultValue) {\n\twhile(renderer) {\n\t\tif($tw.utils.hop(renderer.context,name)) {\n\t\t\treturn renderer.context[name];\n\t\t}\n\t\trenderer = renderer.parentRenderer;\n\t};\n\treturn defaultValue;\n};\n\n/*\nCheck for render context recursion from a particular renderer node by returning true if the members of a proposed new render context are already present in the render context chain\n*/\nWikiRenderTree.prototype.checkContextRecursion = function(renderer,newContext) {\n\twhile(renderer) {\n\t\tvar context = renderer.context;\n\t\tif(context) {\n\t\t\tvar match = true;\n\t\t\tfor(var member in newContext) {\n\t\t\t\tif($tw.utils.hop(context,member)) {\n\t\t\t\t\tif(newContext[member] !== context[member]) {\n\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmatch = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(match) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\trenderer = renderer.parentRenderer;\n\t}\n\treturn false;\n};\n\nWikiRenderTree.prototype.getContextScopeId = function(renderer) {\n\tvar guidBits = [],\n\t\tscopeComponents = [\"tiddlerTitle\",\"templateTitle\"],\n\t\tprocessContext = function(field,name) {\n\t\t\t\tif(scopeComponents.indexOf(name) !== -1) {\n\t\t\t\t\tguidBits.push(name + \":\" + field + \";\");\n\t\t\t\t}\n\t\t\t};\n\twhile(renderer) {\n\t\tif(renderer.context) {\n\t\t\t$tw.utils.each(renderer.context,processContext);\n\t\t\tguidBits.push(\"-\");\n\t\t}\n\t\trenderer = renderer.parentRenderer;\n\t}\n\treturn guidBits.join(\"\");\n};\n\n/*\nFind a named macro definition\n*/\nWikiRenderTree.prototype.findMacroDefinition = function(renderer,name) {\n\twhile(renderer) {\n\t\tif(renderer.context && renderer.context.macroDefinitions && renderer.context.macroDefinitions[name]) {\n\t\t\treturn renderer.context.macroDefinitions[name];\n\t\t}\n\t\trenderer = renderer.parentRenderer;\n\t}\n\treturn undefined;\n};\n\n/*\nExpand the parameters of a macro\n*/\nWikiRenderTree.prototype.substituteParameters = function(macroDefinition,macroCallParseTreeNode) {\n\tvar text = macroDefinition.text,\n\t\tnextAnonParameter = 0; // Next candidate anonymous parameter in macro call\n\t// Step through each of the parameters in the macro definition\n\tfor(var p=0; p<macroDefinition.params.length; p++) {\n\t\t// Check if we've got a macro call parameter with the same name\n\t\tvar paramInfo = macroDefinition.params[p],\n\t\t\tparamValue = undefined;\n\t\tfor(var m=0; m<macroCallParseTreeNode.params.length; m++) {\n\t\t\tif(macroCallParseTreeNode.params[m].name === paramInfo.name) {\n\t\t\t\tparamValue = macroCallParseTreeNode.params[m].value;\n\t\t\t}\n\t\t}\n\t\t// If not, use the next available anonymous macro call parameter\n\t\tif(!paramValue && macroCallParseTreeNode.params.length > 0) {\n\t\t\twhile(macroCallParseTreeNode.params[nextAnonParameter].name && nextAnonParameter < macroCallParseTreeNode.params.length-1) {\n\t\t\t\tnextAnonParameter++;\n\t\t\t}\n\t\t\tif(!macroCallParseTreeNode.params[nextAnonParameter].name) {\n\t\t\t\tparamValue = macroCallParseTreeNode.params[nextAnonParameter].value;\n\t\t\t\tnextAnonParameter++;\n\t\t\t}\n\t\t}\n\t\t// If we've still not got a value, use the default, if any\n\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t// Replace any instances of this parameter\n\t\ttext = text.replace(new RegExp(\"\\\\$\" + $tw.utils.escapeRegExp(paramInfo.name) + \"\\\\$\",\"mg\"),paramValue);\n\t}\n\treturn text;\n};\n\nexports.WikiRenderTree = WikiRenderTree;\n\n})();\n",
"title": "$:/core/modules/rendertree/wikirendertree.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/savers/download.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/download.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via HTML5's download APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar DownloadSaver = function(wiki) {\n};\n\nDownloadSaver.prototype.save = function(text) {\n\t// Set up the link\n\tvar link = document.createElement(\"a\");\n\tlink.setAttribute(\"target\",\"_blank\");\n\tlink.setAttribute(\"href\",\"data:text/html,\" + encodeURIComponent(text));\n\tlink.setAttribute(\"download\",\"tiddlywiki.html\");\n\tdocument.body.appendChild(link);\n\tlink.click();\n\tdocument.body.removeChild(link);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nDownloadSaver.prototype.info = {\n\tname: \"download\",\n\tpriority: 100\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn document.createElement(\"a\").download !== undefined;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new DownloadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/download.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/manualdownload.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/manualdownload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via HTML5's download APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Title of the tiddler containing the download message\nvar downloadInstructionsTitle = \"$:/messages/Download\"\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar ManualDownloadSaver = function(wiki) {\n};\n\nManualDownloadSaver.prototype.save = function(text) {\n\t$tw.modal.display(downloadInstructionsTitle,{\n\t\tdownloadLink: \"data:text/html,\" + encodeURIComponent(text)\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nManualDownloadSaver.prototype.info = {\n\tname: \"manualdownload\",\n\tpriority: 0\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new ManualDownloadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/manualdownload.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/tiddlyfox.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/tiddlyfox.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the TiddlyFox file extension\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar TiddlyFoxSaver = function(wiki) {\n};\n\nTiddlyFoxSaver.prototype.save = function(text,callback) {\n\tvar messageBox = document.getElementById(\"tiddlyfox-message-box\");\n\tif(messageBox) {\n\t\t// Get the pathname of this document\n\t\tvar pathname = document.location.pathname;\n\t\t// Test for a Windows path of the form /x:/blah/blah\n\t\tif(/^\\/[A-Z]\\:\\//.test(pathname)) {\n\t\t\t// Remove the leading slash\n\t\t\tpathname = pathname.substr(1);\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t\t}\n\t\t// Create the message element and put it in the message box\n\t\tvar message = document.createElement(\"div\");\n\t\tmessage.setAttribute(\"data-tiddlyfox-path\",decodeURIComponent(pathname));\n\t\tmessage.setAttribute(\"data-tiddlyfox-content\",text);\n\t\tmessageBox.appendChild(message);\n\t\t// Add an event handler for when the file has been saved\n\t\tmessage.addEventListener(\"tiddlyfox-have-saved-file\",function(event) {\n\t\t\tcallback(null);\n\t\t}, false);\n\t\t// Create and dispatch the custom event to the extension\n\t\tvar event = document.createEvent(\"Events\");\n\t\tevent.initEvent(\"tiddlyfox-save-file\",true,false);\n\t\tmessage.dispatchEvent(event);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nInformation about this saver\n*/\nTiddlyFoxSaver.prototype.info = {\n\tname: \"tiddlyfox\",\n\tpriority: 1500\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn (window.location.protocol === \"file:\");\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyFoxSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/tiddlyfox.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/twedit.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/twedit.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the TWEdit iOS app\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar TWEditSaver = function(wiki) {\n};\n\nTWEditSaver.prototype.save = function(text,callback) {\n\t// Bail if we're not running under TWEdit\n\tif(typeof DeviceInfo !== \"object\") {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = decodeURIComponent(document.location.pathname);\n\t// Strip any query or location part\n\tvar p = pathname.indexOf(\"?\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\tp = pathname.indexOf(\"#\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\t// Remove the leading \"/Documents\" from path\n\tvar prefix = \"/Documents\";\n\tif(pathname.indexOf(prefix) === 0) {\n\t\tpathname = pathname.substr(prefix.length);\n\t}\n\t// Error handler\n\tvar errorHandler = function(event) {\n \t// Error\n \tcallback(\"Error saving to TWEdit: \" + event.target.error.code);\n };\n\t// Get the file system\n window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem) {\n \t// Now we've got the filesystem, get the fileEntry\n fileSystem.root.getFile(pathname, {create: true}, function(fileEntry) {\n \t// Now we've got the fileEntry, create the writer\n \tfileEntry.createWriter(function(writer) {\n\t\t writer.onerror = errorHandler;\n\t\t writer.onwrite = function() {\n\t\t \tcallback(null);\n\t\t };\n\t\t writer.position = 0;\n\t\t writer.write(text);\n \t},errorHandler);\n }, errorHandler);\n }, errorHandler);\n return true;\n};\n\n/*\nInformation about this saver\n*/\nTWEditSaver.prototype.info = {\n\tname: \"twedit\",\n\tpriority: 1600\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TWEditSaver(wiki);\n};\n\n/////////////////////////// Hack\n// HACK: This ensures that TWEdit recognises us as a TiddlyWiki document\nif($tw.browser) {\n\twindow.version = {title: \"TiddlyWiki\"};\n}\n\n})();\n",
"title": "$:/core/modules/savers/twedit.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/upload.js": {
"text": "/*\\\ntitle: $:/core/modules/savers/upload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via upload to a server.\n\nDesigned to be compatible with BidiX's UploadPlugin at http://tiddlywiki.bidix.info/#UploadPlugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar UploadSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nUploadSaver.prototype.save = function(text) {\n\t// Get the various parameters we need\n\tvar backupDir = \".\",\n\t\tusername = this.wiki.getTextReference(\"$:/UploadName\"),\n\t\tpassword = $tw.utils.getPassword(\"upload\"),\n\t\tuploadDir = \".\",\n\t\turl = this.wiki.getTextReference(\"$:/UploadURL\");\n\t// Bail out if we don't have the bits we need\n\tif(!username || username.toString().trim() === \"\" || !password || password.toString().trim() === \"\") {\n\t\treturn false;\n\t}\n\t// Construct the url if not provided\n\tif(!url) {\n\t\turl = \"http://\" + username + \".tiddlyspot.com/store.cgi\";\n\t}\n\t// Assemble the header\n\tvar boundary = \"---------------------------\" + \"AaB03x\";\t\n\tvar uploadFormName = \"UploadPlugin\";\n\tvar head = [];\n\thead.push(\"--\" + boundary + \"\\r\\nContent-disposition: form-data; name=\\\"UploadPlugin\\\"\\r\\n\");\n\thead.push(\"backupDir=\" + backupDir + \";user=\" + username + \";password=\" + password + \";uploaddir=\" + uploadDir + \";;\"); \n\thead.push(\"\\r\\n\" + \"--\" + boundary);\n\thead.push(\"Content-disposition: form-data; name=\\\"userfile\\\"; filename=\\\"index.html\\\"\");\n\thead.push(\"Content-Type: text/html;charset=UTF-8\");\n\thead.push(\"Content-Length: \" + text.length + \"\\r\\n\");\n\thead.push(\"\");\n\t// Assemble the tail and the data itself\n\tvar tail = \"\\r\\n--\" + boundary + \"--\\r\\n\",\n\t\tdata = head.join(\"\\r\\n\") + text + tail;\n\t// Do the HTTP post\n\tvar http = new XMLHttpRequest();\n\thttp.open(\"POST\",url,true,username,password);\n\thttp.setRequestHeader(\"Content-Type\",\"multipart/form-data; ;charset=UTF-8; boundary=\" + boundary);\n\thttp.onreadystatechange = function() {\n\t\tif(http.readyState == 4 && http.status == 200) {\n\t\t\twindow.alert(http.responseText);\n\t\t}\n\t};\n\thttp.send(data);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nUploadSaver.prototype.info = {\n\tname: \"upload\",\n\tpriority: 500\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new UploadSaver(wiki);\n};\n\n})();\n",
"title": "$:/core/modules/savers/upload.js",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/startup.js": {
"text": "/*\\\ntitle: $:/core/modules/startup.js\ntype: application/javascript\nmodule-type: startup\n\nThis is the main application logic for both the client and server\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.startup = function() {\n\tvar modules,n,m,f,commander;\n\t// Load modules\n\t$tw.modules.applyMethods(\"global\",$tw);\n\t$tw.modules.applyMethods(\"config\",$tw.config);\n\t$tw.modules.applyMethods(\"utils\",$tw.utils);\n\tif($tw.browser) {\n\t\t$tw.utils.getBrowserInfo($tw.browser);\n\t}\n\t$tw.version = $tw.utils.extractVersionInfo();\n\t$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap(\"tiddlerfield\");\n\t$tw.modules.applyMethods(\"tiddlermethod\",$tw.Tiddler.prototype);\n\t$tw.modules.applyMethods(\"wikimethod\",$tw.Wiki.prototype);\n\t$tw.modules.applyMethods(\"tiddlerdeserializer\",$tw.Wiki.tiddlerDeserializerModules);\n\t// Set up the parsers\n\t$tw.wiki.initParsers();\n\t// Set up the syncer object\n\t$tw.syncer = new $tw.Syncer({wiki: $tw.wiki});\n\t// Set up the command modules\n\t$tw.Commander.initCommands();\n\t// Kick off the theme manager\n\t$tw.themeManager = new $tw.ThemeManager($tw.wiki);\n\t// Get the default tiddlers\n\tvar defaultTiddlersTitle = \"$:/DefaultTiddlers\",\n\t\tdefaultTiddlersTiddler = $tw.wiki.getTiddler(defaultTiddlersTitle),\n\t\tdefaultTiddlers = [];\n\tif(defaultTiddlersTiddler) {\n\t\tdefaultTiddlers = $tw.wiki.filterTiddlers(defaultTiddlersTiddler.fields.text);\n\t}\n\t// Initialise the story and history\n\tvar storyTitle = \"$:/StoryList\",\n\t\tstory = [];\n\tfor(var t=0; t<defaultTiddlers.length; t++) {\n\t\tstory[t] = defaultTiddlers[t];\n\t}\n\t$tw.wiki.addTiddler({title: storyTitle, text: story.join(\"\\n\")});\n\t// Host-specific startup\n\tif($tw.browser) {\n\t\t// Call browser startup modules\n\t\t$tw.modules.forEachModuleOfType(\"browser-startup\",function(title,module) {\n\t\t\tif(module.startup) {\n\t\t\t\tmodule.startup();\n\t\t\t}\n\t\t});\n\t\t// Install the popup manager\n\t\t$tw.popup = new $tw.utils.Popup({\n\t\t\trootElement: document.body\n\t\t});\n\t\t// Install the modal message mechanism\n\t\t$tw.modal = new $tw.utils.Modal($tw.wiki);\n\t\tdocument.addEventListener(\"tw-modal\",function(event) {\n\t\t\t$tw.modal.display(event.param);\n\t\t},false);\n\t\t// Install the notification mechanism\n\t\t$tw.notifier = new $tw.utils.Notifier($tw.wiki);\n\t\tdocument.addEventListener(\"tw-notify\",function(event) {\n\t\t\t$tw.notifier.display(event.param);\n\t\t},false);\n\t\t// Install the scroller\n\t\t$tw.pageScroller = new $tw.utils.PageScroller();\n\t\tdocument.addEventListener(\"tw-scroll\",$tw.pageScroller,false);\n\t\t// Install the save action handler\n\t\t$tw.wiki.initSavers();\n\t\tdocument.addEventListener(\"tw-save-wiki\",function(event) {\n\t\t\t$tw.wiki.saveWiki({\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \"text/plain\"\n\t\t\t});\n\t\t},false);\n\t\t// Install the crypto event handlers\n\t\tdocument.addEventListener(\"tw-set-password\",function(event) {\n\t\t\t$tw.passwordPrompt.createPrompt({\n\t\t\t\tserviceName: \"Set a new password for this TiddlyWiki\",\n\t\t\t\tnoUserName: true,\n\t\t\t\tsubmitText: \"Set password\",\n\t\t\t\tcallback: function(data) {\n\t\t\t\t\t$tw.crypto.setPassword(data.password);\n\t\t\t\t\treturn true; // Get rid of the password prompt\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tdocument.addEventListener(\"tw-clear-password\",function(event) {\n\t\t\t$tw.crypto.setPassword(null);\n\t\t});\n\t\t// Install the animator\n\t\t$tw.anim = new $tw.utils.Animator();\n\t\t// Kick off the stylesheet manager\n\t\t$tw.stylesheetManager = new $tw.utils.StylesheetManager($tw.wiki);\n\t\t// Display the PageTemplate\n\t\tvar templateTitle = \"$:/core/ui/PageTemplate\",\n\t\t\tparser = $tw.wiki.parseTiddler(templateTitle),\n\t\t\trenderTree = new $tw.WikiRenderTree(parser,{wiki: $tw.wiki, context: {tiddlerTitle: templateTitle}, document: document});\n\t\trenderTree.execute();\n\t\t$tw.pageContainer = document.createElement(\"div\");\n\t\t$tw.utils.addClass($tw.pageContainer,\"tw-page-container\");\n\t\tdocument.body.insertBefore($tw.pageContainer,document.body.firstChild);\n\t\trenderTree.renderInDom($tw.pageContainer);\n\t\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t\trenderTree.refreshInDom(changes);\n\t\t});\n\t\t// If we're being viewed on a data: URI then give instructions for how to save\n\t\tif(document.location.protocol === \"data:\") {\n\t\t\t$tw.utils.dispatchCustomEvent(document,\"tw-modal\",{\n\t\t\t\tparam: \"$:/messages/SaveInstructions\"\n\t\t\t});\n\t\t} else if($tw.wiki.countTiddlers() === 0){\n\t\t\t// Otherwise, if give instructions if this is an empty TiddlyWiki\n\t\t\t$tw.utils.dispatchCustomEvent(document,\"tw-modal\",{\n\t\t\t\tparam: \"$:/messages/GettingStarted\"\n\t\t\t});\n\t\t}\n\t} else {\n\t\t// On the server, start a commander with the command line arguments\n\t\tcommander = new $tw.Commander(\n\t\t\t$tw.boot.argv,\n\t\t\tfunction(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\tconsole.log(\"Error: \" + err);\n\t\t\t\t}\n\t\t\t},\n\t\t\t$tw.wiki,\n\t\t\t{output: process.stdout, error: process.stderr}\n\t\t);\n\t\tcommander.execute();\n\t}\n\n};\n\n})();\n",
"title": "$:/core/modules/startup.js",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/syncer.js": {
"text": "/*\\\ntitle: $:/core/modules/syncer.js\ntype: application/javascript\nmodule-type: global\n\nThe syncer transfers content to and from data sources using syncadaptor modules.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInstantiate the syncer with the following options:\nwiki: wiki to be synced\n*/\nfunction Syncer(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\t// Find a working syncadaptor\n\tthis.syncadaptor = undefined;\n\t$tw.modules.forEachModuleOfType(\"syncadaptor\",function(title,module) {\n\t\tif(!self.syncadaptor && module.adaptorClass) {\n\t\t\tself.syncadaptor = new module.adaptorClass(self);\n\t\t}\n\t});\n\t// Only do anything if we've got a syncadaptor\n\tif(this.syncadaptor) {\n\t\tthis.init();\n\t}\n}\n\n/*\nError handling\n*/\nSyncer.prototype.showError = function(error) {\n\talert(\"Syncer error: \" + error);\n\t$tw.utils.log(\"Syncer error: \" + error);\n};\n\n/*\nMessage logging\n*/\nSyncer.prototype.log = function(/* arguments */) {\n\tvar args = Array.prototype.slice.call(arguments,0);\n\targs[0] = \"Syncer: \" + args[0];\n\t// Temporarily disable logging to help the wood vs. trees situation; we need better filtering of log messages\n\t//$tw.utils.log.apply(null,args);\n};\n\n/*\nConstants\n*/\nSyncer.prototype.titleIsLoggedIn = \"$:/status/IsLoggedIn\";\nSyncer.prototype.titleUserName = \"$:/status/UserName\";\nSyncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer\nSyncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...\nSyncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s\nSyncer.prototype.pollTimerInterval = 60 * 1000; // Interval for polling for changes from the adaptor\n\n/*\nInitialise the syncer\n*/\nSyncer.prototype.init = function() {\n\tvar self = this;\n\t// Hashmap by title of {revision:,changeCount:,adaptorInfo:}\n\tthis.tiddlerInfo = {};\n\t// Record information for known tiddlers\n\tthis.wiki.forEachTiddler(function(title,tiddler) {\n\t\tif(tiddler.fields[\"revision\"]) {\n\t\t\tself.tiddlerInfo[title] = {\n\t\t\t\trevision: tiddler.fields[\"revision\"],\n\t\t\t\tadaptorInfo: self.syncadaptor.getTiddlerInfo(tiddler),\n\t\t\t\tchangeCount: self.wiki.getChangeCount(title)\n\t\t\t}\n\t\t}\n\t});\n\t// Tasks are {type: \"load\"/\"save\"/\"delete\", title:, queueTime:, lastModificationTime:}\n\tthis.taskQueue = {}; // Hashmap of tasks to be performed\n\tthis.taskInProgress = {}; // Hash of tasks in progress\n\tthis.taskTimerId = null; // Timer for task dispatch\n\tthis.pollTimerId = null; // Timer for polling server\n\t// Listen out for changes to tiddlers\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tself.syncToServer(changes);\n\t});\n\t// Listen out for lazyLoad events\n\tthis.wiki.addEventListener(\"lazyLoad\",function(title) {\n\t\tself.handleLazyLoadEvent(title);\n\t});\n\t// Listen out for login/logout/refresh events in the browser\n\tif($tw.browser) {\n\t\tdocument.addEventListener(\"tw-login\",function(event) {\n\t\t\tself.handleLoginEvent(event);\n\t\t},false);\n\t\tdocument.addEventListener(\"tw-logout\",function(event) {\n\t\t\tself.handleLogoutEvent(event);\n\t\t},false);\n\t\tdocument.addEventListener(\"tw-server-refresh\",function(event) {\n\t\t\tself.handleRefreshEvent(event);\n\t\t},false);\n\t}\n\t// Get the login status\n\tthis.getStatus(function (err,isLoggedIn) {\n\t\tif(isLoggedIn) {\n\t\t\t// Do a sync from the server\n\t\t\tself.syncFromServer();\n\t\t}\n\t});\n};\n\n/*\nSave an incoming tiddler in the store, and updates the associated tiddlerInfo\n*/\nSyncer.prototype.storeTiddler = function(tiddlerFields) {\n\t// Save the tiddler\n\tvar tiddler = new $tw.Tiddler(this.wiki.getTiddler(tiddlerFields.title),tiddlerFields);\n\tthis.wiki.addTiddler(tiddler);\n\t// Save the tiddler revision and changeCount details\n\tthis.tiddlerInfo[tiddlerFields.title] = {\n\t\trevision: tiddlerFields.revision,\n\t\tadaptorInfo: this.syncadaptor.getTiddlerInfo(tiddler),\n\t\tchangeCount: this.wiki.getChangeCount(tiddlerFields.title)\n\t};\n};\n\nSyncer.prototype.getStatus = function(callback) {\n\tvar self = this;\n\t// Check if the adaptor supports getStatus()\n\tif(this.syncadaptor.getStatus) {\n\t\t// Mark us as not logged in\n\t\tthis.wiki.addTiddler({title: this.titleIsLoggedIn,text: \"no\"});\n\t\t// Get login status\n\t\tthis.syncadaptor.getStatus(function(err,isLoggedIn,username) {\n\t\t\tif(err) {\n\t\t\t\tself.showError(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Set the various status tiddlers\n\t\t\tself.wiki.addTiddler({title: self.titleIsLoggedIn,text: isLoggedIn ? \"yes\" : \"no\"});\n\t\t\tif(isLoggedIn) {\n\t\t\t\tself.wiki.addTiddler({title: self.titleUserName,text: username});\n\t\t\t} else {\n\t\t\t\tself.wiki.deleteTiddler(self.titleUserName);\n\t\t\t}\n\t\t\t// Invoke the callback\n\t\t\tif(callback) {\n\t\t\t\tcallback(err,isLoggedIn,username);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tcallback(null,true,\"UNAUTHENTICATED\");\n\t}\n};\n\n/*\nSynchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date\n*/\nSyncer.prototype.syncFromServer = function() {\n\tif(this.syncadaptor.getSkinnyTiddlers) {\n\t\tthis.log(\"Retrieving skinny tiddler list\");\n\t\tvar self = this;\n\t\tif(this.pollTimerId) {\n\t\t\tclearTimeout(this.pollTimerId);\n\t\t\tthis.pollTimerId = null;\n\t\t}\n\t\tthis.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {\n\t\t\t// Trigger another sync\n\t\t\tself.pollTimerId = setTimeout(function() {\n\t\t\t\tself.pollTimerId = null;\n\t\t\t\tself.syncFromServer.call(self);\n\t\t\t},self.pollTimerInterval);\n\t\t\t// Check for errors\n\t\t\tif(err) {\n\t\t\t\tself.log(\"Error retrieving skinny tiddler list:\",err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Process each incoming tiddler\n\t\t\tfor(var t=0; t<tiddlers.length; t++) {\n\t\t\t\t// Get the incoming tiddler fields, and the existing tiddler\n\t\t\t\tvar tiddlerFields = tiddlers[t],\n\t\t\t\t\tincomingRevision = tiddlerFields.revision,\n\t\t\t\t\ttiddler = self.wiki.getTiddler(tiddlerFields.title),\n\t\t\t\t\ttiddlerInfo = self.tiddlerInfo[tiddlerFields.title],\n\t\t\t\t\tcurrRevision = tiddlerInfo ? tiddlerInfo.revision : null;\n\t\t\t\t// Ignore the incoming tiddler if it's the same as the revision we've already got\n\t\t\t\tif(currRevision !== incomingRevision) {\n\t\t\t\t\t// Do a full load if we've already got a fat version of the tiddler\n\t\t\t\t\tif(tiddler && tiddler.fields.text !== undefined) {\n\t\t\t\t\t\t// Do a full load of this tiddler\n\t\t\t\t\t\tself.enqueueSyncTask({\n\t\t\t\t\t\t\ttype: \"load\",\n\t\t\t\t\t\t\ttitle: tiddlerFields.title\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Load the skinny version of the tiddler\n\t\t\t\t\t\tself.storeTiddler(tiddlerFields);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nSynchronise a set of changes to the server\n*/\nSyncer.prototype.syncToServer = function(changes) {\n\tvar self = this,\n\t\tnow = new Date();\n\t$tw.utils.each(changes,function(change,title,object) {\n\t\t// Ignore the change if it is a shadow tiddler\n\t\tif((change.deleted && $tw.utils.hop(self.tiddlerInfo,title)) || (!change.deleted && self.wiki.tiddlerExists(title))) {\n\t\t\t// Queue a task to sync this tiddler\n\t\t\tself.enqueueSyncTask({\n\t\t\t\ttype: change.deleted ? \"delete\" : \"save\",\n\t\t\t\ttitle: title\n\t\t\t});\n\t\t}\n\t});\n};\n\n/*\nLazily load a skinny tiddler if we can\n*/\nSyncer.prototype.handleLazyLoadEvent = function(title) {\n\t// Queue up a sync task to load this tiddler\n\tthis.enqueueSyncTask({\n\t\ttype: \"load\",\n\t\ttitle: title\n\t});\n};\n\n/*\nDispay a password prompt and allow the user to login\n*/\nSyncer.prototype.handleLoginEvent = function() {\n\tvar self = this;\n\tthis.getStatus(function(err,isLoggedIn,username) {\n\t\tif(!isLoggedIn) {\n\t\t\t$tw.passwordPrompt.createPrompt({\n\t\t\t\tserviceName: \"Login to TiddlySpace\",\n\t\t\t\tcallback: function(data) {\n\t\t\t\t\tself.login(data.username,data.password,function(err,isLoggedIn) {\n\t\t\t\t\t\tself.syncFromServer();\n\t\t\t\t\t});\n\t\t\t\t\treturn true; // Get rid of the password prompt\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n};\n\n/*\nAttempt to login to TiddlyWeb.\n\tusername: username\n\tpassword: password\n\tcallback: invoked with arguments (err,isLoggedIn)\n*/\nSyncer.prototype.login = function(username,password,callback) {\n\tthis.log(\"Attempting to login as\",username);\n\tvar self = this;\n\tif(this.syncadaptor.login) {\n\t\tthis.syncadaptor.login(username,password,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tself.getStatus(function(err,isLoggedIn,username) {\n\t\t\t\tif(callback) {\n\t\t\t\t\tcallback(null,isLoggedIn);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t} else {\n\t\tcallback(null,true);\n\t}\n};\n\n/*\nAttempt to log out of TiddlyWeb\n*/\nSyncer.prototype.handleLogoutEvent = function() {\n\tthis.log(\"Attempting to logout\");\n\tvar self = this;\n\tif(this.syncadaptor.logout) {\n\t\tthis.syncadaptor.logout(function(err) {\n\t\t\tif(err) {\n\t\t\t\tself.showError(err);\n\t\t\t} else {\n\t\t\t\tself.getStatus();\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nImmediately refresh from the server\n*/\nSyncer.prototype.handleRefreshEvent = function() {\n\tthis.syncFromServer();\n};\n\n/*\nQueue up a sync task. If there is already a pending task for the tiddler, just update the last modification time\n*/\nSyncer.prototype.enqueueSyncTask = function(task) {\n\tvar self = this,\n\t\tnow = new Date();\n\t// Set the timestamps on this task\n\ttask.queueTime = now;\n\ttask.lastModificationTime = now;\n\t// Fill in some tiddlerInfo if the tiddler is one we haven't seen before\n\tif(!$tw.utils.hop(this.tiddlerInfo,task.title)) {\n\t\tthis.tiddlerInfo[task.title] = {\n\t\t\trevision: null,\n\t\t\tadaptorInfo: {},\n\t\t\tchangeCount: -1\n\t\t}\n\t}\n\t// Bail if this is a save and the tiddler is already at the changeCount that the server has\n\tif(task.type === \"save\" && this.wiki.getChangeCount(task.title) <= this.tiddlerInfo[task.title].changeCount) {\n\t\treturn;\n\t}\n\t// Check if this tiddler is already in the queue\n\tif($tw.utils.hop(this.taskQueue,task.title)) {\n\t\tthis.log(\"Re-queueing up sync task with type:\",task.type,\"title:\",task.title);\n\t\tvar existingTask = this.taskQueue[task.title];\n\t\t// If so, just update the last modification time\n\t\texistingTask.lastModificationTime = task.lastModificationTime;\n\t\t// If the new task is a save then we upgrade the existing task to a save. Thus a pending load is turned into a save if the tiddler changes locally in the meantime. But a pending save is not modified to become a load\n\t\tif(task.type === \"save\" || task.type === \"delete\") {\n\t\t\texistingTask.type = task.type;\n\t\t}\n\t} else {\n\t\tthis.log(\"Queuing up sync task with type:\",task.type,\"title:\",task.title);\n\t\t// If it is not in the queue, insert it\n\t\tthis.taskQueue[task.title] = task;\n\t}\n\t// Process the queue\n\t$tw.utils.nextTick(function() {self.processTaskQueue.call(self);});\n};\n\n/*\nReturn the number of tasks in progress\n*/\nSyncer.prototype.numTasksInProgress = function() {\n\treturn $tw.utils.count(this.taskInProgress);\n};\n\n/*\nReturn the number of tasks in the queue\n*/\nSyncer.prototype.numTasksInQueue = function() {\n\treturn $tw.utils.count(this.taskQueue);\n};\n\n/*\nTrigger a timeout if one isn't already outstanding\n*/\nSyncer.prototype.triggerTimeout = function() {\n\tvar self = this;\n\tif(!this.taskTimerId) {\n\t\tthis.taskTimerId = setTimeout(function() {\n\t\t\tself.taskTimerId = null;\n\t\t\tself.processTaskQueue.call(self);\n\t\t},self.taskTimerInterval);\n\t}\n};\n\n/*\nProcess the task queue, performing the next task if appropriate\n*/\nSyncer.prototype.processTaskQueue = function() {\n\tvar self = this;\n\t// Only process a task if we're not already performing a task. If we are already performing a task then we'll dispatch the next one when it completes\n\tif(this.numTasksInProgress() === 0) {\n\t\t// Choose the next task to perform\n\t\tvar task = this.chooseNextTask();\n\t\t// Perform the task if we had one\n\t\tif(task) {\n\t\t\t// Remove the task from the queue and add it to the in progress list\n\t\t\tdelete this.taskQueue[task.title];\n\t\t\tthis.taskInProgress[task.title] = task;\n\t\t\t// Dispatch the task\n\t\t\tthis.dispatchTask(task,function(err) {\n\t\t\t\t// Mark that this task is no longer in progress\n\t\t\t\tdelete self.taskInProgress[task.title];\n\t\t\t\t// Process the next task\n\t\t\t\tself.processTaskQueue.call(self);\n\t\t\t});\n\t\t} else {\n\t\t\t// Make sure we've set a time if there wasn't a task to perform, but we've still got tasks in the queue\n\t\t\tif(this.numTasksInQueue() > 0) {\n\t\t\t\tthis.triggerTimeout();\n\t\t\t}\n\t\t}\n\t}\n};\n\n/*\nChoose the next applicable task\n*/\nSyncer.prototype.chooseNextTask = function() {\n\tvar self = this,\n\t\tcandidateTask = null,\n\t\tnow = new Date();\n\t// Select the best candidate task\n\t$tw.utils.each(this.taskQueue,function(task,title) {\n\t\t// Exclude the task if there's one of the same name in progress\n\t\tif($tw.utils.hop(self.taskInProgress,title)) {\n\t\t\treturn;\n\t\t}\n\t\t// Exclude the task if it is a save and the tiddler has been modified recently, but not hit the fallback time\n\t\tif(task.type === \"save\" && (now - task.lastModificationTime) < self.throttleInterval &&\n\t\t\t(now - task.queueTime) < self.fallbackInterval) {\n\t\t\treturn;\t\n\t\t}\n\t\t// Exclude the task if it is newer than the current best candidate\n\t\tif(candidateTask && candidateTask.queueTime < task.queueTime) {\n\t\t\treturn;\n\t\t}\n\t\t// Now this is our best candidate\n\t\tcandidateTask = task;\n\t});\n\treturn candidateTask;\n};\n\n/*\nDispatch a task and invoke the callback\n*/\nSyncer.prototype.dispatchTask = function(task,callback) {\n\tvar self = this;\n\tif(task.type === \"save\") {\n\t\tvar changeCount = this.wiki.getChangeCount(task.title),\n\t\t\ttiddler = this.wiki.getTiddler(task.title);\n\t\tthis.log(\"Dispatching 'save' task:\",task.title);\n\t\tthis.syncadaptor.saveTiddler(tiddler,function(err,adaptorInfo,revision) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\t// Adjust the info stored about this tiddler\n\t\t\tself.tiddlerInfo[task.title] = {\n\t\t\t\tchangeCount: changeCount,\n\t\t\t\tadaptorInfo: adaptorInfo,\n\t\t\t\trevision: revision\n\t\t\t};\n\t\t\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t});\n\t} else if(task.type === \"load\") {\n\t\t// Load the tiddler\n\t\tthis.log(\"Dispatching 'load' task:\",task.title);\n\t\tthis.syncadaptor.loadTiddler(task.title,function(err,tiddlerFields) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\t// Store the tiddler\n\t\t\tself.storeTiddler(tiddlerFields);\n\t\t\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t});\n\t} else if(task.type === \"delete\") {\n\t\t// Delete the tiddler\n\t\tthis.log(\"Dispatching 'delete' task:\",task.title);\n\t\tthis.syncadaptor.deleteTiddler(task.title,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t});\n\t}\n};\n\nexports.Syncer = Syncer;\n\n})();\n",
"title": "$:/core/modules/syncer.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/themes.js": {
"text": "/*\\\ntitle: $:/core/modules/themes.js\ntype: application/javascript\nmodule-type: global\n\nManages themes and styling.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar THEME_PLUGIN_TITLE = \"$:/theme\", // This tiddler contains the title of the current theme plugin\n\tDEFAULT_THEME_PLUGIN = \"$:/themes/tiddlywiki/snowwhite\";\n\nfunction ThemeManager(wiki) {\n\tthis.wiki = wiki;\n\t// There's no theme to start with\n\tthis.currentThemeTitle = undefined;\n\t// Switch to the current theme\n\tthis.switchTheme();\n\t// Listen for changes to the theme\n\tvar self = this;\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,THEME_PLUGIN_TITLE)) {\n\t\t\tself.switchTheme();\n\t\t}\n\t});\n}\n\nThemeManager.prototype.switchTheme = function() {\n\t// Get the name of the current theme\n\tvar themePluginTitle = this.wiki.getTiddlerText(THEME_PLUGIN_TITLE,DEFAULT_THEME_PLUGIN);\n\t// Accumulate the titles of the plugins that we need to load\n\tvar themePlugins = [],\n\t\tself = this,\n\t\taccumulatePlugin = function(title) {\n\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\tif(tiddler && tiddler.isPlugin() && themePlugins.indexOf(title) === -1) {\n\t\t\t\tthemePlugins.push(title);\n\t\t\t\tvar pluginInfo = JSON.parse(self.wiki.getTiddlerText(title));\n\t\t\t\t$tw.utils.each(pluginInfo.dependents,function(title) {\n\t\t\t\t\taccumulatePlugin(title);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\taccumulatePlugin(themePluginTitle);\n\t// Unregister any existing theme tiddlers\n\tvar unregisteredThemeTiddlers = $tw.wiki.unregisterPluginTiddlers(\"theme\");\n\t// Accumulate the titles of shadow tiddlers that have changed as a result of this switch\n\tvar changedTiddlers = {};\n\t$tw.utils.each(this.wiki.shadowTiddlers,function(shadowInfo,title) {\n\t\tif(unregisteredThemeTiddlers.indexOf(shadowInfo.source) !== -1) {\n\t\t\tchangedTiddlers[title] = true; // isDeleted?\n\t\t}\n\t});\n\t// Register any new theme tiddlers\n\tvar registeredThemeTiddlers = $tw.wiki.registerPluginTiddlers(\"theme\",themePlugins);\n\t// Unpack the current theme tiddlers\n\t$tw.wiki.unpackPluginTiddlers();\n\t// Accumulate the affected shadow tiddlers\n\t$tw.utils.each(this.wiki.shadowTiddlers,function(shadowInfo,title) {\n\t\tif(registeredThemeTiddlers.indexOf(shadowInfo.source) !== -1) {\n\t\t\tchangedTiddlers[title] = false; // isDeleted?\n\t\t}\n\t});\n\t// Issue change events for the modified tiddlers\n\t$tw.utils.each(changedTiddlers,function(status,title) {\n\t\tself.wiki.enqueueTiddlerEvent(title,status);\n\t});\n};\n\nexports.ThemeManager = ThemeManager;\n\n})();\n",
"title": "$:/core/modules/themes.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/tiddler.js": {
"text": "/*\\\ntitle: $:/core/modules/tiddler.js\ntype: application/javascript\nmodule-type: tiddlermethod\n\nExtension methods for the $tw.Tiddler object (constructor and methods required at boot time are in boot/boot.js)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.hasTag = function(tag) {\n\treturn this.fields.tags && this.fields.tags.indexOf(tag) !== -1;\n};\n\nexports.isPlugin = function() {\n\treturn this.fields.type === \"application/json\" && this.hasField(\"plugin\") && this.hasField(\"plugin-type\");\n}\n\nexports.getFieldString = function(field) {\n\tvar value = this.fields[field];\n\t// Check for a missing field\n\tif(value === undefined || value === null) {\n\t\treturn \"\";\n\t}\n\t// Parse the field with the associated module (if any)\n\tvar fieldModule = $tw.Tiddler.fieldModules[field];\n\tif(fieldModule && fieldModule.stringify) {\n\t\treturn fieldModule.stringify.call(this,value);\n\t} else {\n\t\treturn value.toString();\n\t}\n};\n\n/*\nGet all the fields as a name:value block. Options:\n\texclude: an array of field names to exclude\n*/\nexports.getFieldStringBlock = function(options) {\n\toptions = options || {};\n\tvar exclude = options.exclude || [];\n\tvar fields = [];\n\tfor(var field in this.fields) {\n\t\tif($tw.utils.hop(this.fields,field)) {\n\t\t\tif(exclude.indexOf(field) === -1) {\n\t\t\t\tfields.push(field + \": \" + this.getFieldString(field));\n\t\t\t}\n\t\t}\n\t}\n\treturn fields.join(\"\\n\");\n};\n\n})();\n",
"title": "$:/core/modules/tiddler.js",
"type": "application/javascript",
"module-type": "tiddlermethod"
},
"$:/core/modules/utils/dom/animations/slide.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/animations/slide.js\ntype: application/javascript\nmodule-type: animation\n\nA simple slide animation that varies the height of the element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction slideOpen(domNode,options) {\n\t// Get the current height of the domNode\n\tvar computedStyle = window.getComputedStyle(domNode),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\tcurrPaddingBottom = parseInt(computedStyle.paddingBottom,10),\n\t\tcurrPaddingTop = parseInt(computedStyle.paddingTop,10),\n\t\tcurrHeight = domNode.offsetHeight;\n\t// Reset the margin once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(domNode,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"},\n\t\t\t{marginTop: \"\"},\n\t\t\t{paddingBottom: \"\"},\n\t\t\t{paddingTop: \"\"},\n\t\t\t{height: \"auto\"},\n\t\t\t{opacity: \"\"}\n\t\t]);\n\t\tif(options.callback) {\n\t\t\toptions.callback();\n\t\t}\n\t},$tw.config.preferences.animationDuration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"none\"},\n\t\t{marginTop: \"0px\"},\n\t\t{marginBottom: \"0px\"},\n\t\t{paddingTop: \"0px\"},\n\t\t{paddingBottom: \"0px\"},\n\t\t{height: \"0px\"},\n\t\t{opacity: \"0\"}\n\t]);\n\t$tw.utils.forceLayout(domNode);\n\t// Transition to the final position\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"margin-top \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"height \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{marginTop: currMarginTop + \"px\"},\n\t\t{paddingBottom: currPaddingBottom + \"px\"},\n\t\t{paddingTop: currPaddingTop + \"px\"},\n\t\t{height: currHeight + \"px\"},\n\t\t{opacity: \"1\"}\n\t]);\n}\n\nfunction slideClosed(domNode,options) {\n\tvar currHeight = domNode.offsetHeight;\n\t// Clear the properties we've set when the animation is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(domNode,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"},\n\t\t\t{marginTop: \"\"},\n\t\t\t{paddingBottom: \"\"},\n\t\t\t{paddingTop: \"\"},\n\t\t\t{height: \"auto\"},\n\t\t\t{opacity: \"\"}\n\t\t]);\n\t\tif(options.callback) {\n\t\t\toptions.callback();\n\t\t}\n\t},$tw.config.preferences.animationDuration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(domNode,[\n\t\t{height: currHeight + \"px\"},\n\t\t{opacity: \"1\"}\n\t]);\n\t$tw.utils.forceLayout(domNode);\n\t// Transition to the final position\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"margin-top \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"height \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"},\n\t\t{marginTop: \"0px\"},\n\t\t{marginBottom: \"0px\"},\n\t\t{paddingTop: \"0px\"},\n\t\t{paddingBottom: \"0px\"},\n\t\t{height: \"0px\"},\n\t\t{opacity: \"0\"}\n\t]);\n}\n\nexports.slide = {\n\topen: slideOpen,\n\tclose: slideClosed\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/animations/slide.js",
"type": "application/javascript",
"module-type": "animation"
},
"$:/core/modules/utils/dom/animator.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/animator.js\ntype: application/javascript\nmodule-type: utils\n\nOrchestrates animations and transitions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction Animator() {\n\t// Get the registered animation modules\n\tthis.animations = {};\n\t$tw.modules.applyMethods(\"animation\",this.animations);\n}\n\nAnimator.prototype.perform = function(type,domNode,options) {\n\toptions = options || {};\n\t// Find an animation that can handle this type\n\tvar chosenAnimation;\n\t$tw.utils.each(this.animations,function(animation,name) {\n\t\tif($tw.utils.hop(animation,type)) {\n\t\t\tchosenAnimation = animation[type];\n\t\t}\n\t});\n\t// Call the animation\n\tif(chosenAnimation) {\n\t\tchosenAnimation(domNode,options);\n\t}\n};\n\nexports.Animator = Animator;\n\n})();\n",
"title": "$:/core/modules/utils/dom/animator.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/browser.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/browser.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser feature detection\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSet style properties of an element\n\telement: dom node\n\tstyles: ordered array of {name: value} pairs\n*/\nexports.setStyle = function(element,styles) {\n\tfor(var t=0; t<styles.length; t++) {\n\t\tfor(var styleName in styles[t]) {\n\t\t\telement.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];\n\t\t}\n\t}\n};\n\n/*\nConverts a standard CSS property name into the local browser-specific equivalent. For example:\n\t\"background-color\" --> \"backgroundColor\"\n\t\"transition\" --> \"webkitTransition\"\n*/\n\nvar styleNameCache = {}; // We'll cache the style name conversions\n\nexports.convertStyleNameToPropertyName = function(styleName) {\n\t// Return from the cache if we can\n\tif(styleNameCache[styleName]) {\n\t\treturn styleNameCache[styleName];\n\t}\n\t// Convert it by first removing any hyphens\n\tvar propertyName = $tw.utils.unHyphenateCss(styleName);\n\t// Then check if it needs a prefix\n\tif(document.body.style[propertyName] === undefined) {\n\t\tvar prefixes = [\"O\",\"MS\",\"Moz\",\"webkit\"];\n\t\tfor(var t=0; t<prefixes.length; t++) {\n\t\t\tvar prefixedName = prefixes[t] + propertyName.substr(0,1).toUpperCase() + propertyName.substr(1);\n\t\t\tif(document.body.style[prefixedName] !== undefined) {\n\t\t\t\tpropertyName = prefixedName;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// Put it in the cache too\n\tstyleNameCache[styleName] = propertyName;\n\treturn propertyName;\n};\n\n/*\nConverts a JS format CSS property name back into the dashed form used in CSS declarations. For example:\n\t\"backgroundColor\" --> \"background-color\"\n\t\"webkitTransform\" --> \"-webkit-transform\"\n*/\nexports.convertPropertyNameToStyleName = function(propertyName) {\n\t// Rehyphenate the name\n\tvar styleName = $tw.utils.hyphenateCss(propertyName);\n\t// If there's a webkit prefix, add a dash (other browsers have uppercase prefixes, and so get the dash automatically)\n\tif(styleName.indexOf(\"webkit\") === 0) {\n\t\tstyleName = \"-\" + styleName;\n\t} else if(styleName.indexOf(\"-m-s\") === 0) {\n\t\tstyleName = \"-ms\" + styleName.substr(4);\n\t}\n\treturn styleName;\n};\n\n/*\nRound trip a stylename to a property name and back again. For example:\n\t\"transform\" --> \"webkitTransform\" --> \"-webkit-transform\"\n*/\nexports.roundTripPropertyName = function(propertyName) {\n\treturn $tw.utils.convertPropertyNameToStyleName($tw.utils.convertStyleNameToPropertyName(propertyName));\n};\n\n/*\nConverts a standard event name into the local browser specific equivalent. For example:\n\t\"animationEnd\" --> \"webkitAnimationEnd\"\n*/\n\nvar eventNameCache = {}; // We'll cache the conversions\n\nvar eventNameMappings = {\n\t\"transitionEnd\": {\n\t\tcorrespondingCssProperty: \"transition\",\n\t\tmappings: {\n\t\t\ttransition: \"transitionend\",\n\t\t\tOTransition: \"oTransitionEnd\",\n\t\t\tMSTransition: \"msTransitionEnd\",\n\t\t\tMozTransition: \"transitionend\",\n\t\t\twebkitTransition: \"webkitTransitionEnd\"\n\t\t}\n\t},\n\t\"animationEnd\": {\n\t\tcorrespondingCssProperty: \"animation\",\n\t\tmappings: {\n\t\t\tanimation: \"animationend\",\n\t\t\tOAnimation: \"oAnimationEnd\",\n\t\t\tMSAnimation: \"msAnimationEnd\",\n\t\t\tMozAnimation: \"animationend\",\n\t\t\twebkitAnimation: \"webkitAnimationEnd\"\n\t\t}\n\t}\n};\n\nexports.convertEventName = function(eventName) {\n\tif(eventNameCache[eventName]) {\n\t\treturn eventNameCache[eventName];\n\t}\n\tvar newEventName = eventName,\n\t\tmappings = eventNameMappings[eventName];\n\tif(mappings) {\n\t\tvar convertedProperty = $tw.utils.convertStyleNameToPropertyName(mappings.correspondingCssProperty);\n\t\tif(mappings.mappings[convertedProperty]) {\n\t\t\tnewEventName = mappings.mappings[convertedProperty];\n\t\t}\n\t}\n\t// Put it in the cache too\n\teventNameCache[eventName] = newEventName;\n\treturn newEventName;\n};\n\n// Setup constants for the current browser\nexports.getBrowserInfo = function(info) {\n\tinfo.requestFullScreen = document.body.webkitRequestFullScreen !== undefined ? \"webkitRequestFullScreen\" :\n\t\t\t\t\t\t\tdocument.body.mozRequestFullScreen !== undefined ? \"mozRequestFullScreen\" :\n\t\t\t\t\t\t\tdocument.body.requestFullScreen !== undefined ? \"requestFullScreen\" : \"\";\n\tinfo.cancelFullScreen = document.webkitCancelFullScreen !== undefined ? \"webkitCancelFullScreen\" :\n\t\t\t\t\t\t\tdocument.mozCancelFullScreen !== undefined ? \"mozCancelFullScreen\" :\n\t\t\t\t\t\t\tdocument.cancelFullScreen !== undefined ? \"cancelFullScreen\" : \"\";\n\tinfo.isFullScreen = document.webkitIsFullScreen !== undefined ? \"webkitIsFullScreen\" :\n\t\t\t\t\t\t\tdocument.mozFullScreen !== undefined ? \"mozFullScreen\" :\n\t\t\t\t\t\t\tdocument.fullScreen !== undefined ? \"fullScreen\" : \"\";\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/browser.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom.js\ntype: application/javascript\nmodule-type: utils\n\nVarious static DOM-related utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDetermines whether element 'a' contains element 'b'\nCode thanks to John Resig, http://ejohn.org/blog/comparing-document-position/\n*/\nexports.domContains = function(a,b) {\n\treturn a.contains ?\n\t\ta != b && a.contains(b) :\n\t\t!!(a.compareDocumentPosition(b) & 16);\n};\n\nexports.removeChildren = function(node) {\n\twhile(node.hasChildNodes()) {\n\t\tnode.removeChild(node.firstChild);\n\t}\n};\n\nexports.hasClass = function(el,className) {\n\treturn el.className.split(\" \").indexOf(className) !== -1;\n};\n\nexports.addClass = function(el,className) {\n\tvar c = el.className.split(\" \");\n\tif(c.indexOf(className) === -1) {\n\t\tc.push(className);\n\t}\n\tel.className = c.join(\" \");\n};\n\nexports.removeClass = function(el,className) {\n\tvar c = el.className.split(\" \"),\n\t\tp = c.indexOf(className);\n\tif(p !== -1) {\n\t\tc.splice(p,1);\n\t\tel.className = c.join(\" \");\n\t}\n};\n\nexports.toggleClass = function(el,className,status) {\n\tif(status === undefined) {\n\t\tstatus = !exports.hasClass(el,className);\n\t}\n\tif(status) {\n\t\texports.addClass(el,className);\n\t} else {\n\t\texports.removeClass(el,className);\n\t}\n};\n\nexports.applyStyleSheet = function(id,css) {\n\tvar el = document.getElementById(id);\n\tif(document.createStyleSheet) { // Older versions of IE\n\t\tif(el) {\n\t\t\tel.parentNode.removeChild(el);\n\t\t}\n\t\tdocument.getElementsByTagName(\"head\")[0].insertAdjacentHTML(\"beforeEnd\",\n\t\t\t' <style id=\"' + id + '\" type=\"text/css\">' + css + '</style>'); // fails without \n\t} else { // Modern browsers\n\t\tif(el) {\n\t\t\tel.replaceChild(document.createTextNode(css), el.firstChild);\n\t\t} else {\n\t\t\tel = document.createElement(\"style\");\n\t\t\tel.type = \"text/css\";\n\t\t\tel.id = id;\n\t\t\tel.appendChild(document.createTextNode(css));\n\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(el);\n\t\t}\n\t}\n};\n\n/*\nGet the scroll position of the viewport\nReturns:\n\t{\n\t\tx: horizontal scroll position in pixels,\n\t\ty: vertical scroll position in pixels\n\t}\n*/\nexports.getScrollPosition = function() {\n\tif(\"scrollX\" in window) {\n\t\treturn {x: window.scrollX, y: window.scrollY};\n\t} else {\n\t\treturn {x: document.documentElement.scrollLeft, y: document.documentElement.scrollTop};\n\t}\n};\n\n/*\nGets the bounding rectangle of an element in absolute page coordinates\n*/\nexports.getBoundingPageRect = function(element) {\n\tvar scrollPos = $tw.utils.getScrollPosition(),\n\t\tclientRect = element.getBoundingClientRect();\n\treturn {\n\t\tleft: clientRect.left + scrollPos.x,\n\t\twidth: clientRect.width,\n\t\tright: clientRect.right + scrollPos.x,\n\t\ttop: clientRect.top + scrollPos.y,\n\t\theight: clientRect.height,\n\t\tbottom: clientRect.bottom + scrollPos.y\n\t};\n};\n\n/*\nSaves a named password in the browser\n*/\nexports.savePassword = function(name,password) {\n\tlocalStorage.setItem(\"tw5-password-\" + name,password);\n};\n\n/*\nRetrieve a named password from the browser\n*/\nexports.getPassword = function(name) {\n\treturn localStorage.getItem(\"tw5-password-\" + name);\n};\n\n/*\nForce layout of a dom node and its descendents\n*/\nexports.forceLayout = function(element) {\n\tvar dummy = element.offsetWidth;\n};\n\n/*\nPulse an element for debugging purposes\n*/\nexports.pulseElement = function(element) {\n\t// Event handler to remove the class at the end\n\telement.addEventListener($tw.browser.animationEnd,function handler(event) {\n\t\telement.removeEventListener($tw.browser.animationEnd,handler,false);\n\t\t$tw.utils.removeClass(element,\"pulse\");\n\t},false);\n\t// Apply the pulse class\n\t$tw.utils.removeClass(element,\"pulse\");\n\t$tw.utils.forceLayout(element);\n\t$tw.utils.addClass(element,\"pulse\");\n};\n\n/*\nAttach specified event handlers to a DOM node\n*/\nexports.addEventListeners = function(domNode,events) {\n\t$tw.utils.each(events,function(eventInfo) {\n\t\tvar handler;\n\t\tif(eventInfo.handlerFunction) {\n\t\t\thandler = eventInfo.handlerFunction;\n\t\t} else if(eventInfo.handlerObject) {\n\t\t\tif(eventInfo.handlerMethod) {\n\t\t\t\thandler = function(event) {\n\t\t\t\t\teventInfo.handlerObject[eventInfo.handlerMethod].call(eventInfo.handlerObject,event);\n\t\t\t\t};\t\n\t\t\t} else {\n\t\t\t\thandler = eventInfo.handlerObject;\n\t\t\t}\n\t\t}\n\t\tdomNode.addEventListener(eventInfo.name,handler,false);\n\t});\n};\n\n/*\nConstruct and dispatch a custom event\n*/\nexports.dispatchCustomEvent = function(target,name,members) {\n\tvar event = document.createEvent(\"Event\");\n\tevent.initEvent(name,true,true);\n\t$tw.utils.each(members,function(member,name) {\n\t\tevent[name] = member;\n\t});\n\ttarget.dispatchEvent(event); \n};\n\n\n})();\n",
"title": "$:/core/modules/utils/dom.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/http.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/http.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser HTTP support\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nA quick and dirty HTTP function; to be refactored later. Options are:\n\turl: URL to retrieve\n\ttype: GET, PUT, POST etc\n\tcallback: function invoked with (err,data)\n*/\nexports.httpRequest = function(options) {\n\tvar type = options.type || \"GET\",\n\t\theaders = options.headers || {accept: \"application/json\"},\n\t\trequest = new XMLHttpRequest(),\n\t\tdata = \"\",\n\t\tf,results;\n\t// Massage the data hashmap into a string\n\tif(options.data) {\n\t\tif(typeof options.data === \"string\") { // Already a string\n\t\t\tdata = options.data;\n\t\t} else { // A hashmap of strings\n\t\t\tresults = [];\n\t\t\t$tw.utils.each(options.data,function(dataItem,dataItemTitle) {\n\t\t\t\tresults.push(dataItemTitle + \"=\" + encodeURIComponent(dataItem));\n\t\t\t});\n\t\t\tdata = results.join(\"&\");\n\t\t}\n\t}\n\t// Set up the state change handler\n\trequest.onreadystatechange = function() {\n\t\tif(this.readyState === 4) {\n\t\t\tif(this.status === 200 || this.status === 204) {\n\t\t\t\t// Success!\n\t\t\t\toptions.callback(null,this.responseText,this);\n\t\t\t\treturn;\n\t\t\t}\n\t\t// Something went wrong\n\t\toptions.callback(new Error(\"XMLHttpRequest error: \" + this.status));\n\t\t}\n\t};\n\t// Make the request\n\trequest.open(type,options.url,true);\n\tif(headers) {\n\t\t$tw.utils.each(headers,function(header,headerTitle,object) {\n\t\t\trequest.setRequestHeader(headerTitle,header);\n\t\t});\n\t}\n\tif(data && !$tw.utils.hop(headers,\"Content-type\")) {\n\t\trequest.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded; charset=UTF-8\");\n\t}\n\trequest.send(data);\n\treturn request;\n};\n\n})();\n",
"title": "$:/core/modules/utils/dom/http.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/modal.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/modal.js\ntype: application/javascript\nmodule-type: utils\n\nModal message mechanism\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Modal = function(wiki) {\n\tthis.wiki = wiki;\n\tthis.modalCount = 0;\n};\n\n/*\nDisplay a modal dialogue\n\ttitle: Title of tiddler to display\n\toptions: see below\nOptions include:\n\tdownloadLink: Text of a big download link to include\n*/\nModal.prototype.display = function(title,options) {\n\toptions = options || {};\n\tvar self = this;\n\t// Up the modal count and adjust the body class\n\tthis.modalCount++;\n\tthis.adjustPageClass();\n\t// Create the wrapper divs\n\tvar wrapper = document.createElement(\"div\"),\n\t\tmodalBackdrop = document.createElement(\"div\"),\n\t\tmodalWrapper = document.createElement(\"div\"),\n\t\tmodalHeader = document.createElement(\"div\"),\n\t\theaderTitle = document.createElement(\"h3\"),\n\t\tmodalBody = document.createElement(\"div\"),\n\t\tmodalLink = document.createElement(\"a\"),\n\t\tmodalFooter = document.createElement(\"div\"),\n\t\tmodalFooterHelp = document.createElement(\"span\"),\n\t\tmodalFooterButtons = document.createElement(\"span\"),\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\td = $tw.config.preferences.animationDuration + \"ms\";\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\n\t// Add classes\n\t$tw.utils.addClass(wrapper,\"modal-wrapper\");\n\t$tw.utils.addClass(modalBackdrop,\"modal-backdrop\");\n\t$tw.utils.addClass(modalWrapper,\"modal\");\n\t$tw.utils.addClass(modalHeader,\"modal-header\");\n\t$tw.utils.addClass(modalBody,\"modal-body\");\n\t$tw.utils.addClass(modalLink,\"btn btn-large btn-block btn-success\");\n\t$tw.utils.addClass(modalFooter,\"modal-footer\");\n\t// Join them together\n\twrapper.appendChild(modalBackdrop);\n\twrapper.appendChild(modalWrapper);\n\tmodalHeader.appendChild(headerTitle);\n\tmodalWrapper.appendChild(modalHeader);\n\tmodalWrapper.appendChild(modalBody);\n\tmodalFooter.appendChild(modalFooterHelp);\n\tmodalFooter.appendChild(modalFooterButtons);\n\tmodalWrapper.appendChild(modalFooter);\n\t// Render the title of the message\n\tvar titleText;\n\tif(tiddler && tiddler.fields && tiddler.fields.subtitle) {\n\t\ttitleText = tiddler.fields.subtitle;\n\t} else {\n\t\ttitleText = title;\n\t}\n\tvar headerParser = this.wiki.parseText(\"text/vnd.tiddlywiki\",titleText,{parseAsInline: true}),\n\t\theaderRenderTree = new $tw.WikiRenderTree(headerParser,{wiki: $tw.wiki, context: {tiddlerTitle: title}, document: document});\n\theaderRenderTree.execute();\n\theaderRenderTree.renderInDom(headerTitle);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\theaderRenderTree.refreshInDom(changes);\n\t});\n\t// Render the body of the message\n\tvar bodyParser = this.wiki.parseTiddler(title),\n\t\tbodyRenderTree = new $tw.WikiRenderTree(bodyParser,{wiki: $tw.wiki, context: {tiddlerTitle: title}, document: document});\n\tbodyRenderTree.execute();\n\tbodyRenderTree.renderInDom(modalBody);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tbodyRenderTree.refreshInDom(changes);\n\t});\n\t// Setup the link if present\n\tif(options.downloadLink) {\n\t\tmodalLink.href = options.downloadLink\n\t\tmodalLink.appendChild(document.createTextNode(\"Right-click to save changes\"));\n\t\tmodalBody.appendChild(modalLink);\n\t}\n\t// Render the footer of the message\n\tif(tiddler && tiddler.fields && tiddler.fields.help) {\n\t\tvar link = document.createElement(\"a\");\n\t\tlink.setAttribute(\"href\",tiddler.fields.help);\n\t\tlink.setAttribute(\"target\",\"_blank\");\n\t\tlink.appendChild(document.createTextNode(\"Help\"));\n\t\tmodalFooterHelp.appendChild(link);\n\t\tmodalFooterHelp.style.float = \"left\";\n\t}\n\tvar footerText;\n\tif(tiddler && tiddler.fields && tiddler.fields.footer) {\n\t\tfooterText = tiddler.fields.footer;\n\t} else {\n\t\tfooterText = '<$button message=\"tw-close-tiddler\" class=\"btn btn-primary\">Close</$button>';\n\t}\n\tvar footerParser = this.wiki.parseText(\"text/vnd.tiddlywiki\",footerText,{parseAsInline: true}),\n\t\tfooterRenderTree = new $tw.WikiRenderTree(footerParser,{wiki: $tw.wiki, context: {tiddlerTitle: title}, document: document});\n\tfooterRenderTree.execute();\n\tfooterRenderTree.renderInDom(modalFooterButtons);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tfooterRenderTree.refreshInDom(changes);\n\t});\n\t// Add the close event handler\n\twrapper.addEventListener(\"tw-close-tiddler\",function(event) {\n\t\t// Decrease the modal count and adjust the body class\n\t\tself.modalCount--;\n\t\tself.adjustPageClass();\n\t\t// Force layout and animate the modal message away\n\t\t$tw.utils.forceLayout(modalBackdrop);\n\t\t$tw.utils.forceLayout(modalWrapper);\n\t\t$tw.utils.setStyle(modalBackdrop,[\n\t\t\t{opacity: \"0\"}\n\t\t]);\n\t\t$tw.utils.setStyle(modalWrapper,[\n\t\t\t{transform: \"translateY(\" + window.innerHeight + \"px)\"}\n\t\t]);\n\t\t// Set up an event for the transition end\n\t\tmodalWrapper.addEventListener($tw.utils.convertEventName(\"transitionEnd\"),function(event) {\n\t\t\tif(wrapper.parentNode) {\n\t\t\t\t// Remove the modal message from the DOM\n\t\t\t\tdocument.body.removeChild(wrapper);\n\t\t\t}\n\t\t},false);\n\t\t// Don't let anyone else handle the tw-close-tiddler message\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t},false);\n\t// Set the initial styles for the message\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \"0\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transformOrigin: \"0% 0%\"},\n\t\t{transform: \"translateY(\" + (-window.innerHeight) + \"px)\"}\n\t]);\n\t// Put the message into the document\n\tdocument.body.appendChild(wrapper);\n\t// Set up animation for the styles\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{transition: \"opacity \" + d + \" ease-out\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"}\n\t]);\n\t// Force layout\n\t$tw.utils.forceLayout(modalBackdrop);\n\t$tw.utils.forceLayout(modalWrapper);\n\t// Set final animated styles\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \"0.7\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transform: \"translateY(0px)\"}\n\t]);\n};\n\nModal.prototype.adjustPageClass = function() {\n\tif($tw.pageContainer) {\n\t\t$tw.utils.toggleClass($tw.pageContainer,\"tw-modal-displayed\",this.modalCount > 0);\n\t}\n};\n\nexports.Modal = Modal;\n\n})();\n",
"title": "$:/core/modules/utils/dom/modal.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/notifier.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/notifier.js\ntype: application/javascript\nmodule-type: utils\n\nNotifier mechanism\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Notifier = function(wiki) {\n\tthis.wiki = wiki;\n};\n\n/*\nDisplay a notification\n\ttitle: Title of tiddler containing the notification text\n\toptions: see below\nOptions include:\n*/\nNotifier.prototype.display = function(title,options) {\n\toptions = options || {};\n\t// Create the wrapper divs\n\tvar notification = document.createElement(\"div\"),\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\td = $tw.config.preferences.animationDuration + \"ms\";\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\n\t// Add classes\n\t$tw.utils.addClass(notification,\"tw-notification\");\n\t// Render the body of the notification\n\tvar bodyParser = this.wiki.parseTiddler(title),\n\t\tbodyRenderTree = new $tw.WikiRenderTree(bodyParser,{wiki: $tw.wiki, context: {tiddlerTitle: title}, document: document});\n\tbodyRenderTree.execute();\n\tbodyRenderTree.renderInDom(notification);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tbodyRenderTree.refreshInDom(changes);\n\t});\n\t// Set the initial styles for the notification\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \"0\"},\n\t\t{transformOrigin: \"0% 0%\"},\n\t\t{transform: \"translateY(\" + (-window.innerHeight) + \"px)\"},\n\t\t{transition: \"opacity \" + d + \" ease-out, \" + $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"}\n\t]);\n\t// Add the notification to the DOM\n\tdocument.body.appendChild(notification);\n\t// Force layout\n\t$tw.utils.forceLayout(notification);\n\t// Set final animated styles\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \"1.0\"},\n\t\t{transform: \"translateY(0px)\"}\n\t]);\n\t// Set a timer to remove the notification\n\twindow.setTimeout(function() {\n\t\t// Force layout and animate the notification away\n\t\t$tw.utils.forceLayout(notification);\n\t\t$tw.utils.setStyle(notification,[\n\t\t\t{opacity: \"0.0\"},\n\t\t\t{transform: \"translateX(\" + (notification.offsetWidth) + \"px)\"}\n\t\t]);\n\t\t// Set up an event for the transition end\n\t\tnotification.addEventListener($tw.utils.convertEventName(\"transitionEnd\"),function(event) {\n\t\t\tif(notification.parentNode) {\n\t\t\t\t// Remove the modal message from the DOM\n\t\t\t\tdocument.body.removeChild(notification);\n\t\t\t}\n\t\t},false);\n\t},$tw.config.preferences.notificationDuration);\n};\n\nexports.Notifier = Notifier;\n\n})();\n",
"title": "$:/core/modules/utils/dom/notifier.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/popup.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/popup.js\ntype: application/javascript\nmodule-type: utils\n\nModule that creates a $tw.utils.Popup object prototype that manages popups in the browser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreates a Popup object with these options:\n\trootElement: the DOM element to which the popup zapper should be attached\n*/\nvar Popup = function(options) {\n\toptions = options || {};\n\tthis.rootElement = options.rootElement || document.body;\n};\n\nPopup.prototype.show = function(options) {\n\tthis.cancel();\n\tthis.title = options.title;\n\tthis.wiki = options.wiki;\n\tthis.anchorDomNode = options.domNode;\n\tthis.rootElement.addEventListener(\"click\",this,false);\n};\n\nPopup.prototype.handleEvent = function(event) {\n\tif(event.type === \"click\" && !$tw.utils.domContains(this.anchorDomNode,event.target)) {\n\t\tthis.cancel();\n\t}\n};\n\nPopup.prototype.cancel = function() {\n\tthis.rootElement.removeEventListener(\"click\",this,false);\n\tif(this.title) {\n\t\tthis.wiki.deleteTiddler(this.title);\n\t\tthis.title = null;\n\t}\n};\n\n/*\nTrigger a popup open or closed. Parameters are in a hashmap:\n\ttitle: title of the tiddler where the popup details are stored\n\tdomNode: dom node to which the popup will be positioned\n\twiki: wiki\n\tforce: if specified, forces the popup state to true or false\n*/\nPopup.prototype.triggerPopup = function(options) {\n\t// Get the current popup state tiddler\n\tvar value = options.wiki.getTextReference(options.title,\"\");\n\t// Check if the popup is open by checking whether it matches \"(<x>,<y>)\"\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tstate = !popupLocationRegExp.test(value);\n\tif(\"force\" in options) {\n\t\tstate = options.force;\n\t}\n\tif(state) {\n\t\t// Set the position if we're opening it\n\t\tthis.cancel();\n\t\toptions.wiki.setTextReference(options.title,\n\t\t\t\"(\" + options.domNode.offsetLeft + \",\" + options.domNode.offsetTop + \",\" + \n\t\t\t\toptions.domNode.offsetWidth + \",\" + options.domNode.offsetHeight + \")\");\n\t\tthis.show(options);\n\t} else {\n\t\tthis.cancel();\n\t}\n};\n\nexports.Popup = Popup;\n\n})();\n",
"title": "$:/core/modules/utils/dom/popup.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/scroller.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/dom/scroller.js\ntype: application/javascript\nmodule-type: utils\n\nModule that creates a $tw.utils.Scroller object prototype that manages scrolling in the browser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nEvent handler for when the `tw-scroll` event hits the document body\n*/\nvar PageScroller = function() {\n\tthis.idRequestFrame = null;\n\tthis.requestAnimationFrame = window.requestAnimationFrame ||\n\t\twindow.webkitRequestAnimationFrame ||\n\t\twindow.mozRequestAnimationFrame ||\n\t\tfunction(callback) {\n\t\t\treturn window.setTimeout(callback, 1000/60);\n\t\t};\n\tthis.cancelAnimationFrame = window.cancelAnimationFrame ||\n\t\twindow.webkitCancelAnimationFrame ||\n\t\twindow.webkitCancelRequestAnimationFrame ||\n\t\twindow.mozCancelAnimationFrame ||\n\t\twindow.mozCancelRequestAnimationFrame ||\n\t\tfunction(id) {\n\t\t\twindow.clearTimeout(id);\n\t\t};\n};\n\nPageScroller.prototype.cancelScroll = function() {\n\tif(this.idRequestFrame) {\n\t\tthis.cancelAnimationFrame.call(window,this.idRequestFrame);\n\t\tthis.idRequestFrame = null;\n\t}\n};\n\n/*\nHandle an event\n*/\nPageScroller.prototype.handleEvent = function(event) {\n\tif(event.type === \"tw-scroll\") {\n\t\treturn this.scrollIntoView(event.target);\n\t}\n\treturn true;\n};\n\n/*\nHandle a scroll event hitting the page document\n*/\nPageScroller.prototype.scrollIntoView = function(element) {\n\t// Get the offset bounds of the element\n\tvar bounds = {\n\t\t\tleft: element.offsetLeft,\n\t\t\ttop: element.offsetTop,\n\t\t\twidth: element.offsetWidth,\n\t\t\theight: element.offsetHeight\n\t\t};\n\t// Walk up the tree adjusting the offset bounds by each offsetParent\n\twhile(element.offsetParent) {\n\t\telement = element.offsetParent;\n\t\tbounds.left += element.offsetLeft;\n\t\tbounds.top += element.offsetTop;\n\t}\n\t// Now get ready to scroll the body\n\tthis.cancelScroll();\n\tthis.startTime = new Date();\n\tvar scrollPosition = $tw.utils.getScrollPosition(),\n\t\t// We'll consider the horizontal and vertical scroll directions separately via this function\n\t\tgetEndPos = function(targetPos,targetSize,currentPos,currentSize) {\n\t\t\t// If the target is above/left of the current view, then scroll to it's top/left\n\t\t\tif(targetPos <= currentPos) {\n\t\t\t\treturn targetPos;\n\t\t\t// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window\n\t\t\t} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {\n\t\t\t\treturn targetPos + targetSize - currentSize;\n\t\t\t// If the target is big, then just scroll to the top\n\t\t\t} else if(currentPos < targetPos) {\n\t\t\t\treturn targetPos;\n\t\t\t// Otherwise, stay where we are\n\t\t\t} else {\n\t\t\t\treturn currentPos;\n\t\t\t}\n\t\t},\n\t\tendX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth),\n\t\tendY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);\n\t// Only scroll if necessary\n\tif(endX !== scrollPosition.x || endY !== scrollPosition.y) {\n\t\tvar self = this,\n\t\t\tdrawFrame;\n\t\tdrawFrame = function () {\n\t\t\tvar t = ((new Date()) - self.startTime) / $tw.config.preferences.animationDuration;\n\t\t\tif(t >= 1) {\n\t\t\t\tself.cancelScroll();\n\t\t\t\tt = 1;\n\t\t\t}\n\t\t\tt = $tw.utils.slowInSlowOut(t);\n\t\t\twindow.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t);\n\t\t\tif(t < 1) {\n\t\t\t\tself.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);\n\t\t\t}\n\t\t};\n\t\tdrawFrame();\n\t}\n};\n\nexports.PageScroller = PageScroller;\n\n})();\n",
"title": "$:/core/modules/utils/dom/scroller.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/styles.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/styles.js\ntype: application/javascript\nmodule-type: utils\n\nThe stylesheet manager automatically renders any tiddlers tagged \"$:/tags/stylesheet\" as HTML style elements.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar STYLESHEET_ID_PREFIX = \"tw-tiddler-stylesheet-\",\n\tSTYLESHEET_TAG = \"$:/tags/stylesheet\";\n\nfunction StylesheetManager(wiki) {\n\tthis.wiki = wiki;\n\tthis.stylesheets = {}; // Hashmap of currently rendered stylesheets\n\t// Apply initial stylesheets\n\tvar self = this,\n\t\tstylesheetTiddlers = this.wiki.filterTiddlers(\"[is[shadow]!has[draft.of]tag[\" + STYLESHEET_TAG + \"]] [!is[shadow]!has[draft.of]tag[\" + STYLESHEET_TAG + \"]]\");\n\t$tw.utils.each(stylesheetTiddlers,function(title,index) {\n\t\tself.addStylesheet(title);\n\t});\n\t// Listen out for changes\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tself.handleTiddlerChanges(changes);\n\t});\n}\n\nStylesheetManager.prototype.addStylesheet = function(title) {\n\t// Record the stylesheet in the hashmap\n\tthis.stylesheets[title] = true;\n\t// Parse the tiddler and render as plain text\n\tvar parser = this.wiki.parseTiddler(title),\n\t\trenderTree = new $tw.WikiRenderTree(parser,{wiki: this.wiki, context: {tiddlerTitle: title}, document: $tw.document});\n\trenderTree.execute();\n\tvar container = $tw.document.createElement(\"div\");\n\trenderTree.renderInDom(container);\n\tvar text = container.textContent;\n\t// Create a style element and put it in the document\n\tvar styleNode = document.createElement(\"style\");\n\tstyleNode.setAttribute(\"type\",\"text/css\");\n\tstyleNode.setAttribute(\"id\",STYLESHEET_ID_PREFIX + title);\n\tstyleNode.appendChild(document.createTextNode(text));\n\tdocument.getElementsByTagName(\"head\")[0].appendChild(styleNode);\n};\n\nStylesheetManager.prototype.removeStylesheet = function(title) {\n\t// Remove the stylesheet from the hashmap\n\tif($tw.utils.hop(this.stylesheets,title)) {\n\t\tdelete this.stylesheets[title];\n\t}\n\t// Remove the stylesheet from the document\n\tvar styleNode = document.getElementById(STYLESHEET_ID_PREFIX + title);\n\tif(styleNode) {\n\t\tstyleNode.parentNode.removeChild(styleNode);\n\t}\n};\n\nStylesheetManager.prototype.handleTiddlerChanges = function(changes) {\n\tvar self = this;\n\t$tw.utils.each(changes,function(change,title) {\n\t\t// Remove any existing stylesheet for the changed tiddler\n\t\tif($tw.utils.hop(self.stylesheets,title)) {\n\t\t\tself.removeStylesheet(title);\n\t\t}\n\t\t// Add the stylesheet if it is tagged and not a draft\n\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\tif(tiddler && tiddler.hasTag(STYLESHEET_TAG) && !tiddler.hasField(\"draft.of\")) {\n\t\t\tself.addStylesheet(title);\n\t\t}\n\t});\n};\n\nexports.StylesheetManager = StylesheetManager;\n\n})();\n",
"title": "$:/core/modules/utils/styles.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/fakedom.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/fakedom.js\ntype: application/javascript\nmodule-type: global\n\nA barebones implementation of DOM interfaces needed by the rendering mechanism.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar TW_TextNode = function(text) {\n\tthis.textContent = text;\n}\n\nvar TW_Element = function(tag) {\n\tthis.tag = tag;\n\tthis.attributes = {};\n\tthis.isRaw = false;\n\tthis.children = [];\n}\n\nTW_Element.prototype.setAttribute = function(name,value) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot setAttribute on a raw TW_Element\";\n\t}\n\tthis.attributes[name] = value;\n};\n\nTW_Element.prototype.setAttributeNS = function(namespace,name,value) {\n\tthis.setAttribute(name,value);\n};\n\nTW_Element.prototype.appendChild = function(node) {\n\tthis.children.push(node);\n\tnode.parentNode = this;\n};\n\nTW_Element.prototype.removeChild = function(node) {\n\tvar p = this.children.indexOf(node);\n\tif(p !== -1) {\n\t\tthis.children.splice(p,1);\n\t}\n};\n\nTW_Element.prototype.hasChildNodes = function() {\n\treturn !!this.children.length;\n};\n\nObject.defineProperty(TW_Element.prototype, \"firstChild\", {\n get: function() {\n \treturn this.children[0];\n }\n});\n\nTW_Element.prototype.addEventListener = function(type,listener,useCapture) {\n\t// Do nothing\n};\n\nObject.defineProperty(TW_Element.prototype, \"outerHTML\", {\n get: function() {\n\t\tvar output = [],attr,a,v;\n\t\toutput.push(\"<\",this.tag);\n\t\tif(this.attributes) {\n\t\t\tattr = [];\n\t\t\tfor(a in this.attributes) {\n\t\t\t\tattr.push(a);\n\t\t\t}\n\t\t\tattr.sort();\n\t\t\tfor(a=0; a<attr.length; a++) {\n\t\t\t\tv = this.attributes[attr[a]];\n\t\t\t\tif(v !== undefined) {\n\t\t\t\t\toutput.push(\" \",attr[a],\"='\",$tw.utils.htmlEncode(v),\"'\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.push(\">\\n\");\n\t\tif($tw.config.htmlVoidElements.indexOf(this.tag) === -1) {\n\t\t\toutput.push(this.innerHTML);\n\t\t\toutput.push(\"</\",this.tag,\">\");\n\t\t}\n\t\treturn output.join(\"\");\n }\n});\n\nObject.defineProperty(TW_Element.prototype, \"innerHTML\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\treturn this.rawHTML;\n\t\t} else {\n\t\t\tvar b = [];\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tif(node instanceof TW_Element) {\n\t\t\t\t\tb.push(node.outerHTML);\n\t\t\t\t} else if(node instanceof TW_TextNode) {\n\t\t\t\t\tb.push($tw.utils.htmlEncode(node.textContent));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn b.join(\"\");\n\t\t}\n\t},\n set: function(value) {\n \tthis.isRaw = true;\n \tthis.rawHTML = value;\n }\n});\n\nObject.defineProperty(TW_Element.prototype, \"textContent\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\tthrow \"Cannot get textContent on a raw TW_Element\";\n\t\t} else {\n\t\t\tvar b = [];\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tb.push(node.textContent);\n\t\t\t});\n\t\t\treturn b.join(\"\");\n\t\t}\n\t}\n});\n\nvar document = {\n\tcreateElementNS: function(namespace,tag) {\n\t\treturn new TW_Element(tag);\n\t},\n\tcreateElement: function(tag) {\n\t\treturn new TW_Element(tag);\n\t},\n\tcreateTextNode: function(text) {\n\t\treturn new TW_TextNode(text);\n\t},\n};\n\nexports.document = document;\n\n})();\n",
"title": "$:/core/modules/utils/fakedom.js",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/utils/parsetree.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/parsetree.js\ntype: application/javascript\nmodule-type: utils\n\nParse tree utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.addAttributeToParseTreeNode = function(node,name,value) {\n\tif(node.type === \"element\") {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes[name] = {type: \"string\", value: value};\n\t}\n};\n\nexports.addClassToParseTreeNode = function(node,classString) {\n\tvar classes = [];\n\tif(node.type === \"element\") {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes[\"class\"] = node.attributes[\"class\"] || {type: \"string\", value: \"\"};\n\t\tif(node.attributes[\"class\"].type === \"string\") {\n\t\t\tif(node.attributes[\"class\"].value !== \"\") {\n\t\t\t\tclasses = node.attributes[\"class\"].value.split(\" \");\n\t\t\t}\n\t\t\tif(classString !== \"\") {\n\t\t\t\t$tw.utils.pushTop(classes,classString.split(\" \"));\n\t\t\t}\n\t\t\tnode.attributes[\"class\"].value = classes.join(\" \");\n\t\t}\n\t}\n};\n\nexports.addStyleToParseTreeNode = function(node,name,value) {\n\tif(node.type === \"element\") {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes[\"style\"] = node.attributes[\"style\"] || {type: \"string\", value: \"\"};\n\t\tif(node.attributes[\"style\"].type === \"string\") {\n\t\t\tnode.attributes[\"style\"].value += name + \":\" + value + \";\";\n\t\t}\n\t}\n};\n\nexports.findParseTreeNode = function(nodeArray,search) {\n\tfor(var t=0; t<nodeArray.length; t++) {\n\t\tif(nodeArray[t].type === search.type && nodeArray[t].tag === search.tag) {\n\t\t\treturn nodeArray[t];\n\t\t}\n\t}\n\treturn undefined;\n};\n\n})();\n",
"title": "$:/core/modules/utils/parsetree.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/utils.js": {
"text": "/*\\\ntitle: $:/core/modules/utils/utils.js\ntype: application/javascript\nmodule-type: utils\n\nVarious static utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nTrim whitespace from the start and end of a string\nThanks to Steven Levithan, http://blog.stevenlevithan.com/archives/faster-trim-javascript\n*/\nexports.trim = function(str) {\n\tif(typeof str === \"string\") {\n\t\treturn str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n\t} else {\n\t\treturn str;\n\t}\n};\n\n/*\nReturn the number of keys in an object\n*/\nexports.count = function(object) {\n\tvar s = 0;\n\t$tw.utils.each(object,function() {s++;});\n\treturn s;\n};\n\n/*\nPush entries onto an array, removing them first if they already exist in the array\n\tarray: array to modify\n\tvalue: a single value to push or an array of values to push\n*/\nexports.pushTop = function(array,value) {\n\tvar t,p;\n\tif($tw.utils.isArray(value)) {\n\t\t// Remove any array entries that are duplicated in the new values\n\t\tfor(t=0; t<value.length; t++) {\n\t\t\tp = array.indexOf(value[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tarray.splice(p,1);\n\t\t\t}\n\t\t}\n\t\t// Push the values on top of the main array\n\t\tarray.push.apply(array,value);\n\t} else {\n\t\tp = array.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tarray.splice(p,1);\n\t\t}\n\t\tarray.push(value);\n\t}\n};\n\n/*\nRemove entries from an array\n\tarray: array to modify\n\tvalue: a single value to remove, or an array of values to remove\n*/\nexports.removeArrayEntries = function(array,value) {\n\tvar t,p;\n\tif($tw.utils.isArray(value)) {\n\t\tfor(t=0; t<value.length; t++) {\n\t\t\tp = array.indexOf(value[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tarray.splice(p,1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tp = array.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tarray.splice(p,1);\n\t\t}\n\t}\n};\n\n/*\nCheck whether any members of a hashmap are present in another hashmap\n*/\nexports.checkDependencies = function(dependencies,changes) {\n\tvar hit = false;\n\t$tw.utils.each(changes,function(change,title) {\n\t\tif($tw.utils.hop(dependencies,title)) {\n\t\t\thit = true;\n\t\t}\n\t});\n\treturn hit;\n};\n\nexports.extend = function(object /* [, src] */) {\n\t$tw.utils.each(Array.prototype.slice.call(arguments, 1), function(source) {\n\t\tif(source) {\n\t\t\tfor(var property in source) {\n\t\t\t\tobject[property] = source[property];\n\t\t\t}\n\t\t}\n\t});\n\treturn object;\n};\n\nexports.deepCopy = function(object) {\n\tvar result,t;\n\tif($tw.utils.isArray(object)) {\n\t\t// Copy arrays\n\t\tresult = object.slice(0);\n\t} else if(typeof object === \"object\") {\n\t\tresult = {};\n\t\tfor(t in object) {\n\t\t\tif(object[t] !== undefined) {\n\t\t\t\tresult[t] = $tw.utils.deepCopy(object[t]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tresult = object;\n\t}\n\treturn result;\n};\n\nexports.extendDeepCopy = function(object,extendedProperties) {\n\tvar result = $tw.utils.deepCopy(object),t;\n\tfor(t in extendedProperties) {\n\t\tif(extendedProperties[t] !== undefined) {\n\t\t\tresult[t] = $tw.utils.deepCopy(extendedProperties[t]);\n\t\t}\n\t}\n\treturn result;\n};\n\nexports.slowInSlowOut = function(t) {\n\treturn (1 - ((Math.cos(t * Math.PI) + 1) / 2));\n};\n\nexports.formatDateString = function (date,template) {\n\tvar t = template.replace(/0hh12/g,$tw.utils.pad($tw.utils.getHours12(date)));\n\tt = t.replace(/hh12/g,$tw.utils.getHours12(date));\n\tt = t.replace(/0hh/g,$tw.utils.pad(date.getHours()));\n\tt = t.replace(/hh/g,date.getHours());\n\tt = t.replace(/mmm/g,$tw.config.dateFormats.shortMonths[date.getMonth()]);\n\tt = t.replace(/0mm/g,$tw.utils.pad(date.getMinutes()));\n\tt = t.replace(/mm/g,date.getMinutes());\n\tt = t.replace(/0ss/g,$tw.utils.pad(date.getSeconds()));\n\tt = t.replace(/ss/g,date.getSeconds());\n\tt = t.replace(/[ap]m/g,$tw.utils.getAmPm(date).toLowerCase());\n\tt = t.replace(/[AP]M/g,$tw.utils.getAmPm(date).toUpperCase());\n\tt = t.replace(/wYYYY/g,$tw.utils.getYearForWeekNo(date));\n\tt = t.replace(/wYY/g,$tw.utils.pad($tw.utils.getYearForWeekNo(date)-2000));\n\tt = t.replace(/YYYY/g,date.getFullYear());\n\tt = t.replace(/YY/g,$tw.utils.pad(date.getFullYear()-2000));\n\tt = t.replace(/MMM/g,$tw.config.dateFormats.months[date.getMonth()]);\n\tt = t.replace(/0MM/g,$tw.utils.pad(date.getMonth()+1));\n\tt = t.replace(/MM/g,date.getMonth()+1);\n\tt = t.replace(/0WW/g,$tw.utils.pad($tw.utils.getWeek(date)));\n\tt = t.replace(/WW/g,$tw.utils.getWeek(date));\n\tt = t.replace(/DDD/g,$tw.config.dateFormats.days[date.getDay()]);\n\tt = t.replace(/ddd/g,$tw.config.dateFormats.shortDays[date.getDay()]);\n\tt = t.replace(/0DD/g,$tw.utils.pad(date.getDate()));\n\tt = t.replace(/DDth/g,date.getDate()+$tw.utils.getDaySuffix(date));\n\tt = t.replace(/DD/g,date.getDate());\n\tvar tz = date.getTimezoneOffset();\n\tvar atz = Math.abs(tz);\n\tt = t.replace(/TZD/g,(tz < 0 ? '+' : '-') + $tw.utils.pad(Math.floor(atz / 60)) + ':' + $tw.utils.pad(atz % 60));\n\tt = t.replace(/\\\\/g,\"\");\n\treturn t;\n};\n\nexports.getAmPm = function(date) {\n\treturn date.getHours() >= 12 ? $tw.config.dateFormats.pm : $tw.config.dateFormats.am;\n};\n\nexports.getDaySuffix = function(date) {\n\treturn $tw.config.dateFormats.daySuffixes[date.getDate()-1];\n};\n\nexports.getWeek = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) d=7;// JavaScript Sun=0, ISO Sun=7\n\tdt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week to calculate weekNo\n\tvar n = Math.floor((dt.getTime()-new Date(dt.getFullYear(),0,1)+3600000)/86400000);\n\treturn Math.floor(n/7)+1;\n};\n\nexports.getYearForWeekNo = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) d=7;// JavaScript Sun=0, ISO Sun=7\n\tdt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week\n\treturn dt.getFullYear();\n};\n\nexports.getHours12 = function(date) {\n\tvar h = date.getHours();\n\treturn h > 12 ? h-12 : ( h > 0 ? h : 12 );\n};\n\n/*\nConvert a date delta in milliseconds into a string representation of \"23 seconds ago\", \"27 minutes ago\" etc.\n\tdelta: delta in milliseconds\nReturns an object with these members:\n\tdescription: string describing the delta period\n\tupdatePeriod: time in millisecond until the string will be inaccurate\n*/\nexports.getRelativeDate = function(delta) {\n\tvar units = [\n\t\t{name: \"years\", duration: 365 * 24 * 60 * 60 * 1000},\n\t\t{name: \"months\", duration: (365/12) * 24 * 60 * 60 * 1000},\n\t\t{name: \"days\", duration: 24 * 60 * 60 * 1000},\n\t\t{name: \"hours\", duration: 60 * 60 * 1000},\n\t\t{name: \"minutes\", duration: 60 * 1000},\n\t\t{name: \"seconds\", duration: 1000}\n\t];\n\tfor(var t=0; t<units.length; t++) {\n\t\tvar result = Math.floor(delta / units[t].duration);\n\t\tif(result >= 2) {\n\t\t\treturn {\n\t\t\t\tdelta: delta,\n\t\t\t\tdescription: result + \" \" + units[t].name + \" ago\",\n\t\t\t\tupdatePeriod: units[t].duration\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tdelta: delta,\n\t\tdescription: \"1 second ago\",\n\t\tupdatePeriod: 1000\n\t};\n};\n\n// Convert & to \"&\", < to \"<\", > to \">\" and \" to \""\"\nexports.htmlEncode = function(s) {\n\tif(s) {\n\t\treturn s.toString().replace(/&/mg,\"&\").replace(/</mg,\"<\").replace(/>/mg,\">\").replace(/\\\"/mg,\""\");\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n// Converts all HTML entities to their character equivalents\nexports.entityDecode = function(s) {\n\tvar e = s.substr(1,s.length-2); // Strip the & and the ;\n\tif(e.charAt(0) === \"#\") {\n\t\tif(e.charAt(1) === \"x\" || e.charAt(1) === \"X\") {\n\t\t\treturn String.fromCharCode(parseInt(e.substr(2),16));\t\n\t\t} else {\n\t\t\treturn String.fromCharCode(parseInt(e.substr(1),10));\n\t\t}\n\t} else {\n\t\tvar c = $tw.config.htmlEntities[e];\n\t\tif(c) {\n\t\t\treturn String.fromCharCode(c);\n\t\t} else {\n\t\t\treturn s; // Couldn't convert it as an entity, just return it raw\n\t\t}\n\t}\n};\n\nexports.unescapeLineBreaks = function(s) {\n\treturn s.replace(/\\\\n/mg,\"\\n\").replace(/\\\\b/mg,\" \").replace(/\\\\s/mg,\"\\\\\").replace(/\\r/mg,\"\");\n};\n\n/*\n * Returns an escape sequence for given character. Uses \\x for characters <=\n * 0xFF to save space, \\u for the rest.\n *\n * The code needs to be in sync with th code template in the compilation\n * function for \"action\" nodes.\n */\n// Copied from peg.js, thanks to David Majda\nexports.escape = function(ch) {\n\tvar charCode = ch.charCodeAt(0);\n\tif (charCode <= 0xFF) {\n\t\treturn '\\\\x' + $tw.utils.pad(charCode.toString(16).toUpperCase());\n\t} else {\n\t\treturn '\\\\u' + $tw.utils.pad(charCode.toString(16).toUpperCase(),4);\n\t}\n};\n\n// Turns a string into a legal JavaScript string\n// Copied from peg.js, thanks to David Majda\nexports.stringify = function(s) {\n\t/*\n\t* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string\n\t* literal except for the closing quote character, backslash, carriage return,\n\t* line separator, paragraph separator, and line feed. Any character may\n\t* appear in the form of an escape sequence.\n\t*\n\t* For portability, we also escape escape all non-ASCII characters.\n\t*/\n\treturn s\n\t\t.replace(/\\\\/g, '\\\\\\\\') // backslash\n\t\t.replace(/\"/g, '\\\\\"') // double quote character\n\t\t.replace(/'/g, \"\\\\'\") // single quote character\n\t\t.replace(/\\r/g, '\\\\r') // carriage return\n\t\t.replace(/\\n/g, '\\\\n') // line feed\n\t\t.replace(/[\\x80-\\uFFFF]/g, exports.escape); // non-ASCII characters\n};\n\n/*\nEscape the RegExp special characters with a preceding backslash\n*/\nexports.escapeRegExp = function(s) {\n return s.replace(/[\\-\\/\\\\\\^\\$\\*\\+\\?\\.\\(\\)\\|\\[\\]\\{\\}]/g, '\\\\$&');\n};\n\nexports.nextTick = function(fn) {\n/*global window: false */\n\tif(typeof window !== \"undefined\") {\n\t\t// Apparently it would be faster to use postMessage - http://dbaron.org/log/20100309-faster-timeouts\n\t\twindow.setTimeout(fn,4);\n\t} else {\n\t\tprocess.nextTick(fn);\n\t}\n};\n\n/*\nConvert a hyphenated CSS property name into a camel case one\n*/\nexports.unHyphenateCss = function(propName) {\n\treturn propName.replace(/-([a-z])/gi, function(match0,match1) {\n\t\treturn match1.toUpperCase();\n\t});\n};\n\n/*\nConvert a camelcase CSS property name into a dashed one (\"backgroundColor\" --> \"background-color\")\n*/\nexports.hyphenateCss = function(propName) {\n\treturn propName.replace(/([A-Z])/g, function(match0,match1) {\n\t\treturn \"-\" + match1.toLowerCase();\n\t});\n};\n\n/*\nParse a text reference of one of these forms:\n* title\n* !!field\n* title!!field\n* title##index\n* etc\nReturns an object with the following fields, all optional:\n* title: tiddler title\n* field: tiddler field name\n* index: JSON property index\n*/\nexports.parseTextReference = function(textRef) {\n\t// Separate out the title, field name and/or JSON indices\n\tvar reTextRef = /^\\s*([^\\s!#]+)?(?:(?:!!([^\\s]+))|(?:##([^\\s]+)))?\\s*/mg,\n\t\tmatch = reTextRef.exec(textRef);\n\tif(match && reTextRef.lastIndex === textRef.length) {\n\t\t// Return the parts\n\t\treturn {\n\t\t\ttitle: match[1],\n\t\t\tfield: match[2],\n\t\t\tindex: match[3]\n\t\t};\n\t} else {\n\t\t// If we couldn't parse it (eg it started with a)\n\t\treturn {\n\t\t\ttitle: textRef\n\t\t};\n\t}\n};\n\n/*\nExtract the version number from the meta tag or from the boot file\n*/\n\nif($tw.browser) {\n\n// Browser version\nexports.extractVersionInfo = function() {\n\tvar metatags = document.getElementsByTagName(\"meta\");\n\tfor(var t=0; t<metatags.length; t++) {\n\t\tvar m = metatags[t];\n\t\tif(m.name === \"tiddlywiki-version\") {\n\t\t\treturn m.content;\n\t\t}\n\t}\n\treturn null;\n};\n\n} else {\n\n// Server version\nexports.extractVersionInfo = function() {\n\treturn $tw.packageInfo.version;\n};\n\n}\n\n})();\n",
"title": "$:/core/modules/utils/utils.js",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/widgets/button.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/button.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the button widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ButtonWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nButtonWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.message = this.renderer.getAttribute(\"message\");\n\tthis.param = this.renderer.getAttribute(\"param\");\n\tthis.set = this.renderer.getAttribute(\"set\");\n\tthis.setTo = this.renderer.getAttribute(\"setTo\");\n\tthis.popup = this.renderer.getAttribute(\"popup\");\n\tthis.hover = this.renderer.getAttribute(\"hover\");\n\tthis.qualifyTiddlerTitles = this.renderer.getAttribute(\"qualifyTiddlerTitles\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\tthis.selectedClass = this.renderer.getAttribute(\"selectedClass\");\n\t// Compose the button\n\tvar classes = [\"tw-button\"];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\tvar events = [{name: \"click\", handlerObject: this, handlerMethod: \"handleClickEvent\"}];\n\tif(this.hover === \"yes\") {\n\t\tevents.push({name: \"mouseover\", handlerObject: this, handlerMethod: \"handleMouseOverOrOutEvent\"});\n\t\tevents.push({name: \"mouseout\", handlerObject: this, handlerMethod: \"handleMouseOverOrOutEvent\"});\n\t}\n\tif(this.set && this.setTo && this.selectedClass) {\n\t\tif(this.isSelected()) {\n\t\t\tclasses.push(this.selectedClass);\n\t\t}\n\t}\n\t// Set the return element\n\tthis.tag = \"button\";\n\tthis.attributes ={\"class\": classes.join(\" \")};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n\tthis.events = events;\n};\n\nButtonWidget.prototype.dispatchMessage = function(event) {\n\t$tw.utils.dispatchCustomEvent(event.target,this.message,{\n\t\tparam: this.param,\n\t\ttiddlerTitle: this.renderer.tiddlerTitle\n\t});\n};\n\nButtonWidget.prototype.triggerPopup = function(event) {\n\tvar title = this.popup;\n\tif(this.qualifyTiddlerTitles) {\n\t\ttitle = title + \"-\" + this.renderer.renderTree.getContextScopeId(this.renderer.parentRenderer);\n\t}\n\t$tw.popup.triggerPopup({\n\t\tdomNode: this.renderer.domNode,\n\t\ttitle: title,\n\t\twiki: this.renderer.renderTree.wiki\n\t});\n};\n\nButtonWidget.prototype.isSelected = function() {\n\tvar title = this.set;\n\tif(this.qualifyTiddlerTitles) {\n\t\ttitle = title + \"-\" + this.renderer.renderTree.getContextScopeId(this.renderer.parentRenderer);\n\t}\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(title);\n\treturn tiddler ? tiddler.fields.text === this.setTo : false;\n};\n\nButtonWidget.prototype.setTiddler = function() {\n\tvar title = this.set;\n\tif(this.qualifyTiddlerTitles) {\n\t\ttitle = title + \"-\" + this.renderer.renderTree.getContextScopeId(this.renderer.parentRenderer);\n\t}\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(title);\n\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: title, text: this.setTo}));\n};\n\nButtonWidget.prototype.handleClickEvent = function(event) {\n\tvar handled = false;\n\tif(this.message) {\n\t\tthis.dispatchMessage(event);\n\t\thandled = true;\n\t}\n\tif(this.popup) {\n\t\tthis.triggerPopup(event);\n\t\thandled = true;\n\t}\n\tif(this.set) {\n\t\tthis.setTiddler();\n\t\thandled = true;\n\t}\n\tevent.stopPropagation();\n\tevent.preventDefault();\n\treturn handled;\n};\n\nButtonWidget.prototype.handleMouseOverOrOutEvent = function(event) {\n\tif(this.popup) {\n\t\tthis.triggerPopup(event);\n\t}\n\tevent.preventDefault();\n\treturn false;\n};\n\nButtonWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\tvar setTitle = this.set,\n\t\tpopupTitle = this.popup;\n\tif(this.qualifyTiddlerTitles) {\n\t\tvar scopeId = this.renderer.renderTree.getContextScopeId(this.renderer.parentRenderer);\n\t\tif(setTitle) {\n\t\t\tsetTitle = setTitle + \"-\" + scopeId;\n\t\t}\n\t\tif(popupTitle) {\n\t\t\tpopupTitle = popupTitle + \"-\" + scopeId;\n\t\t}\n\t}\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n \tif(changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.qualifyTiddlerTitles || changedAttributes[\"class\"] || (setTitle && changedTiddlers[setTitle]) || (popupTitle && changedTiddlers[popupTitle])) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.button = ButtonWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/button.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/checkbox.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/checkbox.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the checkbox widget.\n\n```\n<$checkbox tag=\"done\"/>\n\n<$checkbox tiddler=\"HelloThere\" tag=\"red\"/>\n\n<$checkbox tag=\"done\">\n<$view title/>\n</$checkbox>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar CheckboxWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nCheckboxWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\tthis.tagName = this.renderer.getAttribute(\"tag\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\t// Compute classes\n\tvar classes = [\"tw-checkbox\"];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\t// Create the checkbox and span elements\n\tvar nodeCheckbox = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"input\",\n\t\t\tattributes: {\n\t\t\t\ttype: {type: \"string\", value: \"checkbox\"}\n\t\t\t}\n\t\t},\n\t\tnodeSpan = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"span\",\n\t\t\tchildren: this.renderer.parseTreeNode.children\n\t\t};\n\t// Set the state of the checkbox\n\tif(this.getValue()) {\n\t\t$tw.utils.addAttributeToParseTreeNode(nodeCheckbox,\"checked\",\"true\");\n\t}\n\t// Set the return element\n\tthis.tag = \"label\";\n\tthis.attributes ={\"class\": classes.join(\" \")};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[nodeCheckbox,nodeSpan]);\n\tthis.events = [{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}];\n};\n\nCheckboxWidget.prototype.getValue = function() {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\treturn tiddler ? tiddler.hasTag(this.tagName) : false;\n};\n\nCheckboxWidget.prototype.handleChangeEvent = function(event) {\n\tvar checked = this.children[0].domNode.checked,\n\t\ttiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler && tiddler.hasTag(this.tagName) !== checked) {\n\t\tvar newTags = tiddler.fields.tags.slice(0),\n\t\t\tpos = newTags.indexOf(this.tagName);\n\t\tif(pos !== -1) {\n\t\t\tnewTags.splice(pos,1);\n\t\t}\n\t\tif(checked) {\n\t\t\tnewTags.push(this.tagName);\n\t\t}\n\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,{tags: newTags}));\n\t}\n};\n\nCheckboxWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.tiddler || changedAttributes.tag || changedAttributes[\"class\"]) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// Update the checkbox if necessary\n\t\tif(changedTiddlers[this.tiddlerTitle]) {\n\t\t\tthis.children[0].domNode.checked = this.getValue();\n\t\t}\n\t\t// Refresh children\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.checkbox = CheckboxWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/checkbox.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/datauri.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/datauri.js\ntype: application/javascript\nmodule-type: widget\n\nThe datauri widget displays the contents of a tiddler as a data URI.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DataUriWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nDataUriWidget.prototype.generate = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\t// Compose the data URI\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle),\n\t\turi = \"\";\n\tif(tiddler) {\n\t\tvar type = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\t\ttypeInfo = $tw.config.contentTypeInfo[type],\n\t\t\tisBase64 = typeInfo && typeInfo.encoding === \"base64\",\n\t\t\tparts = [\"data:\"];\n\t\tparts.push(type);\n\t\tparts.push(isBase64 ? \";base64\" : \"\");\n\t\tparts.push(\",\");\n\t\tparts.push(isBase64 ? tiddler.fields.text : encodeURIComponent(tiddler.fields.text));\n\t\turi = parts.join(\"\");\n\t}\n\t// Set the element\n\tthis.tag = \"pre\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-data-uri\"\n\t};\n\t// Create the renderers for the wrapper and the children\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: uri\n\t}]);\n};\n\nexports.datauri = DataUriWidget;\n\n})();",
"title": "$:/core/modules/widgets/datauri.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit/edit.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit/edit.js\ntype: application/javascript\nmodule-type: widget\n\nThe edit widget uses editor plugins to edit tiddlers of different types.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar EditWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Initialise the editors if they've not been done already\n\tif(!this.editors) {\n\t\tEditWidget.prototype.editors = {};\n\t\t$tw.modules.applyMethods(\"editor\",this.editors);\n\t}\n\t// Generate child nodes\n\tthis.generate();\n};\n\nEditWidget.prototype.generate = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\tthis.fieldName = this.renderer.getAttribute(\"field\",this.renderer.renderTree.getContextVariable(this.renderer,\"field\",\"text\"));\n\t// Choose the editor to use\n\t// TODO: Tiddler field modules should be able to specify a field type from which the editor is derived\n\tthis.editorName = this.chooseEditor();\n\tvar Editor = this.editors[this.editorName];\n\t// Instantiate the editor\n\tthis.editor = new Editor(this,this.tiddlerTitle,this.fieldName);\n\t// Ask the editor to create the widget element\n\tthis.editor.render();\n};\n\n/*\nReturn the name of the editor that should handle this tiddler field\n*/\nEditWidget.prototype.chooseEditor = function() {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(this.fieldName === \"text\" && tiddler && tiddler.fields.type && this.editors[tiddler.fields.type]) {\n\t\treturn tiddler.fields.type;\n\t}\n\treturn \"text/vnd.tiddlywiki\";\n};\n\nEditWidget.prototype.postRenderInDom = function() {\n\tif(this.editor && this.editor.postRenderInDom) {\n\t\tthis.editor.postRenderInDom();\n\t}\n};\n\nEditWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// We'll completely regenerate ourselves if any of our attributes have changed\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.format || this.chooseEditor() !== this.editorName) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else if(this.tiddlerTitle && changedTiddlers[this.tiddlerTitle]) {\n\t\t// Refresh the editor if our tiddler has changed\n\t\tif(this.editor && this.editor.refreshInDom) {\n\t\t\tthis.editor.refreshInDom(changedTiddlers);\n\t\t}\n\t} else {\n\t\t// Otherwise, just refresh any child nodes\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.edit = EditWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/edit/edit.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit/editors/bitmapeditor.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit/editors/bitmapeditor.js\ntype: application/javascript\nmodule-type: editor\n\nA bitmap editor\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Default images sizes\nvar DEFAULT_IMAGE_WIDTH = 300,\n\tDEFAULT_IMAGE_HEIGHT = 185;\n\n// The elements of the editor UI\nvar DOM_CANVAS = 0,\n\tDOM_WIDTH = 1,\n\tDOM_HEIGHT = 2;\n\nvar BitmapEditor = function(editWidget,tiddlerTitle,fieldName) {\n\tthis.editWidget = editWidget;\n\tthis.tiddlerTitle = tiddlerTitle;\n\tthis.fieldName = fieldName;\n};\n\nBitmapEditor.prototype.render = function() {\n\t// Set the element details\n\tthis.editWidget.tag = \"div\";\n\tthis.editWidget.attributes = {\n\t\t\"class\": \"tw-edit-bitmapeditor-wrapper\"\n\t};\n\tvar children = [{\n\t\ttype: \"element\",\n\t\ttag: \"canvas\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: \"tw-edit-bitmapeditor\"}\n\t\t},\n\t\tevents: [{\n\t\t\tname: \"touchstart\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleTouchStartEvent\"\n\t\t},{\n\t\t\tname: \"touchmove\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleTouchMoveEvent\"\n\t\t},{\n\t\t\tname: \"touchend\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleTouchEndEvent\"\n\t\t},{\n\t\t\tname: \"mousedown\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleMouseDownEvent\"\n\t\t},{\n\t\t\tname: \"mousemove\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleMouseMoveEvent\"\n\t\t},{\n\t\t\tname: \"mouseup\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleMouseUpEvent\"\n\t\t}]\n\t},{\n\t\ttype: \"element\",\n\t\ttag: \"input\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: \"tw-edit-bitmapeditor-width\"},\n\t\t\t\"type\": {type: \"string\", value: \"number\"},\n\t\t\t\"value\": {type: \"string\", value: \"\"}\n\t\t},\n\t\tevents: [{\n\t\t\tname: \"change\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleWidthChangeEvent\"\n\t\t}]\n\t},{\n\t\ttype: \"element\",\n\t\ttag: \"input\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: \"tw-edit-bitmapeditor-height\"},\n\t\t\t\"type\": {type: \"string\", value: \"number\"},\n\t\t\t\"value\": {type: \"string\", value: \"\"}\n\t\t},\n\t\tevents: [{\n\t\t\tname: \"change\",\n\t\t\thandlerObject: this,\n\t\t\thandlerMethod: \"handleHeightChangeEvent\"\n\t\t}]\n\t}];\n\tthis.editWidget.children = this.editWidget.renderer.renderTree.createRenderers(this.editWidget.renderer,children);\n};\n\nBitmapEditor.prototype.postRenderInDom = function() {\n\tvar tiddler = this.editWidget.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle),\n\t\tcanvas = this.getDomNode(DOM_CANVAS),\n\t\tcurrImage = new Image();\n\t// Set up event handlers for loading the image\n\tvar self = this;\n\tcurrImage.onload = function() {\n\t\t// Copy the image to the on-screen canvas\n\t\tself.initCanvas(canvas,currImage.width,currImage.height,currImage);\n\t\t// And also copy the current bitmap to the off-screen canvas\n\t\tself.currCanvas = self.editWidget.renderer.renderTree.document.createElement(\"canvas\");\n\t\tself.initCanvas(self.currCanvas,currImage.width,currImage.height,currImage);\n\t\t// Set the width and height input boxes\n\t\tself.updateSize();\n\t};\n\tcurrImage.onerror = function() {\n\t\t// Set the on-screen canvas size and clear it\n\t\tself.initCanvas(canvas,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the off-screen canvas size and clear it\n\t\tself.currCanvas = self.editWidget.renderer.renderTree.document.createElement(\"canvas\");\n\t\tself.initCanvas(self.currCanvas,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the width and height input boxes\n\t\tself.updateSize();\n\t}\n\t// Get the current bitmap into an image object\n\tcurrImage.src = \"data:\" + tiddler.fields.type + \";base64,\" + tiddler.fields.text;\n};\n\nBitmapEditor.prototype.initCanvas = function(canvas,width,height,image) {\n\tcanvas.width = width;\n\tcanvas.height = height;\n\tvar ctx = canvas.getContext(\"2d\");\n\tif(image) {\n\t\tctx.drawImage(image,0,0);\n\t} else {\n\t\tctx.fillStyle = \"#fff\";\n\t\tctx.fillRect(0,0,canvas.width,canvas.height);\n\t}\n}\n\nBitmapEditor.prototype.getDomNode = function(index) {\n\treturn this.editWidget.renderer.domNode.childNodes[index];\n};\n\n/*\n** Update the input boxes with the actual size of the canvas\n*/\nBitmapEditor.prototype.updateSize = function() {\n\tthis.getDomNode(DOM_WIDTH).value = this.currCanvas.width;\n\tthis.getDomNode(DOM_HEIGHT).value = this.currCanvas.height;\n};\n\n/*\n** Change the size of the canvas, preserving the current image\n*/\nBitmapEditor.prototype.changeCanvasSize = function(newWidth,newHeight) {\n\t// Create and size a new canvas\n\tvar newCanvas = this.editWidget.renderer.renderTree.document.createElement(\"canvas\");\n\tthis.initCanvas(newCanvas,newWidth,newHeight);\n\t// Copy the old image\n\tvar ctx = newCanvas.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n\t// Set the new canvas as the current one\n\tthis.currCanvas = newCanvas;\n\t// Set the size of the onscreen canvas\n\tvar canvas = this.getDomNode(DOM_CANVAS);\n\tcanvas.width = newWidth;\n\tcanvas.height = newHeight;\n\t// Paint the onscreen canvas with the offscreen canvas\n\tctx = canvas.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n};\n\nBitmapEditor.prototype.handleWidthChangeEvent = function(event) {\n\t// Get the new width\n\tvar newWidth = parseInt(this.getDomNode(DOM_WIDTH).value,10);\n\t// Update if necessary\n\tif(newWidth > 0 && newWidth !== this.currCanvas.width) {\n\t\tthis.changeCanvasSize(newWidth,this.currCanvas.height);\n\t}\n\t// Update the input controls\n\tthis.updateSize();\n};\n\nBitmapEditor.prototype.handleHeightChangeEvent = function(event) {\n\t// Get the new width\n\tvar newHeight = parseInt(this.getDomNode(DOM_HEIGHT).value,10);\n\t// Update if necessary\n\tif(newHeight > 0 && newHeight !== this.currCanvas.height) {\n\t\tthis.changeCanvasSize(this.currCanvas.width,newHeight);\n\t}\n\t// Update the input controls\n\tthis.updateSize();\n};\n\nBitmapEditor.prototype.handleTouchStartEvent = function(event) {\n\tthis.brushDown = true;\n\tthis.strokeStart(event.touches[0].clientX,event.touches[0].clientY);\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nBitmapEditor.prototype.handleTouchMoveEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.strokeMove(event.touches[0].clientX,event.touches[0].clientY);\n\t}\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nBitmapEditor.prototype.handleTouchEndEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.brushDown = false;\n\t\tthis.strokeEnd();\n\t}\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nBitmapEditor.prototype.handleMouseDownEvent = function(event) {\n\tthis.strokeStart(event.clientX,event.clientY);\n\tthis.brushDown = true;\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nBitmapEditor.prototype.handleMouseMoveEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.strokeMove(event.clientX,event.clientY);\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nBitmapEditor.prototype.handleMouseUpEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.brushDown = false;\n\t\tthis.strokeEnd();\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nBitmapEditor.prototype.adjustCoordinates = function(x,y) {\n\tvar canvas = this.getDomNode(DOM_CANVAS),\n\t\tcanvasRect = canvas.getBoundingClientRect(),\n\t\tscale = canvas.width/canvasRect.width;\n\treturn {x: (x - canvasRect.left) * scale, y: (y - canvasRect.top) * scale};\n};\n\nBitmapEditor.prototype.strokeStart = function(x,y) {\n\t// Start off a new stroke\n\tthis.stroke = [this.adjustCoordinates(x,y)];\n};\n\nBitmapEditor.prototype.strokeMove = function(x,y) {\n\tvar canvas = this.getDomNode(DOM_CANVAS),\n\t\tctx = canvas.getContext(\"2d\"),\n\t\tt;\n\t// Add the new position to the end of the stroke\n\tthis.stroke.push(this.adjustCoordinates(x,y));\n\t// Redraw the previous image\n\tctx.drawImage(this.currCanvas,0,0);\n\t// Render the stroke\n\tctx.strokeStyle = \"#ff0\";\n\tctx.lineWidth = 3;\n\tctx.lineCap = \"round\";\n\tctx.lineJoin = \"round\";\n\tctx.beginPath();\n\tctx.moveTo(this.stroke[0].x,this.stroke[0].y);\n\tfor(t=1; t<this.stroke.length-1; t++) {\n\t\tvar s1 = this.stroke[t],\n\t\t\ts2 = this.stroke[t-1],\n\t\t\ttx = (s1.x + s2.x)/2,\n\t\t\tty = (s1.y + s2.y)/2;\n\t\tctx.quadraticCurveTo(s2.x,s2.y,tx,ty);\n\t}\n\tctx.stroke();\n};\n\nBitmapEditor.prototype.strokeEnd = function() {\n\t// Copy the bitmap to the off-screen canvas\n\tvar canvas = this.getDomNode(DOM_CANVAS),\n\t\tctx = this.currCanvas.getContext(\"2d\");\n\tctx.drawImage(canvas,0,0);\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\nBitmapEditor.prototype.saveChanges = function() {\n\tvar tiddler = this.editWidget.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler) {\n\t\t// data URIs look like \"data:<type>;base64,<text>\"\n\t\tvar dataURL = this.getDomNode(DOM_CANVAS).toDataURL(tiddler.fields.type,1.0),\n\t\t\tposColon = dataURL.indexOf(\":\"),\n\t\t\tposSemiColon = dataURL.indexOf(\";\"),\n\t\t\tposComma = dataURL.indexOf(\",\"),\n\t\t\ttype = dataURL.substring(posColon+1,posSemiColon),\n\t\t\ttext = dataURL.substring(posComma+1);\n\t\tvar update = {type: type, text: text};\n\t\tthis.editWidget.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,update));\n\t}\n};\n\n/*\nNote that the bitmap editor intentionally doesn't have a refreshInDom method to avoid the situation where a bitmap being editted is modified externally\n*/\n\nexports[\"image/jpg\"] = BitmapEditor;\nexports[\"image/jpeg\"] = BitmapEditor;\nexports[\"image/png\"] = BitmapEditor;\nexports[\"image/gif\"] = BitmapEditor;\n\n})();\n",
"title": "$:/core/modules/widgets/edit/editors/bitmapeditor.js",
"type": "application/javascript",
"module-type": "editor"
},
"$:/core/modules/widgets/edit/editors/texteditor.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/edit/editors/texteditor.js\ntype: application/javascript\nmodule-type: editor\n\nA plain text editor\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar MIN_TEXT_AREA_HEIGHT = 100;\n\nvar TextEditor = function(editWidget,tiddlerTitle,fieldName) {\n\tthis.editWidget = editWidget;\n\tthis.tiddlerTitle = tiddlerTitle;\n\tthis.fieldName = fieldName;\n};\n\n/*\nGet the tiddler being edited and current value\n*/\nTextEditor.prototype.getEditInfo = function() {\n\t// Get the current tiddler and the field name\n\tvar tiddler = this.editWidget.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle),\n\t\tvalue;\n\t// If we've got a tiddler, the value to display is the field string value\n\tif(tiddler) {\n\t\tvalue = tiddler.getFieldString(this.fieldName);\n\t} else {\n\t\t// Otherwise, we need to construct a default value for the editor\n\t\tswitch(this.fieldName) {\n\t\t\tcase \"text\":\n\t\t\t\tvalue = \"Type the text for the tiddler '\" + this.tiddlerTitle + \"'\";\n\t\t\t\tbreak;\n\t\t\tcase \"title\":\n\t\t\t\tvalue = this.tiddlerTitle;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tvalue = \"\";\n\t\t\t\tbreak;\n\t\t}\n\t\tvalue = this.editWidget.renderer.getAttribute(\"default\",value);\n\t}\n\treturn {tiddler: tiddler, value: value};\n};\n\nTextEditor.prototype.render = function() {\n\t// Get the initial value of the editor\n\tvar editInfo = this.getEditInfo();\n\t// Create the editor nodes\n\tvar node = {\n\t\ttype: \"element\",\n\t\tattributes: {}\n\t};\n\t// Get the edit type associated with this field\n\tvar type = \"input\";\n\tif(this.fieldName === \"text\") {\n\t\ttype = \"textarea\";\n\t} else {\n\t\tvar fieldModule = $tw.Tiddler.fieldModules[this.fieldName];\n\t\tif(fieldModule && fieldModule.editType) {\n\t\t\ttype = fieldModule.editType;\n\t\t}\n\t}\n\tvar type = this.editWidget.renderer.getAttribute(\"type\",type);\n\tswitch(type) {\n\t\tcase \"textarea\":\n\t\t\tnode.tag = \"textarea\";\n\t\t\tnode.children = [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: editInfo.value\n\t\t\t}];\n\t\t\tbreak;\n\t\tcase \"color\":\n\t\t\tnode.tag = \"input\";\n\t\t\tnode.attributes.type = {type: \"string\", value: \"color\"};\n\t\t\tnode.attributes.value = {type: \"string\", value: editInfo.value};\n\t\t\tbreak;\n\t\tcase \"search\":\n\t\t\tnode.tag = \"input\";\n\t\t\tnode.attributes.type = {type: \"string\", value: \"search\"};\n\t\t\tnode.attributes.value = {type: \"string\", value: editInfo.value};\n\t\t\tbreak;\n\t\tdefault: // \"input\"\n\t\t\tnode.tag = \"input\";\n\t\t\tnode.attributes.type = {type: \"string\", value: \"text\"};\n\t\t\tnode.attributes.value = {type: \"string\", value: editInfo.value};\n\t\t\tbreak;\n\t}\n\tnode.events = [\n\t\t{name: \"focus\", handlerObject: this, handlerMethod: \"handleFocusEvent\"},\n\t\t{name: \"blur\", handlerObject: this, handlerMethod: \"handleBlurEvent\"},\n\t\t{name: \"input\", handlerObject: this, handlerMethod: \"handleInputEvent\"}\n\t];\n\t// Add a placeholder if specified\n\tif(this.editWidget.renderer.hasAttribute(\"placeholder\")) {\n\t\tnode.attributes.placeholder = {type: \"string\", value: this.editWidget.renderer.getAttribute(\"placeholder\")};\n\t}\n\t// Set the element details\n\tthis.editWidget.tag = this.editWidget.renderer.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tthis.editWidget.attributes = {\n\t\t\"class\": \"tw-edit-texteditor\"\n\t};\n\tif(this.editWidget.renderer.hasAttribute(\"class\")) {\n\t\tthis.editWidget.attributes[\"class\"] += \" \" + this.editWidget.renderer.getAttribute(\"class\");\n\t}\n\tif(this.editWidget.renderer.hasAttribute(\"style\")) {\n\t\tthis.editWidget.attributes.style = this.editWidget.attributes.style || \"\";\n\t\tthis.editWidget.attributes.style += this.editWidget.renderer.getAttribute(\"style\");\n\t}\n\tthis.editWidget.children = this.editWidget.renderer.renderTree.createRenderers(this.editWidget.renderer,[node]);\n};\n\nTextEditor.prototype.setFocus = function() {\n\tif(this.editWidget.renderer.hasAttribute(\"focusSet\")) {\n\t\tvar title = this.editWidget.renderer.getAttribute(\"focusSet\");\n\t\tif(this.editWidget.renderer.getAttribute(\"qualifyTiddlerTitles\") === \"yes\") {\n\t\t\ttitle = title + \"-\" + this.editWidget.renderer.renderTree.getContextScopeId(this.editWidget.renderer.parentRenderer);\n\t\t}\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.editWidget.renderer.domNode,\n\t\t\ttitle: title,\n\t\t\twiki: this.editWidget.renderer.renderTree.wiki,\n\t\t\tforce: true\n\t\t});\n\t}\n};\n\nTextEditor.prototype.handleFocusEvent = function(event) {\n//\tthis.saveChanges();\n//\tthis.fixHeight();\n\tthis.setFocus();\n\treturn true;\n};\n\nTextEditor.prototype.handleBlurEvent = function(event) {\n//\tthis.saveChanges();\n\treturn true;\n};\n\nTextEditor.prototype.handleInputEvent = function(event) {\n\tthis.saveChanges();\n\tthis.fixHeight();\n\treturn true;\n};\n\nTextEditor.prototype.saveChanges = function() {\n\tvar text = this.editWidget.children[0].domNode.value,\n\t\ttiddler = this.editWidget.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(!tiddler) {\n\t\ttiddler = new $tw.Tiddler({title: this.tiddlerTitle});\n\t}\n\tif(text !== tiddler.fields[this.fieldName]) {\n\t\tvar update = {};\n\t\tupdate[this.fieldName] = text;\n\t\tthis.editWidget.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,update));\n\t}\n};\n\nTextEditor.prototype.fixHeight = function() {\n\tvar self = this;\n\tif(this.editWidget.children[0].domNode && this.editWidget.children[0].domNode.type === \"textarea\") {\n\t\t$tw.utils.nextTick(function() {\n\t\t\t// Resize the textarea to fit its content\n\t\t\tvar textarea = self.editWidget.children[0].domNode,\n\t\t\t\tscrollPosition = $tw.utils.getScrollPosition(),\n\t\t\t\tscrollTop = scrollPosition.y;\n\t\t\t// Set its height to auto so that it snaps to the correct height\n\t\t\ttextarea.style.height = \"auto\";\n\t\t\t// Calculate the revised height\n\t\t\tvar newHeight = Math.max(textarea.scrollHeight + textarea.offsetHeight - textarea.clientHeight,MIN_TEXT_AREA_HEIGHT);\n\t\t\t// Only try to change the height if it has changed\n\t\t\tif(newHeight !== textarea.offsetHeight) {\n\t\t\t\ttextarea.style.height = newHeight + \"px\";\n\t\t\t\t// Make sure that the dimensions of the textarea are recalculated\n\t\t\t\t$tw.utils.forceLayout(textarea);\n\t\t\t\t// Check that the scroll position is still visible before trying to scroll back to it\n\t\t\t\tscrollTop = Math.min(scrollTop,self.editWidget.renderer.renderTree.document.body.scrollHeight - window.innerHeight);\n\t\t\t\twindow.scrollTo(scrollPosition.x,scrollTop);\n\t\t\t}\n\t\t});\n\t}\n};\n\nTextEditor.prototype.postRenderInDom = function() {\n\tthis.fixHeight();\n};\n\nTextEditor.prototype.refreshInDom = function() {\n\tif(this.editWidget.renderer.renderTree.document.activeElement !== this.editWidget.children[0].domNode) {\n\t\tvar editInfo = this.getEditInfo();\n\t\tthis.editWidget.children[0].domNode.value = editInfo.value;\n\t}\n\t// Fix the height if needed\n\tthis.fixHeight();\n};\n\nexports[\"text/vnd.tiddlywiki\"] = TextEditor;\nexports[\"text/plain\"] = TextEditor;\n\n})();\n",
"title": "$:/core/modules/widgets/edit/editors/texteditor.js",
"type": "application/javascript",
"module-type": "editor"
},
"$:/core/modules/widgets/encrypt.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/encrypt.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the encrypt widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar EncryptWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nEncryptWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.filter = this.renderer.getAttribute(\"filter\");\n\t// Check whether we've got an encryption password\n\tvar isEncrypted = $tw.crypto.hasPassword();\n\t// Encrypt the filtered tiddlers\n\tvar tiddlers = this.renderer.renderTree.wiki.filterTiddlers(this.filter),\n\t\tjson = {},\n\t\tself = this;\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.renderer.renderTree.wiki.getTiddler(title),\n\t\t\tjsonTiddler = {};\n\t\tfor(var f in tiddler.fields) {\n\t\t\tjsonTiddler[f] = tiddler.getFieldString(f);\n\t\t}\n\t\tjson[title] = jsonTiddler;\n\t});\n\tvar encryptedText = $tw.utils.htmlEncode($tw.crypto.encrypt(JSON.stringify(json)));\n\t// Set the return element\n\tthis.tag = \"pre\";\n\tthis.attributes ={\"class\": \"tw-encrypt\"};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: encryptedText\n\t}]);\n};\n\nexports.encrypt = EncryptWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/encrypt.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/error.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/error.js\ntype: application/javascript\nmodule-type: widget\n\nThe error widget displays an error message.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ErrorWidget = function(renderer,errorMessage) {\n\t// Save state\n\tthis.renderer = renderer;\n\tthis.errorMessage = errorMessage;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nErrorWidget.prototype.generate = function() {\n\t// Set the element details\n\tthis.tag = \"span\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-error-widget\"\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\t\ttype: \"text\",\n\t\t\ttext: this.errorMessage\n\t\t}]);\n};\n\nexports.error = ErrorWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/error.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fieldgrid.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/fieldgrid.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the fieldgrid widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar FieldGridWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nFieldGridWidget.prototype.generate = function() {\n\t// Get attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\tthis.exclude = this.renderer.getAttribute(\"exclude\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\t// Set up the exclusion array\n\tvar exclude = [];\n\tif(this.exclude) {\n\t\texclude = this.exclude.split(\" \");\n\t}\n\t// Get the tiddler\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\t// Set up the classes\n\tvar classes = [\"tw-fieldgrid-table\"];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\t// Set up the header row\n\tvar rows = [\n\t\t{type: \"element\", tag: \"tr\", children: [\n\t\t\t{type: \"element\", tag: \"th\", children: [\n\t\t\t\t{type: \"text\", text: \"Field\"}]},\n\t\t\t{type: \"element\", tag: \"th\", children: [\n\t\t\t\t{type: \"text\", text: \"Value\"}]}]}\n\t];\n\t// Add the rows for each field\n\tif(tiddler) {\n\t\tvar fields = [];\n\t\tfor(var f in tiddler.fields) {\n\t\t\tif(exclude.indexOf(f) === -1) {\n\t\t\t\tfields.push(f);\n\t\t\t}\n\t\t}\n\t\tfields.sort();\n\t\tfor(f=0; f<fields.length; f++) {\n\t\t\tvar value;\n\t\t\tif(fields[f] === \"text\") {\n\t\t\t\tvalue = {type: \"element\", tag: \"em\", children: [\n\t\t\t\t\t{type: \"text\", text: \"(length: \" + tiddler.fields.text.length + \")\"}\n\t\t\t\t]};\n\t\t\t} else {\n\t\t\t\tvalue = {type: \"text\", text: tiddler.getFieldString(fields[f])};\n\t\t\t}\n\t\t\trows.push({type: \"element\", tag: \"tr\", children: [\n\t\t\t\t{type: \"element\", tag: \"td\", children: [\n\t\t\t\t\t{type: \"text\", text: fields[f]}\n\t\t\t\t]},\n\t\t\t\t{type: \"element\", tag: \"td\", children: [value]}\n\t\t\t]});\n\t\t}\n\t}\n\t// Return the table element\n\tthis.tag = \"table\";\n\tthis.attributes ={\"class\": classes.join(\" \")};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\ttype: \"element\",\n\t\ttag: \"tbody\",\n\t\tchildren: rows\n\t}]);\n};\n\nexports.fieldgrid = FieldGridWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/fieldgrid.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fieldlist.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/fieldlist.js\ntype: application/javascript\nmodule-type: widget\n\nThe fieldlist widget renders the fields of a tiddler through a template.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar FieldListWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nFieldListWidget.prototype.generate = function() {\n\tvar self = this;\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\tthis.exclude = this.renderer.getAttribute(\"exclude\");\n\t// Get the exclusion list\n\tthis.excludeList;\n\tif(this.exclude) {\n\t\tthis.excludeList = this.exclude.split(\" \");\n\t} else {\n\t\tthis.excludeList = [\"text\"]; \n\t}\n\t// Get the list of fields\n\tvar fieldList = this.getFieldList();\n\t// Set the element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-fieldlist\"\n\t};\n\t// Set up the attributes for the wrapper element\n\tvar classes = [];\n\tif(this.renderer.hasAttribute(\"class\")) {\n\t\t$tw.utils.pushTop(classes,this.renderer.getAttribute(\"class\").split(\" \"));\n\t}\n\tif(classes.length > 0) {\n\t\tthis.attributes[\"class\"] = classes.join(\" \");\n\t}\n\tif(this.renderer.hasAttribute(\"style\")) {\n\t\tthis.attributes.style = this.renderer.getAttribute(\"style\");\n\t}\n\tif(this.renderer.hasAttribute(\"tooltip\")) {\n\t\tthis.attributes.title = this.renderer.getAttribute(\"tooltip\");\n\t}\n\t// Create the renderers for each list item\n\tvar items = [];\n\t$tw.utils.each(fieldList,function(fieldName) {\n\t\titems.push(self.createListElement(fieldName));\n\t});\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,items);\n};\n\nFieldListWidget.prototype.createListElement = function(fieldName) {\n\treturn {\n\t\ttype: \"element\",\n\t\ttag: \"$transclude\",\n\t\tisBlock: true,\n\t\tattributes: {\n\t\t\tcurrentField: {type: \"string\", value: fieldName},\n\t\t\ttarget: {type: \"string\", value: this.tiddlerTitle}\n\t\t},\n\t\tchildren: this.renderer.parseTreeNode.children\n\t};\n};\n\nFieldListWidget.prototype.removeListElement = function(index) {\n\t// Get the list element\n\tvar listElement = this.children[index];\n\t// Delete the DOM node\n\tlistElement.domNode.parentNode.removeChild(listElement.domNode);\n\t// Then delete the actual renderer node\n\tthis.children.splice(index,1);\n};\n\nFieldListWidget.prototype.getFieldList = function() {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle),\n\t\tfieldList = [];\n\tif(tiddler) {\n\t\tfor(var fieldName in tiddler.fields) {\n\t\t\tif(this.excludeList.indexOf(fieldName) === -1) {\n\t\t\t\tfieldList.push(fieldName);\n\t\t\t}\n\t\t}\n\t}\n\tfieldList.sort();\n\treturn fieldList;\n};\n\nFieldListWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.tiddler || changedAttributes.exclude || changedAttributes.style || changedAttributes.tooltip || changedAttributes[\"class\"]) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// Get the potentially updated list of fields\n\t\tvar fieldList = this.getFieldList();\n\t\t// Walk through the fields\n\t\tfor(var fieldIndex = 0; fieldIndex<fieldList.length; fieldIndex++) {\n\t\t\t// Look for the field in the rendered child nodes\n\t\t\tvar targetIndex = this.findChildNode(fieldIndex,fieldList[fieldIndex]);\n\t\t\tif(targetIndex === -1) {\n\t\t\t\t// Insert the field if it wasn't present\n\t\t\t\tthis.children.splice(fieldIndex,0,this.renderer.renderTree.createRenderer(this.renderer,this.createListElement(fieldList[fieldIndex])));\n\t\t\t\tthis.renderer.domNode.insertBefore(this.children[fieldIndex].renderInDom(),this.renderer.domNode.childNodes[fieldIndex]);\n\t\t\t} else {\n\t\t\t\t// Delete any list elements preceding the one we want\n\t\t\t\tfor(var n=targetIndex-1; n>=fieldIndex; n--) {\n\t\t\t\t\tthis.removeListElement(n);\n\t\t\t\t}\n\t\t\t\t// Refresh the node we're reusing\n\t\t\t\tthis.children[fieldIndex].refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t}\n\t\t// Remove any left over elements\n\t\tfor(fieldIndex = this.children.length-1; fieldIndex>=fieldList.length; fieldIndex--) {\n\t\t\tthis.removeListElement(fieldIndex);\n\t\t}\n\t}\n};\n\n/*\nFind the index of the child node representing the named field (or -1 if not present)\n*/\nFieldListWidget.prototype.findChildNode = function(startIndex,fieldName) {\n\tvar index = startIndex;\n\twhile(index < this.children.length) {\n\t\tif(this.children[index].attributes.currentField === fieldName) {\n\t\t\treturn index;\n\t\t}\n\t\tindex++;\n\t}\n\treturn -1;\n};\n\nexports.fieldlist = FieldListWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/fieldlist.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fieldmangler.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/fieldmangler.js\ntype: application/javascript\nmodule-type: widget\n\nThe fieldmangler widget modifies the fields of the current tiddler in response to messages.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar FieldManglerWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nFieldManglerWidget.prototype.generate = function() {\n\tvar self = this;\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\t// Set the element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-fieldmangler\"\n\t};\n\t// Set event handlers\n\tthis.events = [\n\t\t{name: \"tw-remove-field\", handlerObject: this, handlerMethod: \"handleRemoveFieldEvent\"},\n\t\t{name: \"tw-add-field\", handlerObject: this, handlerMethod: \"handleAddFieldEvent\"},\n\t\t{name: \"tw-remove-tag\", handlerObject: this, handlerMethod: \"handleRemoveTagEvent\"},\n\t\t{name: \"tw-add-tag\", handlerObject: this, handlerMethod: \"handleAddTagEvent\"}\n\t];\n\t// Render the children\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n};\n\nFieldManglerWidget.prototype.handleRemoveFieldEvent = function(event) {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle),\n\t\tdeletion = {};\n\tdeletion[event.currentField] = undefined;\n\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,deletion));\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleAddFieldEvent = function(event) {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler && typeof event.param === \"string\" && event.param !== \"\" && !$tw.utils.hop(tiddler.fields,event.param)) {\n\t\tvar addition = {};\n\t\taddition[event.param] = \"\";\n\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));\n\t}\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler && tiddler.fields.tags) {\n\t\tvar p = tiddler.fields.tags.indexOf(event.currentTag);\n\t\tif(p !== -1) {\n\t\t\tvar modification = {};\n\t\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t\tmodification.tags.splice(p,1);\n\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\n\t\t}\n\t}\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleAddTagEvent = function(event) {\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler && typeof event.param === \"string\" && event.param !== \"\") {\n\t\tvar modification = {};\n\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t$tw.utils.pushTop(modification.tags,event.param);\n\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\n\t}\n\treturn true;\n};\n\nexports.fieldmangler = FieldManglerWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/fieldmangler.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fields.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/fields.js\ntype: application/javascript\nmodule-type: widget\n\nThe fields widget displays the fields of a tiddler through a text substitution template.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar FieldsWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nFieldsWidget.prototype.generate = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\tthis.template = this.renderer.getAttribute(\"template\");\n\tthis.exclude = this.renderer.getAttribute(\"exclude\");\n\tthis.stripTitlePrefix = this.renderer.getAttribute(\"stripTitlePrefix\",\"no\") === \"yes\";\n\t// Get the tiddler we're displaying\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle);\n\t// Get the exclusion list\n\tvar exclude;\n\tif(this.exclude) {\n\t\texclude = this.exclude.split(\" \");\n\t} else {\n\t\texclude = [\"text\"]; \n\t}\n\t// Compose the template\n\tvar text = [];\n\tif(this.template && tiddler) {\n\t\tvar fields = [];\n\t\tfor(var fieldName in tiddler.fields) {\n\t\t\tif(exclude.indexOf(fieldName) === -1) {\n\t\t\t\tfields.push(fieldName);\n\t\t\t}\n\t\t}\n\t\tfields.sort();\n\t\tfor(var f=0; f<fields.length; f++) {\n\t\t\tfieldName = fields[f];\n\t\t\tif(exclude.indexOf(fieldName) === -1) {\n\t\t\t\tvar row = this.template,\n\t\t\t\t\tvalue = tiddler.getFieldString(fieldName);\n\t\t\t\tif(this.stripTitlePrefix && fieldName === \"title\") {\n\t\t\t\t\tvar reStrip = /^\\{[^\\}]+\\}(.+)/mg,\n\t\t\t\t\t\treMatch = reStrip.exec(value);\n\t\t\t\t\tif(reMatch) {\n\t\t\t\t\t\tvalue = reMatch[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trow = row.replace(\"$name$\",fieldName);\n\t\t\t\trow = row.replace(\"$value$\",value);\n\t\t\t\trow = row.replace(\"$encoded_value$\",$tw.utils.htmlEncode(value));\n\t\t\t\ttext.push(row)\n\t\t\t}\n\t\t}\n\t}\n\t// Set the element\n\tthis.tag = \"pre\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-fields\"\n\t};\n\t// Set up the attributes for the wrapper element\n\tvar classes = [];\n\tif(this.renderer.hasAttribute(\"class\")) {\n\t\t$tw.utils.pushTop(classes,this.renderer.getAttribute(\"class\").split(\" \"));\n\t}\n\tif(classes.length > 0) {\n\t\tthis.attributes[\"class\"] = classes.join(\" \");\n\t}\n\tif(this.renderer.hasAttribute(\"style\")) {\n\t\tthis.attributes.style = this.renderer.getAttribute(\"style\");\n\t}\n\tif(this.renderer.hasAttribute(\"tooltip\")) {\n\t\tthis.attributes.title = this.renderer.getAttribute(\"tooltip\");\n\t}\n\t// Create the renderers for the wrapper and the children\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: text.join(\"\")\n\t}]);\n};\n\nexports.fields = FieldsWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/fields.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/grid.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/grid.js\ntype: application/javascript\nmodule-type: widget\n\nThe grid widget.\n\nThis example renders a table made up of tiddlers titled `MySheet_A_1`, `MySheet_A_2`, `MySheet_A_3`, ... , `MySheet_B_1`, `MySheet_B_2`, `MySheet_B_3` etc.\n\n```\n<$grid prefix=\"MySheet\" rows=20 cols=20/>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar GridWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate widget elements\n\tthis.generate();\n};\n\nGridWidget.prototype.generate = function() {\n\t// Get our attributes\n\tthis.prefix = this.renderer.getAttribute(\"prefix\",\"Grid\");\n\tthis.rows = parseInt(this.renderer.getAttribute(\"rows\",\"10\"),10);\n\tthis.cols = parseInt(this.renderer.getAttribute(\"cols\",\"10\"),10);\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\t// Set up the classes\n\tvar classes = [\"tw-grid-frame\"];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\t// Create the grid table element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": classes.join(\" \")\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.generateTable());\n};\n\nGridWidget.prototype.generateTable = function() {\n\tvar rows = [];\n\tfor(var row=0; row<this.rows; row++) {\n\t\tvar tr = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"tr\",\n\t\t\tchildren: []\n\t\t};\n\t\trows.push(tr);\n\t\tfor(var col=0; col<this.cols; col++) {\n\t\t\tvar td = {\n\t\t\t\t\ttype: \"element\",\n\t\t\t\t\ttag: \"td\",\n\t\t\t\t\tchildren: [{\n\t\t\t\t\t\ttype: \"element\",\n\t\t\t\t\t\ttag: \"$transclude\",\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\ttarget: {type: \"string\", value: this.getTableCellTitle(col,row)}\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t};\n\t\t\ttr.children.push(td);\n\t\t}\n\t}\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"table\",\n\t\tchildren: [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"tbody\",\n\t\t\tchildren: rows\n\t\t}]\n\t}];\n};\n\nGridWidget.prototype.getTableCellTitle = function(col,row) {\n\tvar c = String.fromCharCode(col % 26 + \"A\".charCodeAt(0));\n\tcol = Math.floor(col/26);\n\twhile(col>0) {\n\t\tc = String.fromCharCode(col % 26 + \"A\".charCodeAt(0) - 1) + c;\n\t\tcol = Math.floor(col/26);\n\t}\n\treturn this.prefix + \"_\" + c + \"_\" + (row + 1);\n};\n\nGridWidget.prototype.postRenderInDom = function() {\n};\n\nGridWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Reexecute the widget if any of our attributes have changed\n\tif(true) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t}\n};\n\nexports.grid = GridWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/grid.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/import.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/import.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the import widget.\n\n```\n<$import>\nImport using the \"browse...\" button or drag files onto this text\n</$import>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ImportWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nImportWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.browse = this.renderer.getAttribute(\"browse\",\"yes\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\t// Compute classes\n\tvar classes = [\"tw-import\"];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\t// Create the file input and container elements\n\tvar fileInput = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"input\",\n\t\t\tattributes: {\n\t\t\t\ttype: {type: \"string\", value: \"file\"},\n\t\t\t\tstyle: {type: \"string\", value: this.browse === \"no\" ? \"display: none;\" : \"display: block;\"}\n\t\t\t},\n\t\t\tevents: [{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}]\n\t\t},\n\t\tcontainer = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"div\",\n\t\t\tchildren: this.renderer.parseTreeNode.children,\n\t\t\tevents: [\n\t\t\t\t{name: \"dragenter\", handlerObject: this, handlerMethod: \"handleDragEnterEvent\"},\n\t\t\t\t{name: \"dragover\", handlerObject: this, handlerMethod: \"handleDragOverEvent\"},\n\t\t\t\t{name: \"dragleave\", handlerObject: this, handlerMethod: \"handleDragLeaveEvent\"},\n\t\t\t\t{name: \"drop\", handlerObject: this, handlerMethod: \"handleDropEvent\"},\n\t\t\t\t{name: \"paste\", handlerObject: this, handlerMethod: \"handlePasteEvent\"}]\n\t\t};\n\t// Set the return element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": classes.join(\" \")\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[fileInput,container]);\n};\n\nImportWidget.prototype.handleChangeEvent = function(event) {\n\tevent.stopPropagation();\n\tthis.importFiles(event.target.files);\n};\n\nImportWidget.prototype.handleDragEnterEvent = function(event) {\n\t// We count enter/leave events\n\tthis.dragEnterCount = (this.dragEnterCount || 0) + 1;\n\t// If we're entering for the first time we need to apply highlighting\n\tif(this.dragEnterCount === 1) {\n\t\t$tw.utils.addClass(this.renderer.domNode,\"tw-dragover\");\n\t}\n\t// Tell the browser that we're ready to handle the drop\n\tevent.preventDefault();\n\t// Tell the browser not to ripple the drag up to any parent drop handlers\n\tevent.stopPropagation();\n};\n\nImportWidget.prototype.handleDragOverEvent = function(event) {\n\t// Tell the browser that we're still interested in the drop\n\tevent.preventDefault();\n\tevent.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy\n};\n\nImportWidget.prototype.handleDragLeaveEvent = function(event) {\n\t// Reduce the enter count\n\tthis.dragEnterCount = (this.dragEnterCount || 0) - 1;\n\t// Remove highlighting if we're leaving externally\n\tif(this.dragEnterCount <= 0) {\n\t\t$tw.utils.removeClass(this.renderer.domNode,\"tw-dragover\");\n\t}\n};\n\nImportWidget.prototype.handleDropEvent = function(event) {\n\tvar dataTransfer = event.dataTransfer;\n\t// Reset the enter count\n\tthis.dragEnterCount = 0;\n\t// Remove highlighting\n\t$tw.utils.removeClass(this.renderer.domNode,\"tw-dragover\");\n\t// Try to import the various data types we understand\n\tthis.importData(dataTransfer);\n\t// Import any files in the drop\n\tthis.importFiles(dataTransfer.files);\n\t// Tell the browser that we handled the drop\n\tevent.preventDefault();\n\t// Stop the drop ripple up to any parent handlers\n\tevent.stopPropagation();\n};\n\nImportWidget.prototype.handlePasteEvent = function(event) {\n\t// Let the browser handle it if we're in a textarea or input box\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) == -1) {\n\t\tvar self = this,\n\t\t\titems = event.clipboardData.items;\n\t\t// Enumerate the clipboard items\n\t\tfor(var t = 0; t<items.length; t++) {\n\t\t\tvar item = items[t];\n\t\t\tif(item.kind === \"file\") {\n\t\t\t\t// Import any files\n\t\t\t\tvar file = item.getAsFile();\n\t\t\t\tthis.importFiles([file]);\n\t\t\t} else if(item.kind === \"string\") {\n\t\t\t\t// Create tiddlers from string items\n\t\t\t\titem.getAsString(function(str) {\n\t\t\t\t\tvar fields = {\n\t\t\t\t\t\ttitle: self.generateTitle(\"Untitled\"),\n\t\t\t\t\t\ttext: str\n\t\t\t\t\t};\n\t\t\t\t\tself.storeTiddler(fields);\n\t\t\t\t\tself.openTiddler(fields.title);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t// Tell the browser that we've handled the paste\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\t}\n};\n\nImportWidget.prototype.openTiddler = function(title) {\n\t$tw.utils.dispatchCustomEvent(this.renderer.domNode,\"tw-navigate\",{\n\t\tnavigateTo: title,\n\t\tnavigateFromNode: this.renderer.domNode,\n\t\tnavigateFromClientRect: this.renderer.domNode.getBoundingClientRect()\n\t});\n};\n\nImportWidget.prototype.importData = function(dataTransfer) {\n\tfor(var t=0; t<this.importDataTypes.length; t++) {\n\t\tvar dataType = this.importDataTypes[t];\n\t\tvar data = dataTransfer.getData(dataType.type);\n\t\tif(data !== \"\") {\n\t\t\tvar fields = dataType.handler(data);\n\t\t\tif(!fields.title) {\n\t\t\t\tfields.title = this.generateTitle(\"Untitled\");\n\t\t\t}\n\t\t\tthis.storeTiddler(fields);\n\t\t\tthis.openTiddler(fields.title);\n\t\t\treturn;\n\t\t}\n\t};\n};\n\nImportWidget.prototype.importDataTypes = [\n\t{type: \"text/vnd.tiddler\", handler: function(data) {\n\t\treturn JSON.parse(data);\n\t}},\n\t{type: \"text/plain\", handler: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}},\n\t{type: \"text/uri-list\", handler: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}}\n];\n\nImportWidget.prototype.importFiles = function(files) {\n\tvar self = this,\n\t\timportFile = function(file) {\n\t\t// Get the type, falling back to the filename extension\n\t\tvar type = file.type;\n\t\tif(type === \"\" || !type) {\n\t\t\tvar dotPos = file.name.lastIndexOf(\".\");\n\t\t\tif(dotPos !== -1) {\n\t\t\t\tvar fileExtensionInfo = $tw.config.fileExtensionInfo[file.name.substr(dotPos)];\n\t\t\t\tif(fileExtensionInfo) {\n\t\t\t\t\ttype = fileExtensionInfo.type;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Figure out if we're reading a binary file\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[type],\n\t\t\tisBinary = contentTypeInfo ? contentTypeInfo.encoding === \"base64\" : false;\n\t\t// Create the FileReader\n\t\tvar reader = new FileReader();\n\t\treader.onload = function(event) {\n\t\t\t// Deserialise the file contents\n\t\t\tvar fields = {\n\t\t\t\ttitle: file.name || \"Untitled\",\n\t\t\t\ttype: type};\n\t\t\t// Are we binary?\n\t\t\tif(isBinary) {\n\t\t\t\tvar commaPos = event.target.result.indexOf(\",\");\n\t\t\t\tif(commaPos !== -1) {\n\t\t\t\t\tfields.text = event.target.result.substr(commaPos+1);\n\t\t\t\t\tself.storeTiddler(fields);\n\t\t\t\t\tself.openTiddler(fields.title);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar tiddlers = self.renderer.renderTree.wiki.deserializeTiddlers(type,event.target.result,fields);\n\t\t\t\tif(!tiddlers) {\n\t\t\t\t\tconsole.log(\"No tiddlers found in file \",file.name);\n\t\t\t\t} else {\n\t\t\t\t\t$tw.utils.each(tiddlers,function(tiddlerFields) {\n\t\t\t\t\t\ttiddlerFields.title = self.generateTitle(tiddlerFields.title);\n\t\t\t\t\t\tself.storeTiddler(tiddlerFields);\n\t\t\t\t\t\tself.openTiddler(tiddlerFields.title);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif(isBinary) {\n\t\t\treader.readAsDataURL(file);\n\t\t} else {\n\t\t\treader.readAsText(file);\n\t\t}\n\t};\n\tfor(var f=0; f<files.length; f++) {\n\t\timportFile(files[f]);\n\t};\n};\n\nImportWidget.prototype.storeTiddler = function(fields) {\n\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(fields));\n};\n\nImportWidget.prototype.generateTitle = function(baseTitle) {\n\tvar c = 0;\n\tdo {\n\t\tvar title = baseTitle + (c ? \" \" + (c + 1) : \"\");\n\t\tc++;\n\t} while(this.renderer.renderTree.wiki.tiddlerExists(title));\n\treturn title;\n};\n\nexports.import = ImportWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/import.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/info.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/info.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the info widget that displays various information about a specified tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar InfoWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nInfoWidget.types = {\n\tchangecount: function(options) {return options.wiki.getChangeCount(options.widget.renderer.tiddlerTitle);},\n\tcurrentField: function(options) {return options.widget.renderer.renderTree.getContextVariable(options.widget.renderer,\"field\",\"text\");}\n};\n\nInfoWidget.prototype.generate = function() {\n\t// Get attributes\n\tthis.type = this.renderer.getAttribute(\"type\",\"changecount\");\n\t// Get the appropriate value for the current tiddler\n\tvar value = \"\",\n\t\tfn = InfoWidget.types[this.type];\n\tif(fn) {\n\t\tvalue = fn({\n\t\t\twiki: this.renderer.renderTree.wiki,\n\t\t\twidget: this\n\t\t});\n\t}\n\t// Set the element\n\tthis.tag = \"span\";\n\tthis.attributes = {};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: value\n\t}]);\n};\n\nexports.info = InfoWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/info.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/link.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/link.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the link widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar isLinkExternal = function(to) {\n\tvar externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data):[^\\s'\"]+(?:\\/|\\b)/i;\n\treturn externalRegExp.test(to);\n};\n\nvar LinkWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nLinkWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.to = this.renderer.getAttribute(\"to\",this.renderer.tiddlerTitle);\n\tthis.hover = this.renderer.getAttribute(\"hover\");\n\tthis.qualifyHoverTitles = this.renderer.getAttribute(\"qualifyHoverTitles\");\n\t// Qualify the hover tiddler title if needed\n\tif(this.qualifyHoverTitles) {\n\t\tthis.hover = this.hover + \"-\" + this.renderer.renderTree.getContextScopeId(this.renderer.parentRenderer);\n\t}\n\t// Determine the default link characteristics\n\tthis.isExternal = isLinkExternal(this.to);\n\tif(!this.isExternal) {\n\t\tthis.isMissing = !this.renderer.renderTree.wiki.tiddlerExists(this.to);\n\t\tthis.isShadow = this.renderer.renderTree.wiki.isShadowTiddler(this.to);\n\t}\n\t// Compose the link\n\tvar classes = [\"tw-tiddlylink\"]\n\tif(this.isExternal) {\n\t\t$tw.utils.pushTop(classes,\"tw-tiddlylink-external\");\n\t} else {\n\t\t$tw.utils.pushTop(classes,\"tw-tiddlylink-internal\");\n\t\tif(this.isShadow) {\n\t\t\t$tw.utils.pushTop(classes,\"tw-tiddlylink-shadow\");\n\t\t}\n\t\tif(this.isMissing && !this.isShadow) {\n\t\t\t$tw.utils.pushTop(classes,\"tw-tiddlylink-missing\");\n\t\t} else {\n\t\t\tif(!this.isMissing) {\n\t\t\t\t$tw.utils.pushTop(classes,\"tw-tiddlylink-resolves\");\n\t\t\t}\n\t\t}\n\t}\n\tvar events = [\n\t\t{name: \"click\", handlerObject: this, handlerMethod: \"handleClickEvent\"},\n\t\t{name: \"dragstart\", handlerObject: this, handlerMethod: \"handleDragStartEvent\"},\n\t\t{name: \"dragend\", handlerObject: this, handlerMethod: \"handleDragEndEvent\"}\n\t];\n\tif(this.hover) {\n\t\tevents.push({name: \"mouseover\", handlerObject: this, handlerMethod: \"handleMouseOverOrOutEvent\"});\n\t\tevents.push({name: \"mouseout\", handlerObject: this, handlerMethod: \"handleMouseOverOrOutEvent\"});\n\t}\n\t// Get the value of the tw-wikilinks configuration macro\n\tvar wikiLinksMacro = this.renderer.renderTree.findMacroDefinition(this.renderer.parentRenderer,\"tw-wikilinks\"),\n\t\tuseWikiLinks = wikiLinksMacro ? !(wikiLinksMacro.text.trim() === \"no\") : true;\n\t// Set up the element\n\tif(useWikiLinks) {\n\t\tthis.tag = \"a\";\n\t\tthis.attributes = {\n\t\t\t\"class\": classes.join(\" \")\n\t\t};\n\t\tif(this.isExternal) {\n\t\t\tthis.attributes.href = this.to;\n\t\t} else {\n\t\t\tvar wikiLinkTemplateMacro = this.renderer.renderTree.findMacroDefinition(this.renderer.parentRenderer,\"tw-wikilink-template\"),\n\t\t\t\twikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.text.trim() : \"#$uri_encoded$\";\n\t\t\tthis.wikiLinkText = wikiLinkTemplate.replace(\"$uri_encoded$\",encodeURIComponent(this.to));\n\t\t\tthis.wikiLinkText = this.wikiLinkText.replace(\"$uri_doubleencoded$\",encodeURIComponent(encodeURIComponent(this.to)));\n\t\t\tthis.attributes.href = this.wikiLinkText;\n\t\t}\n\t\tthis.events = events;\n\t} else {\n\t\tthis.tag = \"span\";\n\t}\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n};\n\nLinkWidget.prototype.handleClickEvent = function(event) {\n\tif(isLinkExternal(this.to)) {\n\t\tevent.target.setAttribute(\"target\",\"_blank\");\n\t\treturn true;\n\t} else {\n\t\tvar bounds = this.renderer.domNode.getBoundingClientRect();\n\t\t$tw.utils.dispatchCustomEvent(event.target,\"tw-navigate\",{\n\t\t\tnavigateTo: this.to,\n\t\t\tnavigateFromNode: this,\n\t\t\tnavigateFromClientRect: {\n\t\t\t\ttop: bounds.top,\n\t\t\t\tleft: bounds.left,\n\t\t\t\twidth: bounds.width,\n\t\t\t\tright: bounds.right,\n\t\t\t\tbottom: bounds.bottom,\n\t\t\t\theight: bounds.height\n\t\t\t}\n\t\t});\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n};\n\nLinkWidget.prototype.handleMouseOverOrOutEvent = function(event) {\n\tif(this.hover) {\n\t\t$tw.popup.triggerPopup({\n\t\t\ttitle: this.hover,\n\t\t\tdomNode: this.renderer.domNode,\n\t\t\twiki: this.renderer.renderTree.wiki\n\t\t});\n\t}\n\tevent.preventDefault();\n\treturn false;\n};\n\nLinkWidget.prototype.handleDragStartEvent = function(event) {\n\tif(this.to) {\n\t\t// Set the dragging class on the element being dragged\n\t\t$tw.utils.addClass(event.target,\"tw-tiddlylink-dragging\");\n\t\t// Create the drag image element\n\t\tthis.dragImage = this.renderer.renderTree.document.createElement(\"div\");\n\t\tthis.dragImage.className = \"tw-tiddler-dragger\";\n\t\tthis.dragImage.appendChild(this.renderer.renderTree.document.createTextNode(this.to));\n\t\tthis.renderer.renderTree.document.body.appendChild(this.dragImage);\n\t\t// Set the data transfer properties\n\t\tvar dataTransfer = event.dataTransfer;\n\t\tdataTransfer.effectAllowed = \"copy\";\n\t\tdataTransfer.setDragImage(this.dragImage,-16,-16);\n\t\tdataTransfer.clearData();\n\t\tdataTransfer.setData(\"text/vnd.tiddler\",this.renderer.renderTree.wiki.getTiddlerAsJson(this.to));\n\t\tdataTransfer.setData(\"text/plain\",this.renderer.renderTree.wiki.getTiddlerText(this.to,\"\"));\n\t\tevent.stopPropagation();\n\t} else {\n\t\tevent.preventDefault();\n\t}\n};\n\nLinkWidget.prototype.handleDragEndEvent = function(event) {\n\t// Remove the dragging class on the element being dragged\n\t$tw.utils.removeClass(event.target,\"tw-tiddlylink-dragging\");\n\t// Delete the drag image element\n\tif(this.dragImage) {\n\t\tthis.dragImage.parentNode.removeChild(this.dragImage);\n\t}\n};\n\nLinkWidget.prototype.postRenderInDom = function() {\n\t// Add the draggable attribute to links (we don't include it in the static HTML representation)\n\tif(this.renderer.domNode.tagName === \"A\") {\n\t\tthis.renderer.domNode.setAttribute(\"draggable\",true);\n\t}\n};\n\nLinkWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Set the class for missing tiddlers\n\tif(this.targetTitle && changedTiddlers[this.targetTitle]) {\n\t\t$tw.utils.toggleClass(this.renderer.domNode,\"tw-tiddler-missing\",!this.renderer.renderTree.wiki.tiddlerExists(this.targetTitle));\n\t}\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.to || changedAttributes.hover || (this.to && changedTiddlers[this.to]) || (this.hover && changedTiddlers[this.hover])) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.link = LinkWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/link.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/linkcatcher.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/linkcatcher.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the linkcatcher widget. It intercepts navigation events from its children, preventing normal navigation, and instead stores the name of the target tiddler in the text reference specified in the `to` attribute.\n\nUsing the linkcatcher widget allows the linking mechanism to be used for tasks like selecting the current theme tiddler from a list.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar LinkCatcherWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nLinkCatcherWidget.prototype.generate = function() {\n\t// Get our attributes\n\tthis.to = this.renderer.getAttribute(\"to\");\n\tthis.message = this.renderer.getAttribute(\"message\");\n\tthis.set = this.renderer.getAttribute(\"set\");\n\tthis.setTo = this.renderer.getAttribute(\"setTo\");\n\t// Set the element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-linkcatcher\"\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n\tthis.events = [\n\t\t{name: \"tw-navigate\", handlerObject: this, handlerMethod: \"handleNavigateEvent\"}\n\t];\n};\n\nLinkCatcherWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t$tw.utils.each(this.children,function(node) {\n\t\tif(node.refreshInDom) {\n\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t}\n\t});\n};\n\n// Navigate to a specified tiddler\nLinkCatcherWidget.prototype.handleNavigateEvent = function(event) {\n\tif(this.to) {\n\t\tthis.renderer.renderTree.wiki.setTextReference(this.to,event.navigateTo,this.renderer.tiddlerTitle);\n\t}\n\tif(this.message) {\n\t\t$tw.utils.dispatchCustomEvent(this.renderer.domNode,this.message,{\n\t\t\tparam: event.navigateTo,\n\t\t\ttiddlerTitle: this.renderer.tiddlerTitle\n\t\t});\n\t}\n\tif(this.set) {\n\t\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.set);\n\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\nexports.linkcatcher = LinkCatcherWidget;\n\n})();",
"title": "$:/core/modules/widgets/linkcatcher.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/list/list.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/list/list.js\ntype: application/javascript\nmodule-type: widget\n\nThe list widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ListWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Initialise the listviews if they've not been done already\n\tif(!this.listViews) {\n\t\tListWidget.prototype.listViews = {};\n\t\t$tw.modules.applyMethods(\"listview\",this.listViews);\n\t}\n\t// Generate widget elements\n\tthis.generate();\n};\n\n/*\nThese types are shorthands for particular filters\n*/\nvar typeMappings = {\n\tall: \"[!is[system]sort[title]]\",\n\trecent: \"[!is[system]sort[modified]]\",\n\tmissing: \"[is[missing]sort[title]]\",\n\torphans: \"[is[orphan]sort[title]]\",\n\tsystem: \"[is[system]sort[title]]\"\n};\n\nListWidget.prototype.generate = function() {\n\t// Get our attributes\n\tthis.itemClass = this.renderer.getAttribute(\"itemClass\");\n\tthis.template = this.renderer.getAttribute(\"template\");\n\tthis.editTemplate = this.renderer.getAttribute(\"editTemplate\");\n\tthis.emptyMessage = this.renderer.getAttribute(\"emptyMessage\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\t// Set up the classes\n\tvar classes = [\"tw-list-frame\"];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\t// Get the list of tiddlers object\n\tthis.getTiddlerList();\n\t// Create the list\n\tvar listMembers = [];\n\tif(this.list.length === 0) {\n\t\t// Check for an empty list\n\t\tlistMembers = [this.getEmptyMessage()];\n\t} else {\n\t\t// Create the list\n\t\tfor(var t=0; t<this.list.length; t++) {\n\t\t\tlistMembers.push(this.createListElement(this.list[t]));\n\t\t}\t\t\n\t}\n\t// Create the list frame element\n\tthis.tag = this.renderer.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tthis.attributes = {\n\t\t\"class\": classes.join(\" \")\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,listMembers);\n};\n\nListWidget.prototype.getTiddlerList = function() {\n\tvar filter;\n\tif(this.renderer.hasAttribute(\"type\")) {\n\t\tfilter = typeMappings[this.renderer.getAttribute(\"type\")];\n\t} else if(this.renderer.hasAttribute(\"filter\")) {\n\t\tfilter = this.renderer.getAttribute(\"filter\");\n\t}\n\tif(!filter) {\n\t\tfilter = \"[!is[system]]\";\n\t}\n\tthis.list = this.renderer.renderTree.wiki.filterTiddlers(filter,this.renderer.tiddlerTitle);\n};\n\n/*\nCreate and execute the nodes representing the empty message\n*/\nListWidget.prototype.getEmptyMessage = function() {\n\treturn {\n\t\ttype: \"element\",\n\t\ttag: \"span\",\n\t\tchildren: this.renderer.renderTree.wiki.parseText(\"text/vnd.tiddlywiki\",this.emptyMessage,{parseAsInline: true}).tree\n\t};\n};\n\n/*\nCreate a list element representing a given tiddler\n*/\nListWidget.prototype.createListElement = function(title) {\n\t// Define an event handler that adds navigation information to the event\n\tvar handleEvent = function(event) {\n\t\t\tevent.navigateFromTitle = title;\n\t\t\treturn true;\n\t\t},\n\t\tclasses = [\"tw-list-element\"];\n\t// Add any specified classes\n\tif(this.itemClass) {\n\t\t$tw.utils.pushTop(classes,this.itemClass);\n\t}\n\t// Return the list element\n\treturn {\n\t\ttype: \"element\",\n\t\ttag: this.renderer.parseTreeNode.isBlock ? \"div\" : \"span\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: classes.join(\" \")}\n\t\t},\n\t\tchildren: [this.createListElementMacro(title)],\n\t\tevents: [\n\t\t\t{name: \"tw-navigate\", handlerFunction: handleEvent},\n\t\t\t{name: \"tw-edit-tiddler\", handlerFunction: handleEvent},\n\t\t\t{name: \"tw-save-tiddler\", handlerFunction: handleEvent},\n\t\t\t{name: \"tw-close-tiddler\", handlerFunction: handleEvent},\n\t\t\t{name: \"tw-new-tiddler\", handlerFunction: handleEvent}\n\t\t]\n\t};\n};\n\n/*\nCreate the tiddler macro needed to represent a given tiddler\n*/\nListWidget.prototype.createListElementMacro = function(title) {\n\t// Check if the tiddler is a draft\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(title),\n\t\tisDraft = tiddler ? tiddler.hasField(\"draft.of\") : false;\n\t// Figure out the template to use\n\tvar template = this.template,\n\t\ttemplateTree = undefined;\n\tif(isDraft && this.editTemplate) {\n\t\ttemplate = this.editTemplate;\n\t}\n\t// Check for not having a template\n\tif(!template) {\n\t\tif(this.renderer.parseTreeNode.children && this.renderer.parseTreeNode.children.length > 0) {\n\t\t\t// Use our content as the template\n\t\t\ttemplateTree = this.renderer.parseTreeNode.children;\n\t\t} else {\n\t\t\t// Use default content\n\t\t\ttemplateTree = [{\n\t\t\t\ttype: \"element\",\n\t\t\t\ttag: \"$view\",\n\t\t\t\tattributes: {\n\t\t\t\t\tfield: {type: \"string\", value: \"title\"},\n\t\t\t\t\tformat: {type: \"string\", value: \"link\"}\n\t\t\t\t}\n\t\t\t}];\n\t\t}\n\t}\n\t// Create the transclude widget\n\treturn {\n\t\ttype: \"element\",\n\t\ttag: \"$transclude\",\n\t\tisBlock: this.renderer.parseTreeNode.isBlock,\n\t\tattributes: {\n\t\t\ttarget: {type: \"string\", value: title},\n\t\t\ttemplate: {type: \"string\", value: template}\n\t\t},\n\t\tchildren: templateTree\n\t};\n};\n\n/*\nRemove a list element from the list, along with the attendant DOM nodes\n*/\nListWidget.prototype.removeListElement = function(index) {\n\t// Get the list element\n\tvar listElement = this.children[index];\n\t// Invoke the listview to animate the removal\n\tif(this.listview && this.listview.remove) {\n\t\tif(!this.listview.remove(index)) {\n\t\t\t// Only delete the DOM element if the listview.remove() returned false\n\t\t\tlistElement.domNode.parentNode.removeChild(listElement.domNode);\n\t\t}\n\t} else {\n\t\t// Always remove the DOM node if we didn't invoke the listview\n\t\tlistElement.domNode.parentNode.removeChild(listElement.domNode);\n\t}\n\t// Then delete the actual renderer node\n\tthis.children.splice(index,1);\n};\n\n/*\nReturn the index of the list element that corresponds to a particular title\nstartIndex: index to start search (use zero to search from the top)\ntitle: tiddler title to seach for\n*/\nListWidget.prototype.findListElementByTitle = function(startIndex,title) {\n\twhile(startIndex < this.children.length) {\n\t\tif(this.children[startIndex].widget.children[0].attributes.target === title) {\n\t\t\treturn startIndex;\n\t\t}\n\t\tstartIndex++;\n\t}\n\treturn undefined;\n};\n\nListWidget.prototype.postRenderInDom = function() {\n\tthis.listview = this.chooseListView();\n\tthis.history = [];\n};\n\n/*\nSelect the appropriate list viewer\n*/\nListWidget.prototype.chooseListView = function() {\n\t// Instantiate the list view\n\tvar listviewName = this.renderer.getAttribute(\"listview\");\n\tvar ListView = this.listViews[listviewName];\n\treturn ListView ? new ListView(this) : null;\n};\n\nListWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Reexecute the widget if any of our attributes have changed\n\tif(changedAttributes.itemClass || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.type || changedAttributes.filter || changedAttributes.template || changedAttributes.history || changedAttributes.listview) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// Handle any changes to the list, and refresh any nodes we're reusing\n\t\tthis.handleListChanges(changedTiddlers);\n\t\t// Update the history list\n\t\tvar history = this.renderer.getAttribute(\"history\");\n\t\tif(history && changedTiddlers[history]) {\n\t\t\tthis.handleHistoryChanges();\n\t\t}\n\t}\n};\n\nListWidget.prototype.handleListChanges = function(changedTiddlers) {\n\tvar t,\n\t\tprevListLength = this.list.length,\n\t\tself = this;\n\t// Get the list of tiddlers, having saved the previous length\n\tthis.getTiddlerList();\n\t// Check if the list is empty\n\tif(this.list.length === 0) {\n\t\t// Check if it was empty before\n\t\tif(prevListLength === 0) {\n\t\t\t// If so, just refresh the empty message\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tif(node.refreshInDom) {\n\t\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t} else {\n\t\t\t// If the list wasn't empty before, empty it\n\t\t\tfor(t=prevListLength-1; t>=0; t--) {\n\t\t\t\tthis.removeListElement(t);\n\t\t\t}\n\t\t\t// Insert the empty message\n\t\t\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[this.getEmptyMessage()]);\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tif(node.renderInDom) {\n\t\t\t\t\tself.renderer.domNode.appendChild(node.renderInDom());\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t} else {\n\t\t// If it is not empty now, but was empty previously, then remove the empty message\n\t\tif(prevListLength === 0) {\n\t\t\tthis.removeListElement(0);\n\t\t}\n\t}\n\t// Step through the list and adjust our child list elements appropriately\n\tfor(t=0; t<this.list.length; t++) {\n\t\t// Check to see if the list element is already there\n\t\tvar index = this.findListElementByTitle(t,this.list[t]);\n\t\tif(index === undefined) {\n\t\t\t// The list element isn't there, so we need to insert it\n\t\t\tthis.children.splice(t,0,this.renderer.renderTree.createRenderer(this.renderer,this.createListElement(this.list[t])));\n\t\t\tthis.renderer.domNode.insertBefore(this.children[t].renderInDom(),this.renderer.domNode.childNodes[t]);\n\t\t\t// Ask the listview to animate the insertion\n\t\t\tif(this.listview && this.listview.insert) {\n\t\t\t\tthis.listview.insert(t);\n\t\t\t}\n\t\t} else {\n\t\t\t// Delete any list elements preceding the one we want\n\t\t\tfor(var n=index-1; n>=t; n--) {\n\t\t\t\tthis.removeListElement(n);\n\t\t\t}\n\t\t\t// Refresh the node we're reusing\n\t\t\tthis.children[t].refreshInDom(changedTiddlers);\n\t\t}\n\t}\n\t// Remove any left over elements\n\tfor(t=this.children.length-1; t>=this.list.length; t--) {\n\t\tthis.removeListElement(t);\n\t}\n};\n\n/*\nHandle any changes to the history list\n*/\nListWidget.prototype.handleHistoryChanges = function() {\n\t// Get the history data\n\tvar historyAtt = this.renderer.getAttribute(\"history\"),\n\t\tnewHistory = this.renderer.renderTree.wiki.getTiddlerData(historyAtt,[]);\n\t// Ignore any entries of the history that match the previous history\n\tvar entry = 0;\n\twhile(entry < newHistory.length && entry < this.history.length && newHistory[entry].title === this.history[entry].title) {\n\t\tentry++;\n\t}\n\t// Navigate forwards to each of the new tiddlers\n\twhile(entry < newHistory.length) {\n\t\tif(this.listview && this.listview.navigateTo) {\n\t\t\tthis.listview.navigateTo(newHistory[entry]);\n\t\t}\n\t\tentry++;\n\t}\n\t// Update the history\n\tthis.history = newHistory;\n};\n\nexports.list = ListWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/list/list.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/list/listviews/classic.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/list/listviews/classic.js\ntype: application/javascript\nmodule-type: listview\n\nViews the list as a linear sequence\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ClassicListView = function(listWidget) {\n\tthis.listWidget = listWidget;\n}\n\nClassicListView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListElementByTitle(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listElementNode = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listElementNode.domNode;\n\t// Scroll the node into view\n\tvar scrollEvent = this.listWidget.renderer.renderTree.document.createEvent(\"Event\");\n\tscrollEvent.initEvent(\"tw-scroll\",true,true);\n\ttargetElement.dispatchEvent(scrollEvent);\n};\n\nClassicListView.prototype.insert = function(index) {\n\tvar listElementNode = this.listWidget.children[index],\n\t\ttargetElement = listElementNode.domNode;\n\t// Get the current height of the tiddler\n\tvar currMarginBottom = parseInt(window.getComputedStyle(targetElement).marginBottom,10),\n\t\tcurrMarginTop = parseInt(window.getComputedStyle(targetElement).marginTop,10),\n\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t// Reset the margin once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"}\n\t\t]);\n\t},$tw.config.preferences.animationDuration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{marginBottom: (-currHeight) + \"px\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t// Transition to the final position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nClassicListView.prototype.remove = function(index) {\n\tvar listElementNode = this.listWidget.children[index],\n\t\ttargetElement = listElementNode.domNode;\n\t// Get the current height of the tiddler\n\tvar currWidth = targetElement.offsetWidth,\n\t\tcurrMarginBottom = parseInt(window.getComputedStyle(targetElement).marginBottom,10),\n\t\tcurrMarginTop = parseInt(window.getComputedStyle(targetElement).marginTop,10),\n\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t// Remove the element at the end of the transition\n\tsetTimeout(function() {\n\t\tif(targetElement.parentNode) {\n\t\t\ttargetElement.parentNode.removeChild(targetElement);\n\t\t}\n\t},$tw.config.preferences.animationDuration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"translateX(0px)\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"},\n\t\t{transform: \"translateX(-\" + currWidth + \"px)\"},\n\t\t{marginBottom: (-currHeight) + \"px\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t// Returning true causes the DOM node not to be deleted\n\treturn true;\n};\n\nexports.classic = ClassicListView;\n\n})();\n",
"title": "$:/core/modules/widgets/list/listviews/classic.js",
"type": "application/javascript",
"module-type": "listview"
},
"$:/core/modules/widgets/list/listviews/pop.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/list/listviews/pop.js\ntype: application/javascript\nmodule-type: listview\n\nAnimates list insertions and removals\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar PopListView = function(listWidget) {\n\tthis.listWidget = listWidget;\n}\n\nPopListView.prototype.insert = function(index) {\n\tvar listElementNode = this.listWidget.children[index],\n\t\ttargetElement = listElementNode.domNode;\n\t// Reset once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{transform: \"none\"}\n\t\t]);\n\t},$tw.config.preferences.animationDuration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"scale(2)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t// Transition to the final position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nPopListView.prototype.remove = function(index) {\n\tvar listElementNode = this.listWidget.children[index],\n\t\ttargetElement = listElementNode.domNode;\n\t// Remove the element at the end of the transition\n\tsetTimeout(function() {\n\t\tif(targetElement.parentNode) {\n\t\t\ttargetElement.parentNode.removeChild(targetElement);\n\t\t}\n\t},$tw.config.preferences.animationDuration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in-out\"},\n\t\t{transform: \"scale(0.1)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t// Returning true causes the DOM node not to be deleted\n\treturn true;\n};\n\nexports.pop = PopListView;\n\n})();\n",
"title": "$:/core/modules/widgets/list/listviews/pop.js",
"type": "application/javascript",
"module-type": "listview"
},
"$:/core/modules/widgets/list/listviews/scroller.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/list/listviews/scroller.js\ntype: application/javascript\nmodule-type: listview\n\nA list view that scrolls to newly inserted elements\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ScrollerListView = function(listWidget) {\n\tthis.listWidget = listWidget;\n}\n\nScrollerListView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListElementByTitle(0,historyInfo.title),\n\t\tlistElementNode = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listElementNode.domNode;\n\t// Scroll the node into view\n\tvar scrollEvent = this.listWidget.renderer.renderTree.document.createEvent(\"Event\");\n\tscrollEvent.initEvent(\"tw-scroll\",true,true);\n\ttargetElement.dispatchEvent(scrollEvent);\n};\n\nexports.scroller = ScrollerListView;\n\n})();\n",
"title": "$:/core/modules/widgets/list/listviews/scroller.js",
"type": "application/javascript",
"module-type": "listview"
},
"$:/core/modules/widgets/list/listviews/zoomin.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/list/listviews/zoomin.js\ntype: application/javascript\nmodule-type: listview\n\nZooms between individual tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ZoominListView = function(listWidget) {\n\tthis.listWidget = listWidget;\n\tthis.storyNode = this.listWidget.renderer.domNode;\n\t// Set the current tiddler\n\tthis.currentTiddler = this.listWidget.children[0];\n\t// Make all the tiddlers position absolute, and hide all but the first one\n\tthis.storyNode.style.position = \"relative\";\n\tfor(var t=0; t<this.storyNode.children.length; t++) {\n\t\tif(t) {\n\t\t\tthis.storyNode.children[t].style.display = \"none\";\n\t\t}\n\t\tthis.storyNode.children[t].style.position = \"absolute\";\n\t}\n};\n\n/*\nFind the first descendent node that is a <$view field=\"title\"> widget\n*/\nfunction findTitleNode(node) {\n\tvar t,r;\n\t// Return true if this node is a view widget with the field attribute set to \"title\"\n\tif(node instanceof $tw.WikiRenderTree.prototype.rendererClasses.element) {\n\t\tif(node.widget instanceof $tw.WikiRenderTree.prototype.rendererClasses.element.prototype.widgetClasses.view && node.attributes.field === \"title\") {\n\t\t\treturn node;\t\n\t\t}\n\t\tif(node.widget.children) {\n\t\t\tfor(t=0; t<node.widget.children.length; t++) {\n\t\t\t\tvar r = findTitleNode(node.widget.children[t]);\n\t\t\t\tif(r) {\n\t\t\t\t\treturn r;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(node.children) {\n\t\t\tfor(t=0; t<node.children.length; t++) {\n\t\t\t\tvar r = findTitleNode(node.children[t]);\n\t\t\t\tif(r) {\n\t\t\t\t\treturn r;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nZoominListView.prototype.insert = function(index) {\n\tvar listElementNode = this.listWidget.children[index],\n\t\ttargetElement = listElementNode.domNode;\n\t// Make the newly inserted node position absolute and hidden\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"none\"},\n\t\t{position: \"absolute\"}\n\t]);\n};\n\nZoominListView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListElementByTitle(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listElementNode = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listElementNode.domNode;\n\t// Make the new tiddler be position absolute and visible so that we can measure it\n\t$tw.utils.setStyle(targetElement,[\n\t\t{position: \"absolute\"},\n\t\t{display: \"block\"},\n\t\t{transformOrigin: \"0 0\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{transition: \"none\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t// Get the position of the source node, or use the centre of the window as the source position\n\tvar sourceBounds = historyInfo.fromPageRect || {\n\t\t\tleft: window.innerWidth/2 - 2,\n\t\t\ttop: window.innerHeight/2 - 2,\n\t\t\twidth: window.innerWidth/8,\n\t\t\theight: window.innerHeight/8\n\t\t};\n\t// Try to find the title node in the target tiddler\n\tvar titleNode = findTitleNode(listElementNode) || listElementNode,\n\t\tzoomBounds = titleNode.domNode.getBoundingClientRect();\n\t// Compute the transform for the target tiddler to make the title lie over the source rectange\n\tvar targetBounds = targetElement.getBoundingClientRect(),\n\t\tscale = sourceBounds.width / zoomBounds.width,\n\t\tx = sourceBounds.left - targetBounds.left - (zoomBounds.left - targetBounds.left) * scale,\n\t\ty = sourceBounds.top - targetBounds.top - (zoomBounds.top - targetBounds.top) * scale;\n\t// Transform the target tiddler to its starting position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transform: \"translateX(\" + x + \"px) translateY(\" + y + \"px) scale(\" + scale + \")\"}\n\t]);\n\t// Force layout\n\t$tw.utils.forceLayout(targetElement);\n\t// Apply the ending transitions with a timeout to ensure that the previously applied transformations are applied first\n\tvar self = this,\n\t\tprevCurrentTiddler = this.currentTiddler;\n\tthis.currentTiddler = listElementNode;\n\t// Transform the target tiddler to its natural size\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in, opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in\"},\n\t\t{opacity: \"1.0\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{zIndex: \"500\"},\n\t]);\n\t// Transform the previous tiddler out of the way and then hide it\n\tif(prevCurrentTiddler && prevCurrentTiddler !== listElementNode) {\n\t\tvar scale = zoomBounds.width / sourceBounds.width;\n\t\tx = zoomBounds.left - targetBounds.left - (sourceBounds.left - targetBounds.left) * scale;\n\t\ty = zoomBounds.top - targetBounds.top - (sourceBounds.top - targetBounds.top) * scale;\n\t\t$tw.utils.setStyle(prevCurrentTiddler.domNode,[\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + $tw.config.preferences.animationDurationMs + \" ease-in, opacity \" + $tw.config.preferences.animationDurationMs + \" ease-in\"},\n\t\t\t{opacity: \"0.0\"},\n\t\t\t{transformOrigin: \"0 0\"},\n\t\t\t{transform: \"translateX(\" + x + \"px) translateY(\" + y + \"px) scale(\" + scale + \")\"},\n\t\t\t{zIndex: \"0\"}\n\t\t]);\n\t\t// Hide the tiddler when the transition has finished\n\t\tsetTimeout(function() {\n\t\t\tif(self.currentTiddler !== prevCurrentTiddler) {\n\t\t\t\tprevCurrentTiddler.domNode.style.display = \"none\";\n\t\t\t}\n\t\t},$tw.config.preferences.animationDuration);\n\t}\n\t// Scroll the target into view\n//\t$tw.pageScroller.scrollIntoView(targetElement);\n};\n\nexports.zoomin = ZoominListView;\n\n})();\n",
"title": "$:/core/modules/widgets/list/listviews/zoomin.js",
"type": "application/javascript",
"module-type": "listview"
},
"$:/core/modules/widgets/navigator.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/navigator.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the navigator widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar NavigatorWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nNavigatorWidget.prototype.generate = function() {\n\t// Get our parameters\n\tthis.storyTitle = this.renderer.getAttribute(\"story\");\n\tthis.historyTitle = this.renderer.getAttribute(\"history\");\n\t// Set the element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": \"tw-navigator\"\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n\tthis.events = [\n\t\t{name: \"tw-navigate\", handlerObject: this, handlerMethod: \"handleNavigateEvent\"},\n\t\t{name: \"tw-edit-tiddler\", handlerObject: this, handlerMethod: \"handleEditTiddlerEvent\"},\n\t\t{name: \"tw-delete-tiddler\", handlerObject: this, handlerMethod: \"handleDeleteTiddlerEvent\"},\n\t\t{name: \"tw-save-tiddler\", handlerObject: this, handlerMethod: \"handleSaveTiddlerEvent\"},\n\t\t{name: \"tw-cancel-tiddler\", handlerObject: this, handlerMethod: \"handleCancelTiddlerEvent\"},\n\t\t{name: \"tw-close-tiddler\", handlerObject: this, handlerMethod: \"handleCloseTiddlerEvent\"},\n\t\t{name: \"tw-close-all-tiddlers\", handlerObject: this, handlerMethod: \"handleCloseAllTiddlersEvent\"},\n\t\t{name: \"tw-new-tiddler\", handlerObject: this, handlerMethod: \"handleNewTiddlerEvent\"}\n\t];\n};\n\nNavigatorWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t$tw.utils.each(this.children,function(node) {\n\t\tif(node.refreshInDom) {\n\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t}\n\t});\n};\n\nNavigatorWidget.prototype.getStoryList = function() {\n\tvar text = this.renderer.renderTree.wiki.getTextReference(this.storyTitle,\"\");\n\tif(text && text.length > 0) {\n\t\tthis.storyList = text.split(\"\\n\");\n\t} else {\n\t\tthis.storyList = [];\n\t}\n};\n\nNavigatorWidget.prototype.saveStoryList = function() {\n\tvar storyTiddler = this.renderer.renderTree.wiki.getTiddler(this.storyTitle);\n\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler({\n\t\ttitle: this.storyTitle\n\t},storyTiddler,{text: this.storyList.join(\"\\n\")}));\n};\n\nNavigatorWidget.prototype.findTitleInStory = function(title,defaultIndex) {\n\tfor(var t=0; t<this.storyList.length; t++) {\n\t\tif(this.storyList[t] === title) {\n\t\t\treturn t;\n\t\t}\n\t}\t\n\treturn defaultIndex;\n};\n\n// Navigate to a specified tiddler\nNavigatorWidget.prototype.handleNavigateEvent = function(event) {\n\tif(this.storyTitle) {\n\t\t// Update the story tiddler if specified\n\t\tthis.getStoryList();\n\t\t// See if the tiddler is already there\n\t\tvar slot = this.findTitleInStory(event.navigateTo,-1);\n\t\t// If not we need to add it\n\t\tif(slot === -1) {\n\t\t\t// First we try to find the position of the story element we navigated from\n\t\t\tslot = this.findTitleInStory(event.navigateFromTitle,-1) + 1;\n\t\t\t// Add the tiddler\n\t\t\tthis.storyList.splice(slot,0,event.navigateTo);\n\t\t\t// Save the story\n\t\t\tthis.saveStoryList();\n\t\t}\n\t}\n\t// Add a new record to the top of the history stack\n\tif(this.historyTitle) {\n\t\tvar historyList = this.renderer.renderTree.wiki.getTiddlerData(this.historyTitle,[]);\n\t\thistoryList.push({title: event.navigateTo, fromPageRect: event.navigateFromClientRect});\n\t\tthis.renderer.renderTree.wiki.setTiddlerData(this.historyTitle,historyList);\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n// Close a specified tiddler\nNavigatorWidget.prototype.handleCloseTiddlerEvent = function(event) {\n\tthis.getStoryList();\n\t// Look for tiddlers with this title to close\n\tvar slot = this.findTitleInStory(event.tiddlerTitle,-1);\n\tif(slot !== -1) {\n\t\tthis.storyList.splice(slot,1);\n\t\tthis.saveStoryList();\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n// Close all tiddlers\nNavigatorWidget.prototype.handleCloseAllTiddlersEvent = function(event) {\n\tthis.storyList = [];\n\tthis.saveStoryList();\n\tevent.stopPropagation();\n\treturn false;\n};\n\n// Place a tiddler in edit mode\nNavigatorWidget.prototype.handleEditTiddlerEvent = function(event) {\n\tthis.getStoryList();\n\t// Replace the specified tiddler with a draft in edit mode\n\tfor(var t=0; t<this.storyList.length; t++) {\n\t\tif(this.storyList[t] === event.tiddlerTitle) {\n\t\t\t// Compute the title for the draft\n\t\t\tvar draftTitle = this.generateDraftTitle(event.tiddlerTitle);\n\t\t\tthis.storyList[t] = draftTitle;\n\t\t\t// Get the current value of the tiddler we're editing\n\t\t\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(event.tiddlerTitle);\n\t\t\t// Save the initial value of the draft tiddler\n\t\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(\n\t\t\t\t{\n\t\t\t\t\ttext: \"Type the text for the tiddler '\" + event.tiddlerTitle + \"'\"\n\t\t\t\t},\n\t\t\t\ttiddler,\n\t\t\t\t{\n\t\t\t\t\ttitle: draftTitle,\n\t\t\t\t\t\"draft.title\": event.tiddlerTitle,\n\t\t\t\t\t\"draft.of\": event.tiddlerTitle\n\t\t\t\t}));\n\t\t}\n\t}\n\tthis.saveStoryList();\n\tevent.stopPropagation();\n\treturn false;\n};\n\n// Delete a tiddler\nNavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {\n\t// Get the tiddler title we're deleting\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(event.tiddlerTitle);\n\t// Check if the tiddler we're deleting is in draft mode\n\tif(tiddler.hasField(\"draft.title\")) {\n\t\t// Delete the original tiddler\n\t\tthis.renderer.renderTree.wiki.deleteTiddler(tiddler.fields[\"draft.of\"]);\n\t}\n\t// Delete this tiddler\n\tthis.renderer.renderTree.wiki.deleteTiddler(event.tiddlerTitle);\n\t// Remove the closed tiddler from the story\n\tthis.getStoryList();\n\t// Look for tiddler with this title to close\n\tvar slot = this.findTitleInStory(event.tiddlerTitle,-1);\n\tif(slot !== -1) {\n\t\tthis.storyList.splice(slot,1);\n\t\tthis.saveStoryList();\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n/*\nGenerate a title for the draft of a given tiddler\n*/\nNavigatorWidget.prototype.generateDraftTitle = function(title) {\n\tvar c = 0;\n\tdo {\n\t\tvar draftTitle = \"Draft \" + (c ? (c + 1) + \" \" : \"\") + \"of '\" + title + \"'\";\n\t\tc++;\n\t} while(this.renderer.renderTree.wiki.tiddlerExists(draftTitle));\n\treturn draftTitle;\n};\n\n// Take a tiddler out of edit mode, saving the changes\nNavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {\n\tthis.getStoryList();\n\tvar storyTiddlerModified = false;\n\tfor(var t=0; t<this.storyList.length; t++) {\n\t\tif(this.storyList[t] === event.tiddlerTitle) {\n\t\t\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(event.tiddlerTitle);\n\t\t\tif(tiddler.hasField(\"draft.title\")) {\n\t\t\t\t// Save the draft tiddler as the real tiddler\n\t\t\t\tthis.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,{\n\t\t\t\t\ttitle: tiddler.fields[\"draft.title\"],\n\t\t\t\t\tmodified: new Date(),\n\t\t\t\t\t\"draft.title\": undefined, \n\t\t\t\t\t\"draft.of\": undefined\n\t\t\t\t}));\n\t\t\t\t// Remove the draft tiddler\n\t\t\t\tthis.renderer.renderTree.wiki.deleteTiddler(event.tiddlerTitle);\n\t\t\t\t// Remove the original tiddler if we're renaming it\n\t\t\t\tif(tiddler.fields[\"draft.of\"] !== tiddler.fields[\"draft.title\"]) {\n\t\t\t\t\tthis.renderer.renderTree.wiki.deleteTiddler(tiddler.fields[\"draft.of\"]);\n\t\t\t\t}\n\t\t\t\t// Make the story record point to the newly saved tiddler\n\t\t\t\tthis.storyList[t] = tiddler.fields[\"draft.title\"];\n\t\t\t\t// Check if we're modifying the story tiddler itself\n\t\t\t\tif(tiddler.fields[\"draft.title\"] === this.storyTitle) {\n\t\t\t\t\tstoryTiddlerModified = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(!storyTiddlerModified) {\n\t\tthis.saveStoryList();\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n// Take a tiddler out of edit mode without saving the changes\nNavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {\n\tthis.getStoryList();\n\tvar storyTiddlerModified = false;\n\tfor(var t=0; t<this.storyList.length; t++) {\n\t\tif(this.storyList[t] === event.tiddlerTitle) {\n\t\t\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(event.tiddlerTitle);\n\t\t\tif(tiddler.hasField(\"draft.title\")) {\n\t\t\t\t// Remove the draft tiddler\n\t\t\t\tthis.renderer.renderTree.wiki.deleteTiddler(event.tiddlerTitle);\n\t\t\t\t// Make the story record point to the original tiddler\n\t\t\t\tthis.storyList[t] = tiddler.fields[\"draft.title\"];\n\t\t\t\t// Check if we're modifying the story tiddler itself\n\t\t\t\tif(tiddler.fields[\"draft.title\"] === this.storyTitle) {\n\t\t\t\t\tstoryTiddlerModified = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(!storyTiddlerModified) {\n\t\tthis.saveStoryList();\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n// Create a new draft tiddler\nNavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {\n\t// Get the story details\n\tthis.getStoryList();\n\t// Create the new tiddler\n\tvar title;\n\tfor(var t=0; true; t++) {\n\t\ttitle = \"New Tiddler\" + (t ? \" \" + t : \"\");\n\t\tif(!this.renderer.renderTree.wiki.tiddlerExists(title)) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tvar tiddler = new $tw.Tiddler({\n\t\ttitle: title,\n\t\ttext: \"Newly created tiddler\"\n\t});\n\tthis.renderer.renderTree.wiki.addTiddler(tiddler);\n\t// Create the draft tiddler\n\tvar draftTitle = this.generateDraftTitle(title),\n\t\tdraftTiddler = new $tw.Tiddler({\n\t\t\ttext: \"Type the text for the new tiddler\",\n\t\t\ttitle: draftTitle,\n\t\t\t\"draft.title\": title,\n\t\t\t\"draft.of\": title\n\t\t});\n\tthis.renderer.renderTree.wiki.addTiddler(draftTiddler);\n\t// Update the story to insert the new draft at the top\n\tvar slot = this.findTitleInStory(event.navigateFromTitle,-1) + 1;\n\tthis.storyList.splice(slot,0,draftTitle);\n\t// Save the updated story\n\tthis.saveStoryList();\n\t// Add a new record to the top of the history stack\n\tvar history = this.renderer.renderTree.wiki.getTiddlerData(this.historyTitle,[]);\n\thistory.push({title: draftTitle});\n\tthis.renderer.renderTree.wiki.setTiddlerData(this.historyTitle,history);\n\tevent.stopPropagation();\n\treturn false;\n};\n\nexports.navigator = NavigatorWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/navigator.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/password.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/password.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the password widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar PasswordWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nPasswordWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.name = this.renderer.getAttribute(\"name\");\n\t// Get the current password\n\tvar password = $tw.browser ? $tw.utils.getPassword(this.name) : \"\";\n\t// Generate our element\n\tthis.tag = \"input\";\n\tthis.attributes = {\n\t\ttype: \"password\",\n\t\tvalue: password\n\t};\n\tthis.events = [\n\t\t{name: \"keyup\", handlerObject: this},\n\t\t{name: \"input\", handlerObject: this}];\n};\n\nPasswordWidget.prototype.handleEvent = function(event) {\n\tvar password = this.renderer.domNode.value;\n\treturn $tw.utils.savePassword(this.name,password);\n};\n\nexports.password = PasswordWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/password.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/reveal.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/reveal.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the reveal widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar RevealWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nRevealWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.state = this.renderer.getAttribute(\"state\");\n\tthis.type = this.renderer.getAttribute(\"type\");\n\tthis.text = this.renderer.getAttribute(\"text\");\n\tthis.position = this.renderer.getAttribute(\"position\");\n\tthis[\"default\"] = this.renderer.getAttribute(\"default\",\"\");\n\tthis.qualifyTiddlerTitles = this.renderer.getAttribute(\"qualifyTiddlerTitles\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\tthis.animate = this.renderer.getAttribute(\"animate\",\"no\");\n\t// Compute the title of the state tiddler and read it\n\tthis.stateTitle = this.state;\n\tif(this.qualifyTiddlerTitles) {\n\t\tthis.stateTitle = this.stateTitle + \"-\" + this.renderer.renderTree.getContextScopeId(this.renderer.parentRenderer);\n\t}\n\tthis.readState();\n\t// Set up the element attributes\n\tvar classes = [\"tw-reveal\"],\n\t\tstyles = [];\n\tif(this[\"class\"]) {\n\t\t$tw.utils.pushTop(classes,this[\"class\"]);\n\t}\n\tif(this.isOpen) {\n\t\t$tw.utils.pushTop(classes,\"tw-reveal-open\");\n\t}\n\tswitch(this.type) {\n\t\tcase \"popup\":\n\t\t\tstyles.push(\"position:absolute;\");\n\t\t\tclasses.push(\"tw-popup\");\n\t\t\tbreak;\n\t}\n\tstyles.push(\"display:\" + (this.isOpen ? (this.renderer.parseTreeNode.isBlock ? \"block\" : \"inline\") : \"none\") + \";\");\n\t// Set the element\n\tthis.tag = \"div\";\n\tthis.attributes = {\n\t\t\"class\": classes.join(\" \"),\n\t\tstyle: styles.join(\"\")\n\t};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.isOpen ? this.renderer.parseTreeNode.children : []);\n\tthis.events = [{name: \"click\", handlerObject: this, handlerMethod: \"handleClickEvent\"}];\n};\n\n/*\nRead the state tiddler\n*/\nRevealWidget.prototype.readState = function() {\n\t// Read the information from the state tiddler\n\tif(this.stateTitle) {\n\t\tvar state = this.renderer.renderTree.wiki.getTextReference(this.stateTitle,this[\"default\"],this.renderer.tiddlerTitle);\n\t\tswitch(this.type) {\n\t\t\tcase \"popup\":\n\t\t\t\tthis.readPopupState(state);\n\t\t\t\tbreak;\n\t\t\tcase \"match\":\n\t\t\t\tthis.readMatchState(state);\n\t\t\t\tbreak;\n\t\t\tcase \"nomatch\":\n\t\t\t\tthis.readMatchState(state);\n\t\t\t\tthis.isOpen = !this.isOpen;\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n\nRevealWidget.prototype.readMatchState = function(state) {\n\tthis.isOpen = state === this.text;\n};\n\nRevealWidget.prototype.readPopupState = function(state) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tmatch = popupLocationRegExp.exec(state);\n\t// Check if the state matches the location regexp\n\tif(match) {\n\t\t// If so, we're open\n\t\tthis.isOpen = true;\n\t\t// Get the location\n\t\tthis.popup = {\n\t\t\tleft: parseFloat(match[1]),\n\t\t\ttop: parseFloat(match[2]),\n\t\t\twidth: parseFloat(match[3]),\n\t\t\theight: parseFloat(match[4])\n\t\t};\n\t} else {\n\t\t// If not, we're closed\n\t\tthis.isOpen = false;\n\t}\n};\n\nRevealWidget.prototype.handleClickEvent = function(event) {\n\tif(event.type === \"click\" && this.type === \"popup\") {\n\t\t// Cancel the popup if we get a click on it\n\t\tif(this.stateTitle) {\n\t\t\tthis.renderer.renderTree.wiki.deleteTextReference(this.stateTitle);\n\t\t}\n\t\tevent.preventDefault();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nRevealWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\tvar self = this;\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes[\"default\"] || changedAttributes.qualifyTiddlerTitles || changedAttributes[\"class\"]) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\tvar needChildrenRefresh = true; // Avoid refreshing the children nodes if we don't need to\n\t\t// Get the open state\n\t\tvar previousState = this.isOpen\n\t\tthis.readState();\n\t\t// Construct the child nodes if required\n\t\tif(this.isOpen && this.children.length === 0) {\n\t\t\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n\t\t\tvar parentNode = this.renderer.domNode;\n\t\t\t$tw.utils.each(this.children,function(child) {\n\t\t\t\tparentNode.appendChild(child.renderInDom());\n\t\t\t});\n\t\t\tneedChildrenRefresh = false;\n\t\t}\n\t\t// Refresh any child nodes\n\t\tif(needChildrenRefresh) {\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tif(node.refreshInDom) {\n\t\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t// Animate the opening or closing\n\t\tif(this.isOpen !== previousState) {\n\t\t\tif(this.animate !== \"no\") {\n\t\t\t\tif(this.isOpen) {\n\t\t\t\t\tthis.renderer.domNode.style.display = this.renderer.parseTreeNode.isBlock ? \"block\" : \"inline\";\n\t\t\t\t\t$tw.anim.perform(\"open\",this.renderer.domNode);\n\t\t\t\t} else {\n\t\t\t\t\t$tw.anim.perform(\"close\",this.renderer.domNode,{callback: function() {\n\t\t\t\t\t\tself.renderer.domNode.style.display = \"none\";\n\t\t\t\t\t}});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.renderer.domNode.style.display = this.isOpen ? (this.renderer.parseTreeNode.isBlock ? \"block\" : \"inline\") : \"none\";\n\t\t\t}\n\t\t}\n\t\t// Add or remove the tw-reveal-open class\n\t\t$tw.utils.toggleClass(this.renderer.domNode,\"tw-reveal-open\",this.isOpen);\n\t}\n\t// Position the content if required\n\tif(this.isOpen) {\n\t\tthis.postRenderInDom();\n\t}\n};\n\nRevealWidget.prototype.postRenderInDom = function() {\n\tswitch(this.type) {\n\t\tcase \"popup\":\n\t\t\tif(this.isOpen) {\n\t\t\t\tthis.renderer.domNode.style.position = \"absolute\";\n\t\t\t\tthis.renderer.domNode.style.zIndex = \"1000\";\n\t\t\t\tswitch(this.position) {\n\t\t\t\t\tcase \"left\":\n\t\t\t\t\t\tthis.renderer.domNode.style.left = (this.popup.left - this.renderer.domNode.offsetWidth) + \"px\";\n\t\t\t\t\t\tthis.renderer.domNode.style.top = this.popup.top + \"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"above\":\n\t\t\t\t\t\tthis.renderer.domNode.style.left = this.popup.left + \"px\";\n\t\t\t\t\t\tthis.renderer.domNode.style.top = (this.popup.top - this.renderer.domNode.offsetHeight) + \"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"aboveright\":\n\t\t\t\t\t\tthis.renderer.domNode.style.left = (this.popup.left + this.popup.width) + \"px\";\n\t\t\t\t\t\tthis.renderer.domNode.style.top = (this.popup.top + this.popup.height - this.renderer.domNode.offsetHeight) + \"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"right\":\n\t\t\t\t\t\tthis.renderer.domNode.style.left = (this.popup.left + this.popup.width) + \"px\";\n\t\t\t\t\t\tthis.renderer.domNode.style.top = this.popup.top + \"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"belowleft\":\n\t\t\t\t\t\tthis.renderer.domNode.style.left = (this.popup.left + this.popup.width - this.renderer.domNode.offsetWidth) + \"px\";\n\t\t\t\t\t\tthis.renderer.domNode.style.top = (this.popup.top + this.popup.height) + \"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault: // Below\n\t\t\t\t\t\tthis.renderer.domNode.style.left = this.popup.left + \"px\";\n\t\t\t\t\t\tthis.renderer.domNode.style.top = (this.popup.top + this.popup.height) + \"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t}\n};\n\nexports.reveal = RevealWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/reveal.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/setstyle.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/setstyle.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the setstyle widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar SetStyleWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nSetStyleWidget.prototype.generate = function() {\n\t// Get the parameters from the attributes\n\tthis.name = this.renderer.getAttribute(\"name\");\n\tthis.value = this.renderer.getAttribute(\"value\");\n\tthis[\"class\"] = this.renderer.getAttribute(\"class\");\n\t// Set up the element\n\tthis.tag = this.renderer.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tthis.attributes = {\n\t\tstyle: this.name + \":\" + this.value\n\t};\n\tif(this[\"class\"]) {\n\t\tthis.attributes[\"class\"] = this[\"class\"];\n\t}\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,this.renderer.parseTreeNode.children);\n};\n\nSetStyleWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.name || changedAttributes.value || changedAttributes[\"class\"]) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.setstyle = SetStyleWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/setstyle.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/transclude.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/transclude.js\ntype: application/javascript\nmodule-type: widget\n\nThe transclude widget includes another tiddler into the tiddler being rendered.\n\nAttributes:\n\ttarget: the title of the tiddler to transclude\n\ttemplate: the title of the tiddler to use as a template for the transcluded tiddler\n\nThe simplest case is to just supply a target tiddler:\n\n{{{\n<$transclude target=\"Foo\"/>\n}}}\n\nThis will render the tiddler Foo within the current tiddler. If the tiddler Foo includes\nthe view widget (or other widget that reference the fields of the current tiddler), then the\nfields of the tiddler Foo will be accessed.\n\nIf you want to transclude the tiddler as a template, so that the fields referenced by the view\nwidget are those of the tiddler doing the transcluding, then you can instead specify the tiddler\nas a template:\n\n{{{\n<$transclude template=\"Foo\"/>\n}}}\n\nThe effect is the same as the previous example: the text of the tiddler Foo is rendered. The\ndifference is that the view widget will access the fields of the tiddler doing the transcluding.\n\nThe `target` and `template` attributes may be combined:\n\n{{{\n<$transclude template=\"Bar\" target=\"Foo\"/>\n}}}\n\nHere, the text of the tiddler `Bar` will be transcluded, with the widgets within it accessing the fields\nof the tiddler `Foo`.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar TranscludeWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nTranscludeWidget.prototype.generate = function() {\n\tvar self = this,\n\t\ttr, templateParseTree, templateTiddler;\n\t// Get the render target details\n\tthis.targetTitle = this.renderer.getAttribute(\"target\",this.renderer.tiddlerTitle);\n\tthis.targetField = this.renderer.getAttribute(\"field\");\n\tthis.targetIndex = this.renderer.getAttribute(\"index\");\n\tthis.currentField = this.renderer.getAttribute(\"currentField\");\n\t// Get the render tree for the template\n\tthis.templateTitle = undefined;\n\tif(this.renderer.parseTreeNode.children && this.renderer.parseTreeNode.children.length > 0) {\n\t\t// Use the child nodes as the template if we've got them\n\t\ttemplateParseTree = this.renderer.parseTreeNode.children;\n\t} else {\n\t\tthis.templateTitle = this.renderer.getAttribute(\"template\",this.targetTitle);\n\t\t// Check for recursion\n\t\tif(this.renderer.renderTree.checkContextRecursion(this.renderer.parentRenderer,{\n\t\t\t\ttiddlerTitle: this.targetTitle,\n\t\t\t\ttemplateTitle: this.templateTitle\n\t\t\t})) {\n\t\t\ttemplateParseTree = [{type: \"text\", text: \"Tiddler recursion error in transclude widget\"}];\t\n\t\t} else {\n\t\t\tvar parser;\n\t\t\tif(this.targetField === \"text\" || (!this.targetField && !this.targetIndex)) {\n\t\t\t\tparser = this.renderer.renderTree.wiki.parseTiddler(this.templateTitle,{parseAsInline: !this.renderer.parseTreeNode.isBlock});\n\t\t\t} else {\n\t\t\t\tvar tiddler,text;\n\t\t\t\tif(this.targetField) {\n\t\t\t\t\ttiddler = this.renderer.renderTree.wiki.getTiddler(this.targetTitle);\n\t\t\t\t\ttext = tiddler ? tiddler.fields[this.targetField] : \"\";\n\t\t\t\t\tif(text === undefined) {\n\t\t\t\t\t\ttext = \"\";\n\t\t\t\t\t}\n\t\t\t\t\tparser = this.renderer.renderTree.wiki.parseText(\"text/vnd.tiddlywiki\",text,{parseAsInline: !this.renderer.parseTreeNode.isBlock});\n\t\t\t\t} else if(this.targetIndex) {\n\t\t\t\t\ttext = this.renderer.renderTree.wiki.extractTiddlerDataItem(this.targetTitle,this.targetIndex,\"\");\n\t\t\t\t\tparser = this.renderer.renderTree.wiki.parseText(\"text/vnd.tiddlywiki\",text);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttemplateParseTree = parser ? parser.tree : [];\n\t\t}\n\t}\n\t// Set up the attributes for the wrapper element\n\tvar classes = [\"tw-transclude\"];\n\tif(this.renderer.hasAttribute(\"class\")) {\n\t\t$tw.utils.pushTop(classes,this.renderer.getAttribute(\"class\").split(\" \"));\n\t}\n\tif(!this.renderer.renderTree.wiki.tiddlerExists(this.targetTitle) && !this.renderer.renderTree.wiki.isShadowTiddler(this.targetTitle)) {\n\t\t$tw.utils.pushTop(classes,\"tw-tiddler-missing\");\n\t}\n\t// Save the context for this renderer node\n\tthis.renderer.context = {\n\t\ttiddlerTitle: this.targetTitle,\n\t\ttemplateTitle: this.templateTitle\n\t};\n\t// Initialise events\n\tthis.events = [];\n\t// If a current field is specified\n\tif(this.currentField) {\n\t\t// Record the current field in the render context\n\t\tthis.renderer.context.field = this.currentField;\n\t\t// Add an event handler to record the current field\n\t\tthis.events.push({name: \"tw-remove-field\", handlerFunction: function(event) {\n\t\t\tevent.currentField = self.currentField;\n\t\t\treturn true;\n\t\t}});\n\t}\n\t// Trap and update tag modification events\n\tthis.events.push({name: \"tw-remove-tag\", handlerFunction: function(event) {\n\t\tevent.currentTag = self.targetTitle;\n\t\treturn true;\n\t}});\n\t// Set the element\n\tthis.tag = this.renderer.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tthis.attributes = {};\n\tif(classes.length > 0) {\n\t\tthis.attributes[\"class\"] = classes.join(\" \");\n\t}\n\tif(this.renderer.hasAttribute(\"style\")) {\n\t\tthis.attributes.style = this.renderer.getAttribute(\"style\");\n\t}\n\tif(this.renderer.hasAttribute(\"tooltip\")) {\n\t\tthis.attributes.title = this.renderer.getAttribute(\"tooltip\");\n\t}\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,templateParseTree);\n};\n\nTranscludeWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Set the class for missing tiddlers\n\tif(this.targetTitle && changedTiddlers[this.targetTitle]) {\n\t\t$tw.utils.toggleClass(this.renderer.domNode,\"tw-tiddler-missing\",!this.renderer.renderTree.wiki.tiddlerExists(this.targetTitle));\n\t}\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.target || changedAttributes.template || (this.templateTitle && changedTiddlers[this.templateTitle])) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.transclude = TranscludeWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/transclude.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/version.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/version.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the version widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar VersionWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nVersionWidget.prototype.generate = function() {\n\t// Set the element\n\tthis.tag = \"span\";\n\tthis.attributes = {};\n\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: $tw.version\n\t}]);\n};\n\nexports.version = VersionWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/version.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/video.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/video.js\ntype: application/javascript\nmodule-type: widget\n\nImplements the video widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar VideoWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Generate child nodes\n\tthis.generate();\n};\n\nVideoWidget.prototype.generate = function() {\n\t// Get attributes\n\tthis.src = this.renderer.getAttribute(\"src\");\n\tthis.type = this.renderer.getAttribute(\"type\",\"vimeo\");\n\tthis.width = parseInt(this.renderer.getAttribute(\"width\",\"640\"),10);\n\tthis.height = parseInt(this.renderer.getAttribute(\"height\",\"360\"),10);\n\t// Return the appropriate element\n\tswitch(this.type) {\n\t\tcase \"vimeo\":\n\t\t\tthis.tag = \"iframe\";\n\t\t\tthis.attributes = {\n\t\t\t\tsrc: \"http://player.vimeo.com/video/\" + this.src + \"?autoplay=0\",\n\t\t\t\twidth: this.width,\n\t\t\t\theight: this.height,\n\t\t\t\tframeborder: 0\n\t\t\t};\n\t\t\tbreak;\n\t\tcase \"youtube\":\n\t\t\tthis.tag = \"iframe\";\n\t\t\tthis.attributes = {\n\t\t\t\tsrc: \"http://www.youtube.com/embed/\" + this.src,\n\t\t\t\twidth: this.width,\n\t\t\t\theight: this.height,\n\t\t\t\tframeborder: 0\n\t\t\t};\n\t\t\tbreak;\n\t\tcase \"archiveorg\":\n\t\t\tthis.tag = \"iframe\";\n\t\t\tthis.attributes = {\n\t\t\t\tsrc: \"http://www.archive.org/embed/\" + this.src,\n\t\t\t\twidth: this.width,\n\t\t\t\theight: this.height,\n\t\t\t\tframeborder: 0\n\t\t\t};\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthis.tag = \"div\";\n\t\t\tthis.attributes = {};\n\t\t\tthis.children = this.renderer.renderTree.createRenderers(this.renderer,[{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: \"Unknown video type\"\n\t\t\t}]);\n\t\t\tbreak;\n\t}\n};\n\nexports.video = VideoWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/video.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/view.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view.js\ntype: application/javascript\nmodule-type: widget\n\nThe view widget displays a tiddler field.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDefine the \"text\" viewer here so that it is always available\n*/\nvar TextViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nTextViewer.prototype.render = function() {\n\t// Get the value as a string\n\tif(this.field !== \"text\" && this.tiddler) {\n\t\tthis.value = this.tiddler.getFieldString(this.field);\n\t}\n\tvar value = \"\";\n\tif(this.value !== undefined && this.value !== null) {\n\t\tvalue = this.value;\n\t}\n\t// Set the element details\n\tthis.viewWidget.tag = \"span\";\n\tthis.viewWidget.attributes = {};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer.renderContext,[{\n\t\ttype: \"text\",\n\t\ttext: value\n\t}]);\n};\n\nvar ViewWidget = function(renderer) {\n\t// Save state\n\tthis.renderer = renderer;\n\t// Initialise the field viewers if they've not been done already\n\tif(!this.fieldViewers) {\n\t\tViewWidget.prototype.fieldViewers = {text: TextViewer}; // Start with the built-in text viewer\n\t\t$tw.modules.applyMethods(\"fieldviewer\",this.fieldViewers);\n\t}\n\t// Generate child nodes\n\tthis.generate();\n};\n\nViewWidget.prototype.generate = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.renderer.getAttribute(\"tiddler\",this.renderer.tiddlerTitle);\n\tthis.fieldName = this.renderer.getAttribute(\"field\",this.renderer.renderTree.getContextVariable(this.renderer,\"field\",\"text\"));\n\tthis.format = this.renderer.getAttribute(\"format\",\"text\");\n\t// Get the value to display\n\tvar tiddler = this.renderer.renderTree.wiki.getTiddler(this.tiddlerTitle),\n\t\tvalue;\n\tif(tiddler) {\n\t\tif(this.fieldName === \"text\") {\n\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\tvalue = this.renderer.renderTree.wiki.getTiddlerText(this.tiddlerTitle);\n\t\t} else {\n\t\t\tvalue = tiddler.fields[this.fieldName];\n\t\t}\n\t} else { // Use a special value if the tiddler is missing\n\t\tswitch(this.fieldName) {\n\t\t\tcase \"title\":\n\t\t\t\tvalue = this.tiddlerTitle;\n\t\t\t\tbreak;\n\t\t\tcase \"modified\":\n\t\t\tcase \"created\":\n\t\t\t\tvalue = new Date();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tvalue = \"\";\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t// Choose the viewer to use\n\tvar Viewer = this.fieldViewers.text;\n\tif($tw.utils.hop(this.fieldViewers,this.format)) {\n\t\tViewer = this.fieldViewers[this.format];\n\t}\n\tthis.viewer = new Viewer(this,tiddler,this.fieldName,value);\n\t// Ask the viewer to create the widget element\n\tthis.viewer.render();\n};\n\nViewWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers) {\n\t// Check if any of our attributes have changed, or if a tiddler we're interested in has changed\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.format || (this.tiddlerTitle && changedTiddlers[this.tiddlerTitle])) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.generate();\n\t\tvar oldDomNode = this.renderer.domNode,\n\t\t\tnewDomNode = this.renderer.renderInDom();\n\t\toldDomNode.parentNode.replaceChild(newDomNode,oldDomNode);\n\t} else {\n\t\t// We don't need to refresh ourselves, so just refresh any child nodes\n\t\t$tw.utils.each(this.children,function(node) {\n\t\t\tif(node.refreshInDom) {\n\t\t\t\tnode.refreshInDom(changedTiddlers);\n\t\t\t}\n\t\t});\n\t}\n};\n\nViewWidget.prototype.postRenderInDom = function() {\n\tif(this.viewer && this.viewer.postRenderInDom) {\n\t\tthis.viewer.postRenderInDom();\n\t}\n};\n\nexports.view = ViewWidget;\n\n})();\n",
"title": "$:/core/modules/widgets/view.js",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/view/viewers/date.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/date.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as a date\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DateViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nDateViewer.prototype.render = function() {\n\tvar template = this.viewWidget.renderer.getAttribute(\"template\",\"DD MMM YYYY\"),\n\t\tvalue = \"\";\n\tif(this.value !== undefined) {\n\t\tvalue = $tw.utils.formatDateString(this.value,template);\n\t}\n\t// Set the element details\n\tthis.viewWidget.tag = \"span\";\n\tthis.viewWidget.attributes = {\n\t\t\"class\": \"tw-view-date\"\n\t};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: value\n\t}]);\n};\n\nexports.date = DateViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/date.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/widgets/view/viewers/htmlencoded.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/htmlencoded.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as HTML encoded text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HtmlEncodedViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nHtmlEncodedViewer.prototype.render = function() {\n\t// Get the value as a string\n\tif(this.field !== \"text\" && this.tiddler) {\n\t\tthis.value = this.tiddler.getFieldString(this.field);\n\t}\n\tvar value = \"\";\n\tif(this.value !== undefined && this.value !== null) {\n\t\tvalue = this.value;\n\t}\n\t// Set the element details\n\tthis.viewWidget.tag = \"span\";\n\tthis.viewWidget.attributes = {\n\t\t\"class\": \"tw-view-htmlencoded\"\n\t};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: $tw.utils.htmlEncode(value)\n\t}]);\n};\n\nexports.htmlencoded = HtmlEncodedViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/htmlencoded.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/widgets/view/viewers/htmlwikified.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/htmlwikified.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as a textual HTML representation of the wikified text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HtmlWikifiedViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nHtmlWikifiedViewer.prototype.render = function() {\n\t// Parse the field text\n\tvar wiki = this.viewWidget.renderer.renderTree.wiki,\n\t\tparser = wiki.parseText(\"text/vnd.tiddlywiki\",this.value),\n\t\trenderTree = new $tw.WikiRenderTree(parser,{wiki: wiki, parentRenderer: this.viewWidget.renderer, document: this.viewWidget.renderer.renderTree.document});\n\trenderTree.execute();\n\tvar container = this.viewWidget.renderer.renderTree.document.createElement(\"div\");\n\trenderTree.renderInDom(container)\n\tvar text = container.innerHTML;\n\t// Set the element details\n\tthis.viewWidget.tag = \"pre\";\n\tthis.viewWidget.attributes = {\n\t\t\"class\": \"tw-view-htmlwikified\"\n\t};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{\n\t\t\ttype: \"text\",\n\t\t\ttext: text\n\t\t}]);\n};\n\nexports.htmlwikified = HtmlWikifiedViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/htmlwikified.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/widgets/view/viewers/jsencoded.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/jsencoded.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as JavaScript stringified text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar JsEncodedViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nJsEncodedViewer.prototype.render = function() {\n\t// Get the value as a string\n\tif(this.field !== \"text\" && this.tiddler) {\n\t\tthis.value = this.tiddler.getFieldString(this.field);\n\t}\n\tvar value = \"\";\n\tif(this.value !== undefined && this.value !== null) {\n\t\tvalue = this.value;\n\t}\n\t// Set the element details\n\tthis.viewWidget.tag = \"pre\";\n\tthis.viewWidget.attributes = {\n\t\t\"class\": \"tw-view-jsencoded\"\n\t};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{\n\t\t\ttype: \"text\",\n\t\t\ttext: $tw.utils.stringify(value)\n\t\t}]);\n};\n\nexports.jsencoded = JsEncodedViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/jsencoded.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/widgets/view/viewers/link.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/link.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as a link\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar LinkViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nLinkViewer.prototype.render = function() {\n\tvar text = this.value === undefined ? \"\" : this.value;\n\t// Indicate that we're not generating an element\n\tthis.viewWidget.tag = this.viewWidget.renderer.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tthis.viewWidget.attributes = {\n\t\t\"class\": \"tw-view-link\"\n\t};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"$link\",\n\t\t\tattributes: {\n\t\t\t\tto: {type: \"string\", value: text}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: text\n\t\t\t}]\n\t\t}]);\n};\n\nexports.link = LinkViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/link.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/widgets/view/viewers/relativedate.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/relativedate.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as a relative date\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar RelativeDateViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nRelativeDateViewer.prototype.render = function() {\n\tvar template = this.viewWidget.renderer.getAttribute(\"template\",\"DD MMM YYYY\"),\n\t\tvalue = \"\";\n\tif(this.value !== undefined) {\n\t\tvalue = $tw.utils.formatDateString(this.value,template);\n\t}\n\t// Set the element details\n\tthis.viewWidget.tag = \"span\";\n\tthis.viewWidget.attributes = {\n\t\t\"class\": \"tw-view-date\"\n\t};\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{\n\t\ttype: \"text\",\n\t\ttext: value\n\t}]);\n};\n\n/*\nTrigger the timer when the relative date is put into the DOM\n*/\nRelativeDateViewer.prototype.postRenderInDom = function() {\n\tthis.update();\n};\n\n/*\nTrigger the timer for the next update of the relative date\n*/\nRelativeDateViewer.prototype.setTimer = function() {\n\tvar self = this;\n\tif(this.relativeDate.updatePeriod < 24 * 60 * 60 * 1000) {\n\t\twindow.setTimeout(function() {\n\t\t\t// Only call the update function if the dom node is still in the document\n\t\t\tif($tw.utils.domContains(self.viewWidget.renderer.renderTree.document,self.viewWidget.renderer.domNode)) {\n\t\t\t\tself.update.call(self);\n\t\t\t}\n\t\t},this.relativeDate.updatePeriod);\n\t}\n};\n\n/*\nUpdate the relative date display, and trigger the timer for the next update\n*/\nRelativeDateViewer.prototype.update = function() {\n\tthis.relativeDate = $tw.utils.getRelativeDate((new Date()) - this.value);\n\tif(this.relativeDate.delta > 0) {\n\t\twhile(this.viewWidget.renderer.domNode.hasChildNodes()) {\n\t\t\tthis.viewWidget.renderer.domNode.removeChild(this.viewWidget.renderer.domNode.firstChild);\n\t\t}\n\t\tthis.viewWidget.renderer.domNode.appendChild(this.viewWidget.renderer.renderTree.document.createTextNode(this.relativeDate.description));\n\t\tthis.setTimer();\n\t}\n};\n\nexports.relativedate = RelativeDateViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/relativedate.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/widgets/view/viewers/wikified.js": {
"text": "/*\\\ntitle: $:/core/modules/widgets/view/viewers/wikified.js\ntype: application/javascript\nmodule-type: fieldviewer\n\nA viewer for viewing tiddler fields as wikified text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar WikifiedViewer = function(viewWidget,tiddler,field,value) {\n\tthis.viewWidget = viewWidget;\n\tthis.tiddler = tiddler;\n\tthis.field = field;\n\tthis.value = value;\n};\n\nWikifiedViewer.prototype.render = function() {\n\t// Set the element details\n\tthis.viewWidget.tag = this.viewWidget.renderer.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tthis.viewWidget.attributes = {};\n\tvar node = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"$transclude\",\n\t\t\tattributes: {\n\t\t\t\t\"class\": \"tw-view-wikified\",\n\t\t\t\tfield: {type: \"string\", value: this.field}\n\t\t\t},\n\t\t\tisBlock: this.viewWidget.renderer.parseTreeNode.isBlock\n\t\t};\n\tif(this.tiddler && this.tiddler.fields.title) {\n\t\tnode.attributes.target = {type: \"string\", value: this.tiddler.fields.title}\n\t}\n\tthis.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[node]);\n};\n\nexports.wikified = WikifiedViewer;\n\n})();\n",
"title": "$:/core/modules/widgets/view/viewers/wikified.js",
"type": "application/javascript",
"module-type": "fieldviewer"
},
"$:/core/modules/wiki.js": {
"text": "/*\\\ntitle: $:/core/modules/wiki.js\ntype: application/javascript\nmodule-type: wikimethod\n\nExtension methods for the $tw.Wiki object\n\nAdds the following properties to the wiki object:\n\n* `eventListeners` is a hashmap by type of arrays of listener functions\n* `changedTiddlers` is a hashmap describing changes to named tiddlers since wiki change events were\nlast dispatched. Each entry is a hashmap containing two fields:\n\tmodified: true/false\n\tdeleted: true/false\n* `changeCount` is a hashmap by tiddler title containing a numerical index that starts at zero and is\n\tincremented each time a tiddler is created changed or deleted\n* `caches` is a hashmap by tiddler title containing a further hashmap of named cache objects. Caches\n\tare automatically cleared when a tiddler is modified or deleted\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nGet the value of a text reference. Text references can have any of these forms:\n\t<tiddlertitle>\n\t<tiddlertitle>!!<fieldname>\n\t!!<fieldname> - specifies a field of the current tiddlers\n\t<tiddlertitle>##<index>\n*/\nexports.getTextReference = function(textRef,defaultText,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle = tr.title || currTiddlerTitle;\n\tif(tr.field) {\n\t\tvar tiddler = this.getTiddler(title);\n\t\tif(tr.field === \"title\") { // Special case so we can return the title of a non-existent tiddler\n\t\t\treturn title;\n\t\t} else if(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\treturn tiddler.getFieldString(tr.field);\n\t\t} else {\n\t\t\treturn defaultText;\n\t\t}\n\t} else if(tr.index) {\n\t\treturn this.extractTiddlerDataItem(title,tr.index,defaultText);\n\t} else {\n\t\treturn this.getTiddlerText(title,defaultText);\n\t}\n};\n\nexports.setTextReference = function(textRef,value,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle,tiddler,fields;\n\t// Check if it is a reference to a tiddler\n\tif(tr.title && !tr.field) {\n\t\ttiddler = this.getTiddler(tr.title);\n\t\tthis.addTiddler(new $tw.Tiddler(tiddler,{title: tr.title,text: value}));\n\t// Else check for a field reference\n\t} else if(tr.field) {\n\t\ttitle = tr.title || currTiddlerTitle;\n\t\ttiddler = this.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tfields = {};\n\t\t\tfields[tr.field] = value;\n\t\t\tthis.addTiddler(new $tw.Tiddler(tiddler,fields));\n\t\t}\n\t}\n};\n\nexports.deleteTextReference = function(textRef,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle,tiddler,fields;\n\t// Check if it is a reference to a tiddler\n\tif(tr.title && !tr.field) {\n\t\tthis.deleteTiddler(tr.title);\n\t// Else check for a field reference\n\t} else if(tr.field) {\n\t\ttitle = tr.title || currTiddlerTitle;\n\t\ttiddler = this.getTiddler(title);\n\t\tif(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\tfields = {};\n\t\t\tfields[tr.field] = undefined;\n\t\t\tthis.addTiddler(new $tw.Tiddler(tiddler,fields));\n\t\t}\n\t}\n};\n\nexports.addEventListener = function(type,listener) {\n\tthis.eventListeners = this.eventListeners || {};\n\tthis.eventListeners[type] = this.eventListeners[type] || [];\n\tthis.eventListeners[type].push(listener);\t\n};\n\nexports.removeEventListener = function(type,listener) {\n\tvar listeners = this.eventListeners[type];\n\tif(listeners) {\n\t\tvar p = listeners.indexOf(listener);\n\t\tif(p !== -1) {\n\t\t\tlisteners.splice(p,1);\n\t\t}\n\t}\n};\n\nexports.dispatchEvent = function(type /*, args */) {\n\tvar args = Array.prototype.slice.call(arguments,1),\n\t\tlisteners = this.eventListeners[type];\n\tif(listeners) {\n\t\tfor(var p=0; p<listeners.length; p++) {\n\t\t\tvar listener = listeners[p];\n\t\t\tlistener.apply(listener,args);\n\t\t}\n\t}\n};\n\n/*\nCauses a tiddler to be marked as changed, incrementing the change count, and triggers event handlers.\nThis method should be called after the changes it describes have been made to the wiki.tiddlers[] array.\n\ttitle: Title of tiddler\n\tisDeleted: defaults to false (meaning the tiddler has been created or modified),\n\t\ttrue if the tiddler has been created\n*/\nexports.enqueueTiddlerEvent = function(title,isDeleted) {\n\t// Record the touch in the list of changed tiddlers\n\tthis.changedTiddlers = this.changedTiddlers || {};\n\tthis.changedTiddlers[title] = this.changedTiddlers[title] || {};\n\tthis.changedTiddlers[title][isDeleted ? \"deleted\" : \"modified\"] = true;\n\t// Increment the change count\n\tthis.changeCount = this.changeCount || {};\n\tif($tw.utils.hop(this.changeCount,title)) {\n\t\tthis.changeCount[title]++;\n\t} else {\n\t\tthis.changeCount[title] = 1;\n\t}\n\t// Trigger events\n\tthis.eventListeners = this.eventListeners || [];\n\tif(!this.eventsTriggered) {\n\t\tvar self = this;\n\t\t$tw.utils.nextTick(function() {\n\t\t\tvar changes = self.changedTiddlers;\n\t\t\tself.changedTiddlers = {};\n\t\t\tself.eventsTriggered = false;\n\t\t\tself.dispatchEvent(\"change\",changes);\n\t\t});\n\t\tthis.eventsTriggered = true;\n\t}\n};\n\nexports.getChangeCount = function(title) {\n\tthis.changeCount = this.changeCount || {};\n\tif($tw.utils.hop(this.changeCount,title)) {\n\t\treturn this.changeCount[title];\n\t} else {\n\t\treturn 0;\n\t}\n};\n\nexports.deleteTiddler = function(title) {\n\tdelete this.tiddlers[title];\n\tthis.clearCache(title);\n\tthis.enqueueTiddlerEvent(title,true);\n};\n\nexports.tiddlerExists = function(title) {\n\treturn !!this.tiddlers[title];\n};\n\nexports.isSystemTiddler = function(title) {\n\treturn title.indexOf(\"$:/\") === 0;\n};\n\nexports.isTemporaryTiddler = function(title) {\n\treturn title.indexOf(\"$:/temp/\") === 0;\n};\n\n/*\nDetermines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler\n*/\nexports.isShadowTiddler = function(title) {\n\treturn $tw.utils.hop(this.shadowTiddlers,title);\n};\n\nexports.addTiddler = function(tiddler) {\n\t// Check if we're passed a fields hashmap instead of a tiddler\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\ttiddler = new $tw.Tiddler(tiddler);\n\t}\n\t// Get the title\n\tvar title = tiddler.fields.title;\n\t// Save the tiddler\n\tthis.tiddlers[title] = tiddler;\n\tthis.clearCache(title);\n\tthis.enqueueTiddlerEvent(title);\n};\n\n/*\nReturn a sorted array of non-system tiddler titles, optionally filtered by a tag \n*/\nexports.getTiddlers = function(sortField,excludeTag) {\n\tsortField = sortField || \"title\";\n\tvar tiddlers = [], t, titles = [];\n\tfor(t in this.tiddlers) {\n\t\tif($tw.utils.hop(this.tiddlers,t) && !this.isSystemTiddler(t) && (!excludeTag || !this.tiddlers[t].hasTag(excludeTag))) {\n\t\t\ttiddlers.push(this.tiddlers[t]);\n\t\t}\n\t}\n\ttiddlers.sort(function(a,b) {\n\t\tvar aa = a.fields[sortField].toLowerCase() || \"\",\n\t\t\tbb = b.fields[sortField].toLowerCase() || \"\";\n\t\tif(aa < bb) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(aa > bb) {\n\t\t\t\treturn 1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n\tfor(t=0; t<tiddlers.length; t++) {\n\t\ttitles.push(tiddlers[t].fields.title);\n\t}\n\treturn titles;\n};\n\nexports.countTiddlers = function(excludeTag) {\n\tvar tiddlers = this.getTiddlers(null,excludeTag);\n\treturn $tw.utils.count(tiddlers);\n};\n\n/*\nSort an array of tiddler titles by a specified field\n\ttitles: array of titles (sorted in place)\n\tsortField: name of field to sort by\n\tisDescending: true if the sort should be descending\n\tisCaseSensitive: true if the sort should consider upper and lower case letters to be different\n*/\nexports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive) {\n\tvar self = this;\n\ttitles.sort(function(a,b) {\n\t\tif(sortField !== \"title\") {\n\t\t\ta = self.getTiddler(a).fields[sortField] || \"\";\n\t\t\tb = self.getTiddler(b).fields[sortField] || \"\";\n\t\t}\n\t\tif(!isCaseSensitive) {\n\t\t\tif(typeof a === \"string\") {\n\t\t\t\ta = a.toLowerCase();\n\t\t\t}\n\t\t\tif(typeof b === \"string\") {\n\t\t\t\tb = b.toLowerCase();\n\t\t\t}\n\t\t}\n\t\tif(a < b) {\n\t\t\treturn isDescending ? +1 : -1;\n\t\t} else {\n\t\t\tif(a > b) {\n\t\t\t\treturn isDescending ? -1 : +1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n};\n\nexports.forEachTiddler = function(/* [sortField,[excludeTag,]]callback */) {\n\tvar arg = 0,\n\t\tsortField = arguments.length > 1 ? arguments[arg++] : null,\n\t\texcludeTag = arguments.length > 2 ? arguments[arg++] : null,\n\t\tcallback = arguments[arg++],\n\t\ttitles = this.getTiddlers(sortField,excludeTag),\n\t\tt, tiddler;\n\tfor(t=0; t<titles.length; t++) {\n\t\ttiddler = this.tiddlers[titles[t]];\n\t\tif(tiddler) {\n\t\t\tcallback.call(this,tiddler.fields.title,tiddler);\n\t\t}\n\t}\n};\n\n/*\nReturn an array of tiddler titles that are directly linked from the specified tiddler\n*/\nexports.getTiddlerLinks = function(title) {\n\tvar self = this;\n\t// We'll cache the links so they only get computed if the tiddler changes\n\treturn this.getCacheForTiddler(title,\"links\",function() {\n\t\t// Parse the tiddler\n\t\tvar parser = self.parseTiddler(title);\n\t\t// Count up the links\n\t\tvar links = [],\n\t\t\tcheckParseTree = function(parseTree) {\n\t\t\t\tfor(var t=0; t<parseTree.length; t++) {\n\t\t\t\t\tvar parseTreeNode = parseTree[t];\n\t\t\t\t\tif(parseTreeNode.type === \"element\" && parseTreeNode.tag === \"$link\" && parseTreeNode.attributes.to.type === \"string\") {\n\t\t\t\t\t\tvar value = parseTreeNode.attributes.to.value;\n\t\t\t\t\t\tif(links.indexOf(value) === -1) {\n\t\t\t\t\t\t\tlinks.push(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(parseTreeNode.children) {\n\t\t\t\t\t\tcheckParseTree(parseTreeNode.children);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\tif(parser) {\n\t\t\tcheckParseTree(parser.tree);\n\t\t}\n\t\treturn links;\n\t});\n};\n\n/*\nReturn an array of tiddler titles that link to the specified tiddler\n*/\nexports.getTiddlerBacklinks = function(targetTitle) {\n\tvar self = this,\n\t\tbacklinks = [];\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\tif(links.indexOf(targetTitle) !== -1) {\n\t\t\tbacklinks.push(title);\n\t\t}\n\t});\n\treturn backlinks;\n};\n\n/*\nReturn a hashmap of tiddler titles that are referenced but not defined. Each value is the number of times the missing tiddler is referenced\n*/\nexports.getMissingTitles = function() {\n\tvar self = this,\n\t\tmissing = [];\n// We should cache the missing tiddler list, even if we recreate it every time any tiddler is modified\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\t$tw.utils.each(links,function(link) {\n\t\t\tif((!self.tiddlerExists(link) && !self.isShadowTiddler(link)) && missing.indexOf(link) === -1) {\n\t\t\t\tmissing.push(link);\n\t\t\t}\n\t\t});\n\t});\n\treturn missing;\n};\n\nexports.getOrphanTitles = function() {\n\tvar self = this,\n\t\torphans = this.getTiddlers();\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\t$tw.utils.each(links,function(link) {\n\t\t\tvar p = orphans.indexOf(link);\n\t\t\tif(p !== -1) {\n\t\t\t\torphans.splice(p,1);\n\t\t\t}\n\t\t});\n\t});\n\treturn orphans; // Todo\n};\n\nexports.getSystemTitles = function() {\n\tvar titles = [];\n\tfor(var title in this.tiddlers) {\n\t\tif(this.isSystemTiddler(title)) {\n\t\t\ttitles.push(title);\n\t\t}\n\t}\n\ttitles.sort();\n\treturn titles;\n};\n\nexports.getShadowTitles = function() {\n\tvar titles = [];\n\tfor(var title in this.shadowTiddlers) {\n\t\ttitles.push(title);\n\t}\n\ttitles.sort();\n\treturn titles;\n};\n\n/*\nRetrieves a list of the tiddler titles that are tagged with a given tag\n*/\nexports.getTiddlersWithTag = function(tag) {\n\tvar titles = [];\n\tfor(var title in this.tiddlers) {\n\t\tvar tiddler = this.tiddlers[title];\n\t\tif(tiddler.fields.tags && tiddler.fields.tags.indexOf(tag) !== -1) {\n\t\t\ttitles.push(title);\n\t\t}\n\t}\n\treturn titles;\n};\n\n/*\nRetrieve a tiddler as a JSON string of the fields\n*/\nexports.getTiddlerAsJson = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\tvar fields = {};\n\t\t$tw.utils.each(tiddler.fields,function(value,name) {\n\t\t\tfields[name] = tiddler.getFieldString(name);\n\t\t});\n\t\treturn JSON.stringify(fields);\n\t} else {\n\t\treturn JSON.stringify({title: title});\n\t}\n};\n\n/*\nGet a tiddlers content as a JavaScript object. How this is done depends on the type of the tiddler:\n\napplication/json: the tiddler JSON is parsed into an object\napplication/x-tiddler-dictionary: the tiddler is parsed as sequence of name:value pairs\n\nOther types currently just return null.\n*/\nexports.getTiddlerData = function(title,defaultData) {\n\tvar tiddler = this.getTiddler(title),\n\t\tdata;\n\tif(tiddler && tiddler.fields.text) {\n\t\tswitch(tiddler.fields.type) {\n\t\t\tcase \"application/json\":\n\t\t\t\t// JSON tiddler\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(tiddler.fields.text);\n\t\t\t\t} catch(ex) {\n\t\t\t\t\treturn defaultData;\n\t\t\t\t}\n\t\t\t\treturn data;\n\t\t\tcase \"application/x-tiddler-dictionary\":\n\t\t\t\treturn $tw.utils.parseFields(tiddler.fields.text);\n\t\t}\n\t}\n\treturn defaultData;\n};\n\n/*\nExtract an indexed field from within a data tiddler\n*/\nexports.extractTiddlerDataItem = function(title,index,defaultText) {\n\tvar data = this.getTiddlerData(title,{}),\n\t\ttext;\n\tif(data && $tw.utils.hop(data,index)) {\n\t\ttext = data[index];\n\t}\n\tif(typeof text === \"string\" || typeof text === \"number\") {\n\t\treturn text.toString();\n\t} else {\n\t\treturn defaultText;\n\t}\n};\n\n/*\nSet a tiddlers content to a JavaScript object. Currently this is done by setting the tiddler's type to \"application/json\" and setting the text to the JSON text of the data.\n*/\nexports.setTiddlerData = function(title,data) {\n\tvar tiddler = this.getTiddler(title);\n\tthis.addTiddler(new $tw.Tiddler(tiddler,{title: title, type: \"application/json\", text: JSON.stringify(data,null,$tw.config.preferences.jsonSpaces)}));\n};\n\n/*\nReturn the content of a tiddler as an array containing each line\n*/\nexports.getTiddlerList = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler && tiddler.fields.text && tiddler.fields.text.length > 0) {\n\t\treturn tiddler.fields.text.split(\"\\n\");\n\t}\n\treturn [];\n};\n\n// Return the named cache object for a tiddler. If the cache doesn't exist then the initializer function is invoked to create it\nexports.getCacheForTiddler = function(title,cacheName,initializer) {\n\tthis.caches = this.caches || {};\n\tvar caches = this.caches[title];\n\tif(caches && caches[cacheName]) {\n\t\treturn caches[cacheName];\n\t} else {\n\t\tif(!caches) {\n\t\t\tcaches = {};\n\t\t\tthis.caches[title] = caches;\n\t\t}\n\t\tcaches[cacheName] = initializer();\n\t\treturn caches[cacheName];\n\t}\n};\n\n// Clear all caches associated with a particular tiddler\nexports.clearCache = function(title) {\n\tthis.caches = this.caches || {};\n\tif($tw.utils.hop(this.caches,title)) {\n\t\tdelete this.caches[title];\n\t}\n};\n\nexports.initParsers = function(moduleType) {\n\t// Install the parser modules\n\t$tw.Wiki.parsers = {};\n\tvar self = this;\n\t$tw.modules.forEachModuleOfType(\"parser\",function(title,module) {\n\t\tfor(var f in module) {\n\t\t\tif($tw.utils.hop(module,f)) {\n\t\t\t\t$tw.Wiki.parsers[f] = module[f]; // Store the parser class\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nParse a block of text of a specified MIME type\n\ttype: content type of text to be parsed\n\ttext: text\n\toptions: see below\nOptions include:\n\tparseAsInline: if true, the text of the tiddler will be parsed as an inline run\n*/\nexports.parseText = function(type,text,options) {\n\toptions = options || {};\n\t// Select a parser\n\tvar Parser = $tw.Wiki.parsers[type];\n\tif(!Parser && $tw.config.fileExtensionInfo[type]) {\n\t\tParser = $tw.Wiki.parsers[$tw.config.fileExtensionInfo[type].type];\n\t}\n\tif(!Parser) {\n\t\tParser = $tw.Wiki.parsers[options.defaultType || \"text/vnd.tiddlywiki\"];\n\t}\n\tif(!Parser) {\n\t\treturn null;\n\t}\n\t// Return the parser instance\n\treturn new Parser(type,text,{\n\t\tparseAsInline: options.parseAsInline,\n\t\twiki: this\n\t});\n};\n\n/*\nParse a tiddler according to its MIME type\n*/\nexports.parseTiddler = function(title,options) {\n\toptions = options || {};\n\tvar cacheType = options.parseAsInline ? \"newInlineParseTree\" : \"newBlockParseTree\",\n\t\ttiddler = this.getTiddler(title),\n\t\tself = this;\n\treturn tiddler ? this.getCacheForTiddler(title,cacheType,function() {\n\t\t\treturn self.parseText(tiddler.fields.type,tiddler.fields.text,options);\n\t\t}) : null;\n};\n\n/*\nParse text in a specified format and render it into another format\n\toutputType: content type for the output\n\ttextType: content type of the input text\n\ttext: input text\n*/\nexports.renderText = function(outputType,textType,text,context) {\n\tvar parser = this.parseText(textType,text),\n\t\trenderTree = new $tw.WikiRenderTree(parser,{wiki: this, context: context, document: $tw.document});\n\trenderTree.execute();\n\tvar container = $tw.document.createElement(\"div\");\n\trenderTree.renderInDom(container)\n\treturn outputType === \"text/html\" ? container.innerHTML : container.textContent;\n};\n\n/*\nParse text from a tiddler and render it into another format\n\toutputType: content type for the output\n\ttitle: title of the tiddler to be rendered\n*/\nexports.renderTiddler = function(outputType,title,context) {\n\tvar parser = this.parseTiddler(title),\n\t\trenderTree = new $tw.WikiRenderTree(parser,{wiki: this, context: context, document: $tw.document});\n\trenderTree.execute();\n\tvar container = $tw.document.createElement(\"div\");\n\trenderTree.renderInDom(container)\n\treturn outputType === \"text/html\" ? container.innerHTML : container.textContent;\n};\n\n/*\nSelect the appropriate saver modules and set them up\n*/\nexports.initSavers = function(moduleType) {\n\tmoduleType = moduleType || \"saver\";\n\t// Instantiate the available savers\n\tthis.savers = [];\n\tvar self = this;\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tif(module.canSave(self)) {\n\t\t\tself.savers.push(module.create(self));\n\t\t}\n\t});\n\t// Sort the savers into priority order\n\tthis.savers.sort(function(a,b) {\n\t\tif(a.info.priority < b.info.priority) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(a.info.priority > b.info.priority) {\n\t\t\t\treturn +1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nInvoke the highest priority saver that successfully handles a method\n*/\nexports.callSaver = function(method /*, args */ ) {\n\tfor(var t=this.savers.length-1; t>=0; t--) {\n\t\tvar saver = this.savers[t];\n\t\tif(saver[method].apply(saver,Array.prototype.slice.call(arguments,1))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/*\nSave the wiki contents. Options are:\n\ttemplate: the tiddler containing the template to save\n\tdownloadType: the content type for the saved file\n*/\nexports.saveWiki = function(options) {\n\toptions = options || {};\n\tvar template = options.template || \"$:/core/templates/tiddlywiki5.template.html\",\n\t\tdownloadType = options.downloadType || \"text/plain\";\n\tvar text = this.renderTiddler(downloadType,template);\n\tthis.callSaver(\"save\",text,function(err) {\n\t\t$tw.notifier.display(\"$:/messages/Saved\");\n\t});\n};\n\n/*\nReturn an array of tiddler titles that match a search string\n\ttext: The text string to search for\n\toptions: see below\nOptions available:\n\ttitles: Hashmap or array of tiddler titles to limit search\n\texclude: An array of tiddler titles to exclude from the search\n\tinvert: If true returns tiddlers that do not contain the specified string\n\tcaseSensitive: If true forces a case sensitive search\n\tliteral: If true, searches for literal string, rather than separate search terms\n*/\nexports.search = function(text,options) {\n\toptions = options || {};\n\tvar self = this,t;\n\t// Convert the search string into a regexp for each term\n\tvar terms, searchTermsRegExps,\n\t\tflags = options.caseSensitive ? \"\" : \"i\";\n\tif(options.literal) {\n\t\tif(text.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tsearchTermsRegExps = [new RegExp(\"(\" + $tw.utils.escapeRegExp(text) + \")\",flags)];\n\t} else {\n\t\tterms = text.replace(/( +)/g,\" \").split(\" \");\n\t\tsearchTermsRegExps = [];\n\t\tif(terms.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tfor(t=0; t<terms.length; t++) {\n\t\t\tsearchTermsRegExps.push(new RegExp(\"(\" + $tw.utils.escapeRegExp(terms[t]) + \")\",flags));\n\t\t}\n\t}\n\t// Function to check a given tiddler for the search term\n\tvar searchTiddler = function(title) {\n\t\tvar tiddler = self.getTiddler(title);\n\t\tif(!tiddler) {\n\t\t\treturn !!options.invert;\n\t\t}\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type];\n\t\tif(contentTypeInfo ? contentTypeInfo.encoding === \"utf8\" : true) {\n\t\t\tvar match = true;\n\t\t\tfor(var t=0; t<searchTermsRegExps.length; t++) {\n\t\t\t\t// Search title and body\n\t\t\t\tif(match) {\n\t\t\t\t\tmatch = searchTermsRegExps[t].test(tiddler.fields.title) || searchTermsRegExps[t].test(tiddler.fields.text);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn options.invert ? !match : match;\n\t\t}\n\t\treturn false;\t\t\t\n\t};\n\t// Loop through all the tiddlers doing the search\n\tvar results = [];\n\tif($tw.utils.isArray(options.titles)) {\n\t\tfor(t=0; t<options.titles.length; t++) {\n\t\t\tif(searchTiddler(options.titles[t])) {\n\t\t\t\tresults.push(options.titles[t]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tvar source = options.titles || this.tiddlers;\n\t\tfor(t in source) {\n\t\t\tif(searchTiddler(t)) {\n\t\t\t\tresults.push(t);\n\t\t\t}\n\t\t}\n\t}\n\t// Remove any of the results we have to exclude\n\tif(options.exclude) {\n\t\tfor(t=0; t<options.exclude.length; t++) {\n\t\t\tvar p = results.indexOf(options.exclude[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tresults.splice(p,1);\n\t\t\t}\n\t\t}\n\t}\n\treturn results;\n};\n\n/*\nTrigger a load for a tiddler if it is skinny. Returns the text, or undefined if the tiddler is missing, null if the tiddler is being lazily loaded.\n*/\nexports.getTiddlerText = function(title,defaultText) {\n\tvar tiddler = this.getTiddler(title);\n\t// Return undefined if the tiddler isn't found\n\tif(!tiddler) {\n\t\treturn defaultText;\n\t}\n\tif(tiddler.fields.text !== undefined) {\n\t\t// Just return the text if we've got it\n\t\treturn tiddler.fields.text;\n\t} else {\n\t\t// Tell any listeners about the need to lazily load this tiddler\n\t\tthis.dispatchEvent(\"lazyLoad\",title);\n\t\t// Indicate that the text is being loaded\n\t\treturn null;\n\t}\n};\n\n})();\n",
"title": "$:/core/modules/wiki.js",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/core/templates/css-tiddler": {
"title": "$:/core/templates/css-tiddler",
"text": "<!--\n\nThis template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields.\n\n-->`<style`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/css\">`<$view field=\"text\" format=\"text\" />`</style>`"
},
"$:/core/templates/html-div-tiddler": {
"title": "$:/core/templates/html-div-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.\n\n-->`<div`<$fields template=' $name$=\"$encoded_value$\"'></$fields>`>\n<pre>`<$view field=\"text\" format=\"htmlencoded\" />`</pre>\n</div>`\n"
},
"$:/core/templates/html-tiddler": {
"title": "$:/core/templates/html-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as raw HTML\n\n--><$view field=\"text\" format=\"htmlwikified\" />"
},
"$:/core/templates/javascript-tiddler": {
"title": "$:/core/templates/javascript-tiddler",
"text": "<!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields.\n\n-->`<script`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/javascript\">`<$view field=\"text\" format=\"text\" />`</script>`"
},
"$:/core/templates/module-tiddler": {
"title": "$:/core/templates/module-tiddler",
"text": "<!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. The body of the tiddler is wrapped in a call to the `$tw.modules.define` function in order to define the body of the tiddler as a module\n\n-->`<script`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/javascript\" data-module=\"yes\">$tw.modules.define(\"`<$view field=\"title\" format=\"jsencoded\" />`\",\"`<$view field=\"module-type\" format=\"jsencoded\" />`\",function(module,exports,require) {`<$view field=\"text\" format=\"text\" />`});\n</script>`"
},
"$:/core/templates/plain-text-tiddler": {
"title": "$:/core/templates/plain-text-tiddler",
"text": "<$view field=\"text\" format=\"text\" />"
},
"$:/core/templates/static.content": {
"title": "$:/core/templates/static.content",
"type": "text/vnd.tiddlywiki",
"text": "<!-- For Google, and people without JavaScript-->\n<$list filter=\"[!is[system]sort[title]]\" >\n<$view field=\"title\" format=\"text\"></$view>\n</$list>\n"
},
"$:/core/templates/static.template.css": {
"title": "$:/core/templates/static.template.css",
"text": "{{{ [is[system]type[text/css]] ||$:/core/templates/plain-text-tiddler}}}\n{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}\n"
},
"$:/core/templates/static.template.html": {
"title": "$:/core/templates/static.template.html",
"type": "text/vnd.tiddlywiki-html",
"text": "\\define tw-wikilink-template() static/$uri_doubleencoded$.html\n\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"format-detection\" content=\"telephone=no\">\n<title>{{$:/core/wiki/title}}</title>\n<div id=\"styleArea\">\n{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}\n</div>\n<style type=\"text/css\">\n{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}\n</style>\n</head>\n<body>\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n{{$:/core/ui/PageTemplate||$:/core/templates/html-tiddler}}\n</body>\n</html>\n"
},
"$:/core/templates/static.tiddler.html": {
"title": "$:/core/templates/static.tiddler.html",
"text": "\\define tw-wikilink-template() $uri_doubleencoded$.html\n`<!doctype html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"`{{$:/core/templates/version}}`\" />\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link rel=\"stylesheet\" href=\"static.css\">\n<title>`{{$:/core/wiki/title}}`</title>\n</head>\n<body>\n`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`\n<section class=\"story-river\">\n<div class=\"tw-tiddler-frame\">\n`<$view tiddler=\"$:/core/ui/ViewTemplate\" format=\"htmlwikified\"/>`\n</div>\n</section>\n</body>\n</html>\n`"
},
"$:/core/templates/store.area.template.html": {
"title": "$:/core/templates/store.area.template.html",
"text": "<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n`<div id=\"storeArea\" style=\"display:none;\">`\n{{{ [!is[system]] ||$:/core/templates/html-div-tiddler}}}\n`</div>`\n</$reveal>\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\n`<!------------- Encrypted tiddlers --------->`\n`<pre id=\"encryptedStoreArea\" type=\"text/plain\" style=\"display:none;\">`\n<$encrypt filter=\"[!is[system]]\"/>\n`</pre>`\n</$reveal>"
},
"$:/core/templates/tid-tiddler": {
"title": "$:/core/templates/tid-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers in TiddlyWeb *.tid format\n\n--><$fields exclude='text bag' template='$name$: $value$\n'></$fields>`\n`<$view field=\"text\" format=\"text\" />"
},
"$:/core/templates/tiddler-metadata": {
"title": "$:/core/templates/tiddler-metadata",
"text": "<!--\n\nThis template is used for saving tiddler metadata *.meta files\n\n--><$fields exclude='text bag' template='$name$: $value$\n'></$fields>"
},
"$:/core/templates/tiddlywiki5.template.html": {
"title": "$:/core/templates/tiddlywiki5.template.html",
"text": "\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"application-name\" content=\"TiddlyWiki\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"format-detection\" content=\"telephone=no\">\n<meta name=\"copyright\" content=\"{{$:/core/copyright.txt}}\" />\n<title>{{$:/core/wiki/title}}</title>\n<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->\n\n<!----------- Raw markup ----------->\n{{{ [tag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}}\n</head>\n<body>\n<!----------- Static styles ----------->\n<div id=\"styleArea\">\n{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}\n</div>\n<!----------- Static content for Google and browsers without JavaScript ----------->\n<noscript>\n<div id=\"splashArea\">\n{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}\n</div>\n</noscript>\n<!----------- Miscellaneous system tiddlers ----------->\n<div id=\"systemArea\" style=\"display:none;\">\n{{{ [is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] ||$:/core/templates/html-div-tiddler}}}\n</div>\n<!----------- Ordinary tiddlers ----------->\n{{$:/core/templates/store.area.template.html}}\n<!----------- Library modules ----------->\n<div id=\"libraryModules\" style=\"display:none;\">\n{{$:/core/lib/jquery.min.js||$:/core/templates/javascript-tiddler}}\n{{{ [is[system]type[application/javascript]library[yes]] -[[$:/core/lib/jquery.min.js]] ||$:/core/templates/javascript-tiddler}}}\n</div>\n<!----------- Boot kernel prologue ----------->\n<div id=\"bootKernelPrefix\" style=\"display:none;\">\n{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}\n</div>\n<!----------- Plugin modules ----------->\n<div id=\"modules\" style=\"display:none;\">\n{{{ [is[system]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}\n</div>\n<!----------- Boot kernel ----------->\n<div id=\"bootKernel\" style=\"display:none;\">\n{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}\n</div>\n</body>\n</html>\n"
},
"$:/core/templates/version": {
"title": "$:/core/templates/version",
"text": "<$version/>"
},
"$:/core/templates/wikified-tiddler": {
"title": "$:/core/templates/wikified-tiddler",
"text": "<$view field=\"text\" format=\"wikified\" />"
},
"$:/core/ui/EditTemplate": {
"title": "$:/core/ui/EditTemplate",
"modifier": "JeremyRuston",
"text": "<span class=\"tw-tiddler-controls title\"> <$button message=\"tw-delete-tiddler\" class=\"btn-invisible\">{{$:/core/images/delete-button}}</$button> <$button message=\"tw-cancel-tiddler\" class=\"btn-invisible\">{{$:/core/images/cancel-button}}</$button> <$button message=\"tw-save-tiddler\" class=\"btn-invisible\">{{$:/core/images/done-button}}</$button> </span>\n\n<$view field=\"title\"/>\n\n@@.title\n<$edit field=\"draft.title\"/>\n@@\n\n<$transclude template=\"$:/core/ui/TagsEditor\"/>\n\n<$reveal state=\"$:/ShowEditPreview\" type=\"match\" text=\"yes\">\n<$transclude template=\"$:/core/ui/EditorHint\"/> <$button type=\"set\" set=\"$:/ShowEditPreview\" setTo=\"no\">hide preview</$button>\n<div class=\"tw-tiddler-preview\">\n<div class=\"tw-tiddler-preview-preview\">\n<$view field=\"text\" format=\"wikified\"/>\n</div>\n<div class=\"tw-tiddler-preview-edit\">\n<$edit field=\"text\"/>\n</div>\n</div>\n</$reveal>\n<$reveal state=\"$:/ShowEditPreview\" type=\"nomatch\" text=\"yes\">\n<$transclude template=\"$:/core/ui/EditorHint\"/> <$button type=\"set\" set=\"$:/ShowEditPreview\" setTo=\"yes\">show preview</$button>\n<$edit field=\"text\"/>\n</$reveal>\n\n<$transclude template=\"$:/core/ui/FieldEditor\"/>\n"
},
"$:/core/ui/EditorHint": {
"title": "$:/core/ui/EditorHint",
"text": "<span class=\"tw-tiddler-help\">Use WikiText to add formatting, images, and dynamic features</span>"
},
"$:/core/ui/FieldEditor": {
"title": "$:/core/ui/FieldEditor",
"text": "<$fieldmangler><div class=\"tw-edit-fields\"><$fieldlist exclude=\"title tags text modified modifier draft.title draft.of\"><div class=\"tw-edit-field\"><span class=\"tw-edit-field-name\"><$info type=\"currentField\"/>:</span> <span class=\"tw-edit-field-value\"><$edit placeholder=\"field value\"/></span> <span class=\"tw-edit-field-remove\"><$button message=\"tw-remove-field\" class=\"btn-invisible\">{{$:/core/images/delete-button}}</$button></span></div>\n</$fieldlist>\n</div>\n\n<div class=\"tw-edit-field-add\">Add a new field: <span class=\"tw-edit-field-add-name\"><$edit tiddler=\"$:/NewFieldName\" type=\"input\" default=\"\" placeholder=\"field name\"/></span> <span class=\"tw-edit-field-add-button\"><$button message=\"tw-add-field\" param={{$:/NewFieldName}} set=\"$:/NewFieldName\" setTo=\"\" class=\"\">add</$button></span></div>\n\n</$fieldmangler>\n"
},
"$:/core/ui/MissingTemplate": {
"title": "$:/core/ui/MissingTemplate",
"text": "<$button popup=\"$:/state/missingpopup\" qualifyTiddlerTitles=\"yes\" class=\"btn-invisible tw-missing-tiddler-label\"><$view field=\"title\" format=\"text\" /></$button>\n<$reveal state=\"$:/state/missingpopup\" type=\"popup\" position=\"below\" qualifyTiddlerTitles=\"yes\" ><div class=\"tw-drop-down\">\n<$view field=\"title\" format=\"link\" />\n----\n<$list filter=\"[is[current]backlinks[]sort[title]]\">\n<$view field=\"title\" format=\"link\" />\n</$list>\n</div></$reveal>\n"
},
"$:/core/ui/MoreSideBar": {
"title": "$:/core/ui/MoreSideBar",
"text": "<div class=\"tw-tab-set tw-more-sidebar\"><div class=\"tw-tab-buttons\">\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"allTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">All</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"recentTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Recent</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"tagsTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Tags</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"missingTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Missing</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"draftsTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Drafts</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"orphanTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Orphans</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"typeTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Types</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"systemTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">System</$button>\n\n<$button type=\"set\" set=\"$:/state/moreSideBarTabSet\" setTo=\"shadowsTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Shadows</$button>\n\n</div><div class=\"tw-tab-content\">\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"allTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[!is[system]sort[title]]\" itemClass=\"tw-menu-list-item\"/>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"recentTab\" qualifyTiddlerTitles=\"yes\">\n{{$:/snippets/recentchanges}}\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"tagsTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[tags[]sort[title]]\" itemClass=\"tw-menu-list-item\" template=\"$:/core/ui/TagTemplate\"/>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"missingTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[is[missing]sort[title]]\" itemClass=\"tw-menu-list-item\" template=\"$:/core/ui/MissingTemplate\"/>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"draftsTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[has[draft.of]sort[title]]\" itemClass=\"tw-menu-list-item\" />\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"orphanTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[is[orphan]sort[title]]\" itemClass=\"tw-menu-list-item\"/>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"typeTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[!is[system]has[type]each[type]sort[type]]\" itemClass=\"tw-menu-list-item\">\n<$view field=\"type\" default=\"untyped\"/>\n<$list filter=\"[type{!!type}!is[system]sort[title]]\" itemClass=\"tw-menu-list-subitem\">\n<$view field=\"title\" format=\"link\"/>\n</$list>\n</$list>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"systemTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[is[system]sort[title]]\" itemClass=\"tw-menu-list-item\"/>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/moreSideBarTabSet\" text=\"shadowsTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[is[shadow]sort[title]]\" itemClass=\"tw-menu-list-item\"/>\n</$reveal>\n</div></div>\n"
},
"$:/core/ui/PageTemplate": {
"title": "$:/core/ui/PageTemplate",
"text": "<!-- The navigator catches navigation events and updates the story and history tiddlers -->\n<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\">\n\n<$import browse=\"no\" class=\"tw-drop-zone-fullscreen\">\n\n<!-- The optional topbar -->\n{{$:/TopSideBar}}\n\n<!-- The optional leftsidebar -->\n{{$:/LeftSideBar}}\n\n<!-- The sidebar header -->\n<header class=\"sidebar-header\">\n\n<div class=\"title\">{{SiteTitle}}</div><div class=\"tw-subtitle\">{{SiteSubtitle}}</div>\n\n<div class=\"tw-page-controls\">\n<$button message=\"tw-new-tiddler\" class=\"btn-invisible\">{{$:/core/images/new-button}}</$button><$link to=\"$:/ControlPanel\">{{$:/core/images/options-button}}</$link><$button message=\"tw-save-wiki\" class=\"btn-invisible\">{{$:/core/images/save-button}}</$button>\n</div>\n\n{{$:/core/ui/SideBar}}\n\n</header>\n\n<!-- The story river -->\n<section class=\"story-river\">\n\n<!-- The main story -->\n<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" template=\"$:/core/ui/ViewTemplate\" editTemplate=\"$:/core/ui/EditTemplate\" listview={{$:/view}} itemClass=\"tw-tiddler-frame\"/>\n\n<!-- End of story river -->\n</section>\n\n</$import>\n\n</$navigator>\n\n"
},
"$:/core/ui/SideBar": {
"title": "$:/core/ui/SideBar",
"text": "<!-- The implementation of tabs here is currently a bit unreadable -->\n\n<div class=\"tw-sidebar-lists\">\n\n<$linkcatcher to=\"$:/temp/search\">\n\n<div class=\"tw-search\"><$edit tiddler=\"$:/temp/search\" type=\"search\" requireFocus=\"yes\"/><$reveal state=\"$:/temp/search\" type=\"nomatch\" text=\"\"> <$link to=\"\" class=\"btn-invisible\">{{$:/core/images/close-button}}</$link></$reveal></div>\n\n</$linkcatcher>\n\n<$reveal state=\"$:/temp/search\" type=\"nomatch\" text=\"\">\n\n<div class=\"tw-search-results\">\n\n<$list filter=\"[!is[system]search{$:/temp/search}sort[title]limit[50]]\" emptyMessage=\"//No results//\"/>\n\n</div>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/search\" type=\"match\" text=\"\">\n\n<div class=\"tw-tab-set\">\n<div class=\"tw-tab-buttons\"><$button type=\"set\" set=\"$:/state/sideBarTabSet\" setTo=\"openTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Open</$button><$button type=\"set\" set=\"$:/state/sideBarTabSet\" setTo=\"recentTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Recent</$button><$button type=\"set\" set=\"$:/state/sideBarTabSet\" setTo=\"toolsTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Tools</$button><$button type=\"set\" set=\"$:/state/sideBarTabSet\" setTo=\"moreTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">More</$button></div>\n<div class=\"tw-tab-divider tw-sidebar-tab-divider\">\n</div>\n<div class=\"tw-tab-content\">\n<$reveal type=\"match\" state=\"$:/state/sideBarTabSet\" text=\"openTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" listview=\"pop\" itemClass=\"tw-menu-list-item tw-open-tiddler-list\">\n<$button message=\"tw-close-tiddler\" class=\"btn-invisible btn-mini\">×</$button> <$view field=\"title\" format=\"link\"/>\n</$list>\n<$button message=\"tw-close-all-tiddlers\" class=\"btn-invisible btn-mini\">close all</$button>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/sideBarTabSet\" text=\"recentTab\" qualifyTiddlerTitles=\"yes\">\n{{$:/snippets/recentchanges}}\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/sideBarTabSet\" text=\"toolsTab\" qualifyTiddlerTitles=\"yes\">\n{{$:/core/ui/ToolsPanel}}\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/sideBarTabSet\" text=\"moreTab\" qualifyTiddlerTitles=\"yes\">\n{{$:/core/ui/MoreSideBar}}\n</$reveal>\n</div>\n</div>\n\n</$reveal>\n</div>\n"
},
"$:/core/ui/TagTemplate": {
"title": "$:/core/ui/TagTemplate",
"text": "<$button popup=\"$:/state/tagpopup\" qualifyTiddlerTitles=\"yes\" class=\"btn-invisible\"><$setstyle name=\"background-color\" value={{!!color}} class=\"tw-tag-label\"><$transclude target={{!!icon}}/> <$view field=\"title\" format=\"text\" /></$setstyle></$button>\n<$reveal state=\"$:/state/tagpopup\" type=\"popup\" position=\"below\" qualifyTiddlerTitles=\"yes\" ><div class=\"tw-drop-down\">\n<$view field=\"title\" format=\"link\" />\n----\n<$list filter=\"[is[current]tagging[]sort[title]]\">\n<$view field=\"title\" format=\"link\" />\n</$list>\n</div></$reveal>\n"
},
"$:/core/ui/TagsEditor": {
"title": "$:/core/ui/TagsEditor",
"text": "<$fieldmangler><div class=\"tw-edit-tags-list\"><$list filter=\"[is[current]tags[]sort[title]]\" listview=\"pop\" itemClass=\"tw-tag-editor-label\"><$setstyle name=\"background-color\" value={{!!color}} class=\"tw-tag-label\"><$view field=\"title\" format=\"text\" /><$button message=\"tw-remove-tag\" class=\"btn-invisible tw-remove-tag-button\">×</$button></$setstyle>\n</$list></div>\n\n<div class=\"tw-add-tag\">Add a new tag: <span class=\"tw-add-tag-name\"><$edit tiddler=\"$:/NewTagName\" type=\"input\" default=\"\" placeholder=\"tag name\" focusSet=\"$:/state/tagsAutoComplete\" qualifyTiddlerTitles=\"yes\"/></span> <$button popup=\"$:/state/tagsAutoComplete\" qualifyTiddlerTitles=\"yes\" class=\"btn-invisible\">{{$:/core/images/down-arrow}}</$button> <span class=\"tw-add-tag-button\"><$button message=\"tw-add-tag\" param={{$:/NewTagName}} set=\"$:/NewTagName\" setTo=\"\" class=\"\">add</$button></span></div>\n\n<div class=\"tw-tags-autocomplete-wrapper\">\n<$reveal state=\"$:/state/tagsAutoComplete\" qualifyTiddlerTitles=\"yes\" type=\"nomatch\" text=\"\" default=\"\" class=\"tw-tags-autocomplete\">\n\n<$linkcatcher set=\"$:/NewTagName\" setTo=\"\" message=\"tw-add-tag\"><$list filter=\"[!is[shadow]tags[]prefix{$:/NewTagName}sort[title]]\"><$link><$setstyle name=\"background-color\" value={{!!color}} class=\"tw-tag-label\"><$view field=\"title\" format=\"text\"/></$setstyle></$link>\n</$list>\n</$linkcatcher>\n\n</$reveal>\n</div>\n</$fieldmangler>\n"
},
"$:/core/ui/TiddlerInfo": {
"title": "$:/core/ui/TiddlerInfo",
"text": "<div class=\"tw-tab-set\"><div class=\"tw-tab-buttons\"><$button type=\"set\" set=\"$:/state/tiddlerDropDownTabSet\" setTo=\"refTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">References</$button><$button type=\"set\" set=\"$:/state/tiddlerDropDownTabSet\" setTo=\"taggingTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Tagging</$button><$button type=\"set\" set=\"$:/state/tiddlerDropDownTabSet\" setTo=\"fieldsTab\" qualifyTiddlerTitles=\"yes\" selectedClass=\"tw-tab-selected\">Fields</$button></div>\n<div class=\"tw-tab-divider\">\n</div>\n<div class=\"tw-tab-content\">\n<$reveal type=\"match\" state=\"$:/state/tiddlerDropDownTabSet\" text=\"refTab\" default=\"refTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[is[current]backlinks[]sort[title]]\" emptyMessage=\"No tiddlers link to this one\">\n</$list>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/tiddlerDropDownTabSet\" text=\"taggingTab\" qualifyTiddlerTitles=\"yes\">\n<$list filter=\"[is[current]tagging[]sort[title]]\" itemClass=\"tw-menu-list-item\" emptyMessage=\"No tiddlers are tagged with this one\"/>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/state/tiddlerDropDownTabSet\" text=\"fieldsTab\" qualifyTiddlerTitles=\"yes\">\n<$fieldgrid />\n</$reveal>\n</div>\n</div>"
},
"$:/core/ui/ToolsPanel": {
"title": "$:/core/ui/ToolsPanel",
"text": "---\n\n{{$:/snippets/viewswitcher}}\n\n---\n\n{{$:/snippets/themeswitcher}}\n\n---\n\nImport: <$import class=\"tw-drop-zone\"/>\n\n---\n\n{{$:/snippets/encryptionstatus}}\n\n"
},
"$:/core/ui/ViewTemplate": {
"title": "$:/core/ui/ViewTemplate",
"modifier": "JeremyRuston",
"text": "<div class=\"tw-tiddler-view\"><div class=\"tw-tiddler-title\"><div class=\"title\"><$setstyle name=\"fill\" value={{!!color}}><span class=\"tw-tiddler-controls\"><$button popup=\"$:/state/tiddlerInfo\" qualifyTiddlerTitles=\"yes\" class=\"btn-invisible\">{{$:/core/images/info-button}}</$button><$button message=\"tw-edit-tiddler\" class=\"btn-invisible\">{{$:/core/images/edit-button}}</$button><$button message=\"tw-close-tiddler\" class=\"btn-invisible\">{{$:/core/images/close-button}}</$button>\n\n</span><$transclude target={{!!icon}}/> <$view field=\"title\"/></$setstyle></div>\n\n<$reveal type=\"nomatch\" text=\"\" default=\"\" state=\"$:/state/tiddlerInfo\" qualifyTiddlerTitles=\"yes\" class=\"tw-tiddler-info\" animate=\"yes\">\n\n<$transclude template=\"$:/core/ui/TiddlerInfo\"/>\n\n</$reveal></div>\n\n<div class=\"tw-subtitle\"><$view field=\"modifier\" format=\"link\"/> <$view field=\"modified\" format=\"relativedate\"/></div>\n\n<div class=\"tw-tags-wrapper\"><$list filter=\"[is[current]tags[]]\" template=\"$:/core/ui/TagTemplate\" listview=\"pop\" itemClass=\"tw-tag-list-item\"/></div>\n\n<div class=\"body\">\n\t<$view field=\"text\" format=\"wikified\">\n\t</$view>\n</div></div>"
},
"$:/ControlPanel": {
"title": "$:/ControlPanel",
"text": "! Configuration tiddlers\n\n* [[Title of this TiddlyWiki|SiteTitle]]: <$edit tiddler=\"SiteTitle\" default=\"\" type=\"input\"/>\n\n* [[Subtitle|SiteSubtitle]]: <$edit tiddler=\"SiteSubtitle\" default=\"\" type=\"input\"/>\n\n* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to choose which tiddlers are displayed at startup\n\n! Import tiddlers\n\nBrowse for files on your computer to import their contents (the individual tiddlers within TiddlyWiki HTML files are imported separately).\n\n<$import class=\"tw-drop-zone\"/>\n\n! Save changes\n\n<$button message=\"tw-save-wiki\" class=\"btn btn-primary\">Save Changes</$button>\n\n! Encryption\n\nThe tiddlers in TiddlyWiki documents can be securely encrypted by specifying a password before saving changes.\n\n{{$:/snippets/encryptionstatus}}\n\n! Theme\n\n{{$:/snippets/themeswitcher}}\n\n{{$:/core/ui/ServerControlPanel}}\n"
},
"$:/DefaultTiddlers": {
"title": "$:/DefaultTiddlers",
"text": "GettingStarted"
},
"GettingStarted": {
"title": "GettingStarted",
"text": "Welcome to TiddlyWiki, the non-linear personal web notebook.\n\nTo get started, first verify that you can save changes successfully - see http://five.tiddlywiki.com/ for detailed instructions.\n\nThen you can:\n\n* Create new tiddlers using the 'plus' button in the sidebar\n* Save changes using the 'download' button in the sidebar\n* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to determine which tiddlers appear when you open this wiki\n* Edit the SiteTitle and SiteSubtitle\n"
},
"SiteSubtitle": {
"title": "SiteSubtitle",
"text": "a non-linear personal web notebook"
},
"SiteTitle": {
"title": "SiteTitle",
"text": "My ~TiddlyWiki"
},
"$:/snippets/encryptionstatus": {
"title": "$:/snippets/encryptionstatus",
"text": "<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\nThis wiki is encrypted.\n<$button message=\"tw-clear-password\" class=\"btn btn-danger\">Clear password</$button>\n<$button message=\"tw-set-password\" class=\"btn btn-warning\">Change password</$button>\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\nThis wiki is not encrypted.\n<$button message=\"tw-set-password\" class=\"btn btn-warning\">Set password</$button>\n</$reveal>"
},
"$:/state/moreSideBarTabSet-tiddlerTitle:$:/core/ui/MoreSideBar;templateTitle:$:/core/ui/MoreSideBar;-tiddlerTitle:$:/core/ui/SideBar;templateTitle:$:/core/ui/SideBar;-tiddlerTitle:$:/core/ui/PageTemplate;-": {
"title": "$:/state/moreSideBarTabSet-tiddlerTitle:$:/core/ui/MoreSideBar;templateTitle:$:/core/ui/MoreSideBar;-tiddlerTitle:$:/core/ui/SideBar;templateTitle:$:/core/ui/SideBar;-tiddlerTitle:$:/core/ui/PageTemplate;-",
"text": "tagsTab"
},
"$:/snippets/recentchanges": {
"title": "$:/snippets/recentchanges",
"text": "<$list filter=\"[has[modified]!sort[modified]limit[100]eachday[modified]]\" itemClass=\"tw-menu-list-item\">\n<$view field=\"modified\" format=\"date\" template=\"DDth MMM YYYY\"/>\n<$list filter=\"[sameday{!!modified}!sort[modified]]\" itemClass=\"tw-menu-list-subitem\">\n<$view field=\"title\" format=\"link\"/>\n</$list>\n</$list>\n"
},
"$:/temp/search": {
"title": "$:/temp/search",
"text": ""
},
"$:/state/sideBarTabSet-tiddlerTitle:$:/core/ui/SideBar;templateTitle:$:/core/ui/SideBar;-tiddlerTitle:$:/core/ui/PageTemplate;-": {
"title": "$:/state/sideBarTabSet-tiddlerTitle:$:/core/ui/SideBar;templateTitle:$:/core/ui/SideBar;-tiddlerTitle:$:/core/ui/PageTemplate;-",
"text": "openTab"
},
"$:/snippets/themeswitcher": {
"title": "$:/snippets/themeswitcher",
"text": "Current theme: {{$:/theme}}\n\n<$linkcatcher to=\"$:/theme\">\n\n<$list filter=\"[plugin-type[theme]sort[title]]\">\n\n<$reveal state=\"$:/theme\" type=\"match\" text={{!!title}}>•</$reveal><$reveal state=\"$:/theme\" type=\"nomatch\" text={{!!title}}> </$reveal> <$link to={{!!title}}>\n\n<$view field=\"name\" format=\"text\"/>\n\n</$link>\n\n</$list>\n\n</$linkcatcher>\n"
},
"$:/core/wiki/title": {
"title": "$:/core/wiki/title",
"type": "text/vnd.tiddlywiki",
"text": "{{SiteTitle}} --- {{SiteSubtitle}}"
},
"$:/view": {
"title": "$:/view",
"text": "classic"
},
"$:/snippets/viewswitcher": {
"title": "$:/snippets/viewswitcher",
"text": "Current view: {{$:/view}}\n\n<$linkcatcher to=\"$:/view\">\n\n<$list filter=\"classic zoomin\">\n\n<$reveal state=\"$:/view\" type=\"match\" text={{!!title}}>•</$reveal><$reveal state=\"$:/view\" type=\"nomatch\" text={{!!title}}> </$reveal> <$view field=\"title\" format=\"link\"/>\n\n</$list>\n\n</$linkcatcher>\n"
}
}
}