You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3379 lines
3.5 MiB
HTML
3379 lines
3.5 MiB
HTML
1 year ago
|
|
||
|
<!doctype html>
|
||
|
<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension -->
|
||
|
<!-- saved from url=(0021)https://tiddlywiki.com -->
|
||
|
<html lang="en-GB">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||
|
<!--~~ Raw markup for the top of the head section ~~-->
|
||
|
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
|
||
|
<meta name="application-name" content="TiddlyWiki" />
|
||
|
<meta name="generator" content="TiddlyWiki" />
|
||
|
<meta name="tiddlywiki-version" content="5.3.0" />
|
||
|
<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="mobile-web-app-capable" content="yes"/>
|
||
|
<meta name="format-detection" content="telephone=no" />
|
||
|
<meta name="copyright" content="TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||
|
|
||
|
Copyright (c) 2004-2007, Jeremy Ruston
|
||
|
Copyright (c) 2007-2023, UnaMesa Association
|
||
|
All rights reserved.
|
||
|
|
||
|
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 copyright holder 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 HOLDER 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>copincha</title>
|
||
|
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->
|
||
|
|
||
|
<!--~~ Raw markup ~~-->
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
<body class="tc-body">
|
||
|
<!--~~ Raw markup for the top of the body section ~~-->
|
||
|
|
||
|
<!--~~ 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
|
||
|
*/
|
||
|
|
||
|
.tc-error-form {
|
||
|
font-family: sans-serif;
|
||
|
color: #fff;
|
||
|
z-index: 20000;
|
||
|
position: fixed;
|
||
|
background-color: rgb(255, 75, 75);
|
||
|
border: 8px solid rgb(255, 0, 0);
|
||
|
border-radius: 8px;
|
||
|
width: 50%;
|
||
|
margin-left: 25%;
|
||
|
margin-top: 4em;
|
||
|
padding: 0 2em 1em 2em;
|
||
|
}
|
||
|
|
||
|
.tc-error-form h1 {
|
||
|
text-align: center;
|
||
|
}
|
||
|
|
||
|
.tc-error-prompt {
|
||
|
text-align: center;
|
||
|
color: #000;
|
||
|
}
|
||
|
|
||
|
.tc-error-message {
|
||
|
overflow: auto;
|
||
|
max-height: 40em;
|
||
|
padding-right: 1em;
|
||
|
margin: 1em 0;
|
||
|
white-space: pre-line;
|
||
|
}
|
||
|
|
||
|
.tc-password-wrapper {
|
||
|
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;
|
||
|
border-radius: 8px;
|
||
|
}
|
||
|
|
||
|
.tc-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);
|
||
|
}
|
||
|
|
||
|
.tc-password-wrapper form {
|
||
|
text-align: left;
|
||
|
}
|
||
|
|
||
|
.tc-password-wrapper h1 {
|
||
|
font-size: 16px;
|
||
|
line-height: 20px;
|
||
|
padding-bottom: 16px;
|
||
|
}
|
||
|
|
||
|
.tc-password-wrapper input {
|
||
|
width: 100%;
|
||
|
}
|
||
|
</style>
|
||
|
</div>
|
||
|
<!--~~ Static content for Google and browsers without JavaScript ~~-->
|
||
|
<noscript>
|
||
|
<div id="splashArea">
|
||
|
|
||
|
|
||
|
<p>This <a class="tc-tiddlylink-external" href="https://tiddlywiki.com" rel="noopener noreferrer" target="_blank">TiddlyWiki</a> contains the following tiddlers:</p><p><ul>
|
||
|
|
||
|
<li>$:/_tw5.com-styles</li>
|
||
|
|
||
|
<li>$:/config/Navigation/openLinkFromInsideRiver</li>
|
||
|
|
||
|
<li>$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/export-page</li>
|
||
|
|
||
|
<li>$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home</li>
|
||
|
|
||
|
<li>$:/config/Plugins/Disabled/$:/plugins/kebi/notebook-tweaks</li>
|
||
|
|
||
|
<li>$:/config/Plugins/Disabled/$:/plugins/kebi/tiddlyremember-tweaks</li>
|
||
|
|
||
|
<li>$:/config/Plugins/Disabled/$:/plugins/kebi/tiddlystudy</li>
|
||
|
|
||
|
<li>$:/config/Plugins/Disabled/$:/plugins/kebi/tiddlystudy-references</li>
|
||
|
|
||
|
<li>$:/config/RelinkOnRename</li>
|
||
|
|
||
|
<li>$:/config/Tiddlers/TitleLinks</li>
|
||
|
|
||
|
<li>$:/core</li>
|
||
|
|
||
|
<li>$:/core/ui/ControlPanel/Settings/TitleLinks</li>
|
||
|
|
||
|
<li>$:/DefaultTiddlers</li>
|
||
|
|
||
|
<li>$:/Import</li>
|
||
|
|
||
|
<li>$:/isEncrypted</li>
|
||
|
|
||
|
<li>$:/jd/palette/Neonize</li>
|
||
|
|
||
|
<li>$:/layout</li>
|
||
|
|
||
|
<li>$:/palette</li>
|
||
|
|
||
|
<li>$:/plugins/anstosa/tw5-markdown</li>
|
||
|
|
||
|
<li>$:/plugins/flibbles/3rd-party</li>
|
||
|
|
||
|
<li>$:/plugins/flibbles/relink</li>
|
||
|
|
||
|
<li>$:/plugins/flibbles/relink-fieldnames</li>
|
||
|
|
||
|
<li>$:/plugins/flibbles/relink-markdown</li>
|
||
|
|
||
|
<li>$:/plugins/flibbles/relink-titles</li>
|
||
|
|
||
|
<li>$:/plugins/kebi/relink-tweaks</li>
|
||
|
|
||
|
<li>$:/plugins/kebi/streams-tweaks</li>
|
||
|
|
||
|
<li>$:/plugins/sq/streams</li>
|
||
|
|
||
|
<li>$:/SiteSubtitle</li>
|
||
|
|
||
|
<li>$:/SiteTitle</li>
|
||
|
|
||
|
<li>$:/state/advancedsearch/currentTab</li>
|
||
|
|
||
|
<li>$:/state/Excise/-655986432/tagnew</li>
|
||
|
|
||
|
<li>$:/state/http-requests</li>
|
||
|
|
||
|
<li>$:/state/plugin-info--1296358760-$:/plugins/tiddlywiki/markdown--1185065935</li>
|
||
|
|
||
|
<li>$:/state/plugin-info--1642337318-$:/plugins/anstosa/tw5-markdown--1963990281</li>
|
||
|
|
||
|
<li>$:/state/plugin-info-1867135918-$:/plugins/anstosa/tw5-markdown</li>
|
||
|
|
||
|
<li>$:/state/plugin-info-1867135918-$:/plugins/anstosa/tw5-markdown--734846815</li>
|
||
|
|
||
|
<li>$:/state/plugin-info-1867135918-$:/plugins/flibbles/relink-markdown</li>
|
||
|
|
||
|
<li>$:/state/plugin-info-1867135918-$:/plugins/tiddlywiki/markdown</li>
|
||
|
|
||
|
<li>$:/state/plugin-info-1867135918-$:/plugins/tiddlywiki/markdown---1654385705</li>
|
||
|
|
||
|
<li>$:/state/showeditpreview</li>
|
||
|
|
||
|
<li>$:/state/ShowPaletteEditor</li>
|
||
|
|
||
|
<li>$:/state/sq/streams/current-edit-tiddler-1908010776</li>
|
||
|
|
||
|
<li>$:/state/tab--1498284803</li>
|
||
|
|
||
|
<li>$:/state/tab--1963855381</li>
|
||
|
|
||
|
<li>$:/state/tab-1749438307</li>
|
||
|
|
||
|
<li>$:/state/tab/sidebar--595412856</li>
|
||
|
|
||
|
<li>$:/state/tabs/controlpanel/toolbars-1345989671</li>
|
||
|
|
||
|
<li>$:/status/RequireReloadDueToPluginChange</li>
|
||
|
|
||
|
<li>$:/StoryList</li>
|
||
|
|
||
|
<li>$:/theme</li>
|
||
|
|
||
|
<li>$:/themes/tiddlywiki/snowwhite</li>
|
||
|
|
||
|
<li>$:/themes/tiddlywiki/vanilla</li>
|
||
|
|
||
|
<li>3d extrude</li>
|
||
|
|
||
|
<li>copincha</li>
|
||
|
|
||
|
<li>copincha/20230806162152675</li>
|
||
|
|
||
|
<li>copincha/20230806162157300</li>
|
||
|
|
||
|
<li>copincha/20230806162201918</li>
|
||
|
|
||
|
<li>copincha/20230806162206195</li>
|
||
|
|
||
|
<li>copincha/20230806162213965</li>
|
||
|
|
||
|
<li>copincha/20230806162338735</li>
|
||
|
|
||
|
<li>copincha/20230806162401166</li>
|
||
|
|
||
|
<li>copincha/20230806162456844</li>
|
||
|
|
||
|
<li>copincha/20230806162515425</li>
|
||
|
|
||
|
<li>copincha/20230806162550703</li>
|
||
|
|
||
|
<li>copincha/20230806162722322</li>
|
||
|
|
||
|
<li>copincha/20230806162747458</li>
|
||
|
|
||
|
<li>copincha/20230806162821869</li>
|
||
|
|
||
|
<li>copincha/20230806163000301</li>
|
||
|
|
||
|
<li>copincha/20230806163034308</li>
|
||
|
|
||
|
<li>copincha/20230806163105663</li>
|
||
|
|
||
|
<li>copincha/20230806163135383</li>
|
||
|
|
||
|
<li>copincha/20230806163143151</li>
|
||
|
|
||
|
<li>copincha/20230806163242772</li>
|
||
|
|
||
|
<li>copincha/20230806163259059</li>
|
||
|
|
||
|
<li>copincha/20230806163305019</li>
|
||
|
|
||
|
<li>copincha/20230806163318843</li>
|
||
|
|
||
|
<li>copincha/20230806163323858</li>
|
||
|
|
||
|
<li>copincha/20230806163327353</li>
|
||
|
|
||
|
<li>copincha/20230806163333206</li>
|
||
|
|
||
|
<li>copincha/20230806163335443</li>
|
||
|
|
||
|
<li>copincha/20230807232728484</li>
|
||
|
|
||
|
<li>copincha/20230807232758672</li>
|
||
|
|
||
|
<li>copincha/20230807233756176</li>
|
||
|
|
||
|
<li>copincha/20230807233813733</li>
|
||
|
|
||
|
<li>copincha/20230807233821579</li>
|
||
|
|
||
|
<li>copincha/20230807233827042</li>
|
||
|
|
||
|
<li>copincha/20230807233838620</li>
|
||
|
|
||
|
<li>copincha/20230808004815029</li>
|
||
|
|
||
|
<li>copincha/20230808004845126</li>
|
||
|
|
||
|
<li>copincha/20230808004846442</li>
|
||
|
|
||
|
<li>copincha/20230808004847415</li>
|
||
|
|
||
|
<li>copincha/20230808004849018</li>
|
||
|
|
||
|
<li>copincha/20230808004850102</li>
|
||
|
|
||
|
<li>copincha/20230808004851226</li>
|
||
|
|
||
|
<li>copincha/20230808004852330</li>
|
||
|
|
||
|
<li>copincha/20230808004941223</li>
|
||
|
|
||
|
<li>copincha/20230808004944251</li>
|
||
|
|
||
|
<li>copincha/20230808004948913</li>
|
||
|
|
||
|
<li>copincha/20230808005507623</li>
|
||
|
|
||
|
<li>copincha/20230808005528418</li>
|
||
|
|
||
|
<li>copincha/20230808005542446</li>
|
||
|
|
||
|
</ul>
|
||
|
</p>
|
||
|
|
||
|
|
||
|
|
||
|
<style>
|
||
|
.tc-remove-when-wiki-loaded {display: none;}
|
||
|
</style>
|
||
|
|
||
|
</div>
|
||
|
</noscript>
|
||
|
<!--~~ Ordinary tiddlers ~~-->
|
||
|
<script class="tiddlywiki-tiddler-store" type="application/json">[
|
||
|
{"title":"$:/_tw5.com-styles","created":"20200507002727378","modified":"20220719132112414","tags":"$:/tags/Stylesheet","type":"text/vnd.tiddlywiki","text":"\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock\n\n.tc-hero-heading a.tc-tiddlylink {\n\tfont-weight: bold;\n}\n\n.tc-double-spaced-list li {\n\tpadding-bottom: .5em;\n\tpadding-top: .5em;\n}\n\n.tc-link-info-item {\n border: 1px solid #ebefcd;\n padding: 5px 10px;\n margin-bottom: 10px;\n background: \u003C\u003Ccolour code-background>>;\n font-size: 0.8em;\n line-height: 1.2;\n}\n\n.tc-link-info-item h1 {\n\tfont-weight: 500;\n\tfont-size: 16px;\t\n}\n\n.tc-scrollable-demo {\n\tborder: 1px solid \u003C\u003Ccolour message-border>>;\n\tbackground-color: \u003C\u003Ccolour message-background>>;\n\tpadding: 1em;\n\theight: 400px;\n\tposition: relative;\n\toverflow: auto;\n}\n\n.tc-improvement-banner {\n\tfont-size: 0.7em;\n\tbackground: #fcc;\n\tpadding-left: 5px;\n\tmargin-top: 6px;\n\tmargin-bottom: 12px;\n\t\u003C\u003Cbox-shadow \"2px 2px 2px rgba(0,0,0,0.4)\">>\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\t\n\t.tc-improvement-banner {\n\t}\n\n}\n\n@media (min-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\n\t.tc-improvement-banner {\n\t\tmargin-right: -53px;\n\t\tmargin-left: -53px;\n\t}\n\n\t.tc-improvement-banner:before {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\twidth: 0;\n\t\theight: 0;\n\t\tcontent: \" \";\n\t\tmargin-left: -5px;\n\t\tmargin-top: -10px;\n\t\tborder-top: 5px solid transparent;\n\t\tborder-left: 5px solid transparent;\n\t\tborder-right: 5px solid #C07E7E;\n\t\tborder-bottom: 5px solid #C07E7E;\n\t}\n\n}\n\n.tc-improvement-banner svg {\n\twidth: 1em;\n\theight: 1em;\n}\n\n\n\n.tc-wrapper-flex {\n\tdisplay: flex;\n}\n\n.tc-saving-sidebar {\n\tmargin: 0;\n\tpadding: 0;\n\tmin-width: 200px;\n\toverflow: auto;\n}\n\n.tc-saving-sidebar a {\n\tdisplay: block;\n}\n\n@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {\n\t.tc-wrapper-flex {\n\t\tflex-direction: column;\n\t}\n\t.tc-saving-sidebar {\n\t\twidth: 100%;\n\t\theight: auto;\n\t}\n\t.tc-saving-sidebar a {\n\t\tfloat: left;\n\t}\n}\n\n.tc-saving-sidebar-category {\n\tmargin-bottom: 10px;\n}\n\n.tc-saving-sidebar-category-title {\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tfont-size: 16px;\n}\n\n.tc-saving-sidebar-category-item {\n\tmargin-left: 10px;\n}\n\n.tc-saving-introduction {\n\tdisplay: flex;\n\tjustify-content: center;\n\ttext-align: center;\n\talign-items: center;\n\tpadding: 4em;\n\tfont-style: italic;\n}\n\n.tc-cards {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tjustify-content: space-evenly;\n\twidth: 100%;\n\tpadding: 0.5em;\n\tbackground: \u003C\u003Ccolour background>>;\n\tborder-color: rgba(34,36,38,.15);\n\tbox-shadow: 0 2px 25px 0 rgb(34 36 38 / 5%) inset;\n\tgap: 1em;\n}\n\n.tc-cards.tc-action-card {\n\ttext-align: center;\n\tbackground: none;\n}\n\n.tc-cards.tc-action-card .tc-card-button {\n\tborder: 1px solid \u003C\u003Ccolour foreground>>;\n\tbackground: \u003C\u003Ccolour foreground>>;\n\tmargin: 0.5em;\n\tborder-radius: 6px;\n\tpadding: 0.5em;\n\tcolor: \u003C\u003Ccolour background>>;\n\tfill: \u003C\u003Ccolour background>>;\n}\n\n.tc-cards.tc-action-card .tc-card-button svg {\n\twidth: 0.65em;\n\theight: 0.65em;\n\tvertical-align: middle;\n}\n\n.tc-tiddlylink.tc-card {\n\tfont-weight: normal;\n\tmax-width: 100%;\n\tposition: relative;\n\tbackground: \u003C\u003Ccolour background>>;\n\tcolor: \u003C\u003Ccolour foreground>>;\n\twidth: 200px;\n\tmin-height: 0;\n\tborder: none;\n\tborder-radius: 8px;\n\tbox-shadow: 0 1px 3px 0 #d4d4d5, 0 0 0 1px #d4d4d5;\n\ttransition: box-shadow 0.3s ease,transform .3s ease;\n}\n\n.tc-cards.tc-cards-vertical .tc-tiddlylink.tc-card {\n\twidth: 100%;\n}\n\n@media (max-width: 500px) {\n\t\n\t.tc-cards {\n\t\tpadding: 0;\n\t}\n\n\t.tc-tiddlylink.tc-card {\n\t\tmargin: 0.25em;\n\t\twidth: 45%;\n\t}\n\n}\n\n.tc-tiddlylink.tc-card.tc-card-quote {\n\twidth: 320px;\n\tbox-sha
|
||
|
{"created":"20230713193505657","title":"$:/config/Navigation/openLinkFromInsideRiver","text":"top","modified":"20230713193505657"},
|
||
|
{"created":"20230713204003017","text":"show","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/export-page","modified":"20230713204003018"},
|
||
|
{"created":"20230713193336348","text":"show","title":"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home","modified":"20230713193336348"},
|
||
|
{"created":"20230719013644581","title":"$:/config/Plugins/Disabled/$:/plugins/kebi/notebook-tweaks","text":"yes","modified":"20230719013644581"},
|
||
|
{"created":"20230719013619479","title":"$:/config/Plugins/Disabled/$:/plugins/kebi/tiddlyremember-tweaks","text":"yes","modified":"20230719013619479"},
|
||
|
{"created":"20230719013744795","title":"$:/config/Plugins/Disabled/$:/plugins/kebi/tiddlystudy","text":"yes","modified":"20230719013744795"},
|
||
|
{"created":"20230719013718234","title":"$:/config/Plugins/Disabled/$:/plugins/kebi/tiddlystudy-references","text":"yes","modified":"20230719013718234"},
|
||
|
{"created":"20230713191337016","text":"yes","title":"$:/config/RelinkOnRename","modified":"20230713191337016"},
|
||
|
{"created":"20230713192517329","title":"$:/config/Tiddlers/TitleLinks","text":"no","modified":"20230713193546288"},
|
||
|
{"title":"$:/core","name":"Core","description":"TiddlyWiki5 core","author":"JeremyRuston","core-version":">=5.0.0","plugin-priority":"0","list":"readme","version":"5.3.0","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/Acknowledgements\":{\"title\":\"$:/Acknowledgements\",\"text\":\"TiddlyWiki incorporates code from these fine OpenSource projects:\\n\\n* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]\\n* [[The Jasmine JavaScript Test Framework|https://jasmine.github.io/]]\\n* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]\\n\\nAnd media from these projects:\\n\\n* World flag icons from [[Wikipedia|http://commons.wikimedia.org/wiki/Category:SVG_flags_by_country]]\\n\"},\"$:/core/copyright.txt\":{\"title\":\"$:/core/copyright.txt\",\"type\":\"text/plain\",\"text\":\"TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\\n\\nCopyright (c) 2004-2007, Jeremy Ruston\\nCopyright (c) 2007-2023, UnaMesa Association\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n* Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n* Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n* Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"},\"$:/core/icon\":{\"title\":\"$:/core/icon\",\"tags\":\"$:/tags/Image\",\"text\":\"\\\\parameters (size:\\\"22pt\\\")\\n\u003Csvg width=\u003C\u003Csize>> height=\u003C\u003Csize>> viewBox=\\\"0 0 128 128\\\">\u003Cpath d=\\\"M64 0l54.56 32v64L64 128 9.44 96V32L64 0zm21.127 95.408c-3.578-.103-5.15-.094-6.974-3.152l-1.42.042c-1.653-.075-.964-.04-2.067-.097-1.844-.07-1.548-1.86-1.873-2.8-.52-3.202.687-6.43.65-9.632-.014-1.14-1.593-5.17-2.157-6.61-1.768.34-3.546.406-5.34.497-4.134-.01-8.24-.527-12.317-1.183-.8 3.35-3.16 8.036-1.21 11.44 2.37 3.52 4.03 4.495 6.61 4.707 2.572.212 3.16 3.18 2.53 4.242-.55.73-1.52.864-2.346 1.04l-1.65.08c-1.296-.046-2.455-.404-3.61-.955-1.93-1.097-3.925-3.383-5.406-5.024.345.658.55 1.938.24 2.53-.878 1.27-4.665 1.26-6.4.47-1.97-.89-6.73-7.162-7.468-11.86 1.96-3.78 4.812-7.07 6.255-11.186-3.146-2.05-4.83-5.384-4.61-9.16l.08-.44c-3.097.59-1.49.37-4.82.628-10.608-.032-19.935-7.37-14.68-18.774.34-.673.664-1.287 1.243-.994.466.237.4 1.18.166 2.227-3.005 13.627 11.67 13.732 20.69 11.21.89-.25 2.67-1.936 3.905-2.495 2.016-.91 4.205-1.282 6.376-1.55 5.4-.63 11.893 2.276 15.19 2.37 3.3.096 7.99-.805 10.87-.615 2.09.098 4.143.483 6.16 1.03 1.306-6.49 1.4-11.27 4.492-12.38 1.814.293 3.213 2.818 4.25 4.167 2.112-.086 4.12.46 6.115 1.066 3.61-.522 6.642-2.593 9.833-4.203-3.234 2.69-3.673 7.075-3.303 11.127.138 2.103-.444 4.386-1.164 6.54-1.348 3.507-3.95 7.204-6.97 7.014-1.14-.036-1.805-.695-2.653-1.4-.164 1.427-.81 2.7-1.434 3.96-1.44 2.797-5.203 4.03-8.687 7.016-3.484 2.985 1.114 13.65 2.23 1
|
||
|
{"title":"$:/core/ui/ControlPanel/Settings/TitleLinks","tags":"$:/tags/ControlPanel/Settings","caption":"{{$:/language/ControlPanel/Settings/TitleLinks/Caption}}","text":"\\define lingo-base() $:/language/ControlPanel/Settings/TitleLinks/\n\u003C$link to=\"$:/config/Tiddlers/TitleLinks\">\u003C\u003Clingo Hint>>\u003C/$link>\n\n\u003C$radio tiddler=\"$:/config/Tiddlers/TitleLinks\" value=\"yes\"> \u003C\u003Clingo Yes/Description>> \u003C/$radio>\n\n\u003C$radio tiddler=\"$:/config/Tiddlers/TitleLinks\" value=\"no\"> \u003C\u003Clingo No/Description>> \u003C/$radio>\n"},
|
||
|
{"created":"20230713172425866","title":"$:/DefaultTiddlers","text":"[[inicio]]","modified":"20230713172447320"},
|
||
|
{"title":"$:/Import","text":"The following tiddlers were imported:\n\n# [[copincha--linux--install--log]]","status":"complete"},
|
||
|
{"title":"$:/isEncrypted","text":"no"},
|
||
|
{"text":"alert-background: #644a7d\nalert-border: #644a7d\nalert-highlight: \u003C\u003Ccolour primary>>\nalert-muted-foreground: \u003C\u003Ccolour muted-foreground>>\nbackground: #2A2B30\nblockquote-bar: \u003C\u003Ccolour muted-foreground>>\nbutton-background: \u003C\u003Ccolour page-background>>\nbutton-foreground: \u003C\u003Ccolour foreground>>\nbutton-border: \u003C\u003Ccolour tag-background>>\ncode-background: \u003C\u003Ccolour page-background>>\ncode-border: \u003C\u003Ccolour page-background>>\ncode-foreground: \u003C\u003Ccolour muted-foreground>>\ndirty-indicator: \u003C\u003Ccolour primary>>\ndownload-background: #644a7d\ndownload-foreground: \u003C\u003Ccolour background>>\ndragger-background: \u003C\u003Ccolour foreground>>\ndragger-foreground: \u003C\u003Ccolour background>>\ndropdown-background: \u003C\u003Ccolour background>>\ndropdown-border: \u003C\u003Ccolour background>>\ndropdown-tab-background-selected: \u003C\u003Ccolour background>>\ndropdown-tab-background: \u003C\u003Ccolour background>>\ndropzone-background: \u003C\u003Ccolour primary>>\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: \u003C\u003Ccolour tag-background>>\nexternal-link-foreground: #f0b000\nforeground: rgba(255,255,255,0.87)\nmessage-background: #644a7d\nmessage-border: #644a7d\nmessage-foreground: \u003C\u003Ccolour foreground>>\nmodal-backdrop: \u003C\u003Ccolour page-background>>\nmodal-background: \u003C\u003Ccolour background>>\nmodal-border: \u003C\u003Ccolour background>>\nmodal-footer-background: \u003C\u003Ccolour background>>\nmodal-footer-border: \u003C\u003Ccolour background>>\nmodal-header-border: \u003C\u003Ccolour muted-foreground>>\nmuted-foreground: rgba(255,255,255,0.5)\nnotification-background: #644a7d\nnotification-border: #644a7d\npage-background: #1c1d22\npre-background: \u003C\u003Ccolour page-background>>\npre-border: \u003C\u003Ccolour page-background>>\nprimary: #00a9c7\nsidebar-button-foreground: \u003C\u003Ccolour foreground>>\nsidebar-controls-foreground-hover: inherit\nsidebar-controls-foreground: \u003C\u003Ccolour muted-foreground>>\nsidebar-foreground-shadow: transparent\nsidebar-foreground: \u003C\u003Ccolour foreground>>\nsidebar-muted-foreground-hover: inherit\nsidebar-muted-foreground: \u003C\u003Ccolour foreground>>\nsidebar-tab-background-selected: \u003C\u003Ccolour page-background>>\nsidebar-tab-background: transparent\nsidebar-tab-border-selected: \u003C\u003Ccolour primary>>\nsidebar-tab-border: transparent\nsidebar-tab-divider: \u003C\u003Ccolour primary>>\nsidebar-tab-foreground-selected: \u003C\u003Ccolour primary>>\nsidebar-tab-foreground: \u003C\u003Ccolour muted-foreground>>\nsidebar-tiddler-link-foreground-hover: inherit\nsidebar-tiddler-link-foreground: \u003C\u003Ccolour muted-foreground>>\nsite-title-foreground: white\nstatic-alert-foreground: \u003C\u003Ccolour foreground>>\ntab-background-selected: \u003C\u003Ccolour background>>\ntab-background: transparent\ntab-border-selected: \u003C\u003Ccolour primary>>\ntab-border: transparent\ntab-divider: \u003C\u003Ccolour primary>>\ntab-foreground-selected: \u003C\u003Ccolour primary>>\ntab-foreground: \u003C\u003Ccolour muted-foreground>>\ntable-border: \u003C\u003Ccolour page-background>>\ntable-footer-background: rgba(0, 0, 0, 0.1)\ntable-header-background: rgba(0, 0, 0, 0.2)\ntag-background: #8a6ca8\ntag-foreground: \u003C\u003Ccolour foreground>>\ntiddler-background: \u003C\u003Ccolour background>>\ntiddler-border: \u003C\u003Ccolour background>>\ntiddler-controls-foreground-hover: inherit\ntiddler-controls-foreground-selected: \u003C\u003Ccolour foreground>>\ntiddler-controls-foreground: #6b6b6b\ntiddler-editor-background: \u003C\u003Ccolour background>>\ntiddler-editor-border-image: \u003C\u003Ccolour background>>\ntiddler-editor-border: rgba(255,255,255,0.1)\ntiddler-editor-fields-even: #3a3a3a\ntiddler-editor-fields-odd: \u003C\u003Ccolour page-background>>\ntiddler-info-back
|
||
|
{"created":"20230713193421295","title":"$:/layout","text":"$:/core/ui/PageTemplate","modified":"20230713193421295"},
|
||
|
{"created":"20230718201626187","title":"$:/palette","text":"$:/palettes/Twilight","modified":"20230718201725557"},
|
||
|
{"text":"{\n \"tiddlers\": {\n \"$:/language/Docs/Types/text/x-markdown\": {\n \"title\": \"$:/language/Docs/Types/text/x-markdown\",\n \"description\": \"Markdown\",\n \"name\": \"text/x-markdown\",\n \"group\": \"Text\"\n },\n \"$:/plugins/anstosa/tw5-markdown/highlight.css\": {\n \"text\": \"/*\\n\\ngithub.com style (c) Vasily Polovnyov \u003Cvast@whiteants.net>\\n\\n*/\\n\\n.hljs {\\n display: block;\\n overflow-x: auto;\\n padding: 0.5em;\\n color: #333;\\n background: #f8f8f8;\\n}\\n\\n.hljs-comment,\\n.hljs-quote {\\n color: #998;\\n font-style: italic;\\n}\\n\\n.hljs-keyword,\\n.hljs-selector-tag,\\n.hljs-subst {\\n color: #333;\\n font-weight: bold;\\n}\\n\\n.hljs-number,\\n.hljs-literal,\\n.hljs-variable,\\n.hljs-template-variable,\\n.hljs-tag .hljs-attr {\\n color: #008080;\\n}\\n\\n.hljs-string,\\n.hljs-doctag {\\n color: #d14;\\n}\\n\\n.hljs-title,\\n.hljs-section,\\n.hljs-selector-id {\\n color: #900;\\n font-weight: bold;\\n}\\n\\n.hljs-subst {\\n font-weight: normal;\\n}\\n\\n.hljs-type,\\n.hljs-class .hljs-title {\\n color: #458;\\n font-weight: bold;\\n}\\n\\n.hljs-tag,\\n.hljs-name,\\n.hljs-attribute {\\n color: #000080;\\n font-weight: normal;\\n}\\n\\n.hljs-regexp,\\n.hljs-link {\\n color: #009926;\\n}\\n\\n.hljs-symbol,\\n.hljs-bullet {\\n color: #990073;\\n}\\n\\n.hljs-built_in,\\n.hljs-builtin-name {\\n color: #0086b3;\\n}\\n\\n.hljs-meta {\\n color: #999;\\n font-weight: bold;\\n}\\n\\n.hljs-deletion {\\n background: #fdd;\\n}\\n\\n.hljs-addition {\\n background: #dfd;\\n}\\n\\n.hljs-emphasis {\\n font-style: italic;\\n}\\n\\n.hljs-strong {\\n font-weight: bold;\\n}\\n\",\n \"type\": \"text/css\",\n \"title\": \"$:/plugins/anstosa/tw5-markdown/highlight.css\",\n \"tags\": \"[[$:/tags/Stylesheet]]\"\n },\n \"$:/plugins/anstosa/tw5-markdown/highlight.js\": {\n \"text\": \"/*! highlight.js v9.10.0 | BSD3 License | git.io/hljslicense */\\n!function(e){var t=\\\"object\\\"==typeof window&&window||\\\"object\\\"==typeof self&&self;\\\"undefined\\\"!=typeof exports?e(exports):t&&(t.hljs=e({}),\\\"function\\\"==typeof define&&define.amd&&define([],function(){return t.hljs}))}(function(e){function t(e){return e.replace(/[&\u003C>]/gm,function(e){return I[e]})}function r(e){return e.nodeName.toLowerCase()}function a(e,t){var r=e&&e.exec(t);return r&&0===r.index}function i(e){return N.test(e)}function n(e){var t,r,a,n,o=e.className+\\\" \\\";if(o+=e.parentNode?e.parentNode.className:\\\"\\\",r=w.exec(o))return S(r[1])?r[1]:\\\"no-highlight\\\";for(o=o.split(/\\\\s+/),t=0,a=o.length;a>t;t++)if(n=o[t],i(n)||S(n))return n}function o(e){var t,r={},a=Array.prototype.slice.call(arguments,1);for(t in e)r[t]=e[t];return a.forEach(function(e){for(t in e)r[t]=e[t]}),r}function s(e){var t=[];return function a(e,i){for(var n=e.firstChild;n;n=n.nextSibling)3===n.nodeType?i+=n.nodeValue.length:1===n.nodeType&&(t.push({event:\\\"start\\\",offset:i,node:n}),i=a(n,i),r(n).match(/br|hr|img|input/)||t.push({event:\\\"stop\\\",offset:i,node:n}));return i}(e,0),t}function l(e,a,i){function n(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset\u003Ca[0].offset?e:a:\\\"start\\\"===a[0].event?e:a:e.length?e:a}function o(e){function a(e){return\\\" \\\"+e.nodeName+'=\\\"'+t(e.value)+'\\\"'}d+=\\\"\u003C\\\"+r(e)+C.map.call(e.attributes,a).join(\\\"\\\")+\\\">\\\"}function s(e){d+=\\\"\u003C/\\\"+r(e)+\\\">\\\"}function l(e){(\\\"start\\\"===e.event?o:s)(e.node)}for(var c=0,d=\\\"\\\",p=[];e.length||a.length;){var m=n();if(d+=t(i.substring(c,m[0].offset)),c=m[0].offset,m===e){p.reverse().forEach(s);do l(m.splice(0,1)[0]),m=n();while(m===e&&m.length&&m[0].offset===c);p.reverse().forEach(o)}else\\\"start\\\"===m[0].event?p.push(m[0].node):p.pop(),l(m.splice(0,1)[0])}return d+t(i.substr(c))}function c(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(t){return o(e,{v:null},t)})),e.cached_variants||e.eW&&[o(e)]||[e]}function d(e){function t
|
||
|
{"title":"$:/plugins/flibbles/3rd-party","description":"Example plugin which integrates with Relink.","list":"readme","name":"Relink Example","plugin-type":"plugin","type":"application/json","text":"{\n\t\"tiddlers\": {\n\t\t\"$:/config/flibbles/relink/attributes/$3rd/editTemplate\": {\n\t\t\t\"text\": \"title\"\n\t\t},\n\t\t\"$:/config/flibbles/relink/attributes/$3rd/filter\": {\n\t\t\t\"text\": \"filter\"\n\t\t},\n\t\t\"$:/config/flibbles/relink/attributes/$3rd/history\": {\n\t\t\t\"text\": \"title\"\n\t\t},\n\t\t\"$:/config/flibbles/relink/attributes/$3rd/template\": {\n\t\t\t\"text\": \"title\"\n\t\t},\n\t\t\"$:/config/flibbles/relink/fields/3rd\": {\n\t\t\t\"text\": \"list\"\n\t\t},\n\t\t\"$:/config/flibbles/relink/macros/3rd/tiddler\": {\n\t\t\t\"text\": \"title\"\n\t\t},\n\t\t\"$:/config/flibbles/relink/operators/3rd\": {\n\t\t\t\"text\": \"title\"\n\t\t},\n\t\t\"$:/plugins/flibbles/3rd-party/readme\": {\n\t\t\t\"text\": \"This plugin doesn't do anything. It only shows how other plugins can integrate with //Relink//. Thereby allowing any macros, widgets, fields, or filter operators they introduce to automatically be configured for //Relink// to handle.\\n\\nLook at the \u003C\u003Clink-to-config-tab caption:'//Relink// configuration page'>> to see how this plugin's configurations are grouped.\"\n\t\t},\n\t\t\"$:/plugins/flibbles/3rd-party/macro\": {\n\t\t\t\"module-type\": \"macro\",\n\t\t\t\"text\": \"/*\\\\\\n\\nExample macro which this plugin has automatically integrated with Relink\\n\\n\\\\*/\\n\\nexports.name = \\\"3rd\\\";\\n\\nexports.params = [\\n\\t{name: \\\"tiddler\\\"}\\n];\\n\\nexports.run = function(tiddler) {\\n\\treturn \\\"3rd macro called with: \\\" + tiddler;\\n};\",\n\t\t\t\"type\": \"application/javascript\"\n\t\t},\n\t\t\"$:/plugins/flibbles/3rd-party/operator\": {\n\t\t\t\"module-type\": \"filteroperator\",\n\t\t\t\"text\": \"/*\\\\\\n\\nExample filter operator which this plugin has automatically integrated with Relink.\\nThis is just a generator that return the third word in the operand tiddler's text.\\n\\n\\\\*/\\n\\nexports[\\\"3rd\\\"] = function(source,operator,options) {\\n\\tvar tiddler = options.wiki.getTiddler(operator.operand);\\n\\tif (tiddler) {\\n\\t\\tvar match = /\\\\S+\\\\s+\\\\S+\\\\s+(\\\\S+)/.exec(tiddler.fields.text);\\n\\t\\tif (match) {\\n\\t\\t\\treturn [match[1]];\\n\\t\\t}\\n\\t}\\n\\treturn [];\\n};\",\n\t\t\t\"type\": \"application/javascript\"\n\t\t},\n\t\t\"$:/plugins/flibbles/3rd-party/widget\": {\n\t\t\t\"module-type\": \"widget\",\n\t\t\t\"text\": \"/*\\\\\\n\\nExample widget. It's just an alternate name for the core $list widget.\\n\\n\\\\*/\\n\\nvar List = require(\\\"$:/core/modules/widgets/list.js\\\").list;\\n\\nexports[\\\"3rd\\\"] = List;\",\n\t\t\t\"type\": \"application/javascript\"\n\t\t}\n\t}\n}\n"},
|
||
|
{"name":"Relink","title":"$:/plugins/flibbles/relink","description":"Flexibility when relinking renamed tiddlers","author":"Flibbles","version":"2.3.4","core-version":">=5.1.22","source":"https://github.com/flibbles/tw5-relink","demo":"http://flibbles.github.io/tw5-relink/","list":"readme configuration license","dependents":"","plugin-type":"plugin","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/flibbles/relink/js/bulkops.js\":{\"text\":\"/*\\\\\\nmodule-type: startup\\n\\nReplaces the relinkTiddler defined in $:/core/modules/wiki-bulkops.js\\n\\nThis is a startup instead of a wikimethods module-type because it's the only\\nway to ensure this runs after the old relinkTiddler method is applied.\\n\\n\\\\*/\\n(function(){\\n\\n/*jslint node: false, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar language = require('$:/plugins/flibbles/relink/js/language.js');\\nvar utils = require(\\\"$:/plugins/flibbles/relink/js/utils.js\\\");\\n\\nexports.name = \\\"redefine-relinkTiddler\\\";\\nexports.synchronous = true;\\n// load-modules is when wikimethods are applied in\\n// ``$:/core/modules/startup/load-modules.js``\\nexports.after = ['load-modules'];\\n// We come before commands because they may do renaming, or jasmine testing\\nexports.before = ['commands'];\\n\\nexports.startup = function() {\\n\\t$tw.Wiki.prototype.relinkTiddler = relinkTiddler;\\n};\\n\\n/** Walks through all relinkable tiddlers and relinks them.\\n * This replaces the existing function in core Tiddlywiki.\\n */\\nfunction relinkTiddler(fromTitle, toTitle, options) {\\n\\toptions = options || {};\\n\\tvar failures = [];\\n\\tvar indexer = utils.getIndexer(this);\\n\\tvar records = indexer.relinkLookup(fromTitle, toTitle, options);\\n\\tfor (var title in records) {\\n\\t\\tvar entries = records[title],\\n\\t\\t\\tchanges = Object.create(null),\\n\\t\\t\\tupdate = false,\\n\\t\\t\\tfails = false;\\n\\t\\tfor (var field in entries) {\\n\\t\\t\\tvar entry = entries[field];\\n\\t\\t\\tfails = fails || entry.impossible;\\n\\t\\t\\tif (entry.output !== undefined) {\\n\\t\\t\\t\\tchanges[field] = entry.output;\\n\\t\\t\\t\\tupdate = true;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tif (fails) {\\n\\t\\t\\tfailures.push(title);\\n\\t\\t}\\n\\t\\t// If any fields changed, update tiddler\\n\\t\\tif (update) {\\n\\t\\t\\tconsole.log(\\\"Renaming '\\\"+fromTitle+\\\"' to '\\\"+toTitle+\\\"' in '\\\" + title + \\\"'\\\");\\n\\n\\t\\t\\tvar tiddler = this.getTiddler(title);\\n\\t\\t\\tvar modifyField = utils.touchModifyField(this) ? this.getModificationFields() : undefined;\\n\\t\\t\\tvar newTiddler = new $tw.Tiddler(tiddler,changes,modifyField)\\n\\t\\t\\tnewTiddler = $tw.hooks.invokeHook(\\\"th-relinking-tiddler\\\",newTiddler,tiddler);\\n\\t\\t\\tthis.addTiddler(newTiddler);\\n\\t\\t\\t// If the title changed, we need to perform a nested rename\\n\\t\\t\\tif (newTiddler.fields.title !== title) {\\n\\t\\t\\t\\tthis.deleteTiddler(title);\\n\\t\\t\\t\\tthis.relinkTiddler(title, newTiddler.fields.title,options);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t};\\n\\tif (failures.length > 0) {\\n\\t\\tvar options = $tw.utils.extend(\\n\\t\\t\\t{ variables: {to: toTitle, from: fromTitle},\\n\\t\\t\\t wiki: this},\\n\\t\\t\\toptions );\\n\\t\\tlanguage.reportFailures(failures, options);\\n\\t}\\n};\\n\\n})();\\n\",\"module-type\":\"startup\",\"title\":\"$:/plugins/flibbles/relink/js/bulkops.js\",\"type\":\"application/javascript\"},\"$:/plugins/flibbles/relink/js/indexer.js\":{\"text\":\"/*\\\\\\nmodule-type: indexer\\n\\nIndexes results from tiddler reference reports so we don't have to call them\\nso much.\\n\\n\\\\*/\\n\\n\\\"use strict\\\";\\n\\nvar utils = require(\\\"./utils.js\\\");\\nvar TiddlerContext = utils.getContext('tiddler');\\n\\nfunction Indexer(wiki) {\\n\\tthis.wiki = wiki;\\n};\\n\\nIndexer.prototype.init = function() {\\n\\tthis.rebuild();\\n};\\n\\nIndexer.prototype.rebuild = function() {\\n\\tthis.index = null;\\n\\tthis.backIndex = null;\\n\\tthis.contexts = Object.create(null);\\n\\tthis.changedTiddlers = undefined;\\n\\tthis.lastRelinks = O
|
||
|
{"name":"Relink Field Names","title":"$:/plugins/flibbles/relink-fieldnames","description":"Renames field names with titles matching Relinked tiddlers","author":"Flibbles","version":"2.3.0","core-version":">=5.1.22","parent-plugin":"$:/plugins/flibbles/relink","source":"https://github.com/flibbles/tw5-relink","demo":"http://flibbles.github.io/tw5-relink/","list":"readme reference","dependents":"","plugin-type":"plugin","type":"application/json","text":"{\"tiddlers\":{\"$:/config/flibbles/relink/attributes/$action-deletefield/$field\":{\"title\":\"$:/config/flibbles/relink/attributes/$action-deletefield/$field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$action-listops/$field\":{\"title\":\"$:/config/flibbles/relink/attributes/$action-listops/$field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$action-setfield/$field\":{\"title\":\"$:/config/flibbles/relink/attributes/$action-setfield/$field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$button/setField\":{\"title\":\"$:/config/flibbles/relink/attributes/$button/setField\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$checkbox/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$checkbox/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$edit-text/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$edit-text/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$edit/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$edit/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$fields/exclude\":{\"title\":\"$:/config/flibbles/relink/attributes/$fields/exclude\",\"text\":\"fieldnamelist\"},\"$:/config/flibbles/relink/attributes/$fields/include\":{\"title\":\"$:/config/flibbles/relink/attributes/$fields/include\",\"text\":\"fieldnamelist\"},\"$:/config/flibbles/relink/attributes/$jsontiddler/exclude\":{\"title\":\"$:/config/flibbles/relink/attributes/$jsontiddler/exclude\",\"text\":\"fieldnamelist\"},\"$:/config/flibbles/relink/attributes/$radio/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$radio/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$range/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$range/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$reveal/stateField\":{\"title\":\"$:/config/flibbles/relink/attributes/$reveal/stateField\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$select/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$select/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$setvariable/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$setvariable/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$set/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$set/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$transclude/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$transclude/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/attributes/$view/field\":{\"title\":\"$:/config/flibbles/relink/attributes/$view/field\",\"text\":\"fieldname\"},\"$:/config/flibbles/relink/fieldnames/blacklist\":{\"title\":\"$:/config/flibbles/relink/fieldnames/blacklist\",\"filter\":\"[all[shadows+tiddlers]removeprefix[$:/language/Docs/Fields/]]\",\"text\":\"This tiddler specifies what fields //Relink-fieldname// should refuse to change. Edit its `filter` field if you'd like to change that list.\\n\"},\"$:/plugins/flibbles/relink-fieldnames/fieldtypes/fieldname.js\":{\"title\":\"$:/plugins/flibbles/relink-fieldnames/fieldtypes/fieldname.js\",\"text\":\"/*\\\\\\ntitle: $:/plugins/flibbles/relink-fieldnames/fieldtypes/fieldname.js\\nmodule-type: relinkfieldtype\\ntype: application/javascript\\n\\nThis field type behaves exactly like the \\\"title\\\" field type, except that\\nit ignores any titles that appear on the field name blacklist.\\n\\n\\\\*/\\n\\nexports.name = 'fieldname';\\n\\nvar utils = require(\\\"../utils.js\\\");\\n\\nex
|
||
|
{"name":"Relink Markdown","title":"$:/plugins/flibbles/relink-markdown","description":"Markdown support for Relink","author":"Flibbles","version":"2.3.3","core-version":">=5.1.22","parent-plugin":"$:/plugins/flibbles/relink","source":"https://github.com/flibbles/tw5-relink","list":"readme","dependents":"","plugin-type":"plugin","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/flibbles/relink-markdown/fieldtypes/markdown.js\":{\"title\":\"$:/plugins/flibbles/relink-markdown/fieldtypes/markdown.js\",\"text\":\"/*\\\\\\nmodule-type: relinkfieldtype\\ntitle: $:/plugins/flibbles/relink-markdown/fieldtypes/markdown.js\\ntype: application/javascript\\n\\nThis relinks tiddlers which contain markdown. It tries to be agnostic to\\nwhichever markdown plugin you're using.\\n\\n\\\\*/\\n\\nvar Rebuilder = require(\\\"$:/plugins/flibbles/relink/js/utils/rebuilder.js\\\");\\nvar wikitextHandler = require(\\\"$:/plugins/flibbles/relink/js/utils.js\\\").getType('wikitext');\\nvar utils = require(\\\"$:/plugins/flibbles/relink-markdown/utils/markdown.js\\\");\\nvar WikiParser = require(\\\"$:/core/modules/parsers/wikiparser/wikiparser.js\\\")['text/vnd.tiddlywiki'];\\n\\nfunction MarkdownWalker(text, options) {\\n\\tthis.wiki = options.wiki;\\n\\tthis.options = Object.create(options);\\n\\tthis.options.macrodefCanBeDisabled = true;\\n\\tif(!this.mdInlineRuleClasses) {\\n\\t\\tMarkdownWalker.prototype.mdInlineRuleClasses = $tw.modules.createClassesFromModules(\\\"relinkmarkdownrule\\\",\\\"inline\\\",$tw.MarkdownRuleBase);\\n\\t}\\n\\tif(!this.mdBlockRuleClasses) {\\n\\t\\tMarkdownWalker.prototype.mdBlockRuleClasses = $tw.modules.createClassesFromModules(\\\"relinkmarkdownrule\\\",\\\"block\\\",$tw.MarkdownRuleBase);\\n\\t}\\n\\tthis.source = text || \\\"\\\";\\n\\tthis.sourceLength = this.source.length;\\n\\t// Set current parse position\\n\\tthis.pos = 0;\\n\\t// Instantiate the parser block and inline rules\\n\\tthis.blockRules = this.instantiateRules(this.mdBlockRuleClasses,\\\"block\\\",0);\\n\\tthis.inlineRules = this.instantiateRules(this.mdInlineRuleClasses,\\\"inline\\\",0);\\n\\t// instantiateRules first with indent==undefined so we can match regardless\\n\\t// of tabdepth. Now we need to be strict about it.\\n\\tthis.indent = 0;\\n\\tthis.parseBlocks();\\n};\\n\\nMarkdownWalker.prototype = Object.create(WikiParser.prototype);\\n\\nmodule.exports\\n\\nMarkdownWalker.prototype.parseBlock = function(terminatorRegExpString) {\\n\\tvar terminatorRegExp = /([^\\\\S\\\\n]*\\\\r?\\\\n)/mg;\\n\\tthis.skipEmptyLines();\\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 this.handleRule(nextMatch);\\n\\t}\\n\\treturn this.parseInlineRun(terminatorRegExp);\\n};\\n\\nMarkdownWalker.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 \u003C 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\\tthis.handleWikitext(this.pos, terminatorMatch.index);\\n\\t\\t\\t\\t//if(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\\tthis.handleWiki
|
||
|
{"name":"Relink Titles","title":"$:/plugins/flibbles/relink-titles","description":"Renames tiddlers with titles derived from Relinked tiddler","author":"Flibbles","version":"2.3.1","core-version":">=5.1.22","parent-plugin":"$:/plugins/flibbles/relink","source":"https://github.com/flibbles/tw5-relink","demo":"http://flibbles.github.io/tw5-relink/","list":"readme configuration","dependents":"","plugin-type":"plugin","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/flibbles/relink-titles/configuration\":{\"title\":\"$:/plugins/flibbles/relink-titles/configuration\",\"caption\":\"{{$:/plugins/flibbles/relink-titles/language/Caption}}\",\"tags\":\"$:/tags/flibbles/relink/Configuration\",\"text\":\"\\\\define lingo-base() $:/plugins/flibbles/relink-titles/language/\\n\\\\define prefix() $:/config/flibbles/relink-titles/relink/\\n\\\\whitespace trim\\n\\n\u003Cdiv class=\\\"tc-control-panel\\\">\\n\\n\u003C\u003Clingo Help>>\\n\\n\u003Ctable>\\n\u003Ctbody>\\n\u003C$list filter=\\\"[[relinktitlesrule]modules[]]\\\">\\n\u003Ctr>\\n\u003Ctd>\\n\u003C$checkbox\\n\\ttiddler={{{ [all[current]addprefix\u003Cprefix>] }}}\\n\\tfield=\\\"text\\\"\\n\\tchecked=\\\"enabled\\\"\\n\\tunchecked=\\\"disabled\\\"\\n\\tdefault=\\\"enabled\\\">\\n \\n''{{!!caption}}''\\n\u003C/$checkbox>\u003C/td>\u003Ctd>\\n\\n\u003C$transclude field='description' />\\n\\n\u003C/td>\u003C/tr>\u003C/$list>\\n\u003C/tbody>\u003C/table>\u003C/div>\\n\"},\"$:/plugins/flibbles/relink-titles/language/Caption\":{\"title\":\"$:/plugins/flibbles/relink-titles/language/Caption\",\"text\":\"Titles\"},\"$:/plugins/flibbles/relink-titles/language/Directory/Caption\":{\"title\":\"$:/plugins/flibbles/relink-titles/language/Directory/Caption\",\"text\":\"Rename subdirectories\"},\"$:/plugins/flibbles/relink-titles/language/Directory/Description\":{\"title\":\"$:/plugins/flibbles/relink-titles/language/Directory/Description\",\"text\":\"For wikis set up hierarchically using `/`, like a filesystem. This option will update all tiddlers nested inside the target tiddler. i.e. `fromTiddler/path/file` becomes `toTiddler/path/file`.\"},\"$:/plugins/flibbles/relink-titles/language/Lookup/Caption\":{\"title\":\"$:/plugins/flibbles/relink-titles/language/Lookup/Caption\",\"text\":\"Lookup tiddlers\"},\"$:/plugins/flibbles/relink-titles/language/Help\":{\"title\":\"$:/plugins/flibbles/relink-titles/language/Help\",\"text\":\"See the \u003Ca href={{{ [{$:/plugins/flibbles/relink-titles!!demo}addsuffix[#Plugins/Titles]] }}} class=\\\"tc-tiddlylink-external\\\">//Relink-titles// documentation page\u003C/a> for details.\"},\"$:/plugins/flibbles/relink-titles/readme\":{\"title\":\"$:/plugins/flibbles/relink-titles/readme\",\"text\":\"Highly customizable relinking of tiddler titles //related// to the renamed tiddler.\\n\\n* Rename a hierarchy of subtiddlers when renaming a root tiddler.\\n* Make custom filter rules to rename other tiddlers the way you want when Relinking.\\n* Integrates with other plugins for plugin-specific rules.\\n\\nSee \u003Ca href={{$:/plugins/flibbles/relink-titles!!source}} class=\\\"tc-tiddlylink-external\\\">the tw5-relink website\u003C/a> for more details and examples.\\n\\n{{$:/core/images/warning}} ''Warning:'' You must use //Relink// v1.10.2 or greater with this, or this plugin may delete some tiddler bodies while trying to relink titles.\\n\"},\"$:/plugins/flibbles/relink-titles/relinkoperations/title.js\":{\"title\":\"$:/plugins/flibbles/relink-titles/relinkoperations/title.js\",\"text\":\"/*\\\\\\nmodule-type: relinkoperator\\ntitle: $:/plugins/flibbles/relink-titles/relinkoperations/title.js\\ntype: application/javascript\\n\\nRenames tiddlers which have titles derived from fromTitle. Then it makes\\nsure that those tiddlers are properly relinked too.\\n\\n\\\\*/\\n\\n/*jslint node: false, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar configPrefix = \\\"$:/config/flibbles/relink-titles/relink/\\\";\\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\\n// This is using hotDirectories, which is a deprecat
|
||
|
{"text":"{\n \"tiddlers\": {\n \"$:/config/flibbles/relink/macros/remembercz/reference\": {\n \"created\": \"20200907091508430\",\n \"text\": \"title\",\n \"title\": \"$:/config/flibbles/relink/macros/remembercz/reference\",\n \"modified\": \"20200907091513296\"\n },\n \"$:/config/flibbles/relink/macros/remembercz/text\": {\n \"created\": \"20200905042540938\",\n \"text\": \"wikitext\",\n \"title\": \"$:/config/flibbles/relink/macros/remembercz/text\",\n \"modified\": \"20200905052651823\"\n },\n \"$:/config/flibbles/relink/macros/rememberp/reference\": {\n \"created\": \"20200930123319494\",\n \"text\": \"title\",\n \"title\": \"$:/config/flibbles/relink/macros/rememberp/reference\",\n \"modified\": \"20200930123331058\",\n \"tags\": \"\"\n },\n \"$:/config/flibbles/relink/macros/rememberp/text\": {\n \"created\": \"20200930123337877\",\n \"text\": \"wikitext\",\n \"title\": \"$:/config/flibbles/relink/macros/rememberp/text\",\n \"modified\": \"20200930123345520\",\n \"tags\": \"\"\n },\n \"$:/config/flibbles/relink/macros/rememberq/reference\": {\n \"created\": \"20200907091605193\",\n \"text\": \"title\",\n \"title\": \"$:/config/flibbles/relink/macros/rememberq/reference\",\n \"modified\": \"20200907091612588\",\n \"tags\": \"\"\n },\n \"$:/config/flibbles/relink/macros/rememberq/text\": {\n \"created\": \"20200905042527106\",\n \"text\": \"wikitext\",\n \"title\": \"$:/config/flibbles/relink/macros/rememberq/text\",\n \"modified\": \"20200905052646704\"\n }\n }\n}","version":"1.0.0","type":"application/json","title":"$:/plugins/kebi/relink-tweaks","tags":"","plugin-type":"plugin","name":"Tweaks for Relink (tiddlystudy)","modified":"20210503195406567","created":"20210503173933422"},
|
||
|
{"text":"{\n \"tiddlers\": {\n \"$:/plugins/sq/streams/templates/stream-row-template\": {\n \"created\": \"20210503175857983\",\n \"text\": \"\\\\whitespace trim\\n\u003C$qualify\\n\\tname=\\\"row-children-visibility-state\\\"\\n\\ttitle={{{ [[$:/state/sq/streams/visibility/]addsuffix\u003CcurrentTiddler>] }}}\\n>\\n\u003C$droppable \\n\\tactions=\u003C\u003Cstream-drop-actions>>\\n\\ttag=\\\"div\\\"\\n\\tclass={{{ stream-droppable [list[!!stream-list]is[tiddler]then[]else[stream-row-nochildren]] +[join[ ]]}}}\\n\\tenable={{{[\u003Cdrag-title-nextsibling-state>get[text]match\u003CcurrentTiddler>then[no]] ~[\u003Cenable-dnd>]}}}\\n\\tdisabledClass=\\\"stream-node-disabled\\\"\\n\\tdata-node-title=\u003C\u003CcurrentTiddler>>\\n>\\n\\t\u003Cdiv class=\\\"tc-droppable-placeholder\\\"/>\\n\\t\u003Cdiv class={{{ stream-row [\u003Crow-children-visibility-state>get[text]match[hide]then[stream-row-children-collapsed]] +[join[ ]]}}}\\n\\t\\tdata-node-title=\u003C\u003CcurrentTiddler>>\\n\\t\\tdata-node-tags={{!!tags}}\\n\\t>\\n\\t\\t\u003C$draggable\\n\\t\\t\\ttag=\\\"div\\\"\\n\\t\\t\\ttiddler=\u003C\u003CcurrentTiddler>>\\n\\t\\t\\tstartactions=\u003C\u003Cnode-drag-start-actions>>\\n\\t\\t\\tendactions=\u003C\u003Cnode-drag-end-actions>>\\n\\t\\t\\tclass=\\\"stream-node-control sq-contextmenu-container\\\"\\n\\t\\t\\tdata-node-title=\u003C\u003CcurrentTiddler>>\\n\\t\\t>\\n\\t\\t\\t\u003Cbutton type=\\\"button\\\" class=\\\"tc-btn-invisible stream-node-ctrl-btn stream-node-collapser\\\" data-btn-role=\\\"stream-node-visibility\\\" data-rowchildren-visibility-state=\u003C\u003Crow-children-visibility-state>>>\\n\\t\\t\\t\\t{{$:/plugins/sq/streams/icons/node-expand-arrow}}\\n\\t\\t\\t\u003C/button>\\n\\t\\t\\t\u003Cdiv class=\\\"stream-node-handle tc-btn-invisible stream-node-ctrl-btn\\\" data-btn-role=\\\"stream-node-decorator\\\" data-node-title=\u003C\u003CcurrentTiddler>>>\\n\\t\\t\\t\\t\\t\u003Cdiv class=\\\"stream-node-handle-inner\\\"/>\\n\\t\\t\\t\u003C/div>\\n\\t\\t\u003C/$draggable>\\n\\t\\t\u003Cdiv class=\\\"stream-node-block\\\">\\n\\t\\t\\t\u003C$list filter=\\\"[\u003Crow-edit-state>get[text]!is[blank]else[]match\u003CcurrentTiddler>]\\\" variable=\\\"NULL\\\" emptyMessage=\\\"\\\"\\\"{{||$:/plugins/sq/streams/templates/stream-row-body}}\\\"\\\"\\\">\\n\\t\\t\\t\\t\u003C$keyboard-plus shortcutTag=\\\"$:/tags/streams/keyboard-shortcuts\\\">\\n\\t\\t\\t\\t\\t{{||$:/plugins/sq/streams/editor-template}}\\n\\t\\t\\t\\t\u003C/$keyboard-plus>\\t\\t\\t\\n\\t\\t\\t\u003C/$list>\\n {{||$:/plugins/kebi/tiddlystudy-references/filters-node}}\\n\\t\\t\u003C/div>\\n\\t\u003C/div>\\n\u003C/$droppable>\\n\u003C$reveal\\n\\ttag=\\\"div\\\"\\n\\ttype=\\\"nomatch\\\"\\n\\tstateTitle=\u003C\u003Crow-children-visibility-state>>\\n\\ttext=\\\"hide\\\"\\n\\tclass=\\\"stream-row-children\\\"\\n>\\n\\t\\t{{||$:/plugins/sq/streams/templates/stream-root-template}}\\n\u003C/$reveal>\\n\u003C/$qualify>\",\n \"title\": \"$:/plugins/sq/streams/templates/stream-row-template\",\n \"modified\": \"20210817082438049\",\n \"tags\": \"tiddlystudy\"\n }\n }\n}","version":"1.0.1","type":"application/json","title":"$:/plugins/kebi/streams-tweaks","tags":"","plugin-type":"plugin","plugin-priority":"2","name":"Tweaks for streams (tiddlystudy)","modified":"20210503195247470","created":"20210503174832801"},
|
||
|
{"text":"{\n \"tiddlers\": {\n \"$:/plugins/sq/streams/CHANGELOG\": {\n \"title\": \"$:/plugins/sq/streams/CHANGELOG\",\n \"text\": \"Release notes for the current release:\\n\\n{{$:/plugins/sq/streams/releasenotes}}\\n\\n[[Full changelog|https://saqimtiaz.github.io/streams/#CHANGELOG]] for Streams\\n\"\n },\n \"$:/plugins/sq/streams/Settings/config\": {\n \"title\": \"$:/plugins/sq/streams/Settings/config\",\n \"caption\": \"Configuration\",\n \"text\": \"\\\\define sortBySettingsGroupFilter()\\n[get[settings-group]!is[blank]else[!general]] [get[settings-group-header]!is[blank]else[99]] +[join[]]\\n\\\\end\\n\\n\u003C$edit-text tiddler=\\\"$:/state/sq/streams/settings/search\\\" class=\\\"sq-search-input\\\" default=\\\"\\\" tag=\\\"input\\\" type=\\\"search\\\" placeholder=\\\"search...\\\"/>\\n\\n\u003Cdiv class=\\\"sq-list-group sq-list-group-box-shadow sq-list-stream-settings\\\">\\n\u003C$list filter=\\\"[all[shadows+tiddlers]prefix[$:/config/sq/streams]has[settings-template]] +[search:title,caption,description{$:/state/sq/streams/settings/search}] +[sortsub\u003CsortBySettingsGroupFilter>]\\\">\\n\u003C$list filter={{{[{!!condition}!is[blank]] :else[{!!title}]}}} variable=\\\"list-condition\\\">\\n\u003Cdiv class=\\\"sq-list-group-item\\\">\\n\u003C$transclude tiddler={{!!settings-template}}/>\\n\u003C/div>\\n\u003C/$list>\\n\u003C/$list>\\n\u003C/div>\"\n },\n \"$:/plugins/sq/streams/Settings/shortcuts\": {\n \"title\": \"$:/plugins/sq/streams/Settings/shortcuts\",\n \"caption\": \"Shortcuts\",\n \"text\": \"\\\\import $:/core/ui/ControlPanel/KeyboardShortcuts\\n\\n\u003Ctable>\\n\u003Ctbody>\\n\u003C$list filter=\\\"[all[shadows+tiddlers]prefix[$:/config/ShortcutInfo/streams-]removeprefix[$:/config/ShortcutInfo/]]\\\" variable=\\\"shortcutName\\\">\\n\u003C\u003Cshortcut-item>>\\n\u003C/$list>\\n\u003C/tbody>\\n\u003C/table>\"\n },\n \"$:/plugins/sq/streams/Settings\": {\n \"title\": \"$:/plugins/sq/streams/Settings\",\n \"tags\": \"$:/tags/ControlPanel\",\n \"caption\": \"Streams settings\",\n \"text\": \"\u003C\u003Ctabs \\\"$:/plugins/sq/streams/Settings/config $:/plugins/sq/streams/Settings/shortcuts\\\" \\\"$:/plugins/sq/streams/Settings/config\\\" \\\"$:/state/streams/settings/tabs\\\">>\\n\"\n },\n \"$:/plugins/sq/streams/action-macros\": {\n \"title\": \"$:/plugins/sq/streams/action-macros\",\n \"text\": \"\\\\whitespace trim\\n\\n\\\\define swiped-right-actions()\\n\u003C$list filter=\\\"[{$:/config/sq/streams/swipe-behaviour}match[contextmenu]]\\\" variable=\\\"_NULL\\\">\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"current\\\" $value=\u003C\u003Cdom-data-node-title>>/>\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"position\\\" $value={{$:/config/sq/streams/swipe-contextmenu-position}}/>\\n\u003C$action-popup $coords=\u003C\u003Ctv-popup-coords>> $state=\u003C\u003Ccontextmenu-state>>/>\\n\u003C/$list>\\n\u003C$list filter=\\\"[{$:/config/sq/streams/swipe-behaviour}match[indent]]\\\" variable=\\\"_NULL\\\">\\n\u003C$vars currentTiddler=\u003C\u003Cdom-data-node-title>>>\\n\u003C\u003Cindent-node-actions>>\\n\u003C/$vars>\\n\u003C/$list>\\n\\\\end\\n\\n\\\\define swiped-left-actions()\\n\u003C$list filter=\\\"[{$:/config/sq/streams/swipe-behaviour}match[indent]]\\\" variable=\\\"_NULL\\\">\\n\u003C$vars currentTiddler=\u003C\u003Cdom-data-node-title>>>\\n\u003C\u003Cunindent-node-actions>>\\n\u003C/$vars>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define oncontext-menu-actions()\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"current\\\" $value=\u003C\u003Cdom-data-node-title>>/>\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"position\\\" $value=\\\"left\\\"/>\\n\u003C$action-popup $coords=\u003C\u003Ctv-popup-coords>> $state=\u003C\u003Ccontextmenu-state>>/>\\n\\\\end\\
|
||
|
{"created":"20230713172438556","title":"$:/SiteSubtitle","text":"","modified":"20230713172438556"},
|
||
|
{"created":"20230712231354873","title":"$:/SiteTitle","text":"copincha","modified":"20230718174954899"},
|
||
|
{"created":"20230719021257869","title":"$:/state/advancedsearch/currentTab","text":"$:/core/ui/AdvancedSearch/Filter","modified":"20230719021257869"},
|
||
|
{"created":"20230718173759529","text":"yes","title":"$:/state/Excise/-655986432/tagnew","modified":"20230718173759529"},
|
||
|
{"title":"$:/state/http-requests","text":"0"},
|
||
|
{"created":"20230713190630253","title":"$:/state/plugin-info--1296358760-$:/plugins/tiddlywiki/markdown--1185065935","text":"syntax","modified":"20230713190636525"},
|
||
|
{"created":"20230713190704078","title":"$:/state/plugin-info--1642337318-$:/plugins/anstosa/tw5-markdown--1963990281","text":"usage","modified":"20230713190704078"},
|
||
|
{"created":"20230713190304724","title":"$:/state/plugin-info-1867135918-$:/plugins/anstosa/tw5-markdown","text":"no","modified":"20230713190326060"},
|
||
|
{"created":"20230713190309048","title":"$:/state/plugin-info-1867135918-$:/plugins/anstosa/tw5-markdown--734846815","text":"readme","modified":"20230713190319392"},
|
||
|
{"created":"20230713190333636","title":"$:/state/plugin-info-1867135918-$:/plugins/flibbles/relink-markdown","text":"no","modified":"20230719013730652"},
|
||
|
{"created":"20230713190218141","title":"$:/state/plugin-info-1867135918-$:/plugins/tiddlywiki/markdown","text":"no","modified":"20230713190403212"},
|
||
|
{"created":"20230713190229565","title":"$:/state/plugin-info-1867135918-$:/plugins/tiddlywiki/markdown---1654385705","text":"config","modified":"20230713190251120"},
|
||
|
{"created":"20230713190105808","title":"$:/state/showeditpreview","text":"yes","modified":"20230713190105808"},
|
||
|
{"created":"20230718201427207","title":"$:/state/ShowPaletteEditor","text":"yes","modified":"20230718201427207"},
|
||
|
{"created":"20230719021449971","title":"$:/state/sq/streams/current-edit-tiddler-1908010776","text":"inicio/20230719021449960","modified":"20230719021449971"},
|
||
|
{"created":"20230719021257870","title":"$:/state/tab--1498284803","text":"$:/core/ui/AdvancedSearch/Filter","modified":"20230719021257870"},
|
||
|
{"created":"20230713193327482","title":"$:/state/tab--1963855381","text":"$:/core/ui/ControlPanel/Toolbars","modified":"20230806162027391"},
|
||
|
{"created":"20230713185744107","title":"$:/state/tab-1749438307","text":"$:/core/ui/ControlPanel/Appearance","modified":"20230806162022339"},
|
||
|
{"created":"20230713185223796","title":"$:/state/tab/sidebar--595412856","text":"$:/core/ui/SideBar/Recent","modified":"20230713185223796"},
|
||
|
{"created":"20230713193334802","title":"$:/state/tabs/controlpanel/toolbars-1345989671","text":"$:/core/ui/ControlPanel/Toolbars/PageControls","modified":"20230713193334802"},
|
||
|
{"title":"$:/status/RequireReloadDueToPluginChange","text":"no"},
|
||
|
{"title":"$:/StoryList","created":"20230807232659887","text":"","list":"[[3d extrude]] copincha inicio","modified":"20230807232659887"},
|
||
|
{"created":"20230719012410221","title":"$:/theme","text":"$:/themes/tiddlywiki/vanilla","modified":"20230719012411469"},
|
||
|
{"title":"$:/themes/tiddlywiki/snowwhite","name":"Snow White","author":"JeremyRuston","core-version":">=5.0.0","plugin-type":"theme","description":"Emphasises individual tiddlers","dependents":"$:/themes/tiddlywiki/vanilla","plugin-priority":"0","version":"5.3.0","type":"application/json","text":"{\"tiddlers\":{\"$:/themes/tiddlywiki/snowwhite/base\":{\"title\":\"$:/themes/tiddlywiki/snowwhite/base\",\"tags\":\"[[$:/tags/Stylesheet]]\",\"text\":\"\\\\define sidebarbreakpoint-minus-one()\\n\u003C$text text={{{ [{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}removesuffix[px]subtract[1]addsuffix[px]] ~[{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}] }}}/>\\n\\\\end\\n\\n\\\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\\n\\n.tc-sidebar-header {\\n\\ttext-shadow: 0 1px 0 \u003C\u003Ccolour sidebar-foreground-shadow>>;\\n}\\n\\n.tc-tiddler-info {\\n\\t\u003C\u003Cbox-shadow \\\"inset 1px 2px 3px rgba(0,0,0,0.1)\\\">>\\n}\\n\\n@media screen {\\n\\t.tc-tiddler-frame {\\n\\t\\t\u003C\u003Cbox-shadow \\\"1px 1px 5px rgba(0, 0, 0, 0.3)\\\">>\\n\\t}\\n}\\n\\n@media (max-width: \u003C\u003Csidebarbreakpoint-minus-one>>) {\\n\\t.tc-tiddler-frame {\\n\\t\\t\u003C\u003Cbox-shadow none>>\\n\\t}\\n}\\n\\n.tc-page-controls button svg, .tc-tiddler-controls button svg, .tc-topbar button svg {\\n\\t\u003C\u003Ctransition \\\"fill 150ms ease-in-out\\\">>\\n}\\n\\n.tc-tiddler-controls button.tc-selected,\\n.tc-page-controls button.tc-selected {\\n\\t\u003C\u003Cfilter \\\"drop-shadow(0px -1px 2px rgba(0,0,0,0.25))\\\">>\\n}\\n\\n.tc-tiddler-frame input.tc-edit-texteditor,\\n.tc-tiddler-frame select.tc-edit-texteditor {\\n\\t\u003C\u003Cbox-shadow \\\"inset 0 1px 8px rgba(0, 0, 0, 0.15)\\\">>\\n}\\n\\n.tc-edit-tags {\\n\\t\u003C\u003Cbox-shadow \\\"inset 0 1px 8px rgba(0, 0, 0, 0.15)\\\">>\\n}\\n\\n.tc-tiddler-frame .tc-edit-tags input.tc-edit-texteditor {\\n\\t\u003C\u003Cbox-shadow \\\"none\\\">>\\n\\tborder: none;\\n\\toutline: none;\\n}\\n\\ntextarea.tc-edit-texteditor {\\n\\tfont-family: {{$:/themes/tiddlywiki/vanilla/settings/editorfontfamily}};\\n}\\n\\ncanvas.tc-edit-bitmapeditor {\\n\\t\u003C\u003Cbox-shadow \\\"2px 2px 5px rgba(0, 0, 0, 0.5)\\\">>\\n}\\n\\n.tc-drop-down {\\n\\tborder-radius: 4px;\\n\\t\u003C\u003Cbox-shadow \\\"2px 2px 10px rgba(0, 0, 0, 0.5)\\\">>\\n}\\n\\n.tc-block-dropdown {\\n\\tborder-radius: 4px;\\n\\t\u003C\u003Cbox-shadow \\\"2px 2px 10px rgba(0, 0, 0, 0.5)\\\">>\\n}\\n\\n.tc-modal {\\n\\tborder-radius: 6px;\\n\\t\u003C\u003Cbox-shadow \\\"0 3px 7px rgba(0,0,0,0.3)\\\">>\\n}\\n\\n.tc-modal-footer {\\n\\tborder-radius: 0 0 6px 6px;\\n\\t\u003C\u003Cbox-shadow \\\"inset 0 1px 0 #fff\\\">>;\\n}\\n\\n\\n.tc-alert {\\n\\tborder-radius: 6px;\\n\\t\u003C\u003Cbox-shadow \\\"0 3px 7px rgba(0,0,0,0.6)\\\">>\\n}\\n\\n.tc-notification {\\n\\tborder-radius: 6px;\\n\\t\u003C\u003Cbox-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.tc-sidebar-lists .tc-tab-set .tc-tab-divider {\\n\\tborder-top: none;\\n\\theight: 1px;\\n\\t\u003C\u003Cbackground-linear-gradient \\\"left, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.0) 100%\\\">>\\n}\\n\\n.tc-more-sidebar > .tc-tab-set > .tc-tab-buttons > button {\\n\\t\u003C\u003Cbackground-linear-gradient \\\"left, rgba(0,0,0,0.01) 0%, rgba(0,0,0,0.1) 100%\\\">>\\n}\\n\\n.tc-more-sidebar > .tc-tab-set > .tc-tab-buttons > button.tc-tab-selected {\\n\\t\u003C\u003Cbackground-linear-gradient \\\"left, rgba(0,0,0,0.05) 0%, rgba(255,255,255,0.05) 100%\\\">>\\n}\\n\\n.tc-message-box img {\\n\\t\u003C\u003Cbox-shadow \\\"1px 1px 3px rgba(0,0,0,0.5)\\\">>\\n}\\n\\n.tc-plugin-info {\\n\\t\u003C\u003Cbox-shadow \\\"1px 1px 3px rgba(0,0,0,0.5)\\\">>\\n}\\n\"}}}"},
|
||
|
{"title":"$:/themes/tiddlywiki/vanilla","name":"Vanilla","author":"JeremyRuston","core-version":">=5.0.0","plugin-type":"theme","description":"Basic theme","plugin-priority":"0","version":"5.3.0","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/themes/tiddlywiki/vanilla/themetweaks\":{\"title\":\"$:/themes/tiddlywiki/vanilla/themetweaks\",\"tags\":\"$:/tags/ControlPanel/Appearance\",\"caption\":\"{{$:/language/ThemeTweaks/ThemeTweaks}}\",\"text\":\"\\\\define lingo-base() $:/language/ThemeTweaks/\\n\\n\\\\define replacement-text()\\n[img[$(imageTitle)$]]\\n\\\\end\\n\\n\\\\define backgroundimage-dropdown()\\n\u003Cdiv class=\\\"tc-drop-down-wrapper\\\">\\n\u003C$set name=\\\"state\\\" value=\u003C\u003Cqualify \\\"$:/state/popup/themetweaks/backgroundimage\\\">>>\\n\u003C$button popup=\u003C\u003Cstate>> class=\\\"tc-btn-invisible tc-btn-dropdown\\\">{{$:/core/images/down-arrow}}\u003C/$button>\\n\u003C$reveal state=\u003C\u003Cstate>> type=\\\"popup\\\" position=\\\"belowleft\\\" text=\\\"\\\" default=\\\"\\\" class=\\\"tc-popup-keep\\\">\\n\u003Cdiv class=\\\"tc-drop-down\\\" style=\\\"text-align:center;\\\">\\n\u003C$macrocall $name=\\\"image-picker\\\" actions=\\\"\\\"\\\"\\n\\n\u003C$action-setfield\\n\\t$tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/backgroundimage\\\"\\n\\t$value=\u003C\u003CimageTitle>>\\n/>\\n\\n\u003C$action-deletetiddler $tiddler=\u003C\u003Cstate>>/>\\n\\n\\\"\\\"\\\"/>\\n\u003C/div>\\n\u003C/$reveal>\\n\u003C/$set>\\n\u003C/div>\\n\\\\end\\n\\n\\\\define backgroundimageattachment-dropdown()\\n\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment\\\" default=\\\"scroll\\\">\\n\u003Coption value=\\\"scroll\\\">\u003C\u003Clingo Settings/BackgroundImageAttachment/Scroll>>\u003C/option>\\n\u003Coption value=\\\"fixed\\\">\u003C\u003Clingo Settings/BackgroundImageAttachment/Fixed>>\u003C/option>\\n\u003C/$select>\\n\\\\end\\n\\n\\\\define backgroundimagesize-dropdown()\\n\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/backgroundimagesize\\\" default=\\\"scroll\\\">\\n\u003Coption value=\\\"auto\\\">\u003C\u003Clingo Settings/BackgroundImageSize/Auto>>\u003C/option>\\n\u003Coption value=\\\"cover\\\">\u003C\u003Clingo Settings/BackgroundImageSize/Cover>>\u003C/option>\\n\u003Coption value=\\\"contain\\\">\u003C\u003Clingo Settings/BackgroundImageSize/Contain>>\u003C/option>\\n\u003C/$select>\\n\\\\end\\n\\n\u003C\u003Clingo ThemeTweaks/Hint>>\\n\\n! \u003C\u003Clingo Options>>\\n\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\\\">\u003C\u003Clingo Options/SidebarLayout>>\u003C/$link> |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\\\">\u003Coption value=\\\"fixed-fluid\\\">\u003C\u003Clingo Options/SidebarLayout/Fixed-Fluid>>\u003C/option>\u003Coption value=\\\"fluid-fixed\\\">\u003C\u003Clingo Options/SidebarLayout/Fluid-Fixed>>\u003C/option>\u003C/$select> |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/stickytitles\\\">\u003C\u003Clingo Options/StickyTitles>>\u003C/$link>\u003Cbr>//\u003C\u003Clingo Options/StickyTitles/Hint>>// |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/stickytitles\\\">\u003Coption value=\\\"no\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"yes\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/options/codewrapping\\\">\u003C\u003Clingo Options/CodeWrapping>>\u003C/$link> |\u003C$select tiddler=\\\"$:/themes/tiddlywiki/vanilla/options/codewrapping\\\">\u003Coption value=\\\"pre\\\">{{$:/language/No}}\u003C/option>\u003Coption value=\\\"pre-wrap\\\">{{$:/language/Yes}}\u003C/option>\u003C/$select> |\\n\\n! \u003C\u003Clingo Settings>>\\n\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/settings/fontfamily\\\">\u003C\u003Clingo Settings/FontFamily>>\u003C/$link> |\u003C$edit-text tiddler=\\\"$:/themes/tiddlywiki/vanilla/settings/fontfamily\\\" default=\\\"\\\" tag=\\\"input\\\"/> | |\\n|\u003C$link to=\\\"$:/themes/tiddlywiki/vanilla/settings/co
|
||
|
{"created":"20230808005253698","text":"","type":"text/x-markdown","title":"3d extrude","tags":"","modified":"20230808005449985"},
|
||
|
{"created":"20230806162134663","text":"","type":"text/x-markdown","title":"copincha","tags":"","modified":"20230807232806504","stream-list":"copincha/20230806162152675 copincha/20230806162821869 copincha/20230806162747458 copincha/20230806162213965","stream-type":"default"},
|
||
|
{"created":"20230806162152681","text":"nyc-resistor","parent":"copincha","stream-type":"default","stream-list":"","modified":"20230806162834678","title":"copincha/20230806162152675"},
|
||
|
{"created":"20230806162157307","parent":"copincha/20230806162821869","stream-type":"default","modified":"20230807232729603","title":"copincha/20230806162157300","text":"wiki","stream-list":"copincha/20230807232728484"},
|
||
|
{"created":"20230806162201922","parent":"copincha/20230806162821869","stream-type":"default","modified":"20230807233839642","title":"copincha/20230806162201918","text":"impresion 3d","stream-list":"copincha/20230807232758672 copincha/20230807233821579 copincha/20230807233827042"},
|
||
|
{"created":"20230806162206198","parent":"copincha/20230806162747458","stream-type":"default","modified":"20230806162810481","title":"copincha/20230806162206195","text":"cnc-laser","stream-list":"copincha/20230806162456844"},
|
||
|
{"created":"20230806162213969","parent":"copincha","stream-type":"default","modified":"20230808004941905","title":"copincha/20230806162213965","text":"temas","stream-list":"copincha/20230808004815029 copincha/20230808004845126 copincha/20230808004846442 copincha/20230808004847415 copincha/20230808004849018 copincha/20230808004850102 copincha/20230808004851226 copincha/20230808004852330"},
|
||
|
{"created":"20230806162338737","parent":"copincha/20230806163034308","stream-type":"default","modified":"20230806163359422","title":"copincha/20230806162338735","text":"recreate","stream-list":"copincha/20230806163242772 copincha/20230806163305019 copincha/20230806163327353 copincha/20230806163333206 copincha/20230806163335443"},
|
||
|
{"created":"20230806162401168","parent":"copincha/20230806163000301","stream-type":"default","modified":"20230808005539422","title":"copincha/20230806162401166","text":"aprovechar material en nyc-resistor","stream-list":"copincha/20230806163105663 copincha/20230808005528418"},
|
||
|
{"created":"20230806162456847","parent":"copincha/20230806162206195","stream-type":"default","modified":"20230806162651166","title":"copincha/20230806162456844","text":"moldes para circular-economy (island)","stream-list":"copincha/20230806162515425 copincha/20230806162550703"},
|
||
|
{"created":"20230806162515428","parent":"copincha/20230806162456844","stream-type":"default","modified":"20230806162651145","title":"copincha/20230806162515425","text":"probar moldes de acrilico para retational moldiing"},
|
||
|
{"created":"20230806162550707","parent":"copincha/20230806162456844","stream-type":"default","modified":"20230806162651158","title":"copincha/20230806162550703","text":"maquina de rotomoldeo"},
|
||
|
{"created":"20230806162722325","text":"3d-filament--extruder","parent":"copincha/20230806162747458","stream-type":"default","stream-list":"","modified":"20230806163042354","title":"copincha/20230806162722322"},
|
||
|
{"created":"20230806162747463","parent":"copincha","stream-type":"default","modified":"20230806163015171","title":"copincha/20230806162747458","text":"projects","stream-list":"copincha/20230806162722322 copincha/20230806163000301 copincha/20230806162206195"},
|
||
|
{"created":"20230806162821873","parent":"copincha","stream-type":"default","modified":"20230807232759842","title":"copincha/20230806162821869","text":"info","stream-list":"copincha/20230806162157300 copincha/20230806162201918"},
|
||
|
{"created":"20230806163000306","parent":"copincha/20230806162747458","stream-type":"default","modified":"20230806163107170","title":"copincha/20230806163000301","text":"objetivos:","stream-list":"copincha/20230806162401166 copincha/20230806163034308"},
|
||
|
{"created":"20230806163034314","parent":"copincha/20230806163000301","stream-type":"default","modified":"20230806163243780","title":"copincha/20230806163034308","text":"desarrollo","stream-list":"copincha/20230806162338735 copincha/20230806163135383"},
|
||
|
{"created":"20230806163105673","text":"material de impresoras 3d","parent":"copincha/20230806162401166","stream-type":"default","stream-list":"","modified":"20230806163117038","title":"copincha/20230806163105663"},
|
||
|
{"created":"20230806163135386","parent":"copincha/20230806163034308","stream-type":"default","modified":"20230806163212592","title":"copincha/20230806163135383","text":"productos para crear sinergias","stream-list":"copincha/20230806163143151"},
|
||
|
{"created":"20230806163143155","parent":"copincha/20230806163135383","stream-type":"default","modified":"20230806163153098","title":"copincha/20230806163143151","text":"phone-holder"},
|
||
|
{"created":"20230806163242776","parent":"copincha/20230806162338735","stream-type":"default","modified":"20230806163310988","title":"copincha/20230806163242772","text":"web:","stream-list":"copincha/20230806163259059"},
|
||
|
{"created":"20230806163259069","parent":"copincha/20230806163242772","stream-type":"default","modified":"20230806163304479","title":"copincha/20230806163259059","text":"http://"},
|
||
|
{"created":"20230806163305022","parent":"copincha/20230806162338735","stream-type":"default","modified":"20230806163329367","title":"copincha/20230806163305019","text":"videos:","stream-list":"copincha/20230806163318843 copincha/20230806163323858"},
|
||
|
{"created":"20230806163318846","parent":"copincha/20230806163305019","stream-type":"default","modified":"20230806163323166","title":"copincha/20230806163318843","text":"mk5"},
|
||
|
{"created":"20230806163323860","parent":"copincha/20230806163305019","stream-type":"default","modified":"20230806163326761","title":"copincha/20230806163323858","text":"cutter"},
|
||
|
{"created":"20230806163327356","parent":"copincha/20230806162338735","stream-type":"default","modified":"20230806163332936","title":"copincha/20230806163327353","text":"lista de partes"},
|
||
|
{"created":"20230806163333210","parent":"copincha/20230806162338735","stream-type":"default","modified":"20230806163335232","title":"copincha/20230806163333206","text":"notas"},
|
||
|
{"created":"20230806163335445","parent":"copincha/20230806162338735","stream-type":"default","modified":"20230806163357904","title":"copincha/20230806163335443","text":"descargar proyecto"},
|
||
|
{"created":"20230807232728489","parent":"copincha/20230806162157300","stream-type":"default","modified":"20230807232729604","title":"copincha/20230807232728484"},
|
||
|
{"created":"20230807232758678","parent":"copincha/20230806162201918","stream-type":"default","modified":"20230807233813739","title":"copincha/20230807232758672","text":"para imprimir ","stream-list":"copincha/20230807233756176 copincha/20230807233813733"},
|
||
|
{"created":"20230807233756180","parent":"copincha/20230807232758672","stream-type":"default","modified":"20230807233813386","title":"copincha/20230807233756176","text":"los archivos de configuracion puedes encontrarlos aqui"},
|
||
|
{"created":"20230807233813738","parent":"copincha/20230807232758672","stream-type":"default","modified":"20230807233813738","title":"copincha/20230807233813733"},
|
||
|
{"created":"20230807233821582","parent":"copincha/20230806162201918","stream-type":"default","modified":"20230807233839641","title":"copincha/20230807233821579","text":"nozzle","stream-list":"copincha/20230807233838620"},
|
||
|
{"created":"20230807233827045","parent":"copincha/20230806162201918","stream-type":"default","modified":"20230807233827045","title":"copincha/20230807233827042"},
|
||
|
{"created":"20230807233838623","text":".06","parent":"copincha/20230807233821579","stream-type":"default","stream-list":"","modified":"20230807233839642","title":"copincha/20230807233838620"},
|
||
|
{"created":"20230808004815034","text":"descentralized-networks--dweb-nyc","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004905047","title":"copincha/20230808004815029"},
|
||
|
{"created":"20230808004845131","text":"descentralized-networks--hotspot","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004907042","title":"copincha/20230808004845126"},
|
||
|
{"created":"20230808004846445","text":"descentralized-networks--mesh--nyc-mesh","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004908669","title":"copincha/20230808004846442"},
|
||
|
{"created":"20230808004847417","text":"descentralized-networks--rpi-server","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004910549","title":"copincha/20230808004847415"},
|
||
|
{"created":"20230808004849019","text":"plastic-recycling--injection--molds","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004912707","title":"copincha/20230808004849018"},
|
||
|
{"created":"20230808004850103","text":"documentation--wiki","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"copincha/20230808004941223 copincha/20230808004944251 copincha/20230808004948913","modified":"20230808004958525","title":"copincha/20230808004850102"},
|
||
|
{"created":"20230808004851227","text":"nyresistor--hackerspace.md","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004916887","title":"copincha/20230808004851226"},
|
||
|
{"created":"20230808004852333","text":"nyresistor--extruder.md","parent":"copincha/20230806162213965","stream-type":"default","stream-list":"","modified":"20230808004919056","title":"copincha/20230808004852330"},
|
||
|
{"created":"20230808004941226","parent":"copincha/20230808004850102","stream-type":"default","modified":"20230808004943072","title":"copincha/20230808004941223","text":"nycr-wiki"},
|
||
|
{"created":"20230808004944253","parent":"copincha/20230808004850102","stream-type":"default","modified":"20230808004948413","title":"copincha/20230808004944251","text":"tiddlywiki"},
|
||
|
{"created":"20230808004948916","parent":"copincha/20230808004850102","stream-type":"default","modified":"20230808004957732","title":"copincha/20230808004948913","text":"docs.copincha.org"},
|
||
|
{"created":"20230808005507627","parent":"copincha/20230808005528418","stream-type":"default","modified":"20230808005552341","title":"copincha/20230808005507623","text":"imprimir base de cortador","stream-list":"copincha/20230808005542446"},
|
||
|
{"created":"20230808005528423","parent":"copincha/20230806162401166","stream-type":"default","modified":"20230808005543563","title":"copincha/20230808005528418","text":"cortador de botellas","stream-list":"copincha/20230808005507623"},
|
||
|
{"created":"20230808005542451","parent":"copincha/20230808005507623","stream-type":"default","modified":"20230808005549853","title":"copincha/20230808005542446","text":"parametros de impresion"}
|
||
|
]</script><div id="storeArea" style="display:none;"></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}}};
|
||
|
sjcl.cipher.aes=function(a){this.s[0][0][0]||this.O();var b,c,d,e,f=this.s[0][4],g=this.s[1];b=a.length;var h=1;if(4!==b&&6!==b&&8!==b)throw new sjcl.exception.invalid("invalid aes key size");this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?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 t(this,a,0)},decrypt:function(a){return t(this,a,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){var a=this.s[0],b=this.s[1],c=a[4],d=b[4],e,f,g,h=[],k=[],l,n,m,p;for(e=0;0x100>e;e++)k[(h[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=l||1,g=k[g]||1)for(m=g^g<<1^g<<2^g<<3^g<<4,m=m>>8^m&255^99,c[f]=m,d[m]=f,n=h[e=h[l=h[f]]],p=0x1010101*n^0x10001*e^0x101*l^0x1010100*f,n=0x101*h[m]^0x1010100*m,e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][m]=p=p<<24^p>>>8;for(e=
|
||
|
0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};
|
||
|
function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes block size");var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,k,l,n=d.length/4-2,m,p=4,r=[0,0,0,0];h=a.s[c];a=h[0];var q=h[1],v=h[2],w=h[3],x=h[4];for(m=0;m<n;m++)h=a[e>>>24]^q[f>>16&255]^v[g>>8&255]^w[b&255]^d[p],k=a[f>>>24]^q[g>>16&255]^v[b>>8&255]^w[e&255]^d[p+1],l=a[g>>>24]^q[b>>16&255]^v[e>>8&255]^w[f&255]^d[p+2],b=a[b>>>24]^q[e>>16&255]^v[f>>8&255]^w[g&255]^d[p+3],p+=4,e=h,f=k,g=l;for(m=
|
||
|
0;4>m;m++)r[c?3&-m:m]=x[e>>>24]<<24^x[f>>16&255]<<16^x[g>>8&255]<<8^x[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h;return r}
|
||
|
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.$(a.slice(b/32),32-(b&31)).slice(1);return void 0===c?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(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.$(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===
|
||
|
b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b=b&31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return!1;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===
|
||
|
c},$:function(a,b,c,d){var e;e=0;for(void 0===d&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)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,32<b+a?c:d.pop(),1));return d},i:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};
|
||
|
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>8>>>8>>>8),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),3===(c&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=a+"00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};
|
||
|
sjcl.codec.base32={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",X:"0123456789ABCDEFGHIJKLMNOPQRSTUV",BITS:32,BASE:5,REMAINING:27,fromBits:function(a,b,c){var d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f="",g=0,h=sjcl.codec.base32.B,k=0,l=sjcl.bitArray.bitLength(a);c&&(h=sjcl.codec.base32.X);for(c=0;f.length*d<l;)f+=h.charAt((k^a[c]>>>g)>>>e),g<d?(k=a[c]<<d-g,g+=e,c++):(k<<=d,g-=d);for(;f.length&7&&!b;)f+="=";return f},toBits:function(a,b){a=a.replace(/\s|=/g,"").toUpperCase();var c=sjcl.codec.base32.BITS,
|
||
|
d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f=[],g,h=0,k=sjcl.codec.base32.B,l=0,n,m="base32";b&&(k=sjcl.codec.base32.X,m="base32hex");for(g=0;g<a.length;g++){n=k.indexOf(a.charAt(g));if(0>n){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}throw new sjcl.exception.invalid("this isn't "+m+"!");}h>e?(h-=e,f.push(l^n>>>h),l=n<<c-h):(h+=d,l^=n<<c-h)}h&56&&f.push(sjcl.bitArray.partial(h&56,l,1));return f}};
|
||
|
sjcl.codec.base32hex={fromBits:function(a,b){return sjcl.codec.base32.fromBits(a,b,1)},toBits:function(a){return sjcl.codec.base32.toBits(a,1)}};
|
||
|
sjcl.codec.base64={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=sjcl.codec.base64.B,g=0,h=sjcl.bitArray.bitLength(a);c&&(f=f.substr(0,62)+"-_");for(c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d,e=0,f=sjcl.codec.base64.B,g=0,h;b&&(f=f.substr(0,62)+"-_");for(d=0;d<a.length;d++){h=f.indexOf(a.charAt(d));
|
||
|
if(0>h)throw new sjcl.exception.invalid("this isn't base64!");26<e?(e-=26,c.push(g^h>>>e),g=h<<32-e):(e+=6,g^=h<<32-e)}e&56&&c.push(sjcl.bitArray.partial(e&56,g,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.b[0]||this.O();a?(this.F=a.F.slice(0),this.A=a.A.slice(0),this.l=a.l):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.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(a){"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.A=sjcl.bitArray.concat(this.A,a);b=this.l;a=this.l=b+sjcl.bitArray.bitLength(a);if(0x1fffffffffffff<a)throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!==typeof Uint32Array){var d=new Uint32Array(c),e=0;for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,d.subarray(16*e,
|
||
|
16*(e+1))),e+=1;c.splice(0,16*e)}else for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,c.splice(0,16));return this},finalize:function(){var a,b=this.A,c=this.F,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.l/0x100000000));for(b.push(this.l|0);b.length;)u(this,b.splice(0,16));this.reset();return c},Y:[],b:[],O:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}for(var b=0,c=2,d,e;64>b;c++){e=!0;for(d=2;d*d<=c;d++)if(0===c%d){e=
|
||
|
!1;break}e&&(8>b&&(this.Y[b]=a(Math.pow(c,.5))),this.b[b]=a(Math.pow(c,1/3)),b++)}}};
|
||
|
function u(a,b){var c,d,e,f=a.F,g=a.b,h=f[0],k=f[1],l=f[2],n=f[3],m=f[4],p=f[5],r=f[6],q=f[7];for(c=0;64>c;c++)16>c?d=b[c]:(d=b[c+1&15],e=b[c+14&15],d=b[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+b[c&15]+b[c+9&15]|0),d=d+q+(m>>>6^m>>>11^m>>>25^m<<26^m<<21^m<<7)+(r^m&(p^r))+g[c],q=r,r=p,p=m,m=n+d|0,n=l,l=k,k=h,h=d+(k&l^n&(k^l))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;f[0]=f[0]+h|0;f[1]=f[1]+k|0;f[2]=f[2]+l|0;f[3]=f[3]+n|0;f[4]=f[4]+m|0;f[5]=f[5]+p|0;f[6]=f[6]+r|0;f[7]=
|
||
|
f[7]+q|0}
|
||
|
sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(a){sjcl.mode.ccm.G.push(a)},unListenProgress:function(a){a=sjcl.mode.ccm.G.indexOf(a);-1<a&&sjcl.mode.ccm.G.splice(a,1)},fa:function(a){var b=sjcl.mode.ccm.G.slice(),c;for(c=0;c<b.length;c+=1)b[c](a)},encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,k=h.bitLength(c)/8,l=h.bitLength(g)/8;e=e||64;d=d||[];if(7>k)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;4>f&&l>>>8*f;f++);f<15-k&&(f=15-k);c=h.clamp(c,
|
||
|
8*(15-f));b=sjcl.mode.ccm.V(a,b,c,d,e,f);g=sjcl.mode.ccm.C(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),k=f.clamp(b,h-e),l=f.bitSlice(b,h-e),h=(h-e)/8;if(7>g)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;4>b&&h>>>8*b;b++);b<15-g&&(b=15-g);c=f.clamp(c,8*(15-b));k=sjcl.mode.ccm.C(a,k,c,l,e,b);a=sjcl.mode.ccm.V(a,k.data,c,d,e,b);if(!f.equal(k.tag,a))throw new sjcl.exception.corrupt("ccm: tag doesn't match");
|
||
|
return k.data},na:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,k=h.i;d=[h.partial(8,(b.length?64:0)|d-2<<2|f-1)];d=h.concat(d,c);d[3]|=e;d=a.encrypt(d);if(b.length)for(c=h.bitLength(b)/8,65279>=c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0;b<g.length;b+=4)d=a.encrypt(k(d,g.slice(b,b+4).concat([0,0,0])));return d},V:function(a,b,c,d,e,f){var g=sjcl.bitArray,h=g.i;e/=8;if(e%2||4>e||16<e)throw new sjcl.exception.invalid("ccm: invalid tag length");
|
||
|
if(0xffffffff<d.length||0xffffffff<b.length)throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data");c=sjcl.mode.ccm.na(a,d,c,e,g.bitLength(b)/8,f);for(d=0;d<b.length;d+=4)c=a.encrypt(h(c,b.slice(d,d+4).concat([0,0,0])));return g.clamp(c,8*e)},C:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.i;var k=b.length,l=h.bitLength(b),n=k/50,m=n;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(!k)return{tag:d,data:[]};for(g=0;g<k;g+=4)g>n&&(sjcl.mode.ccm.fa(g/
|
||
|
k),n+=m),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,l)}}};
|
||
|
sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.S,k=sjcl.bitArray,l=k.i,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4)m=b.slice(g,g+4),n=l(n,m),p=p.concat(l(c,a.encrypt(l(c,m)))),c=h(c);m=b.slice(g);b=k.bitLength(m);g=a.encrypt(l(c,[0,0,0,b]));m=k.clamp(l(m.concat([0,0,0]),g),b);n=l(n,l(m.concat([0,0,0]),g));n=a.encrypt(l(n,l(c,h(c))));
|
||
|
d.length&&(n=l(n,f?d:sjcl.mode.ocb2.pmac(a,d)));return p.concat(k.concat(m,k.clamp(n,e)))},decrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");e=e||64;var g=sjcl.mode.ocb2.S,h=sjcl.bitArray,k=h.i,l=[0,0,0,0],n=g(a.encrypt(c)),m,p,r=sjcl.bitArray.bitLength(b)-e,q=[];d=d||[];for(c=0;c+4<r/32;c+=4)m=k(n,a.decrypt(k(n,b.slice(c,c+4)))),l=k(l,m),q=q.concat(m),n=g(n);p=r-32*c;m=a.encrypt(k(n,[0,0,0,p]));m=k(m,h.clamp(b.slice(c),p).concat([0,
|
||
|
0,0]));l=k(l,m);l=a.encrypt(k(l,k(n,g(n))));d.length&&(l=k(l,f?d:sjcl.mode.ocb2.pmac(a,d)));if(!h.equal(h.clamp(l,e),h.bitSlice(b,r)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return q.concat(h.clamp(m,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.S,e=sjcl.bitArray,f=e.i,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))));c=b.slice(c);128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));g=f(g,c);
|
||
|
return a.encrypt(f(d(f(h,d(h))),g))},S:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}};
|
||
|
sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.C(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.C(!1,a,f,d,c,e);if(!g.equal(a.tag,b))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return a.data},ka:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.i;e=[0,0,
|
||
|
0,0];f=b.slice(0);for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f));g=0!==(f[3]&1);for(d=3;0<d;d--)f[d]=f[d]>>>1|(f[d-1]&1)<<31;f[0]>>>=1;g&&(f[0]^=-0x1f000000)}return e},j:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d<e;d+=4)b[0]^=0xffffffff&c[d],b[1]^=0xffffffff&c[d+1],b[2]^=0xffffffff&c[d+2],b[3]^=0xffffffff&c[d+3],b=sjcl.mode.gcm.ka(b,a);return b},C:function(a,b,c,d,e,f){var g,h,k,l,n,m,p,r,q=sjcl.bitArray;m=c.length;p=q.bitLength(c);r=q.bitLength(d);h=q.bitLength(e);
|
||
|
g=b.encrypt([0,0,0,0]);96===h?(e=e.slice(0),e=q.concat(e,[1])):(e=sjcl.mode.gcm.j(g,[0,0,0,0],e),e=sjcl.mode.gcm.j(g,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff]));h=sjcl.mode.gcm.j(g,[0,0,0,0],d);n=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.j(g,h,c));for(l=0;l<m;l+=4)n[3]++,k=b.encrypt(n),c[l]^=k[0],c[l+1]^=k[1],c[l+2]^=k[2],c[l+3]^=k[3];c=q.clamp(c,p);a&&(d=sjcl.mode.gcm.j(g,h,c));a=[Math.floor(r/0x100000000),r&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.j(g,d,a);k=b.encrypt(e);
|
||
|
d[0]^=k[0];d[1]^=k[1];d[2]^=k[2];d[3]^=k[3];return{tag:q.bitSlice(d,0,f),data:c}}};sjcl.misc.hmac=function(a,b){this.W=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.w=[new b,new b];a.length>e&&(a=b.hash(a));for(d=0;d<e;d++)c[0][d]=a[d]^909522486,c[1][d]=a[d]^1549556828;this.w[0].update(c[0]);this.w[1].update(c[1]);this.R=new b(this.w[0])};
|
||
|
sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){if(this.aa)throw new sjcl.exception.invalid("encrypt on already updated hmac called!");this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.R=new this.W(this.w[0]);this.aa=!1};sjcl.misc.hmac.prototype.update=function(a){this.aa=!0;this.R.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.R.finalize(),a=(new this.W(this.w[1])).update(a).finalize();this.reset();return a};
|
||
|
sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E4;if(0>d||0>c)throw new sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,k,l=[],n=sjcl.bitArray;for(k=1;32*l.length<(d||1);k++){e=f=a.encrypt(n.concat(b,[k]));for(g=1;g<c;g++)for(f=a.encrypt(f),h=0;h<f.length;h++)e[h]^=f[h];l=l.concat(e)}d&&(l=n.clamp(l,d));return l};
|
||
|
sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.m=[0];this.P=0;this.H={};this.N=0;this.U={};this.Z=this.f=this.o=this.ha=0;this.b=[0,0,0,0,0,0,0,0];this.h=[0,0,0,0];this.L=void 0;this.M=a;this.D=!1;this.K={progress:{},seeded:{}};this.u=this.ga=0;this.I=1;this.J=2;this.ca=0x10000;this.T=[0,48,64,96,128,192,0x100,384,512,768,1024];this.da=3E4;this.ba=80};
|
||
|
sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;if(d===this.u)throw new sjcl.exception.notReady("generator isn't seeded");if(d&this.J){d=!(d&this.I);e=[];var f=0,g;this.Z=e[0]=(new Date).valueOf()+this.da;for(g=0;16>g;g++)e.push(0x100000000*Math.random()|0);for(g=0;g<this.c.length&&(e=e.concat(this.c[g].finalize()),f+=this.m[g],this.m[g]=0,d||!(this.P&1<<g));g++);this.P>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.m.push(0));this.f-=f;f>this.o&&(this.o=
|
||
|
f);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.L=new sjcl.cipher.aes(this.b);for(d=0;4>d&&(this.h[d]=this.h[d]+1|0,!this.h[d]);d++);}for(d=0;d<a;d+=4)0===(d+1)%this.ca&&y(this),e=z(this),c.push(e[0],e[1],e[2],e[3]);y(this);return c.slice(0,a)},setDefaultParanoia:function(a,b){if(0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b)throw new sjcl.exception.invalid("Setting paranoia=0 will ruin your security; use it only for testing");this.M=a},addEntropy:function(a,
|
||
|
b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.H[c],h=this.isReady(),k=0;d=this.U[c];void 0===d&&(d=this.U[c]=this.ha++);void 0===g&&(g=this.H[c]=0);this.H[c]=(this.H[c]+1)%this.c.length;switch(typeof a){case "number":void 0===b&&(b=1);this.c[g].update([d,this.N++,1,b,f,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if("[object Uint32Array]"===c){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else for("[object Array]"!==c&&(k=1),c=0;c<a.length&&!k;c++)"number"!==typeof a[c]&&
|
||
|
(k=1);if(!k){if(void 0===b)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,e=e>>>1;this.c[g].update([d,this.N++,2,b,f,a.length].concat(a))}break;case "string":void 0===b&&(b=a.length);this.c[g].update([d,this.N++,3,b,f,a.length]);this.c[g].update(a);break;default:k=1}if(k)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[g]+=b;this.f+=b;h===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))},
|
||
|
isReady:function(a){a=this.T[void 0!==a?a:this.M];return this.o&&this.o>=a?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=a?this.J|this.u:this.u},getProgress:function(a){a=this.T[a?a:this.M];return this.o>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load",
|
||
|
this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event");
|
||
|
this.D=!0}},stopCollectors:function(){this.D&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",
|
||
|
this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(a,b){this.K[a][this.ga++]=b},removeEventListener:function(a,b){var c,d,e=this.K[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},la:function(){C(this,1)},oa:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&this.addEntropy([b,c],2,"mouse");C(this,0)},qa:function(a){a=
|
||
|
a.touches[0]||a.changedTouches[0];this.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch");C(this,0)},ma:function(){C(this,2)},ea:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;"number"===typeof b&&this.addEntropy(b,1,"accelerometer")}a&&this.addEntropy(a,2,"accelerometer");C(this,0)}};
|
||
|
function A(a,b){var c,d=sjcl.random.K[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}function C(a,b){"undefined"!==typeof window&&window.performance&&"function"===typeof window.performance.now?a.addEntropy(window.performance.now(),b,"loadtime"):a.addEntropy((new Date).valueOf(),b,"loadtime")}function y(a){a.b=z(a).concat(z(a));a.L=new sjcl.cipher.aes(a.b)}function z(a){for(var b=0;4>b&&(a.h[b]=a.h[b]+1|0,!a.h[b]);b++);return a.L.encrypt(a.h)}
|
||
|
function B(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);
|
||
|
a:try{var D,E,F,G;if(G="undefined"!==typeof module&&module.exports){var H;try{H=require("crypto")}catch(a){H=null}G=E=H}if(G&&E.randomBytes)D=E.randomBytes(128),D=new Uint32Array((new Uint8Array(D)).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!==typeof window&&"undefined"!==typeof Uint32Array){F=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(F);
|
||
|
else break a;sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!==typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))}
|
||
|
sjcl.json={defaults:{v:1,iter:1E4,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},ja:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.g({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.g(f,c);c=f.adata;"string"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt));"string"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv));if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||"string"===typeof a&&100>=f.iter||64!==f.ts&&96!==f.ts&&128!==f.ts||128!==f.ks&&192!==f.ks&&0x100!==f.ks||2>f.iv.length||
|
||
|
4<f.iv.length)throw new sjcl.exception.invalid("json encrypt: invalid parameters");"string"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,f),a=g.key.slice(0,f.ks/32),f.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.publicKey&&(g=a.kem(),f.kemtag=g.tag,a=g.key.slice(0,f.ks/32));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));"string"===typeof c&&(f.adata=c=sjcl.codec.utf8String.toBits(c));g=new sjcl.cipher[f.cipher](a);e.g(d,f);d.key=a;f.ct="ccm"===f.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&
|
||
|
b instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.encrypt(g,b,f.iv,c,f.ts):sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return f},encrypt:function(a,b,c,d){var e=sjcl.json,f=e.ja.apply(e,arguments);return e.encode(f)},ia:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.g(e.g(e.g({},e.defaults),b),c,!0);var f,g;f=b.adata;"string"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt));"string"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv));if(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||"string"===
|
||
|
typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)throw new sjcl.exception.invalid("json decrypt: invalid parameters");"string"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,b),a=g.key.slice(0,b.ks/32),b.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.secretKey&&(a=a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));"string"===typeof f&&(f=sjcl.codec.utf8String.toBits(f));g=new sjcl.cipher[b.cipher](a);f="ccm"===
|
||
|
b.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&b.ct instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.decrypt(g,b.ct,b.iv,b.tag,f,b.ts):sjcl.mode[b.mode].decrypt(g,b.ct,b.iv,f,b.ts);e.g(d,b);d.key=a;return 1===c.raw?f:sjcl.codec.utf8String.fromBits(f)},decrypt:function(a,b,c,d){var e=sjcl.json;return e.ia(a,e.decode(b),c,d)},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],0)+'"';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(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i)))throw new sjcl.exception.invalid("json decode: this isn't json!");
|
||
|
null!=d[3]?b[d[2]]=parseInt(d[3],10):null!=d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):null!=d[5]&&(b[d[2]]="true"===d[5])}return b},g:function(a,b,c){void 0===a&&(a={});if(void 0===b)return a;for(var d in b)if(b.hasOwnProperty(d)){if(c&&void 0!==a[d]&&a[d]!==b[d])throw new sjcl.exception.invalid("required parameter overridden");a[d]=b[d]}return a},sa:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&a[d]!==b[d]&&(c[d]=a[d]);return c},ra:function(a,
|
||
|
b){var c={},d;for(d=0;d<b.length;d++)void 0!==a[b[d]]&&(c[b[d]]=a[b[d]]);return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.pa={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.pa,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=void 0===b.salt?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)}};
|
||
|
"undefined"!==typeof module&&module.exports&&(module.exports=sjcl);"function"===typeof define&&define([],function(){return sjcl});
|
||
|
</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 || Object.create(null);
|
||
|
$tw.boot = $tw.boot || Object.create(null);
|
||
|
|
||
|
// Detect platforms
|
||
|
if(!("browser" in $tw)) {
|
||
|
$tw.browser = typeof(window) !== "undefined" ? {} : null;
|
||
|
}
|
||
|
if(!("node" in $tw)) {
|
||
|
$tw.node = typeof(process) === "object" ? {} : null;
|
||
|
}
|
||
|
if(!("nodeWebKit" in $tw)) {
|
||
|
$tw.nodeWebKit = $tw.node && global.window && global.window.nwDispatcher ? {} : null;
|
||
|
}
|
||
|
|
||
|
// Set default boot tasks
|
||
|
$tw.boot.tasks = {
|
||
|
trapErrors: !!($tw.browser && !$tw.node),
|
||
|
readBrowserTiddlers: !!($tw.browser && !$tw.node)
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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);
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Convenience function for pushing an array of tiddlers onto the preloading array
|
||
|
*/
|
||
|
$tw.preloadTiddlerArray = function(fieldsArray) {
|
||
|
$tw.preloadTiddlers.push.apply($tw.preloadTiddlers,fieldsArray);
|
||
|
};
|
||
|
|
||
|
return $tw;
|
||
|
|
||
|
});
|
||
|
|
||
|
if(typeof(exports) === "undefined") {
|
||
|
// Set up $tw global for the browser
|
||
|
window.$tw = _bootprefix(window.$tw);
|
||
|
} else {
|
||
|
// Export functionality as a module
|
||
|
exports.bootprefix = _bootprefix;
|
||
|
}
|
||
|
//# sourceURL=$:/boot/bootprefix.js
|
||
|
</script>
|
||
|
</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.
|
||
|
|
||
|
\*/
|
||
|
|
||
|
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 || Object.create(null);
|
||
|
|
||
|
/////////////////////////// Standard node.js libraries
|
||
|
|
||
|
var fs, path, vm;
|
||
|
if($tw.node) {
|
||
|
fs = require("fs");
|
||
|
path = require("path");
|
||
|
vm = require("vm");
|
||
|
}
|
||
|
|
||
|
/////////////////////////// Utility functions
|
||
|
|
||
|
$tw.boot.log = function(str) {
|
||
|
$tw.boot.logMessages = $tw.boot.logMessages || [];
|
||
|
$tw.boot.logMessages.push(str);
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
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]";
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Check if an array is equal by value and by reference.
|
||
|
*/
|
||
|
$tw.utils.isArrayEqual = function(array1,array2) {
|
||
|
if(array1 === array2) {
|
||
|
return true;
|
||
|
}
|
||
|
array1 = array1 || [];
|
||
|
array2 = array2 || [];
|
||
|
if(array1.length !== array2.length) {
|
||
|
return false;
|
||
|
}
|
||
|
return array1.every(function(value,index) {
|
||
|
return value === array2[index];
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Add an entry to a sorted array if it doesn't already exist, while maintaining the sort order
|
||
|
*/
|
||
|
$tw.utils.insertSortedArray = function(array,value) {
|
||
|
var low = 0, high = array.length - 1, mid, cmp;
|
||
|
while(low <= high) {
|
||
|
mid = (low + high) >> 1;
|
||
|
cmp = value.localeCompare(array[mid]);
|
||
|
if(cmp > 0) {
|
||
|
low = mid + 1;
|
||
|
} else if(cmp < 0) {
|
||
|
high = mid - 1;
|
||
|
} else {
|
||
|
return array;
|
||
|
}
|
||
|
}
|
||
|
array.splice(low,0,value);
|
||
|
return array;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Push entries onto an array, removing them first if they already exist in the array
|
||
|
array: array to modify (assumed to be free of duplicates)
|
||
|
value: a single value to push or an array of values to push
|
||
|
*/
|
||
|
$tw.utils.pushTop = function(array,value) {
|
||
|
var t,p;
|
||
|
if($tw.utils.isArray(value)) {
|
||
|
// Remove any array entries that are duplicated in the new values
|
||
|
if(value.length !== 0) {
|
||
|
if(array.length !== 0) {
|
||
|
if(value.length < array.length) {
|
||
|
for(t=0; t<value.length; t++) {
|
||
|
p = array.indexOf(value[t]);
|
||
|
if(p !== -1) {
|
||
|
array.splice(p,1);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
for(t=array.length-1; t>=0; t--) {
|
||
|
p = value.indexOf(array[t]);
|
||
|
if(p !== -1) {
|
||
|
array.splice(t,1);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// Push the values on top of the main array
|
||
|
array.push.apply(array,value);
|
||
|
}
|
||
|
} else {
|
||
|
p = array.indexOf(value);
|
||
|
if(p !== -1) {
|
||
|
array.splice(p,1);
|
||
|
}
|
||
|
array.push(value);
|
||
|
}
|
||
|
return 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 next,f,length;
|
||
|
if(object) {
|
||
|
if(Object.prototype.toString.call(object) == "[object Array]") {
|
||
|
for (f=0, length=object.length; f<length; f++) {
|
||
|
next = callback(object[f],f,object);
|
||
|
if(next === false) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
var keys = Object.keys(object);
|
||
|
for (f=0, length=keys.length; f<length; f++) {
|
||
|
var key = keys[f];
|
||
|
next = callback(object[key],key,object);
|
||
|
if(next === false) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Helper for making DOM elements
|
||
|
tag: tag name
|
||
|
options: see below
|
||
|
Options include:
|
||
|
namespace: defaults to http://www.w3.org/1999/xhtml
|
||
|
attributes: hashmap of attribute values
|
||
|
style: hashmap of styles
|
||
|
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.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
|
||
|
if(options["class"]) {
|
||
|
element.className = options["class"];
|
||
|
}
|
||
|
if(options.text) {
|
||
|
element.appendChild(doc.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);
|
||
|
});
|
||
|
$tw.utils.each(options.style,function(value,name) {
|
||
|
element.style[name] = value;
|
||
|
});
|
||
|
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 = ( $tw.language == undefined ? "Internal JavaScript Error" : $tw.language.getString("InternalJavaScriptError/Title") ),
|
||
|
promptMsg = ( $tw.language == undefined ? "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser" : $tw.language.getString("InternalJavaScriptError/Hint") );
|
||
|
// Log the error to the console
|
||
|
console.error($tw.node ? "\x1b[1;31m" + err + "\x1b[0m" : err);
|
||
|
if($tw.browser && !$tw.node) {
|
||
|
// Display an error message to the user
|
||
|
var dm = $tw.utils.domMaker,
|
||
|
heading = dm("h1",{text: errHeading}),
|
||
|
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
||
|
message = dm("div",{text: err, "class":"tc-error-message"}),
|
||
|
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
||
|
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-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 if(!$tw.browser) {
|
||
|
// Exit if we're under node.js
|
||
|
process.exit(1);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Use our custom error handler if we're in the browser
|
||
|
*/
|
||
|
if($tw.boot.tasks.trapErrors) {
|
||
|
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] === undefined) {
|
||
|
object[p] = source[p];
|
||
|
}
|
||
|
if(typeof object[p] === "object" && typeof source[p] === "object") {
|
||
|
$tw.utils.deepDefaults(object[p],source[p]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
return object;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Convert a URIComponent encoded string to a string safely
|
||
|
*/
|
||
|
$tw.utils.decodeURIComponentSafe = function(s) {
|
||
|
var v = s;
|
||
|
try {
|
||
|
v = decodeURIComponent(s);
|
||
|
} catch(e) {}
|
||
|
return v;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Convert a URI encoded string to a string safely
|
||
|
*/
|
||
|
$tw.utils.decodeURISafe = function(s) {
|
||
|
var v = s;
|
||
|
try {
|
||
|
v = decodeURI(s);
|
||
|
} catch(e) {}
|
||
|
return v;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to "
|
||
|
*/
|
||
|
$tw.utils.htmlDecode = function(s) {
|
||
|
return s.toString().replace(/</mg,"<").replace(/ /mg,"\xA0").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&");
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
|
||
|
*/
|
||
|
$tw.utils.getLocationHash = function() {
|
||
|
var href = window.location.href;
|
||
|
var idx = href.indexOf('#');
|
||
|
if(idx === -1) {
|
||
|
return "#";
|
||
|
} else if(href.substr(idx + 1,1) === "#" || href.substr(idx + 1,3) === "%23") {
|
||
|
// Special case: ignore location hash if it itself starts with a #
|
||
|
return "#";
|
||
|
} else {
|
||
|
return href.substring(idx);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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") {
|
||
|
var negative = 1;
|
||
|
if(value.charAt(0) === "-") {
|
||
|
negative = -1;
|
||
|
value = value.substr(1);
|
||
|
}
|
||
|
var year = parseInt(value.substr(0,4),10) * negative,
|
||
|
d = new Date(Date.UTC(year,
|
||
|
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)));
|
||
|
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
||
|
return d;
|
||
|
} 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) {
|
||
|
if($tw.utils.isArray(value)) {
|
||
|
var result = new Array(value.length);
|
||
|
for(var t=0, l=value.length; t<l; t++) {
|
||
|
var entry = value[t] || "";
|
||
|
if(entry.match(/[^\S\xA0]/mg)) {
|
||
|
result[t] = "[[" + entry + "]]";
|
||
|
} else {
|
||
|
result[t] = entry;
|
||
|
}
|
||
|
}
|
||
|
return result.join(" ");
|
||
|
} else {
|
||
|
return value || "";
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne"
|
||
|
$tw.utils.parseStringArray = function(value, allowDuplicate) {
|
||
|
if(typeof value === "string") {
|
||
|
var memberRegExp = /(?:^|[^\S\xA0])(?:\[\[(.*?)\]\])(?=[^\S\xA0]|$)|([\S\xA0]+)/mg,
|
||
|
results = [], names = {},
|
||
|
match;
|
||
|
do {
|
||
|
match = memberRegExp.exec(value);
|
||
|
if(match) {
|
||
|
var item = match[1] || match[2];
|
||
|
if(item !== undefined && (!$tw.utils.hop(names,item) || allowDuplicate)) {
|
||
|
results.push(item);
|
||
|
names[item] = true;
|
||
|
}
|
||
|
}
|
||
|
} 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 || Object.create(null);
|
||
|
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();
|
||
|
if(field) {
|
||
|
fields[field] = value;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
return fields;
|
||
|
};
|
||
|
|
||
|
// Safely parse a string as JSON
|
||
|
$tw.utils.parseJSONSafe = function(text,defaultJSON) {
|
||
|
try {
|
||
|
return JSON.parse(text);
|
||
|
} catch(e) {
|
||
|
if(typeof defaultJSON === "function") {
|
||
|
return defaultJSON(e);
|
||
|
} else {
|
||
|
return defaultJSON || {};
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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 -- see https://semver.org
|
||
|
*/
|
||
|
$tw.utils.parseVersion = function(version) {
|
||
|
var match = /^v?((\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 +1 if the version string A is greater than the version string B, 0 if they are the same, and +1 if B is greater than A.
|
||
|
Missing or malformed version strings are parsed as 0.0.0
|
||
|
*/
|
||
|
$tw.utils.compareVersions = function(versionStringA,versionStringB) {
|
||
|
var defaultVersion = {
|
||
|
major: 0,
|
||
|
minor: 0,
|
||
|
patch: 0
|
||
|
},
|
||
|
versionA = $tw.utils.parseVersion(versionStringA) || defaultVersion,
|
||
|
versionB = $tw.utils.parseVersion(versionStringB) || defaultVersion,
|
||
|
diff = [
|
||
|
versionA.major - versionB.major,
|
||
|
versionA.minor - versionB.minor,
|
||
|
versionA.patch - versionB.patch
|
||
|
];
|
||
|
if((diff[0] > 0) || (diff[0] === 0 && diff[1] > 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] > 0)) {
|
||
|
return +1;
|
||
|
} else if((diff[0] < 0) || (diff[0] === 0 && diff[1] < 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] < 0)) {
|
||
|
return -1;
|
||
|
} else {
|
||
|
return 0;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Returns true if the version string A is greater than the version string B. Returns true if the versions are the same
|
||
|
*/
|
||
|
$tw.utils.checkVersions = function(versionStringA,versionStringB) {
|
||
|
return $tw.utils.compareVersions(versionStringA,versionStringB) !== -1;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Register file type information
|
||
|
options: {flags: flags,deserializerType: deserializerType}
|
||
|
flags:"image" for image types
|
||
|
deserializerType: defaults to type if not specified
|
||
|
*/
|
||
|
$tw.utils.registerFileType = function(type,encoding,extension,options) {
|
||
|
options = options || {};
|
||
|
if($tw.utils.isArray(extension)) {
|
||
|
$tw.utils.each(extension,function(extension) {
|
||
|
$tw.config.fileExtensionInfo[extension] = {type: type};
|
||
|
});
|
||
|
extension = extension[0];
|
||
|
} else {
|
||
|
$tw.config.fileExtensionInfo[extension] = {type: type};
|
||
|
}
|
||
|
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type};
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Given an extension, always access the $tw.config.fileExtensionInfo
|
||
|
using a lowercase extension only.
|
||
|
*/
|
||
|
$tw.utils.getFileExtensionInfo = function(ext) {
|
||
|
return ext ? $tw.config.fileExtensionInfo[ext.toLowerCase()] : null;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
Given an extension, get the correct encoding for that file.
|
||
|
defaults to utf8
|
||
|
*/
|
||
|
$tw.utils.getTypeEncoding = function(ext) {
|
||
|
var extensionInfo = $tw.utils.getFileExtensionInfo(ext),
|
||
|
type = extensionInfo ? extensionInfo.type : null,
|
||
|
typeInfo = type ? $tw.config.contentTypeInfo[type] : null;
|
||
|
return typeInfo ? typeInfo.encoding : "utf8";
|
||
|
};
|
||
|
|
||
|
var globalCheck =[
|
||
|
" Object.defineProperty(Object.prototype, '__temp__', {",
|
||
|
" get: function () { return this; },",
|
||
|
" configurable: true",
|
||
|
" });",
|
||
|
" if(Object.keys(__temp__).length){",
|
||
|
" console.log(Object.keys(__temp__));",
|
||
|
" delete Object.prototype.__temp__;",
|
||
|
" throw \"Global assignment is not allowed within modules on node.\";",
|
||
|
" }",
|
||
|
" delete Object.prototype.__temp__;",
|
||
|
].join('\n');
|
||
|
|
||
|
/*
|
||
|
Run code globally with specified context variables in scope
|
||
|
*/
|
||
|
$tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
||
|
var contextCopy = $tw.utils.extend(Object.create(null),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 + "\n;})();",
|
||
|
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
||
|
" return exports;\n",
|
||
|
"})"
|
||
|
].join("\n");
|
||
|
|
||
|
// Compile the code into a function
|
||
|
var fn;
|
||
|
if($tw.browser) {
|
||
|
fn = window["eval"](code + "\n\n//# sourceURL=" + filename);
|
||
|
} else {
|
||
|
if(sandbox){
|
||
|
fn = vm.runInContext(code,sandbox,filename)
|
||
|
} else {
|
||
|
fn = vm.runInThisContext(code,filename);
|
||
|
}
|
||
|
}
|
||
|
// Call the function and return the exports
|
||
|
return fn.apply(null,contextValues);
|
||
|
};
|
||
|
$tw.utils.sandbox = !$tw.browser ? vm.createContext({}) : undefined;
|
||
|
/*
|
||
|
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,allowGlobals) {
|
||
|
return $tw.utils.evalGlobal(
|
||
|
code,context,filename,
|
||
|
allowGlobals ? vm.createContext({}) : $tw.utils.sandbox,
|
||
|
allowGlobals
|
||
|
);
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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":"tc-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
|
||
|
canCancel: set true to enable a cancel button (callback called with null)
|
||
|
repeatPassword: set true to prompt for the password twice
|
||
|
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 self = this,
|
||
|
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: $tw.language.getString("Encryption/Username")}
|
||
|
}));
|
||
|
}
|
||
|
children.push(dm("input",{
|
||
|
attributes: {
|
||
|
type: "password",
|
||
|
name: "password",
|
||
|
placeholder: ( $tw.language == undefined ? "Password" : $tw.language.getString("Encryption/Password") )
|
||
|
}
|
||
|
}));
|
||
|
if(options.repeatPassword) {
|
||
|
children.push(dm("input",{
|
||
|
attributes: {
|
||
|
type: "password",
|
||
|
name: "password2",
|
||
|
placeholder: $tw.language.getString("Encryption/RepeatPassword")
|
||
|
}
|
||
|
}));
|
||
|
}
|
||
|
if(options.canCancel) {
|
||
|
children.push(dm("button",{
|
||
|
text: $tw.language.getString("Encryption/Cancel"),
|
||
|
attributes: {
|
||
|
type: "button"
|
||
|
},
|
||
|
eventListeners: [{
|
||
|
name: "click",
|
||
|
handlerFunction: function(event) {
|
||
|
self.removePrompt(promptInfo);
|
||
|
options.callback(null);
|
||
|
}
|
||
|
}]
|
||
|
}));
|
||
|
}
|
||
|
children.push(dm("button",{
|
||
|
attributes: {type: "submit"},
|
||
|
text: submitText
|
||
|
}));
|
||
|
var form = dm("form",{
|
||
|
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;
|
||
|
}
|
||
|
});
|
||
|
// Check that the passwords match
|
||
|
if(options.repeatPassword && data.password !== data.password2) {
|
||
|
alert($tw.language.getString("Encryption/PasswordNoMatch"));
|
||
|
} else {
|
||
|
// Call the callback
|
||
|
if(options.callback(data)) {
|
||
|
// Remove the prompt if the callback returned true
|
||
|
self.removePrompt(promptInfo);
|
||
|
} else {
|
||
|
// Clear the password if the callback returned false
|
||
|
$tw.utils.each(form.elements,function(element) {
|
||
|
if(element.name === "password" || element.name === "password2") {
|
||
|
element.value = "";
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
event.preventDefault();
|
||
|
return false;
|
||
|
},true);
|
||
|
// Add the prompt to the list
|
||
|
var promptInfo = {
|
||
|
serviceName: options.serviceName,
|
||
|
callback: options.callback,
|
||
|
form: form,
|
||
|
owner: this
|
||
|
};
|
||
|
this.passwordPrompts.push(promptInfo);
|
||
|
// Make sure the wrapper is displayed
|
||
|
this.setWrapperDisplay();
|
||
|
return promptInfo;
|
||
|
};
|
||
|
|
||
|
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
|
||
|
var i = this.passwordPrompts.indexOf(promptInfo);
|
||
|
if(i !== -1) {
|
||
|
this.passwordPrompts.splice(i,1);
|
||
|
promptInfo.form.parentNode.removeChild(promptInfo.form);
|
||
|
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.node ? (global.sjcl || require("./sjcl.js")) : window.sjcl,
|
||
|
currentPassword = null,
|
||
|
callSjcl = function(method,inputText,password) {
|
||
|
password = password || currentPassword;
|
||
|
var outputText;
|
||
|
try {
|
||
|
if(password) {
|
||
|
outputText = sjcl[method](password,inputText);
|
||
|
}
|
||
|
} catch(ex) {
|
||
|
console.log("Crypto error:" + ex);
|
||
|
outputText = null;
|
||
|
}
|
||
|
return outputText;
|
||
|
};
|
||
|
this.setPassword = function(newPassword) {
|
||
|
currentPassword = newPassword;
|
||
|
this.updateCryptoStateTiddler();
|
||
|
};
|
||
|
this.updateCryptoStateTiddler = function() {
|
||
|
if($tw.wiki) {
|
||
|
var state = currentPassword ? "yes" : "no",
|
||
|
tiddler = $tw.wiki.getTiddler("$:/isEncrypted");
|
||
|
if(!tiddler || tiddler.fields.text !== state) {
|
||
|
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: state}));
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.hasPassword = function() {
|
||
|
return !!currentPassword;
|
||
|
}
|
||
|
this.encrypt = function(text,password) {
|
||
|
return callSjcl("encrypt",text,password);
|
||
|
};
|
||
|
this.decrypt = function(text,password) {
|
||
|
return callSjcl("decrypt",text,password);
|
||
|
};
|
||
|
};
|
||
|
|
||
|
/////////////////////////// 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;
|
||
|
if(moduleName.charAt(0) === ".") {
|
||
|
name = $tw.utils.resolvePath(moduleName,moduleRoot)
|
||
|
}
|
||
|
if(!$tw.modules.titles[name]) {
|
||
|
if($tw.modules.titles[name + ".js"]) {
|
||
|
name = name + ".js";
|
||
|
} else if($tw.modules.titles[name + "/index.js"]) {
|
||
|
name = name + "/index.js";
|
||
|
} else if($tw.modules.titles[moduleName]) {
|
||
|
name = moduleName;
|
||
|
} else if($tw.modules.titles[moduleName + ".js"]) {
|
||
|
name = moduleName + ".js";
|
||
|
} else if($tw.modules.titles[moduleName + "/index.js"]) {
|
||
|
name = moduleName + "/index.js";
|
||
|
}
|
||
|
}
|
||
|
var moduleInfo = $tw.modules.titles[name],
|
||
|
tiddler = $tw.wiki.getTiddler(name),
|
||
|
_exports = {},
|
||
|
sandbox = {
|
||
|
module: {exports: _exports},
|
||
|
//moduleInfo: moduleInfo,
|
||
|
exports: _exports,
|
||
|
console: console,
|
||
|
setInterval: setInterval,
|
||
|
clearInterval: clearInterval,
|
||
|
setTimeout: setTimeout,
|
||
|
clearTimeout: clearTimeout,
|
||
|
Buffer: $tw.browser ? undefined : 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);
|
||
|
if(sandbox.module.exports) {
|
||
|
moduleInfo.exports = sandbox.module.exports; //more codemirror workaround
|
||
|
}
|
||
|
} else { // Object
|
||
|
moduleInfo.exports = moduleInfo.definition;
|
||
|
}
|
||
|
} catch(e) {
|
||
|
if (e instanceof SyntaxError) {
|
||
|
var line = e.lineNumber || e.line; // Firefox || Safari
|
||
|
if (typeof(line) != "undefined" && line !== null) {
|
||
|
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
|
||
|
} else if(!$tw.browser) {
|
||
|
// this is the only way to get node.js to display the line at which the syntax error appeared,
|
||
|
// and $tw.utils.error would exit anyway
|
||
|
// cf. https://bugs.chromium.org/p/v8/issues/detail?id=2589
|
||
|
throw e;
|
||
|
} else {
|
||
|
// Opera: line number is included in e.message
|
||
|
// Chrome/IE: there's currently no way to get the line number
|
||
|
$tw.utils.error("Syntax error in boot module " + name + ": " + e.message + "\n" + e.stack);
|
||
|
}
|
||
|
} else {
|
||
|
// line number should be included in e.stack for runtime errors
|
||
|
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// 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) {
|
||
|
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 = Object.create(null);
|
||
|
$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 = Object.create(null);
|
||
|
}
|
||
|
$tw.modules.forEachModuleOfType(moduleType,function(title,module) {
|
||
|
$tw.utils.each(module,function(element,title,object) {
|
||
|
targetObject[title] = module[title];
|
||
|
});
|
||
|
});
|
||
|
return targetObject;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Return a class created from a modules. The module should export the properties to be added to those of the optional base class
|
||
|
*/
|
||
|
$tw.modules.createClassFromModule = function(moduleExports,baseClass) {
|
||
|
var newClass = function() {};
|
||
|
if(baseClass) {
|
||
|
newClass.prototype = new baseClass();
|
||
|
newClass.prototype.constructor = baseClass;
|
||
|
}
|
||
|
$tw.utils.extend(newClass.prototype,moduleExports);
|
||
|
return newClass;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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 = Object.create(null);
|
||
|
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
|
||
|
if(!subType || moduleExports.types[subType]) {
|
||
|
classes[moduleExports.name] = $tw.modules.createClassFromModule(moduleExports,baseClass);
|
||
|
}
|
||
|
});
|
||
|
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 = Object.create(null);
|
||
|
this.cache = Object.create(null);
|
||
|
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 || src[t] === null) {
|
||
|
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],
|
||
|
value;
|
||
|
if(fieldModule && fieldModule.parse) {
|
||
|
value = fieldModule.parse.call(this,src[t]);
|
||
|
} else {
|
||
|
value = src[t];
|
||
|
}
|
||
|
// Freeze the field to keep it immutable
|
||
|
if(value != null && typeof value === "object") {
|
||
|
Object.freeze(value);
|
||
|
}
|
||
|
this.fields[t] = value;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// Freeze the tiddler against modification
|
||
|
Object.freeze(this.fields);
|
||
|
Object.freeze(this);
|
||
|
};
|
||
|
|
||
|
$tw.Tiddler.prototype.hasField = function(field) {
|
||
|
return $tw.utils.hop(this.fields,field);
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Compare two tiddlers for equality
|
||
|
tiddler: the tiddler to compare
|
||
|
excludeFields: array of field names to exclude from the comparison
|
||
|
*/
|
||
|
$tw.Tiddler.prototype.isEqual = function(tiddler,excludeFields) {
|
||
|
if(!(tiddler instanceof $tw.Tiddler)) {
|
||
|
return false;
|
||
|
}
|
||
|
excludeFields = excludeFields || [];
|
||
|
var self = this,
|
||
|
differences = []; // Fields that have differences
|
||
|
// Add to the differences array
|
||
|
function addDifference(fieldName) {
|
||
|
// Check for this field being excluded
|
||
|
if(excludeFields.indexOf(fieldName) === -1) {
|
||
|
// Save the field as a difference
|
||
|
$tw.utils.pushTop(differences,fieldName);
|
||
|
}
|
||
|
}
|
||
|
// Returns true if the two values of this field are equal
|
||
|
function isFieldValueEqual(fieldName) {
|
||
|
var valueA = self.fields[fieldName],
|
||
|
valueB = tiddler.fields[fieldName];
|
||
|
// Check for identical string values
|
||
|
if(typeof(valueA) === "string" && typeof(valueB) === "string" && valueA === valueB) {
|
||
|
return true;
|
||
|
}
|
||
|
// Check for identical array values
|
||
|
if($tw.utils.isArray(valueA) && $tw.utils.isArray(valueB) && $tw.utils.isArrayEqual(valueA,valueB)) {
|
||
|
return true;
|
||
|
}
|
||
|
// Check for identical date values
|
||
|
if($tw.utils.isDate(valueA) && $tw.utils.isDate(valueB) && valueA.getTime() === valueB.getTime()) {
|
||
|
return true;
|
||
|
}
|
||
|
// Otherwise the fields must be different
|
||
|
return false;
|
||
|
}
|
||
|
// Compare our fields
|
||
|
for(var fieldName in this.fields) {
|
||
|
if(!isFieldValueEqual(fieldName)) {
|
||
|
addDifference(fieldName);
|
||
|
}
|
||
|
}
|
||
|
// There's a difference for every field in the other tiddler that we don't have
|
||
|
for(fieldName in tiddler.fields) {
|
||
|
if(!(fieldName in this.fields)) {
|
||
|
addDifference(fieldName);
|
||
|
}
|
||
|
}
|
||
|
// Return whether there were any differences
|
||
|
return differences.length === 0;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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
|
||
|
|
||
|
/*
|
||
|
Wiki constructor. State is stored in private members that only a small number of privileged accessor methods have direct access. Methods added via the prototype have to use these accessors and cannot access the state data directly.
|
||
|
options include:
|
||
|
enableIndexers - Array of indexer names to enable, or null to use all available indexers
|
||
|
*/
|
||
|
$tw.Wiki = function(options) {
|
||
|
options = options || {};
|
||
|
var self = this,
|
||
|
tiddlers = Object.create(null), // Hashmap of tiddlers
|
||
|
tiddlerTitles = null, // Array of tiddler titles
|
||
|
getTiddlerTitles = function() {
|
||
|
if(!tiddlerTitles) {
|
||
|
tiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
||
|
}
|
||
|
return tiddlerTitles;
|
||
|
},
|
||
|
pluginTiddlers = [], // Array of tiddlers containing registered plugins, ordered by priority
|
||
|
pluginInfo = Object.create(null), // Hashmap of parsed plugin content
|
||
|
shadowTiddlers = Object.create(null), // Hashmap by title of {source:, tiddler:}
|
||
|
shadowTiddlerTitles = null,
|
||
|
getShadowTiddlerTitles = function() {
|
||
|
if(!shadowTiddlerTitles) {
|
||
|
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||
|
}
|
||
|
return shadowTiddlerTitles;
|
||
|
},
|
||
|
enableIndexers = options.enableIndexers || null,
|
||
|
indexers = [],
|
||
|
indexersByName = Object.create(null);
|
||
|
|
||
|
this.addIndexer = function(indexer,name) {
|
||
|
// Bail if this indexer is not enabled
|
||
|
if(enableIndexers && enableIndexers.indexOf(name) === -1) {
|
||
|
return;
|
||
|
}
|
||
|
indexers.push(indexer);
|
||
|
indexersByName[name] = indexer;
|
||
|
indexer.init();
|
||
|
};
|
||
|
|
||
|
this.getIndexer = function(name) {
|
||
|
return indexersByName[name] || null;
|
||
|
};
|
||
|
|
||
|
// Add a tiddler to the store
|
||
|
this.addTiddler = function(tiddler) {
|
||
|
if(!(tiddler instanceof $tw.Tiddler)) {
|
||
|
tiddler = new $tw.Tiddler(tiddler);
|
||
|
}
|
||
|
// Save the tiddler
|
||
|
if(tiddler) {
|
||
|
var title = tiddler.fields.title;
|
||
|
if(title) {
|
||
|
// Uncomment the following line for detailed logs of all tiddler writes
|
||
|
// console.log("Adding",title,tiddler)
|
||
|
// Record the old tiddler state
|
||
|
var updateDescriptor = {
|
||
|
old: {
|
||
|
tiddler: this.getTiddler(title),
|
||
|
shadow: this.isShadowTiddler(title),
|
||
|
exists: this.tiddlerExists(title)
|
||
|
}
|
||
|
}
|
||
|
// Save the new tiddler
|
||
|
tiddlers[title] = tiddler;
|
||
|
// Check we've got the title
|
||
|
tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);
|
||
|
// Record the new tiddler state
|
||
|
updateDescriptor["new"] = {
|
||
|
tiddler: tiddler,
|
||
|
shadow: this.isShadowTiddler(title),
|
||
|
exists: this.tiddlerExists(title)
|
||
|
}
|
||
|
// Update indexes
|
||
|
this.clearCache(title);
|
||
|
this.clearGlobalCache();
|
||
|
$tw.utils.each(indexers,function(indexer) {
|
||
|
indexer.update(updateDescriptor);
|
||
|
});
|
||
|
// Queue a change event
|
||
|
this.enqueueTiddlerEvent(title);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Delete a tiddler
|
||
|
this.deleteTiddler = function(title) {
|
||
|
// Uncomment the following line for detailed logs of all tiddler deletions
|
||
|
// console.log("Deleting",title)
|
||
|
if($tw.utils.hop(tiddlers,title)) {
|
||
|
// Record the old tiddler state
|
||
|
var updateDescriptor = {
|
||
|
old: {
|
||
|
tiddler: this.getTiddler(title),
|
||
|
shadow: this.isShadowTiddler(title),
|
||
|
exists: this.tiddlerExists(title)
|
||
|
}
|
||
|
}
|
||
|
// Delete the tiddler
|
||
|
delete tiddlers[title];
|
||
|
// Delete it from the list of titles
|
||
|
if(tiddlerTitles) {
|
||
|
var index = tiddlerTitles.indexOf(title);
|
||
|
if(index !== -1) {
|
||
|
tiddlerTitles.splice(index,1);
|
||
|
}
|
||
|
}
|
||
|
// Record the new tiddler state
|
||
|
updateDescriptor["new"] = {
|
||
|
tiddler: this.getTiddler(title),
|
||
|
shadow: this.isShadowTiddler(title),
|
||
|
exists: this.tiddlerExists(title)
|
||
|
}
|
||
|
// Update indexes
|
||
|
this.clearCache(title);
|
||
|
this.clearGlobalCache();
|
||
|
$tw.utils.each(indexers,function(indexer) {
|
||
|
indexer.update(updateDescriptor);
|
||
|
});
|
||
|
// Queue a change event
|
||
|
this.enqueueTiddlerEvent(title,true);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Get a tiddler from the store
|
||
|
this.getTiddler = function(title) {
|
||
|
if(title) {
|
||
|
var t = tiddlers[title];
|
||
|
if(t !== undefined) {
|
||
|
return t;
|
||
|
} else {
|
||
|
var s = shadowTiddlers[title];
|
||
|
if(s !== undefined) {
|
||
|
return s.tiddler;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return undefined;
|
||
|
};
|
||
|
|
||
|
// Get an array of all tiddler titles
|
||
|
this.allTitles = function() {
|
||
|
return getTiddlerTitles().slice(0);
|
||
|
};
|
||
|
|
||
|
// Iterate through all tiddler titles
|
||
|
this.each = function(callback) {
|
||
|
var titles = getTiddlerTitles(),
|
||
|
index,titlesLength,title;
|
||
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||
|
title = titles[index];
|
||
|
callback(tiddlers[title],title);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Get an array of all shadow tiddler titles
|
||
|
this.allShadowTitles = function() {
|
||
|
return getShadowTiddlerTitles().slice(0);
|
||
|
};
|
||
|
|
||
|
// Iterate through all shadow tiddler titles
|
||
|
this.eachShadow = function(callback) {
|
||
|
var titles = getShadowTiddlerTitles(),
|
||
|
index,titlesLength,title;
|
||
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||
|
title = titles[index];
|
||
|
if(tiddlers[title]) {
|
||
|
callback(tiddlers[title],title);
|
||
|
} else {
|
||
|
var shadowInfo = shadowTiddlers[title];
|
||
|
callback(shadowInfo.tiddler,title);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Iterate through all tiddlers and then the shadows
|
||
|
this.eachTiddlerPlusShadows = function(callback) {
|
||
|
var index,titlesLength,title,
|
||
|
titles = getTiddlerTitles();
|
||
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||
|
title = titles[index];
|
||
|
callback(tiddlers[title],title);
|
||
|
}
|
||
|
titles = getShadowTiddlerTitles();
|
||
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||
|
title = titles[index];
|
||
|
if(!tiddlers[title]) {
|
||
|
var shadowInfo = shadowTiddlers[title];
|
||
|
callback(shadowInfo.tiddler,title);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Iterate through all the shadows and then the tiddlers
|
||
|
this.eachShadowPlusTiddlers = function(callback) {
|
||
|
var index,titlesLength,title,
|
||
|
titles = getShadowTiddlerTitles();
|
||
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||
|
title = titles[index];
|
||
|
if(tiddlers[title]) {
|
||
|
callback(tiddlers[title],title);
|
||
|
} else {
|
||
|
var shadowInfo = shadowTiddlers[title];
|
||
|
callback(shadowInfo.tiddler,title);
|
||
|
}
|
||
|
}
|
||
|
titles = getTiddlerTitles();
|
||
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||
|
title = titles[index];
|
||
|
if(!shadowTiddlers[title]) {
|
||
|
callback(tiddlers[title],title);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Test for the existence of a tiddler (excludes shadow tiddlers)
|
||
|
this.tiddlerExists = function(title) {
|
||
|
return !!$tw.utils.hop(tiddlers,title);
|
||
|
};
|
||
|
|
||
|
// Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler
|
||
|
this.isShadowTiddler = function(title) {
|
||
|
return $tw.utils.hop(shadowTiddlers,title);
|
||
|
};
|
||
|
|
||
|
this.getShadowSource = function(title) {
|
||
|
if($tw.utils.hop(shadowTiddlers,title)) {
|
||
|
return shadowTiddlers[title].source;
|
||
|
}
|
||
|
return null;
|
||
|
};
|
||
|
|
||
|
// Get an array of all the currently recognised plugin types
|
||
|
this.getPluginTypes = function() {
|
||
|
var types = [];
|
||
|
$tw.utils.each(pluginTiddlers,function(pluginTiddler) {
|
||
|
var pluginType = pluginTiddler.fields["plugin-type"];
|
||
|
if(pluginType && types.indexOf(pluginType) === -1) {
|
||
|
types.push(pluginType);
|
||
|
}
|
||
|
});
|
||
|
return types;
|
||
|
};
|
||
|
|
||
|
// Read plugin info for all plugins, or just an array of titles. Returns the number of plugins updated or deleted
|
||
|
this.readPluginInfo = function(titles) {
|
||
|
var results = {
|
||
|
modifiedPlugins: [],
|
||
|
deletedPlugins: []
|
||
|
};
|
||
|
$tw.utils.each(titles || getTiddlerTitles(),function(title) {
|
||
|
var tiddler = tiddlers[title];
|
||
|
if(tiddler) {
|
||
|
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type") && tiddler.fields.text) {
|
||
|
pluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);
|
||
|
results.modifiedPlugins.push(tiddler.fields.title);
|
||
|
}
|
||
|
} else {
|
||
|
if(pluginInfo[title]) {
|
||
|
delete pluginInfo[title];
|
||
|
results.deletedPlugins.push(title);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
return results;
|
||
|
};
|
||
|
|
||
|
// Get plugin info for a plugin
|
||
|
this.getPluginInfo = function(title) {
|
||
|
return pluginInfo[title];
|
||
|
};
|
||
|
|
||
|
// Register the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected
|
||
|
this.registerPluginTiddlers = function(pluginType,titles) {
|
||
|
var self = this,
|
||
|
registeredTitles = [],
|
||
|
checkTiddler = function(tiddler,title) {
|
||
|
if(tiddler && tiddler.fields.type === "application/json" && tiddler.fields["plugin-type"] && (!pluginType || tiddler.fields["plugin-type"] === pluginType)) {
|
||
|
var disablingTiddler = self.getTiddler("$:/config/Plugins/Disabled/" + title);
|
||
|
if(title === "$:/core" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") {
|
||
|
self.unregisterPluginTiddlers(null,[title]); // Unregister the plugin if it's already registered
|
||
|
pluginTiddlers.push(tiddler);
|
||
|
registeredTitles.push(tiddler.fields.title);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
if(titles) {
|
||
|
$tw.utils.each(titles,function(title) {
|
||
|
checkTiddler(self.getTiddler(title),title);
|
||
|
});
|
||
|
} else {
|
||
|
this.each(function(tiddler,title) {
|
||
|
checkTiddler(tiddler,title);
|
||
|
});
|
||
|
}
|
||
|
return registeredTitles;
|
||
|
};
|
||
|
|
||
|
// Unregister the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting unregistering to an array of tiddler titles. Returns an array of the titles affected
|
||
|
this.unregisterPluginTiddlers = function(pluginType,titles) {
|
||
|
var self = this,
|
||
|
unregisteredTitles = [];
|
||
|
// Remove any previous registered plugins of this type
|
||
|
for(var t=pluginTiddlers.length-1; t>=0; t--) {
|
||
|
var tiddler = pluginTiddlers[t];
|
||
|
if(tiddler.fields["plugin-type"] && (!pluginType || tiddler.fields["plugin-type"] === pluginType) && (!titles || titles.indexOf(tiddler.fields.title) !== -1)) {
|
||
|
unregisteredTitles.push(tiddler.fields.title);
|
||
|
pluginTiddlers.splice(t,1);
|
||
|
}
|
||
|
}
|
||
|
return unregisteredTitles;
|
||
|
};
|
||
|
|
||
|
// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
|
||
|
this.unpackPluginTiddlers = function() {
|
||
|
var self = this;
|
||
|
// Sort the plugin titles by the `plugin-priority` field
|
||
|
pluginTiddlers.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
|
||
|
shadowTiddlers = Object.create(null);
|
||
|
$tw.utils.each(pluginTiddlers,function(tiddler) {
|
||
|
// Extract the constituent tiddlers
|
||
|
if($tw.utils.hop(pluginInfo,tiddler.fields.title)) {
|
||
|
$tw.utils.each(pluginInfo[tiddler.fields.title].tiddlers,function(constituentTiddler,constituentTitle) {
|
||
|
// Save the tiddler object
|
||
|
if(constituentTitle) {
|
||
|
shadowTiddlers[constituentTitle] = {
|
||
|
source: tiddler.fields.title,
|
||
|
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
|
||
|
};
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
shadowTiddlerTitles = null;
|
||
|
this.clearCache(null);
|
||
|
this.clearGlobalCache();
|
||
|
$tw.utils.each(indexers,function(indexer) {
|
||
|
indexer.rebuild();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
if(this.addIndexersToWiki) {
|
||
|
this.addIndexersToWiki();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Dummy methods that will be filled in after boot
|
||
|
$tw.Wiki.prototype.clearCache =
|
||
|
$tw.Wiki.prototype.clearGlobalCache =
|
||
|
$tw.Wiki.prototype.enqueueTiddlerEvent = function() {};
|
||
|
|
||
|
// Add an array of tiddlers
|
||
|
$tw.Wiki.prototype.addTiddlers = function(tiddlers) {
|
||
|
for(var t=0; t<tiddlers.length; t++) {
|
||
|
this.addTiddler(tiddlers[t]);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Define all modules stored in ordinary tiddlers
|
||
|
*/
|
||
|
$tw.Wiki.prototype.defineTiddlerModules = function() {
|
||
|
this.each(function(tiddler,title) {
|
||
|
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"],$tw.utils.parseJSONSafe(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;
|
||
|
this.eachShadow(function(tiddler,title) {
|
||
|
// Don't define the module if it is overidden by an ordinary tiddler
|
||
|
if(!self.tiddlerExists(title) && tiddler.hasField("module-type")) {
|
||
|
// Define the module
|
||
|
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Enable safe mode by deleting any tiddlers that override a shadow tiddler
|
||
|
*/
|
||
|
$tw.Wiki.prototype.processSafeMode = function() {
|
||
|
var self = this,
|
||
|
overrides = [];
|
||
|
// Find the overriding tiddlers
|
||
|
this.each(function(tiddler,title) {
|
||
|
if(self.isShadowTiddler(title)) {
|
||
|
console.log(title);
|
||
|
overrides.push(title);
|
||
|
}
|
||
|
});
|
||
|
// Assemble a report tiddler
|
||
|
var titleReportTiddler = "TiddlyWiki Safe Mode",
|
||
|
report = [];
|
||
|
report.push("TiddlyWiki has been started in [[safe mode|https://tiddlywiki.com/static/SafeMode.html]]. All plugins are temporarily disabled. Most customisations have been disabled by renaming the following tiddlers:")
|
||
|
// Delete the overrides
|
||
|
overrides.forEach(function(title) {
|
||
|
var tiddler = self.getTiddler(title),
|
||
|
newTitle = "SAFE: " + title;
|
||
|
self.deleteTiddler(title);
|
||
|
self.addTiddler(new $tw.Tiddler(tiddler, {title: newTitle}));
|
||
|
report.push("* [[" + title + "|" + newTitle + "]]");
|
||
|
});
|
||
|
report.push()
|
||
|
this.addTiddler(new $tw.Tiddler({title: titleReportTiddler, text: report.join("\n\n")}));
|
||
|
// Set $:/DefaultTiddlers to point to our report
|
||
|
this.addTiddler(new $tw.Tiddler({title: "$:/DefaultTiddlers", text: "[[" + titleReportTiddler + "]]"}));
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Extracts tiddlers from a typed block of text, specifying default field values
|
||
|
*/
|
||
|
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
|
||
|
srcFields = srcFields || Object.create(null);
|
||
|
options = options || {};
|
||
|
var deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],
|
||
|
fields = Object.create(null);
|
||
|
if(!deserializer) {
|
||
|
deserializer = $tw.Wiki.tiddlerDeserializerModules[type];
|
||
|
}
|
||
|
if(!deserializer && $tw.utils.getFileExtensionInfo(type)) {
|
||
|
// If we didn't find the serializer, try converting it from an extension to a content type
|
||
|
type = $tw.utils.getFileExtensionInfo(type).type;
|
||
|
deserializer = $tw.Wiki.tiddlerDeserializerModules[type];
|
||
|
}
|
||
|
if(!deserializer && $tw.config.contentTypeInfo[type]) {
|
||
|
// see if this type has a different deserializer registered with it
|
||
|
type = $tw.config.contentTypeInfo[type].deserializerType;
|
||
|
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
|
||
|
*/
|
||
|
var deserializeHeaderComment = 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/js","tiddlerdeserializer",{
|
||
|
"application/javascript": deserializeHeaderComment
|
||
|
});
|
||
|
$tw.modules.define("$:/boot/tiddlerdeserializer/css","tiddlerdeserializer",{
|
||
|
"text/css": deserializeHeaderComment
|
||
|
});
|
||
|
$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");
|
||
|
}
|
||
|
return [fields];
|
||
|
}
|
||
|
});
|
||
|
$tw.modules.define("$:/boot/tiddlerdeserializer/tids","tiddlerdeserializer",{
|
||
|
"application/x-tiddlers": function(text,fields) {
|
||
|
var titles = [],
|
||
|
tiddlers = [],
|
||
|
match = /\r?\n\r?\n/mg.exec(text);
|
||
|
if(match) {
|
||
|
fields = $tw.utils.parseFields(text.substr(0,match.index),fields);
|
||
|
var lines = text.substr(match.index + match[0].length).split(/\r?\n/mg);
|
||
|
for(var t=0; t<lines.length; t++) {
|
||
|
var line = lines[t];
|
||
|
if(line.charAt(0) !== "#") {
|
||
|
var colonPos= line.indexOf(":");
|
||
|
if(colonPos !== -1) {
|
||
|
var tiddler = $tw.utils.extend(Object.create(null),fields);
|
||
|
tiddler.title = (tiddler.title || "") + line.substr(0,colonPos).trim();
|
||
|
if(titles.indexOf(tiddler.title) !== -1) {
|
||
|
console.log("Warning: .multids file contains multiple definitions for " + tiddler.title);
|
||
|
}
|
||
|
titles.push(tiddler.title);
|
||
|
tiddler.text = line.substr(colonPos + 2).trim();
|
||
|
tiddlers.push(tiddler);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return tiddlers;
|
||
|
}
|
||
|
});
|
||
|
$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 isTiddlerValid = function(data) {
|
||
|
// Not valid if it's not an object with a title property
|
||
|
if(typeof(data) !== "object" || !$tw.utils.hop(data,"title")) {
|
||
|
return false;
|
||
|
}
|
||
|
for(var f in data) {
|
||
|
if($tw.utils.hop(data,f)) {
|
||
|
// Check field name doesn't contain control characters
|
||
|
if(typeof(data[f]) !== "string" || /[\x00-\x1F]/.test(f)) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
},
|
||
|
isTiddlerArrayValid = function(data) {
|
||
|
for(var t=0; t<data.length; t++) {
|
||
|
if(!isTiddlerValid(data[t])) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
},
|
||
|
data = $tw.utils.parseJSONSafe(text);
|
||
|
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
|
||
|
return data;
|
||
|
} else if(isTiddlerValid(data)) {
|
||
|
return [data];
|
||
|
} else {
|
||
|
// Plain JSON file
|
||
|
fields.text = text;
|
||
|
fields.type = "application/json";
|
||
|
return [fields];
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
/////////////////////////// Browser definitions
|
||
|
|
||
|
if($tw.browser && !$tw.node) {
|
||
|
|
||
|
/*
|
||
|
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 = "Enter a password to decrypt this TiddlyWiki";
|
||
|
// Prompt for the password
|
||
|
if($tw.utils.hop($tw.boot,"encryptionPrompts")) {
|
||
|
prompt = $tw.boot.encryptionPrompts.decrypt;
|
||
|
}
|
||
|
$tw.passwordPrompt.createPrompt({
|
||
|
serviceName: prompt,
|
||
|
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 = $tw.utils.parseJSONSafe(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) {
|
||
|
var type = (node.getAttribute && node.getAttribute("type")) || null;
|
||
|
if(type) {
|
||
|
// A new-style container with an explicit deserialization type
|
||
|
result = $tw.wiki.deserializeTiddlers(type,node.textContent);
|
||
|
} else {
|
||
|
// An old-style container of classic DIV-based tiddlers
|
||
|
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.loadTiddlersBrowser = function() {
|
||
|
// In the browser, we load tiddlers from certain elements
|
||
|
var containerSelectors = [
|
||
|
// IDs for old-style v5.1.x tiddler stores
|
||
|
"#libraryModules",
|
||
|
"#modules",
|
||
|
"#bootKernelPrefix",
|
||
|
"#bootKernel",
|
||
|
"#styleArea",
|
||
|
"#storeArea",
|
||
|
"#systemArea",
|
||
|
// Classes for new-style v5.2.x JSON tiddler stores
|
||
|
"script.tiddlywiki-tiddler-store"
|
||
|
];
|
||
|
for(var t=0; t<containerSelectors.length; t++) {
|
||
|
var nodes = document.querySelectorAll(containerSelectors[t]);
|
||
|
for(var n=0; n<nodes.length; n++) {
|
||
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",nodes[n]));
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
} else {
|
||
|
|
||
|
/////////////////////////// Server definitions
|
||
|
|
||
|
/*
|
||
|
Get any encrypted tiddlers
|
||
|
*/
|
||
|
$tw.boot.decryptEncryptedTiddlers = function(callback) {
|
||
|
// Storing encrypted tiddlers on the server isn't supported yet
|
||
|
callback();
|
||
|
};
|
||
|
|
||
|
} // End of if($tw.browser && !$tw.node)
|
||
|
|
||
|
/////////////////////////// Node definitions
|
||
|
|
||
|
if($tw.node) {
|
||
|
|
||
|
/*
|
||
|
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.utils.getFileExtensionInfo(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),
|
||
|
metadata = $tw.loadMetadataForFile(filepath);
|
||
|
if(metadata) {
|
||
|
if(type === "application/json") {
|
||
|
tiddlers = [{text: data, type: "application/json"}];
|
||
|
}
|
||
|
tiddlers = [$tw.utils.extend({},tiddlers[0],metadata)];
|
||
|
}
|
||
|
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Load the metadata fields in the .meta file corresponding to a particular file
|
||
|
*/
|
||
|
$tw.loadMetadataForFile = function(filepath) {
|
||
|
var metafilename = filepath + ".meta";
|
||
|
if(fs.existsSync(metafilename)) {
|
||
|
return $tw.utils.parseFields(fs.readFileSync(metafilename,"utf8") || "");
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
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$|^\.github$|^\.vscode$|^\.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) {
|
||
|
Array.prototype.push.apply(tiddlers,$tw.loadTiddlersFromSpecification(filepath,excludeRegExp));
|
||
|
} else {
|
||
|
// If not, read all the files in the directory
|
||
|
$tw.utils.each(files,function(file) {
|
||
|
if(!excludeRegExp.test(file) && file !== "plugin.info") {
|
||
|
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + path.sep + file,excludeRegExp));
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
} else if(stat.isFile()) {
|
||
|
tiddlers.push($tw.loadTiddlersFromFile(filepath,{title: filepath}));
|
||
|
}
|
||
|
}
|
||
|
return tiddlers;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Load all the tiddlers defined by a `tiddlywiki.files` specification file
|
||
|
filepath: pathname of the directory containing the specification file
|
||
|
*/
|
||
|
$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||
|
var tiddlers = [];
|
||
|
// Read the specification
|
||
|
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
||
|
// Helper to process a file
|
||
|
var processFile = function(filename,isTiddlerFile,fields,isEditableFile,rootPath) {
|
||
|
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
||
|
type = (extInfo || {}).type || fields.type || "text/plain",
|
||
|
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||
|
pathname = path.resolve(filepath,filename),
|
||
|
text = fs.readFileSync(pathname,typeInfo.encoding || "utf8"),
|
||
|
metadata = $tw.loadMetadataForFile(pathname) || {},
|
||
|
fileTiddlers;
|
||
|
if(isTiddlerFile) {
|
||
|
fileTiddlers = $tw.wiki.deserializeTiddlers(path.extname(pathname),text,metadata) || [];
|
||
|
} else {
|
||
|
fileTiddlers = [$tw.utils.extend({text: text},metadata)];
|
||
|
}
|
||
|
var combinedFields = $tw.utils.extend({},fields,metadata);
|
||
|
$tw.utils.each(fileTiddlers,function(tiddler) {
|
||
|
$tw.utils.each(combinedFields,function(fieldInfo,name) {
|
||
|
if(typeof fieldInfo === "string" || $tw.utils.isArray(fieldInfo)) {
|
||
|
tiddler[name] = fieldInfo;
|
||
|
} else {
|
||
|
var value = tiddler[name];
|
||
|
switch(fieldInfo.source) {
|
||
|
case "subdirectories":
|
||
|
value = path.relative(rootPath, filename).split('/').slice(0, -1);
|
||
|
break;
|
||
|
case "filepath":
|
||
|
value = path.relative(rootPath, filename);
|
||
|
break;
|
||
|
case "filename":
|
||
|
value = path.basename(filename);
|
||
|
break;
|
||
|
case "filename-uri-decoded":
|
||
|
value = $tw.utils.decodeURIComponentSafe(path.basename(filename));
|
||
|
break;
|
||
|
case "basename":
|
||
|
value = path.basename(filename,path.extname(filename));
|
||
|
break;
|
||
|
case "basename-uri-decoded":
|
||
|
value = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));
|
||
|
break;
|
||
|
case "extname":
|
||
|
value = path.extname(filename);
|
||
|
break;
|
||
|
case "created":
|
||
|
value = new Date(fs.statSync(pathname).birthtime);
|
||
|
break;
|
||
|
case "modified":
|
||
|
value = new Date(fs.statSync(pathname).mtime);
|
||
|
break;
|
||
|
}
|
||
|
if(fieldInfo.prefix) {
|
||
|
value = fieldInfo.prefix + value;
|
||
|
}
|
||
|
if(fieldInfo.suffix) {
|
||
|
value = value + fieldInfo.suffix;
|
||
|
}
|
||
|
tiddler[name] = value;
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
if(isEditableFile) {
|
||
|
tiddlers.push({filepath: pathname, hasMetaFile: !!metadata && !isTiddlerFile, isEditableFile: true, tiddlers: fileTiddlers});
|
||
|
} else {
|
||
|
tiddlers.push({tiddlers: fileTiddlers});
|
||
|
}
|
||
|
};
|
||
|
// Helper to recursively search subdirectories
|
||
|
var getAllFiles = function(dirPath, recurse, arrayOfFiles) {
|
||
|
recurse = recurse || false;
|
||
|
arrayOfFiles = arrayOfFiles || [];
|
||
|
var files = fs.readdirSync(dirPath);
|
||
|
files.forEach(function(file) {
|
||
|
if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
||
|
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
|
||
|
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
|
||
|
arrayOfFiles.push(path.join(dirPath, path.sep, file));
|
||
|
}
|
||
|
});
|
||
|
return arrayOfFiles;
|
||
|
}
|
||
|
// Process the listed tiddlers
|
||
|
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
||
|
if(tidInfo.prefix && tidInfo.suffix) {
|
||
|
tidInfo.fields.text = {prefix: tidInfo.prefix,suffix: tidInfo.suffix};
|
||
|
} else if(tidInfo.prefix) {
|
||
|
tidInfo.fields.text = {prefix: tidInfo.prefix};
|
||
|
} else if(tidInfo.suffix) {
|
||
|
tidInfo.fields.text = {suffix: tidInfo.suffix};
|
||
|
}
|
||
|
processFile(tidInfo.file,tidInfo.isTiddlerFile,tidInfo.fields);
|
||
|
});
|
||
|
// Process any listed directories
|
||
|
$tw.utils.each(filesInfo.directories,function(dirSpec) {
|
||
|
// Read literal directories directly
|
||
|
if(typeof dirSpec === "string") {
|
||
|
var pathname = path.resolve(filepath,dirSpec);
|
||
|
if(fs.existsSync(pathname) && fs.statSync(pathname).isDirectory()) {
|
||
|
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(pathname,excludeRegExp));
|
||
|
}
|
||
|
} else {
|
||
|
// Process directory specifier
|
||
|
var dirPath = path.resolve(filepath,dirSpec.path);
|
||
|
if(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
||
|
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
|
||
|
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
||
|
metaRegExp = /^.*\.meta$/;
|
||
|
for(var t=0; t<files.length; t++) {
|
||
|
var thisPath = path.relative(filepath, files[t]),
|
||
|
filename = path.basename(thisPath);
|
||
|
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
||
|
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile,dirSpec.path);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
console.log("Warning: a directory in a tiddlywiki.files file does not exist.");
|
||
|
console.log("dirPath: " + dirPath);
|
||
|
console.log("tiddlywiki.files location: " + 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 infoPath = filepath + path.sep + "plugin.info";
|
||
|
if(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory()) {
|
||
|
// Read the plugin information
|
||
|
if(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) {
|
||
|
console.log("Warning: missing plugin.info file in " + filepath);
|
||
|
return null;
|
||
|
}
|
||
|
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"),function() {return null;});
|
||
|
if(!pluginInfo) {
|
||
|
console.log("warning: invalid JSON in plugin.info file at " + infoPath);
|
||
|
pluginInfo = {};
|
||
|
}
|
||
|
// Read the plugin files
|
||
|
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||
|
// Save the plugin tiddlers into the plugin info
|
||
|
pluginInfo.tiddlers = pluginInfo.tiddlers || Object.create(null);
|
||
|
for(var f=0; f<pluginFiles.length; f++) {
|
||
|
var tiddlers = pluginFiles[f].tiddlers;
|
||
|
for(var t=0; t<tiddlers.length; t++) {
|
||
|
var tiddler= tiddlers[t];
|
||
|
if(tiddler.title) {
|
||
|
pluginInfo.tiddlers[tiddler.title] = tiddler;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// 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;
|
||
|
}
|
||
|
// Use "plugin" as the plugin-type if we don't have one
|
||
|
if(!("plugin-type" in pluginInfo)) {
|
||
|
pluginInfo["plugin-type"] = "plugin";
|
||
|
}
|
||
|
pluginInfo.dependents = pluginInfo.dependents || [];
|
||
|
pluginInfo.type = "application/json";
|
||
|
// Set plugin text
|
||
|
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});
|
||
|
delete pluginInfo.tiddlers;
|
||
|
// Deserialise array fields (currently required for the dependents field)
|
||
|
for(var field in pluginInfo) {
|
||
|
if($tw.utils.isArray(pluginInfo[field])) {
|
||
|
pluginInfo[field] = $tw.utils.stringifyList(pluginInfo[field]);
|
||
|
}
|
||
|
}
|
||
|
return pluginInfo;
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
name: Name of the plugin to find
|
||
|
paths: array of file paths to search for it
|
||
|
Returns the path of the plugin folder
|
||
|
*/
|
||
|
$tw.findLibraryItem = function(name,paths) {
|
||
|
var pathIndex = 0;
|
||
|
do {
|
||
|
var pluginPath = path.resolve(paths[pathIndex],"./" + name)
|
||
|
if(fs.existsSync(pluginPath) && fs.statSync(pluginPath).isDirectory()) {
|
||
|
return pluginPath;
|
||
|
}
|
||
|
} while(++pathIndex < paths.length);
|
||
|
return null;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
name: Name of the plugin to load
|
||
|
paths: array of file paths to search for it
|
||
|
*/
|
||
|
$tw.loadPlugin = function(name,paths) {
|
||
|
var pluginPath = $tw.findLibraryItem(name,paths);
|
||
|
if(pluginPath) {
|
||
|
var pluginFields = $tw.loadPluginFolder(pluginPath);
|
||
|
if(pluginFields) {
|
||
|
$tw.wiki.addTiddler(pluginFields);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
console.log("Warning: Cannot find plugin '" + name + "'");
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
libraryPath: Path of library folder for these plugins (relative to core path)
|
||
|
envVar: Environment variable name for these plugins
|
||
|
Returns an array of search paths
|
||
|
*/
|
||
|
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
|
||
|
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
|
||
|
env = process.env[envVar];
|
||
|
if(env) {
|
||
|
env.split(path.delimiter).map(function(item) {
|
||
|
if(item) {
|
||
|
pluginPaths.push(item);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return pluginPaths;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
plugins: Array of names of plugins (eg, "tiddlywiki/filesystemadaptor")
|
||
|
libraryPath: Path of library folder for these plugins (relative to core path)
|
||
|
envVar: Environment variable name for these plugins
|
||
|
*/
|
||
|
$tw.loadPlugins = function(plugins,libraryPath,envVar) {
|
||
|
if(plugins) {
|
||
|
var pluginPaths = $tw.getLibraryItemSearchPaths(libraryPath,envVar);
|
||
|
for(var t=0; t<plugins.length; t++) {
|
||
|
$tw.loadPlugin(plugins[t],pluginPaths);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
path: path of wiki directory
|
||
|
options:
|
||
|
parentPaths: array of parent paths that we mustn't recurse into
|
||
|
readOnly: true if the tiddler file paths should not be retained
|
||
|
*/
|
||
|
$tw.loadWikiTiddlers = function(wikiPath,options) {
|
||
|
options = options || {};
|
||
|
var parentPaths = options.parentPaths || [],
|
||
|
wikiInfoPath = path.resolve(wikiPath,$tw.config.wikiInfo),
|
||
|
wikiInfo,
|
||
|
pluginFields;
|
||
|
// Bail if we don't have a wiki info file
|
||
|
if(fs.existsSync(wikiInfoPath)) {
|
||
|
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"),function() {return null;});
|
||
|
if(!wikiInfo) {
|
||
|
console.log("warning: invalid JSON in tiddlywiki.info file at " + wikiInfoPath);
|
||
|
wikiInfo = {};
|
||
|
}
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
// Save the path to the tiddlers folder for the filesystemadaptor
|
||
|
var config = wikiInfo.config || {};
|
||
|
if($tw.boot.wikiPath == wikiPath) {
|
||
|
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);
|
||
|
}
|
||
|
// Load any parent wikis
|
||
|
if(wikiInfo.includeWikis) {
|
||
|
parentPaths = parentPaths.slice(0);
|
||
|
parentPaths.push(wikiPath);
|
||
|
$tw.utils.each(wikiInfo.includeWikis,function(info) {
|
||
|
if(typeof info === "string") {
|
||
|
info = {path: info};
|
||
|
}
|
||
|
var resolvedIncludedWikiPath = path.resolve(wikiPath,info.path);
|
||
|
if(parentPaths.indexOf(resolvedIncludedWikiPath) === -1) {
|
||
|
var subWikiInfo = $tw.loadWikiTiddlers(resolvedIncludedWikiPath,{
|
||
|
parentPaths: parentPaths,
|
||
|
readOnly: info["read-only"]
|
||
|
});
|
||
|
// Merge the build targets
|
||
|
wikiInfo.build = $tw.utils.extend([],subWikiInfo.build,wikiInfo.build);
|
||
|
} else {
|
||
|
$tw.utils.error("Cannot recursively include wiki " + resolvedIncludedWikiPath);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
// Load any plugins, themes and languages listed in the wiki info file
|
||
|
$tw.loadPlugins(wikiInfo.plugins,$tw.config.pluginsPath,$tw.config.pluginsEnvVar);
|
||
|
$tw.loadPlugins(wikiInfo.themes,$tw.config.themesPath,$tw.config.themesEnvVar);
|
||
|
$tw.loadPlugins(wikiInfo.languages,$tw.config.languagesPath,$tw.config.languagesEnvVar);
|
||
|
// Load the wiki files, registering them as writable
|
||
|
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
|
||
|
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
|
||
|
if(!options.readOnly && tiddlerFile.filepath) {
|
||
|
$tw.utils.each(tiddlerFile.tiddlers,function(tiddler) {
|
||
|
$tw.boot.files[tiddler.title] = {
|
||
|
filepath: tiddlerFile.filepath,
|
||
|
type: tiddlerFile.type,
|
||
|
hasMetaFile: tiddlerFile.hasMetaFile,
|
||
|
isEditableFile: config["retain-original-tiddler-path"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0
|
||
|
};
|
||
|
});
|
||
|
}
|
||
|
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||
|
});
|
||
|
if ($tw.boot.wikiPath == wikiPath) {
|
||
|
// Save the original tiddler file locations if requested
|
||
|
var output = {}, relativePath, fileInfo;
|
||
|
for(var title in $tw.boot.files) {
|
||
|
fileInfo = $tw.boot.files[title];
|
||
|
if(fileInfo.isEditableFile) {
|
||
|
relativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);
|
||
|
fileInfo.originalpath = relativePath;
|
||
|
output[title] =
|
||
|
path.sep === "/" ?
|
||
|
relativePath :
|
||
|
relativePath.split(path.sep).join("/");
|
||
|
}
|
||
|
}
|
||
|
if(Object.keys(output).length > 0){
|
||
|
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
||
|
}
|
||
|
}
|
||
|
// 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(var 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(var t=0; t<themeFolders.length; t++) {
|
||
|
pluginFields = $tw.loadPluginFolder(path.resolve(wikiThemesPath,"./" + themeFolders[t]));
|
||
|
if(pluginFields) {
|
||
|
$tw.wiki.addTiddler(pluginFields);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// Load any languages within the wiki folder
|
||
|
var wikiLanguagesPath = path.resolve(wikiPath,$tw.config.wikiLanguagesSubDir);
|
||
|
if(fs.existsSync(wikiLanguagesPath)) {
|
||
|
var languageFolders = fs.readdirSync(wikiLanguagesPath);
|
||
|
for(var t=0; t<languageFolders.length; t++) {
|
||
|
pluginFields = $tw.loadPluginFolder(path.resolve(wikiLanguagesPath,"./" + languageFolders[t]));
|
||
|
if(pluginFields) {
|
||
|
$tw.wiki.addTiddler(pluginFields);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return wikiInfo;
|
||
|
};
|
||
|
|
||
|
$tw.loadTiddlersNode = 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 any extra plugins
|
||
|
$tw.utils.each($tw.boot.extraPlugins,function(name) {
|
||
|
if(name.charAt(0) === "+") { // Relative path to plugin
|
||
|
var pluginFields = $tw.loadPluginFolder(name.substring(1));
|
||
|
if(pluginFields) {
|
||
|
$tw.wiki.addTiddler(pluginFields);
|
||
|
}
|
||
|
} else {
|
||
|
var parts = name.split("/"),
|
||
|
type = parts[0];
|
||
|
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
|
||
|
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
// Load the tiddlers from the wiki directory
|
||
|
if($tw.boot.wikiPath) {
|
||
|
$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// End of if($tw.node)
|
||
|
}
|
||
|
|
||
|
/////////////////////////// Main startup function called once tiddlers have been decrypted
|
||
|
|
||
|
/*
|
||
|
Startup TiddlyWiki
|
||
|
*/
|
||
|
$tw.boot.initStartup = function(options) {
|
||
|
// Get the URL hash and check for safe mode
|
||
|
$tw.locationHash = "#";
|
||
|
if($tw.browser && !$tw.node) {
|
||
|
if(location.hash === "#:safe") {
|
||
|
$tw.safeMode = true;
|
||
|
} else {
|
||
|
$tw.locationHash = $tw.utils.getLocationHash();
|
||
|
}
|
||
|
}
|
||
|
// Initialise some more $tw properties
|
||
|
$tw.utils.deepDefaults($tw,{
|
||
|
modules: { // Information about each module
|
||
|
titles: Object.create(null), // hashmap by module title of {fn:, exports:, moduleType:}
|
||
|
types: {} // hashmap by module type of hashmap of exports
|
||
|
},
|
||
|
config: { // Configuration overridables
|
||
|
pluginsPath: "../plugins/",
|
||
|
themesPath: "../themes/",
|
||
|
languagesPath: "../languages/",
|
||
|
editionsPath: "../editions/",
|
||
|
wikiInfo: "./tiddlywiki.info",
|
||
|
wikiPluginsSubDir: "./plugins",
|
||
|
wikiThemesSubDir: "./themes",
|
||
|
wikiLanguagesSubDir: "./languages",
|
||
|
wikiTiddlersSubDir: "./tiddlers",
|
||
|
wikiOutputSubDir: "./output",
|
||
|
jsModuleHeaderRegExpString: "^\\/\\*\\\\(?:\\r?\\n)((?:^[^\\r\\n]*(?:\\r?\\n))+?)(^\\\\\\*\\/$(?:\\r?\\n)?)",
|
||
|
fileExtensionInfo: Object.create(null), // Map file extension to {type:}
|
||
|
contentTypeInfo: Object.create(null), // Map type to {encoding:,extension:}
|
||
|
pluginsEnvVar: "TIDDLYWIKI_PLUGIN_PATH",
|
||
|
themesEnvVar: "TIDDLYWIKI_THEME_PATH",
|
||
|
languagesEnvVar: "TIDDLYWIKI_LANGUAGE_PATH",
|
||
|
editionsEnvVar: "TIDDLYWIKI_EDITION_PATH"
|
||
|
},
|
||
|
log: {}, // Log flags
|
||
|
unloadTasks: []
|
||
|
});
|
||
|
if(!$tw.boot.tasks.readBrowserTiddlers) {
|
||
|
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
|
||
|
$tw.boot.files = Object.create(null);
|
||
|
// System paths and filenames
|
||
|
$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);
|
||
|
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
|
||
|
// If there's no arguments then default to `--help`
|
||
|
if($tw.boot.argv.length === 0) {
|
||
|
$tw.boot.argv = ["--help"];
|
||
|
}
|
||
|
// Parse any extra plugin references
|
||
|
$tw.boot.extraPlugins = $tw.boot.extraPlugins || [];
|
||
|
while($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("+") === 0) {
|
||
|
$tw.boot.extraPlugins.push($tw.boot.argv[0].substring(1));
|
||
|
$tw.boot.argv.splice(0,1);
|
||
|
}
|
||
|
// 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.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 = $tw.packageInfo || require("../package.json");
|
||
|
// Check node version number
|
||
|
if(!$tw.utils.checkVersions(process.version.substr(1),$tw.packageInfo.engines.node.substr(2))) {
|
||
|
$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-tiddlers","utf8",".multids");
|
||
|
$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",".htm"]);
|
||
|
$tw.utils.registerFileType("application/hta","utf16le",".hta",{deserializerType:"text/html"});
|
||
|
$tw.utils.registerFileType("application/javascript","utf8",".js");
|
||
|
$tw.utils.registerFileType("application/json","utf8",".json");
|
||
|
$tw.utils.registerFileType("application/pdf","base64",".pdf",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("application/zip","base64",".zip");
|
||
|
$tw.utils.registerFileType("application/x-zip-compressed","base64",".zip");
|
||
|
$tw.utils.registerFileType("image/jpeg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/jpg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/png","base64",".png",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/gif","base64",".gif",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||
|
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||
|
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||
|
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
||
|
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||
|
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
|
||
|
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
|
||
|
$tw.utils.registerFileType("video/webm","base64",".webm");
|
||
|
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
||
|
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
||
|
$tw.utils.registerFileType("audio/mpeg","base64",[".mp3",".m2a",".mp2",".mpa",".mpg",".mpga"]);
|
||
|
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
|
||
|
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
||
|
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
||
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
||
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
||
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
||
|
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
||
|
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
||
|
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||
|
$tw.utils.registerFileType("application/octet-stream","base64",".octet-stream");
|
||
|
// Create the wiki store for the app
|
||
|
$tw.wiki = new $tw.Wiki($tw.safeMode && {enableIndexers: []});
|
||
|
// Install built in tiddler fields modules
|
||
|
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
|
||
|
// Install the tiddler deserializer modules
|
||
|
$tw.Wiki.tiddlerDeserializerModules = Object.create(null);
|
||
|
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
|
||
|
// Call unload handlers in the browser
|
||
|
if($tw.browser) {
|
||
|
window.onbeforeunload = function(event) {
|
||
|
event = event || {};
|
||
|
var result;
|
||
|
$tw.utils.each($tw.unloadTasks,function(task) {
|
||
|
var r = task(event);
|
||
|
if(r) {
|
||
|
result = r;
|
||
|
}
|
||
|
});
|
||
|
return result;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
$tw.boot.loadStartup = function(options){
|
||
|
|
||
|
// Load tiddlers
|
||
|
if($tw.boot.tasks.readBrowserTiddlers) {
|
||
|
$tw.loadTiddlersBrowser();
|
||
|
} else {
|
||
|
$tw.loadTiddlersNode();
|
||
|
}
|
||
|
// Load any preloaded tiddlers
|
||
|
if($tw.preloadTiddlers) {
|
||
|
$tw.wiki.addTiddlers($tw.preloadTiddlers);
|
||
|
}
|
||
|
// Give hooks a chance to modify the store
|
||
|
$tw.hooks.invokeHook("th-boot-tiddlers-loaded");
|
||
|
}
|
||
|
$tw.boot.execStartup = function(options){
|
||
|
// Unpack plugin tiddlers
|
||
|
$tw.wiki.readPluginInfo();
|
||
|
$tw.wiki.registerPluginTiddlers("plugin",$tw.safeMode ? ["$:/core"] : undefined);
|
||
|
$tw.wiki.unpackPluginTiddlers();
|
||
|
// Process "safe mode"
|
||
|
if($tw.safeMode) {
|
||
|
$tw.wiki.processSafeMode();
|
||
|
}
|
||
|
// 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
|
||
|
if($tw.crypto) {
|
||
|
$tw.crypto.updateCryptoStateTiddler();
|
||
|
}
|
||
|
// Gather up any startup modules
|
||
|
$tw.boot.remainingStartupModules = []; // Array of startup modules
|
||
|
$tw.modules.forEachModuleOfType("startup",function(title,module) {
|
||
|
if(module.startup) {
|
||
|
$tw.boot.remainingStartupModules.push(module);
|
||
|
}
|
||
|
});
|
||
|
// Keep track of the startup tasks that have been executed
|
||
|
$tw.boot.executedStartupModules = Object.create(null);
|
||
|
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
|
||
|
// Repeatedly execute the next eligible task
|
||
|
$tw.boot.executeNextStartupTask(options.callback);
|
||
|
}
|
||
|
/*
|
||
|
Startup TiddlyWiki
|
||
|
*/
|
||
|
$tw.boot.startup = function(options) {
|
||
|
options = options || {};
|
||
|
// Get the URL hash and check for safe mode
|
||
|
$tw.boot.initStartup(options);
|
||
|
$tw.boot.loadStartup(options);
|
||
|
$tw.boot.execStartup(options);
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Add another unload task
|
||
|
*/
|
||
|
$tw.addUnloadTask = function(task) {
|
||
|
if($tw.unloadTasks.indexOf(task) === -1) {
|
||
|
$tw.unloadTasks.push(task);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
Execute the remaining eligible startup tasks
|
||
|
*/
|
||
|
$tw.boot.executeNextStartupTask = function(callback) {
|
||
|
// Find the next eligible task
|
||
|
var taskIndex = 0, task,
|
||
|
asyncTaskCallback = function() {
|
||
|
if(task.name) {
|
||
|
$tw.boot.executedStartupModules[task.name] = true;
|
||
|
}
|
||
|
return $tw.boot.executeNextStartupTask(callback);
|
||
|
};
|
||
|
while(taskIndex < $tw.boot.remainingStartupModules.length) {
|
||
|
task = $tw.boot.remainingStartupModules[taskIndex];
|
||
|
if($tw.boot.isStartupTaskEligible(task)) {
|
||
|
// Remove this task from the list
|
||
|
$tw.boot.remainingStartupModules.splice(taskIndex,1);
|
||
|
// Assemble log message
|
||
|
var s = ["Startup task:",task.name];
|
||
|
if(task.platforms) {
|
||
|
s.push("platforms:",task.platforms.join(","));
|
||
|
}
|
||
|
if(task.after) {
|
||
|
s.push("after:",task.after.join(","));
|
||
|
}
|
||
|
if(task.before) {
|
||
|
s.push("before:",task.before.join(","));
|
||
|
}
|
||
|
$tw.boot.log(s.join(" "));
|
||
|
// Execute task
|
||
|
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
|
||
|
task.startup();
|
||
|
if(task.name) {
|
||
|
$tw.boot.executedStartupModules[task.name] = true;
|
||
|
}
|
||
|
return $tw.boot.executeNextStartupTask(callback);
|
||
|
} else {
|
||
|
task.startup(asyncTaskCallback);
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
taskIndex++;
|
||
|
}
|
||
|
if(typeof callback === 'function') {
|
||
|
callback();
|
||
|
}
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Returns true if we are running on one of the platforms specified in taskModule's
|
||
|
`platforms` array; or if `platforms` property is not defined.
|
||
|
*/
|
||
|
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
||
|
var platforms = taskModule.platforms;
|
||
|
if(platforms) {
|
||
|
for(var t=0; t<platforms.length; t++) {
|
||
|
switch (platforms[t]) {
|
||
|
case "browser":
|
||
|
if ($tw.browser) {
|
||
|
return true;
|
||
|
}
|
||
|
break;
|
||
|
case "node":
|
||
|
if ($tw.node) {
|
||
|
return true;
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
$tw.utils.error("Module " + taskModule.name + ": '" + platforms[t] + "' in export.platforms invalid");
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
};
|
||
|
|
||
|
$tw.boot.isStartupTaskEligible = function(taskModule) {
|
||
|
var t;
|
||
|
// Check that the platform is correct
|
||
|
if(!$tw.boot.doesTaskMatchPlatform(taskModule)) {
|
||
|
return false;
|
||
|
}
|
||
|
var name = taskModule.name,
|
||
|
remaining = $tw.boot.remainingStartupModules;
|
||
|
if(name) {
|
||
|
// Fail if this module is disabled
|
||
|
if($tw.boot.disabledStartupModules.indexOf(name) !== -1) {
|
||
|
return false;
|
||
|
}
|
||
|
// Check that no other outstanding tasks must be executed before this one
|
||
|
for(t=0; t<remaining.length; t++) {
|
||
|
var task = remaining[t];
|
||
|
if(task.before && task.before.indexOf(name) !== -1) {
|
||
|
if($tw.boot.doesTaskMatchPlatform(task) && (!task.name || $tw.boot.disabledStartupModules.indexOf(task.name) === -1)) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// Check that all of the tasks that we must be performed after has been done
|
||
|
var after = taskModule.after;
|
||
|
if(after) {
|
||
|
for(t=0; t<after.length; t++) {
|
||
|
if(!$tw.boot.executedStartupModules[after[t]]) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Global Hooks mechanism which allows plugins to modify default functionality
|
||
|
*/
|
||
|
$tw.hooks = $tw.hooks || { names: {}};
|
||
|
|
||
|
/*
|
||
|
Add hooks to the hashmap
|
||
|
*/
|
||
|
$tw.hooks.addHook = function(hookName,definition) {
|
||
|
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
||
|
$tw.hooks.names[hookName].push(definition);
|
||
|
}
|
||
|
else {
|
||
|
$tw.hooks.names[hookName] = [definition];
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Invoke the hook by key
|
||
|
*/
|
||
|
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
||
|
var args = Array.prototype.slice.call(arguments,1);
|
||
|
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
||
|
for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
|
||
|
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
|
||
|
}
|
||
|
}
|
||
|
return args[0];
|
||
|
};
|
||
|
|
||
|
/////////////////////////// Main boot function to decrypt tiddlers and then startup
|
||
|
|
||
|
$tw.boot.boot = function(callback) {
|
||
|
// Initialise crypto object
|
||
|
$tw.crypto = new $tw.utils.Crypto();
|
||
|
// Initialise password prompter
|
||
|
if($tw.browser && !$tw.node) {
|
||
|
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
|
||
|
}
|
||
|
// Preload any encrypted tiddlers
|
||
|
$tw.boot.decryptEncryptedTiddlers(function() {
|
||
|
// Startup
|
||
|
$tw.boot.startup({callback: callback});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/////////////////////////// Autoboot in the browser
|
||
|
|
||
|
if($tw.browser && !$tw.boot.suppressBoot) {
|
||
|
$tw.boot.boot();
|
||
|
}
|
||
|
|
||
|
return $tw;
|
||
|
|
||
|
});
|
||
|
|
||
|
if(typeof(exports) !== "undefined") {
|
||
|
exports.TiddlyWiki = _boot;
|
||
|
} else {
|
||
|
_boot(window.$tw);
|
||
|
}
|
||
|
//# sourceURL=$:/boot/boot.js
|
||
|
</script>
|
||
|
</div>
|
||
|
<!--~~ Raw markup for the bottom of the body section ~~-->
|
||
|
|
||
|
</body>
|
||
|
</html>
|