Last active
April 25, 2023 04:00
-
-
Save Jermolene/8383863 to your computer and use it in GitHub Desktop.
Unofficial build of TiddlyWiki 5.0.7-prerelease for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension --> | |
<!-- saved from url=(0021)http://tiddlywiki.com --> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Force IE standards mode for Intranet and HTA - should be the first meta --> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
<meta name="application-name" content="TiddlyWiki" /> | |
<meta name="generator" content="TiddlyWiki" /> | |
<meta name="tiddlywiki-version" content="5.0.7-prerelease" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> | |
<meta name="format-detection" content="telephone=no" /> | |
<meta name="copyright" content="TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com) | |
Copyright © Jeremy Ruston 2004-2007 | |
Copyright © UnaMesa Association 2007-2014 | |
Redistribution and use in source and binary forms, with or without modification, | |
are permitted provided that the following conditions are met: | |
Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. | |
Redistributions in binary form must reproduce the above copyright notice, this | |
list of conditions and the following disclaimer in the documentation and/or other | |
materials provided with the distribution. | |
Neither the name of the UnaMesa Association nor the names of its contributors may be | |
used to endorse or promote products derived from this software without specific | |
prior written permission. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY | |
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | |
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | |
DAMAGE. | |
" /> | |
<link id="faviconLink" rel="shortcut icon" href="favicon.ico"> | |
<title>TiddlyWiki — a non-linear personal web notebook</title> | |
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~--><!--~~ Raw markup ~~--> | |
</head> | |
<body class="tw-body"> | |
<!--~~ Static styles ~~--> | |
<div id="styleArea"> | |
<style data-tiddler-title="$:/boot/boot.css" data-tiddler-type="text/css" type="text/css">/* | |
Basic styles used before we boot up the parsing engine | |
*/ | |
/* | |
Error message and password prompt | |
*/ | |
.tw-password-wrapper, .tw-error-form { | |
font-family: sans-serif; | |
z-index: 20000; | |
position: fixed; | |
text-align: center; | |
width: 200px; | |
top: 4em; | |
left: 50%; | |
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */ | |
padding: 16px 16px 16px 16px; | |
-webkit-border-radius: 8px; | |
-moz-border-radius: 8px; | |
border-radius: 8px; | |
} | |
.tw-error-form { | |
color: #fff; | |
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); | |
background-color: rgb(255, 75, 75); | |
border: 8px solid rgb(255, 0, 0); | |
} | |
.tw-error-form div { | |
padding-bottom: 1em; | |
} | |
.tw-error-prompt { | |
color: #000; | |
text-shadow: none; | |
} | |
.tw-password-wrapper { | |
color: #000; | |
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); | |
background-color: rgb(197, 235, 183); | |
border: 8px solid rgb(164, 197, 152); | |
} | |
.tw-password-wrapper form { | |
text-align: left; | |
} | |
.tw-password-wrapper h1 { | |
font-size: 16px; | |
line-height: 20px; | |
padding-bottom: 16px; | |
} | |
</style> | |
</div> | |
<!--~~ Static content for Google and browsers without JavaScript ~~--> | |
<noscript> | |
<div id="splashArea"> | |
<div class=' tw-reveal' hidden='true'></div> | |
</div> | |
</noscript> | |
<!--~~ Ordinary tiddlers ~~--> | |
<div id="storeArea" style="display:none;"> | |
<div dependents="" description="TiddlyWiki5 core plugin" plugin-priority="0" plugin-type="plugin" title="$:/core" type="application/json" version="5.0.7-prerelease"> | |
<pre>{ | |
"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-2014\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" | |
}, | |
"$:/docs/fields/bag": { | |
"title": "$:/docs/fields/bag", | |
"text": "The name of the bag from which a tiddler came" | |
}, | |
"$:/docs/fields/color": { | |
"title": "$:/docs/fields/color", | |
"text": "The CSS color value associated with a tiddler" | |
}, | |
"$:/docs/fields/created": { | |
"title": "$:/docs/fields/created", | |
"text": "The date a tiddler was created" | |
}, | |
"$:/docs/fields/creator": { | |
"title": "$:/docs/fields/creator", | |
"text": "The name of the person who created a tiddler" | |
}, | |
"$:/docs/fields/description": { | |
"title": "$:/docs/fields/description", | |
"text": "The descriptive text for a wizard" | |
}, | |
"$:/docs/fields/draft.of": { | |
"title": "$:/docs/fields/draft.of", | |
"text": "For draft tiddlers, contains the title of the tiddler of which this is a draft" | |
}, | |
"$:/docs/fields/draft.title": { | |
"title": "$:/docs/fields/draft.title", | |
"text": "For draft tiddlers, contains the proposed new title of the tiddler" | |
}, | |
"$:/docs/fields/footer": { | |
"title": "$:/docs/fields/footer", | |
"text": "The footer text for a wizard" | |
}, | |
"$:/docs/fields/icon": { | |
"title": "$:/docs/fields/icon", | |
"text": "The title of the tiddler containing the icon associated with a tiddler" | |
}, | |
"$:/docs/fields/library": { | |
"title": "$:/docs/fields/library", | |
"text": "If set to \"yes\" indicates that a tiddler should be saved as a JavaScript library" | |
}, | |
"$:/docs/fields/list": { | |
"title": "$:/docs/fields/list", | |
"text": "An ordered list of tiddler titles associated with a tiddler" | |
}, | |
"$:/docs/fields/modified": { | |
"title": "$:/docs/fields/modified", | |
"text": "The date and time at which a tiddler was last modified" | |
}, | |
"$:/docs/fields/modifier": { | |
"title": "$:/docs/fields/modifier", | |
"text": "The tiddler title associated with the person who last modified a tiddler" | |
}, | |
"$:/docs/fields/name": { | |
"title": "$:/docs/fields/name", | |
"text": "The human readable name associated with a plugin tiddler" | |
}, | |
"$:/docs/fields/plugin-priority": { | |
"title": "$:/docs/fields/plugin-priority", | |
"text": "A numerical value indicating the priority of a plugin tiddler" | |
}, | |
"$:/docs/fields/plugin-type": { | |
"title": "$:/docs/fields/plugin-type", | |
"text": "The type of plugin in a plugin tiddler" | |
}, | |
"$:/docs/fields/revision": { | |
"title": "$:/docs/fields/revision", | |
"text": "The revision of the tiddler held at the server" | |
}, | |
"$:/docs/fields/source": { | |
"title": "$:/docs/fields/source", | |
"text": "The source URL associated with a tiddler" | |
}, | |
"$:/docs/fields/subtitle": { | |
"title": "$:/docs/fields/subtitle", | |
"text": "The subtitle text for a wizard" | |
}, | |
"$:/docs/fields/tags": { | |
"title": "$:/docs/fields/tags", | |
"text": "A list of tags associated with a tiddler" | |
}, | |
"$:/docs/fields/text": { | |
"title": "$:/docs/fields/text", | |
"text": "The body text of a tiddler" | |
}, | |
"$:/docs/fields/title": { | |
"title": "$:/docs/fields/title", | |
"text": "The unique name of a tiddler" | |
}, | |
"$:/docs/fields/type": { | |
"title": "$:/docs/fields/type", | |
"text": "The content type of a tiddler" | |
}, | |
"$:/docs/moduletypes/animation": { | |
"title": "$:/docs/moduletypes/animation", | |
"text": "Animation modules contain animations that may be used with the RevealWidget." | |
}, | |
"$:/docs/types/application/json": { | |
"title": "$:/docs/types/application/json", | |
"description": "JSON data", | |
"name": "application/json", | |
"text": "" | |
}, | |
"$:/docs/types/application/x-tiddler-dictionary": { | |
"title": "$:/docs/types/application/x-tiddler-dictionary", | |
"description": "Data dictionary", | |
"name": "application/x-tiddler-dictionary", | |
"text": "" | |
}, | |
"$:/docs/types/image/gif": { | |
"title": "$:/docs/types/image/gif", | |
"description": "GIF image", | |
"name": "image/gif", | |
"text": "" | |
}, | |
"$:/docs/types/image/jpeg": { | |
"title": "$:/docs/types/image/jpeg", | |
"description": "JPEG image", | |
"name": "image/jpeg", | |
"text": "" | |
}, | |
"$:/docs/types/image/png": { | |
"title": "$:/docs/types/image/png", | |
"description": "PNG image", | |
"name": "image/png", | |
"text": "" | |
}, | |
"$:/docs/types/image/svg+xml": { | |
"title": "$:/docs/types/image/svg+xml", | |
"description": "Structured Vector Graphics image", | |
"name": "image/svg+xml", | |
"text": "" | |
}, | |
"$:/docs/types/image/x-icon": { | |
"title": "$:/docs/types/image/x-icon", | |
"description": "ICO format icon file", | |
"name": "image/x-icon", | |
"text": "" | |
}, | |
"$:/docs/types/text/plain": { | |
"title": "$:/docs/types/text/plain", | |
"description": "Plain text", | |
"name": "text/plain", | |
"text": "" | |
}, | |
"$:/docs/types/text/vnd.tiddlywiki": { | |
"title": "$:/docs/types/text/vnd.tiddlywiki", | |
"description": "TiddlyWiki version 5 wikitext", | |
"name": "text/vnd.tiddlywiki", | |
"text": "" | |
}, | |
"$:/docs/types/text/x-tiddlywiki": { | |
"title": "$:/docs/types/text/x-tiddlywiki", | |
"description": "TiddlyWiki Classic wikitext", | |
"name": "text/x-tiddlywiki", | |
"text": "" | |
}, | |
"$:/core/images/cancel-button": { | |
"title": "$:/core/images/cancel-button", | |
"text": "<svg class=\"tw-image-cancel-button tw-image-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 tw-image-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 tw-image-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 tw-image-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 tw-image-button\" 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 tw-image-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 tw-image-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 tw-image-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 tw-image-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 tw-image-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/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" | |
}, | |
"$:/messages/StartingSave": { | |
"title": "$:/messages/StartingSave", | |
"text": "Starting to save 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/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/print.js": { | |
"text": "/*\\\ntitle: $:/core/modules/commands/print.js\ntype: application/javascript\nmodule-type: command\n\nPrint 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: \"print\",\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 print 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 print 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 print 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\tprintConfig = 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\tprintConfig(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\tprintObject = 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\tprintConfig($tw.config,\" $tw.config\");\n\tprintObject(\"Tiddler field modules:\",$tw.Tiddler.fieldModules);\n\tprintObject(\"Loaded modules:\",$tw.modules.titles);\n\tprintObject(\"Command modules:\",$tw.commands);\n\tprintObject(\"Parser modules:\",$tw.wiki.parsers);\n\tprintObject(\"Macro modules:\",$tw.wiki.macros);\n\tprintObject(\"Deserializer modules:\",$tw.Wiki.tiddlerDeserializerModules);\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n", | |
"title": "$:/core/modules/commands/print.js", | |
"type": "application/javascript", | |
"module-type": "command" | |
}, | |
"$:/core/modules/commands/rendertiddler.js": { | |
"text": "/*\\\ntitle: $:/core/modules/commands/rendertiddler.js\ntype: application/javascript\nmodule-type: command\n\nCommand to render a tiddler and save it 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: \"rendertiddler\",\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/rendertiddler.js", | |
"type": "application/javascript", | |
"module-type": "command" | |
}, | |
"$:/core/modules/commands/rendertiddlers.js": { | |
"text": "/*\\\ntitle: $:/core/modules/commands/rendertiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to render several tiddlers to a folder of files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"rendertiddlers\",\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 < 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\ttiddlers = wiki.filterTiddlers(filter);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar parser = wiki.parseTiddler(template),\n\t\t\twidgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});\n\t\tvar container = $tw.document.createElement(\"div\");\n\t\twidgetNode.render(container,null);\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/rendertiddlers.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 the content of 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\ttiddler = this.commander.wiki.getTiddler(title),\n\t\ttype = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \"utf8\"};\n\tfs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,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/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.findMatchingRoute = function(request,state) {\n\tfor(var t=0; t<this.routes.length; t++) {\n\t\tvar potentialRoute = this.routes[t],\n\t\t\tpathRegExp = potentialRoute.path,\n\t\t\tmatch = potentialRoute.path.exec(state.urlInfo.pathname);\n\t\tif(match && request.method === potentialRoute.method) {\n\t\t\tstate.params = [];\n\t\t\tfor(var p=1; p<match.length; p++) {\n\t\t\t\tstate.params.push(match[p]);\n\t\t\t}\n\t\t\treturn potentialRoute;\n\t\t}\n\t}\n\treturn null;\n};\n\nSimpleServer.prototype.checkCredentials = function(request,incomingUsername,incomingPassword) {\n\tvar header = request.headers[\"authorization\"] || \"\",\n\t\ttoken = header.split(/\\s+/).pop() || \"\",\n\t\tauth = $tw.utils.base64Decode(token),\n\t\tparts = auth.split(/:/),\n\t\tusername = parts[0],\n\t\tpassword = parts[1];\n\tif(incomingUsername === username && incomingPassword === password) {\n\t\treturn \"ALLOWED\";\n\t} else {\n\t\treturn \"DENIED\";\n\t}\n}\n\nSimpleServer.prototype.listen = function(port,host) {\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 = self.findMatchingRoute(request,state);\n\t\t// Check for the username and password if we've got one\n\t\tvar username = self.get(\"username\"),\n\t\t\tpassword = self.get(\"password\");\n\t\tif(username && password) {\n\t\t\t// Check they match\n\t\t\tif(self.checkCredentials(request,username,password) !== \"ALLOWED\") {\n\t\t\t\tresponse.writeHead(401,\"Authentication required\",{\n\t\t\t\t\t\"WWW-Authenticate\": 'Basic realm=\"Please provide your username and password to login to TiddlyWiki5\"'\n\t\t\t\t});\n\t\t\t\tresponse.end();\n\t\t\t\treturn;\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,host);\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(state.wiki.getCreationFields(),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: state.server.get(\"username\"),\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: /^\\/favicon.ico$/,\n\t\thandler: function(request,response,state) {\n\t\t\tresponse.writeHead(200, {\"Content-Type\": \"image/x-icon\"});\n\t\t\tvar buffer = state.wiki.getTiddlerText(\"$:/favicon.ico\",\"\");\n\t\t\tresponse.end(buffer,\"base64\");\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({sortField: \"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\ttiddlerFields.type = tiddlerFields.type || \"text/vnd.tiddlywiki\";\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\ttiddlerFields.type = tiddlerFields.type || \"text/vnd.tiddlywiki\";\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/save/all\",\n\t\trenderType = this.params[2] || \"text/plain\",\n\t\tserveType = this.params[3] || \"text/html\",\n\t\tusername = this.params[4],\n\t\tpassword = this.params[5],\n\t\thost = this.params[6] || \"127.0.0.1\";\n\tthis.server.set({\n\t\trootTiddler: rootTiddler,\n\t\trenderType: renderType,\n\t\tserveType: serveType,\n\t\tusername: username,\n\t\tpassword: password\n\t});\n\tthis.server.listen(port,host);\n\tconsole.log(\"Serving on \" + host + \":\" + port);\n\tconsole.log(\"(press ctrl-C to exit)\");\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.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 startRegExp = /^\\s*<div\\s+([^>]*)>(\\s*<pre>)?/gi,\n\t\tendRegExp,\n\t\tmatch = startRegExp.exec(text);\n\tif(match) {\n\t\t// Old-style DIVs don't have the <pre> tag\n\t\tif(match[2]) {\n\t\t\tendRegExp = /<\\/pre>\\s*<\\/div>\\s*$/gi;\n\t\t} else {\n\t\t\tendRegExp = /<\\/div>\\s*$/gi;\n\t\t}\n\t\tvar endMatch = endRegExp.exec(text);\n\t\tif(endMatch) {\n\t\t\t// Extract the text\n\t\t\tresult.text = text.substring(match.index + match[0].length,endMatch.index);\n\t\t\t// Process the attributes\n\t\t\tvar attrRegExp = /\\s*([^=\\s]+)\\s*=\\s*\"([^\"]*)\"/gi,\n\t\t\t\tattrMatch;\n\t\t\tdo {\n\t\t\t\tattrMatch = attrRegExp.exec(match[1]);\n\t\t\t\tif(attrMatch) {\n\t\t\t\t\tvar name = attrMatch[1];\n\t\t\t\t\tvar value = attrMatch[2];\n\t\t\t\t\tresult[name] = value;\n\t\t\t\t}\n\t\t\t} while(attrMatch);\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn undefined;\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/x-tiddlywiki` 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\t// First read the normal tiddlers\n\t\tvar results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);\n\t\t// Then any system tiddlers\n\t\tvar systemAreaMarkerRegExp = /<div id=[\"']?systemArea['\"]?( style=[\"']?display:none;[\"']?)?>/gi,\n\t\t\tsysMatch = systemAreaMarkerRegExp.exec(text);\n\t\tif(sysMatch) {\n\t\t\tresults.push.apply(results,deserializeTiddlyWikiFile(text,systemAreaMarkerRegExp.lastIndex,!!sysMatch[1],fields));\n\t\t}\n\t\treturn results\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 ? undefined : \"text/x-tiddlywiki\";\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\t$tw.utils.each(tiddlerFields,function(value,name) {\n\t\t\tif(typeof value === \"string\") {\n\t\t\t\ttiddlerFields[name] = $tw.utils.htmlDecode(value);\n\t\t\t}\n\t\t});\n\t\tif(tiddlerFields.text !== null) {\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// Function to convert a date/time to a date integer\n\tvar toDate = function(value) {\n\t\tvalue = (new Date(value)).setHours(0,0,0,0);\n\t\treturn value+0;\n\t};\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 && tiddler.fields[operator.operand]) {\n\t\t\tvar value = toDate(tiddler.fields[operator.operand]);\n\t\t\tif(values.indexOf(value) === -1) {\n\t\t\t\tvalues.push(value);\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/fields.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/fields.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the fields on 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.fields = function(source,operator,options) {\n\tvar self = this,\n\t\tresults = [];\n\t// Function to check an individual title\n\tfunction checkTiddler(title) {\n\t\t// Return the fields on the specified tiddler\n\t\tvar tiddler = options.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tfor(var fieldName in tiddler.fields) {\n\t\t\t\t$tw.utils.pushTop(results,fieldName);\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/fields.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/tiddler.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/is/tiddler.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[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.tiddler = function(source,prefix,options) {\n\tvar results = [];\n\t// Function to check a tiddler\n\tfunction checkTiddler(title) {\n\t\tvar match = options.wiki.tiddlerExists(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/tiddler.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);\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/listed.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/listed.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers that have the selected tiddlers in a list\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.listed = 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.findListingsOfTiddler(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/listed.js", | |
"type": "application/javascript", | |
"module-type": "filteroperator" | |
}, | |
"$:/core/modules/filters/modules.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/modules.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the titles of the modules of a given type in this wiki\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.modules = function(source,operator,options) {\n\tvar results = [],\n\t\tpushModules = function(type) {\n\t\t\t$tw.utils.each($tw.modules.types[type],function(moduleInfo,moduleName) {\n\t\t\t\tresults.push(moduleName);\n\t\t\t});\n\t\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\tpushModules(title);\n\t\t});\n\t} else {\n\t\t$tw.utils.each(source,function(element,title) {\n\t\t\tpushModules(title);\n\t\t});\n\t}\n\tresults.sort();\n\treturn results;\n};\n\n})();\n", | |
"title": "$:/core/modules/filters/modules.js", | |
"type": "application/javascript", | |
"module-type": "filteroperator" | |
}, | |
"$:/core/modules/filters/moduletypes.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/moduletypes.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the module types in this wiki\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.moduletypes = function(source,operator,options) {\n\tvar results = [];\n\t$tw.utils.each($tw.modules.types,function(moduleInfo,type) {\n\t\tresults.push(type);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n", | |
"title": "$:/core/modules/filters/moduletypes.js", | |
"type": "application/javascript", | |
"module-type": "filteroperator" | |
}, | |
"$:/core/modules/filters/next.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/next.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler whose title occurs next in the list supplied 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.next = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\n\tfunction checkTiddler(title) {\n\t\tvar match = list.indexOf(title);\n\t\t// increment match and then test if result is in range\n\t\tmatch++;\n\t\tif(match > 0 && match < list.length) {\n\t\t\tresults.push(list[match]);\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/next.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/previous.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/previous.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler whose title occurs immediately prior in the list supplied 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.previous = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\n\tfunction checkTiddler(title) {\n\t\tvar match = list.indexOf(title);\n\t\t// decrement match and then test if result is in range\n\t\tmatch--;\n\t\tif( match >= 0 ) {\n\t\t\tresults.push(list[match]);\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/previous.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\tisSameDay = function(dateField,dateString) {\n\t\t\tvar date1 = (new Date(dateField)).setHours(0,0,0,0),\n\t\t\t\tdate2 = (new Date($tw.utils.parseDate(dateString))).setHours(0,0,0,0);\n\t\t\treturn date1 === date2;\n\t\t};\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 = isSameDay(tiddler.fields.modified,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/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});\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 = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand,operator.prefix === \"!\",false,false);\n\treturn results;\n};\n\nexports.nsort = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand,operator.prefix === \"!\",false,true);\n\treturn results;\n};\n\nexports.sortcs = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand,operator.prefix === \"!\",true,false);\n\treturn results;\n};\n\nexports.nsortcs = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand,operator.prefix === \"!\",true,true);\n\treturn results;\n};\n\nvar prepare_results = function (source) {\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\treturn results;\n}\n\n})();\n", | |
"title": "$:/core/modules/filters/sort.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\t// Sort the results if we are matching a tag\n\tif(operator.prefix !== \"!\") {\n\t\tresults = options.wiki.sortByList(results,operator.operand);\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 the tags of 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/untagged.js": { | |
"text": "/*\\\ntitle: $:/core/modules/filters/untagged.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all the selected tiddlers that are untagged\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.untagged = 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\t\tmatch = tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0;\n\t\tif(operator.prefix !== \"!\") {\n\t\t\tmatch = !match;\n\t\t}\n\t\tif(match) {\n\t\t\t$tw.utils.pushTop(results,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/untagged.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;\n\ttry {\n\t\tfilterParseTree = this.parseFilter(filterString);\n\t} catch(e) {\n\t\treturn function(source,currTiddlerTitle) {\n\t\t\treturn [\"Filter error: \" + e];\n\t\t};\n\t}\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/macros/changecount.js": { | |
"text": "/*\\\ntitle: $:/core/modules/macros/changecount.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return the changecount for the current tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"changecount\";\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn this.wiki.getChangeCount(this.getVariable(\"currentTiddler\")) + \"\";\n};\n\n})();\n", | |
"title": "$:/core/modules/macros/changecount.js", | |
"type": "application/javascript", | |
"module-type": "macro" | |
}, | |
"$:/core/modules/macros/makedatauri.js": { | |
"text": "/*\\\ntitle: $:/core/modules/macros/makedatauri.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to convert the content of a tiddler to a data URI\n\n<<makedatauri text:\"Text to be converted\" type:\"text/vnd.tiddlywiki\">>\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"makedatauri\";\n\nexports.params = [\n\t{name: \"text\"},\n\t{name: \"type\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(text,type) {\n\ttype = type || \"text/vnd.tiddlywiki\";\n\tvar typeInfo = $tw.config.contentTypeInfo[type] || $tw.config.contentTypeInfo[\"text/plain\"],\n\t\tisBase64 = typeInfo.encoding === \"base64\",\n\t\tparts = [];\n\tparts.push(\"data:\");\n\tparts.push(type);\n\tparts.push(isBase64 ? \";base64\" : \"\");\n\tparts.push(\",\");\n\tparts.push(isBase64 ? text : encodeURIComponent(text));\n\treturn parts.join(\"\");\n};\n\n})();\n", | |
"title": "$:/core/modules/macros/makedatauri.js", | |
"type": "application/javascript", | |
"module-type": "macro" | |
}, | |
"$:/core/modules/macros/qualify.js": { | |
"text": "/*\\\ntitle: $:/core/modules/macros/qualify.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to qualify a state tiddler title according\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"qualify\";\n\nexports.params = [\n\t{name: \"title\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(title) {\n\treturn title + \"-\" + this.getStateQualifier();\n};\n\n})();\n", | |
"title": "$:/core/modules/macros/qualify.js", | |
"type": "application/javascript", | |
"module-type": "macro" | |
}, | |
"$:/core/modules/macros/version.js": { | |
"text": "/*\\\ntitle: $:/core/modules/macros/version.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return the TiddlyWiki core version number\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"version\";\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn $tw.version;\n};\n\n})();\n", | |
"title": "$:/core/modules/macros/version.js", | |
"type": "application/javascript", | |
"module-type": "macro" | |
}, | |
"$:/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;\nexports[\"image/x-icon\"] = 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/x-tiddlywiki\"] = TextParser;\nexports[\"application/javascript\"] = TextParser;\nexports[\"application/json\"] = TextParser;\nexports[\"text/css\"] = TextParser;\nexports[\"application/x-tiddler-dictionary\"] = 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\tThis is another ``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 = new RegExp(this.match[1], \"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 ? \"&ndash;\" : \"&mdash;\";\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: &copy;\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|skype):[^\\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: \"a\",\n\t\t\tattributes: {\n\t\t\t\thref: {type: \"string\", value: this.match[0]},\n\t\t\t\t\"class\": {type: \"string\", value: \"tw-tiddlylink-external\"},\n\t\t\t\ttarget: {type: \"string\", value: \"_blank\"}\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/hardlinebreaks.js": { | |
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for marking areas with hard line breaks. For example:\n\n```\n\"\"\"\nThis is some text\nThat is set like\nIt is a Poem\nWhen it is\nClearly\nNot\n\"\"\"\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"hardlinebreaks\";\nexports.types = {inline: 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\ttree = [];\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tdo {\n\t\t// Parse the run up to the terminator\n\t\ttree.push.apply(tree,this.parser.parseInlineRun(reEnd,{eatTerminator: false}));\n\t\t// Redo the terminator match\n\t\treEnd.lastIndex = this.parser.pos;\n\t\tvar match = reEnd.exec(this.parser.source);\n\t\tif(match) {\n\t\t\tthis.parser.pos = reEnd.lastIndex;\n\t\t\t// Add a line break if the terminator was a line break\n\t\t\tif(match[2]) {\n\t\t\t\ttree.push({type: \"element\", tag: \"br\"});\n\t\t\t}\n\t\t}\n\t} while(match && !match[1]);\n\t// Return the nodes\n\treturn tree;\n};\n\n})();\n", | |
"title": "$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.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 && this.isLegalTag(tag.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\nexports.isLegalTag = function(tag) {\n\t// If it starts with a $ then we'll let anything go\n\tif(tag.charAt(0) === \"$\") {\n\t\treturn true;\n\t// If it starts with a dash then it's not legal\n\t} else if(tag.charAt(0) === \"-\") {\n\t\treturn false;\n\t} else {\n\t\t// Otherwise it's OK\n\t\treturn true;\n\t}\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\t\">\": {listTag: \"blockquote\", itemTag: \"p\"}\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*)((?:[^>]|(?:>(?!>)))*?)>>(?:\\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\nvar isLinkExternal = function(to) {\n\tvar externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\\s'\"]+(?:\\/|\\b)/i;\n\treturn externalRegExp.test(to);\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\tif(isLinkExternal(link)) {\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tattributes: {\n\t\t\t\thref: {type: \"string\", value: link},\n\t\t\t\t\"class\": {type: \"string\", value: \"tw-tiddlylink-external\"},\n\t\t\t\ttarget: {type: \"string\", value: \"_blank\"}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: text\n\t\t\t}]\n\t\t}];\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: link}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: text\n\t\t\t}]\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/quoteblock.js": { | |
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/quoteblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for quote blocks. For example:\n\n```\n\t<<<.optionalClass(es) optional cited from\n\ta quote\n\t<<<\n\t\n\t<<<.optionalClass(es)\n\ta quote\n\t<<< optional cited from\n```\n\nQuotes can be quoted by putting more <s\n\n```\n\t<<<\n\tQuote Level 1\n\t\n\t<<<<\n\tQuoteLevel 2\n\t<<<<\n\t\n\t<<<\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"quoteblock\";\nexports.types = {block: 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\tvar classes = [\"tw-quote\"];\n\t// Get all the details of the match\n\tvar reEndString = \"^\" + this.match[1] + \"(?!<)\";\n\t// Move past the <s\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t\n\t// Parse any classes, whitespace and then the optional cite itself\n\tclasses.push.apply(classes, this.parser.parseClasses());\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar cite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\n\t// before handling the cite, parse the body of the quote\n\tvar tree= this.parser.parseBlocks(reEndString);\n\t// If we got a cite, put it before the text\n\tif(cite.length > 0) {\n\t\ttree.unshift({\n\t\t\ttype: \"element\",\n\t\t\ttag: \"cite\",\n\t\t\tchildren: cite\n\t\t});\n\t}\n\n\t// Parse any optional cite\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar cite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// If we got a cite, push it\n\tif(cite.length > 0) {\n\t\ttree.push({\n\t\t\ttype: \"element\",\n\t\t\ttag: \"cite\",\n\t\t\tchildren: cite\n\t\t});\n\t}\n\n\t// Return the blockquote element\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"blockquote\",\n\t\tattributes: {\n\t\t\tclass: { type: \"string\", value: classes.join(\" \") },\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n\n})();\n", | |
"title": "$:/core/modules/parsers/wikiparser/rules/quoteblock.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\tvar vAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,\"valign\",\"center\");\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"valign\",vAlign);\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[1] === \"<\" && prevCell) {\n\t\t\tcolSpanCount = 1 + $tw.utils.getAttributeValueFromParseTreeNode(prevCell,\"colspan\",1);\n\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\"colspan\",colSpanCount);\n\t\t\tcolSpanCount = 1;\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\tif(prevCell.attributes && prevCell.attributes && prevCell.attributes.colspan) {\n\t\t\t\t\t\tcolSpanCount += prevCell.attributes.colspan.value;\n\t\t\t\t} else {\n\t\t\t\t\tcolSpanCount -= 1;\n\t\t\t\t}\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\tvar vAlign = null;\n\t\t\tif(chr === \"^\") {\n\t\t\t\tvAlign = \"top\";\n\t\t\t} else if(chr === \",\") {\n\t\t\t\tvAlign = \"bottom\";\n\t\t\t}\n\t\t\tif(vAlign) {\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\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(vAlign) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"valign\",vAlign);\n\t\t\t}\n\t\t\tif(this.parser.source.substr(this.parser.pos - 2,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||TemplateTitle}}\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 = /\\{\\{([^\\{\\}\\|]+)(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}(?:\\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\ttemplate = $tw.utils.trim(this.match[2]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"$transclude\",\n\t\t\tattributes: {},\n\t\t\tisBlock: true\n\t\t};\n\tvar tiddlerNode = {\n\t\ttype: \"element\",\n\t\ttag: \"$tiddler\",\n\t\tattributes: {\n\t\t\ttiddler: {type: \"string\", value: targetTitle}\n\t\t},\n\t\tisBlock: true,\n\t\tchildren: [transcludeNode]\n\t};\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: template};\n\t} else {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: targetTitle};\n\t\tif(targetField) {\n\t\t\ttranscludeNode.attributes.field = {type: \"string\", value: targetField};\n\t\t}\n\t\tif(targetIndex) {\n\t\t\ttranscludeNode.attributes.index = {type: \"string\", value: targetIndex};\n\t\t}\n\t}\n\treturn [tiddlerNode];\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||TemplateTitle}}\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 = /\\{\\{([^\\{\\}\\|]+)(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}/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\ttemplate = $tw.utils.trim(this.match[2]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"$transclude\",\n\t\t\tattributes: {}\n\t\t};\n\tvar tiddlerNode = {\n\t\ttype: \"element\",\n\t\ttag: \"$tiddler\",\n\t\tattributes: {\n\t\t\ttiddler: {type: \"string\", value: targetTitle}\n\t\t},\n\t\tchildren: [transcludeNode]\n\t};\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: template};\n\t} else {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: targetTitle};\n\t\tif(targetField) {\n\t\t\ttranscludeNode.attributes.field = {type: \"string\", value: targetField};\n\t\t}\n\t\tif(targetIndex) {\n\t\t\ttranscludeNode.attributes.index = {type: \"string\", value: targetIndex};\n\t\t}\n\t}\n\treturn [tiddlerNode];\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\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\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 widgetNode = this.parser.wiki.makeWidget(parser),\n\t\t\tcontainer = $tw.document.createElement(\"div\");\n\t\twidgetNode.render(container,null);\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: \"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/savers/andtidwiki.js": { | |
"text": "/*\\\ntitle: $:/core/modules/savers/andtidwiki.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the AndTidWiki Android 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 AndTidWiki = function(wiki) {\n};\n\nAndTidWiki.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = decodeURIComponent(document.location.toString());\n\t// Strip the file://\n\tif(pathname.indexOf(\"file://\") === 0) {\n\t\tpathname = pathname.substr(7);\n\t}\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// Save the file\n\twindow.twi.saveFile(pathname,text)\n\t// Call the callback\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nAndTidWiki.prototype.info = {\n\tname: \"andtidwiki\",\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 !!window.twi && !!window.twi.saveFile;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new AndTidWiki(wiki);\n};\n\n})();\n", | |
"title": "$:/core/modules/savers/andtidwiki.js", | |
"type": "application/javascript", | |
"module-type": "saver" | |
}, | |
"$:/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,method,callback) {\n\t// Get the current filename\n\tvar filename = \"tiddlywiki.html\",\n\t\tp = document.location.pathname.lastIndexOf(\"/\");\n\tif(p !== -1) {\n\t\tfilename = document.location.pathname.substr(p+1);\n\t}\n\t// Set up the link\n\tvar link = document.createElement(\"a\");\n\tlink.setAttribute(\"target\",\"_blank\");\n\tif(Blob !== undefined) {\n\t\tvar blob = new Blob([text], {type: \"text/html\"});\n\t\tlink.setAttribute(\"href\", URL.createObjectURL(blob));\n\t} else {\n\t\tlink.setAttribute(\"href\",\"data:text/html,\" + encodeURIComponent(text));\n\t}\n\tlink.setAttribute(\"download\",filename);\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/fsosaver.js": { | |
"text": "/*\\\ntitle: $:/core/modules/savers/fsosaver.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via MS FileSystemObject ActiveXObject\n\nNote: Since TiddlyWiki's markup contains the MOTW, the FileSystemObject normally won't be available. \nHowever, if the wiki is loaded as an .HTA file (Windows HTML Applications) then the FSO can be used.\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 FSOSaver = function(wiki) {\n};\n\nFSOSaver.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = unescape(document.location.pathname);\n\t// Test for a Windows path of the form /x:\\blah...\n\tif(/^\\/[A-Z]\\:\\\\[^\\\\]+/i.test(pathname)) {\t// ie: ^/[a-z]:/[^/]+\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t} else if(document.location.hostname !== \"\" && /^\\/\\\\[^\\\\]+\\\\[^\\\\]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t\t// reconstruct UNC path\n\t\tpathname = \"\\\\\\\\\" + document.location.hostname + pathname;\n\t} else return false;\n\t\n\t// Save the file (as UTF-16)\n\tvar fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n\tvar file = fso.OpenTextFile(pathname,2,-1,-1);\n\t\n\tfile.Write(text);\n\tfile.Close();\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nFSOSaver.prototype.info = {\n\tname: \"FSOSaver\",\n\tpriority: 120\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\ttry {\n\t\treturn (window.location.protocol === \"file:\") && !!(new ActiveXObject(\"Scripting.FileSystemObject\"));\n\t} catch(e) { return false; }\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new FSOSaver(wiki);\n};\n\n})();\n", | |
"title": "$:/core/modules/savers/fsosaver.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,method,callback) {\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/msdownload.js": { | |
"text": "/*\\\ntitle: $:/core/modules/savers/msdownload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via window.navigator.msSaveBlob()\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 MsDownloadSaver = function(wiki) {\n};\n\nMsDownloadSaver.prototype.save = function(text,method,callback) {\n\t// Get the current filename\n\tvar filename = \"tiddlywiki.html\",\n\t\tp = document.location.pathname.lastIndexOf(\"/\");\n\tif(p !== -1) {\n\t\tfilename = document.location.pathname.substr(p+1);\n\t}\n\t// Set up the link\n\tvar blob = new Blob([text], {type: \"text/html\"});\n\twindow.navigator.msSaveBlob(blob,filename);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nMsDownloadSaver.prototype.info = {\n\tname: \"msdownload\",\n\tpriority: 110\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.navigator.msSaveBlob;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new MsDownloadSaver(wiki);\n};\n\n})();\n", | |
"title": "$:/core/modules/savers/msdownload.js", | |
"type": "application/javascript", | |
"module-type": "saver" | |
}, | |
"$:/core/modules/savers/nodewebkit.js": { | |
"text": "/*\\\ntitle: $:/core/modules/savers/nodewebkit.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes in the node-webkit environment\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar NodeWebKitSaver = function(wiki) {\n};\n\nNodeWebKitSaver.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = document.location.pathname;\n\t// Test for a Windows path of the form /x:/blah/blah\n\tif(/^\\/[A-Z]\\:\\//i.test(pathname)) {\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t\t// Convert slashes to backslashes\n\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t}\n\t// Try to save\n\tvar fs = require(\"fs\");\n\tfs.writeFile(pathname,text,callback);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nNodeWebKitSaver.prototype.info = {\n\tname: \"nodewebkit\",\n\tpriority: 1700\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\t// Check if we're running under node-webkit\n\treturn (typeof process == \"object\")\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new NodeWebKitSaver(wiki);\n};\n\n})();\n", | |
"title": "$:/core/modules/savers/nodewebkit.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,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\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]\\:\\//i.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/tiddlyie.js": { | |
"text": "/*\\\ntitle: $:/core/modules/savers/tiddlyie.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via Internet Explorer BHO extenion (TiddlyIE)\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 TiddlyIESaver = function(wiki) {\n};\n\nTiddlyIESaver.prototype.save = function(text,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\n\t// check existence of TiddlyIE BHO extension (note: only works after document is complete)\n\tif(typeof(window.TiddlyIE) != \"undefined\") {\n\t\t// Get the pathname of this document\n\t\tvar pathname = unescape(document.location.pathname);\n\t\t// Test for a Windows path of the form /x:/blah...\n\t\tif(/^\\/[A-Z]\\:\\/[^\\/]+/i.test(pathname)) {\t// ie: ^/[a-z]:/[^/]+ (is this better?: ^/[a-z]:/[^/]+(/[^/]+)*\\.[^/]+ )\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} else if(document.hostname !== \"\" && /^\\/[^\\/]+\\/[^\\/]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t\t\t// reconstruct UNC path\n\t\t\tpathname = \"\\\\\\\\\" + document.location.hostname + pathname;\n\t\t} else return false;\n\t\t\n\t\t// Prompt the user to save the file\n\t\twindow.TiddlyIE.save(pathname, text);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nInformation about this saver\n*/\nTiddlyIESaver.prototype.info = {\n\tname: \"tiddlyiesaver\",\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 TiddlyIESaver(wiki);\n};\n\n})();\n", | |
"title": "$:/core/modules/savers/tiddlyie.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,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\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,method,callback) {\n\t// Bail out unless this is a save (rather than a download)\n\tif(method !== \"save\") {\n\t\treturn false;\n\t}\n\t// Get the various parameters we need\n\tvar backupDir = this.wiki.getTextReference(\"$:/UploadBackupDir\") || \".\",\n\t\tusername = this.wiki.getTextReference(\"$:/UploadName\"),\n\t\tpassword = $tw.utils.getPassword(\"upload\"),\n\t\tuploadDir = this.wiki.getTextReference(\"$:/UploadDir\") || \".\",\n\t\tuploadFilename = this.wiki.getTextReference(\"$:/UploadFilename\") || \"index.html\",\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=\\\"\" + uploadFilename + \"\\\"\");\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\tif(http.responseText.substr(0,4) === \"0 - \") {\n\t\t\t\tcallback(null);\n\t\t\t} else {\n\t\t\t\tcallback(http.responseText);\n\t\t\t}\n\t\t}\n\t};\n\thttp.send(data);\n\t$tw.notifier.display(\"$:/messages/StartingSave\");\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\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\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$tw.macros = $tw.modules.getModulesByTypeAsHashmap(\"macro\");\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: \"\", list: story},$tw.wiki.getModificationFields());\n\t// Host-specific startup\n\tif($tw.browser) {\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 animator\n\t\t$tw.anim = new $tw.utils.Animator();\n\t\t// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers\n\t\t$tw.rootWidget = new widget.widget({\n\t\t\ttype: \"widget\",\n\t\t\tchildren: []\n\t\t},{\n\t\t\twiki: $tw.wiki,\n\t\t\tdocument: document\n\t\t});\n\t\t// Install the modal message mechanism\n\t\t$tw.modal = new $tw.utils.Modal($tw.wiki);\n\t\t$tw.rootWidget.addEventListener(\"tw-modal\",function(event) {\n\t\t\t$tw.modal.display(event.param);\n\t\t});\n\t\t// Install the notification mechanism\n\t\t$tw.notifier = new $tw.utils.Notifier($tw.wiki);\n\t\t$tw.rootWidget.addEventListener(\"tw-notify\",function(event) {\n\t\t\t$tw.notifier.display(event.param);\n\t\t});\n\t\t// Install the scroller\n\t\t$tw.pageScroller = new $tw.utils.PageScroller();\n\t\t$tw.rootWidget.addEventListener(\"tw-scroll\",function(event) {\n\t\t\t$tw.pageScroller.handleEvent(event);\n\t\t});\n\t\t// Install the save action handler\n\t\t$tw.wiki.initSavers();\n\t\t$tw.rootWidget.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});\n\t\t$tw.rootWidget.addEventListener(\"tw-download-file\",function(event) {\n\t\t\t$tw.wiki.saveWiki({\n\t\t\t\tmethod: \"download\",\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \"text/plain\"\n\t\t\t});\n\t\t});\n\t\t// Install the crypto event handlers\n\t\t$tw.rootWidget.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\t$tw.rootWidget.addEventListener(\"tw-clear-password\",function(event) {\n\t\t\t$tw.crypto.setPassword(null);\n\t\t});\n\t\t// Set up the favicon\n\t\tvar faviconTitle = \"$:/favicon.ico\",\n\t\t\tfaviconLink = document.getElementById(\"faviconLink\"),\n\t\t\tsetFavicon = function() {\n\t\t\t\tvar tiddler = $tw.wiki.getTiddler(faviconTitle);\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tfaviconLink.setAttribute(\"href\",\"data:\" + tiddler.fields.type + \";base64,\" + tiddler.fields.text);\n\t\t\t\t}\n\t\t\t};\n\t\tsetFavicon();\n\t\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t\tif($tw.utils.hop(changes,faviconTitle)) {\n\t\t\t\tsetFavicon();\n\t\t\t}\n\t\t});\n\t\t// Set up the styles\n\t\tvar styleTemplateTitle = \"$:/core/ui/PageStylesheet\",\n\t\t\tstyleParser = $tw.wiki.parseTiddler(styleTemplateTitle);\n\t\t$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.document});\n\t\t$tw.styleContainer = $tw.document.createElement(\"style\");\n\t\t$tw.styleWidgetNode.render($tw.styleContainer,null);\n\t\t$tw.styleElement = document.createElement(\"style\");\n\t\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\t\tdocument.head.insertBefore($tw.styleElement,document.head.firstChild);\n\t\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t\tif($tw.styleWidgetNode.refresh(changes,$tw.styleContainer,null)) {\n\t\t\t\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\t\t\t}\n\t\t});\n\t\t// Display the PageMacros, which includes the PageTemplate\n\t\tvar templateTitle = \"$:/core/ui/PageMacros\",\n\t\t\tparser = $tw.wiki.parseTiddler(templateTitle);\n\t\t$tw.pageWidgetNode = $tw.wiki.makeWidget(parser,{document: document, parentWidget: $tw.rootWidget});\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\t$tw.pageWidgetNode.render($tw.pageContainer,null);\n\t\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t\t$tw.pageWidgetNode.refresh(changes,$tw.pageContainer,null);\n\t\t});\n\t\t// Fix up the link between the root widget and the page container\n\t\t$tw.rootWidget.domNodes = [$tw.pageContainer];\n\t\t$tw.rootWidget.children = [$tw.pageWidgetNode];\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}\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} 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/storyviews/classic.js": { | |
"text": "/*\\\ntitle: $:/core/modules/storyviews/classic.js\ntype: application/javascript\nmodule-type: storyview\n\nViews the story as a linear sequence\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ClassicStoryView = function(listWidget) {\n\tthis.listWidget = listWidget;\n}\n\nClassicStoryView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \"tw-scroll\", target: targetElement});\n};\n\nClassicStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Get the current height of the tiddler\n\tvar computedStyle = window.getComputedStyle(targetElement),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.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},duration);\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 \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nClassicStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Get the current height of the tiddler\n\tvar currWidth = targetElement.offsetWidth,\n\t\tcomputedStyle = window.getComputedStyle(targetElement),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t// Remove the dom nodes of the widget at the end of the transition\n\tsetTimeout(function() {\n\t\twidget.removeChildDomNodes();\n\t},duration);\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\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms 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};\n\nexports.classic = ClassicStoryView;\n\n})();", | |
"title": "$:/core/modules/storyviews/classic.js", | |
"type": "application/javascript", | |
"module-type": "storyview" | |
}, | |
"$:/core/modules/storyviews/pop.js": { | |
"text": "/*\\\ntitle: $:/core/modules/storyviews/pop.js\ntype: application/javascript\nmodule-type: storyview\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 PopStoryView = function(listWidget) {\n\tthis.listWidget = listWidget;\n}\n\nPopStoryView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \"tw-scroll\", target: targetElement});\n};\n\nPopStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\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},duration);\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\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nPopStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Remove the element at the end of the transition\n\tsetTimeout(function() {\n\t\tif(targetElement.parentNode) {\n\t\t\twidget.removeChildDomNodes();\n\t\t}\n\t},duration);\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\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{transform: \"scale(0.1)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n};\n\nexports.pop = PopStoryView;\n\n})();\n", | |
"title": "$:/core/modules/storyviews/pop.js", | |
"type": "application/javascript", | |
"module-type": "storyview" | |
}, | |
"$:/core/modules/storyviews/zoomin.js": { | |
"text": "/*\\\ntitle: $:/core/modules/storyviews/zoomin.js\ntype: application/javascript\nmodule-type: storyview\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\tvar self = this;\n\tthis.listWidget = listWidget;\n\t// Make all the tiddlers position absolute, and hide all but the first one\n\t$tw.utils.each(this.listWidget.children,function(itemWidget,index) {\n\t\tvar domNode = itemWidget.findFirstDomNode();\n\t\tif(index) {\n\t\t\tdomNode.style.display = \"none\";\n\t\t} else {\n\t\t\tself.currentTiddlerDomNode = domNode;\n\t\t}\n\t\tdomNode.style.position = \"absolute\";\n\t});\n}\n\nZoominListView.prototype.navigateTo = function(historyInfo) {\n\tvar duration = $tw.utils.getAnimationDuration(),\n\t\tlistElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\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 titleDomNode = findTitleDomNode(listItemWidget) || listItemWidget.findFirstDomNode(),\n\t\tzoomBounds = titleDomNode.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.currentTiddlerDomNode;\n\tthis.currentTiddlerDomNode = targetElement;\n\t// Transform the target tiddler to its natural size\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in, opacity \" + duration + \"ms 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 !== targetElement) {\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,[\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in, opacity \" + duration + \"ms 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.currentTiddlerDomNode !== prevCurrentTiddler) {\n\t\t\t\tprevCurrentTiddler.style.display = \"none\";\n\t\t\t}\n\t\t},duration);\n\t}\n\t// Scroll the target into view\n//\t$tw.pageScroller.scrollIntoView(targetElement);\n};\n\n/*\nFind the first child DOM node of a widget that has the class \"title\"\n*/\nfunction findTitleDomNode(widget,targetClass) {\n\ttargetClass = targetClass || \"title\";\n\tvar domNode = widget.findFirstDomNode();\n\tif(domNode && domNode.querySelector) {\n\t\treturn domNode.querySelector(\".\" + targetClass);\n\t}\n\treturn null;\n}\n\nZoominListView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode();\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.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Set up the tiddler that is being closed\n\t$tw.utils.setStyle(targetElement,[\n\t\t{position: \"absolute\"},\n\t\t{display: \"block\"},\n\t\t{transformOrigin: \"50% 50%\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{transition: \"none\"},\n\t\t{zIndex: \"0\"}\n\t]);\n\t// We'll move back to the previous or next element in the story\n\tvar toWidget = widget.previousSibling();\n\tif(!toWidget) {\n\t\ttoWidget = widget.nextSibling();\n\t}\n\tvar toWidgetDomNode = toWidget && toWidget.findFirstDomNode();\n\t// Set up the tiddler we're moving back in\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{position: \"absolute\"},\n\t\t\t{display: \"block\"},\n\t\t\t{transformOrigin: \"50% 50%\"},\n\t\t\t{transform: \"translateX(0px) translateY(0px) scale(10)\"},\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in, opacity \" + duration + \"ms ease-in\"},\n\t\t\t{opacity: \"0\"},\n\t\t\t{zIndex: \"500\"}\n\t\t]);\n\t\tthis.currentTiddlerDomNode = toWidgetDomNode;\n\t}\n\t// Animate them both\n\t// Force layout\n\t$tw.utils.forceLayout(this.listWidget.parentDomNode);\n\t// First, the tiddler we're closing\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transformOrigin: \"50% 50%\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(0.1)\"},\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in, opacity \" + duration + \"ms ease-in\"},\n\t\t{opacity: \"0\"},\n\t\t{zIndex: \"0\"}\n\t]);\n\tsetTimeout(function() {\n\t\t// Delete the DOM node when the transition is over\n\t\twidget.removeChildDomNodes();\n\t},duration);\n\t// Now the tiddler we're going back to\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t\t{opacity: \"1\"}\n\t\t]);\n\t}\n\treturn true; // Indicate that we'll delete the DOM node\n};\n\nexports.zoomin = ZoominListView;\n\n})();", | |
"title": "$:/core/modules/storyviews/zoomin.js", | |
"type": "application/javascript", | |
"module-type": "storyview" | |
}, | |
"$:/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({includeSystem: true},function(title,tiddler) {\n\t\tself.tiddlerInfo[title] = {\n\t\t\trevision: tiddler.fields[\"revision\"],\n\t\t\tadaptorInfo: self.syncadaptor.getTiddlerInfo(tiddler),\n\t\t\tchangeCount: self.wiki.getChangeCount(title)\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\tif(err) {\n\t\t\t\t\tconsole.log(\"Sync error while processing '\" + task.title + \"':\\n\" + err);\n\t\t\t\t}\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\tif(tiddler) {\n\t\t\tthis.syncadaptor.saveTiddler(tiddler,function(err,adaptorInfo,revision) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\t// Adjust the info stored about this tiddler\n\t\t\t\tself.tiddlerInfo[task.title] = {\n\t\t\t\t\tchangeCount: changeCount,\n\t\t\t\t\tadaptorInfo: adaptorInfo,\n\t\t\t\t\trevision: revision\n\t\t\t\t};\n\t\t\t\t// Invoke the callback\n\t\t\t\tcallback(null);\n\t\t\t});\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\tif(tiddlerFields) {\n\t\t\t\tself.storeTiddler(tiddlerFields);\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 === \"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_PLUGINS = [\n\t\t\"$:/themes/tiddlywiki/snowwhite\",\n\t\t\"$:/themes/tiddlywiki/vanilla\"\n\t];\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);\n\t// If it doesn't exist, then fallback to one of the default themes\n\tvar index = 0;\n\twhile(!this.wiki.getTiddler(themePluginTitle) && index < DEFAULT_THEME_PLUGINS.length) {\n\t\tthemePluginTitle = DEFAULT_THEME_PLUGINS[index++];\n\t}\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\tdependents = $tw.utils.parseStringArray(tiddler.fields.dependents || \"\");\n\t\t\t\t$tw.utils.each(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-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\toptions = options || {};\n\tvar duration = options.duration || $tw.utils.getAnimationDuration();\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},duration);\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 \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"height \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms 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\toptions = options || {};\n\tvar duration = options.duration || $tw.utils.getAnimationDuration(),\n\t\tcurrHeight = 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},duration);\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 \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"height \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms 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\tif(!chosenAnimation) {\n\t\tchosenAnimation = function(domNode,options) {\n\t\t\tif(options.callback) {\n\t\t\t\toptions.callback();\n\t\t\t}\n\t\t};\n\t}\n\t// Call the animation\n\tchosenAnimation(domNode,options);\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\tif(element.nodeType === 1) { // Element.ELEMENT_NODE\n\t\tfor(var t=0; t<styles.length; t++) {\n\t\t\tfor(var styleName in styles[t]) {\n\t\t\t\telement.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];\n\t\t\t}\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.isIE = (/msie|trident/i.test(navigator.userAgent));\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 && el.className && 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'&nbsp;<style id=\"' + id + '\" type=\"text/css\">' + css + '</style>'); // fails without &nbsp;\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\tif(window.localStorage) {\n\t\tlocalStorage.setItem(\"tw5-password-\" + name,password);\n\t}\n};\n\n/*\nRetrieve a named password from the browser\n*/\nexports.getPassword = function(name) {\n\treturn window.localStorage ? 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\ndomNode: where to attach the event handlers\nevents: array of event handlers to be added (see below)\nEach entry in the events array is an object with these properties:\nhandlerFunction: optional event handler function\nhandlerObject: optional event handler object\nhandlerMethod: optionally specifies object handler method name (defaults to `handleEvent`)\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 widget = require(\"$:/core/modules/widgets/widget.js\");\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\tduration = $tw.utils.getAnimationDuration(),\n\t\ttiddler = this.wiki.getTiddler(title);\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\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// Up the modal count and adjust the body class\n\tthis.modalCount++;\n\tthis.adjustPageClass();\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\theaderWidgetNode = this.wiki.makeWidget(headerParser,{parentWidget: $tw.rootWidget, document: document});\n\theaderWidgetNode.render(headerTitle,null);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\theaderWidgetNode.refresh(changes,modalHeader,null);\n\t});\n\t// Render the body of the message\n\tvar bodyParser = this.wiki.parseTiddler(title),\n\t\tbodyWidgetNode = this.wiki.makeWidget(bodyParser,{parentWidget: $tw.rootWidget, document: document});\n\tbodyWidgetNode.render(modalBody,null);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tbodyWidgetNode.refresh(changes,modalBody,null);\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\tfooterWidgetNode = this.wiki.makeWidget(footerParser,{parentWidget: $tw.rootWidget, document: document});\n\tfooterWidgetNode.render(modalFooterButtons,null);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tfooterWidgetNode.refresh(changes,modalFooterButtons,null);\n\t});\n\t// Add the close event handler\n\tvar closeHandler = 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\twindow.setTimeout(function() {\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},duration);\n\t\t// Don't let anyone else handle the tw-close-tiddler message\n\t\treturn false;\n\t};\n\theaderWidgetNode.addEventListener(\"tw-close-tiddler\",closeHandler,false);\n\tbodyWidgetNode.addEventListener(\"tw-close-tiddler\",closeHandler,false);\n\tfooterWidgetNode.addEventListener(\"tw-close-tiddler\",closeHandler,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 \" + duration + \"ms ease-out\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms 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 widget = require(\"$:/core/modules/widgets/widget.js\");\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\tduration = $tw.utils.getAnimationDuration();\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 parser = this.wiki.parseTiddler(title),\n\t\twidgetNode = this.wiki.makeWidget(parser,{parentWidget: $tw.rootWidget, document: document});\n\twidgetNode.render(notification,null);\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\twidgetNode.refresh(changes,notification,null);\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 \" + duration + \"ms ease-out, \" + $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms 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// Remove the modal message from the DOM once the transition ends\n\t\tsetTimeout(function() {\n\t\t\tif(notification.parentNode) {\n\t\t\t\tdocument.body.removeChild(notification);\n\t\t\t}\n\t\t},duration);\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\t$tw.utils.addClass(this.anchorDomNode,\"tw-popup\");\n\tthis.rootElement.addEventListener(\"click\",this,false);\n};\n\nPopup.prototype.handleEvent = function(event) {\n\t// Dismiss the popup if we get a click on an element that doesn't have .tw-popup class\n\tif(event.type === \"click\") {\n\t\tvar node = event.target;\n\t\twhile(node && !$tw.utils.hasClass(node,\"tw-popup\")) {\n\t\t\tnode = node.parentNode;\n\t\t}\n\t\tif(!node) {\n\t\t\tthis.cancel();\n\t\t}\n\t}\n};\n\nPopup.prototype.cancel = function() {\n\tif(this.anchorDomNode) {\n\t\t$tw.utils.removeClass(this.anchorDomNode,\"tw-popup\");\n\t\tthis.anchorDomNode = null;\t\t\n\t}\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 state = !this.readPopupState(options.title,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\n/*\nReturns true if the specified title and text identifies an active popup\n*/\nPopup.prototype.readPopupState = function(title,text) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tresult = false;\n\tif(this.title === title) {\n\t\tresult = popupLocationRegExp.test(text);\n\t}\n\treturn result;\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\tvar duration = $tw.utils.getAnimationDuration();\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;\n\t\t\tif(duration <= 0) {\n\t\t\t\tt = 1;\n\t\t\t} else {\n\t\t\t\tt = ((new Date()) - self.startTime) / duration;\t\n\t\t\t}\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/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\n// Sequence number used to enable us to track objects for testing\nvar sequenceNumber = null;\n\nvar bumpSequenceNumber = function(object) {\n\tif(sequenceNumber !== null) {\n\t\tobject.sequenceNumber = sequenceNumber++;\n\t}\n}\n\nvar TW_TextNode = function(text) {\n\tbumpSequenceNumber(this);\n\tthis.textContent = text;\n};\n\nvar TW_Element = function(tag,namespace) {\n\tbumpSequenceNumber(this);\n\tthis.isTiddlyWikiFakeDom = true;\n\tthis.tag = tag;\n\tthis.attributes = {};\n\tthis.isRaw = false;\n\tthis.children = [];\n\tthis.namespaceURI = namespace || \"http://www.w3.org/1999/xhtml\";\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.removeAttribute = function(name) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot removeAttribute on a raw TW_Element\";\n\t}\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\tdelete this.attributes[name];\n\t}\n};\n\nTW_Element.prototype.appendChild = function(node) {\n\tthis.children.push(node);\n\tnode.parentNode = this;\n};\n\nTW_Element.prototype.insertBefore = function(node,nextSibling) {\n\tif(nextSibling) {\n\t\tvar p = this.children.indexOf(nextSibling);\n\t\tif(p !== -1) {\n\t\t\tthis.children.splice(p,0,node);\n\t\t\tnode.parentNode = this;\n\t\t} else {\n\t\t\tthis.appendChild(node);\n\t\t}\n\t} else {\n\t\tthis.appendChild(node);\n\t}\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, \"className\", {\n\tget: function() {\n\t\treturn this.attributes[\"class\"] || \"\";\n\t},\n set: function(value) {\n \tthis.attributes[\"class\"] = value;\n }\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\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\tsetSequenceNumber: function(value) {\n\t\tsequenceNumber = value;\n\t},\n\tcreateElementNS: function(namespace,tag) {\n\t\treturn new TW_Element(tag,namespace);\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.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) {\n\tif(node.type === \"element\" && node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) {\n\t\treturn node.attributes[name].value;\n\t}\n\treturn defaultValue;\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 \"&amp;\", < to \"&lt;\", > to \"&gt;\" and \" to \"&quot;\"\nexports.htmlEncode = function(s) {\n\tif(s) {\n\t\treturn s.toString().replace(/&/mg,\"&amp;\").replace(/</mg,\"&lt;\").replace(/>/mg,\"&gt;\").replace(/\\\"/mg,\"&quot;\");\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*/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/*\nGet the animation duration in ms\n*/\nexports.getAnimationDuration = function() {\n\treturn parseInt($tw.wiki.getTiddlerText(\"$:/config/AnimationDuration\",\"400\"),10);\n};\n\n/*\nHash a string to a number\nDerived from http://stackoverflow.com/a/15710692\n*/\nexports.hashString = function(str) {\n\treturn str.split(\"\").reduce(function(a,b) {\n\t\ta = ((a << 5) - a) + b.charCodeAt(0);\n\t\treturn a & a;\n\t},0);\n};\n\n/*\nDecode a base64 string\n*/\nexports.base64Decode = function(string64) {\n\tif($tw.browser) {\n\t\t// TODO\n\t\tthrow \"$tw.utils.base64Decode() doesn't work in the browser\";\n\t} else {\n\t\treturn (new Buffer(string64,\"base64\")).toString();\n\t}\n};\n\n})();\n", | |
"title": "$:/core/modules/utils/utils.js", | |
"type": "application/javascript", | |
"module-type": "utils" | |
}, | |
"$:/core/modules/widgets/browse.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/browse.js\ntype: application/javascript\nmodule-type: widget\n\nBrowse widget for browsing for files to import\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar BrowseWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nBrowseWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nBrowseWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"input\");\n\tdomNode.setAttribute(\"type\",\"file\");\n\tdomNode.setAttribute(\"multiple\",\"multiple\");\n\t// Add a click event handler\n\tdomNode.addEventListener(\"change\",function (event) {\n\t\tself.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {\n\t\t\tself.dispatchEvent({type: \"tw-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray)});\n\t\t});\n\t\treturn false;\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nBrowseWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nBrowseWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.browse = BrowseWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/browse.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/button.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/button.js\ntype: application/javascript\nmodule-type: widget\n\nButton widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ButtonWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nButtonWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nButtonWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"button\");\n\t// Assign classes\n\tvar classes = this[\"class\"].split(\" \") || [];\n\tif(this.selectedClass) {\n\t\tif(this.set && this.setTo && this.isSelected()) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\" \"));\n\t\t}\n\t\tif(this.popup && this.isPoppedUp()) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\" \"));\n\t\t}\n\t}\n\tdomNode.className = classes.join(\" \");\n\t// Assign classes\n\tif(this.style) {\n\t\tdomNode.setAttribute(\"style\",this.style);\n\t}\n\t// Add a click event handler\n\tdomNode.addEventListener(\"click\",function (event) {\n\t\tvar handled = false;\n\t\tif(self.message) {\n\t\t\tself.dispatchMessage(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.popup) {\n\t\t\tself.triggerPopup(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.set) {\n\t\t\tself.setTiddler();\n\t\t\thandled = true;\n\t\t}\n\t\tif(handled) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\treturn handled;\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nButtonWidget.prototype.isSelected = function() {\n\tvar tiddler = this.wiki.getTiddler(this.set);\n\treturn tiddler ? tiddler.fields.text === this.setTo : this.defaultSetValue === this.setTo;\n};\n\nButtonWidget.prototype.isPoppedUp = function() {\n\tvar tiddler = this.wiki.getTiddler(this.popup);\n\tvar result = tiddler && tiddler.fields.text ? $tw.popup.readPopupState(this.popup,tiddler.fields.text) : false;\n\treturn result;\n};\n\nButtonWidget.prototype.dispatchMessage = function(event) {\n\tthis.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable(\"currentTiddler\")});\n};\n\nButtonWidget.prototype.triggerPopup = function(event) {\n\t$tw.popup.triggerPopup({\n\t\tdomNode: this.domNodes[0],\n\t\ttitle: this.popup,\n\t\twiki: this.wiki\n\t});\n};\n\nButtonWidget.prototype.setTiddler = function() {\n\tvar tiddler = this.wiki.getTiddler(this.set);\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));\n};\n\n/*\nCompute the internal state of the widget\n*/\nButtonWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.message = this.getAttribute(\"message\");\n\tthis.param = this.getAttribute(\"param\");\n\tthis.set = this.getAttribute(\"set\");\n\tthis.setTo = this.getAttribute(\"setTo\");\n\tthis.popup = this.getAttribute(\"popup\");\n\tthis.hover = this.getAttribute(\"hover\");\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tthis.style = this.getAttribute(\"style\");\n\tthis.selectedClass = this.getAttribute(\"selectedClass\");\n\tthis.defaultSetValue = this.getAttribute(\"default\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nButtonWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes[\"class\"] || changedAttributes.selectedClass || changedAttributes.style || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\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\nCheckbox widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CheckboxWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCheckboxWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCheckboxWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our elements\n\tthis.labelDomNode = this.document.createElement(\"label\");\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"checkbox\");\n\tif(this.getValue()) {\n\t\tthis.inputDomNode.setAttribute(\"checked\",\"true\");\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\"span\");\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.labelDomNode,nextSibling);\n\tthis.renderChildren(this.spanDomNode,null);\n\tthis.domNodes.push(this.labelDomNode);\n};\n\nCheckboxWidget.prototype.getValue = function() {\n\tvar tiddler = this.wiki.getTiddler(this.checkboxTitle);\n\treturn tiddler ? tiddler.hasTag(this.checkboxTag) : false;\n};\n\nCheckboxWidget.prototype.handleChangeEvent = function(event) {\n\tvar checked = this.inputDomNode.checked,\n\t\ttiddler = this.wiki.getTiddler(this.checkboxTitle);\n\tif(tiddler && tiddler.hasTag(this.checkboxTag) !== checked) {\n\t\tvar newTags = (tiddler.fields.tags || []).slice(0),\n\t\t\tpos = newTags.indexOf(this.checkboxTag);\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.checkboxTag);\n\t\t}\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{tags: newTags},this.wiki.getModificationFields()));\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nCheckboxWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.checkboxTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.checkboxTag = this.getAttribute(\"tag\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCheckboxWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.tag || changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.checkboxTitle]) {\n\t\t\tthis.inputDomNode.checked = this.getValue();\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\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/count.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/count.js\ntype: application/javascript\nmodule-type: widget\n\nCount widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CountWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCountWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCountWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.currentCount);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nCountWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.filter = this.getAttribute(\"filter\");\n\t// Execute the filter\n\tif(this.filter) {\n\t\tthis.currentCount = this.wiki.filterTiddlers(this.filter,this.getVariable(\"currentTiddler\")).length;\n\t} else {\n\t\tthis.currentCount = undefined;\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCountWidget.prototype.refresh = function(changedTiddlers) {\n\t// Re-execute the filter to get the count\n\tvar oldCount = this.currentCount;\n\tthis.execute();\n\tif(this.currentCount !== oldCount) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n\n};\n\nexports.count = CountWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/count.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/dropzone.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/dropzone.js\ntype: application/javascript\nmodule-type: widget\n\nDropzone widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DropZoneWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDropZoneWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDropZoneWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"div\");\n\tdomNode.className = \"tw-dropzone\";\n\t// Add event handlers\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"dragenter\", handlerObject: this, handlerMethod: \"handleDragEnterEvent\"},\n\t\t{name: \"dragover\", handlerObject: this, handlerMethod: \"handleDragOverEvent\"},\n\t\t{name: \"dragleave\", handlerObject: this, handlerMethod: \"handleDragLeaveEvent\"},\n\t\t{name: \"drop\", handlerObject: this, handlerMethod: \"handleDropEvent\"},\n\t\t{name: \"paste\", handlerObject: this, handlerMethod: \"handlePasteEvent\"}\n\t]);\n\tdomNode.addEventListener(\"click\",function (event) {\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nDropZoneWidget.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.domNodes[0],\"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\nDropZoneWidget.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\nDropZoneWidget.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.domNodes[0],\"tw-dragover\");\n\t}\n};\n\nDropZoneWidget.prototype.handleDropEvent = function(event) {\n\tvar self = this,\n\t\tdataTransfer = event.dataTransfer;\n\t// Reset the enter count\n\tthis.dragEnterCount = 0;\n\t// Remove highlighting\n\t$tw.utils.removeClass(this.domNodes[0],\"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.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {\n\t\tself.dispatchEvent({type: \"tw-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray)});\n\t});\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\nDropZoneWidget.prototype.importData = function(dataTransfer) {\n\t// Try each provided data type in turn\n\tfor(var t=0; t<this.importDataTypes.length; t++) {\n\t\tif(!$tw.browser.isIE || this.importDataTypes[t].IECompatible) {\n\t\t\t// Get the data\n\t\t\tvar dataType = this.importDataTypes[t];\n\t\t\t\tvar data = dataTransfer.getData(dataType.type);\n\t\t\t// Import the tiddlers in the data\n\t\t\tif(data !== \"\" && data !== null) {\n\t\t\t\tvar tiddlerFields = dataType.convertToFields(data);\n\t\t\t\tif(!tiddlerFields.title) {\n\t\t\t\t\ttiddlerFields.title = this.wiki.generateNewTitle(\"Untitled\");\n\t\t\t\t}\n\t\t\t\tthis.dispatchEvent({type: \"tw-import-tiddlers\", param: JSON.stringify([tiddlerFields])});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n};\n\nDropZoneWidget.prototype.importDataTypes = [\n\t{type: \"text/vnd.tiddler\", IECompatible: false, convertToFields: function(data) {\n\t\treturn JSON.parse(data);\n\t}},\n\t{type: \"URL\", IECompatible: true, convertToFields: function(data) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURI(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn JSON.parse(match[1]);\n\t\t} else {\n\t\t\treturn { // As URL string\n\t\t\t\ttext: data\n\t\t\t};\n\t\t}\n\t}},\n\t{type: \"text/x-moz-url\", IECompatible: false, convertToFields: function(data) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURI(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn JSON.parse(match[1]);\n\t\t} else {\n\t\t\treturn { // As URL string\n\t\t\t\ttext: data\n\t\t\t};\n\t\t}\n\t}},\n\t{type: \"text/plain\", IECompatible: false, convertToFields: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}},\n\t{type: \"Text\", IECompatible: true, convertToFields: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}},\n\t{type: \"text/uri-list\", IECompatible: false, convertToFields: function(data) {\n\t\treturn {\n\t\t\ttext: data\n\t\t};\n\t}}\n];\n\nDropZoneWidget.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\tthis.wiki.readFile(item.getAsFile(),function(tiddlerFields) {\n\t\t\t\t\tself.dispatchEvent({type: \"tw-import-tiddlers\", param: JSON.stringify([tiddlerFields])});\n\t\t\t\t});\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 tiddlerFields = {\n\t\t\t\t\t\ttitle: self.wiki.generateNewTitle(\"Untitled\"),\n\t\t\t\t\t\ttext: str\n\t\t\t\t\t};\n\t\t\t\t\tself.dispatchEvent({type: \"tw-import-tiddlers\", param: JSON.stringify([tiddlerFields])});\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\n/*\nCompute the internal state of the widget\n*/\nDropZoneWidget.prototype.execute = function() {\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDropZoneWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.dropzone = DropZoneWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/dropzone.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/edit-bitmap.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-bitmap.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-bitmap widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Default image sizes\nvar DEFAULT_IMAGE_WIDTH = 300,\n\tDEFAULT_IMAGE_HEIGHT = 185;\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditBitmapWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditBitmapWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditBitmapWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our element\n\tthis.canvasDomNode = $tw.utils.domMaker(\"canvas\",{\n\t\tdocument: this.document,\n\t\t\"class\":\"tw-edit-bitmapeditor\",\n\t\teventListeners: [{\n\t\t\tname: \"touchstart\", handlerObject: this, handlerMethod: \"handleTouchStartEvent\"\n\t\t},{\n\t\t\tname: \"touchmove\", handlerObject: this, handlerMethod: \"handleTouchMoveEvent\"\n\t\t},{\n\t\t\tname: \"touchend\", handlerObject: this, handlerMethod: \"handleTouchEndEvent\"\n\t\t},{\n\t\t\tname: \"mousedown\", handlerObject: this, handlerMethod: \"handleMouseDownEvent\"\n\t\t},{\n\t\t\tname: \"mousemove\", handlerObject: this, handlerMethod: \"handleMouseMoveEvent\"\n\t\t},{\n\t\t\tname: \"mouseup\", handlerObject: this, handlerMethod: \"handleMouseUpEvent\"\n\t\t}]\n\t});\n\tthis.widthDomNode = $tw.utils.domMaker(\"input\",{\n\t\tdocument: this.document,\n\t\t\"class\":\"tw-edit-bitmapeditor-width\",\n\t\teventListeners: [{\n\t\t\tname: \"change\", handlerObject: this, handlerMethod: \"handleWidthChangeEvent\"\n\t\t}]\n\t});\n\tthis.heightDomNode = $tw.utils.domMaker(\"input\",{\n\t\tdocument: this.document,\n\t\t\"class\":\"tw-edit-bitmapeditor-height\",\n\t\teventListeners: [{\n\t\t\tname: \"change\", handlerObject: this, handlerMethod: \"handleHeightChangeEvent\"\n\t\t}]\n\t});\n\t// Insert the elements into the DOM\n\tparent.insertBefore(this.canvasDomNode,nextSibling);\n\tparent.insertBefore(this.widthDomNode,nextSibling);\n\tparent.insertBefore(this.heightDomNode,nextSibling);\n\tthis.domNodes.push(this.canvasDomNode,this.widthDomNode,this.heightDomNode);\n\t// Load the image into the canvas\n\tthis.loadCanvas();\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditBitmapWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n};\n\n/*\nNote that the bitmap editor intentionally doesn't try to refresh itself because it would be confusing to have the image changing spontaneously while editting it\n*/\nEditBitmapWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nEditBitmapWidget.prototype.loadCanvas = function() {\n\tvar tiddler = this.wiki.getTiddler(this.editTitle),\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(self.canvasDomNode,currImage.width,currImage.height,currImage);\n\t\t// And also copy the current bitmap to the off-screen canvas\n\t\tself.currCanvas = self.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(self.canvasDomNode,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the off-screen canvas size and clear it\n\t\tself.currCanvas = self.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\nEditBitmapWidget.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\n/*\n** Update the input boxes with the actual size of the canvas\n*/\nEditBitmapWidget.prototype.updateSize = function() {\n\tthis.widthDomNode.value = this.currCanvas.width;\n\tthis.heightDomNode.value = this.currCanvas.height;\n};\n\n/*\n** Change the size of the canvas, preserving the current image\n*/\nEditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) {\n\t// Create and size a new canvas\n\tvar newCanvas = this.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\tthis.canvasDomNode.width = newWidth;\n\tthis.canvasDomNode.height = newHeight;\n\t// Paint the onscreen canvas with the offscreen canvas\n\tctx = this.canvasDomNode.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n};\n\nEditBitmapWidget.prototype.handleWidthChangeEvent = function(event) {\n\t// Get the new width\n\tvar newWidth = parseInt(this.widthDomNode.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\nEditBitmapWidget.prototype.handleHeightChangeEvent = function(event) {\n\t// Get the new width\n\tvar newHeight = parseInt(this.heightDomNode.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\nEditBitmapWidget.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\nEditBitmapWidget.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\nEditBitmapWidget.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\nEditBitmapWidget.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\nEditBitmapWidget.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\nEditBitmapWidget.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\nEditBitmapWidget.prototype.adjustCoordinates = function(x,y) {\n\tvar canvasRect = this.canvasDomNode.getBoundingClientRect(),\n\t\tscale = this.canvasDomNode.width/canvasRect.width;\n\treturn {x: (x - canvasRect.left) * scale, y: (y - canvasRect.top) * scale};\n};\n\nEditBitmapWidget.prototype.strokeStart = function(x,y) {\n\t// Start off a new stroke\n\tthis.stroke = [this.adjustCoordinates(x,y)];\n};\n\nEditBitmapWidget.prototype.strokeMove = function(x,y) {\n\tvar ctx = this.canvasDomNode.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\nEditBitmapWidget.prototype.strokeEnd = function() {\n\t// Copy the bitmap to the off-screen canvas\n\tvar ctx = this.currCanvas.getContext(\"2d\");\n\tctx.drawImage(this.canvasDomNode,0,0);\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\nEditBitmapWidget.prototype.saveChanges = function() {\n\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\tif(tiddler) {\n\t\t// data URIs look like \"data:<type>;base64,<text>\"\n\t\tvar dataURL = this.canvasDomNode.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.wiki.addTiddler(new $tw.Tiddler(tiddler,update));\n\t}\n};\n\nexports[\"edit-bitmap\"] = EditBitmapWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/edit-bitmap.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/edit-text.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-text.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-text widget\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; // Minimum height of textareas in pixels\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditTextWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditTextWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditTextWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our element\n\tvar editInfo = this.getEditInfo();\n\tvar domNode = this.document.createElement(this.editTag);\n\tif(this.editType) {\n\t\tdomNode.setAttribute(\"type\",this.editType);\n\t}\n\tif(editInfo.value === \"\" && this.editPlaceholder) {\n\t\tdomNode.setAttribute(\"placeholder\",this.editPlaceholder);\n\t}\n\t// Assign classes\n\tif(this.editClass) {\n\t\tdomNode.className = this.editClass;\n\t}\n\t// Set the text\n\tif(this.editTag === \"textarea\") {\n\t\tdomNode.appendChild(this.document.createTextNode(editInfo.value));\n\t} else {\n\t\tdomNode.setAttribute(\"value\",editInfo.value)\n\t}\n\t// Add an input event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"focus\", handlerObject: this, handlerMethod: \"handleFocusEvent\"},\n\t\t{name: \"input\", handlerObject: this, handlerMethod: \"handleInputEvent\"}\n\t]);\n\t// Insert the element into the DOM\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.domNodes.push(domNode);\n\tif(this.postRender) {\n\t\tthis.postRender();\n\t}\n\t// Fix height\n\tthis.fixHeight();\n};\n\n/*\nGet the tiddler being edited and current value\n*/\nEditTextWidget.prototype.getEditInfo = function() {\n\t// Get the edit value\n\tvar self = this,\n\t\tvalue,\n\t\tupdate;\n\tif(this.editIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault);\n\t\tupdate = function(value) {\n\t\t\tvar data = self.wiki.getTiddlerData(self.editTitle,{});\n\t\t\tif(data[self.editIndex] !== value) {\n\t\t\t\tdata[self.editIndex] = value;\n\t\t\t\tself.wiki.setTiddlerData(self.editTitle,data);\n\t\t\t}\n\t\t};\n\t} else {\n\t\t// Get the current tiddler and the field name\n\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\tif(tiddler) {\n\t\t\t// If we've got a tiddler, the value to display is the field string value\n\t\t\tvalue = tiddler.getFieldString(this.editField);\n\t\t} else {\n\t\t\t// Otherwise, we need to construct a default value for the editor\n\t\t\tswitch(this.editField) {\n\t\t\t\tcase \"text\":\n\t\t\t\t\tvalue = \"Type the text for the tiddler '\" + this.editTitle + \"'\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"title\":\n\t\t\t\t\tvalue = this.editTitle;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = \"\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(this.editDefault !== undefined) {\n\t\t\t\tvalue = this.editDefault;\n\t\t\t}\n\t\t}\n\t\tupdate = function(value) {\n\t\t\tvar tiddler = self.wiki.getTiddler(self.editTitle),\n\t\t\t\tupdateFields = {\n\t\t\t\t\ttitle: self.editTitle\n\t\t\t\t};\n\t\t\tupdateFields[self.editField] = value;\n\t\t\tself.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields()));\n\t\t};\n\t}\n\treturn {value: value, update: update};\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditTextWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.editField = this.getAttribute(\"field\",\"text\");\n\tthis.editIndex = this.getAttribute(\"index\");\n\tthis.editDefault = this.getAttribute(\"default\");\n\tthis.editClass = this.getAttribute(\"class\");\n\tthis.editPlaceholder = this.getAttribute(\"placeholder\");\n\tthis.editFocusPopup = this.getAttribute(\"focusPopup\");\n\t// Get the editor element tag and type\n\tvar tag,type;\n\tif(this.editField === \"text\") {\n\t\ttag = \"textarea\";\n\t} else {\n\t\ttag = \"input\";\n\t\tvar fieldModule = $tw.Tiddler.fieldModules[this.editField];\n\t\tif(fieldModule && fieldModule.editTag) {\n\t\t\ttag = fieldModule.editTag;\n\t\t}\n\t\tif(fieldModule && fieldModule.editType) {\n\t\t\ttype = fieldModule.editType;\n\t\t}\n\t\ttype = type || \"text\";\n\t}\n\t// Get the rest of our parameters\n\tthis.editTag = this.getAttribute(\"tag\",tag);\n\tthis.editType = this.getAttribute(\"type\",type);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEditTextWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Completely rerender if any of our attributes have changed\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedTiddlers[this.editTitle]) {\n\t\tthis.updateEditor(this.getEditInfo().value);\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n/*\nUpdate the editor with new text. This method is separate from updateEditorDomNode()\nso that subclasses can override updateEditor() and still use updateEditorDomNode()\n*/\nEditTextWidget.prototype.updateEditor = function(text) {\n\tthis.updateEditorDomNode(text);\n};\n\n/*\nUpdate the editor dom node with new text\n*/\nEditTextWidget.prototype.updateEditorDomNode = function(text) {\n\t// Replace the edit value if the tiddler we're editing has changed\n\tvar domNode = this.domNodes[0];\n\tif(!domNode.isTiddlyWikiFakeDom) {\n\t\tif(this.document.activeElement !== domNode) {\n\t\t\tdomNode.value = text;\n\t\t}\n\t\t// Fix the height if needed\n\t\tthis.fixHeight();\n\t}\n};\n\n/*\nFix the height of textareas to fit their content\n*/\nEditTextWidget.prototype.fixHeight = function() {\n\tvar self = this,\n\t\tdomNode = this.domNodes[0];\n\tif(domNode && !domNode.isTiddlyWikiFakeDom && this.editTag === \"textarea\") {\n\t\t$tw.utils.nextTick(function() {\n\t\t\t// Resize the textarea to fit its content, preserving scroll position\n\t\t\tvar scrollPosition = $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\tdomNode.style.height = \"auto\";\n\t\t\t// Calculate the revised height\n\t\t\tvar newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,MIN_TEXT_AREA_HEIGHT);\n\t\t\t// Only try to change the height if it has changed\n\t\t\tif(newHeight !== domNode.offsetHeight) {\n\t\t\t\tdomNode.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(domNode);\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.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\n/*\nHandle a dom \"input\" event\n*/\nEditTextWidget.prototype.handleInputEvent = function(event) {\n\tthis.saveChanges(this.domNodes[0].value);\n\tthis.fixHeight();\n\treturn true;\n};\n\nEditTextWidget.prototype.handleFocusEvent = function(event) {\n\tif(this.editFocusPopup) {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.domNodes[0],\n\t\t\ttitle: this.editFocusPopup,\n\t\t\twiki: this.wiki,\n\t\t\tforce: true\n\t\t});\n\t}\n\treturn true;\n};\n\nEditTextWidget.prototype.saveChanges = function(text) {\n\tvar editInfo = this.getEditInfo();\n\tif(text !== editInfo.value) {\n\t\teditInfo.update(text);\n\t}\n};\n\nexports[\"edit-text\"] = EditTextWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/edit-text.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/edit.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/edit.js\ntype: application/javascript\nmodule-type: widget\n\nEdit widget is a meta-widget chooses the appropriate actual editting widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n// Mappings from content type to editor type\n// TODO: This information should be configurable/extensible\nvar editorTypeMappings = {\n\t\"text/vnd.tiddlywiki\": \"text\",\n\t\"image/svg+xml\": \"text\",\n\t\"image/jpg\": \"bitmap\",\n\t\"image/jpeg\": \"bitmap\",\n\t\"image/gif\": \"bitmap\",\n\t\"image/png\": \"bitmap\",\n\t\"image/x-icon\": \"bitmap\"\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.editField = this.getAttribute(\"field\",\"text\");\n\tthis.editIndex = this.getAttribute(\"index\");\n\tthis.editClass = this.getAttribute(\"class\");\n\tthis.editPlaceholder = this.getAttribute(\"placeholder\");\n\t// Get the content type of the thing we're editing\n\tvar type;\n\tif(this.editField === \"text\") {\n\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\tif(tiddler) {\n\t\t\ttype = tiddler.fields.type;\n\t\t}\n\t}\n\ttype = type || \"text/vnd.tiddlywiki\";\n\t// Choose the appropriate edit widget\n\tvar editorType = editorTypeMappings[type] || \"text\";\n\t// Make the child widgets\n\tthis.makeChildWidgets([{\n\t\ttype: \"edit-\" + editorType,\n\t\tattributes: {\n\t\t\ttiddler: {type: \"string\", value: this.editTitle},\n\t\t\tfield: {type: \"string\", value: this.editField},\n\t\t\tindex: {type: \"string\", value: this.editIndex},\n\t\t\t\"class\": {type: \"string\", value: this.editClass},\n\t\t\t\"placeholder\": {type: \"string\", value: this.editPlaceholder}\n\t\t}\n\t}]);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEditWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.edit = EditWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/edit.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/element.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/element.js\ntype: application/javascript\nmodule-type: widget\n\nElement widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ElementWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nElementWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nElementWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar domNode = this.document.createElementNS(this.namespace,this.parseTreeNode.tag);\n\tthis.assignAttributes(domNode);\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nElementWidget.prototype.execute = function() {\n\t// Select the namespace for the tag\n\tvar tagNamespaces = {\n\t\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\t\tmath: \"http://www.w3.org/1998/Math/MathML\",\n\t\t\tbody: \"http://www.w3.org/1999/xhtml\"\n\t\t};\n\tthis.namespace = tagNamespaces[this.parseTreeNode.tag];\n\tif(this.namespace) {\n\t\tthis.setVariable(\"namespace\",this.namespace);\n\t} else {\n\t\tthis.namespace = this.getVariable(\"namespace\",{defaultValue: \"http://www.w3.org/1999/xhtml\"});\n\t}\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nElementWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\thasChangedAttributes = $tw.utils.count(changedAttributes) > 0;\n\tif(hasChangedAttributes) {\n\t\t// Update our attributes\n\t\tthis.assignAttributes(this.domNodes[0]);\n\t}\n\treturn this.refreshChildren(changedTiddlers) || hasChangedAttributes;\n};\n\nexports.element = ElementWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/element.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/encrypt.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/encrypt.js\ntype: application/javascript\nmodule-type: widget\n\nEncrypt widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EncryptWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEncryptWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEncryptWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.encryptedText);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEncryptWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.filter = this.getAttribute(\"filter\",\"[!is[system]]\");\n\t// Encrypt the filtered tiddlers\n\tvar tiddlers = this.wiki.filterTiddlers(this.filter),\n\t\tjson = {},\n\t\tself = this;\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.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\tthis.encryptedText = $tw.utils.htmlEncode($tw.crypto.encrypt(JSON.stringify(json)));\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEncryptWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\taffectedTiddlers = this.wiki.filterTiddlers(this.filter,null,changedTiddlers);\n\tif(changedAttributes.filter || affectedTiddlers.length > 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\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/entity.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/entity.js\ntype: application/javascript\nmodule-type: widget\n\nHTML entity widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EntityWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEntityWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEntityWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tvar textNode = this.document.createTextNode($tw.utils.entityDecode(this.parseTreeNode.entity));\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEntityWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEntityWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.entity = EntityWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/entity.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\nField mangler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar FieldManglerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"tw-remove-field\", handler: \"handleRemoveFieldEvent\"},\n\t\t{type: \"tw-add-field\", handler: \"handleAddFieldEvent\"},\n\t\t{type: \"tw-remove-tag\", handler: \"handleRemoveTagEvent\"},\n\t\t{type: \"tw-add-tag\", handler: \"handleAddTagEvent\"}\n\t]);\n};\n\n/*\nInherit from the base widget class\n*/\nFieldManglerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nFieldManglerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nFieldManglerWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.mangleTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nFieldManglerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nFieldManglerWidget.prototype.handleRemoveFieldEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\tdeletion = {};\n\tdeletion[event.param] = undefined;\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,deletion));\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleAddFieldEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle);\n\tif(tiddler && typeof event.param === \"string\") {\n\t\tvar name = event.param.toLowerCase();\n\t\tif(name !== \"\" && !$tw.utils.hop(tiddler.fields,name)) {\n\t\t\tvar addition = this.wiki.getModificationFields();\n\t\t\taddition[name] = \"\";\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));\n\t\t}\n\t}\n\treturn true;\n};\n\nFieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle);\n\tif(tiddler && tiddler.fields.tags) {\n\t\tvar p = tiddler.fields.tags.indexOf(event.param);\n\t\tif(p !== -1) {\n\t\t\tvar modification = this.wiki.getModificationFields();\n\t\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t\tmodification.tags.splice(p,1);\n\t\tthis.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.wiki.getTiddler(this.mangleTitle);\n\tif(tiddler && typeof event.param === \"string\" && event.param !== \"\") {\n\t\tvar modification = this.wiki.getModificationFields();\n\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t$tw.utils.pushTop(modification.tags,event.param);\n\t\tthis.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\nFields widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar FieldsWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nFieldsWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nFieldsWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.text);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nFieldsWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.template = this.getAttribute(\"template\");\n\tthis.exclude = this.getAttribute(\"exclude\");\n\tthis.stripTitlePrefix = this.getAttribute(\"stripTitlePrefix\",\"no\") === \"yes\";\n\t// Get the value to display\n\tvar tiddler = this.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\tthis.text = text.join(\"\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nFieldsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.template || changedAttributes.exclude || changedAttributes.stripTitlePrefix || changedTiddlers[this.tiddlerTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\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/link.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/link.js\ntype: application/javascript\nmodule-type: widget\n\nLink widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar LinkWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nLinkWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLinkWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Get the value of the tw-wikilinks configuration macro\n\tvar wikiLinksMacro = this.getVariable(\"tw-wikilinks\"),\n\t\tuseWikiLinks = wikiLinksMacro ? !(wikiLinksMacro.trim() === \"no\") : true;\n\t// Render the link if required\n\tif(useWikiLinks) {\n\t\tthis.renderLink(parent,nextSibling);\n\t} else {\n\t\t// Just insert the link text\n\t\tvar domNode = this.document.createElement(\"span\");\n\t\tparent.insertBefore(domNode,nextSibling);\n\t\tthis.renderChildren(domNode,null);\n\t\tthis.domNodes.push(domNode);\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nLinkWidget.prototype.renderLink = function(parent,nextSibling) {\n\tvar self = this;\n\t// Create our element\n\tvar domNode = this.document.createElement(\"a\");\n\t// Assign classes\n\t$tw.utils.addClass(domNode,\"tw-tiddlylink\");\n\tif(this.isShadow) {\n\t\t$tw.utils.addClass(domNode,\"tw-tiddlylink-shadow\");\n\t}\n\tif(this.isMissing && !this.isShadow) {\n\t\t$tw.utils.addClass(domNode,\"tw-tiddlylink-missing\");\n\t} else {\n\t\tif(!this.isMissing) {\n\t\t\t$tw.utils.addClass(domNode,\"tw-tiddlylink-resolves\");\n\t\t}\n\t}\n\t// Set an href\n\tvar wikiLinkTemplateMacro = this.getVariable(\"tw-wikilink-template\"),\n\t\twikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : \"#$uri_encoded$\",\n\t\twikiLinkText = wikiLinkTemplate.replace(\"$uri_encoded$\",encodeURIComponent(this.to));\n\twikiLinkText = wikiLinkText.replace(\"$uri_doubleencoded$\",encodeURIComponent(encodeURIComponent(this.to)));\n\tdomNode.setAttribute(\"href\",wikiLinkText);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\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\t// Insert the link into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nLinkWidget.prototype.handleClickEvent = function (event) {\n\t// Send the click on it's way as a navigate event\n\tvar bounds = this.domNodes[0].getBoundingClientRect();\n\tthis.dispatchEvent({\n\t\ttype: \"tw-navigate\",\n\t\tnavigateTo: this.to,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: this,\n\t\tnavigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t}\n\t});\n\tevent.preventDefault();\n\tevent.stopPropagation();\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 elements\n\t\tthis.dragImage = this.document.createElement(\"div\");\n\t\tthis.dragImage.className = \"tw-tiddler-dragger\";\n\t\tvar inner = this.document.createElement(\"div\");\n\t\tinner.className = \"tw-tiddler-dragger-inner\";\n\t\tinner.appendChild(this.document.createTextNode(this.to));\n\t\tthis.dragImage.appendChild(inner);\n\t\tthis.document.body.appendChild(this.dragImage);\n\t\t// Astoundingly, we need to cover the dragger up: http://www.kryogenix.org/code/browser/custom-drag-image.html\n\t\tvar cover = this.document.createElement(\"div\");\n\t\tcover.className = \"tw-tiddler-dragger-cover\";\n\t\tcover.style.left = (inner.offsetLeft - 16) + \"px\";\n\t\tcover.style.top = (inner.offsetTop - 16) + \"px\";\n\t\tcover.style.width = (inner.offsetWidth + 32) + \"px\";\n\t\tcover.style.height = (inner.offsetHeight + 32) + \"px\";\n\t\tthis.dragImage.appendChild(cover);\n\t\t// Set the data transfer properties\n\t\tvar dataTransfer = event.dataTransfer;\n\t\t// First the image\n\t\tdataTransfer.effectAllowed = \"copy\";\n\t\tif(dataTransfer.setDragImage) {\n\t\t\tdataTransfer.setDragImage(this.dragImage.firstChild,-16,-16);\n\t\t}\n\t\t// Then the data\n\t\tdataTransfer.clearData();\n\t\tvar jsonData = this.wiki.getTiddlerAsJson(this.to),\n\t\t\ttextData = this.wiki.getTiddlerText(this.to,\"\");\n\t\t// IE doesn't like these content types\n\t\tif(!$tw.browser.isIE) {\n\t\t\tdataTransfer.setData(\"text/vnd.tiddler\",jsonData);\n\t\t\tdataTransfer.setData(\"text/plain\",textData);\n\t\t\tdataTransfer.setData(\"text/x-moz-url\",\"data:text/vnd.tiddler,\" + encodeURI(jsonData));\n\t\t}\n\t\tdataTransfer.setData(\"URL\",\"data:text/vnd.tiddler,\" + encodeURI(jsonData));\n\t\tdataTransfer.setData(\"Text\",textData);\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\n/*\nCompute the internal state of the widget\n*/\nLinkWidget.prototype.execute = function() {\n\t// Get the target tiddler title\n\tthis.to = this.getAttribute(\"to\",this.getVariable(\"currentTiddler\"));\n\t// Determine the link characteristics\n\tthis.isMissing = !this.wiki.tiddlerExists(this.to);\n\tthis.isShadow = this.wiki.isShadowTiddler(this.to);\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nLinkWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedTiddlers[this.to]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\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\nLinkcatcher widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar LinkCatcherWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"tw-navigate\", handler: \"handleNavigateEvent\"}\n\t]);\n};\n\n/*\nInherit from the base widget class\n*/\nLinkCatcherWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLinkCatcherWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nLinkCatcherWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.catchTo = this.getAttribute(\"to\");\n\tthis.catchMessage = this.getAttribute(\"message\");\n\tthis.catchSet = this.getAttribute(\"set\");\n\tthis.catchSetTo = this.getAttribute(\"setTo\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nLinkCatcherWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedAttributes.message || changedAttributes.set || changedAttributes.setTo) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\n/*\nHandle a tw-navigate event\n*/\nLinkCatcherWidget.prototype.handleNavigateEvent = function(event) {\n\tif(this.catchTo) {\n\t\tthis.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable(\"currentTiddler\"));\n\t}\n\tif(this.catchMessage) {\n\t\tthis.dispatchEvent({\n\t\t\ttype: this.catchMessage,\n\t\t\tparam: event.navigateTo\n\t\t});\n\t}\n\tif(this.catchSet) {\n\t\tvar tiddler = this.wiki.getTiddler(this.catchSet);\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.catchSet, text: this.catchSetTo}));\n\t}\n\treturn false;\n};\n\nexports.linkcatcher = LinkCatcherWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/linkcatcher.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/list.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/list.js\ntype: application/javascript\nmodule-type: widget\n\nList and list item widgets\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\n/*\nThe list widget creates list element sub-widgets that reach back into the list widget for their configuration\n*/\n\nvar ListWidget = function(parseTreeNode,options) {\n\t// Initialise the storyviews if they've not been done already\n\tif(!this.storyViews) {\n\t\tListWidget.prototype.storyViews = {};\n\t\t$tw.modules.applyMethods(\"storyview\",this.storyViews);\n\t}\n\t// Main initialisation inherited from widget.js\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nListWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nListWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n\t// Construct the storyview\n\tvar StoryView = this.storyViews[this.storyViewName];\n\tthis.storyview = StoryView ? new StoryView(this) : null;\n};\n\n/*\nCompute the internal state of the widget\n*/\nListWidget.prototype.execute = function() {\n\t// Get our attributes\n\tthis.template = this.getAttribute(\"template\");\n\tthis.editTemplate = this.getAttribute(\"editTemplate\");\n\tthis.variableName = this.getAttribute(\"variable\",\"currentTiddler\");\n\tthis.storyViewName = this.getAttribute(\"storyview\");\n\tthis.historyTitle = this.getAttribute(\"history\");\n\t// Compose the list elements\n\tthis.list = this.getTiddlerList();\n\tvar members = [],\n\t\tself = this;\n\t// Check for an empty list\n\tif(this.list.length === 0) {\n\t\tmembers = this.getEmptyMessage();\n\t} else {\n\t\t$tw.utils.each(this.list,function(title,index) {\n\t\t\tmembers.push(self.makeItemTemplate(title));\n\t\t});\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(members);\n\t// Clear the last history\n\tthis.history = [];\n};\n\nListWidget.prototype.getTiddlerList = function() {\n\tvar defaultFilter = \"[!is[system]sort[title]]\";\n\treturn this.wiki.filterTiddlers(this.getAttribute(\"filter\",defaultFilter),this.getVariable(\"currentTiddler\"));\n};\n\nListWidget.prototype.getEmptyMessage = function() {\n\tvar emptyMessage = this.getAttribute(\"emptyMessage\",\"\"),\n\t\tparser = this.wiki.parseText(\"text/vnd.tiddlywiki\",emptyMessage,{parseAsInline: true});\n\tif(parser) {\n\t\treturn parser.tree;\n\t} else {\n\t\treturn [];\n\t}\n};\n\n/*\nCompose the template for a list item\n*/\nListWidget.prototype.makeItemTemplate = function(title) {\n\t// Check if the tiddler is a draft\n\tvar tiddler = this.wiki.getTiddler(title),\n\t\tisDraft = tiddler && tiddler.hasField(\"draft.of\"),\n\t\ttemplate = this.template,\n\t\ttemplateTree;\n\tif(isDraft && this.editTemplate) {\n\t\ttemplate = this.editTemplate;\n\t}\n\t// Compose the transclusion of the template\n\tif(template) {\n\t\ttemplateTree = [{type: \"transclude\", attributes: {tiddler: {type: \"string\", value: template}}}];\n\t} else {\n\t\tif(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {\n\t\t\ttemplateTree = this.parseTreeNode.children;\n\t\t} else {\n\t\t\t// Default template is a link to the title\n\t\t\ttemplateTree = [{type: \"element\", tag: this.parseTreeNode.isBlock ? \"div\" : \"span\", children: [{type: \"link\", attributes: {to: {type: \"string\", value: title}}, children: [\n\t\t\t\t\t{type: \"text\", text: title}\n\t\t\t]}]}];\n\t\t}\n\t}\n\t// Return the list item\n\treturn {type: \"listitem\", itemTitle: title, variableName: this.variableName, children: templateTree};\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nListWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Completely refresh if any of our attributes have changed\n\tif(changedAttributes.filter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\t// Handle any changes to the list\n\t\tvar hasChanged = this.handleListChanges(changedTiddlers);\n\t\t// Handle any changes to the history stack\n\t\tif(this.historyTitle && changedTiddlers[this.historyTitle]) {\n\t\t\tthis.handleHistoryChanges();\n\t\t}\n\t\treturn hasChanged;\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 newHistory = this.wiki.getTiddlerData(this.historyTitle,[]);\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.storyview && this.storyview.navigateTo) {\n\t\t\tthis.storyview.navigateTo(newHistory[entry]);\n\t\t}\n\t\tentry++;\n\t}\n\t// Update the history\n\tthis.history = newHistory;\n};\n\n/*\nProcess any changes to the list\n*/\nListWidget.prototype.handleListChanges = function(changedTiddlers) {\n\t// Get the new list\n\tvar prevList = this.list;\n\tthis.list = this.getTiddlerList();\n\t// Check for an empty list\n\tif(this.list.length === 0) {\n\t\t// Check if it was empty before\n\t\tif(prevList.length === 0) {\n\t\t\t// If so, just refresh the empty message\n\t\t\treturn this.refreshChildren(changedTiddlers);\n\t\t} else {\n\t\t\t// Replace the previous content with the empty message\n\t\t\tfor(t=this.children.length-1; t>=0; t--) {\n\t\t\t\tthis.removeListItem(t);\n\t\t\t}\n\t\t\tvar nextSibling = this.findNextSiblingDomNode();\n\t\t\tthis.makeChildWidgets(this.getEmptyMessage());\n\t\t\tthis.renderChildren(this.parentDomNode,nextSibling);\n\t\t\treturn true;\n\t\t}\n\t} else {\n\t\t// If the list was empty then we need to remove the empty message\n\t\tif(prevList.length === 0) {\n\t\t\tthis.removeChildDomNodes();\n\t\t\tthis.children = [];\n\t\t}\n\t\t// Cycle through the list, inserting and removing list items as needed\n\t\tvar hasRefreshed = false;\n\t\tfor(var t=0; t<this.list.length; t++) {\n\t\t\tvar index = this.findListItem(t,this.list[t]);\n\t\t\tif(index === undefined) {\n\t\t\t\t// The list item must be inserted\n\t\t\t\tthis.insertListItem(t,this.list[t]);\n\t\t\t\thasRefreshed = true;\n\t\t\t} else {\n\t\t\t\t// There are intervening list items that must be removed\n\t\t\t\tfor(var n=index-1; n>=t; n--) {\n\t\t\t\t\tthis.removeListItem(n);\n\t\t\t\t\thasRefreshed = true;\n\t\t\t\t}\n\t\t\t\t// Refresh the item we're reusing\n\t\t\t\tvar refreshed = this.children[t].refresh(changedTiddlers);\n\t\t\t\thasRefreshed = hasRefreshed || refreshed;\n\t\t\t}\n\t\t}\n\t\t// Remove any left over items\n\t\tfor(t=this.children.length-1; t>=this.list.length; t--) {\n\t\t\tthis.removeListItem(t);\n\t\t\thasRefreshed = true;\n\t\t}\n\t\treturn hasRefreshed;\n\t}\n};\n\n/*\nFind the list item with a given title, starting from a specified position\n*/\nListWidget.prototype.findListItem = function(startIndex,title) {\n\twhile(startIndex < this.children.length) {\n\t\tif(this.children[startIndex].parseTreeNode.itemTitle === title) {\n\t\t\treturn startIndex;\n\t\t}\n\t\tstartIndex++;\n\t}\n\treturn undefined;\n};\n\n/*\nInsert a new list item at the specified index\n*/\nListWidget.prototype.insertListItem = function(index,title) {\n\t// Create, insert and render the new child widgets\n\tvar widget = this.makeChildWidget(this.makeItemTemplate(title));\n\twidget.parentDomNode = this.parentDomNode; // Hack to enable findNextSiblingDomNode() to work\n\tthis.children.splice(index,0,widget);\n\tvar nextSibling = widget.findNextSiblingDomNode();\n\twidget.render(this.parentDomNode,nextSibling);\n\t// Animate the insertion if required\n\tif(this.storyview && this.storyview.insert) {\n\t\tthis.storyview.insert(widget);\n\t}\n\treturn true;\n};\n\n/*\nRemove the specified list item\n*/\nListWidget.prototype.removeListItem = function(index) {\n\tvar widget = this.children[index];\n\t// Animate the removal if required\n\tif(this.storyview && this.storyview.remove) {\n\t\tthis.storyview.remove(widget);\n\t} else {\n\t\twidget.removeChildDomNodes();\n\t}\n\t// Remove the child widget\n\tthis.children.splice(index,1);\n};\n\nexports.list = ListWidget;\n\nvar ListItemWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nListItemWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nListItemWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nListItemWidget.prototype.execute = function() {\n\t// Set the current list item title\n\tthis.setVariable(this.parseTreeNode.variableName,this.parseTreeNode.itemTitle);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nListItemWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.listitem = ListItemWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/list.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/macrocall.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/macrocall.js\ntype: application/javascript\nmodule-type: widget\n\nMacrocall widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar MacroCallWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nMacroCallWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nMacroCallWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nMacroCallWidget.prototype.execute = function() {\n\t// Get the parse type if specified\n\tthis.parseType = this.getAttribute(\"$type\",\"text/vnd.tiddlywiki\");\n\tthis.renderOutput = this.getAttribute(\"$output\",\"text/html\");\n\t// Merge together the parameters specified in the parse tree with the specified attributes\n\tvar params = this.parseTreeNode.params ? this.parseTreeNode.params.slice(0) : [];\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tparams.push({name: name, value: attribute});\t\t\t\n\t\t}\n\t});\n\t// Get the macro value\n\tvar text = this.getVariable(this.parseTreeNode.name || this.getAttribute(\"$name\"),{params: params}),\n\t\tparseTreeNodes;\n\t// Are we rendering to HTML?\n\tif(this.renderOutput === \"text/html\") {\n\t\t// If so we'll return the parsed macro\n\t\tvar parser = this.wiki.parseText(this.parseType,text,\n\t\t\t\t\t\t\t{parseAsInline: !this.parseTreeNode.isBlock});\n\t\tparseTreeNodes = parser ? parser.tree : [];\n\t} else {\n\t\t// Otherwise, we'll render the text\n\t\tvar plainText = this.wiki.renderText(\"text/plain\",this.parseType,text,{parentWidget: this});\n\t\tparseTreeNodes = [{type: \"text\", text: plainText}];\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nMacroCallWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\t// Rerender ourselves\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.macrocall = MacroCallWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/macrocall.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/navigator.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/navigator.js\ntype: application/javascript\nmodule-type: widget\n\nNavigator widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar NavigatorWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"tw-navigate\", handler: \"handleNavigateEvent\"},\n\t\t{type: \"tw-edit-tiddler\", handler: \"handleEditTiddlerEvent\"},\n\t\t{type: \"tw-delete-tiddler\", handler: \"handleDeleteTiddlerEvent\"},\n\t\t{type: \"tw-save-tiddler\", handler: \"handleSaveTiddlerEvent\"},\n\t\t{type: \"tw-cancel-tiddler\", handler: \"handleCancelTiddlerEvent\"},\n\t\t{type: \"tw-close-tiddler\", handler: \"handleCloseTiddlerEvent\"},\n\t\t{type: \"tw-close-all-tiddlers\", handler: \"handleCloseAllTiddlersEvent\"},\n\t\t{type: \"tw-close-other-tiddlers\", handler: \"handleCloseOtherTiddlersEvent\"},\n\t\t{type: \"tw-new-tiddler\", handler: \"handleNewTiddlerEvent\"},\n\t\t{type: \"tw-import-tiddlers\", handler: \"handleImportTiddlersEvent\"},\n\t]);\n};\n\n/*\nInherit from the base widget class\n*/\nNavigatorWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nNavigatorWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nNavigatorWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.storyTitle = this.getAttribute(\"story\");\n\tthis.historyTitle = this.getAttribute(\"history\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nNavigatorWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.story || changedAttributes.history) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nNavigatorWidget.prototype.getStoryList = function() {\n\treturn this.storyTitle ? this.wiki.getTiddlerList(this.storyTitle) : null;\n};\n\nNavigatorWidget.prototype.saveStoryList = function(storyList) {\n\tvar storyTiddler = this.wiki.getTiddler(this.storyTitle);\n\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\t{title: this.storyTitle},\n\t\tstoryTiddler,\n\t\t{list: storyList}\n\t));\n};\n\nNavigatorWidget.prototype.findTitleInStory = function(storyList,title,defaultIndex) {\n\tvar p = storyList.indexOf(title);\n\treturn p === -1 ? defaultIndex : p;\n};\n\nNavigatorWidget.prototype.removeTitleFromStory = function(storyList,title) {\n\tvar p = storyList.indexOf(title);\n\twhile(p !== -1) {\n\t\tstoryList.splice(p,1);\n\t\tp = storyList.indexOf(title);\n\t}\n};\n\nNavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle,newTitle) {\n\tvar pos = storyList.indexOf(oldTitle);\n\tif(pos !== -1) {\n\t\tstoryList[pos] = newTitle;\n\t\tdo {\n\t\t\tpos = storyList.indexOf(oldTitle,pos + 1);\n\t\t\tif(pos !== -1) {\n\t\t\t\tstoryList.splice(pos,1);\n\t\t\t}\n\t\t} while(pos !== -1);\n\t} else {\n\t\tstoryList.splice(0,0,newTitle);\n\t}\n};\n\nNavigatorWidget.prototype.addToStory = function(title,fromTitle) {\n\tvar storyList = this.getStoryList();\n\tif(storyList) {\n\t\t// See if the tiddler is already there\n\t\tvar slot = this.findTitleInStory(storyList,title,-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(storyList,fromTitle,-1) + 1;\n\t\t\t// Add the tiddler\n\t\t\tstoryList.splice(slot,0,title);\n\t\t\t// Save the story\n\t\t\tthis.saveStoryList(storyList);\n\t\t}\n\t}\n};\n\n/*\nAdd a new record to the top of the history stack\ntitle: a title string or an array of title strings\nfromPageRect: page coordinates of the origin of the navigation\n*/\nNavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {\n\tvar titles = $tw.utils.isArray(title) ? title : [title];\n\t// Add a new record to the top of the history stack\n\tif(this.historyTitle) {\n\t\tvar historyList = this.wiki.getTiddlerData(this.historyTitle,[]);\n\t\t$tw.utils.each(titles,function(title) {\n\t\t\thistoryList.push({title: title, fromPageRect: fromPageRect});\n\t\t});\n\t\tthis.wiki.setTiddlerData(this.historyTitle,historyList);\n\t}\n};\n\n/*\nHandle a tw-navigate event\n*/\nNavigatorWidget.prototype.handleNavigateEvent = function(event) {\n\tthis.addToStory(event.navigateTo,event.navigateFromTitle);\n\tthis.addToHistory(event.navigateTo,event.navigateFromClientRect);\n\treturn false;\n};\n\n// Close a specified tiddler\nNavigatorWidget.prototype.handleCloseTiddlerEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle,\n\t\tstoryList = this.getStoryList();\n\t// Look for tiddlers with this title to close\n\tthis.removeTitleFromStory(storyList,title);\n\tthis.saveStoryList(storyList);\n\treturn false;\n};\n\n// Close all tiddlers\nNavigatorWidget.prototype.handleCloseAllTiddlersEvent = function(event) {\n\tthis.saveStoryList([]);\n\treturn false;\n};\n\n// Close other tiddlers\nNavigatorWidget.prototype.handleCloseOtherTiddlersEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle;\n\tthis.saveStoryList([title]);\n\treturn false;\n};\n\n// Place a tiddler in edit mode\nNavigatorWidget.prototype.handleEditTiddlerEvent = function(event) {\n\t// Replace the specified tiddler with a draft in edit mode\n\tvar title = event.param || event.tiddlerTitle,\n\t\tdraftTiddler = this.makeDraftTiddler(title),\n\t\tdraftTitle = draftTiddler.fields.title,\n\t\tstoryList = this.getStoryList();\n\tthis.removeTitleFromStory(storyList,draftTitle);\n\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\tthis.saveStoryList(storyList);\n\treturn false;\n};\n\n// Delete a tiddler\nNavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {\n\t// Get the tiddler we're deleting\n\tvar title = event.param || event.tiddlerTitle,\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tstoryList = this.getStoryList();\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\tvar originalTitle = tiddler.fields[\"draft.of\"];\n\t\tthis.wiki.deleteTiddler(originalTitle);\n\t\tthis.removeTitleFromStory(storyList,originalTitle);\n\t}\n\t// Delete this tiddler\n\tthis.wiki.deleteTiddler(title);\n\t// Remove the closed tiddler from the story\n\tthis.removeTitleFromStory(storyList,title);\n\tthis.saveStoryList(storyList);\n\treturn false;\n};\n\n/*\nCreate/reuse the draft tiddler for a given title\n*/\nNavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) {\n\t// See if there is already a draft tiddler for this tiddler\n\tvar drafts = [];\n\tthis.wiki.forEachTiddler({includeSystem: true},function(title,tiddler) {\n\t\tif(tiddler.fields[\"draft.title\"] && tiddler.fields[\"draft.of\"] === targetTitle) {\n\t\t\tdrafts.push(tiddler);\n\t\t}\n\t});\n\tif(drafts.length > 0) {\n\t\treturn drafts[0];\n\t}\n\t// Get the current value of the tiddler we're editing\n\tvar tiddler = this.wiki.getTiddler(targetTitle),\n\t\tdraftTitle = this.generateDraftTitle(targetTitle);\n\t// Save the initial value of the draft tiddler\n\tvar draftTiddler = new $tw.Tiddler(\n\t\t\t{text: \"Type the text for the tiddler '\" + targetTitle + \"'\"},\n\t\t\ttiddler,\n\t\t\t{\n\t\t\t\ttitle: draftTitle,\n\t\t\t\t\"draft.title\": targetTitle,\n\t\t\t\t\"draft.of\": targetTitle\n\t\t\t},\n\t\t\tthis.wiki.getModificationFields()\n\t\t);\n\tthis.wiki.addTiddler(draftTiddler);\n\treturn draftTiddler;\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.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\tvar title = event.param || event.tiddlerTitle,\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tstoryList = this.getStoryList(),\n\t\tstoryTiddlerModified = false; // We have to special case saving the story tiddler itself\n\t// Replace the original tiddler with the draft\n\tif(tiddler) {\n\t\tvar draftTitle = (tiddler.fields[\"draft.title\"] || \"\").trim(),\n\t\t\tdraftOf = (tiddler.fields[\"draft.of\"] || \"\").trim();\n\t\tif(draftTitle) {\n\t\t\tvar isRename = draftOf !== draftTitle,\n\t\t\t\tisConfirmed = true;\n\t\t\tif(isRename && this.wiki.tiddlerExists(draftTitle)) {\n\t\t\t\tisConfirmed = confirm(\"Do you wish to overwrite the tiddler '\" + draftTitle + \"'?\");\n\t\t\t}\n\t\t\tif(isConfirmed) {\n\t\t\t\t// Save the draft tiddler as the real tiddler\n\t\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,{\n\t\t\t\t\ttitle: draftTitle,\n\t\t\t\t\t\"draft.title\": undefined, \n\t\t\t\t\t\"draft.of\": undefined\n\t\t\t\t},this.wiki.getModificationFields()));\n\t\t\t\t// Remove the draft tiddler\n\t\t\t\tthis.wiki.deleteTiddler(title);\n\t\t\t\t// Remove the original tiddler if we're renaming it\n\t\t\t\tif(isRename) {\n\t\t\t\t\tthis.wiki.deleteTiddler(draftOf);\n\t\t\t\t}\n\t\t\t\t// Replace the draft in the story with the original\n\t\t\t\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\t\t\t\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\t\t\t\tif(draftTitle !== this.storyTitle) {\n\t\t\t\t\tthis.saveStoryList(storyList);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n// Take a tiddler out of edit mode without saving the changes\nNavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {\n\t// Flip the specified tiddler from draft back to the original\n\tvar draftTitle = event.param || event.tiddlerTitle,\n\t\tdraftTiddler = this.wiki.getTiddler(draftTitle),\n\t\toriginalTitle = draftTiddler.fields[\"draft.of\"],\n\t\tstoryList = this.getStoryList();\n\tif(draftTiddler && originalTitle) {\n\t\t// Remove the draft tiddler\n\t\tthis.wiki.deleteTiddler(draftTitle);\n\t\tthis.replaceFirstTitleInStory(storyList,draftTitle,originalTitle);\n\t\tthis.addToHistory(originalTitle,event.navigateFromClientRect);\n\t\tthis.saveStoryList(storyList);\n\t}\n\treturn false;\n};\n\n// Create a new draft tiddler\nNavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {\n\t// Get the story details\n\tvar storyList = this.getStoryList();\n\t// Get the template tiddler if there is one\n\tvar templateTiddler = this.wiki.getTiddler(event.param);\n\t// Create the new tiddler\n\tvar title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || \"New Tiddler\");\n\tvar tiddler = new $tw.Tiddler(this.wiki.getCreationFields(),{\n\t\ttext: \"Newly created tiddler\",\n\t\ttitle: title\n\t},this.wiki.getModificationFields());\n\tthis.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: \"\"\n\t\t},templateTiddler,{\n\t\t\ttitle: draftTitle,\n\t\t\t\"draft.title\": title,\n\t\t\t\"draft.of\": title\n\t\t},this.wiki.getModificationFields());\n\tthis.wiki.addTiddler(draftTiddler);\n\t// Update the story to insert the new draft at the top\n\tvar slot = storyList.indexOf(event.navigateFromTitle);\n\tstoryList.splice(slot + 1,0,draftTitle);\n\t// Save the updated story\n\tthis.saveStoryList(storyList);\n\t// Add a new record to the top of the history stack\n\tthis.addToHistory(draftTitle);\n\treturn false;\n};\n\n// Import JSON tiddlers\nNavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {\n\tvar self = this;\n\t// Get the story and history details\n\tvar storyList = this.getStoryList();\n\tvar history = [];\n\t// Get the tiddlers\n\tvar tiddlers = [];\n\ttry {\n\t\ttiddlers = JSON.parse(event.param);\t\n\t} catch(e) {\n\t}\n\t// Process each tiddler\n\t$tw.utils.each(tiddlers,function(tiddlerFields) {\n\t\tvar title = tiddlerFields.title;\n\t\t// Add it to the store\n\t\tvar imported = self.wiki.importTiddler(new $tw.Tiddler(\n\t\t\tself.wiki.getCreationFields(),\n\t\t\tself.wiki.getModificationFields(),\n\t\t\ttiddlerFields\n\t\t));\n\t\tif(imported) {\n\t\t\t// Add it to the story\n\t\t\tif(storyList.indexOf(title) === -1) {\n\t\t\t\tstoryList.unshift(title);\n\t\t\t}\n\t\t\t// And to history\n\t\t\thistory.push(title);\n\t\t}\n\t});\n\t// Save the updated story and history\n\tthis.saveStoryList(storyList);\n\tthis.addToHistory(history);\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\nPassword widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar PasswordWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nPasswordWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nPasswordWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Get the current password\n\tvar password = $tw.browser ? $tw.utils.getPassword(this.passwordName) || \"\" : \"\";\n\t// Create our element\n\tvar domNode = this.document.createElement(\"input\");\n\tdomNode.setAttribute(\"type\",\"password\");\n\tdomNode.setAttribute(\"value\",password);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nPasswordWidget.prototype.handleChangeEvent = function(event) {\n\tvar password = this.domNodes[0].value;\n\treturn $tw.utils.savePassword(this.passwordName,password);\n};\n\n/*\nCompute the internal state of the widget\n*/\nPasswordWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.passwordName = this.getAttribute(\"name\",\"\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nPasswordWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.password = PasswordWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/password.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/radio.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/radio.js\ntype: application/javascript\nmodule-type: widget\n\nRadio widget\n\nWill set a field to the selected value:\n\n```\n\t<$radio field=\"myfield\" value=\"check 1\">one</$radio>\n\t<$radio field=\"myfield\" value=\"check 2\">two</$radio>\n\t<$radio field=\"myfield\" value=\"check 3\">three</$radio>\n```\n\n|Parameter |Description |h\n|tiddler |Name of the tiddler in which the field should be set. Defaults to current tiddler |\n|field |The name of the field to be set |\n|value |The value to set |\n|class |Optional class name(s) |\n\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RadioWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRadioWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRadioWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our elements\n\tthis.labelDomNode = this.document.createElement(\"label\");\n\tthis.labelDomNode.setAttribute(\"class\",this.radioClass);\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"radio\");\n\tif(this.getValue() == this.radioValue) {\n\t\tthis.inputDomNode.setAttribute(\"checked\",\"true\");\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\"span\");\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.labelDomNode,nextSibling);\n\tthis.renderChildren(this.spanDomNode,null);\n\tthis.domNodes.push(this.labelDomNode);\n};\n\nRadioWidget.prototype.getValue = function() {\n\tvar tiddler = this.wiki.getTiddler(this.radioTitle);\n\treturn tiddler && tiddler.getFieldString(this.radioField);\n};\n\nRadioWidget.prototype.setValue = function() {\n\tif(this.radioField) {\n\t\tvar tiddler = this.wiki.getTiddler(this.radioTitle),\n\t\t\taddition = {};\n\t\taddition[this.radioField] = this.radioValue;\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));\n\t}\n};\n\nRadioWidget.prototype.handleChangeEvent = function(event) {\n\tif(this.inputDomNode.checked) {\n\t\tthis.setValue();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nRadioWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.radioTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.radioField = this.getAttribute(\"field\");\n\tthis.radioValue = this.getAttribute(\"value\");\n\tthis.radioClass = this.getAttribute(\"class\",\"\");\n\tif(this.radioClass !== \"\") {\n\t\tthis.radioClass += \" \";\n\t}\n\tthis.radioClass += \"tw-radio\";\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRadioWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.value || changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.radioTitle]) {\n\t\t\tthis.inputDomNode.checked = this.getValue() === this.radioValue;\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\nexports.radio = RadioWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/radio.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/raw.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/raw.js\ntype: application/javascript\nmodule-type: widget\n\nRaw widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RawWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRawWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRawWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tvar div = this.document.createElement(\"div\");\n\tdiv.innerHTML=this.parseTreeNode.html;\n\tparent.insertBefore(div,nextSibling);\n\tthis.domNodes.push(div);\t\n};\n\n/*\nCompute the internal state of the widget\n*/\nRawWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRawWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.raw = RawWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/raw.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\nReveal widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RevealWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRevealWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRevealWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar domNode = this.document.createElement(this.parseTreeNode.isBlock ? \"div\" : \"span\");\n\tvar classes = this[\"class\"].split(\" \") || [];\n\tclasses.push(\"tw-reveal\");\n\tdomNode.className = classes.join(\" \");\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tif(!domNode.isTiddlyWikiFakeDom && this.type === \"popup\" && this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\"tw-popup\"); // Make sure that clicks don't dismiss popups within the revealed content\n\t}\n\tif(!this.isOpen) {\n\t\tdomNode.setAttribute(\"hidden\",\"true\")\n\t}\n\tthis.domNodes.push(domNode);\n};\n\nRevealWidget.prototype.positionPopup = function(domNode) {\n\tdomNode.style.position = \"absolute\";\n\tdomNode.style.zIndex = \"1000\";\n\tswitch(this.position) {\n\t\tcase \"left\":\n\t\t\tdomNode.style.left = (this.popup.left - domNode.offsetWidth) + \"px\";\n\t\t\tdomNode.style.top = this.popup.top + \"px\";\n\t\t\tbreak;\n\t\tcase \"above\":\n\t\t\tdomNode.style.left = this.popup.left + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top - domNode.offsetHeight) + \"px\";\n\t\t\tbreak;\n\t\tcase \"aboveright\":\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width) + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height - domNode.offsetHeight) + \"px\";\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width) + \"px\";\n\t\t\tdomNode.style.top = this.popup.top + \"px\";\n\t\t\tbreak;\n\t\tcase \"belowleft\":\n\t\t\tdomNode.style.left = (this.popup.left + this.popup.width - domNode.offsetWidth) + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height) + \"px\";\n\t\t\tbreak;\n\t\tdefault: // Below\n\t\t\tdomNode.style.left = this.popup.left + \"px\";\n\t\t\tdomNode.style.top = (this.popup.top + this.popup.height) + \"px\";\n\t\t\tbreak;\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nRevealWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.state = this.getAttribute(\"state\");\n\tthis.type = this.getAttribute(\"type\");\n\tthis.text = this.getAttribute(\"text\");\n\tthis.position = this.getAttribute(\"position\");\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tthis[\"default\"] = this.getAttribute(\"default\",\"\");\n\tthis.animate = this.getAttribute(\"animate\",\"no\");\n\tthis.openAnimation = this.animate === \"no\" ? undefined : \"open\";\n\tthis.closeAnimation = this.animate === \"no\" ? undefined : \"close\";\n\t// Compute the title of the state tiddler and read it\n\tthis.stateTitle = this.state;\n\tthis.readState();\n\t// Construct the child widgets\n\tvar childNodes = this.isOpen ? this.parseTreeNode.children : [];\n\tthis.hasChildNodes = this.isOpen;\n\tthis.makeChildWidgets(childNodes);\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.wiki.getTextReference(this.stateTitle,this[\"default\"],this.getVariable(\"currentTiddler\"));\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\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRevealWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes[\"default\"] || changedAttributes.animate) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.stateTitle]) {\n\t\t\tthis.updateState();\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\n/*\nCalled by refresh() to dynamically show or hide the content\n*/\nRevealWidget.prototype.updateState = function() {\n\t// Read the current state\n\tthis.readState();\n\t// Construct the child nodes if needed\n\tvar domNode = this.domNodes[0];\n\tif(this.isOpen && !this.hasChildNodes) {\n\t\tthis.hasChildNodes = true;\n\t\tthis.makeChildWidgets(this.parseTreeNode.children);\n\t\tthis.renderChildren(domNode,null);\n\t}\n\t// Animate our DOM node\n\tif(!domNode.isTiddlyWikiFakeDom && this.type === \"popup\" && this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\"tw-popup\"); // Make sure that clicks don't dismiss popups within the revealed content\n\n\t}\n\tif(this.isOpen) {\n\t\tdomNode.removeAttribute(\"hidden\");\n $tw.anim.perform(this.openAnimation,domNode);\n\t} else {\n\t\t$tw.anim.perform(this.closeAnimation,domNode,{callback: function() {\n\t\t\tdomNode.setAttribute(\"hidden\",\"true\");\n }});\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/set.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/set.js\ntype: application/javascript\nmodule-type: widget\n\nSet variable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SetWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSetWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSetWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nSetWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.setName = this.getAttribute(\"name\",\"currentTiddler\");\n\tthis.setValue = this.getAttribute(\"value\");\n\t// Set context variable\n\tthis.setVariable(this.setName,this.setValue,this.parseTreeNode.params);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nSetWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name || changedAttributes.value) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.setvariable = SetWidget;\nexports.set = SetWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/set.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/text.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/text.js\ntype: application/javascript\nmodule-type: widget\n\nText node widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TextNodeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTextNodeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTextNodeWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.parseTreeNode.text);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTextNodeWidget.prototype.execute = function() {\n\t// Nothing to do for a text node\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTextNodeWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.text = TextNodeWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/text.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/core/modules/widgets/tiddler.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/tiddler.js\ntype: application/javascript\nmodule-type: widget\n\nTiddler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTiddlerWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Set context variables\n\tthis.setVariable(\"currentTiddler\",this.tiddlerTitle);\n\tthis.setVariable(\"missingTiddlerClass\",(this.wiki.tiddlerExists(this.tiddlerTitle) || this.wiki.isShadowTiddler(this.tiddlerTitle)) ? \"tw-tiddler-exists\" : \"tw-tiddler-missing\");\n\tthis.setVariable(\"shadowTiddlerClass\",this.wiki.isShadowTiddler(this.tiddlerTitle) ? \"tw-tiddler-shadow\" : \"\");\n\tthis.setVariable(\"systemTiddlerClass\",this.wiki.isSystemTiddler(this.tiddlerTitle) ? \"tw-tiddler-system\" : \"\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\t\t\n\t}\n};\n\nexports.tiddler = TiddlerWidget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/tiddler.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\nTransclude widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TranscludeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTranscludeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTranscludeWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTranscludeWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.transcludeTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.transcludeField = this.getAttribute(\"field\");\n\tthis.transcludeIndex = this.getAttribute(\"index\");\n\t// Check for recursion\n\tvar recursionMarker = this.makeRecursionMarker();;\n\tif(this.parentWidget && this.parentWidget.hasVariable(\"transclusion\",recursionMarker)) {\n\t\tthis.makeChildWidgets([{type: \"text\", text: \"Tiddler recursion error in transclude widget\"}]);\n\t\treturn;\n\t}\n\t// Set context variables for recursion detection\n\tthis.setVariable(\"transclusion\",recursionMarker);\n\t// Parse the text reference\n\tvar parser = this.wiki.parseTextReference(\n\t\t\t\t\t\tthis.transcludeTitle,\n\t\t\t\t\t\tthis.transcludeField,\n\t\t\t\t\t\tthis.transcludeIndex,\n\t\t\t\t\t\t{parseAsInline: !this.parseTreeNode.isBlock}),\n\t\tparseTreeNodes = parser ? parser.tree : [];\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nCompose a string comprising the title, field and/or index to identify this transclusion for recursion detection\n*/\nTranscludeWidget.prototype.makeRecursionMarker = function() {\n\tvar output = [];\n\toutput.push(\"{\");\n\toutput.push(this.getVariable(\"currentTiddler\",{defaultValue: \"\"}));\n\toutput.push(\"|\");\n\toutput.push(this.transcludeTitle || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeField || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeIndex || \"\");\n\toutput.push(\"}\");\n\treturn output.join(\"\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTranscludeWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedTiddlers[this.transcludeTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\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/view.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/view.js\ntype: application/javascript\nmodule-type: widget\n\nView widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ViewWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nViewWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nViewWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tif(this.text) {\n\t\tvar textNode = this.document.createTextNode(this.text);\n\t\tparent.insertBefore(textNode,nextSibling);\n\t\tthis.domNodes.push(textNode);\n\t} else {\n\t\tthis.makeChildWidgets();\n\t\tthis.renderChildren(parent,nextSibling);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nViewWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.viewTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.viewField = this.getAttribute(\"field\",\"text\");\n\tthis.viewIndex = this.getAttribute(\"index\");\n\tthis.viewFormat = this.getAttribute(\"format\",\"text\");\n\tthis.viewTemplate = this.getAttribute(\"template\",\"\");\n\tswitch(this.viewFormat) {\n\t\tcase \"htmlwikified\":\n\t\t\tthis.text = this.getValueAsHtmlWikified();\n\t\t\tbreak;\n\t\tcase \"htmlencoded\":\n\t\t\tthis.text = this.getValueAsHtmlEncoded();\n\t\t\tbreak;\n\t\tcase \"urlencoded\":\n\t\t\tthis.text = this.getValueAsUrlEncoded();\n\t\t\tbreak;\n\t\tcase \"doubleurlencoded\":\n\t\t\tthis.text = this.getValueAsDoubleUrlEncoded();\n\t\t\tbreak;\n\t\tcase \"date\":\n\t\t\tthis.text = this.getValueAsDate(this.viewTemplate);\n\t\t\tbreak;\n\t\tcase \"relativedate\":\n\t\t\tthis.text = this.getValueAsRelativeDate();\n\t\t\tbreak;\n\t\tcase \"stripcomments\":\n\t\t\tthis.text = this.getValueAsStrippedComments();\n\t\t\tbreak;\n\t\tcase \"jsencoded\":\n\t\t\tthis.text = this.getValueAsJsEncoded();\n\t\t\tbreak;\n\t\tdefault: // \"text\"\n\t\t\tthis.text = this.getValueAsText();\n\t\t\tbreak;\n\t}\n};\n\n/*\nThe various formatter functions are baked into this widget for the moment. Eventually they will be replaced by macro functions\n*/\n\nViewWidget.prototype.getValue = function() {\n\t// Get the value to display\n\tvar value,\n\t\ttiddler = this.wiki.getTiddler(this.viewTitle);\n\tif(tiddler) {\n\t\tif(this.viewField === \"text\") {\n\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\tvalue = this.wiki.getTiddlerText(this.viewTitle);\n\t\t} else {\n\t\t\tif($tw.utils.hop(tiddler.fields,this.viewField)) {\n\t\t\t\tvalue = tiddler.fields[this.viewField];\t\t\t\t\n\t\t\t} else {\n\t\t\t\tvalue = \"\";\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(this.viewField === \"title\") {\n\t\t\tvalue = this.viewTitle;\n\t\t} else {\n\t\t\tvalue = undefined;\n\t\t}\n\t}\n\treturn value;\n};\n\nViewWidget.prototype.getValueAsText = function() {\n\t// Get the value to display\n\tvar text,\n\t\ttiddler = this.wiki.getTiddler(this.viewTitle);\n\tif(tiddler) {\n\t\tif(this.viewField === \"text\") {\n\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\ttext = this.wiki.getTiddlerText(this.viewTitle);\n\t\t} else {\n\t\t\ttext = tiddler.getFieldString(this.viewField);\n\t\t}\n\t} else { // Use a special value if the tiddler is missing\n\t\tif(this.viewField === \"title\") {\n\t\t\ttext = this.viewTitle;\n\t\t} else {\n\t\t\ttext = \"\";\n\t\t}\n\t}\n\treturn text;\n};\n\nViewWidget.prototype.getValueAsHtmlWikified = function() {\n\treturn this.wiki.renderText(\"text/html\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{parentWidget: this});\n};\n\nViewWidget.prototype.getValueAsHtmlEncoded = function() {\n\treturn $tw.utils.htmlEncode(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsUrlEncoded = function() {\n\treturn encodeURIComponent(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsDoubleUrlEncoded = function() {\n\treturn encodeURIComponent(encodeURIComponent(this.getValueAsText()));\n};\n\nViewWidget.prototype.getValueAsDate = function(format) {\n\tformat = format || \"YYYY MM DD 0hh:0mm\";\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\treturn $tw.utils.formatDateString(value,format);\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\nViewWidget.prototype.getValueAsRelativeDate = function(format) {\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\treturn $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\nViewWidget.prototype.getValueAsStrippedComments = function() {\n\tvar lines = this.getValueAsText().split(\"\\n\"),\n\t\tout = [];\n\tfor(var line=0; line<lines.length; line++) {\n\t\tvar text = lines[line];\n\t\tif(!/^\\s*\\/\\/#/.test(text)) {\n\t\t\tout.push(text);\n\t\t}\n\t}\n\treturn out.join(\"\\n\");\n};\n\nViewWidget.prototype.getValueAsJsEncoded = function() {\n\treturn $tw.utils.stringify(this.getValueAsText());\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nViewWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.template || changedAttributes.format || changedTiddlers[this.viewTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\t\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/widget.js": { | |
"text": "/*\\\ntitle: $:/core/modules/widgets/widget.js\ntype: application/javascript\nmodule-type: widget\n\nWidget base class\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreate a widget object for a parse tree node\n\tparseTreeNode: reference to the parse tree node to be rendered\n\toptions: see below\nOptions include:\n\twiki: mandatory reference to wiki associated with this render tree\n\tvariables: optional hashmap of context variables (see below)\n\tparentWidget: 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\tcurrentTiddler: title of the tiddler providing the context\n*/\nvar Widget = function(parseTreeNode,options) {\n\tif(arguments.length > 0) {\n\t\tthis.initialise(parseTreeNode,options);\n\t}\n};\n\n/*\nInitialise widget properties. These steps are pulled out of the constructor so that we can reuse them in subclasses\n*/\nWidget.prototype.initialise = function(parseTreeNode,options) {\n\toptions = options || {};\n\t// Save widget info\n\tthis.parseTreeNode = parseTreeNode;\n\tthis.wiki = options.wiki;\n\tthis.parentWidget = options.parentWidget;\n\tthis.variablesConstructor = function() {};\n\tthis.variablesConstructor.prototype = this.parentWidget ? this.parentWidget.variables : {};\n\tthis.variables = new this.variablesConstructor();\n\tthis.document = options.document;\n\tthis.attributes = {};\n\tthis.children = [];\n\tthis.domNodes = [];\n\tthis.eventListeners = {};\n\t// Hashmap of the widget classes\n\tif(!this.widgetClasses) {\n\t\tWidget.prototype.widgetClasses = $tw.modules.applyMethods(\"widget\");\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nWidget.prototype.execute = function() {\n\tthis.makeChildWidgets();\n};\n\n/*\nSet the value of a context variable\nname: name of the variable\nvalue: value of the variable\nparams: array of {name:, default:} for each parameter\n*/\nWidget.prototype.setVariable = function(name,value,params) {\n\tthis.variables[name] = {value: value, params: params};\n};\n\n/*\nGet the prevailing value of a context variable\nname: name of variable\noptions: see below\nOptions include\nparams: array of {name:, value:} for each parameter\ndefaultValue: default value if the variable is not defined\n*/\nWidget.prototype.getVariable = function(name,options) {\n\toptions = options || {};\n\tvar actualParams = options.params || [];\n\t// If the variable doesn't exist then look for a macro module\n\tif(!(name in this.variables)) {\n\t\treturn this.evaluateMacroModule(name,actualParams,options.defaultValue);\n\t}\n\tvar variable = this.variables[name],\n\t\tvalue = variable.value || \"\";\n\t// Substitute any parameters specified in the definition\n\tvalue = this.substituteVariableParameters(value,variable.params,actualParams);\n\tvalue = this.substituteVariableReferences(value);\n\treturn value;\n};\n\nWidget.prototype.substituteVariableParameters = function(text,formalParams,actualParams) {\n\tif(formalParams) {\n\t\tvar nextAnonParameter = 0, // Next candidate anonymous parameter in macro call\n\t\t\tparamInfo, paramValue;\n\t\t// Step through each of the parameters in the macro definition\n\t\tfor(var p=0; p<formalParams.length; p++) {\n\t\t\t// Check if we've got a macro call parameter with the same name\n\t\t\tparamInfo = formalParams[p];\n\t\t\tparamValue = undefined;\n\t\t\tfor(var m=0; m<actualParams.length; m++) {\n\t\t\t\tif(actualParams[m].name === paramInfo.name) {\n\t\t\t\t\tparamValue = actualParams[m].value;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If not, use the next available anonymous macro call parameter\n\t\t\twhile(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {\n\t\t\t\tnextAnonParameter++;\n\t\t\t}\n\t\t\tif(paramValue === undefined && nextAnonParameter < actualParams.length) {\n\t\t\t\tparamValue = actualParams[nextAnonParameter++].value;\n\t\t\t}\n\t\t\t// If we've still not got a value, use the default, if any\n\t\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t\t// Replace any instances of this parameter\n\t\t\ttext = text.replace(new RegExp(\"\\\\$\" + $tw.utils.escapeRegExp(paramInfo.name) + \"\\\\$\",\"mg\"),paramValue);\n\t\t}\n\t}\n\treturn text;\n};\n\nWidget.prototype.substituteVariableReferences = function(text) {\n\tvar self = this;\n\treturn text.replace(/\\$\\(([^\\)\\$]+)\\)\\$/g,function(match,p1,offset,string) {\n\t\treturn self.getVariable(p1,{defaultValue: \"\"});\n\t});\n};\n\nWidget.prototype.evaluateMacroModule = function(name,actualParams,defaultValue) {\n\tif($tw.utils.hop($tw.macros,name)) {\n\t\tvar macro = $tw.macros[name],\n\t\t\targs = [];\n\t\tif(macro.params.length > 0) {\n\t\t\tvar nextAnonParameter = 0, // Next candidate anonymous parameter in macro call\n\t\t\t\tparamInfo, paramValue;\n\t\t\t// Step through each of the parameters in the macro definition\n\t\t\tfor(var p=0; p<macro.params.length; p++) {\n\t\t\t\t// Check if we've got a macro call parameter with the same name\n\t\t\t\tparamInfo = macro.params[p];\n\t\t\t\tparamValue = undefined;\n\t\t\t\tfor(var m=0; m<actualParams.length; m++) {\n\t\t\t\t\tif(actualParams[m].name === paramInfo.name) {\n\t\t\t\t\t\tparamValue = actualParams[m].value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If not, use the next available anonymous macro call parameter\n\t\t\t\twhile(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {\n\t\t\t\t\tnextAnonParameter++;\n\t\t\t\t}\n\t\t\t\tif(paramValue === undefined && nextAnonParameter < actualParams.length) {\n\t\t\t\t\tparamValue = actualParams[nextAnonParameter++].value;\n\t\t\t\t}\n\t\t\t\t// If we've still not got a value, use the default, if any\n\t\t\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t\t\t// Save the parameter\n\t\t\t\targs.push(paramValue);\n\t\t\t}\n\t\t}\n\t\telse for(var i=0; i<actualParams.length; ++i) {\n\t\t\targs.push(actualParams[i].value);\n\t\t}\n\t\treturn macro.run.apply(this,args)\n\t} else {\n\t\treturn defaultValue;\n\t}\n};\n\n/*\nCheck whether a given context variable value exists in the parent chain\n*/\nWidget.prototype.hasVariable = function(name,value) {\n\tvar node = this;\n\twhile(node) {\n\t\tif($tw.utils.hop(node.variables,name) && node.variables[name].value === value) {\n\t\t\treturn true;\n\t\t}\n\t\tnode = node.parentWidget;\n\t}\n\treturn false;\n};\n\n/*\nConstruct a qualifying string based on a hash of concatenating the values of a given variable in the parent chain\n*/\nWidget.prototype.getStateQualifier = function(name) {\n\tname = name || \"transclusion\";\n\tvar output = [],\n\t\tnode = this;\n\twhile(node) {\n\t\tif($tw.utils.hop(node.variables,name)) {\n\t\t\toutput.push(node.getVariable(name));\n\t\t}\n\t\tnode = node.parentWidget;\n\t}\n\treturn \"{\" + $tw.utils.hashString(output.join(\"\")) + \"}\";\n};\n\n/*\nCompute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed\n*/\nWidget.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.wiki.getTextReference(attribute.textReference,\"\",self.getVariable(\"currentTiddler\"));\n\t\t} else if(attribute.type === \"macro\") {\n\t\t\tvalue = self.getVariable(attribute.value.name,{params: attribute.value.params});\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\n/*\nCheck for the presence of an attribute\n*/\nWidget.prototype.hasAttribute = function(name) {\n\treturn $tw.utils.hop(this.attributes,name);\n};\n\n/*\nGet the value of an attribute\n*/\nWidget.prototype.getAttribute = function(name,defaultText) {\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\treturn this.attributes[name];\n\t} else {\n\t\treturn defaultText;\n\t}\n};\n\n/*\nAssign the computed attributes of the widget to a domNode\n*/\nWidget.prototype.assignAttributes = function(domNode) {\n\tvar self = this;\n\t$tw.utils.each(this.attributes,function(v,a) {\n\t\tif(v !== undefined) {\n\t\t\t// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)\n\t\t\ttry {\n\t\t\t\tdomNode.setAttributeNS(null,a,v);\n\t\t\t} catch(e) {\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nMake child widgets correspondng to specified parseTreeNodes\n*/\nWidget.prototype.makeChildWidgets = function(parseTreeNodes) {\n\tthis.children = [];\n\tvar self = this;\n\t$tw.utils.each(parseTreeNodes || (this.parseTreeNode && this.parseTreeNode.children),function(childNode) {\n\t\tself.children.push(self.makeChildWidget(childNode));\n\t});\n};\n\n/*\nConstruct the widget object for a parse tree node\n*/\nWidget.prototype.makeChildWidget = function(parseTreeNode) {\n\tvar WidgetClass = this.widgetClasses[parseTreeNode.type];\n\tif(!WidgetClass) {\n\t\tWidgetClass = this.widgetClasses[\"text\"];\n\t\tparseTreeNode = {type: \"text\", text: \"Undefined widget '\" + parseTreeNode.type + \"'\"};\n\t}\n\treturn new WidgetClass(parseTreeNode,{\n\t\twiki: this.wiki,\n\t\tvariables: {},\n\t\tparentWidget: this,\n\t\tdocument: this.document\n\t});\n};\n\n/*\nGet the next sibling of this widget\n*/\nWidget.prototype.nextSibling = function() {\n\tif(this.parentWidget) {\n\t\tvar index = this.parentWidget.children.indexOf(this);\n\t\tif(index !== -1 && index < this.parentWidget.children.length-1) {\n\t\t\treturn this.parentWidget.children[index+1];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nGet the previous sibling of this widget\n*/\nWidget.prototype.previousSibling = function() {\n\tif(this.parentWidget) {\n\t\tvar index = this.parentWidget.children.indexOf(this);\n\t\tif(index !== -1 && index > 0) {\n\t\t\treturn this.parentWidget.children[index-1];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRender the children of this widget into the DOM\n*/\nWidget.prototype.renderChildren = function(parent,nextSibling) {\n\t$tw.utils.each(this.children,function(childWidget) {\n\t\tchildWidget.render(parent,nextSibling);\n\t});\n};\n\n/*\nAdd a list of event listeners from an array [{type:,handler:},...]\n*/\nWidget.prototype.addEventListeners = function(listeners) {\n\tvar self = this;\n\t$tw.utils.each(listeners,function(listenerInfo) {\n\t\tself.addEventListener(listenerInfo.type,listenerInfo.handler);\t\t\n\t});\n};\n\n/*\nAdd an event listener\n*/\nWidget.prototype.addEventListener = function(type,handler) {\n\tvar self = this;\n\tif(typeof handler === \"string\") { // The handler is a method name on this widget\n\t\tthis.eventListeners[type] = function(event) {\n\t\t\treturn self[handler].call(self,event);\n\t\t};\n\t} else { // The handler is a function\n\t\tthis.eventListeners[type] = function(event) {\n\t\t\treturn handler.call(self,event);\n\t\t}\n\n\t}\n};\n\n/*\nDispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget\n*/\nWidget.prototype.dispatchEvent = function(event) {\n\t// Dispatch the event if this widget handles it\n\tvar listener = this.eventListeners[event.type];\n\tif(listener) {\n\t\t// Don't propagate the event if the listener returned false\n\t\tif(!listener(event)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Dispatch the event to the parent widget\n\tif(this.parentWidget) {\n\t\treturn this.parentWidget.dispatchEvent(event);\n\t}\n\treturn true;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nRebuild a previously rendered widget\n*/\nWidget.prototype.refreshSelf = function() {\n\tvar nextSibling = this.findNextSiblingDomNode();\n\tthis.removeChildDomNodes();\n\tthis.render(this.parentDomNode,nextSibling);\n};\n\n/*\nRefresh all the children of a widget\n*/\nWidget.prototype.refreshChildren = function(changedTiddlers) {\n\tvar self = this,\n\t\trefreshed = false;\n\t$tw.utils.each(this.children,function(childWidget) {\n\t\trefreshed = childWidget.refresh(changedTiddlers) || refreshed;\n\t});\n\treturn refreshed;\n};\n\n/*\nFind the next sibling in the DOM to this widget. This is done by scanning the widget tree through all next siblings and their descendents that share the same parent DOM node\n*/\nWidget.prototype.findNextSiblingDomNode = function(startIndex) {\n\t// Refer to this widget by its index within its parents children\n\tvar parent = this.parentWidget,\n\t\tindex = startIndex !== undefined ? startIndex : parent.children.indexOf(this);\nif(index === -1) {\n\tthrow \"node not found in parents children\";\n}\n\t// Look for a DOM node in the later siblings\n\twhile(++index < parent.children.length) {\n\t\tvar domNode = parent.children[index].findFirstDomNode();\n\t\tif(domNode) {\n\t\t\treturn domNode;\n\t\t}\n\t}\n\t// Go back and look for later siblings of our parent if it has the same parent dom node\n\tvar grandParent = parent.parentWidget;\n\tif(grandParent && parent.parentDomNode === this.parentDomNode) {\n\t\tindex = grandParent.children.indexOf(parent);\n\t\treturn parent.findNextSiblingDomNode(index);\n\t}\n\treturn null;\n};\n\n/*\nFind the first DOM node generated by a widget or its children\n*/\nWidget.prototype.findFirstDomNode = function() {\n\t// Return the first dom node of this widget, if we've got one\n\tif(this.domNodes.length > 0) {\n\t\treturn this.domNodes[0];\n\t}\n\t// Otherwise, recursively call our children\n\tfor(var t=0; t<this.children.length; t++) {\n\t\tvar domNode = this.children[t].findFirstDomNode();\n\t\tif(domNode) {\n\t\t\treturn domNode;\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRemove any DOM nodes created by this widget or its children\n*/\nWidget.prototype.removeChildDomNodes = function() {\n\t// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case \n\tif(this.domNodes.length > 0) {\n\t\t$tw.utils.each(this.domNodes,function(domNode) {\n\t\t\tdomNode.parentNode.removeChild(domNode);\n\t\t});\n\t\tthis.domNodes = [];\n\t} else {\n\t\t// Otherwise, ask the child widgets to delete their DOM nodes\n\t\t$tw.utils.each(this.children,function(childWidget) {\n\t\t\tchildWidget.removeChildDomNodes();\n\t\t});\n\t}\n};\n\nexports.widget = Widget;\n\n})();\n", | |
"title": "$:/core/modules/widgets/widget.js", | |
"type": "application/javascript", | |
"module-type": "widget" | |
}, | |
"$:/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 last 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 incremented 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 are automatically cleared when a tiddler is modified or deleted\n* `globalCache` is a hashmap by cache name of cache objects that are cleared whenever any tiddler change occurs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nvar USER_NAME_TITLE = \"$:/status/UserName\";\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},this.getModificationFields()));\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,this.getModificationFields()));\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,this.getModificationFields()));\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.clearGlobalCache();\n\tthis.enqueueTiddlerEvent(title,true);\n};\n\nexports.tiddlerExists = function(title) {\n\treturn !!this.tiddlers[title];\n};\n\n/*\nGenerate an unused title from the specified base\n*/\nexports.generateNewTitle = function(baseTitle) {\n\tvar c = 0,\n\t title = baseTitle;\n\twhile(this.tiddlerExists(title)) {\n\t\ttitle = baseTitle + \" \" + (++c);\n\t};\n\treturn 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\tif(title) {\n\t\tthis.tiddlers[title] = tiddler;\n\t\tthis.clearCache(title);\n\t\tthis.clearGlobalCache();\n\t\tthis.enqueueTiddlerEvent(title);\n\t}\n};\n\n/*\nLike addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported\n*/\nexports.importTiddler = function(tiddler) {\n\tvar existingTiddler = this.getTiddler(tiddler.fields.title);\n\t// Check if we're dealing with a plugin\n\tif(tiddler && tiddler.hasField(\"plugin-type\") && tiddler.hasField(\"version\") && existingTiddler && existingTiddler.hasField(\"plugin-type\") && existingTiddler.hasField(\"version\")) {\n\t\t// Reject the incoming plugin if it is older\n\t\tif($tw.utils.checkVersions(existingTiddler.fields.version,tiddler.fields.version)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Fall through to adding the tiddler\n\tthis.addTiddler(tiddler);\n\treturn true;\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is created\n*/\nexports.getCreationFields = function() {\n\tvar fields = {\n\t\t\tcreated: new Date()\n\t\t},\n\t\tcreator = this.getTiddlerText(USER_NAME_TITLE);\n\tif(creator) {\n\t\tfields.creator = creator;\n\t}\n\treturn fields;\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is modified\n*/\nexports.getModificationFields = function() {\n\tvar fields = {},\n\t\tmodifier = this.getTiddlerText(USER_NAME_TITLE);\n\tfields.modified = new Date();\n\tif(modifier) {\n\t\tfields.modifier = modifier;\n\t}\n\treturn fields;\n};\n\n/*\nReturn a sorted array of tiddler titles. Options include:\nsortField: field to sort by\nexcludeTag: tag to exclude\nincludeSystem: whether to include system tiddlers (defaults to false)\n*/\nexports.getTiddlers = function(options) {\n\toptions = options || {};\n\tvar self = this,\n\t\tsortField = options.sortField || \"title\",\n\t\ttiddlers = [], t, titles = [];\n\tfor(t in this.tiddlers) {\n\t\tif($tw.utils.hop(this.tiddlers,t)) {\n\t\t\tif(options.includeSystem || !this.isSystemTiddler(t)) {\n\t\t\t\tif(!options.excludeTag || !this.tiddlers[t].hasTag(excludeTag)) {\n\t\t\t\t\ttiddlers.push(this.tiddlers[t]);\n\t\t\t\t}\n\t\t\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({excludeTag: 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,isNumeric) {\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(!isNumeric || isNaN(a) || isNaN(b)) {\n\t\t\tif(!isCaseSensitive) {\n\t\t\t\tif(typeof a === \"string\") {\n\t\t\t\t\ta = a.toLowerCase();\n\t\t\t\t}\n\t\t\t\tif(typeof b === \"string\") {\n\t\t\t\t\tb = b.toLowerCase();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\ta-= 0;\n\t\t\tb-= 0;\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\n/*\nFor every tiddler invoke a callback(title,tiddler) with `this` set to the wiki object. Options include:\nsortField: field to sort by\nexcludeTag: tag to exclude\nincludeSystem: whether to include system tiddlers (defaults to false)\n*/\nexports.forEachTiddler = function(/* [options,]callback */) {\n\tvar arg = 0,\n\t\toptions = arguments.length >= 2 ? arguments[arg++] : {},\n\t\tcallback = arguments[arg++],\n\t\ttitles = this.getTiddlers(options),\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 === \"link\" && parseTreeNode.attributes.to && 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 self = this;\n\treturn this.getGlobalCache(\"taglist-\" + tag,function() {\n\t\tvar tagmap = self.getTagMap();\n\t\treturn self.sortByList(tagmap[tag],tag);\n\t});\n};\n\n/*\nGet a hashmap by tag of arrays of tiddler titles\n*/\nexports.getTagMap = function() {\n\tvar self = this;\n\treturn this.getGlobalCache(\"tagmap\",function() {\n\t\tvar tags = {};\n\t\t// Collect up all the tags\n\t\tfor(var title in self.tiddlers) {\n\t\t\tvar tiddler = self.tiddlers[title];\n\t\t\tif(tiddler.fields.tags) {\n\t\t\t\tfor(var index=0; index<tiddler.fields.tags.length; index++) {\n\t\t\t\t\tvar tag = tiddler.fields.tags[index];\n\t\t\t\t\tif(tags[tag]) {\n\t\t\t\t\t\ttags[tag].push(title)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttags[tag] = [title];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn tags;\n\t});\n};\n\n/*\nLookup a given tiddler and return a list of all the tiddlers that include it in their list\n*/\nexports.findListingsOfTiddler = function(targetTitle) {\n\t// Get the list associated with the tag\n\tvar titles = [];\n\tfor(var title in this.tiddlers) {\n\t\tvar tiddler = this.tiddlers[title];\n\t\tif($tw.utils.isArray(tiddler.fields.list) && tiddler.fields.list.indexOf(targetTitle) !== -1) {\n\t\t\ttitles.push(title);\n\t\t}\n\t}\n\treturn titles;\n};\n\n/*\nSorts an array of tiddler titles according to an ordered list\n*/\nexports.sortByList = function(array,listTitle) {\n\tvar list = this.getTiddlerList(listTitle);\n\tif(!array || array.length === 0) {\n\t\treturn [];\n\t} else if(list) {\n\t\tvar titles = [], t, title;\n\t\t// First place any entries that are present in the list\n\t\tfor(t=0; t<list.length; t++) {\n\t\t\ttitle = list[t];\n\t\t\tif(array.indexOf(title) !== -1) {\n\t\t\t\ttitles.push(title);\n\t\t\t}\n\t\t}\n\t\t// Then place any remaining entries\n\t\tfor(t=0; t<array.length; t++) {\n\t\t\ttitle = array[t];\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\ttitles.push(title);\n\t\t\t}\n\t\t}\n\t\treturn titles;\n\t} else {\n\t\treturn array;\n\t}\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)},this.getModificationFields()));\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 && $tw.utils.isArray(tiddler.fields.list)) {\n\t\treturn tiddler.fields.list.slice(0);\n\t}\n\treturn [];\n};\n\n// Return a named global cache object. Global cache objects are cleared whenever a tiddler change occurs\nexports.getGlobalCache = function(cacheName,initializer) {\n\tthis.globalCache = this.globalCache || {};\n\tif($tw.utils.hop(this.globalCache,cacheName)) {\n\t\treturn this.globalCache[cacheName];\n\t} else {\n\t\tthis.globalCache[cacheName] = initializer();\n\t\treturn this.globalCache[cacheName];\n\t}\n};\n\nexports.clearGlobalCache = function() {\n\tthis.globalCache = {};\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\n// Temporarily disable caching so that tweakParseTreeNode() works\nreturn initializer();\n\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.old_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.old_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.old_parseText(tiddler.fields.type,tiddler.fields.text,options);\n\t\t}) : null;\n};\n\n// We need to tweak parse trees generated by the existing parser because of the change from {type:\"element\",tag:\"$tiddler\",...} to {type:\"tiddler\",...}\nvar tweakParseTreeNode = function(node) {\n\tif(node.type === \"element\" && node.tag.charAt(0) === \"$\") {\n\t\tnode.type = node.tag.substr(1);\n\t\tdelete node.tag;\n\t}\n\ttweakParseTreeNodes(node.children);\n};\n\nvar tweakParseTreeNodes = function(nodeList) {\n\t$tw.utils.each(nodeList,tweakParseTreeNode);\n};\n\nvar tweakMacroDefinition = function(nodeList) {\n\tif(nodeList && nodeList[0] && nodeList[0].type === \"macrodef\") {\n\t\tnodeList[0].type = \"set\";\n\t\tnodeList[0].attributes = {\n\t\t\tname: {type: \"string\", value: nodeList[0].name},\n\t\t\tvalue: {type: \"string\", value: nodeList[0].text}\n\t\t};\n\t\tnodeList[0].children = nodeList.slice(1);\n\t\tnodeList.splice(1,nodeList.length-1);\n\t\ttweakMacroDefinition(nodeList[0].children);\n\t}\n};\n\nvar tweakParser = function(parser) {\n\t// Move any macro definitions to contain the body tree\n\ttweakMacroDefinition(parser.tree);\n\t// Tweak widgets\n\ttweakParseTreeNodes(parser.tree);\n};\n\nexports.parseText = function(type,text,options) {\n\tvar parser = this.old_parseText(type,text,options);\n\tif(parser) {\n\t\ttweakParser(parser)\n\t};\n\treturn parser;\n};\n\nexports.parseTiddler = function(title,options) {\n\tvar parser = this.old_parseTiddler(title,options);\n\tif(parser) {\n\t\ttweakParser(parser)\n\t};\n\treturn parser;\n};\n\nexports.parseTextReference = function(title,field,index,options) {\n\tif(field === \"text\" || (!field && !index)) {\n\t\t// Force the tiddler to be lazily loaded\n\t\tthis.getTiddlerText(title);\n\t\t// Parse it\n\t\treturn this.parseTiddler(title,options);\n\t} else {\n\t\tvar tiddler,text;\n\t\tif(field) {\n\t\t\ttiddler = this.getTiddler(title);\n\t\t\ttext = tiddler ? tiddler.fields[field] : \"\";\n\t\t\tif(text === undefined) {\n\t\t\t\ttext = \"\";\n\t\t\t}\n\t\t\treturn this.parseText(\"text/vnd.tiddlywiki\",text.toString(),options);\n\t\t} else if(index) {\n\t\t\ttext = this.extractTiddlerDataItem(title,index,\"\");\n\t\t\treturn this.parseText(\"text/vnd.tiddlywiki\",text,options);\n\t\t}\n\t}\n};\n\n/*\nMake a widget tree for a parse tree\nparser: parser object\noptions: see below\nOptions include:\ndocument: optional document to use\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.makeWidget = function(parser,options) {\n\toptions = options || {};\n\tvar widgetNode = {\n\t\t\ttype: \"widget\",\n\t\t\tchildren: []\n\t\t},\n\t\tcurrWidgetNode = widgetNode;\n\t// Create set variable widgets for each variable\n\t$tw.utils.each(options.variables,function(value,name) {\n\t\tvar setVariableWidget = {\n\t\t\ttype: \"set\",\n\t\t\tattributes: {\n\t\t\t\tname: {type: \"string\", value: name},\n\t\t\t\tvalue: {type: \"string\", value: value}\n\t\t\t},\n\t\t\tchildren: []\n\t\t};\n\t\tcurrWidgetNode.children = [setVariableWidget];\n\t\tcurrWidgetNode = setVariableWidget;\n\t});\n\t// Add in the supplied parse tree nodes\n\tcurrWidgetNode.children = parser ? parser.tree : [];\n\t// Create the widget\n\treturn new widget.widget(widgetNode,{\n\t\twiki: this,\n\t\tdocument: options.document || $tw.document,\n\t\tparentWidget: options.parentWidget\n\t});\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\toptions: see below\nOptions include:\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.renderText = function(outputType,textType,text,options) {\n\toptions = options || {};\n\tvar parser = this.parseText(textType,text,options),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.document.createElement(\"div\");\n\twidgetNode.render(container,null);\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\toptions: see below\nOptions include:\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.renderTiddler = function(outputType,title,options) {\n\toptions = options || {};\n\tvar parser = this.parseTiddler(title),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.document.createElement(\"div\");\n\twidgetNode.render(container,null);\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\tmethod: \"save\" or \"download\"\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 method = options.method || \"save\",\n\t\ttemplate = options.template || \"$:/core/save/all\",\n\t\tdownloadType = options.downloadType || \"text/plain\";\n\tvar text = this.renderTiddler(downloadType,template);\n\tthis.callSaver(\"save\",text,method,function(err) {\n\t\tif(err) {\n\t\t\talert(\"Error while saving:\\n\\n\" + err);\n\t\t} else {\n\t\t\t$tw.notifier.display(\"$:/messages/Saved\");\n\t\t}\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\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [new RegExp(\"(\" + $tw.utils.escapeRegExp(text) + \")\",flags)];\n\t\t}\n\t} else {\n\t\tterms = text.split(/ +/);\n\t\tif(terms.length === 1 && terms[0] === \"\") {\n\t\t\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [];\n\t\t\tfor(t=0; t<terms.length; t++) {\n\t\t\t\tsearchTermsRegExps.push(new RegExp(\"(\" + $tw.utils.escapeRegExp(terms[t]) + \")\",flags));\n\t\t\t}\n\t\t}\n\t}\n\t// Function to check a given tiddler for the search term\n\tvar searchTiddler = function(title) {\n\t\tif(!searchTermsRegExps) {\n\t\t\treturn true;\n\t\t}\n\t\tvar tiddler = self.getTiddler(title);\n\t\tif(!tiddler) {\n\t\t\ttiddler = new $tw.Tiddler({title: title, text: \"\", type: \"text/vnd.tiddlywiki\"});\n\t\t}\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type] || $tw.config.contentTypeInfo[\"text/vnd.tiddlywiki\"],\n\t\t\tmatch;\n\t\tfor(var t=0; t<searchTermsRegExps.length; t++) {\n\t\t\t// Search title, tags and body\n\t\t\tmatch = false;\n\t\t\tif(contentTypeInfo.encoding === \"utf8\") {\n\t\t\t\tmatch = match || searchTermsRegExps[t].test(tiddler.fields.text);\n\t\t\t}\n\t\t\tvar tags = tiddler.fields.tags ? tiddler.fields.tags.join(\"\\0\") : \"\";\n\t\t\tmatch = match || searchTermsRegExps[t].test(tags) || searchTermsRegExps[t].test(tiddler.fields.title);\n\t\t\tif(!match) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\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]) === !options.invert) {\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) === !options.invert) {\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/*\nRead an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read\n*/\nexports.readFiles = function(files,callback) {\n\tvar result = [],\n\t\toutstanding = files.length;\n\tfor(var f=0; f<files.length; f++) {\n\t\tthis.readFile(files[f],function(tiddlerFieldsArray) {\n\t\t\tresult.push.apply(result,tiddlerFieldsArray);\n\t\t\tif(--outstanding === 0) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t});\n\t};\n};\n\n/*\nRead a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects\n*/\nexports.readFile = function(file,callback) {\n\t// Get the type, falling back to the filename extension\n\tvar self = this,\n\t\ttype = file.type;\n\tif(type === \"\" || !type) {\n\t\tvar dotPos = file.name.lastIndexOf(\".\");\n\t\tif(dotPos !== -1) {\n\t\t\tvar fileExtensionInfo = $tw.config.fileExtensionInfo[file.name.substr(dotPos)];\n\t\t\tif(fileExtensionInfo) {\n\t\t\t\ttype = fileExtensionInfo.type;\n\t\t\t}\n\t\t}\n\t}\n\t// Figure out if we're reading a binary file\n\tvar contentTypeInfo = $tw.config.contentTypeInfo[type],\n\t\tisBinary = contentTypeInfo ? contentTypeInfo.encoding === \"base64\" : false;\n\t// Create the FileReader\n\tvar reader = new FileReader();\n\t// Onload\n\treader.onload = function(event) {\n\t\t// Deserialise the file contents\n\t\tvar tiddlerFields = {title: file.name || \"Untitled\", type: type};\n\t\t// Are we binary?\n\t\tif(isBinary) {\n\t\t\t// The base64 section starts after the first comma in the data URI\n\t\t\tvar commaPos = event.target.result.indexOf(\",\");\n\t\t\tif(commaPos !== -1) {\n\t\t\t\ttiddlerFields.text = event.target.result.substr(commaPos+1);\n\t\t\t\tcallback([tiddlerFields]);\n\t\t\t}\n\t\t} else {\n\t\t\tcallback(self.deserializeTiddlers(type,event.target.result,tiddlerFields));\n\t\t}\n\t};\n\t// Kick off the read\n\tif(isBinary) {\n\t\treader.readAsDataURL(file);\n\t} else {\n\t\treader.readAsText(file);\n\t}\n};\n\n})();\n", | |
"title": "$:/core/modules/wiki.js", | |
"type": "application/javascript", | |
"module-type": "wikimethod" | |
}, | |
"$:/core/templates/MOTW.html": { | |
"title": "$:/core/templates/MOTW.html", | |
"text": "\\rules only filteredtranscludeinline transcludeinline entity\n<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension -->\n<!-- saved from url=(0021)http://tiddlywiki.com -->&#13;&#10;" | |
}, | |
"$:/core/templates/alltiddlers.content": { | |
"title": "$:/core/templates/alltiddlers.content", | |
"text": "{{{ [!is[system]sort[title]] ||$:/core/templates/static-tiddler}}}" | |
}, | |
"$:/core/templates/alltiddlers.template.html": { | |
"title": "$:/core/templates/alltiddlers.template.html", | |
"type": "text/vnd.tiddlywiki-html", | |
"text": "\\define tw-wikilink-template() #$uri_encoded$\n\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<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 id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\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 class=\"tw-body\">\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n<section class=\"story-river\">\n{{$:/core/templates/alltiddlers.content||$:/core/templates/html-tiddler}}\n</section>\n</body>\n</html>\n" | |
}, | |
"$:/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/save/all": { | |
"title": "$:/core/save/all", | |
"text": "\\define saveTiddlerFilter()\n[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n" | |
}, | |
"$:/core/save/empty": { | |
"title": "$:/core/save/empty", | |
"text": "\\define saveTiddlerFilter()\n[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n" | |
}, | |
"$:/core/templates/split-recipe": { | |
"title": "$:/core/templates/split-recipe", | |
"text": "<$list filter=\"[!is[system]]\">\ntiddler: <$view field=\"title\" format=\"urlencoded\"/>.tid\n</$list>\n" | |
}, | |
"$:/core/templates/static-tiddler": { | |
"title": "$:/core/templates/static-tiddler", | |
"text": "<a name=<<currentTiddler>>>\n<$transclude tiddler=\"$:/core/ui/ViewTemplate\"/>\n</a>" | |
}, | |
"$:/core/templates/static.area": { | |
"title": "$:/core/templates/static.area", | |
"text": "<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}\n</$reveal>\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\nThis file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted.\n</$reveal>\n" | |
}, | |
"$:/core/templates/static.content": { | |
"title": "$:/core/templates/static.content", | |
"type": "text/vnd.tiddlywiki", | |
"text": "<!-- For Google, and people without JavaScript-->\nThis [[TiddlyWiki|http://tiddlywiki.com]] contains the following tiddlers:\n\n<ul>\n<$list filter=<<saveTiddlerFilter>>>\n<li><$view field=\"title\" format=\"text\"></$view></li>\n</$list>\n</ul>\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<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 id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\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 class=\"tw-body\">\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n{{$:/core/ui/PageMacros||$:/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<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 id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<link rel=\"stylesheet\" href=\"static.css\">\n<title>`{{$:/core/wiki/title}}`</title>\n</head>\n<body class=\"tw-body\">\n`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`\n<section class=\"story-river\">\n`<$view tiddler=\"$:/core/ui/ViewTemplate\" format=\"htmlwikified\"/>`\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<$list filter=<<saveTiddlerFilter>> template=\"$:/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=<<saveTiddlerFilter>>/>\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.html": { | |
"title": "$:/core/templates/tiddlywiki5.html", | |
"text": "\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n{{$:/core/templates/MOTW.html}}<html>\n<head>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\t\t<!-- Force IE standards mode for Intranet and HTA - should be the first meta -->\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<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\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 class=\"tw-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.area}}\n</div>\n</noscript>\n<!--~~ Ordinary tiddlers ~~-->\n{{$:/core/templates/store.area.template.html}}\n<!--~~ Library modules ~~-->\n<div id=\"libraryModules\" style=\"display:none;\">\n{{{ [is[system]type[application/javascript]library[yes]] ||$:/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<!--~~ Static 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": "<$transclude />" | |
}, | |
"$:/core/ui/AdvancedSearch/Shadows": { | |
"title": "$:/core/ui/AdvancedSearch/Shadows", | |
"tags": "$:/tags/AdvancedSearch", | |
"caption": "Shadows", | |
"text": "<$linkcatcher to=\"$:/temp/advancedsearch\">\n\nSearch for shadow tiddlers:\n\n<div class=\"tw-search\"><$edit-text tiddler=\"$:/temp/advancedsearch\" type=\"search\" tag=\"input\"/><$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\"> <$link to=\"\" class=\"btn-invisible\">{{$:/core/images/close-button}}</$link></$reveal></div>\n\n</$linkcatcher>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n\n<div class=\"tw-search-results\">\n\n//<small><$count filter=\"[is[shadow]search{$:/temp/advancedsearch}]\"/> matches</small>//\n\n<$list filter=\"[is[shadow]search{$:/temp/advancedsearch}sort[title]limit[250]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n</div>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"match\" text=\"\">\n\n</$reveal>\n" | |
}, | |
"$:/core/ui/AdvancedSearch/System": { | |
"title": "$:/core/ui/AdvancedSearch/System", | |
"tags": "$:/tags/AdvancedSearch", | |
"caption": "System", | |
"text": "<$linkcatcher to=\"$:/temp/advancedsearch\">\n\nSearch for system tiddlers:\n\n<div class=\"tw-search\"><$edit-text tiddler=\"$:/temp/advancedsearch\" type=\"search\" tag=\"input\"/><$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\"> <$link to=\"\" class=\"btn-invisible\">{{$:/core/images/close-button}}</$link></$reveal></div>\n\n</$linkcatcher>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n\n<div class=\"tw-search-results\">\n\n//<small><$count filter=\"[is[system]search{$:/temp/advancedsearch}]\"/> matches</small>//\n\n<$list filter=\"[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n</div>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"match\" text=\"\">\n\n</$reveal>\n" | |
}, | |
"$:/AdvancedSearch": { | |
"title": "$:/AdvancedSearch", | |
"text": "<div class=\"tw-advanced-search\"><<tabs \"[is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] [!is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] +[tag[$:/tags/AdvancedSearch]]\" \"$:/core/ui/AdvancedSearch/System\">></div>\n" | |
}, | |
"$:/core/ui/ControlPanel/Appearance": { | |
"title": "$:/core/ui/ControlPanel/Appearance", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Appearance", | |
"text": "! Theme\n\n{{$:/snippets/themeswitcher}}\n\n! Story View\n\n{{$:/snippets/viewswitcher}}\n" | |
}, | |
"$:/core/ui/ControlPanel/Basics": { | |
"title": "$:/core/ui/ControlPanel/Basics", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Basics", | |
"text": "|TiddlyWiki version |''<<version>>'' |\n|[[Title of this TiddlyWiki|SiteTitle]] |<$edit-text tiddler=\"SiteTitle\" default=\"\" tag=\"input\"/> |\n|[[Subtitle|SiteSubtitle]] |<$edit-text tiddler=\"SiteSubtitle\" default=\"\" tag=\"input\"/> |\n|[[Username for signing edits|$:/status/UserName]] |<$edit-text tiddler=\"$:/status/UserName\" default=\"\" tag=\"input\"/> |\n|[[Animation duration|$:/config/AnimationDuration]] |<$edit-text tiddler=\"$:/config/AnimationDuration\" default=\"\" tag=\"input\"/> |\n|[[DefaultTiddlers|$:/DefaultTiddlers]] |Choose which tiddlers are displayed at startup:<br> <$edit-text tag=\"textarea\" tiddler=\"$:/DefaultTiddlers\"/><br>//Use &#91;&#91;double square brackets&#93;&#93; for titles with spaces// |\n|Tiddlers |''<$count filter=\"[!is[system]]\"/>'' |\n|System tiddlers |''<$count filter=\"[is[system]]\"/>'' |\n|Shadow tiddlers |''<$count filter=\"[is[shadow]]\"/>'' |\n|Overridden shadow tiddlers |''<$count filter=\"[!is[system]is[shadow]]\"/>'' |\n" | |
}, | |
"$:/core/ui/ControlPanel/Internals": { | |
"title": "$:/core/ui/ControlPanel/Internals", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Internals", | |
"text": "! Tiddler fields\n\nThis is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers).\n\n{{$:/snippets/allfields}}\n\n! Loaded Modules\n\nThese are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process.\n\n{{$:/snippets/modules}}\n" | |
}, | |
"$:/core/ui/ControlPanel/Plugins": { | |
"title": "$:/core/ui/ControlPanel/Plugins", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Plugins", | |
"text": "<table><tbody><tr><th>Title</th><th>Description</th><th>Version</th></tr><$list filter=\"[!has[draft.of]has[plugin-type]sort[title]]\"><tr><td><$link to={{!!title}}><$view field=\"title\"/></$link></td><td><$view field=\"description\"/></td><td><$view field=\"version\"/></td></tr></$list>\n</tbody>\n</table>\n" | |
}, | |
"$:/core/ui/ControlPanel/Saving": { | |
"title": "$:/core/ui/ControlPanel/Saving", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Saving", | |
"text": "\\define backupURL()\nhttp://$(userName)$.tiddlyspot.com/backup/\n\\end\n\\define backupLink()\n<$reveal type=\"nomatch\" state=\"$:/UploadName\" text=\"\">\n<$set name=\"userName\" value={{$:/UploadName}}>\n<a href=<<backupURL>>><$macrocall $name=\"backupURL\" $type=\"text/plain\" $output=\"text/plain\"/></a>\n</$set>\n</$reveal>\n\\end\n! TiddlySpot\n\n|[[Wiki name|$:/UploadName]] |<$edit-text tiddler=\"$:/UploadName\" default=\"\" tag=\"input\"/> |\n|Password |<$password name=\"upload\"/> |\n|Backups |<<backupLink>> |\n\n!! Advanced settings\n\n|Server URL |<$edit-text tiddler=\"$:/UploadURL\" default=\"\" tag=\"input\"/> |\n|Upload filename |<$edit-text tiddler=\"$:/UploadFilename\" default=\"index.html\" tag=\"input\"/> |\n|Upload directory |<$edit-text tiddler=\"$:/UploadDir\" default=\".\" tag=\"input\"/> |\n|Backup directory |<$edit-text tiddler=\"$:/UploadBackupDir\" default=\".\" tag=\"input\"/> |\n\n\n//The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address//\n" | |
}, | |
"$:/core/ui/ControlPanel/Tools": { | |
"title": "$:/core/ui/ControlPanel/Tools", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Tools", | |
"text": "! Import\n\n<$browse/>\n\nBrowse for files on your computer to import their contents (the individual tiddlers within TiddlyWiki HTML files are imported separately). You can also drag and drop files directly to the browser window.\n\n! Export\n\n<$button message=\"tw-download-file\" param=\"$:/core/templates/alltiddlers.template.html\" class=\"btn-big-green\">Download all tiddlers as static HTML {{$:/core/images/save-button}}</$button>\n\n! Encryption\n\n{{$:/snippets/encryptionstatus}}\n" | |
}, | |
"$:/ControlPanel": { | |
"title": "$:/ControlPanel", | |
"text": "<div class=\"tw-control-panel\"><<tabs \"[is[shadow]!has[draft.of]tag[$:/tags/ControlPanel]] [!is[shadow]!has[draft.of]tag[$:/tags/ControlPanel]] +[tag[$:/tags/ControlPanel]]\" \"$:/core/ui/ControlPanel/Basics\">></div>\n" | |
}, | |
"$:/core/ui/EditTemplate/body": { | |
"title": "$:/core/ui/EditTemplate/body", | |
"tags": "$:/tags/EditTemplate", | |
"text": "\\define prompt()\nType the text for this tiddler\n\\end\n<$reveal state=\"$:/ShowEditPreview\" type=\"match\" text=\"yes\">\n<em class=\"tw-edit\"><$transclude tiddler=\"$:/core/ui/EditorHint\"/></em> <$button type=\"set\" set=\"$:/ShowEditPreview\" setTo=\"no\">hide preview</$button>\n<div class=\"tw-tiddler-preview\">\n<div class=\"tw-tiddler-preview-preview\">\n<$transclude />\n</div>\n<div class=\"tw-tiddler-preview-edit\">\n<$edit field=\"text\" class=\"tw-edit-texteditor\" placeholder=<<prompt>>/>\n</div>\n</div>\n</$reveal>\n<$reveal state=\"$:/ShowEditPreview\" type=\"nomatch\" text=\"yes\">\n<em class=\"tw-edit\"><$transclude tiddler=\"$:/core/ui/EditorHint\"/></em> <$button type=\"set\" set=\"$:/ShowEditPreview\" setTo=\"yes\">show preview</$button>\n<$edit field=\"text\" class=\"tw-edit-texteditor\" placeholder=<<prompt>>/>\n</$reveal>\n" | |
}, | |
"$:/core/ui/EditTemplate/controls": { | |
"title": "$:/core/ui/EditTemplate/controls", | |
"tags": "$:/tags/EditTemplate", | |
"text": "<span class=\"tw-tiddler-controls titlebar\"> <$list filter=\"[is[shadow]!has[draft.of]tag[$:/tags/EditToolbar]] [!is[shadow]!has[draft.of]tag[$:/tags/EditToolbar]] +[tag[$:/tags/EditToolbar]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list> </span>\n" | |
}, | |
"$:/core/ui/EditTemplate/fields": { | |
"title": "$:/core/ui/EditTemplate/fields", | |
"tags": "$:/tags/EditTemplate", | |
"text": "<$fieldmangler><div class=\"tw-edit-fields\">\n<table class=\"tw-edit-fields\"><tbody><$list filter=\"[is[current]fields[]] -title -tags -text -creator -created -modified -modifier -type -[[draft.title]] -[[draft.of]]\" variable=\"currentField\"><tr class=\"tw-edit-field\"><td class=\"tw-edit-field-name\"><<currentField>>:</td><td class=\"tw-edit-field-value\"><$edit-text tiddler=<<currentTiddler>> field=<<currentField>> placeholder=\"field value\"/></td><td class=\"tw-edit-field-remove\"><$button message=\"tw-remove-field\" param=<<currentField>> class=\"btn-invisible\">{{$:/core/images/delete-button}}</$button></td>\n</tr>\n</$list>\n</tbody>\n</table>\n</div>\n\n<div class=\"tw-edit-field-add\"><em class=\"tw-edit\">Add a new field:</em> <span class=\"tw-edit-field-add-name\"><$edit-text tiddler=\"$:/NewFieldName\" tag=\"input\" default=\"\" placeholder=\"field name\" class=\"tw-edit-texteditor\"/></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/EditTemplate/tags": { | |
"title": "$:/core/ui/EditTemplate/tags", | |
"tags": "$:/tags/EditTemplate", | |
"text": "\\define tag-styles()\nbackground-color:$(backgroundColor)$;\n\\end\n<div class=\"tw-edit-tags\"><$fieldmangler><$list filter=\"[is[current]tags[]sort[title]]\" storyview=\"pop\"><$set name=\"backgroundColor\" value={{!!color}}><span style=<<tag-styles>> class=\"tw-tag-label\"><$view field=\"title\" format=\"text\" /><$button message=\"tw-remove-tag\" param={{!!title}} class=\"btn-invisible tw-remove-tag-button\">&times;</$button></span></$set>\n</$list>\n\n<div class=\"tw-edit-add-tag\"><span class=\"tw-add-tag-name\"><$edit-text tiddler=\"$:/NewTagName\" tag=\"input\" default=\"\" placeholder=\"tag name\" focusPopup=<<qualify \"$:/state/tagsAutoComplete\">> class=\"tw-edit-texteditor\"/></span> <$button popup=<<qualify \"$:/state/tagsAutoComplete\">> class=\"btn-invisible btn-dropdown\">{{$:/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-block-dropdown-wrapper\">\n<$reveal state=<<qualify \"$:/state/tagsAutoComplete\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tw-block-dropdown\">\n<$linkcatcher set=\"$:/NewTagName\" setTo=\"\" message=\"tw-add-tag\"><$list filter=\"[!is[shadow]tags[]search{$:/NewTagName}sort[title]]\"><$link><$set name=\"backgroundColor\" value={{!!color}}><span style=<<tag-styles>> class=\"tw-tag-label\"><$view field=\"title\" format=\"text\"/></span></$set></$link>\n</$list>\n</$linkcatcher>\n</div>\n\n</$reveal>\n</div>\n</$fieldmangler>\n</div>" | |
}, | |
"$:/core/ui/EditTemplate/title": { | |
"title": "$:/core/ui/EditTemplate/title", | |
"tags": "$:/tags/EditTemplate", | |
"text": "<$view field=\"title\"/>\n\n<$edit-text field=\"draft.title\" class=\"titlebar tw-edit-texteditor\"/>\n" | |
}, | |
"$:/core/ui/EditTemplate/type": { | |
"title": "$:/core/ui/EditTemplate/type", | |
"tags": "$:/tags/EditTemplate", | |
"text": "<p><em class=\"tw-edit\">Type:</em> <$edit-text field=\"type\" tag=\"input\" default=\"\" placeholder=\"type\" focusPopup=<<qualify \"$:/state/typeDropdown\">> class=\"tw-edit-typeeditor\"/> <$button popup=<<qualify \"$:/state/typeDropdown\">> class=\"btn-invisible btn-dropdown\">{{$:/core/images/down-arrow}}</$button></p>\n\n<div class=\"tw-block-dropdown-wrapper\">\n<$reveal state=<<qualify \"$:/state/typeDropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tw-block-dropdown tw-edit-type-dropdown\">\n<$linkcatcher to=\"!!type\">\n<$list filter=\"[is[shadow]prefix[$:/docs/types/]] [!is[shadow]prefix[$:/docs/types/]] +[sort[description]]\"><$link to={{!!name}}><$view field=\"description\"/> (<$view field=\"name\"/>)</$link>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>\n</div>" | |
}, | |
"$:/core/ui/EditTemplate": { | |
"title": "$:/core/ui/EditTemplate", | |
"text": "\\define frame-classes()\ntw-tiddler-frame tw-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$\n\\end\n<$set name=\"storyTiddler\" value=<<currentTiddler>>><div class=<<frame-classes>>><$list filter=\"[is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] +[tag[$:/tags/EditTemplate]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list></div></$set>\n" | |
}, | |
"$:/core/ui/EditToolbar/cancel": { | |
"title": "$:/core/ui/EditToolbar/cancel", | |
"tags": "$:/tags/EditToolbar", | |
"text": "<$button message=\"tw-cancel-tiddler\" class=\"btn-invisible\">{{$:/core/images/cancel-button}}</$button>" | |
}, | |
"$:/core/ui/EditToolbar/delete": { | |
"title": "$:/core/ui/EditToolbar/delete", | |
"tags": "$:/tags/EditToolbar", | |
"text": "<$button message=\"tw-delete-tiddler\" class=\"btn-invisible\">{{$:/core/images/delete-button}}</$button>" | |
}, | |
"$:/core/ui/EditToolbar/save": { | |
"title": "$:/core/ui/EditToolbar/save", | |
"tags": "$:/tags/EditToolbar", | |
"text": "<$button message=\"tw-save-tiddler\" class=\"btn-invisible\">{{$:/core/images/done-button}}</$button>" | |
}, | |
"$:/core/ui/EditorHint": { | |
"title": "$:/core/ui/EditorHint", | |
"text": "Use WikiText to add formatting, images, and dynamic features" | |
}, | |
"$:/core/ui/ListItemTemplate": { | |
"title": "$:/core/ui/ListItemTemplate", | |
"text": "<div class=\"tw-menu-list-item\"><$link to={{!!title}}><$view field=\"title\"/></$link>\n</div>" | |
}, | |
"$:/core/ui/MissingTemplate": { | |
"title": "$:/core/ui/MissingTemplate", | |
"text": "<div class=\"tw-tiddler-missing\"><$button popup=<<qualify \"$:/state/missingpopup\">> class=\"btn-invisible tw-missing-tiddler-label\"><$view field=\"title\" format=\"text\" /></$button>\n<$reveal state=<<qualify \"$:/state/missingpopup\">> type=\"popup\" position=\"below\" animate=\"yes\"><div class=\"tw-drop-down\">\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n<hr>\n<$list filter=\"[is[current]backlinks[]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div></$reveal></div>\n" | |
}, | |
"$:/core/ui/MoreSideBar/All": { | |
"title": "$:/core/ui/MoreSideBar/All", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "All", | |
"text": "<$list filter=\"[!is[system]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/MoreSideBar/Drafts": { | |
"title": "$:/core/ui/MoreSideBar/Drafts", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Drafts", | |
"text": "<$list filter=\"[has[draft.of]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/MoreSideBar/Missing": { | |
"title": "$:/core/ui/MoreSideBar/Missing", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Missing", | |
"text": "<$list filter=\"[is[missing]sort[title]]\" template=\"$:/core/ui/MissingTemplate\"/>\n" | |
}, | |
"$:/core/ui/MoreSideBar/Orphans": { | |
"title": "$:/core/ui/MoreSideBar/Orphans", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Orphans", | |
"text": "<$list filter=\"[is[orphan]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/MoreSideBar/Recent": { | |
"title": "$:/core/ui/MoreSideBar/Recent", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Recent", | |
"text": "{{$:/snippets/recentchanges}}\n" | |
}, | |
"$:/core/ui/MoreSideBar/Shadows": { | |
"title": "$:/core/ui/MoreSideBar/Shadows", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Shadows", | |
"text": "<$list filter=\"[is[shadow]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/MoreSideBar/System": { | |
"title": "$:/core/ui/MoreSideBar/System", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "System", | |
"text": "<$list filter=\"[is[system]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/MoreSideBar/Tags": { | |
"title": "$:/core/ui/MoreSideBar/Tags", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Tags", | |
"text": "<$list filter=\"[tags[]sort[title]]\">\n<$transclude tiddler=\"$:/core/ui/TagTemplate\"/> <small class=\"tw-menu-list-count\"><$count filter=\"[is[current]tagging[]]\"/></small>\n</$list>\n----\n{{$:/core/ui/UntaggedTemplate}} <small class=\"tw-menu-list-count\"><$count filter=\"[untagged[]!is[system]] -[tags[]]\"/></small>\n" | |
}, | |
"$:/core/ui/MoreSideBar/Types": { | |
"title": "$:/core/ui/MoreSideBar/Types", | |
"tags": "$:/tags/MoreSideBar", | |
"caption": "Types", | |
"text": "<$list filter=\"[!is[system]has[type]each[type]sort[type]]\">\n<div class=\"tw-menu-list-item\">\n<$view field=\"type\"/>\n<$list filter=\"[type{!!type}!is[system]sort[title]]\">\n<div class=\"tw-menu-list-subitem\">\n<$link to={{!!title}}><$view field=\"title\"/></$link>\n</div>\n</$list>\n</div>\n</$list>\n" | |
}, | |
"$:/core/ui/PageControls/control-panel": { | |
"title": "$:/core/ui/PageControls/control-panel", | |
"tags": "$:/tags/PageControls", | |
"text": "<$link to=\"$:/ControlPanel\">{{$:/core/images/options-button}}</$link>" | |
}, | |
"$:/core/ui/PageControls/new-tiddler": { | |
"title": "$:/core/ui/PageControls/new-tiddler", | |
"tags": "$:/tags/PageControls", | |
"text": "<$button message=\"tw-new-tiddler\" class=\"btn-invisible\">{{$:/core/images/new-button}}</$button>" | |
}, | |
"$:/core/ui/PageControls/save-wiki": { | |
"title": "$:/core/ui/PageControls/save-wiki", | |
"tags": "$:/tags/PageControls", | |
"text": "<$button message=\"tw-save-wiki\" class=\"btn-invisible\">{{$:/core/images/save-button}}</$button>" | |
}, | |
"$:/core/ui/PageMacros": { | |
"title": "$:/core/ui/PageMacros", | |
"text": "\\define tabs(tabsList,default,state:\"$:/state/tab\")\n<div class=\"tw-tab-buttons\"><$list filter=\"$tabsList$\" variable=\"currentTab\"><$button set=<<qualify \"$state$\">> setTo=<<currentTab>> default=\"$default$\" selectedClass=\"tw-tab-selected\"><$view tiddler=<<currentTab>> field=\"caption\"><$macrocall $name=\"currentTab\" $type=\"text/plain\" $output=\"text/plain\"/></$view> </$button>\n</$list>\n</div>\n<div class=\"tw-tab-divider\">\n</div>\n<div class=\"tw-tab-content\">\n<$list filter=\"$tabsList$\" variable=\"currentTab\">\n<$reveal type=\"match\" state=<<qualify \"$state$\">> text=<<currentTab>> default=\"$default$\">\n<$transclude tiddler=<<currentTab>>/>\n</$reveal>\n</$list>\n</div>\n\\end\n\\define wikitext-example(src)\n```\n$src$\n```\n\nRenders as:\n\n$src$\n\nIn HTML:\n\n$$$text/vnd.tiddlywiki>text/html\n$src$\n$$$\n\n\\end\n{{$:/core/ui/PageTemplate}}\n" | |
}, | |
"$:/core/ui/PageStylesheet": { | |
"title": "$:/core/ui/PageStylesheet", | |
"text": "<$list filter=\"[is[shadow]tag[$:/tags/stylesheet]] [!is[shadow]tag[$:/tags/stylesheet]]\">\n<$transclude/>\n</$list>\n" | |
}, | |
"$:/core/ui/PageTemplate/sidebar": { | |
"title": "$:/core/ui/PageTemplate/sidebar", | |
"tags": "$:/tags/PageTemplate", | |
"text": "<header class=\"sidebar-header\">\n<div class=\"titlebar\">{{SiteTitle}}</div>\n<div class=\"tw-subtitle\">{{SiteSubtitle}}</div>\n\n<div class=\"tw-page-controls\">\n<$list filter=\"[is[shadow]!has[draft.of]tag[$:/tags/PageControls]] [!is[shadow]!has[draft.of]tag[$:/tags/PageControls]] +[tag[$:/tags/PageControls]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list>\n</div>\n\n{{$:/core/ui/SideBarLists}}\n\n</header>\n" | |
}, | |
"$:/core/ui/PageTemplate/story": { | |
"title": "$:/core/ui/PageTemplate/story", | |
"tags": "$:/tags/PageTemplate", | |
"text": "<section class=\"story-river\">\n\n<!-- The main story -->\n<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" template=\"$:/core/ui/ViewTemplate\" editTemplate=\"$:/core/ui/EditTemplate\" storyview={{$:/view}} />\n\n<!-- End of story river -->\n</section>\n" | |
}, | |
"$:/core/ui/PageTemplate": { | |
"title": "$:/core/ui/PageTemplate", | |
"text": "<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\">\n\n<$dropzone>\n\n<$list filter=\"[is[shadow]!has[draft.of]tag[$:/tags/PageTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/PageTemplate]] +[tag[$:/tags/PageTemplate]]\" variable=\"listItem\">\n\n<$transclude tiddler=<<listItem>>/>\n\n</$list>\n\n</$dropzone>\n\n</$navigator>\n\n" | |
}, | |
"$:/core/ui/SideBar/More": { | |
"title": "$:/core/ui/SideBar/More", | |
"tags": "$:/tags/SideBar", | |
"caption": "More", | |
"text": "<div class=\"tw-more-sidebar\">\n<<tabs \"[is[shadow]!has[draft.of]tag[$:/tags/MoreSideBar]] [!is[shadow]!has[draft.of]tag[$:/tags/MoreSideBar]] +[tag[$:/tags/MoreSideBar]]\" \"$:/core/ui/MoreSideBar/Open\" \"$:/state/tab/moresidebar\">>\n</div>\n" | |
}, | |
"$:/core/ui/SideBar/Open": { | |
"title": "$:/core/ui/SideBar/Open", | |
"tags": "$:/tags/SideBar", | |
"caption": "Open", | |
"text": "<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" storyview=\"pop\">\n<$button message=\"tw-close-tiddler\" class=\"btn-invisible btn-mini\">&times;</$button> <$link to={{!!title}}><$view field=\"title\"/></$link>\n</$list>\n<$button message=\"tw-close-all-tiddlers\" class=\"btn-invisible btn-mini\">close all</$button>\n" | |
}, | |
"$:/core/ui/SideBar/Recent": { | |
"title": "$:/core/ui/SideBar/Recent", | |
"tags": "$:/tags/SideBar", | |
"caption": "Recent", | |
"text": "{{$:/snippets/recentchanges}}\n" | |
}, | |
"$:/core/ui/SideBar/Tools": { | |
"title": "$:/core/ui/SideBar/Tools", | |
"tags": "$:/tags/SideBar", | |
"caption": "Tools", | |
"text": "{{$:/snippets/viewswitcher}}\n\n---\n\n[[AdvancedSearch|$:/AdvancedSearch]]\n\n---\n\n{{$:/snippets/minithemeswitcher}}\n\n---\n\nImport: <$browse/>\n\n---\n\n{{$:/snippets/encryptionstatus}}\n\n---\n\nTiddlyWiki5 version <<version>>\n" | |
}, | |
"$:/core/ui/SideBarLists": { | |
"title": "$:/core/ui/SideBarLists", | |
"text": "<div class=\"tw-sidebar-lists\">\n\n<div class=\"tw-search\"><$edit-text tiddler=\"$:/temp/search\" type=\"search\" tag=\"input\"/> <$reveal state=\"$:/temp/search\" type=\"nomatch\" text=\"\"><$linkcatcher to=\"$:/temp/search\"><$link to=\"\" class=\"btn-invisible\">{{$:/core/images/close-button}}</$link></$linkcatcher></$reveal><$reveal state=\"$:/temp/search\" type=\"match\" text=\"\"> &nbsp;<$link to=\"$:/AdvancedSearch\" class=\"btn-invisible\">...</$link></$reveal></div>\n\n<$reveal state=\"$:/temp/search\" type=\"nomatch\" text=\"\">\n\n<div class=\"tw-search-results\">\n\n//<small><$count filter=\"[!is[system]search{$:/temp/search}]\"/> matches</small>//\n\n<$list filter=\"[!is[system]search{$:/temp/search}sort[title]limit[250]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n\n</div>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/search\" type=\"match\" text=\"\">\n\n<<tabs \"[is[shadow]!has[draft.of]tag[$:/tags/SideBar]] [!is[shadow]!has[draft.of]tag[$:/tags/SideBar]] +[tag[$:/tags/SideBar]]\" \"$:/core/ui/SideBar/Open\" \"$:/state/tab/sidebar\">>\n\n</$reveal>\n</div>\n" | |
}, | |
"$:/core/ui/TagTemplate": { | |
"title": "$:/core/ui/TagTemplate", | |
"text": "\\define tag-styles()\nbackground-color:$(backgroundColor)$;\n\\end\n<span class=\"tw-tag-list-item\"><$set name=\"backgroundColor\" value={{!!color}}><$button popup=<<qualify \"$:/state/tagpopup\">> class=\"btn-invisible tw-tag-label\" style=<<tag-styles>>><$transclude tiddler={{!!icon}}/> <$view field=\"title\" format=\"text\" /></$button></$set>\n<$reveal state=<<qualify \"$:/state/tagpopup\">> type=\"popup\" position=\"below\" animate=\"yes\"><div class=\"tw-drop-down\"><$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n<hr>\n<$list filter=\"[is[current]tagging[]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div></$reveal></span>\n" | |
}, | |
"$:/core/ui/TiddlerFieldTemplate": { | |
"title": "$:/core/ui/TiddlerFieldTemplate", | |
"text": "<tr class=\"tw-view-field\"><td class=\"tw-view-field-name\"><<listItem>></td><td class=\"tw-view-field-value\"><$view field=<<listItem>>/></td></tr>" | |
}, | |
"$:/core/ui/TiddlerFields": { | |
"title": "$:/core/ui/TiddlerFields", | |
"text": "<table class=\"tw-view-field-table\"><tbody><$list filter=\"[is[current]fields[]sort[title]] -text\" template=\"$:/core/ui/TiddlerFieldTemplate\" variable=\"listItem\"/>\n</tbody>\n</table>\n" | |
}, | |
"$:/core/ui/TiddlerInfo/Fields": { | |
"title": "$:/core/ui/TiddlerInfo/Fields", | |
"tags": "$:/tags/TiddlerInfo", | |
"caption": "Fields", | |
"text": "<$transclude tiddler=\"$:/core/ui/TiddlerFields\"/>\n" | |
}, | |
"$:/core/ui/TiddlerInfo/List": { | |
"title": "$:/core/ui/TiddlerInfo/List", | |
"tags": "$:/tags/TiddlerInfo", | |
"caption": "List", | |
"text": "<$list filter=\"[list{!!title}]\" emptyMessage=\"This tiddler does not have a list\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/TiddlerInfo/Listed": { | |
"title": "$:/core/ui/TiddlerInfo/Listed", | |
"tags": "$:/tags/TiddlerInfo", | |
"caption": "Listed", | |
"text": "<$list filter=\"[is[current]listed[]!is[system]]\" emptyMessage=\"This tiddler is not listed by any others\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/TiddlerInfo/References": { | |
"title": "$:/core/ui/TiddlerInfo/References", | |
"tags": "$:/tags/TiddlerInfo", | |
"caption": "References", | |
"text": "<$list filter=\"[is[current]backlinks[]sort[title]]\" emptyMessage=\"No tiddlers link to this one\" template=\"$:/core/ui/ListItemTemplate\">\n</$list>\n" | |
}, | |
"$:/core/ui/TiddlerInfo/Tagging": { | |
"title": "$:/core/ui/TiddlerInfo/Tagging", | |
"tags": "$:/tags/TiddlerInfo", | |
"caption": "Tagging", | |
"text": "<$list filter=\"[is[current]tagging[]]\" emptyMessage=\"No tiddlers are tagged with this one\" template=\"$:/core/ui/ListItemTemplate\"/>\n" | |
}, | |
"$:/core/ui/TiddlerInfo": { | |
"title": "$:/core/ui/TiddlerInfo", | |
"text": "<<tabs \"[is[shadow]!has[draft.of]tag[$:/tags/TiddlerInfo]] [!is[shadow]!has[draft.of]tag[$:/tags/TiddlerInfo]] +[tag[$:/tags/TiddlerInfo]]\" \"$:/core/ui/TiddlerInfo/References\">>\n" | |
}, | |
"$:/core/ui/UntaggedTemplate": { | |
"title": "$:/core/ui/UntaggedTemplate", | |
"text": "<$button popup=<<qualify \"$:/state/tagpopup\">> class=\"btn-invisible tw-untagged-label tw-tag-label\">untagged</$button>\n<$reveal state=<<qualify \"$:/state/tagpopup\">> type=\"popup\" position=\"below\"><div class=\"tw-drop-down\">\n<$list filter=\"[untagged[]!is[system]] -[tags[]] +[sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div></$reveal>\n" | |
}, | |
"$:/core/ui/ViewTemplate/body": { | |
"title": "$:/core/ui/ViewTemplate/body", | |
"tags": "$:/tags/ViewTemplate", | |
"text": "<div class=\"body\">\n<$transclude />\n</div>" | |
}, | |
"$:/core/ui/ViewTemplate/subtitle": { | |
"title": "$:/core/ui/ViewTemplate/subtitle", | |
"tags": "$:/tags/ViewTemplate", | |
"text": "<div class=\"tw-subtitle\"><$link to={{!!modifier}}><$view field=\"modifier\"/></$link> <$view field=\"modified\" format=\"relativedate\"/></div>\n" | |
}, | |
"$:/core/ui/ViewTemplate/tags": { | |
"title": "$:/core/ui/ViewTemplate/tags", | |
"tags": "$:/tags/ViewTemplate", | |
"text": "<div class=\"tw-tags-wrapper\"><$list filter=\"[is[current]tags[]sort[title]]\" template=\"$:/core/ui/TagTemplate\" storyview=\"pop\"/></div>\n" | |
}, | |
"$:/core/ui/ViewTemplate/title": { | |
"title": "$:/core/ui/ViewTemplate/title", | |
"tags": "$:/tags/ViewTemplate", | |
"text": "\\define title-styles()\nfill:$(foregroundColor)$;\n\\end\n<div class=\"tw-tiddler-title\"><div class=\"titlebar\"><span class=\"tw-tiddler-controls\"><$list filter=\"[is[shadow]!has[draft.of]tag[$:/tags/ViewToolbar]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewToolbar]] +[tag[$:/tags/ViewToolbar]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list>\n\n</span><$set name=\"foregroundColor\" value={{!!color}}><span style=<<title-styles>>><$transclude tiddler={{!!icon}}/></span></$set> <span class=\"title\"><$view field=\"title\"/></span></div>\n\n<$reveal type=\"nomatch\" text=\"\" default=\"\" state=<<tiddlerInfoState>> class=\"tw-tiddler-info tw-popup\" animate=\"yes\">\n\n<$transclude tiddler=\"$:/core/ui/TiddlerInfo\"/>\n\n</$reveal></div>" | |
}, | |
"$:/core/ui/ViewTemplate": { | |
"title": "$:/core/ui/ViewTemplate", | |
"text": "\\define frame-classes()\ntw-tiddler-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$\n\\end\n<$set name=\"storyTiddler\" value=<<currentTiddler>>><$set name=\"tiddlerInfoState\" value=<<qualify \"$:/state/tiddlerInfo\">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter=\"[is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] +[tag[$:/tags/ViewTemplate]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list>\n</div>\n</$tiddler></$set></$set>\n" | |
}, | |
"$:/core/ui/ViewToolbar/close": { | |
"title": "$:/core/ui/ViewToolbar/close", | |
"tags": "$:/tags/ViewToolbar", | |
"text": "<$button message=\"tw-close-tiddler\" class=\"btn-invisible\">{{$:/core/images/close-button}}</$button>" | |
}, | |
"$:/core/ui/ViewToolbar/edit": { | |
"title": "$:/core/ui/ViewToolbar/edit", | |
"tags": "$:/tags/ViewToolbar", | |
"text": "<$button message=\"tw-edit-tiddler\" class=\"btn-invisible\">{{$:/core/images/edit-button}}</$button>" | |
}, | |
"$:/core/ui/ViewToolbar/info": { | |
"title": "$:/core/ui/ViewToolbar/info", | |
"tags": "$:/tags/ViewToolbar", | |
"text": "<$button popup=<<tiddlerInfoState>> class=\"btn-invisible\" selectedClass=\"tw-selected\">{{$:/core/images/info-button}}</$button>" | |
}, | |
"$:/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://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* Learn more about [[WikiText|http://tiddlywiki.com/static/WikiText.html]]\n" | |
}, | |
"SiteSubtitle": { | |
"title": "SiteSubtitle", | |
"text": "a non-linear personal web notebook" | |
}, | |
"SiteTitle": { | |
"title": "SiteTitle", | |
"text": "My ~TiddlyWiki" | |
}, | |
"$:/temp/advancedsearch": { | |
"title": "$:/temp/advancedsearch", | |
"text": "" | |
}, | |
"$:/snippets/allfields": { | |
"title": "$:/snippets/allfields", | |
"text": "\\define renderfield(title)\n<tr class=\"tw-view-field\"><td class=\"tw-view-field-name\">''$title$'':</td><td class=\"tw-view-field-value\">//{{$:/docs/fields/$title$}}//</td></tr>\n\\end\n<table class=\"tw-view-field-table\"><tbody><$list filter=\"[fields[]sort[title]]\" variable=\"listItem\"><$macrocall $name=\"renderfield\" title=<<listItem>>/></$list>\n</tbody></table>\n" | |
}, | |
"$:/config/AnimationDuration": { | |
"title": "$:/config/AnimationDuration", | |
"text": "400" | |
}, | |
"$:/snippets/download-wiki-button": { | |
"title": "$:/snippets/download-wiki-button", | |
"text": "<$button message=\"tw-download-file\" param=\"$:/core/save/all\" class=\"btn-big-green\">Download Full {{$:/core/images/save-button}}</$button>" | |
}, | |
"$:/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>" | |
}, | |
"$:/snippets/minithemeswitcher": { | |
"title": "$:/snippets/minithemeswitcher", | |
"text": "Current theme: <$link to={{$:/theme}}><$view tiddler={{$:/theme}} field=\"name\"/></$link>\n\n<$linkcatcher to=\"$:/theme\">\n<$list filter=\"[plugin-type[theme]sort[title]]\"><div><$reveal state=\"$:/theme\" type=\"match\" text={{!!title}}>&bull;</$reveal><$reveal state=\"$:/theme\" type=\"nomatch\" text={{!!title}}>&nbsp;</$reveal> <$link to={{!!title}}><$view field=\"name\" format=\"text\"/></$link></div>\n</$list>\n</$linkcatcher>" | |
}, | |
"$:/snippets/modules": { | |
"title": "$:/snippets/modules", | |
"text": "\\define describeModuleType(type)\n{{$:/docs/moduletypes/$type$}}\n\\end\n<$list filter=\"[moduletypes[]]\">\n!! <$macrocall $name=\"currentTiddler\" $type=\"text/plain\" $output=\"text/plain\"/>\n<$macrocall $name=\"describeModuleType\" type=<<currentTiddler>>/>\n<ul><$list filter=\"[is[current]modules[]]\"><li><$link><<currentTiddler>></$link>\n</li>\n</$list>\n</ul>\n</$list>\n" | |
}, | |
"$:/state/tab/moresidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar/More||}{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}": { | |
"title": "$:/state/tab/moresidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar/More||}{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}", | |
"text": "$:/core/ui/MoreSideBar/Tags" | |
}, | |
"$:/snippets/recentchanges": { | |
"title": "$:/snippets/recentchanges", | |
"text": "<$list filter=\"[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]\">\n<div class=\"tw-menu-list-item\">\n<$view field=\"modified\" format=\"date\" template=\"DDth MMM YYYY\"/>\n<$list filter=\"[sameday{!!modified}!is[system]!sort[modified]]\">\n<div class=\"tw-menu-list-subitem\">\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</div>\n</$list>\n</div>\n</$list>\n" | |
}, | |
"$:/temp/search": { | |
"title": "$:/temp/search", | |
"text": "" | |
}, | |
"$:/state/tab/sidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}": { | |
"title": "$:/state/tab/sidebar-{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}", | |
"text": "$:/core/ui/SideBar/Open" | |
}, | |
"$:/tags/ControlPanel": { | |
"title": "$:/tags/ControlPanel", | |
"list": "$:/core/ui/ControlPanel/Basics $:/core/ui/ControlPanel/Appearance $:/core/ui/ControlPanel/Saving $:/core/ui/ControlPanel/Plugins $:/core/ui/ControlPanel/Tools $:/core/ui/ControlPanel/Internals", | |
"text": "" | |
}, | |
"$:/tags/EditTemplate": { | |
"title": "$:/tags/EditTemplate", | |
"list": "[[$:/core/ui/EditTemplate/controls]] [[$:/core/ui/EditTemplate/title]] [[$:/core/ui/EditTemplate/tags]] [[$:/core/ui/EditTemplate/body]] [[$:/core/ui/EditTemplate/type]] [[$:/core/ui/EditTemplate/fields]]", | |
"text": "" | |
}, | |
"$:/tags/EditToolbar": { | |
"title": "$:/tags/EditToolbar", | |
"list": "[[$:/core/ui/EditToolbar/delete]] [[$:/core/ui/EditToolbar/cancel]] [[$:/core/ui/EditToolbar/save]]", | |
"text": "" | |
}, | |
"$:/tags/MoreSideBar": { | |
"title": "$:/tags/MoreSideBar", | |
"list": "[[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]]", | |
"text": "" | |
}, | |
"$:/tags/PageControls": { | |
"title": "$:/tags/PageControls", | |
"list": "[[$:/core/ui/PageControls/new-tiddler]] [[$:/core/ui/PageControls/control-panel]] [[$:/core/ui/PageControls/save-wiki]]", | |
"text": "" | |
}, | |
"$:/tags/PageTemplate": { | |
"title": "$:/tags/PageTemplate", | |
"list": "[[$:/core/ui/PageTemplate/sidebar]] [[$:/core/ui/PageTemplate/story]]", | |
"text": "" | |
}, | |
"$:/tags/SideBar": { | |
"title": "$:/tags/SideBar", | |
"list": "[[$:/core/ui/SideBar/Open]] [[$:/core/ui/SideBar/Recent]] [[$:/core/ui/SideBar/Tools]] [[$:/core/ui/SideBar/More]]", | |
"text": "" | |
}, | |
"$:/tags/TiddlerInfo": { | |
"title": "$:/tags/TiddlerInfo", | |
"list": "[[$:/core/ui/TiddlerInfo/References]] [[$:/core/ui/TiddlerInfo/Tagging]] [[$:/core/ui/TiddlerInfo/List]] [[$:/core/ui/TiddlerInfo/Listed]] [[$:/core/ui/TiddlerInfo/Fields]]", | |
"text": "" | |
}, | |
"$:/tags/ViewTemplate": { | |
"title": "$:/tags/ViewTemplate", | |
"list": "[[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/body]]", | |
"text": "" | |
}, | |
"$:/tags/ViewToolbar": { | |
"title": "$:/tags/ViewToolbar", | |
"list": "[[$:/core/ui/ViewToolbar/info]] [[$:/core/ui/ViewToolbar/edit]] [[$:/core/ui/ViewToolbar/close]]", | |
"text": "" | |
}, | |
"$:/snippets/themeswitcher": { | |
"title": "$:/snippets/themeswitcher", | |
"text": "Current theme: <$link to={{$:/theme}}><$view tiddler={{$:/theme}} field=\"name\"/></$link>\n\n<$linkcatcher to=\"$:/theme\">\n<$list filter=\"[plugin-type[theme]sort[title]]\"><div><$reveal state=\"$:/theme\" type=\"match\" text={{!!title}}>&bull;</$reveal><$reveal state=\"$:/theme\" type=\"nomatch\" text={{!!title}}>&nbsp;</$reveal> <$link to={{!!title}}>''<$view field=\"name\" format=\"text\"/>'' <$view field=\"description\" format=\"text\"/></$link></div>\n</$list>\n</$linkcatcher>" | |
}, | |
"$:/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\"><$list filter=\"classic zoomin pop\"><div><$reveal state=\"$:/view\" type=\"match\" text={{!!title}}>&bull;</$reveal><$reveal state=\"$:/view\" type=\"nomatch\" text={{!!title}}>&nbsp;</$reveal> <$link to={{!!title}}><$view field=\"title\"/></$link>\n</div>\n</$list>\n</$linkcatcher>\n" | |
} | |
} | |
}</pre> | |
</div> | |
<div title="$:/isEncrypted"> | |
<pre>no</pre> | |
</div> | |
<div dependents="" description="Adds support for HTML5 full screen mode" plugin-type="plugin" title="$:/plugins/tiddlywiki/fullscreen" type="application/json" version="5.0.7-prerelease"> | |
<pre>{ | |
"tiddlers": { | |
"$:/plugins/tiddlywiki/fullscreen/init.js": { | |
"text": "/*\\\ntitle: $:/plugins/tiddlywiki/fullscreen/init.js\ntype: application/javascript\nmodule-type: browser-startup\n\nMessage handler for full screen mode\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, Element: false */\n\"use strict\";\n\nvar d = document,\n\tdb = d.body,\n\t_requestFullscreen = db.webkitRequestFullscreen !== undefined ? \"webkitRequestFullscreen\" :\n\t\t\t\t\t\tdb.mozRequestFullScreen !== undefined ? \"mozRequestFullScreen\" :\n\t\t\t\t\t\tdb.msRequestFullscreen !== undefined ? \"msRequestFullscreen\" :\n\t\t\t\t\t\tdb.requestFullscreen !== undefined ? \"requestFullscreen\" : \"\",\n\t_exitFullscreen = d.webkitExitFullscreen !== undefined ? \"webkitExitFullscreen\" :\n\t\t\t\t\t\t\td.mozCancelFullScreen !== undefined ? \"mozCancelFullScreen\" :\n\t\t\t\t\t\t\td.msExitFullscreen !== undefined ? \"msExitFullscreen\" :\n\t\t\t\t\t\t\td.exitFullscreen !== undefined ? \"exitFullscreen\" : \"\",\n\t_fullscreenElement = d.webkitFullscreenElement !== undefined ? \"webkitFullscreenElement\" :\n\t\t\t\t\t\t\td.mozFullScreenElement !== undefined ? \"mozFullScreenElement\" :\n\t\t\t\t\t\t\td.msFullscreenElement !== undefined ? \"msFullscreenElement\" :\n\t\t\t\t\t\t\td.fullscreenElement !== undefined ? \"fullscreenElement\" : \"\";\n\nvar toggleFullscreen = function() {\n\tif(document[_fullscreenElement]) {\n\t\tdocument[_exitFullscreen]();\n\t} else {\n\t\tdocument.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);\n\t}\n};\n\nexports.startup = function() {\n\t// Install the full screen handler\n\tif(_requestFullscreen) {\n\t\t$tw.rootWidget.addEventListener(\"tw-full-screen\",function(event) {\n\t\t\ttoggleFullscreen();\n\t\t});\n\t}\n};\n\n})();\n", | |
"title": "$:/plugins/tiddlywiki/fullscreen/init.js", | |
"type": "application/javascript", | |
"module-type": "browser-startup" | |
} | |
} | |
}</pre> | |
</div> | |
<div dependents="$:/themes/tiddlywiki/vanilla" description="A clean theme that emphasises individual tiddlers" name="Snow White" plugin-type="theme" title="$:/themes/tiddlywiki/snowwhite" type="application/json" version="5.0.7-prerelease"> | |
<pre>{ | |
"tiddlers": { | |
"$:/themes/tiddlywiki/snowwhite/base": { | |
"title": "$:/themes/tiddlywiki/snowwhite/base", | |
"tags": "[[$:/tags/stylesheet]]", | |
"text": "\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\n\\define border-radius(radius)\n```\n -webkit-border-radius: $radius$;\n -moz-border-radius: $radius$;\n border-radius: $radius$;\n```\n\\end\n\\define box-shadow(shadow)\n```\n -webkit-box-shadow: $shadow$;\n -moz-box-shadow: $shadow$;\n box-shadow: $shadow$;\n```\n\\end\n\\define filter(filter)\n```\n -webkit-filter: $filter$;\n -moz-filter: $filter$;\n filter: $filter$;\n```\n\\end\n\\define transition(transition)\n```\n -webkit-transition: $transition$;\n -moz-transition: $transition$;\n transition: $transition$;\n```\n\\end\n\\define transform-origin(origin)\n```\n -webkit-transform-origin: $origin$;\n -moz-transform-origin: $origin$;\n transform-origin: $origin$;\n```\n\\end\n\\define background-linear-gradient(gradient)\n```\nbackground-image: linear-gradient($gradient$);\nbackground-image: -o-linear-gradient($gradient$);\nbackground-image: -moz-linear-gradient($gradient$);\nbackground-image: -webkit-linear-gradient($gradient$);\nbackground-image: -ms-linear-gradient($gradient$);\n```\n\\end\n\n.sidebar-header {\n\ttext-shadow: 0 1px 0 rgba(255,255,255, 0.8);\n}\n\n.tw-page-controls svg {\n\t<<transition \"fill 150ms ease-in-out\">>\n}\n\n.tw-tiddler-info {\n\t<<box-shadow \"inset 1px 2px 3px rgba(0,0,0,0.1)\">>\n}\n\n@media screen {\n\t.tw-tiddler-frame {\n\t\t<<box-shadow \"5px 5px 5px rgba(0, 0, 0, 0.1)\">>\n\t}\n}\n\n@media (max-width: 770px) {\n\t.tw-tiddler-frame {\n\t\t<<box-shadow none>>\n\t}\n}\n\n.tw-tiddler-controls button svg {\n\t<<transition \"fill 150ms ease-in-out\">>\n}\n\n.tw-tiddler-controls button.tw-selected svg {\n\t<<filter \"drop-shadow(0px -1px 2px rgba(0,0,0,0.25))\">>\n}\n\n.tw-tiddler-frame input.tw-edit-texteditor {\n\t<<box-shadow \"inset 0 1px 8px rgba(0, 0, 0, 0.15)\">>\n}\n\n.tw-edit-tags {\n\t<<box-shadow \"inset 0 1px 8px rgba(0, 0, 0, 0.15)\">>\n}\n\n.tw-tiddler-frame .tw-edit-tags input.tw-edit-texteditor {\n\t<<box-shadow \"none\">>\n\tborder: none;\n\toutline: none;\n}\n\ncanvas.tw-edit-bitmapeditor {\n\t<<box-shadow \"2px 2px 5px rgba(0, 0, 0, 0.5)\">>\n}\n\n.tw-drop-down {\n\t<<border-radius 4px>>\n\t<<box-shadow \"2px 2px 10px rgba(0, 0, 0, 0.5)\">>\n}\n\n.tw-block-dropdown {\n\t<<border-radius 4px>>\n\t<<box-shadow \"2px 2px 10px rgba(0, 0, 0, 0.5)\">>\n}\n\n.modal {\n\t<<border-radius 6px>>\n\t<<box-shadow \"0 3px 7px rgba(0,0,0,0.3)\">>\n}\n\n.modal-footer {\n\t<<border-radius \"0 0 6px 6px\">>\n\t<<box-shadow \"inset 0 1px 0 #fff\">>;\n}\n\n.tw-notification {\n\t<<border-radius 6px>>\n\t<<box-shadow \"0 3px 7px rgba(0,0,0,0.3)\">>\n\ttext-shadow: 0 1px 0 rgba(255,255,255, 0.8);\n}\n\n.tw-sidebar-lists .tw-tab-divider {\n\t<<background-linear-gradient \"left, rgb(216,216,216) 0%, rgb(236,236,236) 250px\">>\n}\n\n.tw-more-sidebar .tw-tab-buttons button {\n\t<<background-linear-gradient \"left, rgb(236,236,236) 0%, rgb(224,224,224) 100%\">>\n}\n\n.tw-more-sidebar .tw-tab-buttons button.tw-tab-selected {\n\t<<background-linear-gradient \"left, rgb(236,236,236) 0%, rgb(248,248,248) 100%\">>\n}\n\n.tw-message-box img {\n\t<<box-shadow \"1px 1px 3px rgba(0,0,0,0.5)\">>\n}\n" | |
} | |
} | |
}</pre> | |
</div> | |
<div dependents="" description="A basic default theme" name="Vanilla" plugin-type="theme" title="$:/themes/tiddlywiki/vanilla" type="application/json" version="5.0.7-prerelease"> | |
<pre>{ | |
"tiddlers": { | |
"$:/themes/tiddlywiki/vanilla/themetweaks": { | |
"title": "$:/themes/tiddlywiki/vanilla/themetweaks", | |
"tags": "$:/tags/ControlPanel", | |
"caption": "Theme Tweaks", | |
"text": "You can tweak certain aspects of the ''Vanilla'' theme.\n\n//Currently, you need to toggle to a different theme and back (or save and restart TiddlyWiki) before these changes take effect. Also take care to preserve any backticks (&#96;) in the settings//\n\n! Colours\n\n* Primary colour: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colours\" index=\"primary\" default=\"\" tag=\"input\" type=\"color\"/>\n* Background colour: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colours\" index=\"background\" default=\"\" tag=\"input\" type=\"color\"/>\n* Foreground colour: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colours\" index=\"foreground\" default=\"\" tag=\"input\" type=\"color\"/>\n* Page background colour: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colours\" index=\"pagebackground\" default=\"\" tag=\"input\" type=\"color\"/>\n* Medium contrast color: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colours\" index=\"medium\" default=\"\" tag=\"input\" type=\"color\"/>\n\n! Colour mappings\n\n* Tiddler background colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"tiddlerbackground\" default=\"\" tag=\"input\"/>\n* Tiddler foreground colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"foreground\" default=\"\" tag=\"input\"/>\n* Page background colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"pagebackground\" default=\"\" tag=\"input\"/>\n* Link background colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"linkbackground\" default=\"\" tag=\"input\"/>\n* Link foreground colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"linkforeground\" default=\"\" tag=\"input\"/>\n* Dropdown background colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"dropdownbackground\" default=\"\" tag=\"input\"/>\n* Dropdown border colour mapping: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/colourmappings\" index=\"dropdownborder\" default=\"\" tag=\"input\"/>\n\n! Settings\n\n* Font family: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/settings\" index=\"fontfamily\" default=\"\" tag=\"input\"/>\n\n! Sizes\n\n* Font size: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"fontsize\" default=\"\" tag=\"input\"/>\n* Line height: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"lineheight\" default=\"\" tag=\"input\"/>\n* Story left position //(the distance between the left of the screen and the left margin of the story river or tiddler area)//: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"storyleft\" default=\"\" tag=\"input\"/>\n* Story top position //(the distance between the top of the screen ad the top margin of the story river or tiddler area)//: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"storytop\" default=\"\" tag=\"input\"/>\n* Story right //(the distance between the left side of the screen and the left margin of the sidebar area)//: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"storyright\" default=\"\" tag=\"input\"/>\n* Story width //(the width of the story river or tiddler area)//: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"storywidth\" default=\"\" tag=\"input\"/>\n* Tiddler width //(the width of individual tiddlers -- used for zoomin storyview)//: <$edit-text tiddler=\"$:/themes/tiddlywiki/vanilla/metrics\" index=\"tiddlerwidth\" default=\"\" tag=\"input\"/>\n\n" | |
}, | |
"$:/themes/tiddlywiki/vanilla/base": { | |
"title": "$:/themes/tiddlywiki/vanilla/base", | |
"tags": "[[$:/tags/stylesheet]]", | |
"text": "\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\n\\define border-radius(radius)\n```\n -webkit-border-radius: $radius$;\n -moz-border-radius: $radius$;\n border-radius: $radius$;\n```\n\\end\n\n/*\n** Start with the normalize CSS reset, and then belay some of its effects\n*/\n\n{{$:/themes/tiddlywiki/vanilla/reset}}\n\n*, input[type=\"search\"] {\n\tbox-sizing: border-box;\n\t-moz-box-sizing: border-box;\n\t-webkit-box-sizing: border-box;\n}\n\n/*\n** Basic element styles\n*/\n\nhtml {\n\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings##fontfamily}};\n}\n\nbody.tw-body {\n\tfont-size: {{$:/themes/tiddlywiki/vanilla/metrics##fontsize}};\n\tline-height: {{$:/themes/tiddlywiki/vanilla/metrics##lineheight}};\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##foreground}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##pagebackground}};\n\tword-wrap: break-word;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tline-height: 1em;\n\tfont-weight: 300;\n}\n\npre {\n\tdisplay: block;\n\tpadding: 14px;\n\tmargin: 0 0 14px;\n\tword-break: normal;\n\tword-wrap: break-word;\n\twhite-space: pre;\n\twhite-space: pre-wrap;\n\tbackground-color: #f5f5f5;\n\tborder: 1px solid #ccc;\n\tpadding: 0 3px 2px;\n\t<<border-radius 3px>>\n}\n\ncode {\n\tcolor: #d14;\n\tbackground-color: #f7f7f9;\n\tborder: 1px solid #e1e1e8;\n white-space: pre-wrap;\n\tpadding: 0 3px 2px;\n\t<<border-radius 3px>>\n}\n\nblockquote {\n\tborder-left: 5px solid #ddd;\n\tmargin-left: 25px;\n\tpadding-left: 10px;\n}\n\ndl dt {\n\tfont-weight: bold;\n\tmargin-top: 6px;\n}\n\n/*\nMarkdown likes putting code elements inside pre elements\n*/\npre > code {\n\tpadding: 0;\n\tborder: none;\n\tbackground-color: inherit;\n\tcolor: inherit;\n}\n\ntable {\n\tborder: 1px solid #ddd;\n\twidth: auto;\n\tmax-width: 100%;\n\tcaption-side: bottom;\n}\n\ntable th, table td {\n\tpadding: 0 7px 0 7px;\n\tborder-top: 1px solid #ddd;\n\tborder-left: 1px solid #ddd;\n}\n\ntable thead tr td, table th {\n\tbackground-color: #f0f0f0;\n\tfont-weight: bold;\n}\n\ntable tfoot tr td {\n\tbackground-color: #a8a8a8;\n}\n\n.tw-tiddler-frame img, .tw-tiddler-frame svg, .tw-tiddler-frame canvas, .tw-tiddler-frame embed {\n\tmax-width: 100%;\n}\n\n.tw-tiddler-frame embed {\n\twidth: 100%;\n\theight: 600px;\n}\n\n/*\n** Links\n*/\n\na.tw-tiddlylink {\n\ttext-decoration: none;\n\tfont-weight: normal;\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkforeground}};\n\t-webkit-user-select: inherit; /* Otherwise the draggable attribute makes links impossible to select */\n}\n\n.tw-sidebar-lists a.tw-tiddlylink {\n\tcolor: #999;\n}\n\n.tw-sidebar-lists a.tw-tiddlylink:hover {\n\tcolor: #444;\n}\n\na.tw-tiddlylink:hover {\n\ttext-decoration: underline;\n}\n\na.tw-tiddlylink-resolves {\n}\n\na.tw-tiddlylink-shadow {\n\tfont-weight: bold;\n}\n\na.tw-tiddlylink-shadow.tw-tiddlylink-resolves {\n\tfont-weight: normal;\n}\n\na.tw-tiddlylink-missing {\n\tfont-style: italic;\n}\n\na.tw-tiddlylink-external {\n\ttext-decoration: underline;\n}\n\n/*\n** Drag and drop styles\n*/\n\n.tw-tiddler-dragger {\n\tposition: relative;\n\tz-index: -10000;\n}\n\n.tw-tiddler-dragger-inner {\n\tposition: absolute;\n\tdisplay: inline-block;\n\tpadding: 8px 20px;\n\tfont-size: 16.9px;\n\tfont-weight: bold;\n\tline-height: 20px;\n\tcolor: #fff;\n\ttext-shadow: 0 1px 0 rgba(0, 0, 0, 1);\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n\tbackground-color: #000;\n\t<<border-radius 20px>>\n}\n\n.tw-tiddler-dragger-cover {\n\tposition: absolute;\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##pagebackground}};\n}\n\n.tw-dropzone {\n\tposition: relative;\n}\n\n.tw-dropzone.tw-dragover:before {\n\tz-index: 10000;\n\tdisplay: block;\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbackground: rgba(0,200,0,0.7);\n\ttext-align: center;\n\tcontent: \"Drop here\";\n}\n\n/*\n** Buttons\n*/\n\n.btn-invisible {\n\tpadding: 0;\n\tmargin: 0;\n\tbackground: none;\n\tborder: none;\n}\n\n.btn-big-green {\n\tpadding: 8px;\n\tmargin: 4px 8px 4px 8px;\n\tbackground: #34C734;\n\tcolor: #fff;\n\tfill: #fff;\n\tborder: none;\n\tfont-size: 1.2em;\n\tline-height: 1.4em;\n}\n\n.btn-mini {\n\tcolor: #e0e0e0;\n}\n\n.btn-mini:hover {\n\tcolor: #444;\n}\n\n.tw-image-button {\n\theight: 1em;\n}\n\n/*\n** Tags and missing tiddlers\n*/\n\n.tw-tag-list-item {\n\tdisplay: inline-block;\n\tmargin-right: 7px;\n}\n\n.tw-tags-wrapper {\n\tmargin: 4px 0 14px 0;\n}\n\n.tw-missing-tiddler-label {\n\tfont-style: italic;\n\tfont-weight: normal;\n\tdisplay: inline-block;\n\tfont-size: 11.844px;\n\tline-height: 14px;\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n}\n\n.tw-tag-label {\n\tdisplay: inline-block;\n\tpadding: 2px 9px;\n\tfont-size: 0.9em;\n\tfont-weight: 300;\n\tline-height: 1.2em;\n\tcolor: #fff;\n\twhite-space: nowrap;\n\tvertical-align: baseline;\n\tbackground-color: #D5AD34;\n\t<<border-radius 8px>>\n}\n\n.tw-untagged-label {\n\tbackground-color: #999;\n}\n\n.tw-tag-label svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: #fff;\n}\n\n/*\n** Page layout\n*/\n\n.sidebar-header {\n\tcolor: #acacac;\n}\n\n.sidebar-header .title a.tw-tiddlylink-resolves {\n\tfont-weight: 300;\n}\n\n.sidebar-header .tw-sidebar-lists p {\n\tmargin-top: 3px;\n\tmargin-bottom: 3px;\n}\n\n.tw-search a svg {\n\theight: 0.75em;\n}\n\n.tw-search-results {\n\tpadding-top: 14px;\n}\n\n.tw-page-controls {\n\tmargin-top: 14px;\n}\n\n.tw-page-controls a.tw-tiddlylink:hover {\n\ttext-decoration: none;\n}\n\n.tw-page-controls svg {\n\theight: 1.75em;\n\tmin-width: 1px;\n\tpadding-right: 0.5em;\n\tfill: #fff;\n}\n\n.tw-page-controls button:hover svg, .tw-page-controls a:hover svg {\n\tfill: #000;\n}\n\n.tw-menu-list-item {\n\twhite-space: nowrap;\n}\n\n.tw-menu-list-count {\n\tfont-weight: bold;\n}\n\n.tw-open-tiddler-list {\n\t<<transform-origin \"0% 0%\">>\n}\n\n.tw-menu-list-subitem {\n\tpadding-left: 7px;\n}\n\n.story-river {\n\tposition: relative;\n}\n\n.tw-story-spacer {\n\tposition: absolute;\n\tmin-height: 100%;\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics##storywidth}}) {\n\t.sidebar-header {\n\t\tpadding: 14px;\n\t}\n\n\t.story-river {\n\t\tposition: relative;\n\t\tpadding: 0;\n\t}\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics##storywidth}}) {\n\t.sidebar-header {\n\t\tposition: fixed;\n\t\ttop: {{$:/themes/tiddlywiki/vanilla/metrics##storytop}};\n\t\tleft: {{$:/themes/tiddlywiki/vanilla/metrics##storyright}};\n\t\tbottom: 0;\n\t\tright: 0;\n\t\toverflow-y: auto;\n\t\toverflow-x: auto;\n\t\t-webkit-overflow-scrolling: touch;\n\t\tmargin: 0 0 0 -42px;\n\t\tpadding: 70px 0 28px 42px;\n\t}\n\n\t.story-river {\n\t\tposition: relative;\n\t\tleft: {{$:/themes/tiddlywiki/vanilla/metrics##storyleft}};\n\t\ttop: {{$:/themes/tiddlywiki/vanilla/metrics##storytop}};\n\t\twidth: {{$:/themes/tiddlywiki/vanilla/metrics##storywidth}};\n\t\tpadding: 56px 42px 42px 42px;\n\t}\n}\n\n@media print {\n\t.sidebar-header {\n\t\tdisplay: none;\n\t}\n\n\t.story-river {\n\t\tmargin-left: 14px;\n\t}\n}\n\n/*\n** Tiddler styles\n*/\n\n.tw-tiddler-frame {\n\tmargin-bottom: 28px;\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##tiddlerbackground}};\n}\n\n.tw-tiddler-info {\n\tpadding: 14px 42px 14px 42px;\n\tbackground-color: #f8f8f8;\n\tborder-top: 1px solid #ddd;\n\tborder-bottom: 1px solid #ddd;\n}\n\n.tw-tiddler-info .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #f8f8f8;\n\tborder-bottom: 1px solid #f8f8f8;\n}\n\n.tw-view-field-table {\n\twidth: 100%;\n}\n\n.tw-view-field-name {\n\twidth: 1%; /* Makes this column be as narrow as possible */\n\ttext-align: right;\n\tfont-style: italic;\n}\n\n.tw-view-field-value {\n}\n\n@media (max-width: 770px) {\n\t.tw-tiddler-frame {\n\t\tpadding: 14px 14px 14px 14px;\n\t}\n\n\t.tw-tiddler-info {\n\t\tmargin: 0 -14px 0 -14px;\n\t}\n}\n\n@media (min-width: 770px) {\n\t.tw-tiddler-frame {\n\t\tpadding: 28px 42px 42px 42px;\n\t\twidth: {{$:/themes/tiddlywiki/vanilla/metrics##tiddlerwidth}};\n\t}\n\n\t.tw-tiddler-info {\n\t\tmargin: 0 -42px 0 -42px;\n\t}\n}\n\n.titlebar {\n\tfont-weight: 300;\n\tfont-size: 2.35em;\n\tline-height: 1.2em;\n\tcolor: #182955;\n}\n\n.titlebar img {\n\theight: 1em;\n}\n\n.tw-subtitle {\n\tfont-size: 0.9em;\n\tcolor: #c0c0c0;\n\tfont-weight: 300;\n}\n\n.tw-tiddler-missing .title {\n font-style: italic;\n font-weight: normal;\n}\n\n.tw-tiddler-frame .tw-tiddler-controls {\n\tfloat: right;\n}\n\n.tw-tiddler-controls button {\n\tmargin: 0 0 0 5px;\n\tvertical-align: baseline;\n}\n\n.tw-tiddler-controls button svg {\n\theight: 0.75em;\n\tfill: #ccc;\n}\n\n.tw-tiddler-controls button.tw-selected svg {\n\tfill: #444;\n}\n\n.tw-tiddler-controls button:hover svg {\n\tfill: #888;\n}\n\n@media print {\n\t.tw-tiddler-controls {\n\t\tdisplay: none;\n\t}\n}\n\n.tw-tiddler-help { /* Help prompts within tiddler template */\n\tcolor: #999;\n\tmargin-top: 14px;\n}\n\n.tw-tiddler-help a.tw-tiddlylink {\n\tcolor: #888888;\n}\n\n.tw-tiddler-frame input.tw-edit-texteditor, .tw-tiddler-frame textarea.tw-edit-texteditor {\n\twidth: 100%;\n\tpadding: 3px 3px 3px 3px;\n\tborder: 1px solid #ccc;\n\tline-height: 1.3em;\n\t-webkit-appearance: none;\n\tmargin: 4px 0 4px 0;\n}\n\n.tw-tiddler-frame input.tw-edit-texteditor {\n\tbackground-color: #f8f8f8;\n}\n\ncanvas.tw-edit-bitmapeditor {\n\tborder: 6px solid #fff;\n\tcursor: crosshair;\n\t-moz-user-select: none;\n\t-webkit-user-select: none;\n\t-ms-user-select: none;\n\tmargin-top: 6px;\n\tmargin-bottom: 6px;\n}\n\n.tw-edit-bitmapeditor-width {\n\tdisplay: block;\n}\n\n.tw-edit-bitmapeditor-height {\n\tdisplay: block;\n}\n\n/*\n** Tiddler edit mode\n*/\n\n.tw-tiddler-edit-frame em.tw-edit {\n\tcolor: #999;\n\tfont-style: normal;\n}\n\n.tw-edit-type-dropdown a.tw-tiddlylink-missing {\n\tfont-style: normal;\n}\n\n.tw-edit-tags {\n\tborder: 1px solid #ddd;\n\tpadding: 4px 8px 4px 8px;\n}\n\n.tw-edit-add-tag {\n\tdisplay: inline-block;\n}\n\n.tw-edit-add-tag .tw-add-tag-name input {\n\twidth: 50%;\n}\n\n.tw-edit-tags .tw-tag-label {\n\tdisplay: inline-block;\n}\n\n.tw-edit-tags-list {\n\tmargin: 14px 0 14px 0;\n}\n\n.tw-tag-editor-label {\n\tdisplay: inline-block;\n\tmargin-right: 7px;\n}\n\n.tw-remove-tag-button {\n\tpadding-left: 4px;\n}\n\n.tw-tiddler-preview {\n\toverflow: auto;\n}\n\n.tw-tiddler-preview-preview {\n\tfloat: right;\n\twidth: 48%;\n\tborder: 1px solid #ccc;\n\tmargin: 4px 3px 3px 3px;\n\tpadding: 3px 3px 3px 3px;\n}\n\n.tw-tiddler-preview-edit {\n\twidth: 48%;\n}\n\n.tw-edit-fields {\n\twidth: 100%;\n}\n\n\n.tw-edit-fields table, .tw-edit-fields tr, .tw-edit-fields td {\n\tborder: none;\n\tpadding: 4px;\n}\n\n.tw-edit-fields > tbody > .tw-edit-field:nth-child(odd) {\n\tbackground-color: #f0f4f0;\n}\n\n.tw-edit-fields > tbody > .tw-edit-field:nth-child(even) {\n\tbackground-color: #e0e8e0;\n}\n\n.tw-edit-field-name {\n\ttext-align: right;\n}\n\n.tw-edit-field-value input {\n\twidth: 100%;\n}\n\n.tw-edit-field-remove {\n}\n\n.tw-edit-field-remove svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: #888;\n\tvertical-align: middle;\n}\n\n.tw-edit-field-add-name {\n\tdisplay: inline-block;\n\twidth: 15%;\n}\n\n.tw-edit-field-add-button {\n\tdisplay: inline-block;\n\twidth: 10%;\n}\n\n/*\n** Dropdowns\n*/\n\n.btn-dropdown svg {\n\theight: 1em;\n\twidth: 1em;\n\tfill: #999;\n}\n\n.tw-drop-down {\n\tmin-width: 280px;\n\tborder: 1px solid {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownborder}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownbackground}};\n\tpadding: 7px 0 7px 0;\n\tmargin: 4px 0 0 0;\n\twhite-space: nowrap;\n}\n\n.tw-drop-down p {\n\tpadding: 0 14px 0 14px;\n}\n\n.tw-drop-down a {\n\tdisplay: block;\n\tpadding: 0 14px 0 14px;\n}\n\n.tw-drop-down a:hover {\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkbackground}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkforeground}};\n\ttext-decoration: none;\n}\n\n.tw-drop-down .tw-tab-buttons button {\n\tbackground-color: #ececec;\n}\n\n.tw-drop-down .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #fff;\n\tborder-bottom: 1px solid #fff;\n}\n\n.tw-drop-down .tw-tab-contents a {\n\tpadding: 0 0.5em 0 0.5em;\n}\n\n.tw-block-dropdown-wrapper {\n\tposition: relative;\n}\n\n.tw-block-dropdown {\n\tposition: absolute;\n\tmin-width: 280px;\n\tborder: 1px solid {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownborder}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##dropdownbackground}};\n\tpadding: 0 0 0 0;\n\tmargin: 4px 0 0 0;\n\twhite-space: nowrap;\n\tz-index: 1000;\n}\n\n.tw-block-dropdown a {\n\tdisplay: block;\n\tpadding: 4px 14px 4px 14px;\n}\n\n.tw-block-dropdown a:hover {\n\tcolor: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkbackground}};\n\tbackground-color: {{$:/themes/tiddlywiki/vanilla/colourmappings##linkforeground}};\n\ttext-decoration: none;\n}\n\n/*\n** Modals\n*/\n\n.tw-modal-displayed {\n\t-webkit-filter: blur(4px);\n}\n\n.modal-backdrop {\n\tposition: fixed;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\tz-index: 1000;\n\tbackground-color: #000;\n}\n\n.modal {\n\tz-index: 1100;\n\tbackground-color: #fff;\n\tborder: 1px solid #999;\n\tborder: 1px solid rgba(0,0,0,.3);\n}\n\n@media (max-width: 55em) {\n\t.modal {\n\t\tposition: fixed;\n\t\ttop: 1em;\n\t\tleft: 1em;\n\t\tright: 1em;\n\t}\n\n\t.modal-body {\n\t\toverflow-y: auto;\n\t\tmax-height: 400px;\n\t}\n}\n\n@media (min-width: 55em) {\n\t.modal {\n\t\tposition: fixed;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\twidth: 560px;\n\t\tmargin: -250px 0 0 -280px;\n\t}\n}\n\n.modal-header {\n\tpadding: 9px 15px;\n\tborder-bottom: 1px solid #eee;\n}\n\n.modal-header h3 {\n\tmargin: 0;\n\tline-height: 30px;\n}\n\n.modal-body {\n\tpadding: 15px;\n}\n\n.modal-footer {\n\tpadding: 14px 15px 15px;\n\tmargin-bottom: 0;\n\ttext-align: right;\n\tbackground-color: #f5f5f5;\n\tborder-top: 1px solid #ddd;\n}\n\n/*\n** Notifications\n*/\n\n.tw-notification {\n\tposition: fixed;\n\ttop: 14px;\n\tright: 14px;\n\tz-index: 1000;\n\tmax-width: 280px;\n\tpadding: 0 14px 0 14px;\n\tbackground-color: #ffd;\n\tborder: 1px solid #999;\n\tborder: 1px solid rgba(0,0,0,.3);\n}\n\n/*\n** Tabs\n*/\n\n.tw-tab-set {\n}\n\n.tw-tab-buttons {\n\tfont-size: 0.85em;\n\tline-height: 100%;\n\tpadding-top: 1em;\n\tmargin-bottom: -1px;\n}\n\n.tw-tab-buttons button {\n\tcolor: #666;\n\tmargin-left: 2px;\n\tmargin-right: 2px;\n\tfont-weight: 300;\n\tborder: none;\n\tbackground: inherit;\n}\n\n.tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #fff;\n\tborder-left: 1px solid #d8d8d8;\n\tborder-top: 1px solid #d8d8d8;\n\tborder-right: 1px solid #d8d8d8;\n\tmargin-bottom: -1px;\n}\n\n.tw-tab-buttons button:not(.tw-tab-selected) {\n\tbackground-color: #d8d8d8;\n\tborder-left: 1px solid #ccc;\n\tborder-top: 1px solid #ccc;\n\tborder-right: 1px solid #ccc;\n}\n\n.tw-tab-divider {\n\tborder-top: 1px solid #d8d8d8;\n}\n\n.tw-tab-content {\n\tpadding-top: 14px;\n}\n\n.tw-sidebar-lists .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #ececec;\n\tborder-bottom: 1px solid #ececec;\n}\n\n.tw-sidebar-lists .tw-tab-divider {\n\tborder-top: none;\n\theight: 1px;\n\t<<background-linear-gradient \"left, rgb(216,216,216) 0%, rgb(236,236,236) 250px\">>\n}\n\n.tw-more-sidebar {\n\twhite-space: nowrap;\n}\n\n@media (min-width: 770px) {\n\t.tw-more-sidebar {\n\t\tmargin-left: -14px;\n\t}\n}\n\n.tw-more-sidebar .tw-tab-buttons {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\ttext-align: right;\n\tpadding-top: 0;\n\tpadding-left: 0;\n}\n\n.tw-more-sidebar .tw-tab-buttons button {\n\tdisplay: block;\n\twidth: 100%;\n\ttext-align: right;\n}\n\n.tw-sidebar-lists .tw-more-sidebar .tw-tab-divider {\n\tdisplay: none;\n}\n\n.tw-more-sidebar .tw-tab-content {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tpadding-top: 0;\n\tpadding-left: 14px;\n}\n\n.tw-more-sidebar .tw-tab-buttons button {\n\tbackground-color: #ececec;\n\t<<background-linear-gradient \"left, rgb(236,236,236) 0%, rgb(224,224,224) 100%\">>\n\tborder-top: none;\n\tborder-left: none;\n\tborder-bottom: none;\n\tborder-right: 1px solid #ccc;\n}\n\n.tw-more-sidebar .tw-tab-buttons button.tw-tab-selected {\n\tbackground-color: #fff;\n\t<<background-linear-gradient \"left, rgb(236,236,236) 0%, rgb(248,248,248) 100%\">>\n\tborder: none;\n}\n\n/*\n** Alerts\n*/\n\n.tw-alert {\n\t<<border-radius 6px>>\n\tmargin: 7px 7px 7px 7px;\n\tpadding: 14px 14px 14px 14px;\n\tborder: 3px solid #DBB727;\n\tbackground-color: rgb(250, 210, 50);\n}\n\n.tw-static-alert {\n\tposition: relative;\n}\n\n.tw-static-alert-inner {\n\tpadding: 0 2px 2px 42px;\n\tcolor: #AAA;\n\tposition: absolute;\n}\n\n/*\n** Grids\n*/\n\n.tw-grid-frame td {\n\twidth: 1em;\n\theight: 1em;\n}\n\n/*\n** Control panel\n*/\n\n.tw-control-panel td {\n\tpadding: 4px;\n}\n\n.tw-control-panel table, .tw-control-panel table input, .tw-control-panel table textarea {\n\twidth: 100%;\n}\n\n/*\n** Message boxes\n*/\n\n.tw-message-box {\n\tborder: 1px solid #CFD6E6;\n\tbackground: #ECF2FF;\n\tpadding: 0px 21px 0px 21px;\n\tmargin: 0 -21px 0 -21px;\n\tfont-size: 12px;\n\tline-height: 18px;\n\tcolor: #547599;\n}\n\n.tw-message-box img {\n\tfloat: right;\n\twidth: 150px;\n\tmargin: 0px 0px 12px 12px;\n}\n" | |
}, | |
"$:/themes/tiddlywiki/vanilla/colourmappings": { | |
"title": "$:/themes/tiddlywiki/vanilla/colourmappings", | |
"type": "application/x-tiddler-dictionary", | |
"text": "tiddlerbackground: {{$:/themes/tiddlywiki/vanilla/colours##background}}\nforeground: {{$:/themes/tiddlywiki/vanilla/colours##foreground}}\npagebackground: {{$:/themes/tiddlywiki/vanilla/colours##pagebackground}}\nlinkbackground: {{$:/themes/tiddlywiki/vanilla/colours##background}}\nlinkforeground: {{$:/themes/tiddlywiki/vanilla/colours##primary}}\ndropdownbackground: {{$:/themes/tiddlywiki/vanilla/colours##background}}\ndropdownborder: {{$:/themes/tiddlywiki/vanilla/colours##medium}}\n" | |
}, | |
"$:/themes/tiddlywiki/vanilla/colours": { | |
"title": "$:/themes/tiddlywiki/vanilla/colours", | |
"type": "application/x-tiddler-dictionary", | |
"text": "primary: #5778D8\nbackground: #ffffff\nforeground: #333333\npagebackground: #ececec\nmedium: #bbbbbb\n" | |
}, | |
"$:/themes/tiddlywiki/vanilla/metrics": { | |
"title": "$:/themes/tiddlywiki/vanilla/metrics", | |
"type": "application/x-tiddler-dictionary", | |
"text": "fontsize: `14px`\nlineheight: `20px`\nstoryleft: `0px`\nstorytop: `0px`\nstoryright: `770px`\nstorywidth: `770px`\ntiddlerwidth: `686px`\n" | |
}, | |
"$:/themes/tiddlywiki/vanilla/reset": { | |
"title": "$:/themes/tiddlywiki/vanilla/reset", | |
"type": "text/plain", | |
"text": "/*! normalize.css v2.1.0 | MIT License | git.io/normalize */\n\n/* ==========================================================================\n HTML5 display definitions\n ========================================================================== */\n\n/**\n * Correct `block` display not defined in IE 8/9.\n */\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nnav,\nsection,\nsummary {\n display: block;\n}\n\n/**\n * Correct `inline-block` display not defined in IE 8/9.\n */\n\naudio,\ncanvas,\nvideo {\n display: inline-block;\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\n/**\n * Address styling not present in IE 8/9.\n */\n\n[hidden] {\n display: none;\n}\n\n/* ==========================================================================\n Base\n ========================================================================== */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\n\nhtml {\n font-family: sans-serif; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -ms-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n margin: 0;\n}\n\n/* ==========================================================================\n Links\n ========================================================================== */\n\n/**\n * Address `outline` inconsistency between Chrome and other browsers.\n */\n\na:focus {\n outline: thin dotted;\n}\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\n\na:active,\na:hover {\n outline: 0;\n}\n\n/* ==========================================================================\n Typography\n ========================================================================== */\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari 5, and Chrome.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/**\n * Address styling not present in IE 8/9, Safari 5, and Chrome.\n */\n\nabbr[title] {\n border-bottom: 1px dotted;\n}\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\n\ndfn {\n font-style: italic;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0;\n}\n\n/**\n * Address styling not present in IE 8/9.\n */\n\nmark {\n background: #ff0;\n color: #000;\n}\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\n\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, serif;\n font-size: 1em;\n}\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\n\npre {\n white-space: pre-wrap;\n}\n\n/**\n * Set consistent quote types.\n */\n\nq {\n quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\";\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsup {\n top: -0.5em;\n}\n\nsub {\n bottom: -0.25em;\n}\n\n/* ==========================================================================\n Embedded content\n ========================================================================== */\n\n/**\n * Remove border when inside `a` element in IE 8/9.\n */\n\nimg {\n border: 0;\n}\n\n/**\n * Correct overflow displayed oddly in IE 9.\n */\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\n/* ==========================================================================\n Figures\n ========================================================================== */\n\n/**\n * Address margin not present in IE 8/9 and Safari 5.\n */\n\nfigure {\n margin: 0;\n}\n\n/* ==========================================================================\n Forms\n ========================================================================== */\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n border: 0; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n */\n\nbutton,\ninput,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 2 */\n margin: 0; /* 3 */\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\nbutton,\ninput {\n line-height: normal;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button; /* 2 */\n cursor: pointer; /* 3 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\n\n/**\n * 1. Address box sizing set to `content-box` in IE 8/9.\n * 2. Remove excess padding in IE 8/9.\n */\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n * (include `-moz` to future-proof).\n */\n\ninput[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box; /* 2 */\n box-sizing: content-box;\n}\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n\n/**\n * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\n\ntextarea {\n overflow: auto; /* 1 */\n vertical-align: top; /* 2 */\n}\n\n/* ==========================================================================\n Tables\n ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n" | |
}, | |
"$:/themes/tiddlywiki/vanilla/settings": { | |
"title": "$:/themes/tiddlywiki/vanilla/settings", | |
"type": "application/x-tiddler-dictionary", | |
"text": "fontfamily: `\"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif`\n" | |
} | |
} | |
}</pre> | |
</div> | |
</div> | |
<!--~~ Library modules ~~--> | |
<div id="libraryModules" style="display:none;"> | |
<script data-tiddler-library="yes" data-tiddler-title="$:/library/sjcl.js" data-tiddler-type="application/javascript" type="text/javascript">"use strict";var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}}; | |
if(typeof module!="undefined"&&module.exports)module.exports=sjcl; | |
sjcl.cipher.aes=function(a){this.h[0][0][0]||this.z();var b,c,d,e,f=this.h[0][4],g=this.h[1];b=a.length;var h=1;if(b!==4&&b!==6&&b!==8)throw new sjcl.exception.invalid("invalid aes key size");this.a=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(a%b===0||b===8&&a%b===4){c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255];if(a%b===0){c=c<<8^c>>>24^h<<24;h=h<<1^(h>>7)*283}}d[a]=d[a-b]^c}for(b=0;a;b++,a--){c=d[b&3?a:a-4];e[b]=a<=4||b<4?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^ | |
g[3][f[c&255]]}}; | |
sjcl.cipher.aes.prototype={encrypt:function(a){return this.I(a,0)},decrypt:function(a){return this.I(a,1)},h:[[[],[],[],[],[]],[[],[],[],[],[]]],z:function(){var a=this.h[0],b=this.h[1],c=a[4],d=b[4],e,f,g,h=[],i=[],k,j,l,m;for(e=0;e<0x100;e++)i[(h[e]=e<<1^(e>>7)*283)^e]=e;for(f=g=0;!c[f];f^=k||1,g=i[g]||1){l=g^g<<1^g<<2^g<<3^g<<4;l=l>>8^l&255^99;c[f]=l;d[l]=f;j=h[e=h[k=h[f]]];m=j*0x1010101^e*0x10001^k*0x101^f*0x1010100;j=h[l]*0x101^l*0x1010100;for(e=0;e<4;e++){a[e][f]=j=j<<24^j>>>8;b[e][l]=m=m<<24^m>>>8}}for(e= | |
0;e<5;e++){a[e]=a[e].slice(0);b[e]=b[e].slice(0)}},I:function(a,b){if(a.length!==4)throw new sjcl.exception.invalid("invalid aes block size");var c=this.a[b],d=a[0]^c[0],e=a[b?3:1]^c[1],f=a[2]^c[2];a=a[b?1:3]^c[3];var g,h,i,k=c.length/4-2,j,l=4,m=[0,0,0,0];g=this.h[b];var n=g[0],o=g[1],p=g[2],q=g[3],r=g[4];for(j=0;j<k;j++){g=n[d>>>24]^o[e>>16&255]^p[f>>8&255]^q[a&255]^c[l];h=n[e>>>24]^o[f>>16&255]^p[a>>8&255]^q[d&255]^c[l+1];i=n[f>>>24]^o[a>>16&255]^p[d>>8&255]^q[e&255]^c[l+2];a=n[a>>>24]^o[d>>16& | |
255]^p[e>>8&255]^q[f&255]^c[l+3];l+=4;d=g;e=h;f=i}for(j=0;j<4;j++){m[b?3&-j:j]=r[d>>>24]<<24^r[e>>16&255]<<16^r[f>>8&255]<<8^r[a&255]^c[l++];g=d;d=e;e=f;f=a;a=g}return m}}; | |
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.P(a.slice(b/32),32-(b&31)).slice(1);return c===undefined?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(a.length===0||b.length===0)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return d===32?a.concat(b):sjcl.bitArray.P(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length; | |
if(b===0)return 0;return(b-1)*32+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(a.length*32<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b&=31;if(c>0&&b)a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1);return a},partial:function(a,b,c){if(a===32)return b;return(c?b|0:b<<32-a)+a*0x10000000000},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return false;var c=0,d;for(d=0;d<a.length;d++)c|= | |
a[d]^b[d];return c===0},P:function(a,b,c,d){var e;e=0;if(d===undefined)d=[];for(;b>=32;b-=32){d.push(c);c=0}if(b===0)return d.concat(a);for(e=0;e<a.length;e++){d.push(c|a[e]>>>b);c=a[e]<<32-b}e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,b+a>32?c:d.pop(),1));return d},k:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]}}; | |
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++){if((d&3)===0)e=a[d/4];b+=String.fromCharCode(e>>>24);e<<=8}return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++){d=d<<8|a.charCodeAt(c);if((c&3)===3){b.push(d);d=0}}c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}}; | |
sjcl.codec.hex={fromBits:function(a){var b="",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\s|0x/g,"");d=a.length;a+="00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,d*4)}}; | |
sjcl.codec.base64={F:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=sjcl.codec.base64.F,g=0,h=sjcl.bitArray.bitLength(a);if(c)f=f.substr(0,62)+"-_";for(c=0;d.length*6<h;){d+=f.charAt((g^a[c]>>>e)>>>26);if(e<6){g=a[c]<<6-e;e+=26;c++}else{g<<=6;e-=6}}for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d=0,e=sjcl.codec.base64.F,f=0,g;if(b)e=e.substr(0,62)+"-_";for(b=0;b<a.length;b++){g=e.indexOf(a.charAt(b)); | |
if(g<0)throw new sjcl.exception.invalid("this isn't base64!");if(d>26){d-=26;c.push(f^g>>>d);f=g<<32-d}else{d+=6;f^=g<<32-d}}d&56&&c.push(sjcl.bitArray.partial(d&56,f,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.a[0]||this.z();if(a){this.n=a.n.slice(0);this.i=a.i.slice(0);this.e=a.e}else this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()}; | |
sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.n=this.N.slice(0);this.i=[];this.e=0;return this},update:function(a){if(typeof a==="string")a=sjcl.codec.utf8String.toBits(a);var b,c=this.i=sjcl.bitArray.concat(this.i,a);b=this.e;a=this.e=b+sjcl.bitArray.bitLength(a);for(b=512+b&-512;b<=a;b+=512)this.D(c.splice(0,16));return this},finalize:function(){var a,b=this.i,c=this.n;b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.e/ | |
4294967296));for(b.push(this.e|0);b.length;)this.D(b.splice(0,16));this.reset();return c},N:[],a:[],z:function(){function a(e){return(e-Math.floor(e))*0x100000000|0}var b=0,c=2,d;a:for(;b<64;c++){for(d=2;d*d<=c;d++)if(c%d===0)continue a;if(b<8)this.N[b]=a(Math.pow(c,0.5));this.a[b]=a(Math.pow(c,1/3));b++}},D:function(a){var b,c,d=a.slice(0),e=this.n,f=this.a,g=e[0],h=e[1],i=e[2],k=e[3],j=e[4],l=e[5],m=e[6],n=e[7];for(a=0;a<64;a++){if(a<16)b=d[a];else{b=d[a+1&15];c=d[a+14&15];b=d[a&15]=(b>>>7^b>>>18^ | |
b>>>3^b<<25^b<<14)+(c>>>17^c>>>19^c>>>10^c<<15^c<<13)+d[a&15]+d[a+9&15]|0}b=b+n+(j>>>6^j>>>11^j>>>25^j<<26^j<<21^j<<7)+(m^j&(l^m))+f[a];n=m;m=l;l=j;j=k+b|0;k=i;i=h;h=g;g=b+(h&i^k&(h^i))+(h>>>2^h>>>13^h>>>22^h<<30^h<<19^h<<10)|0}e[0]=e[0]+g|0;e[1]=e[1]+h|0;e[2]=e[2]+i|0;e[3]=e[3]+k|0;e[4]=e[4]+j|0;e[5]=e[5]+l|0;e[6]=e[6]+m|0;e[7]=e[7]+n|0}}; | |
sjcl.mode.ccm={name:"ccm",encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,i=h.bitLength(c)/8,k=h.bitLength(g)/8;e=e||64;d=d||[];if(i<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;f<4&&k>>>8*f;f++);if(f<15-i)f=15-i;c=h.clamp(c,8*(15-f));b=sjcl.mode.ccm.H(a,b,c,d,e,f);g=sjcl.mode.ccm.J(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),i=f.clamp(b,h-e),k=f.bitSlice(b, | |
h-e);h=(h-e)/8;if(g<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;b<4&&h>>>8*b;b++);if(b<15-g)b=15-g;c=f.clamp(c,8*(15-b));i=sjcl.mode.ccm.J(a,i,c,k,e,b);a=sjcl.mode.ccm.H(a,i.data,c,d,e,b);if(!f.equal(i.tag,a))throw new sjcl.exception.corrupt("ccm: tag doesn't match");return i.data},H:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,i=h.k;e/=8;if(e%2||e<4||e>16)throw new sjcl.exception.invalid("ccm: invalid tag length");if(d.length>0xffffffff||b.length>0xffffffff)throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data"); | |
f=[h.partial(8,(d.length?64:0)|e-2<<2|f-1)];f=h.concat(f,c);f[3]|=h.bitLength(b)/8;f=a.encrypt(f);if(d.length){c=h.bitLength(d)/8;if(c<=65279)g=[h.partial(16,c)];else if(c<=0xffffffff)g=h.concat([h.partial(16,65534)],[c]);g=h.concat(g,d);for(d=0;d<g.length;d+=4)f=a.encrypt(i(f,g.slice(d,d+4).concat([0,0,0])))}for(d=0;d<b.length;d+=4)f=a.encrypt(i(f,b.slice(d,d+4).concat([0,0,0])));return h.clamp(f,e*8)},J:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.k;var i=b.length,k=h.bitLength(b);c=h.concat([h.partial(8, | |
f-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!i)return{tag:d,data:[]};for(g=0;g<i;g+=4){c[3]++;e=a.encrypt(c);b[g]^=e[0];b[g+1]^=e[1];b[g+2]^=e[2];b[g+3]^=e[3]}return{tag:d,data:h.clamp(b,k)}}}; | |
sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(sjcl.bitArray.bitLength(c)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.B,i=sjcl.bitArray,k=i.k,j=[0,0,0,0];c=h(a.encrypt(c));var l,m=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4){l=b.slice(g,g+4);j=k(j,l);m=m.concat(k(c,a.encrypt(k(c,l))));c=h(c)}l=b.slice(g);b=i.bitLength(l);g=a.encrypt(k(c,[0,0,0,b]));l=i.clamp(k(l.concat([0,0,0]),g),b);j=k(j,k(l.concat([0,0,0]),g));j=a.encrypt(k(j,k(c,h(c)))); | |
if(d.length)j=k(j,f?d:sjcl.mode.ocb2.pmac(a,d));return m.concat(i.concat(l,i.clamp(j,e)))},decrypt:function(a,b,c,d,e,f){if(sjcl.bitArray.bitLength(c)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");e=e||64;var g=sjcl.mode.ocb2.B,h=sjcl.bitArray,i=h.k,k=[0,0,0,0],j=g(a.encrypt(c)),l,m,n=sjcl.bitArray.bitLength(b)-e,o=[];d=d||[];for(c=0;c+4<n/32;c+=4){l=i(j,a.decrypt(i(j,b.slice(c,c+4))));k=i(k,l);o=o.concat(l);j=g(j)}m=n-c*32;l=a.encrypt(i(j,[0,0,0,m]));l=i(l,h.clamp(b.slice(c), | |
m).concat([0,0,0]));k=i(k,l);k=a.encrypt(i(k,i(j,g(j))));if(d.length)k=i(k,f?d:sjcl.mode.ocb2.pmac(a,d));if(!h.equal(h.clamp(k,e),h.bitSlice(b,n)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return o.concat(h.clamp(l,m))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.B,e=sjcl.bitArray,f=e.k,g=[0,0,0,0],h=a.encrypt([0,0,0,0]);h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4){h=d(h);g=f(g,a.encrypt(f(h,b.slice(c,c+4))))}b=b.slice(c);if(e.bitLength(b)<128){h=f(h,d(h));b=e.concat(b,[2147483648|0,0, | |
0,0])}g=f(g,b);return a.encrypt(f(d(f(h,d(h))),g))},B:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^(a[0]>>>31)*135]}};sjcl.misc.hmac=function(a,b){this.M=b=b||sjcl.hash.sha256;var c=[[],[]],d=b.prototype.blockSize/32;this.l=[new b,new b];if(a.length>d)a=b.hash(a);for(b=0;b<d;b++){c[0][b]=a[b]^909522486;c[1][b]=a[b]^1549556828}this.l[0].update(c[0]);this.l[1].update(c[1])}; | |
sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a,b){a=(new this.M(this.l[0])).update(a,b).finalize();return(new this.M(this.l[1])).update(a).finalize()}; | |
sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E3;if(d<0||c<0)throw sjcl.exception.invalid("invalid params to pbkdf2");if(typeof a==="string")a=sjcl.codec.utf8String.toBits(a);e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,i,k=[],j=sjcl.bitArray;for(i=1;32*k.length<(d||1);i++){e=f=a.encrypt(j.concat(b,[i]));for(g=1;g<c;g++){f=a.encrypt(f);for(h=0;h<f.length;h++)e[h]^=f[h]}k=k.concat(e)}if(d)k=j.clamp(k,d);return k}; | |
sjcl.random={randomWords:function(a,b){var c=[];b=this.isReady(b);var d;if(b===0)throw new sjcl.exception.notReady("generator isn't seeded");else b&2&&this.U(!(b&1));for(b=0;b<a;b+=4){(b+1)%0x10000===0&&this.L();d=this.w();c.push(d[0],d[1],d[2],d[3])}this.L();return c.slice(0,a)},setDefaultParanoia:function(a){this.t=a},addEntropy:function(a,b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.q[c],h=this.isReady(),i=0;d=this.G[c];if(d===undefined)d=this.G[c]=this.R++;if(g===undefined)g=this.q[c]= | |
0;this.q[c]=(this.q[c]+1)%this.b.length;switch(typeof a){case "number":if(b===undefined)b=1;this.b[g].update([d,this.u++,1,b,f,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if(c==="[object Uint32Array]"){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else{if(c!=="[object Array]")i=1;for(c=0;c<a.length&&!i;c++)if(typeof a[c]!="number")i=1}if(!i){if(b===undefined)for(c=b=0;c<a.length;c++)for(e=a[c];e>0;){b++;e>>>=1}this.b[g].update([d,this.u++,2,b,f,a.length].concat(a))}break;case "string":if(b=== | |
undefined)b=a.length;this.b[g].update([d,this.u++,3,b,f,a.length]);this.b[g].update(a);break;default:i=1}if(i)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.j[g]+=b;this.f+=b;if(h===0){this.isReady()!==0&&this.K("seeded",Math.max(this.g,this.f));this.K("progress",this.getProgress())}},isReady:function(a){a=this.C[a!==undefined?a:this.t];return this.g&&this.g>=a?this.j[0]>80&&(new Date).valueOf()>this.O?3:1:this.f>=a?2:0},getProgress:function(a){a= | |
this.C[a?a:this.t];return this.g>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.m){if(window.addEventListener){window.addEventListener("load",this.o,false);window.addEventListener("mousemove",this.p,false)}else if(document.attachEvent){document.attachEvent("onload",this.o);document.attachEvent("onmousemove",this.p)}else throw new sjcl.exception.bug("can't attach event");this.m=true}},stopCollectors:function(){if(this.m){if(window.removeEventListener){window.removeEventListener("load", | |
this.o,false);window.removeEventListener("mousemove",this.p,false)}else if(window.detachEvent){window.detachEvent("onload",this.o);window.detachEvent("onmousemove",this.p)}this.m=false}},addEventListener:function(a,b){this.r[a][this.Q++]=b},removeEventListener:function(a,b){var c;a=this.r[a];var d=[];for(c in a)a.hasOwnProperty(c)&&a[c]===b&&d.push(c);for(b=0;b<d.length;b++){c=d[b];delete a[c]}},b:[new sjcl.hash.sha256],j:[0],A:0,q:{},u:0,G:{},R:0,g:0,f:0,O:0,a:[0,0,0,0,0,0,0,0],d:[0,0,0,0],s:undefined, | |
t:6,m:false,r:{progress:{},seeded:{}},Q:0,C:[0,48,64,96,128,192,0x100,384,512,768,1024],w:function(){for(var a=0;a<4;a++){this.d[a]=this.d[a]+1|0;if(this.d[a])break}return this.s.encrypt(this.d)},L:function(){this.a=this.w().concat(this.w());this.s=new sjcl.cipher.aes(this.a)},T:function(a){this.a=sjcl.hash.sha256.hash(this.a.concat(a));this.s=new sjcl.cipher.aes(this.a);for(a=0;a<4;a++){this.d[a]=this.d[a]+1|0;if(this.d[a])break}},U:function(a){var b=[],c=0,d;this.O=b[0]=(new Date).valueOf()+3E4;for(d= | |
0;d<16;d++)b.push(Math.random()*0x100000000|0);for(d=0;d<this.b.length;d++){b=b.concat(this.b[d].finalize());c+=this.j[d];this.j[d]=0;if(!a&&this.A&1<<d)break}if(this.A>=1<<this.b.length){this.b.push(new sjcl.hash.sha256);this.j.push(0)}this.f-=c;if(c>this.g)this.g=c;this.A++;this.T(b)},p:function(a){sjcl.random.addEntropy([a.x||a.clientX||a.offsetX||0,a.y||a.clientY||a.offsetY||0],2,"mouse")},o:function(){sjcl.random.addEntropy((new Date).valueOf(),2,"loadtime")},K:function(a,b){var c;a=sjcl.random.r[a]; | |
var d=[];for(c in a)a.hasOwnProperty(c)&&d.push(a[c]);for(c=0;c<d.length;c++)d[c](b)}};try{var s=new Uint32Array(32);crypto.getRandomValues(s);sjcl.random.addEntropy(s,1024,"crypto['getRandomValues']")}catch(t){} | |
sjcl.json={defaults:{v:1,iter:1E3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},encrypt:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.c({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.c(f,c);c=f.adata;if(typeof f.salt==="string")f.salt=sjcl.codec.base64.toBits(f.salt);if(typeof f.iv==="string")f.iv=sjcl.codec.base64.toBits(f.iv);if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||typeof a==="string"&&f.iter<=100||f.ts!==64&&f.ts!==96&&f.ts!==128||f.ks!==128&&f.ks!==192&&f.ks!==0x100||f.iv.length< | |
2||f.iv.length>4)throw new sjcl.exception.invalid("json encrypt: invalid parameters");if(typeof a==="string"){g=sjcl.misc.cachedPbkdf2(a,f);a=g.key.slice(0,f.ks/32);f.salt=g.salt}if(typeof b==="string")b=sjcl.codec.utf8String.toBits(b);if(typeof c==="string")c=sjcl.codec.utf8String.toBits(c);g=new sjcl.cipher[f.cipher](a);e.c(d,f);d.key=a;f.ct=sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return e.encode(f)},decrypt:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.c(e.c(e.c({},e.defaults),e.decode(b)), | |
c,true);var f;c=b.adata;if(typeof b.salt==="string")b.salt=sjcl.codec.base64.toBits(b.salt);if(typeof b.iv==="string")b.iv=sjcl.codec.base64.toBits(b.iv);if(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||typeof a==="string"&&b.iter<=100||b.ts!==64&&b.ts!==96&&b.ts!==128||b.ks!==128&&b.ks!==192&&b.ks!==0x100||!b.iv||b.iv.length<2||b.iv.length>4)throw new sjcl.exception.invalid("json decrypt: invalid parameters");if(typeof a==="string"){f=sjcl.misc.cachedPbkdf2(a,b);a=f.key.slice(0,b.ks/32);b.salt=f.salt}if(typeof c=== | |
"string")c=sjcl.codec.utf8String.toBits(c);f=new sjcl.cipher[b.cipher](a);c=sjcl.mode[b.mode].decrypt(f,b.ct,b.iv,c,b.ts);e.c(d,b);d.key=a;return sjcl.codec.utf8String.fromBits(c)},encode:function(a){var b,c="{",d="";for(b in a)if(a.hasOwnProperty(b)){if(!b.match(/^[a-z0-9]+$/i))throw new sjcl.exception.invalid("json encode: invalid property name");c+=d+'"'+b+'":';d=",";switch(typeof a[b]){case "number":case "boolean":c+=a[b];break;case "string":c+='"'+escape(a[b])+'"';break;case "object":c+='"'+ | |
sjcl.codec.base64.fromBits(a[b],1)+'"';break;default:throw new sjcl.exception.bug("json encode: unsupported type");}}return c+"}"},decode:function(a){a=a.replace(/\s/g,"");if(!a.match(/^\{.*\}$/))throw new sjcl.exception.invalid("json decode: this isn't json!");a=a.replace(/^\{|\}$/g,"").split(/,/);var b={},c,d;for(c=0;c<a.length;c++){if(!(d=a[c].match(/^(?:(["']?)([a-z][a-z0-9]*)\1):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i)))throw new sjcl.exception.invalid("json decode: this isn't json!");b[d[2]]= | |
d[3]?parseInt(d[3],10):d[2].match(/^(ct|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4])}return b},c:function(a,b,c){if(a===undefined)a={};if(b===undefined)return a;var d;for(d in b)if(b.hasOwnProperty(d)){if(c&&a[d]!==undefined&&a[d]!==b[d])throw new sjcl.exception.invalid("required parameter overridden");a[d]=b[d]}return a},W:function(a,b){var c={},d;for(d in a)if(a.hasOwnProperty(d)&&a[d]!==b[d])c[d]=a[d];return c},V:function(a,b){var c={},d;for(d=0;d<b.length;d++)if(a[b[d]]!==undefined)c[b[d]]= | |
a[b[d]];return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.S={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.S,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=b.salt===undefined?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};</script> | |
</div> | |
<!--~~ Boot kernel prologue ~~--> | |
<div id="bootKernelPrefix" style="display:none;"> | |
<script data-tiddler-title="$:/boot/bootprefix.js" data-tiddler-type="application/javascript" type="text/javascript">/*\ | |
title: $:/boot/bootprefix.js | |
type: application/javascript | |
This file sets up the globals that need to be available when JavaScript modules are executed in the browser. The overall sequence is: | |
# BootPrefix.js | |
# <module definitions> | |
# Boot.js | |
See Boot.js for further details of the boot process. | |
\*/ | |
var _bootprefix = (function($tw) { | |
"use strict"; | |
$tw = $tw || {browser: typeof(window) !== "undefined" ? {} : null}; | |
/* | |
Information about each module is kept in an object with these members: | |
moduleType: type of module | |
definition: object, function or string defining the module; see below | |
exports: exports of the module, filled in after execution | |
The `definition` can be of several types: | |
* An object can be used to directly specify the exports of the module | |
* A function with the arguments `module,require,exports` that returns `exports` | |
* A string function body with the same arguments | |
Each moduleInfo object is stored in two hashmaps: $tw.modules.titles and $tw.modules.types. The first is indexed by title and the second is indexed by type and then title | |
*/ | |
$tw.modules = { | |
titles: {}, // hashmap by module name of moduleInfo | |
types: {} // hashmap by module type and then name of moduleInfo | |
}; | |
/* | |
Define a JavaScript tiddler module for later execution | |
moduleName: name of module being defined | |
moduleType: type of module | |
definition: module definition; see discussion above | |
*/ | |
$tw.modules.define = function(moduleName,moduleType,definition) { | |
// Create the moduleInfo | |
var moduleInfo = { | |
moduleType: moduleType, | |
definition: definition, | |
exports: undefined | |
}; | |
// If the definition is already an object we can use it as the exports | |
if(typeof moduleInfo.definition === "object") { | |
moduleInfo.exports = definition; | |
} | |
// Store the module in the titles hashmap | |
if(Object.prototype.hasOwnProperty.call($tw.modules.titles,moduleName)) { | |
console.log("Warning: Redefined module - " + moduleName); | |
} | |
$tw.modules.titles[moduleName] = moduleInfo; | |
// Store the module in the types hashmap | |
if(!Object.prototype.hasOwnProperty.call($tw.modules.types,moduleType)) { | |
$tw.modules.types[moduleType] = {}; | |
} | |
if(Object.prototype.hasOwnProperty.call($tw.modules.types[moduleType],moduleName)) { | |
console.log("Warning: Redefined module - " + moduleName); | |
} | |
$tw.modules.types[moduleType][moduleName] = moduleInfo; | |
}; | |
/* | |
External JavaScript can populate this array before calling boot.js in order to preload tiddlers | |
*/ | |
$tw.preloadTiddlers = $tw.preloadTiddlers || []; | |
/* | |
Convenience function for pushing a tiddler onto the preloading array | |
*/ | |
$tw.preloadTiddler = function(fields) { | |
$tw.preloadTiddlers.push(fields); | |
}; | |
return $tw | |
}); | |
if(typeof(exports) === "undefined") { | |
// Set up $tw global for the browser | |
window.$tw = _bootprefix(); | |
} else { | |
// Export functionality as a module | |
exports.bootprefix = _bootprefix; | |
} | |
</script> | |
</div> | |
<!--~~ Static modules ~~--> | |
<div id="modules" style="display:none;"> | |
</div> | |
<!--~~ Boot kernel ~~--> | |
<div id="bootKernel" style="display:none;"> | |
<script data-tiddler-title="$:/boot/boot.js" data-tiddler-type="application/javascript" type="text/javascript">/*\ | |
title: $:/boot/boot.js | |
type: application/javascript | |
The main boot kernel for TiddlyWiki. This single file creates a barebones TW environment that is just sufficient to bootstrap the modules containing the main logic of the application. | |
On the server this file is executed directly to boot TiddlyWiki. In the browser, this file is packed into a single HTML file along with other elements: | |
# bootprefix.js | |
# <module definitions> | |
# boot.js | |
The module definitions on the browser look like this: | |
$tw.defineModule("MyModule","moduletype",function(module,exports,require) { | |
// Module code inserted here | |
return exports; | |
}); | |
In practice, each module is wrapped in a separate script block. | |
\*/ | |
var _boot = (function($tw) { | |
/*jslint node: true, browser: true */ | |
/*global modules: false, $tw: false */ | |
"use strict"; | |
// Include bootprefix if we're not given module data | |
if(!$tw) { | |
$tw = require("./bootprefix.js").bootprefix(); | |
} | |
$tw.utils = $tw.utils || {}; | |
$tw.boot = $tw.boot || {}; | |
/////////////////////////// Standard node.js libraries | |
var fs, path, vm; | |
if(!$tw.browser) { | |
fs = require("fs"); | |
path = require("path"); | |
vm = require("vm"); | |
} | |
/////////////////////////// Utility functions | |
/* | |
Log a message | |
*/ | |
$tw.utils.log = function(/* args */) { | |
if(console !== undefined && console.log !== undefined) { | |
return Function.apply.call(console.log, console, arguments); | |
} | |
}; | |
/* | |
Check if an object has a property | |
*/ | |
$tw.utils.hop = function(object,property) { | |
return object ? Object.prototype.hasOwnProperty.call(object,property) : false; | |
}; | |
/* | |
Determine if a value is an array | |
*/ | |
$tw.utils.isArray = function(value) { | |
return Object.prototype.toString.call(value) == "[object Array]"; | |
}; | |
/* | |
Determine if a value is a date | |
*/ | |
$tw.utils.isDate = function(value) { | |
return Object.prototype.toString.call(value) === "[object Date]"; | |
}; | |
/* | |
Iterate through all the own properties of an object or array. Callback is invoked with (element,title,object) | |
*/ | |
$tw.utils.each = function(object,callback) { | |
var f; | |
if(object) { | |
if($tw.utils.isArray(object)) { | |
for(f=0; f<object.length; f++) { | |
callback(object[f],f,object); | |
} | |
} else { | |
for(f in object) { | |
if($tw.utils.hop(object,f)) { | |
callback(object[f],f,object); | |
} | |
} | |
} | |
} | |
}; | |
/* | |
Helper for making DOM elements | |
tag: tag name | |
options: see below | |
Options include: | |
attributes: hashmap of attribute values | |
text: text to add as a child node | |
children: array of further child nodes | |
innerHTML: optional HTML for element | |
class: class name(s) | |
document: defaults to current document | |
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded) | |
*/ | |
$tw.utils.domMaker = function(tag,options) { | |
var doc = options.document || document; | |
var element = doc.createElement(tag); | |
if(options["class"]) { | |
element.className = options["class"]; | |
} | |
if(options.text) { | |
element.appendChild(document.createTextNode(options.text)); | |
} | |
$tw.utils.each(options.children,function(child) { | |
element.appendChild(child); | |
}); | |
if(options.innerHTML) { | |
element.innerHTML = options.innerHTML; | |
} | |
$tw.utils.each(options.attributes,function(attribute,name) { | |
element.setAttribute(name,attribute); | |
}); | |
if(options.eventListeners) { | |
$tw.utils.addEventListeners(element,options.eventListeners); | |
} | |
return element; | |
}; | |
/* | |
Display an error and exit | |
*/ | |
$tw.utils.error = function(err) { | |
// Prepare the error message | |
var errHeading = "Internal JavaScript Error", | |
promptMsg = "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser"; | |
// Log the error to the console | |
console.error(err); | |
if($tw.browser) { | |
// Display an error message to the user | |
var dm = $tw.utils.domMaker, | |
heading = dm("h1",{text: errHeading}), | |
prompt = dm("div",{text: promptMsg, "class": "tw-error-prompt"}), | |
message = dm("div",{text: err}), | |
button = dm("button",{text: "close"}), | |
form = dm("form",{children: [heading,prompt,message,button], "class": "tw-error-form"}); | |
document.body.insertBefore(form,document.body.firstChild); | |
form.addEventListener("submit",function(event) { | |
document.body.removeChild(form); | |
event.preventDefault(); | |
return false; | |
},true); | |
return null; | |
} else { | |
// Exit if we're under node.js | |
process.exit(1); | |
} | |
}; | |
/* | |
Use our custom error handler if we're in the browser | |
*/ | |
if($tw.browser) { | |
window.onerror = function(errorMsg,url,lineNumber) { | |
$tw.utils.error(errorMsg); | |
return false; | |
}; | |
} | |
/* | |
Extend an object with the properties from a list of source objects | |
*/ | |
$tw.utils.extend = function(object /*, sourceObjectList */) { | |
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { | |
if(source) { | |
for (var p in source) { | |
object[p] = source[p]; | |
} | |
} | |
}); | |
return object; | |
}; | |
/* | |
Fill in any null or undefined properties of an object with the properties from a list of source objects. Each property that is an object is called recursively | |
*/ | |
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) { | |
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { | |
if(source) { | |
for (var p in source) { | |
if(object[p] == null) { | |
object[p] = source[p]; | |
} | |
if(typeof object[p] === "object" && typeof source[p] === "object") { | |
$tw.utils.deepDefaults(object[p],source[p]); | |
} | |
} | |
} | |
}); | |
return object; | |
}; | |
/* | |
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to " | |
*/ | |
$tw.utils.htmlDecode = function(s) { | |
return s.toString().replace(/</mg,"<").replace(/ /mg,"\x40").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&"); | |
}; | |
/* | |
Pad a string to a given length with "0"s. Length defaults to 2 | |
*/ | |
$tw.utils.pad = function(value,length) { | |
length = length || 2; | |
var s = value.toString(); | |
if(s.length < length) { | |
s = "000000000000000000000000000".substr(0,length - s.length) + s; | |
} | |
return s; | |
}; | |
// Convert a date into UTC YYYYMMDDHHMMSSmmm format | |
$tw.utils.stringifyDate = function(value) { | |
return value.getUTCFullYear() + | |
$tw.utils.pad(value.getUTCMonth() + 1) + | |
$tw.utils.pad(value.getUTCDate()) + | |
$tw.utils.pad(value.getUTCHours()) + | |
$tw.utils.pad(value.getUTCMinutes()) + | |
$tw.utils.pad(value.getUTCSeconds()) + | |
$tw.utils.pad(value.getUTCMilliseconds(),3); | |
}; | |
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string | |
$tw.utils.parseDate = function(value) { | |
if(typeof value === "string") { | |
return new Date(Date.UTC(parseInt(value.substr(0,4),10), | |
parseInt(value.substr(4,2),10)-1, | |
parseInt(value.substr(6,2),10), | |
parseInt(value.substr(8,2)||"00",10), | |
parseInt(value.substr(10,2)||"00",10), | |
parseInt(value.substr(12,2)||"00",10), | |
parseInt(value.substr(14,3)||"000",10))); | |
} else if($tw.utils.isDate(value)) { | |
return value; | |
} else { | |
return null; | |
} | |
}; | |
// Stringify an array of tiddler titles into a list string | |
$tw.utils.stringifyList = function(value) { | |
var result = []; | |
for(var t=0; t<value.length; t++) { | |
if(value[t].indexOf(" ") !== -1) { | |
result.push("[[" + value[t] + "]]"); | |
} else { | |
result.push(value[t]); | |
} | |
} | |
return result.join(" "); | |
}; | |
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne" | |
$tw.utils.parseStringArray = function(value) { | |
if(typeof value === "string") { | |
var memberRegExp = /(?:^|\s)(?:\[\[(.*?)\]\])(?=\s|$)|(\S+)/mg, | |
results = [], | |
match; | |
do { | |
match = memberRegExp.exec(value); | |
if(match) { | |
var item = match[1] || match[2]; | |
if(results.indexOf(item) === -1) { | |
results.push(item); | |
} | |
} | |
} while(match); | |
return results; | |
} else if($tw.utils.isArray(value)) { | |
return value; | |
} else { | |
return null; | |
} | |
}; | |
// Parse a block of name:value fields. The `fields` object is used as the basis for the return value | |
$tw.utils.parseFields = function(text,fields) { | |
fields = fields || {}; | |
text.split(/\r?\n/mg).forEach(function(line) { | |
if(line.charAt(0) !== "#") { | |
var p = line.indexOf(":"); | |
if(p !== -1) { | |
var field = line.substr(0, p).trim(), | |
value = line.substr(p+1).trim(); | |
fields[field] = value; | |
} | |
} | |
}); | |
return fields; | |
}; | |
/* | |
Resolves a source filepath delimited with `/` relative to a specified absolute root filepath. | |
In relative paths, the special folder name `..` refers to immediate parent directory, and the | |
name `.` refers to the current directory | |
*/ | |
$tw.utils.resolvePath = function(sourcepath,rootpath) { | |
// If the source path starts with ./ or ../ then it is relative to the root | |
if(sourcepath.substr(0,2) === "./" || sourcepath.substr(0,3) === "../" ) { | |
var src = sourcepath.split("/"), | |
root = rootpath.split("/"); | |
// Remove the filename part of the root | |
root.splice(root.length-1,1); | |
// Process the source path bit by bit onto the end of the root path | |
while(src.length > 0) { | |
var c = src.shift(); | |
if(c === "..") { // Slice off the last root entry for a double dot | |
if(root.length > 0) { | |
root.splice(root.length-1,1); | |
} | |
} else if(c !== ".") { // Ignore dots | |
root.push(c); // Copy other elements across | |
} | |
} | |
return root.join("/"); | |
} else { | |
// If it isn't relative, just return the path | |
if(rootpath) { | |
var root = rootpath.split("/"); | |
// Remove the filename part of the root | |
root.splice(root.length - 1, 1); | |
return root.join("/") + "/" + sourcepath; | |
} else { | |
return sourcepath; | |
} | |
} | |
}; | |
/* | |
Parse a semantic version string into its constituent parts | |
*/ | |
$tw.utils.parseVersion = function(version) { | |
var match = /^((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/.exec(version); | |
if(match) { | |
return { | |
version: match[1], | |
major: parseInt(match[2],10), | |
minor: parseInt(match[3],10), | |
patch: parseInt(match[4],10), | |
prerelease: match[5], | |
build: match[6] | |
}; | |
} else { | |
return null; | |
} | |
}; | |
/* | |
Returns true if the version string A is greater than the version string B | |
*/ | |
$tw.utils.checkVersions = function(versionStringA,versionStringB) { | |
var versionA = $tw.utils.parseVersion(versionStringA), | |
versionB = $tw.utils.parseVersion(versionStringB), | |
diff = [ | |
versionA.major - versionB.major, | |
versionA.minor - versionB.minor, | |
versionA.patch - versionB.patch | |
]; | |
return (diff[0] > 0) || | |
(diff[0] === 0 && diff[1] > 0) || | |
(diff[0] === 0 && diff[1] === 0 && diff[2] > 0); | |
}; | |
/* | |
Register file type information | |
*/ | |
$tw.utils.registerFileType = function(type,encoding,extension) { | |
$tw.config.fileExtensionInfo[extension] = {type: type}; | |
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension}; | |
}; | |
/* | |
Run code globally with specified context variables in scope | |
*/ | |
$tw.utils.evalGlobal = function(code,context,filename) { | |
var contextCopy = $tw.utils.extend({},context); | |
// Get the context variables as a pair of arrays of names and values | |
var contextNames = [], contextValues = []; | |
$tw.utils.each(contextCopy,function(value,name) { | |
contextNames.push(name); | |
contextValues.push(value); | |
}); | |
// Add the code prologue and epilogue | |
code = "(function(" + contextNames.join(",") + ") {(function(){\n" + code + ";})();\nreturn exports;\n})\n"; | |
// Compile the code into a function | |
var fn; | |
if($tw.browser) { | |
fn = window["eval"](code); | |
} else { | |
fn = vm.runInThisContext(code,filename); | |
} | |
// Call the function and return the exports | |
return fn.apply(null,contextValues); | |
}; | |
/* | |
Run code in a sandbox with only the specified context variables in scope | |
*/ | |
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) { | |
var sandbox = $tw.utils.extend({},context); | |
vm.runInNewContext(code,sandbox,filename); | |
return sandbox.exports; | |
}; | |
/* | |
Creates a PasswordPrompt object | |
*/ | |
$tw.utils.PasswordPrompt = function() { | |
// Store of pending password prompts | |
this.passwordPrompts = []; | |
// Create the wrapper | |
this.promptWrapper = $tw.utils.domMaker("div",{"class":"tw-password-wrapper"}); | |
document.body.appendChild(this.promptWrapper); | |
// Hide the empty wrapper | |
this.setWrapperDisplay(); | |
}; | |
/* | |
Hides or shows the wrapper depending on whether there are any outstanding prompts | |
*/ | |
$tw.utils.PasswordPrompt.prototype.setWrapperDisplay = function() { | |
if(this.passwordPrompts.length) { | |
this.promptWrapper.style.display = "block"; | |
} else { | |
this.promptWrapper.style.display = "none"; | |
} | |
}; | |
/* | |
Adds a new password prompt. Options are: | |
submitText: text to use for submit button (defaults to "Login") | |
serviceName: text of the human readable service name | |
noUserName: set true to disable username prompt | |
callback: function to be called on submission with parameter of object {username:,password:}. Callback must return `true` to remove the password prompt | |
*/ | |
$tw.utils.PasswordPrompt.prototype.createPrompt = function(options) { | |
// Create and add the prompt to the DOM | |
var submitText = options.submitText || "Login", | |
dm = $tw.utils.domMaker, | |
children = [dm("h1",{text: options.serviceName})]; | |
if(!options.noUserName) { | |
children.push(dm("input",{ | |
attributes: {type: "text", name: "username", placeholder: "Username"}, | |
"class": "input-small" | |
})); | |
} | |
children.push(dm("input",{ | |
attributes: {type: "password", name: "password", placeholder: "Password"}, | |
"class": "input-small" | |
})); | |
children.push(dm("button",{ | |
attributes: {type: "submit"}, | |
text: submitText, | |
"class": "btn" | |
})); | |
var form = dm("form",{ | |
"class": "form-inline", | |
attributes: {autocomplete: "off"}, | |
children: children | |
}); | |
this.promptWrapper.appendChild(form); | |
window.setTimeout(function() { | |
form.elements[0].focus(); | |
},10); | |
// Add a submit event handler | |
var self = this; | |
form.addEventListener("submit",function(event) { | |
// Collect the form data | |
var data = {},t; | |
$tw.utils.each(form.elements,function(element) { | |
if(element.name && element.value) { | |
data[element.name] = element.value; | |
} | |
}); | |
// Call the callback | |
if(options.callback(data)) { | |
// Remove the prompt if the callback returned true | |
var i = self.passwordPrompts.indexOf(promptInfo); | |
if(i !== -1) { | |
self.passwordPrompts.splice(i,1); | |
promptInfo.form.parentNode.removeChild(promptInfo.form); | |
self.setWrapperDisplay(); | |
} | |
} else { | |
// Clear the password if the callback returned false | |
$tw.utils.each(form.elements,function(element) { | |
if(element.name === "password") { | |
element.value = ""; | |
} | |
}); | |
} | |
event.preventDefault(); | |
return false; | |
},true); | |
// Add the prompt to the list | |
var promptInfo = { | |
serviceName: options.serviceName, | |
callback: options.callback, | |
form: form | |
}; | |
this.passwordPrompts.push(promptInfo); | |
// Make sure the wrapper is displayed | |
this.setWrapperDisplay(); | |
}; | |
/* | |
Crypto helper object for encrypted content. It maintains the password text in a closure, and provides methods to change | |
the password, and to encrypt/decrypt a block of text | |
*/ | |
$tw.utils.Crypto = function() { | |
var sjcl = $tw.browser ? window.sjcl : require("./sjcl.js"), | |
password = null, | |
callSjcl = function(method,inputText) { | |
var outputText; | |
try { | |
outputText = sjcl[method](password,inputText); | |
} catch(ex) { | |
console.log("Crypto error:" + ex); | |
outputText = null; | |
} | |
return outputText; | |
}; | |
this.setPassword = function(newPassword) { | |
password = newPassword; | |
this.updateCryptoStateTiddler(); | |
}; | |
this.updateCryptoStateTiddler = function() { | |
if($tw.wiki && $tw.wiki.addTiddler) { | |
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: password ? "yes" : "no"})); | |
} | |
}; | |
this.hasPassword = function() { | |
return !!password; | |
} | |
this.encrypt = function(text) { | |
return callSjcl("encrypt",text); | |
}; | |
this.decrypt = function(text) { | |
return callSjcl("decrypt",text); | |
}; | |
}; | |
/////////////////////////// Module mechanism | |
/* | |
Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot' | |
*/ | |
$tw.modules.execute = function(moduleName,moduleRoot) { | |
var name = moduleName[0] === "." ? $tw.utils.resolvePath(moduleName,moduleRoot) : moduleName, | |
moduleInfo = $tw.modules.titles[name] || $tw.modules.titles[name + ".js"] || $tw.modules.titles[moduleName] || $tw.modules.titles[moduleName + ".js"] , | |
tiddler = $tw.wiki.getTiddler(name) || $tw.wiki.getTiddler(name + ".js") || $tw.wiki.getTiddler(moduleName) || $tw.wiki.getTiddler(moduleName + ".js") , | |
_exports = {}, | |
sandbox = { | |
module: {}, | |
//moduleInfo: moduleInfo, | |
exports: _exports, | |
console: console, | |
setInterval: setInterval, | |
clearInterval: clearInterval, | |
setTimeout: setTimeout, | |
clearTimeout: clearTimeout, | |
Buffer: $tw.browser ? {} : Buffer, | |
$tw: $tw, | |
require: function(title) { | |
return $tw.modules.execute(title, name); | |
} | |
}; | |
Object.defineProperty(sandbox.module, "id", { | |
value: name, | |
writable: false, | |
enumerable: true, | |
configurable: false | |
}); | |
if(!$tw.browser) { | |
$tw.utils.extend(sandbox,{ | |
process: process | |
}); | |
} else { | |
/* | |
CommonJS optional require.main property: | |
In a browser we offer a fake main module which points back to the boot function | |
(Theoretically, this may allow TW to eventually load itself as a module in the browser) | |
*/ | |
Object.defineProperty(sandbox.require, "main", { | |
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot}, | |
writable: false, | |
enumerable: true, | |
configurable: false | |
}); | |
} | |
if(!moduleInfo) { | |
// We could not find the module on this path | |
// Try to defer to browserify etc, or node | |
var deferredModule; | |
if($tw.browser) { | |
if(window.require) { | |
try { | |
return window.require(moduleName); | |
} catch(e) {} | |
} | |
throw "Cannot find module named '" + moduleName + "' required by module '" + moduleRoot + "', resolved to " + name; | |
} else { | |
// If we don't have a module with that name, let node.js try to find it | |
return require(moduleName); | |
} | |
} | |
// Execute the module if we haven't already done so | |
if(!moduleInfo.exports) { | |
try { | |
// Check the type of the definition | |
if(typeof moduleInfo.definition === "function") { // Function | |
moduleInfo.exports = _exports; | |
moduleInfo.definition(moduleInfo,moduleInfo.exports,sandbox.require); | |
} else if(typeof moduleInfo.definition === "string") { // String | |
moduleInfo.exports = _exports; | |
$tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title); | |
} else { // Object | |
moduleInfo.exports = moduleInfo.definition; | |
} | |
} catch(e) { | |
$tw.utils.error("Error executing boot module " + name + ":\n" + e); | |
} | |
} | |
// Return the exports of the module | |
return moduleInfo.exports; | |
}; | |
/* | |
Apply a callback to each module of a particular type | |
moduleType: type of modules to enumerate | |
callback: function called as callback(title,moduleExports) for each module | |
*/ | |
$tw.modules.forEachModuleOfType = function(moduleType,callback) { | |
var modules = $tw.modules.types[moduleType]; | |
$tw.utils.each(modules,function(element,title,object) { | |
callback(title,$tw.modules.execute(title)); | |
}); | |
}; | |
/* | |
Get all the modules of a particular type in a hashmap by their `name` field | |
*/ | |
$tw.modules.getModulesByTypeAsHashmap = function(moduleType,nameField) { | |
nameField = nameField || "name"; | |
var results = {}; | |
$tw.modules.forEachModuleOfType(moduleType,function(title,module) { | |
results[module[nameField]] = module; | |
}); | |
return results; | |
}; | |
/* | |
Apply the exports of the modules of a particular type to a target object | |
*/ | |
$tw.modules.applyMethods = function(moduleType,targetObject) { | |
if(!targetObject) { | |
targetObject = {}; | |
} | |
$tw.modules.forEachModuleOfType(moduleType,function(title,module) { | |
$tw.utils.each(module,function(element,title,object) { | |
targetObject[title] = module[title]; | |
}); | |
}); | |
return targetObject; | |
}; | |
/* | |
Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class | |
*/ | |
$tw.modules.createClassesFromModules = function(moduleType,subType,baseClass) { | |
var classes = {}; | |
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) { | |
if(!subType || moduleExports.types[subType]) { | |
var newClass = function() {}; | |
if(baseClass) { | |
newClass.prototype = new baseClass(); | |
newClass.prototype.constructor = baseClass; | |
} | |
$tw.utils.extend(newClass.prototype,moduleExports); | |
classes[moduleExports.name] = newClass; | |
} | |
}); | |
return classes; | |
}; | |
/////////////////////////// Barebones tiddler object | |
/* | |
Construct a tiddler object from a hashmap of tiddler fields. If multiple hasmaps are provided they are merged, | |
taking precedence to the right | |
*/ | |
$tw.Tiddler = function(/* [fields,] fields */) { | |
this.fields = {}; | |
for(var c=0; c<arguments.length; c++) { | |
var arg = arguments[c], | |
src = (arg instanceof $tw.Tiddler) ? arg.fields : arg; | |
for(var t in src) { | |
if(src[t] === undefined) { | |
if(t in this.fields) { | |
delete this.fields[t]; // If we get a field that's undefined, delete any previous field value | |
} | |
} else { | |
// Parse the field with the associated field module (if any) | |
var fieldModule = $tw.Tiddler.fieldModules[t]; | |
if(fieldModule && fieldModule.parse) { | |
this.fields[t] = fieldModule.parse.call(this,src[t]); | |
} else { | |
this.fields[t] = src[t]; | |
} | |
} | |
} | |
} | |
}; | |
$tw.Tiddler.prototype.hasField = function(field) { | |
return $tw.utils.hop(this.fields,field); | |
}; | |
/* | |
Register and install the built in tiddler field modules | |
*/ | |
$tw.modules.define("$:/boot/tiddlerfields/modified","tiddlerfield",{ | |
name: "modified", | |
parse: $tw.utils.parseDate, | |
stringify: $tw.utils.stringifyDate | |
}); | |
$tw.modules.define("$:/boot/tiddlerfields/created","tiddlerfield",{ | |
name: "created", | |
parse: $tw.utils.parseDate, | |
stringify: $tw.utils.stringifyDate | |
}); | |
$tw.modules.define("$:/boot/tiddlerfields/color","tiddlerfield",{ | |
name: "color", | |
editTag: "input", | |
editType: "color" | |
}); | |
$tw.modules.define("$:/boot/tiddlerfields/tags","tiddlerfield",{ | |
name: "tags", | |
parse: $tw.utils.parseStringArray, | |
stringify: $tw.utils.stringifyList | |
}); | |
$tw.modules.define("$:/boot/tiddlerfields/list","tiddlerfield",{ | |
name: "list", | |
parse: $tw.utils.parseStringArray, | |
stringify: $tw.utils.stringifyList | |
}); | |
/////////////////////////// Barebones wiki store | |
/* | |
Construct a wiki store object | |
*/ | |
$tw.Wiki = function() { | |
this.tiddlers = {}; | |
this.plugins = []; // Array of registered plugins, ordered by priority | |
this.shadowTiddlers = {}; // Hashmap by title of {source:, tiddler:} | |
}; | |
$tw.Wiki.prototype.addTiddler = function(tiddler) { | |
if(!(tiddler instanceof $tw.Tiddler)) { | |
tiddler = new $tw.Tiddler(tiddler); | |
} | |
if(tiddler.fields.title) { | |
this.tiddlers[tiddler.fields.title] = tiddler; | |
} | |
}; | |
$tw.Wiki.prototype.addTiddlers = function(tiddlers) { | |
for(var t=0; t<tiddlers.length; t++) { | |
this.addTiddler(tiddlers[t]); | |
} | |
}; | |
/* | |
Register the plugin tiddlers of a particular type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected | |
*/ | |
$tw.Wiki.prototype.registerPluginTiddlers = function(pluginType,titles) { | |
var self = this, | |
registeredTitles = []; | |
// Go through the provided titles, or the entire tiddler list, looking for plugins of this type | |
var checkTiddler = function(tiddler) { | |
if(tiddler && tiddler.fields.type === "application/json" && tiddler.fields["plugin-type"] === pluginType) { | |
self.plugins.push(tiddler); | |
registeredTitles.push(tiddler.fields.title); | |
} | |
}; | |
if(titles) { | |
$tw.utils.each(titles,function(title) { | |
checkTiddler(self.getTiddler(title)); | |
}); | |
} else { | |
$tw.utils.each(this.tiddlers,function(tiddler,title) { | |
checkTiddler(tiddler); | |
}); | |
} | |
return registeredTitles; | |
}; | |
/* | |
Unregister the plugin tiddlers of a particular type, returning an array of the titles affected | |
*/ | |
$tw.Wiki.prototype.unregisterPluginTiddlers = function(pluginType) { | |
var self = this, | |
titles = []; | |
// Remove any previous registered plugins of this type | |
for(var t=this.plugins.length-1; t>=0; t--) { | |
var tiddler = this.plugins[t]; | |
if(tiddler.fields["plugin-type"] === pluginType) { | |
titles.push(tiddler.fields.title); | |
this.plugins.splice(t,1); | |
} | |
} | |
return titles; | |
}; | |
/* | |
Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers | |
*/ | |
$tw.Wiki.prototype.unpackPluginTiddlers = function() { | |
var self = this; | |
// Sort the plugin titles by the `plugin-priority` field | |
this.plugins.sort(function(a,b) { | |
if("plugin-priority" in a.fields && "plugin-priority" in b.fields) { | |
return a.fields["plugin-priority"] - b.fields["plugin-priority"]; | |
} else if("plugin-priority" in a.fields) { | |
return -1; | |
} else if("plugin-priority" in b.fields) { | |
return +1; | |
} else if(a.fields.title < b.fields.title) { | |
return -1; | |
} else if(a.fields.title === b.fields.title) { | |
return 0; | |
} else { | |
return +1; | |
} | |
}); | |
// Now go through the plugins in ascending order and assign the shadows | |
this.shadowTiddlers = {}; | |
$tw.utils.each(this.plugins,function(tiddler) { | |
// Get the plugin information | |
var pluginInfo = JSON.parse(tiddler.fields.text); | |
// Extract the constituent tiddlers | |
$tw.utils.each(pluginInfo.tiddlers,function(constituentTiddler,constituentTitle) { | |
// Save the tiddler object | |
if(constituentTitle) { | |
self.shadowTiddlers[constituentTitle] = { | |
source: tiddler.fields.title, | |
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle}) | |
}; | |
} | |
}); | |
}); | |
}; | |
/* | |
Define all modules stored in ordinary tiddlers | |
*/ | |
$tw.Wiki.prototype.defineTiddlerModules = function() { | |
$tw.utils.each(this.tiddlers,function(tiddler,title,object) { | |
if(tiddler.hasField("module-type")) { | |
switch (tiddler.fields.type) { | |
case "application/javascript": | |
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script | |
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) { | |
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text); | |
} | |
break; | |
case "application/json": | |
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],JSON.parse(tiddler.fields.text)); | |
break; | |
case "application/x-tiddler-dictionary": | |
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseFields(tiddler.fields.text)); | |
break; | |
} | |
} | |
}); | |
}; | |
/* | |
Register all the module tiddlers that have a module type | |
*/ | |
$tw.Wiki.prototype.defineShadowModules = function() { | |
var self = this; | |
$tw.utils.each(this.shadowTiddlers,function(element,title) { | |
var tiddler = self.getTiddler(title); | |
if(!$tw.utils.hop(self.tiddlers,title)) { // Don't define the module if it is overidden by an ordinary tiddler | |
if(tiddler.hasField("module-type")) { | |
// Define the module | |
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text); | |
} | |
} | |
}); | |
}; | |
$tw.Wiki.prototype.getTiddler = function(title) { | |
var t = this.tiddlers[title]; | |
if(t instanceof $tw.Tiddler) { | |
return t; | |
} else if(title !== undefined && $tw.utils.hop(this.shadowTiddlers,title)) { | |
return this.shadowTiddlers[title].tiddler; | |
} else { | |
return undefined; | |
} | |
}; | |
/* | |
Extracts tiddlers from a typed block of text, specifying default field values | |
*/ | |
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) { | |
srcFields = srcFields || {}; | |
var deserializer = $tw.Wiki.tiddlerDeserializerModules[type], | |
fields = {}; | |
if(!deserializer && $tw.config.fileExtensionInfo[type]) { | |
// If we didn't find the serializer, try converting it from an extension to a content type | |
type = $tw.config.fileExtensionInfo[type].type; | |
deserializer = $tw.Wiki.tiddlerDeserializerModules[type]; | |
} | |
if(!deserializer) { | |
// If we still don't have a deserializer, treat it as plain text | |
deserializer = $tw.Wiki.tiddlerDeserializerModules["text/plain"]; | |
} | |
for(var f in srcFields) { | |
fields[f] = srcFields[f]; | |
} | |
if(deserializer) { | |
return deserializer.call(this,text,fields,type); | |
} else { | |
// Return a raw tiddler for unknown types | |
fields.text = text; | |
return [fields]; | |
} | |
}; | |
/* | |
Register the built in tiddler deserializer modules | |
*/ | |
$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{ | |
"application/javascript": function(text,fields) { | |
var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"), | |
match = headerCommentRegExp.exec(text); | |
fields.text = text; | |
if(match) { | |
fields = $tw.utils.parseFields(match[1].split(/\r?\n\r?\n/mg)[0],fields); | |
} | |
return [fields]; | |
} | |
}); | |
$tw.modules.define("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{ | |
"application/x-tiddler": function(text,fields) { | |
var split = text.split(/\r?\n\r?\n/mg); | |
if(split.length >= 1) { | |
fields = $tw.utils.parseFields(split[0],fields); | |
} | |
if(split.length >= 2) { | |
fields.text = split.slice(1).join("\n\n"); | |
} else { | |
fields.text = ""; | |
} | |
return [fields]; | |
} | |
}); | |
$tw.modules.define("$:/boot/tiddlerdeserializer/txt","tiddlerdeserializer",{ | |
"text/plain": function(text,fields,type) { | |
fields.text = text; | |
fields.type = type || "text/plain"; | |
return [fields]; | |
} | |
}); | |
$tw.modules.define("$:/boot/tiddlerdeserializer/html","tiddlerdeserializer",{ | |
"text/html": function(text,fields) { | |
fields.text = text; | |
fields.type = "text/html"; | |
return [fields]; | |
} | |
}); | |
$tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{ | |
"application/json": function(text,fields) { | |
var tiddlers = JSON.parse(text); | |
return tiddlers; | |
} | |
}); | |
/////////////////////////// Browser definitions | |
if($tw.browser) { | |
/* | |
Decrypt any tiddlers stored within the element with the ID "encryptedArea". The function is asynchronous to allow the user to be prompted for a password | |
callback: function to be called the decryption is complete | |
*/ | |
$tw.boot.decryptEncryptedTiddlers = function(callback) { | |
var encryptedArea = document.getElementById("encryptedStoreArea"); | |
if(encryptedArea) { | |
var encryptedText = encryptedArea.innerHTML; | |
// Prompt for the password | |
$tw.passwordPrompt.createPrompt({ | |
serviceName: "Enter a password to decrypt this TiddlyWiki", | |
noUserName: true, | |
submitText: "Decrypt", | |
callback: function(data) { | |
// Attempt to decrypt the tiddlers | |
$tw.crypto.setPassword(data.password); | |
var decryptedText = $tw.crypto.decrypt(encryptedText); | |
if(decryptedText) { | |
var json = JSON.parse(decryptedText); | |
for(var title in json) { | |
$tw.preloadTiddler(json[title]); | |
} | |
// Call the callback | |
callback(); | |
// Exit and remove the password prompt | |
return true; | |
} else { | |
// We didn't decrypt everything, so continue to prompt for password | |
return false; | |
} | |
} | |
}); | |
} else { | |
// Just invoke the callback straight away if there weren't any encrypted tiddlers | |
callback(); | |
} | |
}; | |
/* | |
Register a deserializer that can extract tiddlers from the DOM | |
*/ | |
$tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{ | |
"(DOM)": function(node) { | |
var extractTextTiddlers = function(node) { | |
var e = node.firstChild; | |
while(e && e.nodeName.toLowerCase() !== "pre") { | |
e = e.nextSibling; | |
} | |
var title = node.getAttribute ? node.getAttribute("title") : null; | |
if(e && title) { | |
var attrs = node.attributes, | |
tiddler = { | |
text: $tw.utils.htmlDecode(e.innerHTML) | |
}; | |
for(var i=attrs.length-1; i >= 0; i--) { | |
tiddler[attrs[i].name] = attrs[i].value; | |
} | |
return [tiddler]; | |
} else { | |
return null; | |
} | |
}, | |
extractModuleTiddlers = function(node) { | |
if(node.hasAttribute && node.hasAttribute("data-tiddler-title")) { | |
var text = node.innerHTML, | |
s = text.indexOf("{"), | |
e = text.lastIndexOf("}"); | |
if(node.hasAttribute("data-module") && s !== -1 && e !== -1) { | |
text = text.substring(s+1,e); | |
} | |
var fields = {text: text}, | |
attributes = node.attributes; | |
for(var a=0; a<attributes.length; a++) { | |
if(attributes[a].nodeName.substr(0,13) === "data-tiddler-") { | |
fields[attributes[a].nodeName.substr(13)] = attributes[a].value; | |
} | |
} | |
return [fields]; | |
} else { | |
return null; | |
} | |
}, | |
t,result = []; | |
if(node) { | |
for(t = 0; t < node.childNodes.length; t++) { | |
var childNode = node.childNodes[t], | |
tiddlers = extractTextTiddlers(childNode); | |
tiddlers = tiddlers || extractModuleTiddlers(childNode); | |
if(tiddlers) { | |
result.push.apply(result,tiddlers); | |
} | |
} | |
} | |
return result; | |
} | |
}); | |
$tw.loadTiddlers = function() { | |
// In the browser, we load tiddlers from certain elements | |
var containerIds = [ | |
"libraryModules", | |
"modules", | |
"bootKernelPrefix", | |
"bootKernel", | |
"styleArea", | |
"storeArea", | |
"systemArea" | |
]; | |
for(var t=0; t<containerIds.length; t++) { | |
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t]))); | |
} | |
// Load any preloaded tiddlers | |
if($tw.preloadTiddlers) { | |
$tw.wiki.addTiddlers($tw.preloadTiddlers); | |
} | |
}; | |
// End of if($tw.browser) | |
} | |
/////////////////////////// Server definitions | |
if(!$tw.browser) { | |
/* | |
Get any encrypted tiddlers | |
*/ | |
$tw.boot.decryptEncryptedTiddlers = function(callback) { | |
// Storing encrypted tiddlers on the server isn't supported yet | |
callback(); | |
}; | |
/* | |
Load the tiddlers contained in a particular file (and optionally extract fields from the accompanying .meta file) returned as {filepath:,type:,tiddlers:[],hasMetaFile:} | |
*/ | |
$tw.loadTiddlersFromFile = function(filepath,fields) { | |
var ext = path.extname(filepath), | |
extensionInfo = $tw.config.fileExtensionInfo[ext], | |
type = extensionInfo ? extensionInfo.type : null, | |
typeInfo = type ? $tw.config.contentTypeInfo[type] : null, | |
data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"), | |
tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields), | |
metafile = filepath + ".meta", | |
metadata; | |
if(ext !== ".json" && tiddlers.length === 1 && fs.existsSync(metafile)) { | |
metadata = fs.readFileSync(metafile,"utf8"); | |
if(metadata) { | |
tiddlers = [$tw.utils.parseFields(metadata,tiddlers[0])]; | |
} | |
} | |
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata}; | |
}; | |
/* | |
A default set of files for TiddlyWiki to ignore during load. | |
This matches what NPM ignores, and adds "*.meta" to ignore tiddler | |
metadata files. | |
*/ | |
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/; | |
/* | |
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property. | |
*/ | |
$tw.loadTiddlersFromPath = function(filepath,excludeRegExp) { | |
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp; | |
var tiddlers = []; | |
if(fs.existsSync(filepath)) { | |
var stat = fs.statSync(filepath); | |
if(stat.isDirectory()) { | |
var files = fs.readdirSync(filepath); | |
// Look for a tiddlywiki.files file | |
if(files.indexOf("tiddlywiki.files") !== -1) { | |
// If so, process the files it describes | |
var filesInfo = JSON.parse(fs.readFileSync(filepath + "/tiddlywiki.files","utf8")); | |
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) { | |
var typeInfo = $tw.config.contentTypeInfo[tidInfo.fields.type || "text/plain"], | |
pathname = path.resolve(filepath,tidInfo.file), | |
text = fs.readFileSync(pathname,typeInfo ? typeInfo.encoding : "utf8"); | |
if(tidInfo.prefix) { | |
text = tidInfo.prefix + text; | |
} | |
if(tidInfo.suffix) { | |
text = text + tidInfo.suffix; | |
} | |
tidInfo.fields.text = text; | |
tiddlers.push({tiddlers: [tidInfo.fields]}); | |
}); | |
} else { | |
// If not, read all the files in the directory | |
$tw.utils.each(files,function(file) { | |
if(!excludeRegExp.test(file)) { | |
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + "/" + file,excludeRegExp)); | |
} | |
}); | |
} | |
} else if(stat.isFile()) { | |
tiddlers.push($tw.loadTiddlersFromFile(filepath)); | |
} | |
} | |
return tiddlers; | |
}; | |
/* | |
Load the tiddlers from a plugin folder, and package them up into a proper JSON plugin tiddler | |
*/ | |
$tw.loadPluginFolder = function(filepath,excludeRegExp) { | |
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp; | |
var stat, files, pluginInfo, pluginTiddlers = [], f, file, titlePrefix, t; | |
if(fs.existsSync(filepath)) { | |
stat = fs.statSync(filepath); | |
if(stat.isDirectory()) { | |
// Read the plugin information | |
pluginInfo = JSON.parse(fs.readFileSync(filepath + "/plugin.info","utf8")); | |
// Read the plugin files | |
files = fs.readdirSync(filepath); | |
for(f=0; f<files.length; f++) { | |
file = files[f]; | |
if(!excludeRegExp.test(file) && file !== "plugin.info" && file !== "tiddlywiki.files") { | |
var tiddlerFiles = $tw.loadTiddlersFromPath(filepath + "/" + file,excludeRegExp); | |
$tw.utils.each(tiddlerFiles,function(tiddlerFile) { | |
pluginTiddlers.push.apply(pluginTiddlers,tiddlerFile.tiddlers); | |
}); | |
} | |
} | |
// Save the plugin tiddlers into the plugin info | |
pluginInfo.tiddlers = pluginInfo.tiddlers || {}; | |
for(t=0; t<pluginTiddlers.length; t++) { | |
if(pluginTiddlers[t].title) { | |
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t]; | |
} | |
} | |
} | |
} | |
// Give the plugin the same version number as the core if it doesn't have one | |
if(!("version" in pluginInfo)) { | |
pluginInfo.version = $tw.packageInfo.version; | |
} | |
// Save the plugin tiddler | |
if(pluginInfo) { | |
var fields = { | |
title: pluginInfo.title, | |
type: "application/json", | |
text: JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4), | |
"plugin-priority": pluginInfo["plugin-priority"], | |
"name": pluginInfo["name"], | |
"version": pluginInfo["version"], | |
"thumbnail": pluginInfo["thumbnail"], | |
"description": pluginInfo["description"], | |
"plugin-type": pluginInfo["plugin-type"] || "plugin", | |
"dependents": $tw.utils.stringifyList(pluginInfo["dependents"] || []) | |
} | |
return fields; | |
} else { | |
return null; | |
} | |
}; | |
/* | |
Fallback tiddlywiki.info content | |
*/ | |
$tw.boot.defaultWikiInfo = { | |
"plugins": [ | |
"tiddlywiki/tiddlyweb", | |
"tiddlywiki/filesystem" | |
], | |
"themes": [ | |
"tiddlywiki/vanilla", | |
"tiddlywiki/snowwhite" | |
] | |
}; | |
/* | |
path: path of wiki directory | |
parentPaths: array of parent paths that we mustn't recurse into | |
*/ | |
$tw.loadWikiTiddlers = function(wikiPath,parentPaths) { | |
parentPaths = parentPaths || []; | |
var wikiInfoPath = path.resolve(wikiPath,$tw.config.wikiInfo), | |
wikiInfo, | |
pluginFields; | |
// Bail if we don't have a wiki info file | |
if(fs.existsSync(wikiInfoPath)) { | |
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8")); | |
} else { | |
wikiInfo = $tw.boot.defaultWikiInfo; | |
} | |
// Load any parent wikis | |
if(wikiInfo.includeWikis) { | |
parentPaths = parentPaths.slice(0); | |
parentPaths.push(wikiPath); | |
$tw.utils.each(wikiInfo.includeWikis,function(includedWikiPath) { | |
var resolvedIncludedWikiPath = path.resolve(wikiPath,includedWikiPath); | |
if(parentPaths.indexOf(resolvedIncludedWikiPath) === -1) { | |
$tw.loadWikiTiddlers(resolvedIncludedWikiPath,parentPaths); | |
} else { | |
$tw.utils.error("Cannot recursively include wiki " + resolvedIncludedWikiPath); | |
} | |
}); | |
} | |
// Load any plugins listed in the wiki info file | |
if(wikiInfo.plugins) { | |
var pluginBasePath = path.resolve($tw.boot.corePath,$tw.config.pluginsPath); | |
for(var t=0; t<wikiInfo.plugins.length; t++) { | |
pluginFields = $tw.loadPluginFolder(path.resolve(pluginBasePath,"./" + wikiInfo.plugins[t])); | |
if(pluginFields) { | |
$tw.wiki.addTiddler(pluginFields); | |
} | |
} | |
} | |
// Load any themes listed in the wiki info file | |
if(wikiInfo.themes) { | |
var themesBasePath = path.resolve($tw.boot.corePath,$tw.config.themesPath); | |
for(var t=0; t<wikiInfo.themes.length; t++) { | |
pluginFields = $tw.loadPluginFolder(path.resolve(themesBasePath,"./" + wikiInfo.themes[t])); | |
if(pluginFields) { | |
$tw.wiki.addTiddler(pluginFields); | |
} | |
} | |
} | |
// Load the wiki files, registering them as writable | |
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir); | |
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) { | |
$tw.wiki.addTiddlers(tiddlerFile.tiddlers); | |
if(tiddlerFile.filepath) { | |
$tw.utils.each(tiddlerFile.tiddlers,function(tiddler) { | |
$tw.boot.files[tiddler.title] = { | |
filepath: tiddlerFile.filepath, | |
type: tiddlerFile.type, | |
hasMetaFile: tiddlerFile.hasMetaFile | |
}; | |
}); | |
} | |
}); | |
// Save the path to the tiddlers folder for the filesystemadaptor | |
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir); | |
// Load any plugins within the wiki folder | |
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir); | |
if(fs.existsSync(wikiPluginsPath)) { | |
var pluginFolders = fs.readdirSync(wikiPluginsPath); | |
for(t=0; t<pluginFolders.length; t++) { | |
pluginFields = $tw.loadPluginFolder(path.resolve(wikiPluginsPath,"./" + pluginFolders[t])); | |
if(pluginFields) { | |
$tw.wiki.addTiddler(pluginFields); | |
} | |
} | |
} | |
// Load any themes within the wiki folder | |
var wikiThemesPath = path.resolve(wikiPath,$tw.config.wikiThemesSubDir); | |
if(fs.existsSync(wikiThemesPath)) { | |
var themeFolders = fs.readdirSync(wikiThemesPath); | |
for(t=0; t<themeFolders.length; t++) { | |
pluginFields = $tw.loadPluginFolder(path.resolve(wikiThemesPath,"./" + themeFolders[t])); | |
if(pluginFields) { | |
$tw.wiki.addTiddler(pluginFields); | |
} | |
} | |
} | |
return wikiInfo; | |
}; | |
$tw.loadTiddlers = function() { | |
// Load the boot tiddlers | |
$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) { | |
$tw.wiki.addTiddlers(tiddlerFile.tiddlers); | |
}); | |
// Load the core tiddlers | |
$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath)); | |
// Load the tiddlers from the wiki directory | |
if($tw.boot.wikiPath) { | |
$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath); | |
} | |
}; | |
// End of if(!$tw.browser) | |
} | |
/////////////////////////// Main startup function called once tiddlers have been decrypted | |
$tw.boot.startup = function() { | |
// Initialise some more $tw properties | |
$tw.utils.deepDefaults($tw,{ | |
modules: { // Information about each module | |
titles: {}, // hashmap by module title of {fn:, exports:, moduleType:} | |
types: {} // hashmap by module type of hashmap of exports | |
}, | |
config: { // Configuration overridables | |
pluginsPath: "../plugins/", | |
themesPath: "../themes/", | |
wikiInfo: "./tiddlywiki.info", | |
wikiPluginsSubDir: "./plugins", | |
wikiThemesSubDir: "./themes", | |
wikiTiddlersSubDir: "./tiddlers", | |
jsModuleHeaderRegExpString: "^\\/\\*\\\\(?:\\r?\\n)((?:^[^\\r\\n]*(?:\\r?\\n))+?)(^\\\\\\*\\/$(?:\\r?\\n)?)", | |
fileExtensionInfo: {}, // Map file extension to {type:} | |
contentTypeInfo: {} // Map type to {encoding:,extension:} | |
} | |
}); | |
if(!$tw.browser) { | |
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:} | |
$tw.boot.files = {}; | |
// System paths and filenames | |
$tw.boot.bootPath = path.dirname(module.filename); | |
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core"); | |
// If the first command line argument doesn't start with `--` then we | |
// interpret it as the path to the wiki folder, which will otherwise default | |
// to the current folder | |
if($tw.boot.argv[0] === "*") { | |
$tw.boot.wikiPath = undefined; | |
$tw.boot.argv = $tw.boot.argv.slice(1); | |
} else if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) { | |
$tw.boot.wikiPath = $tw.boot.argv[0]; | |
$tw.boot.argv = $tw.boot.argv.slice(1); | |
} else { | |
$tw.boot.wikiPath = process.cwd(); | |
} | |
// Read package info | |
$tw.packageInfo = require("../package"); | |
// Check node version number | |
if($tw.utils.checkVersions($tw.packageInfo.engines.node.substr(2),process.version.substr(1))) { | |
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engines.node); | |
} | |
} | |
// Add file extension information | |
$tw.utils.registerFileType("text/vnd.tiddlywiki","utf8",".tid"); | |
$tw.utils.registerFileType("application/x-tiddler","utf8",".tid"); | |
$tw.utils.registerFileType("application/x-tiddler-html-div","utf8",".tiddler"); | |
$tw.utils.registerFileType("text/vnd.tiddlywiki2-recipe","utf8",".recipe"); | |
$tw.utils.registerFileType("text/plain","utf8",".txt"); | |
$tw.utils.registerFileType("text/css","utf8",".css"); | |
$tw.utils.registerFileType("text/html","utf8",".html"); | |
$tw.utils.registerFileType("application/javascript","utf8",".js"); | |
$tw.utils.registerFileType("application/json","utf8",".json"); | |
$tw.utils.registerFileType("application/pdf","base64",".pdf"); | |
$tw.utils.registerFileType("image/jpeg","base64",".jpg"); | |
$tw.utils.registerFileType("image/png","base64",".png"); | |
$tw.utils.registerFileType("image/gif","base64",".gif"); | |
$tw.utils.registerFileType("image/svg+xml","utf8",".svg"); | |
$tw.utils.registerFileType("image/x-icon","base64",".ico"); | |
$tw.utils.registerFileType("application/font-woff","base64",".woff"); | |
// Create the wiki store for the app | |
$tw.wiki = new $tw.Wiki(); | |
// Install built in tiddler fields modules | |
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield"); | |
// Install the tiddler deserializer modules | |
$tw.Wiki.tiddlerDeserializerModules = {}; | |
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules); | |
// Load tiddlers | |
$tw.loadTiddlers(); | |
// Unpack plugin tiddlers | |
$tw.wiki.registerPluginTiddlers("plugin"); | |
$tw.wiki.unpackPluginTiddlers(); | |
// Register typed modules from the tiddlers we've just loaded | |
$tw.wiki.defineTiddlerModules(); | |
// And any modules within plugins | |
$tw.wiki.defineShadowModules(); | |
// Make sure the crypto state tiddler is up to date | |
$tw.crypto.updateCryptoStateTiddler(); | |
// Run any startup modules | |
$tw.modules.forEachModuleOfType("startup",function(title,module) { | |
if(module.startup) { | |
module.startup(); | |
} | |
}); | |
}; | |
/////////////////////////// Main boot function to decrypt tiddlers and then startup | |
$tw.boot.boot = function() { | |
// Initialise crypto object | |
$tw.crypto = new $tw.utils.Crypto(); | |
// Initialise password prompter | |
if($tw.browser) { | |
$tw.passwordPrompt = new $tw.utils.PasswordPrompt(); | |
} | |
// Preload any encrypted tiddlers | |
$tw.boot.decryptEncryptedTiddlers(function() { | |
// Startup | |
$tw.boot.startup(); | |
}); | |
}; | |
/////////////////////////// Autoboot in the browser | |
if($tw.browser) { | |
$tw.boot.boot(); | |
} | |
return $tw; | |
}); | |
if(typeof(exports) !== "undefined") { | |
exports.TiddlyWiki = _boot; | |
} else { | |
_boot(window.$tw); | |
} | |
</script> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment