tiddlywiki 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +9 -2
- package/bin/build-site.sh +25 -5
- package/bin/ci-test.sh +16 -0
- package/boot/boot.js +18 -7
- package/core/images/new-journal-button.tid +1 -3
- package/core/language/en-GB/Exporters.multids +1 -1
- package/core/language/en-GB/Help/commands.tid +1 -1
- package/core/language/en-GB/Help/savewikifolder.tid +2 -2
- package/core/language/en-GB/Help/server.tid +1 -1
- package/core/language/en-GB/Types/image_svg_xml.tid +1 -1
- package/core/language/en-GB/Types/image_x-icon.tid +1 -1
- package/core/modules/commands/savetiddlers.js +1 -1
- package/core/modules/editor/engines/framed.js +1 -1
- package/core/modules/editor/engines/simple.js +1 -1
- package/core/modules/filters/all.js +5 -5
- package/core/modules/filters/encodings.js +6 -2
- package/core/modules/filters/json-ops.js +95 -1
- package/core/modules/filters/listops.js +1 -0
- package/core/modules/parsers/textparser.js +5 -4
- package/core/modules/parsers/wikiparser/rules/conditional.js +120 -0
- package/core/modules/parsers/wikiparser/rules/fnprocdef.js +2 -2
- package/core/modules/parsers/wikiparser/rules/parameters.js +1 -1
- package/core/modules/parsers/wikiparser/wikiparser.js +31 -8
- package/core/modules/savers/github.js +1 -1
- package/core/modules/startup/rootwidget.js +1 -0
- package/core/modules/startup/startup.js +5 -0
- package/core/modules/startup/windows.js +2 -1
- package/core/modules/syncer.js +160 -122
- package/core/modules/utils/dom/dom.js +3 -3
- package/core/modules/utils/dom/dragndrop.js +4 -2
- package/core/modules/utils/dom/http.js +19 -3
- package/core/modules/utils/fakedom.js +5 -1
- package/core/modules/utils/utils.js +27 -4
- package/core/modules/widgets/browse.js +10 -0
- package/core/modules/widgets/button.js +15 -3
- package/core/modules/widgets/checkbox.js +14 -1
- package/core/modules/widgets/draggable.js +16 -5
- package/core/modules/widgets/droppable.js +14 -2
- package/core/modules/widgets/image.js +19 -14
- package/core/modules/widgets/importvariables.js +1 -1
- package/core/modules/widgets/link.js +12 -2
- package/core/modules/widgets/list.js +176 -19
- package/core/modules/widgets/radio.js +4 -0
- package/core/modules/widgets/range.js +4 -0
- package/core/modules/widgets/scrollable.js +66 -1
- package/core/modules/widgets/select.js +35 -23
- package/core/modules/widgets/transclude.js +88 -45
- package/core/modules/widgets/widget.js +42 -47
- package/core/modules/wiki.js +3 -3
- package/core/templates/html-json-skinny-tiddler.tid +0 -1
- package/core/templates/html-json-tiddler.tid +1 -1
- package/core/templates/store.area.template.html.tid +4 -4
- package/core/ui/AlertTemplate.tid +1 -0
- package/core/ui/ControlPanel/Basics.tid +2 -2
- package/core/ui/EditTemplate/body/default.tid +12 -8
- package/core/ui/EditTemplate/fields.tid +2 -2
- package/core/ui/EditTemplate/type.tid +1 -1
- package/core/ui/EditTemplate.tid +1 -0
- package/core/ui/EditorToolbar/preview.tid +6 -0
- package/core/ui/ImportPreviews/Text.tid +1 -0
- package/core/ui/PageStylesheet.tid +1 -0
- package/core/ui/PageTemplate.tid +2 -1
- package/core/ui/RootTemplate.tid +1 -0
- package/core/ui/StoryTiddlerTemplate.tid +1 -0
- package/core/ui/ViewTemplate/body/default.tid +1 -0
- package/core/ui/ViewTemplate/subtitle.tid +2 -5
- package/core/ui/ViewTemplate.tid +1 -0
- package/core/wiki/config/OfficialPluginLibrary.tid +1 -1
- package/core/wiki/config/ViewTemplateBodyFilters.multids +2 -1
- package/core/wiki/macros/colour-picker.tid +6 -6
- package/core/wiki/macros/image-picker.tid +5 -5
- package/core/wiki/macros/list.tid +95 -78
- package/core/wiki/macros/tabs.tid +9 -1
- package/core/wiki/macros/tag-picker.tid +2 -2
- package/core/wiki/macros/tag.tid +2 -1
- package/core/wiki/macros/toc.tid +3 -3
- package/core/wiki/tags/ViewTemplateBodyFilter.tid +1 -2
- package/editions/de-AT/tiddlers/HelloThere.tid +2 -2
- package/editions/de-AT/tiddlers/community/Fur_Entwickler.tid +1 -1
- package/editions/de-AT/tiddlers/external/tiddlywiki.files +1 -1
- package/editions/de-AT-server/tiddlers/system/favicon.png +0 -0
- package/editions/{es-ES-server/tiddlers/system/favicon.ico.meta → de-AT-server/tiddlers/system/favicon.png.meta} +1 -1
- package/editions/dev/tiddlers/images/favicon.png +0 -0
- package/editions/{de-AT-server/tiddlers/system/favicon.ico.meta → dev/tiddlers/images/favicon.png.meta} +1 -1
- package/editions/dev/tiddlers/new/HookMechanism.tid +28 -3
- package/editions/empty/tiddlywiki.info +5 -2
- package/editions/es-ES/tiddlers/Forums.tid +4 -5
- package/editions/es-ES/tiddlers/HelloThere.tid +2 -2
- package/editions/es-ES/tiddlers/Typography.tid +1 -1
- package/editions/es-ES/tiddlers/images/favicon.png +0 -0
- package/editions/{dev/tiddlers/images/favicon.ico.meta → es-ES/tiddlers/images/favicon.png.meta} +1 -1
- package/editions/es-ES/tiddlers/images/green_favicon.png +0 -0
- package/editions/es-ES/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
- package/editions/es-ES-server/tiddlers/system/favicon.png +0 -0
- package/editions/{es-ES/tiddlers/images/favicon.ico.meta → es-ES-server/tiddlers/system/favicon.png.meta} +1 -1
- package/editions/fr-FR/tiddlers/images/favicon.png +0 -0
- package/editions/fr-FR/tiddlers/images/favicon.png.meta +2 -0
- package/editions/fr-FR/tiddlers/images/green_favicon.png +0 -0
- package/editions/fr-FR/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
- package/editions/fr-FR-server/tiddlers/system/favicon.png +0 -0
- package/editions/fr-FR-server/tiddlers/system/favicon.png.meta +2 -0
- package/editions/highlightdemo/tiddlywiki.info +1 -1
- package/editions/ja-JP/tiddlers/images/favicon.png +0 -0
- package/editions/ja-JP/tiddlers/images/favicon.png.meta +2 -0
- package/editions/ja-JP/tiddlers/images/green_favicon.png +0 -0
- package/editions/ja-JP/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
- package/editions/katexdemo/tiddlywiki.info +1 -1
- package/editions/ko-KR/tiddlers/images/favicon.png +0 -0
- package/editions/ko-KR/tiddlers/images/favicon.png.meta +2 -0
- package/editions/ko-KR/tiddlers/images/green_favicon.png +0 -0
- package/editions/ko-KR/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
- package/editions/ko-KR-server/tiddlers/system/favicon.png +0 -0
- package/editions/ko-KR-server/tiddlers/system/favicon.png.meta +2 -0
- package/editions/pluginlibrary/tiddlywiki.info +2 -2
- package/editions/prerelease/tiddlers/{Release 5.3.1.tid → Release 5.3.3.tid } +23 -21
- package/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid +1 -1
- package/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid +1 -1
- package/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid +1 -1
- package/editions/prerelease/tiddlers/system/favicon.png +0 -0
- package/editions/prerelease/tiddlers/system/favicon.png.meta +2 -0
- package/editions/prerelease/tiddlers/system/temp-my-scroll-position.tid +3 -0
- package/editions/resumebuilder/tiddlywiki.info +1 -1
- package/editions/server/tiddlywiki.info +1 -1
- package/editions/server-external-js/tiddlywiki.info +1 -1
- package/editions/test/playwright.spec.js +25 -0
- package/editions/test/tiddlers/tests/data/conditionals/Basic.tid +26 -0
- package/editions/test/tiddlers/tests/data/conditionals/BlockMode.tid +37 -0
- package/editions/test/tiddlers/tests/data/conditionals/Else.tid +26 -0
- package/editions/test/tiddlers/tests/data/conditionals/Elseif.tid +32 -0
- package/editions/test/tiddlers/tests/data/conditionals/MissingEndIf.tid +26 -0
- package/editions/test/tiddlers/tests/data/conditionals/MultipleResults.tid +12 -0
- package/editions/test/tiddlers/tests/data/conditionals/Nested.tid +38 -0
- package/editions/test/tiddlers/tests/data/conditionals/NestedElseif.tid +60 -0
- package/editions/test/tiddlers/tests/data/functions/IndentedFunctions.tid +24 -0
- package/editions/test/tiddlers/tests/data/functions/WikifiedFunctions.tid +1 -1
- package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgets.tid +23 -0
- package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgets2.tid +22 -0
- package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgetsAndMacros.tid +29 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithExplicitTemplates.tid +29 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithExplicitTemplatesInBlockMode.tid +32 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithExplicitTemplatesOverriddenByAttributes.tid +33 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithJoinTemplate.tid +30 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithJoinTemplateInBlockMode.tid +32 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithLimit.tid +25 -0
- package/editions/test/tiddlers/tests/data/list-widget/WithMissingTemplate.tid +26 -0
- package/editions/test/tiddlers/tests/data/procedures/Nested-indented.tid +20 -0
- package/editions/test/tiddlers/tests/data/procedures/TrailingNewlines.tid +22 -0
- package/editions/test/tiddlers/tests/data/transclude/CustomWidget-CodeblockOverride-TextParser.tid +20 -0
- package/editions/test/tiddlers/tests/data/transclude/CustomWidget-Simple-Indented.tid +33 -0
- package/editions/test/tiddlers/tests/data/transclude/Parameterised-Shortcut-ParametersIndented.tid +20 -0
- package/editions/test/tiddlers/tests/data/transclude/Procedures-Double-Underscore.tid +26 -0
- package/editions/test/tiddlers/tests/data/transclude/Variable-Refreshing.tid +27 -0
- package/editions/test/tiddlers/tests/data/transclude/Variable-Static.tid +15 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/ButtonWidget-DataAttributes.tid +27 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/CheckboxWidget-DataAttributes.tid +22 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/DraggableWidget-DataAttributes.tid +27 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/DroppableWidget-DataAttributes.tid +27 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/LinkWidget-DataAttributes.tid +27 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/OrderedStyleAttributes.tid +15 -0
- package/editions/test/tiddlers/tests/data/widgets/DataAttributes/SelectWidget-DataAttributes.tid +27 -0
- package/editions/test/tiddlers/tests/data/widgets/ElementWidgetEventAttributes.tid +15 -0
- package/editions/test/tiddlers/tests/data/widgets/ElementWidgetStyleAttributes.tid +15 -0
- package/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid +5 -3
- package/editions/test/tiddlers/tests/test-filters.js +5 -4
- package/editions/test/tiddlers/tests/test-json-filters.js +40 -0
- package/editions/test/tiddlers/tests/test-utils.js +23 -0
- package/editions/test/tiddlers/tests/test-widget.js +62 -0
- package/editions/tw.org/tiddlers/$__favicon.ico.png +0 -0
- package/editions/tw.org/tiddlywiki.info +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/classic.tiddlywiki.com.png +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/{classic.tiddlywiki.com.ico.meta → classic.tiddlywiki.com.png.meta} +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/links.tiddlywiki.org.png +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/{links.tiddlywiki.org.ico.meta → links.tiddlywiki.org.png.meta} +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.dev.png +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.dev.ico.meta → tiddlywiki.com.dev.png.meta} +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.png +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.ico.meta → tiddlywiki.com.png.meta} +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.prerelease.png +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.prerelease.ico.meta → tiddlywiki.com.prerelease.png.meta} +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.upgrade.png +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.upgrade.ico.meta → tiddlywiki.com.upgrade.png.meta} +1 -1
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.org.png +0 -0
- package/editions/tw5.com/tiddlers/about/Archive.tid +82 -0
- package/editions/tw5.com/tiddlers/community/Chinese Community.tid +20 -0
- package/editions/tw5.com/tiddlers/community/editions/Tidme by oflg.tid +16 -0
- package/editions/tw5.com/tiddlers/community/plugins/FSRS4TW by oflg.tid +10 -0
- package/editions/tw5.com/tiddlers/community/resources/TiddlyWiki Posts.tid +3 -3
- package/editions/tw5.com/tiddlers/community/resources/_Timimi_ Extension and executable by Riz.tid +3 -1
- package/editions/tw5.com/tiddlers/community/tutorials/GitHub Saver Tutorial by Mohammad.tid +5 -5
- package/editions/tw5.com/tiddlers/concepts/Macros.tid +7 -3
- package/editions/tw5.com/tiddlers/concepts/Title List.tid +5 -1
- package/editions/tw5.com/tiddlers/definitions/Git.tid +9 -0
- package/editions/tw5.com/tiddlers/definitions/GitHub.tid +6 -4
- package/editions/tw5.com/tiddlers/definitions/GitLab.tid +13 -0
- package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid +2 -0
- package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid +11 -1
- package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid +2 -0
- package/editions/tw5.com/tiddlers/filters/decodebase64 Operator.tid +6 -1
- package/editions/tw5.com/tiddlers/filters/encodebase64 Operator.tid +6 -1
- package/editions/tw5.com/tiddlers/filters/examples/jsonset.tid +59 -0
- package/editions/tw5.com/tiddlers/filters/examples/jsonstringify Operator (Examples).tid +7 -5
- package/editions/tw5.com/tiddlers/filters/examples/stringify_Operator_(Examples).tid +5 -3
- package/editions/tw5.com/tiddlers/filters/jsonextract.tid +8 -0
- package/editions/tw5.com/tiddlers/filters/jsonget.tid +8 -0
- package/editions/tw5.com/tiddlers/filters/jsonset.tid +64 -0
- package/editions/tw5.com/tiddlers/filters/jsonstringify Operator.tid +14 -15
- package/editions/tw5.com/tiddlers/filters/jsontype.tid +8 -0
- package/editions/tw5.com/tiddlers/filters/stringify_Operator.tid +12 -15
- package/editions/tw5.com/tiddlers/filters/substitute Operator.tid +3 -3
- package/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid +1 -1
- package/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +6 -1
- package/editions/tw5.com/tiddlers/howtos/Constructing JSON tiddlers.tid +3 -3
- package/editions/tw5.com/tiddlers/images/Favicon template.svg +296 -0
- package/editions/tw5.com/tiddlers/images/Favicon template.svg.meta +3 -0
- package/editions/tw5.com/tiddlers/images/New Release Banner.png +0 -0
- package/editions/tw5.com/tiddlers/images/{New Release Banner.jpg.meta → New Release Banner.png.meta } +1 -1
- package/editions/tw5.com/tiddlers/images/favicon.png +0 -0
- package/editions/tw5.com/tiddlers/images/favicon.png.meta +2 -0
- package/editions/tw5.com/tiddlers/images/green_favicon.png +0 -0
- package/editions/tw5.com/tiddlers/images/green_favicon.png.meta +2 -0
- package/editions/tw5.com/tiddlers/macros/CoreMacros.tid +1 -1
- package/editions/tw5.com/tiddlers/macros/TagMacro.tid +3 -1
- package/editions/tw5.com/tiddlers/macros/examples/tag.tid +22 -1
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Random Dog.tid +90 -0
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Zotero.tid +4 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid +4 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid +4 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-window.tid +12 -5
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-permalink.tid +1 -1
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid +3 -3
- package/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid +2 -2
- package/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid +2 -2
- package/editions/tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid +7 -3
- package/editions/tw5.com/tiddlers/pragmas/Pragmas.tid +3 -1
- package/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid +4 -2
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.0.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.1.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.10.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.11.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.12.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.13.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.14.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.15.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.16.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.17.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.18.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.19.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.2.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.20.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.21.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.22.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.23.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.3.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.4.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.5.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.6.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.7.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.8.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.9.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.0.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.1.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.2.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.3.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.4.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.5.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.6.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.7.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.0.tid +1 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.1.tid +87 -0
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.2.tid +184 -0
- package/editions/tw5.com/tiddlers/releasenotes/Releases.tid +4 -2
- package/editions/tw5.com/tiddlers/releasenotes/TiddlyWiki Releases.tid +1 -1
- package/editions/tw5.com/tiddlers/{Saving on Browser with TiddlyStow.tid → saving/Saving on Browser with TiddlyStow.tid } +2 -2
- package/editions/tw5.com/tiddlers/saving/Saving to a Git service.tid +5 -1
- package/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid +8 -11
- package/editions/tw5.com/tiddlers/system/tw5.com-styles.tid +5 -0
- package/editions/tw5.com/tiddlers/systemtags/SystemTag_ $__tags_Macro.tid +1 -1
- package/editions/tw5.com/tiddlers/variables/Behaviour of invoked variables depends on how the variable was declared.tid +52 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter expression function call.tid +10 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter operator parameter.tid +11 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via normal wikitext.tid +11 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via widget attributes.tid +11 -0
- package/editions/tw5.com/tiddlers/variables/Variable Usage.tid +5 -49
- package/editions/tw5.com/tiddlers/widgets/ActionListopsWidget.tid +24 -2
- package/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid +2 -2
- package/editions/tw5.com/tiddlers/widgets/BrowseWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/ButtonWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/Custom Widgets.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid +3 -2
- package/editions/tw5.com/tiddlers/widgets/DroppableWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid +1 -1
- package/editions/tw5.com/tiddlers/widgets/ImageWidget.tid +2 -1
- package/editions/tw5.com/tiddlers/widgets/LinkWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/ListWidget.tid +27 -2
- package/editions/tw5.com/tiddlers/widgets/RadioWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/RangeWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/ScrollableWidget.tid +27 -2
- package/editions/tw5.com/tiddlers/widgets/SelectWidget.tid +4 -1
- package/editions/tw5.com/tiddlers/widgets/SetWidget.tid +17 -1
- package/editions/tw5.com/tiddlers/widgets/TranscludeWidget.tid +2 -2
- package/editions/tw5.com/tiddlers/widgets/examples/ActionListopsWidget (Examples).tid +12 -1
- package/editions/tw5.com/tiddlers/wikitext/Anchor Links using HTML.tid +1 -1
- package/editions/tw5.com/tiddlers/wikitext/Conditional Shortcut Syntax.tid +62 -0
- package/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid +52 -19
- package/editions/tw5.com/tiddlers/wikitext/Transclusion and Substitution.tid +3 -3
- package/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid +5 -2
- package/editions/tw5.com/tiddlers/wikitext/Widget Attributes.tid +8 -3
- package/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid +1 -0
- package/editions/tw5.com/tiddlywiki.info +9 -3
- package/editions/tw5.com-server/tiddlers/system/tiddlywiki.com.server.png +0 -0
- package/editions/tw5.com-server/tiddlers/system/tiddlywiki.com.server.png.meta +2 -0
- package/editions/zh-Hans/tiddlers/images/favicon.png +0 -0
- package/editions/zh-Hans/tiddlers/images/favicon.png.meta +2 -0
- package/editions/zh-Hans/tiddlers/images/green_favicon.png +0 -0
- package/editions/zh-Hans/tiddlers/images/green_favicon.png.meta +2 -0
- package/editions/zh-Hant/tiddlers/images/favicon.png +0 -0
- package/editions/zh-Hant/tiddlers/images/favicon.png.meta +2 -0
- package/editions/zh-Hant/tiddlers/images/green_favicon.png +0 -0
- package/editions/zh-Hant/tiddlers/images/green_favicon.png.meta +2 -0
- package/languages/de-DE/Exporters.multids +1 -1
- package/languages/de-DE/Help/commands.tid +2 -2
- package/languages/de-DE/Help/server.tid +1 -1
- package/languages/de-DE/Types/image_x-icon.tid +1 -1
- package/languages/es-ES/Buttons.multids +2 -0
- package/languages/es-ES/Fields.multids +4 -0
- package/languages/es-ES/Help/listen.tid +1 -1
- package/languages/es-ES/Help/savewikifolder.tid +16 -1
- package/languages/es-ES/Help/server.tid +1 -1
- package/languages/es-ES/Misc.multids +3 -0
- package/languages/es-ES/SiteTitle.tid +1 -1
- package/languages/pl-PL/Exporters.multids +1 -1
- package/languages/pl-PL/Help/commands.tid +1 -1
- package/languages/pl-PL/Help/savewikifolder.tid +19 -4
- package/languages/pl-PL/Help/server.tid +1 -1
- package/languages/zh-Hans/Exporters.multids +1 -1
- package/languages/zh-Hans/Help/commands.tid +1 -1
- package/languages/zh-Hans/Help/savewikifolder.tid +5 -1
- package/languages/zh-Hans/Help/server.tid +1 -1
- package/languages/zh-Hans/Types/image_svg_xml.tid +1 -1
- package/languages/zh-Hans/Types/image_x-icon.tid +1 -1
- package/languages/zh-Hant/Exporters.multids +1 -1
- package/languages/zh-Hant/Help/commands.tid +1 -1
- package/languages/zh-Hant/Help/savewikifolder.tid +5 -1
- package/languages/zh-Hant/Help/server.tid +1 -1
- package/languages/zh-Hant/Types/image_svg_xml.tid +1 -1
- package/languages/zh-Hant/Types/image_x-icon.tid +1 -1
- package/licenses/cla-individual.md +20 -0
- package/package.json +4 -1
- package/playwright.config.js +46 -0
- package/plugins/tiddlywiki/codemirror/styles.tid +5 -0
- package/plugins/tiddlywiki/comments/styles.tid +8 -8
- package/plugins/tiddlywiki/dynannotate/docs/readme.tid +1 -0
- package/plugins/tiddlywiki/dynannotate/modules/dynannotate.js +28 -27
- package/plugins/tiddlywiki/evernote/modules/enex-deserializer.js +82 -23
- package/plugins/tiddlywiki/evernote/readme.tid +1 -0
- package/plugins/tiddlywiki/evernote/samples/sample-enex-with-image.xml.enex +2 -2
- package/plugins/tiddlywiki/googleanalytics/googleanalytics.js +1 -1
- package/plugins/tiddlywiki/googleanalytics/settings.tid +1 -3
- package/plugins/tiddlywiki/jasmine/jasmine-plugin.js +9 -2
- package/plugins/tiddlywiki/jasmine/run-wiki-based-tests.js +1 -1
- package/plugins/tiddlywiki/jasmine/startup.js +2 -1
- package/plugins/tiddlywiki/qrcode/barcodereader.js +90 -0
- package/plugins/tiddlywiki/qrcode/docs/barcodereader.tid +44 -0
- package/plugins/tiddlywiki/qrcode/{doc/usage.tid → docs/makeqr.tid} +4 -4
- package/plugins/tiddlywiki/qrcode/docs.tid +3 -0
- package/plugins/tiddlywiki/qrcode/{MakeContactQR.tid → examples/make/MakeContactQR.tid} +1 -1
- package/plugins/tiddlywiki/qrcode/{MakeGenericQR.tid → examples/make/MakeGenericQR.tid} +1 -1
- package/plugins/tiddlywiki/qrcode/{MakeWifiQR.tid → examples/make/MakeWifiQR.tid} +1 -1
- package/plugins/tiddlywiki/qrcode/examples/make/make.tid +5 -0
- package/plugins/tiddlywiki/qrcode/examples/read/BarCodeReader.tid +17 -0
- package/plugins/tiddlywiki/qrcode/examples/read/read.tid +5 -0
- package/plugins/tiddlywiki/qrcode/examples.tid +3 -0
- package/plugins/tiddlywiki/qrcode/files/html5-qrcode/LICENSE +201 -0
- package/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md +398 -0
- package/plugins/tiddlywiki/qrcode/files/html5-qrcode/html5-qrcode.min.js +1 -0
- package/plugins/tiddlywiki/qrcode/files/tiddlywiki.files +20 -4
- package/plugins/tiddlywiki/qrcode/makeqr.js +1 -1
- package/plugins/tiddlywiki/qrcode/plugin.info +1 -1
- package/plugins/tiddlywiki/qrcode/readme.tid +15 -0
- package/plugins/tiddlywiki/tiddlyweb/html-json-skinny-tiddler.tid +0 -1
- package/plugins/tiddlywiki/tiddlyweb/html-json-tiddler.tid +1 -2
- package/plugins/tiddlywiki/upgrade/UpgradeWizard.tid +2 -2
- package/plugins/tiddlywiki/upgrade/favicon.png +0 -0
- package/plugins/tiddlywiki/upgrade/favicon.png.meta +2 -0
- package/readme.md +1 -1
- package/themes/tiddlywiki/vanilla/base.tid +45 -14
- package/themes/tiddlywiki/vanilla/settings.multids +1 -1
- package/editions/de-AT-server/tiddlers/system/favicon.ico +0 -0
- package/editions/dev/tiddlers/images/favicon.ico +0 -0
- package/editions/es-ES/tiddlers/images/favicon.ico +0 -0
- package/editions/es-ES/tiddlers/images/green_favicon.ico +0 -0
- package/editions/es-ES-server/tiddlers/system/favicon.ico +0 -0
- package/editions/fr-FR/tiddlers/images/favicon.ico +0 -0
- package/editions/fr-FR/tiddlers/images/favicon.ico.meta +0 -2
- package/editions/fr-FR/tiddlers/images/green_favicon.ico +0 -0
- package/editions/fr-FR-server/tiddlers/system/favicon.ico +0 -0
- package/editions/fr-FR-server/tiddlers/system/favicon.ico.meta +0 -2
- package/editions/ja-JP/tiddlers/images/favicon.ico +0 -0
- package/editions/ja-JP/tiddlers/images/favicon.ico.meta +0 -2
- package/editions/ja-JP/tiddlers/images/green_favicon.ico +0 -0
- package/editions/ko-KR/tiddlers/images/favicon.ico +0 -0
- package/editions/ko-KR/tiddlers/images/favicon.ico.meta +0 -2
- package/editions/ko-KR/tiddlers/images/green_favicon.ico +0 -0
- package/editions/ko-KR-server/tiddlers/system/favicon.ico +0 -0
- package/editions/ko-KR-server/tiddlers/system/favicon.ico.meta +0 -2
- package/editions/prerelease/tiddlers/system/favicon.ico +0 -0
- package/editions/prerelease/tiddlers/system/favicon.ico.meta +0 -2
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/classic.tiddlywiki.com.ico +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/links.tiddlywiki.org.ico +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.dev.ico +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.ico +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.prerelease.ico +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.upgrade.ico +0 -0
- package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.org.ico +0 -0
- package/editions/tw5.com/tiddlers/community/editions/TiddlyMemo by oflg.tid +0 -16
- package/editions/tw5.com/tiddlers/community/tutorials/Install and run TiddlyWiki on a CentOS 6 VPS using Nginx.tid +0 -16
- package/editions/tw5.com/tiddlers/images/New Release Banner.jpg +0 -0
- package/editions/tw5.com/tiddlers/images/favicon.ico +0 -0
- package/editions/tw5.com/tiddlers/images/favicon.ico.meta +0 -2
- package/editions/tw5.com/tiddlers/images/green_favicon.ico +0 -0
- package/editions/tw5.com/tiddlers/images/green_favicon.ico.meta +0 -2
- package/editions/tw5.com-server/tiddlers/system/favicon.ico +0 -0
- package/editions/tw5.com-server/tiddlers/system/favicon.ico.meta +0 -2
- package/editions/zh-Hans/tiddlers/images/favicon.ico +0 -0
- package/editions/zh-Hans/tiddlers/images/favicon.ico.meta +0 -2
- package/editions/zh-Hans/tiddlers/images/green_favicon.ico +0 -0
- package/editions/zh-Hans/tiddlers/images/green_favicon.ico.meta +0 -2
- package/editions/zh-Hant/tiddlers/images/favicon.ico +0 -0
- package/editions/zh-Hant/tiddlers/images/favicon.ico.meta +0 -2
- package/editions/zh-Hant/tiddlers/images/green_favicon.ico +0 -0
- package/editions/zh-Hant/tiddlers/images/green_favicon.ico.meta +0 -2
- package/plugins/tiddlywiki/qrcode/doc/examples.tid +0 -3
- package/plugins/tiddlywiki/qrcode/doc/readme.tid +0 -13
- package/plugins/tiddlywiki/upgrade/favicon.ico +0 -0
- package/plugins/tiddlywiki/upgrade/favicon.ico.meta +0 -2
- /package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.org.ico.meta → tiddlywiki.org.png.meta} +0 -0
- /package/plugins/tiddlywiki/qrcode/files/{LICENSE → qrcode/LICENSE} +0 -0
- /package/plugins/tiddlywiki/qrcode/files/{README.md → qrcode/README.md} +0 -0
- /package/plugins/tiddlywiki/qrcode/files/{qrcode.js → qrcode/qrcode.js} +0 -0
@@ -194,6 +194,7 @@ Parse any pragmas at the beginning of a block of parse text
|
|
194
194
|
WikiParser.prototype.parsePragmas = function() {
|
195
195
|
var currentTreeBranch = this.tree;
|
196
196
|
while(true) {
|
197
|
+
var savedPos = this.pos;
|
197
198
|
// Skip whitespace
|
198
199
|
this.skipWhitespace();
|
199
200
|
// Check for the end of the text
|
@@ -204,6 +205,7 @@ WikiParser.prototype.parsePragmas = function() {
|
|
204
205
|
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
205
206
|
// If not, just exit
|
206
207
|
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
208
|
+
this.pos = savedPos;
|
207
209
|
break;
|
208
210
|
}
|
209
211
|
// Process the pragma rule
|
@@ -223,7 +225,7 @@ Parse a block from the current position
|
|
223
225
|
terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
|
224
226
|
*/
|
225
227
|
WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
226
|
-
var terminatorRegExp = terminatorRegExpString ? new RegExp(
|
228
|
+
var terminatorRegExp = terminatorRegExpString ? new RegExp(terminatorRegExpString + "|\\r?\\n\\r?\\n","mg") : /(\r?\n\r?\n)/mg;
|
227
229
|
this.skipWhitespace();
|
228
230
|
if(this.pos >= this.sourceLength) {
|
229
231
|
return [];
|
@@ -264,11 +266,21 @@ WikiParser.prototype.parseBlocksUnterminated = function() {
|
|
264
266
|
};
|
265
267
|
|
266
268
|
/*
|
267
|
-
Parse blocks of text until a terminating regexp is encountered
|
269
|
+
Parse blocks of text until a terminating regexp is encountered. Wrapper for parseBlocksTerminatedExtended that just returns the parse tree
|
268
270
|
*/
|
269
271
|
WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
270
|
-
var
|
271
|
-
|
272
|
+
var ex = this.parseBlocksTerminatedExtended(terminatorRegExpString);
|
273
|
+
return ex.tree;
|
274
|
+
};
|
275
|
+
|
276
|
+
/*
|
277
|
+
Parse blocks of text until a terminating regexp is encountered
|
278
|
+
*/
|
279
|
+
WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpString) {
|
280
|
+
var terminatorRegExp = new RegExp(terminatorRegExpString,"mg"),
|
281
|
+
result = {
|
282
|
+
tree: []
|
283
|
+
};
|
272
284
|
// Skip any whitespace
|
273
285
|
this.skipWhitespace();
|
274
286
|
// Check if we've got the end marker
|
@@ -277,7 +289,7 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
|
277
289
|
// Parse the text into blocks
|
278
290
|
while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
|
279
291
|
var blocks = this.parseBlock(terminatorRegExpString);
|
280
|
-
tree.push.apply(tree,blocks);
|
292
|
+
result.tree.push.apply(result.tree,blocks);
|
281
293
|
// Skip any whitespace
|
282
294
|
this.skipWhitespace();
|
283
295
|
// Check if we've got the end marker
|
@@ -286,8 +298,9 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
|
286
298
|
}
|
287
299
|
if(match && match.index === this.pos) {
|
288
300
|
this.pos = match.index + match[0].length;
|
301
|
+
result.match = match;
|
289
302
|
}
|
290
|
-
return
|
303
|
+
return result;
|
291
304
|
};
|
292
305
|
|
293
306
|
/*
|
@@ -330,6 +343,11 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|
330
343
|
};
|
331
344
|
|
332
345
|
WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
|
346
|
+
var ex = this.parseInlineRunTerminatedExtended(terminatorRegExp,options);
|
347
|
+
return ex.tree;
|
348
|
+
};
|
349
|
+
|
350
|
+
WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegExp,options) {
|
333
351
|
options = options || {};
|
334
352
|
var tree = [];
|
335
353
|
// Find the next occurrence of the terminator
|
@@ -349,7 +367,10 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|
349
367
|
if(options.eatTerminator) {
|
350
368
|
this.pos += terminatorMatch[0].length;
|
351
369
|
}
|
352
|
-
return
|
370
|
+
return {
|
371
|
+
match: terminatorMatch,
|
372
|
+
tree: tree
|
373
|
+
};
|
353
374
|
}
|
354
375
|
}
|
355
376
|
// Process any inline rule, along with the text preceding it
|
@@ -373,7 +394,9 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|
373
394
|
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
374
395
|
}
|
375
396
|
this.pos = this.sourceLength;
|
376
|
-
return
|
397
|
+
return {
|
398
|
+
tree: tree
|
399
|
+
};
|
377
400
|
};
|
378
401
|
|
379
402
|
/*
|
@@ -31,7 +31,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
|
31
31
|
headers = {
|
32
32
|
"Accept": "application/vnd.github.v3+json",
|
33
33
|
"Content-Type": "application/json;charset=UTF-8",
|
34
|
-
"Authorization": "Basic " +
|
34
|
+
"Authorization": "Basic " + $tw.utils.base64Encode(username + ":" + password),
|
35
35
|
"If-None-Match": ""
|
36
36
|
};
|
37
37
|
// Bail if we don't have everything we need
|
@@ -27,6 +27,11 @@ exports.startup = function() {
|
|
27
27
|
if($tw.browser) {
|
28
28
|
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
29
29
|
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
30
|
+
// 2023-07-21 Edge returns UA below. So we use "isChromeLike"
|
31
|
+
//'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/114.0.0.0 safari/537.36 edg/114.0.1823.82'
|
32
|
+
$tw.browser.isChromeLike = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
33
|
+
$tw.browser.hasTouch = !!window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
34
|
+
$tw.browser.isMobileChrome = $tw.browser.isChromeLike && $tw.browser.hasTouch;
|
30
35
|
}
|
31
36
|
// Platform detection
|
32
37
|
$tw.platform = {};
|
@@ -40,7 +40,7 @@ exports.startup = function() {
|
|
40
40
|
variables = $tw.utils.extend({},paramObject,{currentTiddler: title, "tv-window-id": windowID});
|
41
41
|
// Open the window
|
42
42
|
var srcWindow,
|
43
|
-
|
43
|
+
srcDocument;
|
44
44
|
// In case that popup blockers deny opening a new window
|
45
45
|
try {
|
46
46
|
srcWindow = window.open("","external-" + windowID,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
|
@@ -52,6 +52,7 @@ exports.startup = function() {
|
|
52
52
|
$tw.windows[windowID] = srcWindow;
|
53
53
|
// Check for reopening the same window
|
54
54
|
if(srcWindow.haveInitialisedWindow) {
|
55
|
+
srcWindow.focus();
|
55
56
|
return;
|
56
57
|
}
|
57
58
|
// Initialise the document
|
package/core/modules/syncer.js
CHANGED
@@ -24,7 +24,7 @@ Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
|
|
24
24
|
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
|
25
25
|
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
|
26
26
|
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
|
27
|
-
Syncer.prototype.taskTimerInterval =
|
27
|
+
Syncer.prototype.taskTimerInterval = 0.25 * 1000; // Interval for sync timer
|
28
28
|
Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...
|
29
29
|
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
|
30
30
|
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
|
@@ -74,9 +74,11 @@ function Syncer(options) {
|
|
74
74
|
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
|
75
75
|
// Timers
|
76
76
|
this.taskTimerId = null; // Timer for task dispatch
|
77
|
-
this.pollTimerId = null; // Timer for polling server
|
78
77
|
// Number of outstanding requests
|
79
78
|
this.numTasksInProgress = 0;
|
79
|
+
// True when we want to force an immediate sync from the server
|
80
|
+
this.forceSyncFromServer = false;
|
81
|
+
this.timestampLastSyncFromServer = new Date();
|
80
82
|
// Listen out for changes to tiddlers
|
81
83
|
this.wiki.addEventListener("change",function(changes) {
|
82
84
|
// Filter the changes to just include ones that are being synced
|
@@ -203,33 +205,37 @@ Syncer.prototype.readTiddlerInfo = function() {
|
|
203
205
|
Checks whether the wiki is dirty (ie the window shouldn't be closed)
|
204
206
|
*/
|
205
207
|
Syncer.prototype.isDirty = function() {
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
var
|
211
|
-
|
212
|
-
|
213
|
-
if(
|
214
|
-
|
215
|
-
|
208
|
+
var self = this;
|
209
|
+
function checkIsDirty() {
|
210
|
+
// Check tiddlers that are in the store and included in the filter function
|
211
|
+
var titles = self.getSyncedTiddlers();
|
212
|
+
for(var index=0; index<titles.length; index++) {
|
213
|
+
var title = titles[index],
|
214
|
+
tiddlerInfo = self.tiddlerInfo[title];
|
215
|
+
if(self.wiki.tiddlerExists(title)) {
|
216
|
+
if(tiddlerInfo) {
|
217
|
+
// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server
|
218
|
+
if(self.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
219
|
+
return true;
|
220
|
+
}
|
221
|
+
} else {
|
222
|
+
// If the tiddler isn't known on the server then it needs to be saved to the server
|
216
223
|
return true;
|
217
224
|
}
|
218
|
-
} else {
|
219
|
-
// If the tiddler isn't known on the server then it needs to be saved to the server
|
220
|
-
return true;
|
221
225
|
}
|
222
226
|
}
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
227
|
+
// Check tiddlers that are known from the server but not currently in the store
|
228
|
+
titles = Object.keys(self.tiddlerInfo);
|
229
|
+
for(index=0; index<titles.length; index++) {
|
230
|
+
if(!self.wiki.tiddlerExists(titles[index])) {
|
231
|
+
// There must be a pending delete
|
232
|
+
return true;
|
233
|
+
}
|
230
234
|
}
|
235
|
+
return false;
|
231
236
|
}
|
232
|
-
|
237
|
+
var dirtyStatus = checkIsDirty();
|
238
|
+
return dirtyStatus;
|
233
239
|
};
|
234
240
|
|
235
241
|
/*
|
@@ -293,92 +299,16 @@ Syncer.prototype.getStatus = function(callback) {
|
|
293
299
|
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
|
294
300
|
*/
|
295
301
|
Syncer.prototype.syncFromServer = function() {
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
clearTimeout(self.pollTimerId);
|
300
|
-
self.pollTimerId = null;
|
301
|
-
}
|
302
|
-
},
|
303
|
-
triggerNextSync = function() {
|
304
|
-
self.pollTimerId = setTimeout(function() {
|
305
|
-
self.pollTimerId = null;
|
306
|
-
self.syncFromServer.call(self);
|
307
|
-
},self.pollTimerInterval);
|
308
|
-
},
|
309
|
-
syncSystemFromServer = (self.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
|
310
|
-
if(this.syncadaptor && this.syncadaptor.getUpdatedTiddlers) {
|
311
|
-
this.logger.log("Retrieving updated tiddler list");
|
312
|
-
cancelNextSync();
|
313
|
-
this.syncadaptor.getUpdatedTiddlers(self,function(err,updates) {
|
314
|
-
triggerNextSync();
|
315
|
-
if(err) {
|
316
|
-
self.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
317
|
-
return;
|
318
|
-
}
|
319
|
-
if(updates) {
|
320
|
-
$tw.utils.each(updates.modifications,function(title) {
|
321
|
-
self.titlesToBeLoaded[title] = true;
|
322
|
-
});
|
323
|
-
$tw.utils.each(updates.deletions,function(title) {
|
324
|
-
if(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {
|
325
|
-
delete self.tiddlerInfo[title];
|
326
|
-
self.logger.log("Deleting tiddler missing from server:",title);
|
327
|
-
self.wiki.deleteTiddler(title);
|
328
|
-
}
|
329
|
-
});
|
330
|
-
if(updates.modifications.length > 0 || updates.deletions.length > 0) {
|
331
|
-
self.processTaskQueue();
|
332
|
-
}
|
333
|
-
}
|
334
|
-
});
|
335
|
-
} else if(this.syncadaptor && this.syncadaptor.getSkinnyTiddlers) {
|
336
|
-
this.logger.log("Retrieving skinny tiddler list");
|
337
|
-
cancelNextSync();
|
338
|
-
this.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {
|
339
|
-
triggerNextSync();
|
340
|
-
// Check for errors
|
341
|
-
if(err) {
|
342
|
-
self.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
343
|
-
return;
|
344
|
-
}
|
345
|
-
// Keep track of which tiddlers we already know about have been reported this time
|
346
|
-
var previousTitles = Object.keys(self.tiddlerInfo);
|
347
|
-
// Process each incoming tiddler
|
348
|
-
for(var t=0; t<tiddlers.length; t++) {
|
349
|
-
// Get the incoming tiddler fields, and the existing tiddler
|
350
|
-
var tiddlerFields = tiddlers[t],
|
351
|
-
incomingRevision = tiddlerFields.revision + "",
|
352
|
-
tiddler = self.wiki.tiddlerExists(tiddlerFields.title) && self.wiki.getTiddler(tiddlerFields.title),
|
353
|
-
tiddlerInfo = self.tiddlerInfo[tiddlerFields.title],
|
354
|
-
currRevision = tiddlerInfo ? tiddlerInfo.revision : null,
|
355
|
-
indexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);
|
356
|
-
if(indexInPreviousTitles !== -1) {
|
357
|
-
previousTitles.splice(indexInPreviousTitles,1);
|
358
|
-
}
|
359
|
-
// Ignore the incoming tiddler if it's the same as the revision we've already got
|
360
|
-
if(currRevision !== incomingRevision) {
|
361
|
-
// Only load the skinny version if we don't already have a fat version of the tiddler
|
362
|
-
if(!tiddler || tiddler.fields.text === undefined) {
|
363
|
-
self.storeTiddler(tiddlerFields);
|
364
|
-
}
|
365
|
-
// Do a full load of this tiddler
|
366
|
-
self.titlesToBeLoaded[tiddlerFields.title] = true;
|
367
|
-
}
|
368
|
-
}
|
369
|
-
// Delete any tiddlers that were previously reported but missing this time
|
370
|
-
$tw.utils.each(previousTitles,function(title) {
|
371
|
-
if(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {
|
372
|
-
delete self.tiddlerInfo[title];
|
373
|
-
self.logger.log("Deleting tiddler missing from server:",title);
|
374
|
-
self.wiki.deleteTiddler(title);
|
375
|
-
}
|
376
|
-
});
|
377
|
-
self.processTaskQueue();
|
378
|
-
});
|
302
|
+
if(this.canSyncFromServer()) {
|
303
|
+
this.forceSyncFromServer = true;
|
304
|
+
this.processTaskQueue();
|
379
305
|
}
|
380
306
|
};
|
381
307
|
|
308
|
+
Syncer.prototype.canSyncFromServer = function() {
|
309
|
+
return !!this.syncadaptor.getUpdatedTiddlers || !!this.syncadaptor.getSkinnyTiddlers;
|
310
|
+
}
|
311
|
+
|
382
312
|
/*
|
383
313
|
Force load a tiddler from the server
|
384
314
|
*/
|
@@ -510,7 +440,7 @@ Syncer.prototype.processTaskQueue = function() {
|
|
510
440
|
} else {
|
511
441
|
self.updateDirtyStatus();
|
512
442
|
// Process the next task
|
513
|
-
self.processTaskQueue.call(self);
|
443
|
+
self.processTaskQueue.call(self);
|
514
444
|
}
|
515
445
|
});
|
516
446
|
} else {
|
@@ -518,31 +448,39 @@ Syncer.prototype.processTaskQueue = function() {
|
|
518
448
|
this.updateDirtyStatus();
|
519
449
|
// And trigger a timeout if there is a pending task
|
520
450
|
if(task === true) {
|
521
|
-
this.triggerTimeout();
|
451
|
+
this.triggerTimeout(this.taskTimerInterval);
|
452
|
+
} else if(this.canSyncFromServer()) {
|
453
|
+
this.triggerTimeout(this.pollTimerInterval);
|
522
454
|
}
|
523
455
|
}
|
524
456
|
} else {
|
525
|
-
this.updateDirtyStatus();
|
457
|
+
this.updateDirtyStatus();
|
458
|
+
this.triggerTimeout(this.taskTimerInterval);
|
526
459
|
}
|
527
460
|
};
|
528
461
|
|
529
462
|
Syncer.prototype.triggerTimeout = function(interval) {
|
530
463
|
var self = this;
|
531
|
-
if(
|
532
|
-
this.taskTimerId
|
533
|
-
self.taskTimerId = null;
|
534
|
-
self.processTaskQueue.call(self);
|
535
|
-
},interval || self.taskTimerInterval);
|
464
|
+
if(this.taskTimerId) {
|
465
|
+
clearTimeout(this.taskTimerId);
|
536
466
|
}
|
467
|
+
this.taskTimerId = setTimeout(function() {
|
468
|
+
self.taskTimerId = null;
|
469
|
+
self.processTaskQueue.call(self);
|
470
|
+
},interval || self.taskTimerInterval);
|
537
471
|
};
|
538
472
|
|
539
473
|
/*
|
540
|
-
Choose the next sync task. We prioritise saves, then deletes, then loads from the server
|
474
|
+
Choose the next sync task. We prioritise saves to the server, then getting updates from the server, then deletes to the server, then loads from the server
|
541
475
|
|
542
|
-
Returns either
|
476
|
+
Returns either:
|
477
|
+
* a task object
|
478
|
+
* the boolean true if there are pending sync tasks that aren't yet due
|
479
|
+
* null if there's no pending sync tasks (just the next poll)
|
543
480
|
*/
|
544
481
|
Syncer.prototype.chooseNextTask = function() {
|
545
|
-
var
|
482
|
+
var now = new Date(),
|
483
|
+
thresholdLastSaved = now - this.throttleInterval,
|
546
484
|
havePending = null;
|
547
485
|
// First we look for tiddlers that have been modified locally and need saving back to the server
|
548
486
|
var titles = this.getSyncedTiddlers();
|
@@ -556,14 +494,18 @@ Syncer.prototype.chooseNextTask = function() {
|
|
556
494
|
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
557
495
|
if(hasChanged) {
|
558
496
|
if(isReadyToSave) {
|
559
|
-
return new SaveTiddlerTask(this,title);
|
497
|
+
return new SaveTiddlerTask(this,title);
|
560
498
|
} else {
|
561
499
|
havePending = true;
|
562
500
|
}
|
563
501
|
}
|
564
502
|
}
|
565
503
|
}
|
566
|
-
// Second
|
504
|
+
// Second we check for an outstanding sync from server
|
505
|
+
if(this.forceSyncFromServer || (this.timestampLastSyncFromServer && (now.valueOf() >= (this.timestampLastSyncFromServer.valueOf() + this.pollTimerInterval)))) {
|
506
|
+
return new SyncFromServerTask(this);
|
507
|
+
}
|
508
|
+
// Third, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server
|
567
509
|
titles = Object.keys(this.tiddlerInfo);
|
568
510
|
for(index=0; index<titles.length; index++) {
|
569
511
|
title = titles[index];
|
@@ -573,13 +515,13 @@ Syncer.prototype.chooseNextTask = function() {
|
|
573
515
|
return new DeleteTiddlerTask(this,title);
|
574
516
|
}
|
575
517
|
}
|
576
|
-
//
|
518
|
+
// Finally, check for tiddlers that need loading
|
577
519
|
title = Object.keys(this.titlesToBeLoaded)[0];
|
578
520
|
if(title) {
|
579
521
|
delete this.titlesToBeLoaded[title];
|
580
522
|
return new LoadTiddlerTask(this,title);
|
581
523
|
}
|
582
|
-
// No tasks are ready
|
524
|
+
// No tasks are ready now, but might be in the future
|
583
525
|
return havePending;
|
584
526
|
};
|
585
527
|
|
@@ -589,6 +531,10 @@ function SaveTiddlerTask(syncer,title) {
|
|
589
531
|
this.type = "save";
|
590
532
|
}
|
591
533
|
|
534
|
+
SaveTiddlerTask.prototype.toString = function() {
|
535
|
+
return "SAVE " + this.title;
|
536
|
+
}
|
537
|
+
|
592
538
|
SaveTiddlerTask.prototype.run = function(callback) {
|
593
539
|
var self = this,
|
594
540
|
changeCount = this.syncer.wiki.getChangeCount(this.title),
|
@@ -613,7 +559,6 @@ SaveTiddlerTask.prototype.run = function(callback) {
|
|
613
559
|
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
614
560
|
});
|
615
561
|
} else {
|
616
|
-
this.syncer.logger.log(" Not Dispatching 'save' task:",this.title,"tiddler does not exist");
|
617
562
|
$tw.utils.nextTick(callback(null));
|
618
563
|
}
|
619
564
|
};
|
@@ -624,6 +569,10 @@ function DeleteTiddlerTask(syncer,title) {
|
|
624
569
|
this.type = "delete";
|
625
570
|
}
|
626
571
|
|
572
|
+
DeleteTiddlerTask.prototype.toString = function() {
|
573
|
+
return "DELETE " + this.title;
|
574
|
+
}
|
575
|
+
|
627
576
|
DeleteTiddlerTask.prototype.run = function(callback) {
|
628
577
|
var self = this;
|
629
578
|
this.syncer.logger.log("Dispatching 'delete' task:",this.title);
|
@@ -647,6 +596,10 @@ function LoadTiddlerTask(syncer,title) {
|
|
647
596
|
this.type = "load";
|
648
597
|
}
|
649
598
|
|
599
|
+
LoadTiddlerTask.prototype.toString = function() {
|
600
|
+
return "LOAD " + this.title;
|
601
|
+
}
|
602
|
+
|
650
603
|
LoadTiddlerTask.prototype.run = function(callback) {
|
651
604
|
var self = this;
|
652
605
|
this.syncer.logger.log("Dispatching 'load' task:",this.title);
|
@@ -664,6 +617,91 @@ LoadTiddlerTask.prototype.run = function(callback) {
|
|
664
617
|
});
|
665
618
|
};
|
666
619
|
|
620
|
+
function SyncFromServerTask(syncer) {
|
621
|
+
this.syncer = syncer;
|
622
|
+
this.type = "syncfromserver";
|
623
|
+
}
|
624
|
+
|
625
|
+
SyncFromServerTask.prototype.toString = function() {
|
626
|
+
return "SYNCFROMSERVER";
|
627
|
+
}
|
628
|
+
|
629
|
+
SyncFromServerTask.prototype.run = function(callback) {
|
630
|
+
var self = this;
|
631
|
+
var syncSystemFromServer = (self.syncer.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
|
632
|
+
var successCallback = function() {
|
633
|
+
self.syncer.forceSyncFromServer = false;
|
634
|
+
self.syncer.timestampLastSyncFromServer = new Date();
|
635
|
+
callback(null);
|
636
|
+
};
|
637
|
+
if(this.syncer.syncadaptor.getUpdatedTiddlers) {
|
638
|
+
this.syncer.syncadaptor.getUpdatedTiddlers(self.syncer,function(err,updates) {
|
639
|
+
if(err) {
|
640
|
+
self.syncer.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
641
|
+
return callback(err);
|
642
|
+
}
|
643
|
+
if(updates) {
|
644
|
+
$tw.utils.each(updates.modifications,function(title) {
|
645
|
+
self.syncer.titlesToBeLoaded[title] = true;
|
646
|
+
});
|
647
|
+
$tw.utils.each(updates.deletions,function(title) {
|
648
|
+
if(syncSystemFromServer || !self.syncer.wiki.isSystemTiddler(title)) {
|
649
|
+
delete self.syncer.tiddlerInfo[title];
|
650
|
+
self.syncer.logger.log("Deleting tiddler missing from server:",title);
|
651
|
+
self.syncer.wiki.deleteTiddler(title);
|
652
|
+
}
|
653
|
+
});
|
654
|
+
}
|
655
|
+
return successCallback();
|
656
|
+
});
|
657
|
+
} else if(this.syncer.syncadaptor.getSkinnyTiddlers) {
|
658
|
+
this.syncer.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {
|
659
|
+
// Check for errors
|
660
|
+
if(err) {
|
661
|
+
self.syncer.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
662
|
+
return callback(err);
|
663
|
+
}
|
664
|
+
// Keep track of which tiddlers we already know about have been reported this time
|
665
|
+
var previousTitles = Object.keys(self.syncer.tiddlerInfo);
|
666
|
+
// Process each incoming tiddler
|
667
|
+
for(var t=0; t<tiddlers.length; t++) {
|
668
|
+
// Get the incoming tiddler fields, and the existing tiddler
|
669
|
+
var tiddlerFields = tiddlers[t],
|
670
|
+
incomingRevision = tiddlerFields.revision + "",
|
671
|
+
tiddler = self.syncer.wiki.tiddlerExists(tiddlerFields.title) && self.syncer.wiki.getTiddler(tiddlerFields.title),
|
672
|
+
tiddlerInfo = self.syncer.tiddlerInfo[tiddlerFields.title],
|
673
|
+
currRevision = tiddlerInfo ? tiddlerInfo.revision : null,
|
674
|
+
indexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);
|
675
|
+
if(indexInPreviousTitles !== -1) {
|
676
|
+
previousTitles.splice(indexInPreviousTitles,1);
|
677
|
+
}
|
678
|
+
// Ignore the incoming tiddler if it's the same as the revision we've already got
|
679
|
+
if(currRevision !== incomingRevision) {
|
680
|
+
// Only load the skinny version if we don't already have a fat version of the tiddler
|
681
|
+
if(!tiddler || tiddler.fields.text === undefined) {
|
682
|
+
self.syncer.storeTiddler(tiddlerFields);
|
683
|
+
}
|
684
|
+
// Do a full load of this tiddler
|
685
|
+
self.syncer.titlesToBeLoaded[tiddlerFields.title] = true;
|
686
|
+
}
|
687
|
+
}
|
688
|
+
// Delete any tiddlers that were previously reported but missing this time
|
689
|
+
$tw.utils.each(previousTitles,function(title) {
|
690
|
+
if(syncSystemFromServer || !self.syncer.wiki.isSystemTiddler(title)) {
|
691
|
+
delete self.syncer.tiddlerInfo[title];
|
692
|
+
self.syncer.logger.log("Deleting tiddler missing from server:",title);
|
693
|
+
self.syncer.wiki.deleteTiddler(title);
|
694
|
+
}
|
695
|
+
});
|
696
|
+
self.syncer.forceSyncFromServer = false;
|
697
|
+
self.syncer.timestampLastSyncFromServer = new Date();
|
698
|
+
return successCallback();
|
699
|
+
});
|
700
|
+
} else {
|
701
|
+
return successCallback();
|
702
|
+
}
|
703
|
+
};
|
704
|
+
|
667
705
|
exports.Syncer = Syncer;
|
668
706
|
|
669
707
|
})();
|
@@ -313,7 +313,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|
313
313
|
variables["dom-" + attribute.name] = attribute.value.toString();
|
314
314
|
});
|
315
315
|
|
316
|
-
if(selectedNode
|
316
|
+
if("offsetLeft" in selectedNode) {
|
317
317
|
// Add variables with a (relative and absolute) popup coordinate string for the selected node
|
318
318
|
var nodeRect = {
|
319
319
|
left: selectedNode.offsetLeft,
|
@@ -338,12 +338,12 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|
338
338
|
}
|
339
339
|
}
|
340
340
|
|
341
|
-
if(domNode && domNode
|
341
|
+
if(domNode && ("offsetWidth" in domNode)) {
|
342
342
|
variables["tv-widgetnode-width"] = domNode.offsetWidth.toString();
|
343
343
|
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
|
344
344
|
}
|
345
345
|
|
346
|
-
if(event &&
|
346
|
+
if(event && ("clientX" in event) && ("clientY" in event)) {
|
347
347
|
if(selectedNode) {
|
348
348
|
// Add variables for event X and Y position relative to selected node
|
349
349
|
selectedNodeRect = selectedNode.getBoundingClientRect();
|
@@ -80,7 +80,7 @@ exports.makeDraggable = function(options) {
|
|
80
80
|
if(dataTransfer.setDragImage) {
|
81
81
|
if(dragImageType === "pill") {
|
82
82
|
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
83
|
-
} else if
|
83
|
+
} else if(dragImageType === "blank") {
|
84
84
|
dragImage.removeChild(dragImage.firstChild);
|
85
85
|
dataTransfer.setDragImage(dragImage,0,0);
|
86
86
|
} else {
|
@@ -106,7 +106,9 @@ exports.makeDraggable = function(options) {
|
|
106
106
|
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
107
107
|
dataTransfer.setData("text/plain",titleString);
|
108
108
|
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
109
|
-
}
|
109
|
+
}
|
110
|
+
// If browser is Chrome-like and has a touch-input device do NOT .setData
|
111
|
+
if(!($tw.browser.isMobileChrome)) {
|
110
112
|
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
111
113
|
}
|
112
114
|
dataTransfer.setData("Text",titleString);
|
@@ -90,6 +90,7 @@ wiki: wiki to be used for executing action strings
|
|
90
90
|
url: URL for request
|
91
91
|
method: method eg GET, POST
|
92
92
|
body: text of request body
|
93
|
+
binary: set to "yes" to force binary processing of response payload
|
93
94
|
oncompletion: action string to be invoked on completion
|
94
95
|
onprogress: action string to be invoked on progress updates
|
95
96
|
bindStatus: optional title of tiddler to which status ("pending", "complete", "error") should be written
|
@@ -106,10 +107,11 @@ function HttpClientRequest(options) {
|
|
106
107
|
this.wiki = options.wiki;
|
107
108
|
this.completionActions = options.oncompletion;
|
108
109
|
this.progressActions = options.onprogress;
|
109
|
-
this.bindStatus = options["
|
110
|
-
this.bindProgress = options["
|
110
|
+
this.bindStatus = options["bindStatus"];
|
111
|
+
this.bindProgress = options["bindProgress"];
|
111
112
|
this.method = options.method || "GET";
|
112
113
|
this.body = options.body || "";
|
114
|
+
this.binary = options.binary || "";
|
113
115
|
this.variables = options.variables;
|
114
116
|
var url = options.url;
|
115
117
|
$tw.utils.each(options.queryStrings,function(value,name) {
|
@@ -132,7 +134,7 @@ HttpClientRequest.prototype.send = function(callback) {
|
|
132
134
|
var self = this,
|
133
135
|
setBinding = function(title,text) {
|
134
136
|
if(title) {
|
135
|
-
|
137
|
+
self.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
|
136
138
|
}
|
137
139
|
};
|
138
140
|
if(this.url) {
|
@@ -156,6 +158,8 @@ HttpClientRequest.prototype.send = function(callback) {
|
|
156
158
|
type: this.method,
|
157
159
|
headers: this.requestHeaders,
|
158
160
|
data: this.body,
|
161
|
+
returnProp: this.binary === "" ? "responseText" : "response",
|
162
|
+
responseType: this.binary === "" ? "text" : "arraybuffer",
|
159
163
|
callback: function(err,data,xhr) {
|
160
164
|
var hasSucceeded = xhr.status >= 200 && xhr.status < 300,
|
161
165
|
completionCode = hasSucceeded ? "complete" : "error",
|
@@ -175,6 +179,16 @@ HttpClientRequest.prototype.send = function(callback) {
|
|
175
179
|
data: (data || "").toString(),
|
176
180
|
headers: JSON.stringify(headers)
|
177
181
|
};
|
182
|
+
/* Convert data from binary to base64 */
|
183
|
+
if (xhr.responseType === "arraybuffer") {
|
184
|
+
var binary = "",
|
185
|
+
bytes = new Uint8Array(data),
|
186
|
+
len = bytes.byteLength;
|
187
|
+
for (var i=0; i<len; i++) {
|
188
|
+
binary += String.fromCharCode(bytes[i]);
|
189
|
+
}
|
190
|
+
resultVariables.data = $tw.utils.base64Encode(binary,true);
|
191
|
+
}
|
178
192
|
self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getTiddler(requestTrackerTitle),{
|
179
193
|
status: completionCode,
|
180
194
|
}));
|
@@ -212,6 +226,7 @@ Make an HTTP request. Options are:
|
|
212
226
|
callback: function invoked with (err,data,xhr)
|
213
227
|
progress: optional function invoked with (lengthComputable,loaded,total)
|
214
228
|
returnProp: string name of the property to return as first argument of callback
|
229
|
+
responseType: "text" or "arraybuffer"
|
215
230
|
*/
|
216
231
|
exports.httpRequest = function(options) {
|
217
232
|
var type = options.type || "GET",
|
@@ -264,6 +279,7 @@ exports.httpRequest = function(options) {
|
|
264
279
|
}
|
265
280
|
}
|
266
281
|
}
|
282
|
+
request.responseType = options.responseType || "text";
|
267
283
|
// Set up the state change handler
|
268
284
|
request.onreadystatechange = function() {
|
269
285
|
if(this.readyState === 4) {
|