diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d7f1a5566..000000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: node_js - - "node" - -stages: - - name: test - - name: build-prerelease - if: branch = "master" - - name: build-tiddlywiki-com - if: branch = "tiddlywiki-com" - -jobs: - include: - - stage: test - script: ./bin/test.sh - - stage: build-prerelease - script: - - ./bin/travis-pre-build.sh - - export TW5_BUILD_TIDDLYWIKI='./tiddlywiki.js' - - export TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number) - - export TW5_BUILD_DETAILS="Prerelease built from branch '$TRAVIS_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" - - export TW5_BUILD_MAIN_EDITION='./editions/prerelease' - - export TW5_BUILD_OUTPUT='./output/prerelease' - - ./bin/build-site.sh - - ./bin/travis-push.sh - - stage: build-tiddlywiki-com - script: - - ./bin/travis-pre-build.sh - - export TW5_BUILD_TIDDLYWIKI='./node_modules/tiddlywiki/tiddlywiki.js' - - export TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number) - - export TW5_BUILD_DETAILS="Built from branch '$TRAVIS_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" - - export TW5_BUILD_MAIN_EDITION='./editions/tw5.com' - - export TW5_BUILD_OUTPUT='./output' - - ./bin/build-site.sh - - ./bin/travis-push.sh diff --git a/bin/2bld.cmd b/bin/2bld.cmd new file mode 100644 index 000000000..9d18f6327 --- /dev/null +++ b/bin/2bld.cmd @@ -0,0 +1,15 @@ +@echo off + +rem build TiddlyWiki 2.x + +rem cook the TiddlyWiki 2.x.x index file + +node .\tiddlywiki.js ^ + editions\tw2 ^ + --verbose ^ + --output tmp\tw2 ^ + --load editions\tw2\source\tiddlywiki.com\index.html.recipe ^ + --rendertiddler $:/core/templates/tiddlywiki2.template.html index.html text/plain ^ + || exit 1 + +fc tmp\tw2\index.html editions\tw2\target\prebuilt.html diff --git a/bin/2bld.sh b/bin/2bld.sh new file mode 100755 index 000000000..530466540 --- /dev/null +++ b/bin/2bld.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# build TiddlyWiki 2.x + +# cook the TiddlyWiki 2.x.x index file + +node ./tiddlywiki.js \ + editions/tw2 \ + --verbose \ + --output tmp/tw2 \ + --load editions/tw2/source/tiddlywiki.com/index.html.recipe \ + --rendertiddler $:/core/templates/tiddlywiki2.template.html index.html text/plain \ + || exit 1 + +diff -q tmp/tw2/index.html editions/tw2/target/prebuilt.html diff --git a/bin/build-site.sh b/bin/build-site.sh deleted file mode 100755 index ba2fd80ec..000000000 --- a/bin/build-site.sh +++ /dev/null @@ -1,449 +0,0 @@ -#!/bin/bash - -# Build all tiddlywiki.com assets. - -# Default to the current version number for building the plugin library - -if [ -z "$TW5_BUILD_VERSION" ]; then - TW5_BUILD_VERSION=v5.1.21 -fi - -echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" - -# Default to using tw5.com as the main edition for /index.html - -if [ -z "$TW5_BUILD_MAIN_EDITION" ]; then - TW5_BUILD_MAIN_EDITION=./editions/tw5.com -fi - -echo "Using TW5_BUILD_MAIN_EDITION as [$TW5_BUILD_MAIN_EDITION]" - -# Default to the version of TiddlyWiki installed in this repo - -if [ -z "$TW5_BUILD_TIDDLYWIKI" ]; then - TW5_BUILD_TIDDLYWIKI=./tiddlywiki.js -fi - -echo "Using TW5_BUILD_TIDDLYWIKI as [$TW5_BUILD_TIDDLYWIKI]" - -# Set up the build details - -if [ -z "$TW5_BUILD_DETAILS" ]; then - TW5_BUILD_DETAILS="$(git symbolic-ref --short HEAD)-$(git rev-parse HEAD) from $(git remote get-url origin)" -fi - -echo "Using TW5_BUILD_DETAILS as [$TW5_BUILD_DETAILS]" - -if [ -z "$TW5_BUILD_COMMIT" ]; then - TW5_BUILD_COMMIT="$(git rev-parse HEAD)" -fi - -echo "Using TW5_BUILD_COMMIT as [$TW5_BUILD_COMMIT]" - -# Set up the build output directory - -if [ -z "$TW5_BUILD_OUTPUT" ]; then - TW5_BUILD_OUTPUT=./output -fi - -mkdir -p $TW5_BUILD_OUTPUT - -if [ ! -d "$TW5_BUILD_OUTPUT" ]; then - echo 'A valid TW5_BUILD_OUTPUT environment variable must be set' - exit 1 -fi - -echo "Using TW5_BUILD_OUTPUT as [$TW5_BUILD_OUTPUT]" - -echo "Build details: $TW5_BUILD_DETAILS" - -# Make the CNAME file that GitHub Pages requires - -echo "tiddlywiki.com" > $TW5_BUILD_OUTPUT/CNAME - -# Delete any existing static content - -mkdir -p $TW5_BUILD_OUTPUT/static -mkdir -p $TW5_BUILD_OUTPUT/dev -mkdir -p $TW5_BUILD_OUTPUT/dev/static -rm $TW5_BUILD_OUTPUT/static/* -rm $TW5_BUILD_OUTPUT/dev/static/* - -# Redirects - -echo "Moved to http://tiddlywiki.com/plugins/tiddlywiki/tw2parser/index.html" > $TW5_BUILD_OUTPUT/classicparserdemo.html -echo "Moved to http://tiddlywiki.com/plugins/tiddlywiki/codemirror/index.html" > $TW5_BUILD_OUTPUT/codemirrordemo.html -echo "Moved to http://tiddlywiki.com/plugins/tiddlywiki/d3/index.html" > $TW5_BUILD_OUTPUT/d3demo.html -echo "Moved to http://tiddlywiki.com/plugins/tiddlywiki/highlight/index.html" > $TW5_BUILD_OUTPUT/highlightdemo.html -echo "Moved to http://tiddlywiki.com/plugins/tiddlywiki/markdown/index.html" > $TW5_BUILD_OUTPUT/markdowndemo.html -echo "Moved to http://tiddlywiki.com/plugins/tiddlywiki/tahoelafs/index.html" > $TW5_BUILD_OUTPUT/tahoelafs.html - -# Put the build details into a .tid file so that it can be included in each build (deleted at the end of this script) - -echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n" > $TW5_BUILD_OUTPUT/build.tid - -###################################################### -# -# Core distribution -# -###################################################### - -# /index.html Main site -# /favicon.ico Favicon for main site -# /static.html Static rendering of default tiddlers -# /alltiddlers.html Static rendering of all tiddlers -# /static/* Static single tiddlers -# /static/static.css Static stylesheet -# /static/favicon.ico Favicon for static pages -node $TW5_BUILD_TIDDLYWIKI \ - $TW5_BUILD_MAIN_EDITION \ - --verbose \ - --version \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --build favicon static index \ - || exit 1 - -# /empty.html Empty -# /empty.hta For Internet Explorer -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/empty \ - --verbose \ - --output $TW5_BUILD_OUTPUT \ - --build empty \ - || exit 1 - - -# /test.html Test edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/test \ - --verbose \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all test.html text/plain \ - || exit 1 - -# /dev/index.html Developer docs -# /dev/favicon.ico Favicon for dev site -# /dev/static.html Static rendering of default tiddlers -# /dev/alltiddlers.html Static rendering of all tiddlers -# /dev/static/* Static single tiddlers -# /dev/static/static.css Static stylesheet -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/dev \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/dev \ - --build index favicon static \ - || exit 1 - -# /upgrade.html Custom edition for performing upgrades -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/upgrade \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --build upgrade \ - || exit 1 - -# /encrypted.html Copy of the main file encrypted with the password "password" -node $TW5_BUILD_TIDDLYWIKI \ - $TW5_BUILD_MAIN_EDITION \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --build encrypted \ - || exit 1 - - -###################################################### -# -# Editions -# -###################################################### - -# /editions/xlsx-utils/index.html xlsx-utils edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/xlsx-utils \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \ - --build index \ - || exit 1 - -# /editions/resumebuilder/index.html Resume builder edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/resumebuilder \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \ - --build index \ - || exit 1 - -# /editions/text-slicer/index.html Text slicer edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/text-slicer \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/text-slicer/ \ - --build index \ - || exit 1 - -# /editions/translators/index.html Translators edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/translators \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/translators/ \ - --build index \ - || exit 1 - -# /editions/introduction/index.html Introduction edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/introduction \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/introduction/ \ - --build index \ - || exit 1 - -# /editions/full/index.html Full edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/full \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/full/ \ - --build index \ - || exit 1 - -# /editions/tw5.com-docs/index.html tiddlywiki.com docs edition -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/tw5.com-docs \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \ - --build index \ - || exit 1 - -###################################################### -# -# Plugin demos -# -###################################################### - -# /plugins/tiddlywiki/innerwiki/index.html Demo wiki with Innerwiki plugin - -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/innerwikidemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/dynaview/index.html Demo wiki with DynaView plugin -# /plugins/tiddlywiki/dynaview/empty.html Empty wiki with DynaView plugin - -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/dynaviewdemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/dynaview/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/katex/index.html Demo wiki with KaTeX plugin -# /plugins/tiddlywiki/katex/empty.html Empty wiki with KaTeX plugin - -# TODO: Build the static file with the release of 5.1.3 -# --rendertiddler $:/core/templates/static.template.html plugins/tiddlywiki/katex/static.html text/plain \ - -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/katexdemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/katex/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/tahoelafs/index.html Demo wiki with Tahoe-LAFS plugin -# /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/tahoelafs \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/tahoelafs/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/d3/index.html Demo wiki with D3 plugin -# /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/d3demo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/d3/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/codemirror/index.html Demo wiki with codemirror plugin -# /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/codemirrordemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/codemirror/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/markdown/index.html Demo wiki with Markdown plugin -# /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/markdowndemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/markdown/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/tw2parser/index.html Demo wiki with tw2parser plugin -# /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/classicparserdemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/tw2parser/empty.html text/plain \ - || exit 1 - -# /plugins/tiddlywiki/highlight/index.html Demo wiki with highlight plugin -# /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/highlightdemo \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \ - --rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \ - || exit 1 - -###################################################### -# -# Language editions -# -###################################################### - -# Delete any existing static content - -rm $TW5_BUILD_OUTPUT/languages/de-AT/static/* -rm $TW5_BUILD_OUTPUT/languages/de-DE/static/* -rm $TW5_BUILD_OUTPUT/languages/es-ES/static/* -rm $TW5_BUILD_OUTPUT/languages/fr-FR/static/* -rm $TW5_BUILD_OUTPUT/languages/ja-JP/static/* -rm $TW5_BUILD_OUTPUT/languages/ko-KR/static/* -rm $TW5_BUILD_OUTPUT/languages/zh-Hans/static/* -rm $TW5_BUILD_OUTPUT/languages/zh-Hant/static/* - -# /languages/de-AT/index.html Demo wiki with de-AT language -# /languages/de-AT/empty.html Empty wiki with de-AT language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/de-AT \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/de-AT \ - --build favicon empty static index \ - || exit 1 - -# /languages/de-DE/index.html Demo wiki with de-DE language -# /languages/de-DE/empty.html Empty wiki with de-DE language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/de-DE \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/de-DE \ - --build favicon empty static index \ - || exit 1 - -# /languages/es-ES/index.html Demo wiki with es-ES language -# /languages/es-ES/empty.html Empty wiki with es-ES language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/es-ES \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/es-ES \ - --build favicon empty static index \ - || exit 1 - -# /languages/fr-FR/index.html Demo wiki with fr-FR language -# /languages/fr-FR/empty.html Empty wiki with fr-FR language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/fr-FR \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/fr-FR \ - --build favicon empty static index \ - || exit 1 - -# /languages/ja-JP/index.html Demo wiki with ja-JP language -# /languages/ja-JP/empty.html Empty wiki with ja-JP language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/ja-JP \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/ja-JP \ - --build empty index \ - || exit 1 - -# /languages/ko-KR/index.html Demo wiki with ko-KR language -# /languages/ko-KR/empty.html Empty wiki with ko-KR language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/ko-KR \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/ko-KR \ - --build favicon empty static index \ - || exit 1 - -# /languages/zh-Hans/index.html Demo wiki with zh-Hans language -# /languages/zh-Hans/empty.html Empty wiki with zh-Hans language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/zh-Hans \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/zh-Hans \ - --build empty index \ - || exit 1 - -# /languages/zh-Hant/index.html Demo wiki with zh-Hant language -# /languages/zh-Hant/empty.html Empty wiki with zh-Hant language -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/zh-Hant \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/languages/zh-Hant \ - --build empty index \ - || exit 1 - -###################################################### -# -# Plugin library -# -###################################################### - -node $TW5_BUILD_TIDDLYWIKI \ - ./editions/pluginlibrary \ - --verbose \ - --load $TW5_BUILD_OUTPUT/build.tid \ - --output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \ - --build \ - || exit 1 - -# Delete the temporary build tiddler - -rm $TW5_BUILD_OUTPUT/build.tid || exit 1 diff --git a/bin/get-plugin-library-version-number b/bin/get-plugin-library-version-number deleted file mode 100755 index b5fcd6d81..000000000 --- a/bin/get-plugin-library-version-number +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env node - -// Extract raw version number from package.json (without the optional "-prerelease" suffix) - -if(!process.env["TW5_BUILD_TIDDLYWIKI"]) { - throw "TW5_BUILD_TIDDLYWIKI environment variable not set"; -} - -var fs = require("fs"), - path = require("path"); - -var filename = path.resolve(path.dirname(process.env["TW5_BUILD_TIDDLYWIKI"]),"./package.json"), - json = JSON.parse(fs.readFileSync(filename,"utf8")); - -if(!json.version) { - throw "Missing version number in package.json"; -} - -process.stdout.write("v" + json.version.split("-")[0]); diff --git a/bin/npm-publish.sh b/bin/npm-publish.sh deleted file mode 100755 index c37de5c24..000000000 --- a/bin/npm-publish.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# publish to npm - -./bin/clean.sh - -npm publish || exit 1 diff --git a/bin/optimise-svgs.js b/bin/optimise-svgs.js deleted file mode 100755 index 28f4f715d..000000000 --- a/bin/optimise-svgs.js +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env node - -/* -Optimise the SVGs in ./core/images using SVGO from https://github.com/svg/svgo - -Install SVGO with the following command in the root of the repo: - -npm install svgo -*/ - -"use strict"; - -var fs = require("fs"), - path = require("path"), - SVGO = require("svgo"), - svgo = new SVGO({ - plugins: [ - {cleanupAttrs: true}, - {removeDoctype: true}, - {removeXMLProcInst: true}, - {removeComments: true}, - {removeMetadata: true}, - {removeTitle: true}, - {removeDesc: true}, - {removeUselessDefs: true}, - {removeEditorsNSData: true}, - {removeEmptyAttrs: true}, - {removeHiddenElems: true}, - {removeEmptyText: true}, - {removeEmptyContainers: true}, - {removeViewBox: false}, - {cleanupEnableBackground: true}, - {convertStyleToAttrs: true}, - {convertColors: true}, - {convertPathData: true}, - {convertTransform: true}, - {removeUnknownsAndDefaults: true}, - {removeNonInheritableGroupAttrs: true}, - {removeUselessStrokeAndFill: true}, - {removeUnusedNS: true}, - {cleanupIDs: true}, - {cleanupNumericValues: true}, - {moveElemsAttrsToGroup: true}, - {moveGroupAttrsToElems: true}, - {collapseGroups: true}, - {removeRasterImages: false}, - {mergePaths: true}, - {convertShapeToPath: true}, - {sortAttrs: true}, - {removeDimensions: false}, - {removeAttrs: {attrs: "(stroke|fill)"}} - ] - }); - -var basepath = "./core/images/", - files = fs.readdirSync(basepath).sort(); - -files.forEach(function(filename) { - if(filename.slice(-4) === ".tid") { - var filepath = path.resolve(basepath,filename), - data = fs.readFileSync(filepath,"utf8"), - lines = data.split("\n"), - blankLine = lines.indexOf(""), - header = lines.slice(0,blankLine), - body = lines.slice(blankLine + 1), - fakeSVG = body.join("\n"); - // A hack to make the new-journal-button work - fakeSVG = fakeSVG.replace("<>","<<now "DD">>"); - svgo.optimize(fakeSVG, {path: filepath}).then(function(result) { - var newSVG = header.join("\n") + "\n\n" + result.data.replace("<<now "DD">>","<>"); - fs.writeFileSync(filepath,newSVG); - },function(err) { - console.log("Error " + err + " with " + filename) - process.exit(); - }); - } -}); diff --git a/bin/quick-bld.sh b/bin/quick-bld.sh deleted file mode 100755 index 63da9aacc..000000000 --- a/bin/quick-bld.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Abbreviated build script for building prerelease - -tiddlywiki editions/prerelease \ - --verbose \ - --build favicon index empty \ - || exit 1 diff --git a/bin/readme-bld.sh b/bin/readme-bld.sh deleted file mode 100755 index 198c3abd0..000000000 --- a/bin/readme-bld.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Build readmes from corresponding tiddlers - -# Default to the version of TiddlyWiki installed in this repo - -if [ -z "$TW5_BUILD_TIDDLYWIKI" ]; then - TW5_BUILD_TIDDLYWIKI=./tiddlywiki.js -fi - -# tw5.com readmes -node $TW5_BUILD_TIDDLYWIKI \ - editions/tw5.com \ - --verbose \ - --output . \ - --build readmes \ - || exit 1 diff --git a/bin/readme.md b/bin/readme.md index d2014ca6b..22cb2965e 100644 --- a/bin/readme.md +++ b/bin/readme.md @@ -1,4 +1,3 @@

Script Files

The TiddlyWiki5 repository contains several scripts in the bin folder that you can use to automate common tasks, or as a useful starting point for your own scripts. See Scripts for building tiddlywiki.com for details of the scripts used to build and release https://tiddlywiki.com/.

All the scripts expect to be run from the root folder of the repository.

serve: serves tw5.com

./bin/serve.sh -h
 ./bin/serve.sh [edition dir] [username] [password] [host] [port]

Or:

./bin/serve.cmd -h
-./bin/serve.cmd [edition dir] [username] [password] [host] [port]

This script starts TiddlyWiki5 running as an HTTP server, defaulting to the content from the tw5.com-server edition. By default, the Node.js serves on port 8080. If the optional username parameter is provided, it is used for signing edits. If the password is provided then HTTP basic authentication is used. Run the script with the -h parameter to see online help.

To experiment with this configuration, run the script and then visit http://127.0.0.1:8080 in a browser.

Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).

test: build and run tests

This script runs the test edition of TiddlyWiki on the server to perform the server-side tests and to build test.html for running the tests in the browser.

lazy: serves tw5.com with lazily loaded images

./bin/lazy.sh <username> [<password>]

Or:

./bin/lazy.cmd <username> [<password>]

This script serves the tw5.com-server edition content with LazyLoading applied to images. -

\ No newline at end of file +./bin/serve.cmd [edition dir] [username] [password] [host] [port]

This script starts TiddlyWiki5 running as an HTTP server, defaulting to the content from the tw5.com-server edition. By default, the Node.js serves on port 8080. If the optional username parameter is provided, it is used for signing edits. If the password is provided then HTTP basic authentication is used. Run the script with the -h parameter to see online help.

To experiment with this configuration, run the script and then visit http://127.0.0.1:8080 in a browser.

Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).

test: build and run tests

This script runs the test edition of TiddlyWiki on the server to perform the server-side tests and to build test.html for running the tests in the browser.

lazy: serves tw5.com with lazily loaded images

./bin/lazy.sh <username> [<password>]

Or:

./bin/lazy.cmd <username> [<password>]

This script serves the tw5.com-server edition content with LazyLoading applied to images.

2bld: builds TiddlyWiki 2.6.5

This script builds TiddlyWiki 2.6.5 from the original source and then displays the differences between them (diff is used for *nix, fc for Windows).

\ No newline at end of file diff --git a/bin/test.sh b/bin/test.sh index 2de66b1fd..38bb7fbb8 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -7,7 +7,6 @@ node ./tiddlywiki.js \ ./editions/test \ --verbose \ - --version \ --rendertiddler $:/core/save/all test.html text/plain \ || exit 1 diff --git a/bin/travis-pre-build.sh b/bin/travis-pre-build.sh deleted file mode 100755 index 6f4b0ca78..000000000 --- a/bin/travis-pre-build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Install latest current release from npm -# (we need to force because otherwise npm will refuse to install a module of the same name) - -npm --force install tiddlywiki || exit 1 - -# Pull existing GitHub pages content - -git clone --depth=1 --branch=master "https://github.com/Jermolene/jermolene.github.io.git" output diff --git a/bin/travis-push.sh b/bin/travis-push.sh deleted file mode 100755 index aa16cd73c..000000000 --- a/bin/travis-push.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Push output back to GitHub - - -cd output || exit 1 - -git config --global user.email "travis@travis-ci.org" || exit 1 - -git config --global user.name "Travis CI" || exit 1 - -git add -A . || exit 1 - -git commit --message "Travis build: $TRAVIS_BUILD_NUMBER of $TRAVIS_BRANCH ($(date +'%F %T %Z'))" || exit 1 - -git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1 - -git push deploy master &>/dev/null || exit 1 - -cd .. || exit 1 diff --git a/bin/verbump.sh b/bin/verbump.sh deleted file mode 100755 index ae4b0da80..000000000 --- a/bin/verbump.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Bump to a new version number - -if [ -z "$1" ] - then - echo "Missing version (eg '5.1.38-prerelease')" - exit 1 -fi - -# Set the new version number (will also commit and tag the release) - -npm version $1 -m "Version number update for $1" || exit 1 - -# Make sure our tags are pushed to the origin server - -git push origin --tags || exit 1 diff --git a/boot/boot.js b/boot/boot.js index d2663837c..e5b608cae 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -51,63 +51,6 @@ $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]; - }); -}; - -/* -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=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 */ @@ -146,9 +89,7 @@ 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 @@ -158,7 +99,7 @@ eventListeners: array of event listeners (this option won't work until $tw.utils */ $tw.utils.domMaker = function(tag,options) { var doc = options.document || document; - var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag); + var element = doc.createElement(tag); if(options["class"]) { element.className = options["class"]; } @@ -174,9 +115,6 @@ $tw.utils.domMaker = function(tag,options) { $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); } @@ -314,13 +252,13 @@ $tw.utils.parseDate = function(value) { // 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=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); + if(tiddler.fields["plugin-type"] === pluginType) { + titles.push(tiddler.fields.title); pluginTiddlers.splice(t,1); } } - return unregisteredTitles; + return titles; }; // Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers @@ -1356,14 +1156,8 @@ $tw.Wiki = function(options) { 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 @@ -1558,40 +1352,8 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/html","tiddlerdeserializer",{ }); $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 whitespace or control characters - if(typeof(data[f]) !== "string" || /[\x00-\x1F\s]/.test(f)) { - return false; - } - } - } - return true; - }, - isTiddlerArrayValid = function(data) { - for(var t=0; tContributing to TiddlyWiki5

We welcome contributions to the code and documentation of TiddlyWiki in several ways:

There are other ways to help TiddlyWiki too.

Contributor License Agreement

Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).

How to sign the CLA

Create a GitHub pull request to add your name to cla-individual.md or cla-entity.md, with the date in the format (YYYY/MM/DD).

step by step

  1. Navigate to licenses/CLA-individual or licenses/CLA-entity according to whether you are signing as an individual or representative of an organisation
  2. Ensure that the "branch" dropdown at the top left is set to tiddlywiki-com
  3. Click the "edit" button at the top-right corner (clicking this button will fork the project so you can edit the file)
  4. Add your name at the bottom
    • eg: Jeremy Ruston, @Jermolene, 2011/11/22
  5. Below the edit box for the CLA text you should see a box labelled Propose file change
  6. Enter a brief title to explain the change (eg, "Signing the CLA")
  7. Click the green button labelled Propose file change
  8. On the following screen, click the green button labelled Create pull request

The CLA documents used for this project were created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity".

Remarks

If you do not own the copyright in the entire work of authorship:

In this case, please clearly state so and provide links and any additional information that clarify under which license the rest of the code is distributed. +

Contributing to TiddlyWiki5

We welcome contributions to the code and documentation of TiddlyWiki in several ways:

There are other ways to help TiddlyWiki too.

Contributor License Agreement

Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).

How to sign the CLA

Create a GitHub pull request to add your name to cla-individual.md or cla-entity.md, with the date in the format (YYYY/MM/DD).

step by step

  1. Navigate to licenses/CLA-individual or licenses/CLA-entity according to whether you are signing as an individual or representative of an organisation
  2. Click the "edit" button at the top-right corner (clicking this button will fork the project so you can edit the file)
  3. Add your name at the bottom
    • eg: Jeremy Ruston, @Jermolene, 2011/11/22
  4. Below the edit box for the CLA text you should see a box labelled Propose file change
  5. Enter a brief title to explain the change (eg, "Signing the CLA")
  6. Click the green button labelled Propose file change
  7. On the following screen, click the green button labelled Create pull request

The CLA documents used for this project were created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity".

Remarks +----—

    • When not owning the copyright in the entire work of authorship**

In this case, please clearly state so, since otherwise we assume that you are the legal copyright holder of the contributed work! Please provide links and additional information that clarify under which license the rest of the code is distributed.

This file was automatically generated by TiddlyWiki5

\ No newline at end of file diff --git a/core/copyright.tid b/core/copyright.tid index ffc8c4ac0..21470e3c4 100644 --- a/core/copyright.tid +++ b/core/copyright.tid @@ -4,7 +4,7 @@ type: text/plain TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com) Copyright (c) 2004-2007, Jeremy Ruston -Copyright (c) 2007-2020, UnaMesa Association +Copyright (c) 2007-2018, UnaMesa Association All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/core/images/add-comment.tid b/core/images/add-comment.tid index 178221806..3e77ed518 100644 --- a/core/images/add-comment.tid +++ b/core/images/add-comment.tid @@ -1,4 +1,4 @@ title: $:/core/images/add-comment tags: $:/tags/Image - \ No newline at end of file + \ No newline at end of file diff --git a/core/images/advanced-search-button.tid b/core/images/advanced-search-button.tid index 6fda3fe8b..5579193ac 100755 --- a/core/images/advanced-search-button.tid +++ b/core/images/advanced-search-button.tid @@ -1,4 +1,11 @@ title: $:/core/images/advanced-search-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/core/images/auto-height.tid b/core/images/auto-height.tid index 78f95418b..e65b9c5b6 100755 --- a/core/images/auto-height.tid +++ b/core/images/auto-height.tid @@ -1,4 +1,6 @@ title: $:/core/images/auto-height tags: $:/tags/Image - \ No newline at end of file + + + \ No newline at end of file diff --git a/core/images/blank.tid b/core/images/blank.tid index 731b55a5a..17cd2e65a 100755 --- a/core/images/blank.tid +++ b/core/images/blank.tid @@ -1,4 +1,4 @@ title: $:/core/images/blank tags: $:/tags/Image - \ No newline at end of file + \ No newline at end of file diff --git a/core/images/bold.tid b/core/images/bold.tid index 67a00f894..0e5d9d8d6 100755 --- a/core/images/bold.tid +++ b/core/images/bold.tid @@ -1,4 +1,8 @@ title: $:/core/images/bold tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/cancel-button.tid b/core/images/cancel-button.tid index c55620b06..2bca34874 100755 --- a/core/images/cancel-button.tid +++ b/core/images/cancel-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/cancel-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/chevron-down.tid b/core/images/chevron-down.tid index f1b363dfc..a20539d7a 100755 --- a/core/images/chevron-down.tid +++ b/core/images/chevron-down.tid @@ -1,4 +1,9 @@ title: $:/core/images/chevron-down tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/chevron-left.tid b/core/images/chevron-left.tid index e4c69d95a..379db701e 100755 --- a/core/images/chevron-left.tid +++ b/core/images/chevron-left.tid @@ -1,4 +1,9 @@ title: $:/core/images/chevron-left tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/chevron-right.tid b/core/images/chevron-right.tid index 6ff5b6c0d..2d379867e 100755 --- a/core/images/chevron-right.tid +++ b/core/images/chevron-right.tid @@ -1,4 +1,9 @@ title: $:/core/images/chevron-right tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/chevron-up.tid b/core/images/chevron-up.tid index 9acbdec40..29824211a 100755 --- a/core/images/chevron-up.tid +++ b/core/images/chevron-up.tid @@ -1,4 +1,9 @@ title: $:/core/images/chevron-up tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/clone-button.tid b/core/images/clone-button.tid index 9ff4903ad..4aa1c9362 100755 --- a/core/images/clone-button.tid +++ b/core/images/clone-button.tid @@ -1,4 +1,9 @@ title: $:/core/images/clone-button tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/close-all-button.tid b/core/images/close-all-button.tid index 3334c5dbc..d998e68e9 100755 --- a/core/images/close-all-button.tid +++ b/core/images/close-all-button.tid @@ -1,4 +1,11 @@ title: $:/core/images/close-all-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/core/images/close-button.tid b/core/images/close-button.tid index c462c9bac..da83fd5fb 100755 --- a/core/images/close-button.tid +++ b/core/images/close-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/close-button tags: $:/tags/Image - \ No newline at end of file + + + + + diff --git a/core/images/close-others-button.tid b/core/images/close-others-button.tid index 1cd54d797..78a163299 100755 --- a/core/images/close-others-button.tid +++ b/core/images/close-others-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/close-others-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/copy-clipboard.tid b/core/images/copy-clipboard.tid index e4e55b6e9..583808bd4 100644 --- a/core/images/copy-clipboard.tid +++ b/core/images/copy-clipboard.tid @@ -1,4 +1,15 @@ title: $:/core/images/copy-clipboard tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/delete-button.tid b/core/images/delete-button.tid index e8c9b6108..5dde6fe03 100755 --- a/core/images/delete-button.tid +++ b/core/images/delete-button.tid @@ -1,4 +1,14 @@ title: $:/core/images/delete-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/done-button.tid b/core/images/done-button.tid index 265528d06..069adafe9 100755 --- a/core/images/done-button.tid +++ b/core/images/done-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/done-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/down-arrow.tid b/core/images/down-arrow.tid index 4cac65a00..8315c8e49 100755 --- a/core/images/down-arrow.tid +++ b/core/images/down-arrow.tid @@ -1,4 +1,6 @@ title: $:/core/images/down-arrow tags: $:/tags/Image - \ No newline at end of file + + + \ No newline at end of file diff --git a/core/images/download-button.tid b/core/images/download-button.tid index e3a549639..0c524b28f 100755 --- a/core/images/download-button.tid +++ b/core/images/download-button.tid @@ -1,4 +1,4 @@ title: $:/core/images/download-button tags: $:/tags/Image - \ No newline at end of file + \ No newline at end of file diff --git a/core/images/edit-button.tid b/core/images/edit-button.tid index 190dffc41..d65f94903 100755 --- a/core/images/edit-button.tid +++ b/core/images/edit-button.tid @@ -1,4 +1,9 @@ title: $:/core/images/edit-button tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/erase.tid b/core/images/erase.tid index 22b31e7cc..ba18f5bd0 100755 --- a/core/images/erase.tid +++ b/core/images/erase.tid @@ -1,4 +1,8 @@ title: $:/core/images/erase tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/excise.tid b/core/images/excise.tid index e6c2c9404..2360cb5a7 100755 --- a/core/images/excise.tid +++ b/core/images/excise.tid @@ -1,4 +1,8 @@ title: $:/core/images/excise tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/export-button.tid b/core/images/export-button.tid index eb3284c80..940ffe7d5 100755 --- a/core/images/export-button.tid +++ b/core/images/export-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/export-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/file.tid b/core/images/file.tid index 67ebc22ac..d66b19e50 100755 --- a/core/images/file.tid +++ b/core/images/file.tid @@ -1,4 +1,14 @@ title: $:/core/images/file tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/fixed-height.tid b/core/images/fixed-height.tid index c15162267..3b53256ab 100755 --- a/core/images/fixed-height.tid +++ b/core/images/fixed-height.tid @@ -1,4 +1,8 @@ title: $:/core/images/fixed-height tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/fold-all-button.tid b/core/images/fold-all-button.tid index edff8b22b..c74ae421a 100755 --- a/core/images/fold-all-button.tid +++ b/core/images/fold-all-button.tid @@ -1,4 +1,11 @@ title: $:/core/images/fold-all-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/core/images/fold-button.tid b/core/images/fold-button.tid index f0b2b474d..190e61d64 100755 --- a/core/images/fold-button.tid +++ b/core/images/fold-button.tid @@ -1,4 +1,10 @@ title: $:/core/images/fold-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/core/images/fold-others-button.tid b/core/images/fold-others-button.tid index 5cb086f85..d19505cea 100755 --- a/core/images/fold-others-button.tid +++ b/core/images/fold-others-button.tid @@ -1,4 +1,10 @@ title: $:/core/images/fold-others-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/core/images/folder.tid b/core/images/folder.tid index 4b89418ff..354e6e633 100755 --- a/core/images/folder.tid +++ b/core/images/folder.tid @@ -1,4 +1,9 @@ title: $:/core/images/folder tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/full-screen-button.tid b/core/images/full-screen-button.tid index 8572ff646..acc6edbd6 100755 --- a/core/images/full-screen-button.tid +++ b/core/images/full-screen-button.tid @@ -1,4 +1,19 @@ title: $:/core/images/full-screen-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/github.tid b/core/images/github.tid index 6389f5cdc..98d9aeef3 100755 --- a/core/images/github.tid +++ b/core/images/github.tid @@ -1,4 +1,8 @@ title: $:/core/images/github tags: $:/tags/Image - \ No newline at end of file + + + + + diff --git a/core/images/gitter.tid b/core/images/gitter.tid deleted file mode 100644 index 876fc3da1..000000000 --- a/core/images/gitter.tid +++ /dev/null @@ -1,4 +0,0 @@ -title: $:/core/images/gitter -tags: $:/tags/Image - - \ No newline at end of file diff --git a/core/images/globe.tid b/core/images/globe.tid index 9448ed7a4..02b58e219 100755 --- a/core/images/globe.tid +++ b/core/images/globe.tid @@ -1,4 +1,10 @@ title: $:/core/images/globe tags: $:/tags/Image - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/core/images/heading-1.tid b/core/images/heading-1.tid index f8a98123b..94d57dee9 100755 --- a/core/images/heading-1.tid +++ b/core/images/heading-1.tid @@ -1,4 +1,8 @@ title: $:/core/images/heading-1 tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/heading-2.tid b/core/images/heading-2.tid index ef0022cc6..65b2e3750 100755 --- a/core/images/heading-2.tid +++ b/core/images/heading-2.tid @@ -1,4 +1,8 @@ title: $:/core/images/heading-2 tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/heading-3.tid b/core/images/heading-3.tid index d706d067b..6899440a7 100755 --- a/core/images/heading-3.tid +++ b/core/images/heading-3.tid @@ -1,4 +1,8 @@ title: $:/core/images/heading-3 tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/heading-4.tid b/core/images/heading-4.tid index 16d4440db..c30a44692 100755 --- a/core/images/heading-4.tid +++ b/core/images/heading-4.tid @@ -1,4 +1,8 @@ title: $:/core/images/heading-4 tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/heading-5.tid b/core/images/heading-5.tid index 8f34b7058..8e0a7fdc8 100755 --- a/core/images/heading-5.tid +++ b/core/images/heading-5.tid @@ -1,4 +1,8 @@ title: $:/core/images/heading-5 tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/heading-6.tid b/core/images/heading-6.tid index b348c70af..93f7bcfd7 100755 --- a/core/images/heading-6.tid +++ b/core/images/heading-6.tid @@ -1,4 +1,8 @@ title: $:/core/images/heading-6 tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/help.tid b/core/images/help.tid index 07167ae93..33f924bc4 100755 --- a/core/images/help.tid +++ b/core/images/help.tid @@ -1,4 +1,8 @@ title: $:/core/images/help tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/home-button.tid b/core/images/home-button.tid index 10c00626a..5eabf6a98 100755 --- a/core/images/home-button.tid +++ b/core/images/home-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/home-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/import-button.tid b/core/images/import-button.tid index 6850513ef..54534bb6c 100755 --- a/core/images/import-button.tid +++ b/core/images/import-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/import-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/info-button.tid b/core/images/info-button.tid index 2679a135a..263fe9056 100755 --- a/core/images/info-button.tid +++ b/core/images/info-button.tid @@ -1,4 +1,12 @@ title: $:/core/images/info-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/core/images/italic.tid b/core/images/italic.tid index 06aada589..f7c46b55c 100755 --- a/core/images/italic.tid +++ b/core/images/italic.tid @@ -1,4 +1,8 @@ title: $:/core/images/italic tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/left-arrow.tid b/core/images/left-arrow.tid index a418581cd..461aec452 100755 --- a/core/images/left-arrow.tid +++ b/core/images/left-arrow.tid @@ -3,4 +3,6 @@ modified: 20150315235324760 tags: $:/tags/Image title: $:/core/images/left-arrow - \ No newline at end of file + + + diff --git a/core/images/line-width.tid b/core/images/line-width.tid index f77763ce6..1e8854c4e 100755 --- a/core/images/line-width.tid +++ b/core/images/line-width.tid @@ -1,4 +1,9 @@ title: $:/core/images/line-width tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/link.tid b/core/images/link.tid index 395307c42..1e094a9b0 100644 --- a/core/images/link.tid +++ b/core/images/link.tid @@ -1,4 +1,9 @@ title: $:/core/images/link tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/linkify.tid b/core/images/linkify.tid index 40acdc19a..368d27490 100644 --- a/core/images/linkify.tid +++ b/core/images/linkify.tid @@ -1,4 +1,4 @@ title: $:/core/images/linkify tags: $:/tags/Image - \ No newline at end of file + \ No newline at end of file diff --git a/core/images/list-bullet.tid b/core/images/list-bullet.tid index 322dd4ae6..7951ad229 100755 --- a/core/images/list-bullet.tid +++ b/core/images/list-bullet.tid @@ -1,4 +1,8 @@ title: $:/core/images/list-bullet tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/list-number.tid b/core/images/list-number.tid index 161917823..768f16d25 100755 --- a/core/images/list-number.tid +++ b/core/images/list-number.tid @@ -1,4 +1,8 @@ title: $:/core/images/list-number tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/list.tid b/core/images/list.tid index 22b784bfe..c27a51647 100644 --- a/core/images/list.tid +++ b/core/images/list.tid @@ -1,4 +1,9 @@ title: $:/core/images/list tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/locked-padlock.tid b/core/images/locked-padlock.tid index 14d95560c..28a6ea986 100755 --- a/core/images/locked-padlock.tid +++ b/core/images/locked-padlock.tid @@ -1,4 +1,8 @@ title: $:/core/images/locked-padlock tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/mail.tid b/core/images/mail.tid index cf0f4eab7..50d39f35f 100755 --- a/core/images/mail.tid +++ b/core/images/mail.tid @@ -1,4 +1,8 @@ title: $:/core/images/mail tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/menu-button.tid b/core/images/menu-button.tid index 6d1872e4c..b2a9162d6 100755 --- a/core/images/menu-button.tid +++ b/core/images/menu-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/menu-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/mono-block.tid b/core/images/mono-block.tid index f8695302b..1675e3854 100755 --- a/core/images/mono-block.tid +++ b/core/images/mono-block.tid @@ -1,4 +1,8 @@ title: $:/core/images/mono-block tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/mono-line.tid b/core/images/mono-line.tid index 09cfe513e..81d0faf3f 100755 --- a/core/images/mono-line.tid +++ b/core/images/mono-line.tid @@ -1,4 +1,8 @@ title: $:/core/images/mono-line tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/new-button.tid b/core/images/new-button.tid index 6e592ada9..560d15350 100755 --- a/core/images/new-button.tid +++ b/core/images/new-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/new-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/new-here-button.tid b/core/images/new-here-button.tid index ab0f7a6f3..ce8fd31bd 100755 --- a/core/images/new-here-button.tid +++ b/core/images/new-here-button.tid @@ -1,4 +1,14 @@ title: $:/core/images/new-here-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/new-image-button.tid b/core/images/new-image-button.tid index 16b63c3c3..5109bf98d 100755 --- a/core/images/new-image-button.tid +++ b/core/images/new-image-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/new-image-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/new-journal-button.tid b/core/images/new-journal-button.tid index fb67c8007..86c3c589c 100755 --- a/core/images/new-journal-button.tid +++ b/core/images/new-journal-button.tid @@ -1,4 +1,16 @@ title: $:/core/images/new-journal-button tags: $:/tags/Image -<> \ No newline at end of file + + + + + + + + <> + + + + + \ No newline at end of file diff --git a/core/images/opacity.tid b/core/images/opacity.tid index e9a29aea2..e9bb732e1 100755 --- a/core/images/opacity.tid +++ b/core/images/opacity.tid @@ -1,4 +1,10 @@ title: $:/core/images/opacity tags: $:/tags/Image - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/core/images/open-window.tid b/core/images/open-window.tid index 14b556484..337c582a1 100755 --- a/core/images/open-window.tid +++ b/core/images/open-window.tid @@ -1,4 +1,9 @@ title: $:/core/images/open-window tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/options-button.tid b/core/images/options-button.tid index bd0ffcb1a..6b00b23f9 100755 --- a/core/images/options-button.tid +++ b/core/images/options-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/options-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/paint.tid b/core/images/paint.tid index bb536b53a..c6dcab834 100755 --- a/core/images/paint.tid +++ b/core/images/paint.tid @@ -1,4 +1,8 @@ title: $:/core/images/paint tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/palette.tid b/core/images/palette.tid index d605fd853..083769bb6 100755 --- a/core/images/palette.tid +++ b/core/images/palette.tid @@ -1,4 +1,8 @@ title: $:/core/images/palette tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/permalink-button.tid b/core/images/permalink-button.tid index e8fd0aecd..28f1223a0 100755 --- a/core/images/permalink-button.tid +++ b/core/images/permalink-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/permalink-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/permaview-button.tid b/core/images/permaview-button.tid index b2ad9a408..a501f6f6f 100755 --- a/core/images/permaview-button.tid +++ b/core/images/permaview-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/permaview-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/picture.tid b/core/images/picture.tid index 7d035e2fc..71d2bf1a6 100755 --- a/core/images/picture.tid +++ b/core/images/picture.tid @@ -1,4 +1,8 @@ title: $:/core/images/picture tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/plugin-generic-language.tid b/core/images/plugin-generic-language.tid index 64b310872..1c5aa3ce5 100755 --- a/core/images/plugin-generic-language.tid +++ b/core/images/plugin-generic-language.tid @@ -1,4 +1,8 @@ title: $:/core/images/plugin-generic-language tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/plugin-generic-plugin.tid b/core/images/plugin-generic-plugin.tid index 94988e2ca..6f56da7a3 100755 --- a/core/images/plugin-generic-plugin.tid +++ b/core/images/plugin-generic-plugin.tid @@ -1,4 +1,8 @@ title: $:/core/images/plugin-generic-plugin tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/plugin-generic-theme.tid b/core/images/plugin-generic-theme.tid index 34dccf18f..1f4224b10 100755 --- a/core/images/plugin-generic-theme.tid +++ b/core/images/plugin-generic-theme.tid @@ -1,4 +1,8 @@ title: $:/core/images/plugin-generic-theme tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/preview-closed.tid b/core/images/preview-closed.tid index 5986d8966..1ca8f24ba 100755 --- a/core/images/preview-closed.tid +++ b/core/images/preview-closed.tid @@ -1,4 +1,15 @@ title: $:/core/images/preview-closed tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/preview-open.tid b/core/images/preview-open.tid index 4664990b4..17f2319e1 100755 --- a/core/images/preview-open.tid +++ b/core/images/preview-open.tid @@ -1,4 +1,9 @@ title: $:/core/images/preview-open tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/print-button.tid b/core/images/print-button.tid index 55b33c896..5e7c1d8e0 100644 --- a/core/images/print-button.tid +++ b/core/images/print-button.tid @@ -1,4 +1,12 @@ title: $:/core/images/print-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/core/images/quote.tid b/core/images/quote.tid index 7134306a6..882b1debc 100755 --- a/core/images/quote.tid +++ b/core/images/quote.tid @@ -1,4 +1,8 @@ title: $:/core/images/quote tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/refresh-button.tid b/core/images/refresh-button.tid index 2422b0679..c28c7af32 100755 --- a/core/images/refresh-button.tid +++ b/core/images/refresh-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/refresh-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/right-arrow.tid b/core/images/right-arrow.tid index 42e7dea56..14095b3b1 100755 --- a/core/images/right-arrow.tid +++ b/core/images/right-arrow.tid @@ -1,4 +1,6 @@ title: $:/core/images/right-arrow tags: $:/tags/Image - \ No newline at end of file + + + \ No newline at end of file diff --git a/core/images/rotate-left.tid b/core/images/rotate-left.tid index 188d3b45c..7530aedde 100644 --- a/core/images/rotate-left.tid +++ b/core/images/rotate-left.tid @@ -1,4 +1,4 @@ title: $:/core/images/rotate-left tags: $:/tags/Image - \ No newline at end of file + \ No newline at end of file diff --git a/core/images/save-button.tid b/core/images/save-button.tid index a66756616..dd57a92e5 100755 --- a/core/images/save-button.tid +++ b/core/images/save-button.tid @@ -1,4 +1,8 @@ title: $:/core/images/save-button tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/size.tid b/core/images/size.tid index db84ecf9b..4822dbb50 100755 --- a/core/images/size.tid +++ b/core/images/size.tid @@ -1,4 +1,6 @@ title: $:/core/images/size tags: $:/tags/Image - \ No newline at end of file + + + \ No newline at end of file diff --git a/core/images/spiral.tid b/core/images/spiral.tid index ca4684cab..5ad004f46 100755 --- a/core/images/spiral.tid +++ b/core/images/spiral.tid @@ -1,4 +1,8 @@ title: $:/core/images/spiral tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/stamp.tid b/core/images/stamp.tid index ba385aaae..ab8949c1d 100755 --- a/core/images/stamp.tid +++ b/core/images/stamp.tid @@ -1,4 +1,8 @@ title: $:/core/images/stamp tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/star-filled.tid b/core/images/star-filled.tid index 10b8f1c3d..3199c14db 100755 --- a/core/images/star-filled.tid +++ b/core/images/star-filled.tid @@ -1,4 +1,8 @@ title: $:/core/images/star-filled tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/storyview-classic.tid b/core/images/storyview-classic.tid index 86872817b..a0f7b7af0 100755 --- a/core/images/storyview-classic.tid +++ b/core/images/storyview-classic.tid @@ -1,4 +1,8 @@ title: $:/core/images/storyview-classic tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/storyview-pop.tid b/core/images/storyview-pop.tid index a610c89d5..f56cb58bc 100755 --- a/core/images/storyview-pop.tid +++ b/core/images/storyview-pop.tid @@ -1,4 +1,8 @@ title: $:/core/images/storyview-pop tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/storyview-zoomin.tid b/core/images/storyview-zoomin.tid index 61b7ff273..949f535e2 100755 --- a/core/images/storyview-zoomin.tid +++ b/core/images/storyview-zoomin.tid @@ -1,4 +1,8 @@ title: $:/core/images/storyview-zoomin tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/strikethrough.tid b/core/images/strikethrough.tid index 1f7a1c202..80898c870 100755 --- a/core/images/strikethrough.tid +++ b/core/images/strikethrough.tid @@ -1,4 +1,9 @@ title: $:/core/images/strikethrough tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/subscript.tid b/core/images/subscript.tid index 96548bdb5..a56aa2f1d 100755 --- a/core/images/subscript.tid +++ b/core/images/subscript.tid @@ -1,4 +1,8 @@ title: $:/core/images/subscript tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/superscript.tid b/core/images/superscript.tid index 149e44893..ca48636e0 100755 --- a/core/images/superscript.tid +++ b/core/images/superscript.tid @@ -1,4 +1,8 @@ title: $:/core/images/superscript tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/tag-button.tid b/core/images/tag-button.tid index 9f6cad8b4..9eb2a70d7 100755 --- a/core/images/tag-button.tid +++ b/core/images/tag-button.tid @@ -1,4 +1,9 @@ title: $:/core/images/tag-button tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/theme-button.tid b/core/images/theme-button.tid index d80a0e82a..8e14a45d5 100755 --- a/core/images/theme-button.tid +++ b/core/images/theme-button.tid @@ -1,4 +1,9 @@ title: $:/core/images/theme-button tags: $:/tags/Image - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/images/timestamp-off.tid b/core/images/timestamp-off.tid index 0d20f28d6..132dfc127 100644 --- a/core/images/timestamp-off.tid +++ b/core/images/timestamp-off.tid @@ -1,4 +1,8 @@ title: $:/core/images/timestamp-off tags: $:/tags/Image - \ No newline at end of file + + + + + diff --git a/core/images/timestamp-on.tid b/core/images/timestamp-on.tid index 3a16df7eb..292181b49 100644 --- a/core/images/timestamp-on.tid +++ b/core/images/timestamp-on.tid @@ -1,4 +1,8 @@ title: $:/core/images/timestamp-on tags: $:/tags/Image - \ No newline at end of file + + + + + diff --git a/core/images/tip.tid b/core/images/tip.tid index f8109ada4..88a622ab0 100755 --- a/core/images/tip.tid +++ b/core/images/tip.tid @@ -1,4 +1,8 @@ title: $:/core/images/tip tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/transcludify.tid b/core/images/transcludify.tid index 0579feb10..33f7e0af1 100644 --- a/core/images/transcludify.tid +++ b/core/images/transcludify.tid @@ -1,4 +1,4 @@ title: $:/core/images/transcludify tags: $:/tags/Image - \ No newline at end of file + diff --git a/core/images/twitter.tid b/core/images/twitter.tid index 28cfccdbd..614cf762c 100755 --- a/core/images/twitter.tid +++ b/core/images/twitter.tid @@ -1,4 +1,8 @@ title: $:/core/images/twitter tags: $:/tags/Image - \ No newline at end of file + + + + + diff --git a/core/images/underline.tid b/core/images/underline.tid index 768d2a199..22465748b 100755 --- a/core/images/underline.tid +++ b/core/images/underline.tid @@ -1,4 +1,8 @@ title: $:/core/images/underline tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/unfold-all-button.tid b/core/images/unfold-all-button.tid index e496bdd89..29f217b94 100755 --- a/core/images/unfold-all-button.tid +++ b/core/images/unfold-all-button.tid @@ -1,4 +1,11 @@ title: $:/core/images/unfold-all-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/core/images/unfold-button.tid b/core/images/unfold-button.tid index cfad70570..bd4e9036d 100755 --- a/core/images/unfold-button.tid +++ b/core/images/unfold-button.tid @@ -1,4 +1,10 @@ title: $:/core/images/unfold-button tags: $:/tags/Image - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/core/images/unlocked-padlock.tid b/core/images/unlocked-padlock.tid index c5367c085..6e24bb3b3 100755 --- a/core/images/unlocked-padlock.tid +++ b/core/images/unlocked-padlock.tid @@ -1,4 +1,8 @@ title: $:/core/images/unlocked-padlock tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/up-arrow.tid b/core/images/up-arrow.tid index a1bd132bf..b680b69df 100755 --- a/core/images/up-arrow.tid +++ b/core/images/up-arrow.tid @@ -3,4 +3,7 @@ modified: 20150316000831867 tags: $:/tags/Image title: $:/core/images/up-arrow - \ No newline at end of file + + + + diff --git a/core/images/video.tid b/core/images/video.tid index 3bf0bb259..6ae9fd46a 100755 --- a/core/images/video.tid +++ b/core/images/video.tid @@ -1,4 +1,8 @@ title: $:/core/images/video tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/images/warning.tid b/core/images/warning.tid index 53bff59ec..1a34233dc 100755 --- a/core/images/warning.tid +++ b/core/images/warning.tid @@ -1,4 +1,8 @@ title: $:/core/images/warning tags: $:/tags/Image - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 83598f410..cddf68485 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -32,7 +32,6 @@ ExportTiddler/Caption: export tiddler ExportTiddler/Hint: Export tiddler ExportTiddlers/Caption: export tiddlers ExportTiddlers/Hint: Export tiddlers -SidebarSearch/Hint: Select the sidebar search field Fold/Caption: fold tiddler Fold/Hint: Fold the body of this tiddler Fold/FoldBar/Caption: fold-bar @@ -182,7 +181,6 @@ Subscript/Caption: subscript Subscript/Hint: Apply subscript formatting to selection Superscript/Caption: superscript Superscript/Hint: Apply superscript formatting to selection -ToggleSidebar/Hint: Toggle the sidebar visibility Transcludify/Caption: transclusion Transcludify/Hint: Wrap selection in curly brackets Underline/Caption: underline diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 99a526b9f..2b2358250 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -4,27 +4,25 @@ Advanced/Caption: Advanced Advanced/Hint: Internal information about this TiddlyWiki Appearance/Caption: Appearance Appearance/Hint: Ways to customise the appearance of your TiddlyWiki. -Basics/AnimDuration/Prompt: Animation duration -Basics/AutoFocus/Prompt: Default focus field for new tiddlers +Basics/AnimDuration/Prompt: Animation duration: Basics/Caption: Basics Basics/DefaultTiddlers/BottomHint: Use [[double square brackets]] for titles with spaces. Or you can choose to <$button set="$:/DefaultTiddlers" setTo="[list[$:/StoryList]]">retain story ordering -Basics/DefaultTiddlers/Prompt: Default tiddlers -Basics/DefaultTiddlers/TopHint: Choose which tiddlers are displayed at startup +Basics/DefaultTiddlers/Prompt: Default tiddlers: +Basics/DefaultTiddlers/TopHint: Choose which tiddlers are displayed at startup: Basics/Language/Prompt: Hello! Current language: Basics/NewJournal/Title/Prompt: Title of new journal tiddlers Basics/NewJournal/Text/Prompt: Text for new journal tiddlers Basics/NewJournal/Tags/Prompt: Tags for new journal tiddlers Basics/NewTiddler/Title/Prompt: Title of new tiddlers -Basics/NewTiddler/Tags/Prompt: Tags for new tiddlers -Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers -Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers -Basics/Subtitle/Prompt: Subtitle -Basics/SystemTiddlers/Prompt: Number of system tiddlers -Basics/Tags/Prompt: Number of tags -Basics/Tiddlers/Prompt: Number of tiddlers -Basics/Title/Prompt: Title of this ~TiddlyWiki -Basics/Username/Prompt: Username for signing edits -Basics/Version/Prompt: ~TiddlyWiki version +Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers: +Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers: +Basics/Subtitle/Prompt: Subtitle: +Basics/SystemTiddlers/Prompt: Number of system tiddlers: +Basics/Tags/Prompt: Number of tags: +Basics/Tiddlers/Prompt: Number of tiddlers: +Basics/Title/Prompt: Title of this ~TiddlyWiki: +Basics/Username/Prompt: Username for signing edits: +Basics/Version/Prompt: ~TiddlyWiki version: EditorTypes/Caption: Editor Types EditorTypes/Editor/Caption: Editor EditorTypes/Hint: These tiddlers determine which editor is used to edit specific tiddler types. @@ -49,8 +47,6 @@ LoadedModules/Hint: These are the currently loaded tiddler modules linked to the Palette/Caption: Palette Palette/Editor/Clone/Caption: clone Palette/Editor/Clone/Prompt: It is recommended that you clone this shadow palette before editing it -Palette/Editor/Delete/Hint: delete this entry from the current palette -Palette/Editor/Names/External/Show: Show color names that are not part of the current palette Palette/Editor/Prompt/Modified: This shadow palette has been modified Palette/Editor/Prompt: Editing Palette/Editor/Reset/Caption: reset @@ -65,7 +61,6 @@ Parsing/Pragma/Caption: Pragma Parse Rules Plugins/Add/Caption: Get more plugins Plugins/Add/Hint: Install plugins from the official library Plugins/AlreadyInstalled/Hint: This plugin is already installed at version <$text text=<>/> -Plugins/AlsoRequires: Also requires: Plugins/Caption: Plugins Plugins/Disable/Caption: disable Plugins/Disable/Hint: Disable this plugin when reloading page @@ -81,7 +76,6 @@ Plugins/NoInfoFound/Hint: No ''"<$text text=<>/>"'' found Plugins/NotInstalled/Hint: This plugin is not currently installed Plugins/OpenPluginLibrary: open plugin library Plugins/ClosePluginLibrary: close plugin library -Plugins/PluginWillRequireReload: (requires reload) Plugins/Plugins/Caption: Plugins Plugins/Plugins/Hint: Plugins Plugins/Reinstall/Caption: reinstall @@ -95,18 +89,6 @@ Saving/DownloadSaver/Hint: These settings apply to the HTML5-compatible download Saving/General/Caption: General Saving/General/Hint: These settings apply to all the loaded savers Saving/Hint: Settings used for saving the entire TiddlyWiki as a single file via a saver module -Saving/GitService/Branch: Target branch for saving -Saving/GitService/CommitMessage: Saved by TiddlyWiki -Saving/GitService/Description: These settings are only used when saving to <> -Saving/GitService/Filename: Filename of target file (e.g. `index.html`) -Saving/GitService/Path: Path to target file (e.g. `/wiki/`) -Saving/GitService/Repo: Target repository (e.g. `Jermolene/TiddlyWiki5`) -Saving/GitService/ServerURL: Server API URL -Saving/GitService/UserName: Username -Saving/GitService/GitHub/Caption: ~GitHub Saver -Saving/GitService/GitHub/Password: Password, OAUTH token, or personal access token (see [[GitHub help page|https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line]] for details) -Saving/GitService/GitLab/Caption: ~GitLab Saver -Saving/GitService/GitLab/Password: Personal access token for API (see [[GitLab help page|https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html]] for details) Saving/TiddlySpot/Advanced/Heading: Advanced Settings Saving/TiddlySpot/BackupDir: Backup Directory Saving/TiddlySpot/Backups: Backups diff --git a/core/language/en-GB/EditTemplate.multids b/core/language/en-GB/EditTemplate.multids index 31f18765a..b7b99a175 100644 --- a/core/language/en-GB/EditTemplate.multids +++ b/core/language/en-GB/EditTemplate.multids @@ -8,7 +8,6 @@ Field/Remove/Hint: Remove field Field/Dropdown/Caption: field list Field/Dropdown/Hint: Show field list Fields/Add/Button: add -Fields/Add/Button/Hint: Add the new field to the tiddler Fields/Add/Name/Placeholder: field name Fields/Add/Prompt: Add a new field: Fields/Add/Value/Placeholder: field value @@ -17,14 +16,12 @@ Fields/Add/Dropdown/User: User fields Shadow/Warning: This is a shadow tiddler. Any changes you make will override the default version from the plugin <> Shadow/OverriddenWarning: This is a modified shadow tiddler. You can revert to the default version in the plugin <> by deleting this tiddler Tags/Add/Button: add -Tags/Add/Button/Hint: add tag Tags/Add/Placeholder: tag name Tags/Dropdown/Caption: tag list Tags/Dropdown/Hint: Show tag list Title/BadCharacterWarning: Warning: avoid using any of the characters <> in tiddler titles Title/Exists/Prompt: Target tiddler already exists Title/Relink/Prompt: Update ''<$text text=<>/>'' to ''<$text text=<>/>'' in the //tags// and //list// fields of other tiddlers -Title/References/Prompt: The following references to this tiddler will not be automatically updated: Type/Dropdown/Caption: content type list Type/Dropdown/Hint: Show content type list Type/Delete/Caption: delete content type diff --git a/core/language/en-GB/Fields.multids b/core/language/en-GB/Fields.multids index 6b4823c02..b2ca06294 100644 --- a/core/language/en-GB/Fields.multids +++ b/core/language/en-GB/Fields.multids @@ -13,9 +13,9 @@ description: The descriptive text for a plugin, or a modal dialogue draft.of: For draft tiddlers, contains the title of the tiddler of which this is a draft draft.title: For draft tiddlers, contains the proposed new title of the tiddler footer: The footer text for a wizard -hide-body: The view template will hide bodies of tiddlers if set to: ''yes'' +hack-to-give-us-something-to-compare-against: A temporary storage field used in [[$:/core/templates/static.content]] icon: The title of the tiddler containing the icon associated with a tiddler -library: Indicates that a tiddler should be saved as a JavaScript library if set to: ''yes'' +library: If set to "yes" indicates that a tiddler should be saved as a JavaScript library list: An ordered list of tiddler titles associated with a tiddler list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty @@ -30,8 +30,6 @@ source: The source URL associated with a tiddler subtitle: The subtitle text for a wizard tags: A list of tags associated with a tiddler text: The body text of a tiddler -throttle.refresh: If present, throttles refreshes of this tiddler title: The unique name of a tiddler -toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to: ''no'' type: The content type of a tiddler version: Version information for a plugin diff --git a/core/language/en-GB/Filters.multids b/core/language/en-GB/Filters.multids index b4f0f9f1b..b84818f72 100644 --- a/core/language/en-GB/Filters.multids +++ b/core/language/en-GB/Filters.multids @@ -10,7 +10,6 @@ Orphans: Orphan tiddlers SystemTiddlers: System tiddlers ShadowTiddlers: Shadow tiddlers OverriddenShadowTiddlers: Overridden shadow tiddlers -SessionTiddlers: Tiddlers modified since the wiki was loaded SystemTags: System tags StoryList: Tiddlers in the story river, excluding <$text text="$:/AdvancedSearch"/> TypedTiddlers: Non wiki-text tiddlers \ No newline at end of file diff --git a/core/language/en-GB/Help/deletetiddlers.tid b/core/language/en-GB/Help/deletetiddlers.tid deleted file mode 100644 index ec2b2cf94..000000000 --- a/core/language/en-GB/Help/deletetiddlers.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/language/Help/deletetiddlers -description: Deletes a group of tiddlers - -<<.from-version "5.1.20">> Deletes a group of tiddlers identified by a filter. - -``` ---deletetiddlers -``` diff --git a/core/language/en-GB/Help/listen.tid b/core/language/en-GB/Help/listen.tid index 88208ea29..95c20af37 100644 --- a/core/language/en-GB/Help/listen.tid +++ b/core/language/en-GB/Help/listen.tid @@ -19,8 +19,8 @@ All parameters are optional with safe defaults, and can be specified in any orde * ''username'' - optional username for basic authentication * ''password'' - optional password for basic authentication * ''authenticated-user-header'' - optional name of header to be used for trusted authentication -* ''readers'' - comma separated list of principals allowed to read from this wiki -* ''writers'' - comma separated list of principals allowed to write to this wiki +* ''readers'' - comma separated list of principals allowed to write to this wiki +* ''writers'' - comma separated list of principals allowed to read from this wiki * ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no") * ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all") * ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain") @@ -28,7 +28,3 @@ All parameters are optional with safe defaults, and can be specified in any orde * ''tls-cert'' - pathname of TLS certificate file (relative to wiki folder) * ''tls-key'' - pathname of TLS key file (relative to wiki folder) * ''debug-level'' - optional debug level; set to "debug" to view request details (defaults to "none") -* ''gzip'' - set to "yes" to enable gzip compression for some http endpoints (defaults to "no") - -For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com. - diff --git a/core/language/en-GB/Help/load.tid b/core/language/en-GB/Help/load.tid index 2999f60c5..afc8642cb 100644 --- a/core/language/en-GB/Help/load.tid +++ b/core/language/en-GB/Help/load.tid @@ -4,12 +4,10 @@ description: Load tiddlers from a file Load tiddlers from TiddlyWiki (`.html`), `.tiddler`, `.tid`, `.json` or other local files. The processing applied to incoming files is determined by the file extension. Use the alternative `import` command if you need to specify the deserializer and encoding explicitly. ``` ---load [noerror] ---load [noerror] +--load +--load ``` -By default, the load command raises an error if no tiddlers are found. The error can be suppressed by providing the optional "noerror" parameter. - To load tiddlers from an encrypted TiddlyWiki file you should first specify the password with the PasswordCommand. For example: ``` diff --git a/core/language/en-GB/Help/render.tid b/core/language/en-GB/Help/render.tid index 2b7b168c9..9318b5cfa 100644 --- a/core/language/en-GB/Help/render.tid +++ b/core/language/en-GB/Help/render.tid @@ -13,8 +13,8 @@ A name and value for an additional variable may optionally also be specified. * ''tiddler-filter'': A filter identifying the tiddler(s) to be rendered * ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]addsuffix[.html]]`, which uses the unchanged tiddler title as the filename -* ''render-type'': Optional render type: `text/html` (the default) returns the full HTML text and `text/plain` just returns the text content (ie it ignores HTML tags and other unprintable material) * ''template'': Optional template through which each tiddler is rendered +* ''render-type'': Optional render type: `text/html` (the default) returns the full HTML text and `text/plain` just returns the text content (ie it ignores HTML tags and other unprintable material) * ''name'': Name of optional variable * ''value'': Value of optional variable diff --git a/core/language/en-GB/Help/savewikifolder.tid b/core/language/en-GB/Help/savewikifolder.tid deleted file mode 100644 index bda1d19a3..000000000 --- a/core/language/en-GB/Help/savewikifolder.tid +++ /dev/null @@ -1,19 +0,0 @@ -title: $:/language/Help/savewikifolder -description: Saves a wiki to a new wiki folder - -<<.from-version "5.1.20">> Saves the current wiki as a wiki folder, including tiddlers, plugins and configuration: - -``` ---savewikifolder [] -``` - -* The target wiki folder must be empty or non-existent -* The filter specifies which tiddlers should be included. It is optional, defaulting to `[all[tiddlers]]` -* Plugins from the official plugin library are replaced with references to those plugins in the `tiddlywiki.info` file -* Custom plugins are unpacked into their own folder - -A common usage is to convert a TiddlyWiki HTML file into a wiki folder: - -``` -tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder -``` diff --git a/core/language/en-GB/Help/server.tid b/core/language/en-GB/Help/server.tid index 78e9c8ab1..8c5f932b4 100644 --- a/core/language/en-GB/Help/server.tid +++ b/core/language/en-GB/Help/server.tid @@ -12,7 +12,7 @@ The parameters are: * ''port'' - port number on which to listen; non-numeric values are interpreted as a system environment variable from which the port number is extracted (defaults to "8080") * ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all") * ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain") -* ''root-serve-type'' - the content type with which the root tiddler should be served (defaults to "text/html") +* ''rooot-serve-type'' - the content type with which the root tiddler should be served (defaults to "text/html") * ''username'' - the default username for signing edits * ''password'' - optional password for basic authentication * ''host'' - optional hostname to serve from (defaults to "127.0.0.1" aka "localhost") @@ -27,15 +27,12 @@ For example: --server 8080 $:/core/save/all text/plain text/html MyUserName passw0rd ``` -The username and password can be specified as empty strings if you need to set the hostname or pathprefix and don't want to require a password. - +The username and password can be specified as empty strings if you need to set the hostname or pathprefix and don't want to require a password: ``` --server 8080 $:/core/save/all text/plain text/html "" "" 192.168.0.245 ``` -Using an address like this exposes your system to the local network. For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com. - To run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port. It can be useful to use an environment variable to pass the port number to the Node.js process. This example references an environment variable called "MY_PORT_NUMBER": ``` diff --git a/core/language/en-GB/Import.multids b/core/language/en-GB/Import.multids index 10a01d7dd..083086606 100644 --- a/core/language/en-GB/Import.multids +++ b/core/language/en-GB/Import.multids @@ -18,6 +18,4 @@ Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming < Upgrader/Plugins/Upgraded: Upgraded plugin from <> to <> Upgrader/State/Suppressed: Blocked temporary state tiddler Upgrader/System/Suppressed: Blocked system tiddler -Upgrader/System/Warning: Core module tiddler -Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<>/> diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index 599b575eb..0f267186e 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -59,7 +59,7 @@ MissingTiddler/Hint: Missing tiddler "<$text text=<>/>" -- click No: No OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team. -PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect +PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to plugins to take effect RecentChanges/DateFormat: DDth MMM YYYY SystemTiddler/Tooltip: This is a system tiddler SystemTiddlers/Include/Prompt: Include system tiddlers diff --git a/core/language/en-GB/NewJournal.multids b/core/language/en-GB/NewJournal.multids index f5c939068..b7a3f5e62 100644 --- a/core/language/en-GB/NewJournal.multids +++ b/core/language/en-GB/NewJournal.multids @@ -2,3 +2,4 @@ title: $:/config/NewJournal/ Title: DDth MMM YYYY Text: +Tags: Journal diff --git a/core/language/en-GB/NewJournalTags.tid b/core/language/en-GB/NewJournalTags.tid deleted file mode 100644 index 0534cba33..000000000 --- a/core/language/en-GB/NewJournalTags.tid +++ /dev/null @@ -1,2 +0,0 @@ -title: $:/config/NewJournal/Tags -tags: Journal diff --git a/core/modules/commands/deletetiddlers.js b/core/modules/commands/deletetiddlers.js deleted file mode 100644 index 3d8b855d9..000000000 --- a/core/modules/commands/deletetiddlers.js +++ /dev/null @@ -1,42 +0,0 @@ -/*\ -title: $:/core/modules/commands/deletetiddlers.js -type: application/javascript -module-type: command - -Command to delete tiddlers - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -exports.info = { - name: "deletetiddlers", - synchronous: true -}; - -var Command = function(params,commander,callback) { - this.params = params; - this.commander = commander; - this.callback = callback; -}; - -Command.prototype.execute = function() { - if(this.params.length < 1) { - return "Missing filter"; - } - var self = this, - wiki = this.commander.wiki, - filter = this.params[0], - tiddlers = wiki.filterTiddlers(filter); - $tw.utils.each(tiddlers,function(title) { - wiki.deleteTiddler(title); - }); - return null; -}; - -exports.Command = Command; - -})(); diff --git a/core/modules/commands/listen.js b/core/modules/commands/listen.js index 3c5f6a63a..dd22ea940 100644 --- a/core/modules/commands/listen.js +++ b/core/modules/commands/listen.js @@ -39,7 +39,7 @@ Command.prototype.execute = function() { variables: self.params }); var nodeServer = this.server.listen(); - $tw.hooks.invokeHook("th-server-command-post-start",this.server,nodeServer,"tiddlywiki"); + $tw.hooks.invokeHook("th-server-command-post-start",this.server,nodeServer); return null; }; diff --git a/core/modules/commands/load.js b/core/modules/commands/load.js index 8fd9cba10..230a253d5 100644 --- a/core/modules/commands/load.js +++ b/core/modules/commands/load.js @@ -38,7 +38,7 @@ Command.prototype.execute = function() { count++; }); }); - if(!count && self.params[1] !== "noerror") { + if(!count) { self.callback("No tiddlers found in file \"" + self.params[0] + "\""); } else { self.callback(null); diff --git a/core/modules/commands/makelibrary.js b/core/modules/commands/makelibrary.js index ce7150f0c..bb149fd16 100644 --- a/core/modules/commands/makelibrary.js +++ b/core/modules/commands/makelibrary.js @@ -59,7 +59,7 @@ Command.prototype.execute = function() { title: upgradeLibraryTitle, type: "application/json", "plugin-type": "library", - "text": JSON.stringify({tiddlers: tiddlers}) + "text": JSON.stringify({tiddlers: tiddlers},null,$tw.config.preferences.jsonSpaces) }; wiki.addTiddler(new $tw.Tiddler(pluginFields)); return null; diff --git a/core/modules/commands/savelibrarytiddlers.js b/core/modules/commands/savelibrarytiddlers.js index 58030d3d8..44feea071 100644 --- a/core/modules/commands/savelibrarytiddlers.js +++ b/core/modules/commands/savelibrarytiddlers.js @@ -65,11 +65,10 @@ Command.prototype.execute = function() { // Save each JSON file and collect the skinny data var pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + ".json"); $tw.utils.createFileDirectories(pathname); - fs.writeFileSync(pathname,JSON.stringify(tiddler),"utf8"); + fs.writeFileSync(pathname,JSON.stringify(tiddler,null,$tw.config.preferences.jsonSpaces),"utf8"); // Collect the skinny list data var pluginTiddlers = JSON.parse(tiddler.text), readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text, - doesRequireReload = !!$tw.wiki.doesPluginInfoRequireReload(pluginTiddlers), iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {}, iconType = iconTiddler.type, iconText = iconTiddler.text, @@ -77,12 +76,7 @@ Command.prototype.execute = function() { if(iconType && iconText) { iconContent = $tw.utils.makeDataUri(iconText,iconType); } - skinnyList.push($tw.utils.extend({},tiddler,{ - text: undefined, - readme: readmeContent, - "requires-reload": doesRequireReload ? "yes" : "no", - icon: iconContent - })); + skinnyList.push($tw.utils.extend({},tiddler,{text: undefined, readme: readmeContent, icon: iconContent})); }); // Save the catalogue tiddler if(skinnyListTitle) { diff --git a/core/modules/commands/savewikifolder.js b/core/modules/commands/savewikifolder.js deleted file mode 100644 index 1e3ab36c6..000000000 --- a/core/modules/commands/savewikifolder.js +++ /dev/null @@ -1,184 +0,0 @@ -/*\ -title: $:/core/modules/commands/savewikifolder.js -type: application/javascript -module-type: command - -Command to save the current wiki as a wiki folder - ---savewikifolder [] - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -exports.info = { - name: "savewikifolder", - synchronous: true -}; - -var fs,path; -if($tw.node) { - fs = require("fs"); - path = require("path"); -} - -var Command = function(params,commander,callback) { - this.params = params; - this.commander = commander; - this.callback = callback; -}; - -Command.prototype.execute = function() { - if(this.params.length < 1) { - return "Missing wiki folder path"; - } - var wikifoldermaker = new WikiFolderMaker(this.params[0],this.params[1],this.commander); - return wikifoldermaker.save(); -}; - -function WikiFolderMaker(wikiFolderPath,wikiFilter,commander) { - this.wikiFolderPath = wikiFolderPath; - this.wikiFilter = wikiFilter || "[all[tiddlers]]"; - this.commander = commander; - this.wiki = commander.wiki; - this.savedPaths = []; // So that we can detect filename clashes -} - -WikiFolderMaker.prototype.log = function(str) { - if(this.commander.verbose) { - console.log(str); - } -}; - -WikiFolderMaker.prototype.tiddlersToIgnore = [ - "$:/boot/boot.css", - "$:/boot/boot.js", - "$:/boot/bootprefix.js", - "$:/core", - "$:/library/sjcl.js", - "$:/temp/info-plugin" -]; - -/* -Returns null if successful, or an error string if there was an error -*/ -WikiFolderMaker.prototype.save = function() { - var self = this; - // Check that the output directory doesn't exist - if(fs.existsSync(this.wikiFolderPath) && !$tw.utils.isDirectoryEmpty(this.wikiFolderPath)) { - return "The unpackwiki command requires that the output wiki folder be empty"; - } - // Get the tiddlers from the source wiki - var tiddlerTitles = this.wiki.filterTiddlers(this.wikiFilter); - // Initialise a new tiddlwiki.info file - var newWikiInfo = {}; - // Process each incoming tiddler in turn - $tw.utils.each(tiddlerTitles,function(title) { - var tiddler = self.wiki.getTiddler(title); - if(tiddler) { - if(self.tiddlersToIgnore.indexOf(title) !== -1) { - // Ignore the core plugin and the ephemeral info plugin - self.log("Ignoring tiddler: " + title); - } else { - var type = tiddler.fields.type, - pluginType = tiddler.fields["plugin-type"]; - if(type === "application/json" && pluginType) { - // Plugin tiddler - var libraryDetails = self.findPluginInLibrary(title); - if(libraryDetails) { - // A plugin from the core library - self.log("Adding built-in plugin: " + libraryDetails.name); - newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || []; - $tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name); - } else { - // A custom plugin - self.log("Processing custom plugin: " + title); - self.saveCustomPlugin(tiddler); - } - } else { - // Ordinary tiddler - self.saveTiddler("tiddlers",tiddler); - } - } - } - }); - // Save the tiddlywiki.info file - this.saveJSONFile("tiddlywiki.info",newWikiInfo); - self.log("Writing tiddlywiki.info: " + JSON.stringify(newWikiInfo,null,$tw.config.preferences.jsonSpaces)); - return null; -}; - -/* -Test whether the specified tiddler is a plugin in the plugin library -*/ -WikiFolderMaker.prototype.findPluginInLibrary = function(title) { - var parts = title.split("/"), - pluginPath, type, name; - if(parts[0] === "$:") { - if(parts[1] === "languages" && parts.length === 3) { - pluginPath = "languages" + path.sep + parts[2]; - type = parts[1]; - name = parts[2]; - } else if(parts[1] === "plugins" || parts[1] === "themes" && parts.length === 4) { - pluginPath = parts[1] + path.sep + parts[2] + path.sep + parts[3]; - type = parts[1]; - name = parts[2] + "/" + parts[3]; - } - } - if(pluginPath && type && name) { - pluginPath = path.resolve($tw.boot.bootPath,"..",pluginPath); - if(fs.existsSync(pluginPath)) { - return { - pluginPath: pluginPath, - type: type, - name: name - }; - } - } - return false; -}; - -WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) { - var self = this, - pluginTitle = pluginTiddler.fields.title, - titleParts = pluginTitle.split("/"), - directory = $tw.utils.generateTiddlerFilepath(titleParts[titleParts.length - 1],{ - directory: path.resolve(this.wikiFolderPath,pluginTiddler.fields["plugin-type"] + "s") - }), - pluginInfo = pluginTiddler.getFieldStrings({exclude: ["text","type"]}); - this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo); - self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces)); - var pluginTiddlers = JSON.parse(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin - $tw.utils.each(pluginTiddlers,function(tiddler) { - self.saveTiddler(directory,new $tw.Tiddler(tiddler)); - }); -}; - -WikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) { - var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{ - directory: path.resolve(this.wikiFolderPath,directory), - wiki: this.wiki - }); - $tw.utils.saveTiddlerToFileSync(tiddler,fileInfo); -}; - -WikiFolderMaker.prototype.saveJSONFile = function(filename,json) { - this.saveTextFile(filename,JSON.stringify(json,null,$tw.config.preferences.jsonSpaces)); -}; - -WikiFolderMaker.prototype.saveTextFile = function(filename,data) { - this.saveFile(filename,"utf8",data); -}; - -WikiFolderMaker.prototype.saveFile = function(filename,encoding,data) { - var filepath = path.resolve(this.wikiFolderPath,filename); - $tw.utils.createFileDirectories(filepath); - fs.writeFileSync(filepath,data,encoding); -}; - -exports.Command = Command; - -})(); diff --git a/core/modules/commands/server.js b/core/modules/commands/server.js index 507d1281d..fd1e4ea50 100644 --- a/core/modules/commands/server.js +++ b/core/modules/commands/server.js @@ -46,7 +46,7 @@ Command.prototype.execute = function() { } }); var nodeServer = this.server.listen(); - $tw.hooks.invokeHook("th-server-command-post-start",this.server,nodeServer,"tiddlywiki"); + $tw.hooks.invokeHook("th-server-command-post-start",this.server,nodeServer); return null; }; diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js index 6e7da24da..d3694320f 100644 --- a/core/modules/editor/engines/framed.js +++ b/core/modules/editor/engines/framed.js @@ -42,7 +42,6 @@ function FramedEngine(options) { this.iframeNode.style.border = "none"; this.iframeNode.style.padding = "0"; this.iframeNode.style.resize = "none"; - this.iframeNode.style["background-color"] = this.widget.wiki.extractTiddlerDataItem(this.widget.wiki.getTiddlerText("$:/palette"),"tiddler-editor-background"); this.iframeDoc.body.style.margin = "0"; this.iframeDoc.body.style.padding = "0"; this.widget.domNodes.push(this.iframeNode); @@ -71,9 +70,6 @@ function FramedEngine(options) { if(this.widget.editRows) { this.domNode.setAttribute("rows",this.widget.editRows); } - if(this.widget.editTabIndex) { - this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex); - } // Copy the styles from the dummy textarea this.copyStyles(); // Add event listeners @@ -96,7 +92,6 @@ FramedEngine.prototype.copyStyles = function() { this.domNode.style.display = "block"; this.domNode.style.width = "100%"; this.domNode.style.margin = "0"; - this.domNode.style["background-color"] = this.widget.wiki.extractTiddlerDataItem(this.widget.wiki.getTiddlerText("$:/palette"),"tiddler-editor-background"); // In Chrome setting -webkit-text-fill-color overrides the placeholder text colour this.domNode.style["-webkit-text-fill-color"] = "currentcolor"; }; diff --git a/core/modules/editor/engines/simple.js b/core/modules/editor/engines/simple.js index bb77893d7..62bcf08b5 100644 --- a/core/modules/editor/engines/simple.js +++ b/core/modules/editor/engines/simple.js @@ -49,9 +49,6 @@ function SimpleEngine(options) { if(this.widget.editClass) { this.domNode.className = this.widget.editClass; } - if(this.widget.editTabIndex) { - this.domNode.setAttribute("tabindex",this.widget.editTabIndex); - } // Add an input event handler $tw.utils.addEventListeners(this.domNode,[ {name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"}, diff --git a/core/modules/editor/factory.js b/core/modules/editor/factory.js index 8dfc88037..a4184d1b3 100644 --- a/core/modules/editor/factory.js +++ b/core/modules/editor/factory.js @@ -176,7 +176,6 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT); this.editFocusPopup = this.getAttribute("focusPopup"); this.editFocus = this.getAttribute("focus"); - this.editTabIndex = this.getAttribute("tabindex"); // Get the default editor element tag and type var tag,type; if(this.editField === "text") { @@ -193,7 +192,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { type = type || "text"; } // Get the rest of our parameters - this.editTag = this.getAttribute("tag",tag) || "input"; + this.editTag = this.getAttribute("tag",tag); this.editType = this.getAttribute("type",type); // Make the child widgets this.makeChildWidgets(); @@ -208,7 +207,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { EditTextWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); // Completely rerender if any of our attributes have changed - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) { + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) { this.refreshSelf(); return true; } else if(changedTiddlers[this.editTitle]) { @@ -217,7 +216,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { } this.engine.fixHeight(); if(this.editShowToolbar) { - return this.refreshChildren(changedTiddlers); + return this.refreshChildren(changedTiddlers); } else { return false; } @@ -267,7 +266,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { el.dispatchEvent(clickEvent); event.preventDefault(); event.stopPropagation(); - return true; + return true; } } } diff --git a/core/modules/editor/operations/text/prefix-lines.js b/core/modules/editor/operations/text/prefix-lines.js index fd483a983..ad67232fc 100644 --- a/core/modules/editor/operations/text/prefix-lines.js +++ b/core/modules/editor/operations/text/prefix-lines.js @@ -13,13 +13,12 @@ Text editor operation to add a prefix to the selected lines "use strict"; exports["prefix-lines"] = function(event,operation) { - var targetCount = parseInt(event.paramObject.count + "",10); // Cut just past the preceding line break, or the start of the text operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart); // Cut to just past the following line break, or to the end of the text operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd); // Compose the required prefix - var prefix = $tw.utils.repeat(event.paramObject.character,targetCount); + var prefix = $tw.utils.repeat(event.paramObject.character,event.paramObject.count); // Process each line var lines = operation.text.substring(operation.cutStart,operation.cutEnd).split(/\r?\n/mg); $tw.utils.each(lines,function(line,index) { @@ -34,7 +33,7 @@ exports["prefix-lines"] = function(event,operation) { line = line.substring(1); } // We're done if we removed the exact required prefix, otherwise add it - if(count !== targetCount) { + if(count !== event.paramObject.count) { // Apply the prefix line = prefix + " " + line; } diff --git a/core/modules/editor/operations/text/wrap-selection.js b/core/modules/editor/operations/text/wrap-selection.js index 6800cbe5b..30e41e841 100644 --- a/core/modules/editor/operations/text/wrap-selection.js +++ b/core/modules/editor/operations/text/wrap-selection.js @@ -16,12 +16,14 @@ exports["wrap-selection"] = function(event,operation) { if(operation.selStart === operation.selEnd) { // No selection; check if we're within the prefix/suffix if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) { - // Remove the prefix and suffix - operation.cutStart = operation.selStart - event.paramObject.prefix.length; - operation.cutEnd = operation.selEnd + event.paramObject.suffix.length; - operation.replacement = ""; - operation.newSelStart = operation.cutStart; - operation.newSelEnd = operation.newSelStart; + // Remove the prefix and suffix unless they comprise the entire text + if(operation.selStart > event.paramObject.prefix.length || (operation.selEnd + event.paramObject.suffix.length) < operation.text.length ) { + operation.cutStart = operation.selStart - event.paramObject.prefix.length; + operation.cutEnd = operation.selEnd + event.paramObject.suffix.length; + operation.replacement = ""; + operation.newSelStart = operation.cutStart; + operation.newSelEnd = operation.newSelStart; + } } else { // Wrap the cursor instead operation.cutStart = operation.selStart; diff --git a/core/modules/filters.js b/core/modules/filters.js index b00082bd1..76046b828 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -40,23 +40,12 @@ function parseFilterOperation(operators,filterString,p) { nextBracketPos += p; var bracket = filterString.charAt(nextBracketPos); operator.operator = filterString.substring(p,nextBracketPos); + // Any suffix? var colon = operator.operator.indexOf(':'); if(colon > -1) { - // The raw suffix for older filters operator.suffix = operator.operator.substring(colon + 1); operator.operator = operator.operator.substring(0,colon) || "field"; - // The processed suffix for newer filters - operator.suffixes = []; - $tw.utils.each(operator.suffix.split(":"),function(subsuffix) { - operator.suffixes.push([]); - $tw.utils.each(subsuffix.split(","),function(entry) { - entry = $tw.utils.trim(entry); - if(entry) { - operator.suffixes[operator.suffixes.length - 1].push(entry); - } - }); - }); } // Empty operator means: title else if(operator.operator === "") { @@ -119,7 +108,7 @@ exports.parseFilter = function(filterString) { p = 0, // Current position in the filter string match; var whitespaceRegExp = /(\s+)/mg, - operandRegExp = /((?:\+|\-|~|=)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg; + operandRegExp = /((?:\+|\-)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg; while(p < filterString.length) { // Skip any whitespace whitespaceRegExp.lastIndex = p; @@ -219,7 +208,6 @@ exports.compileFilter = function(filterString) { operand: operand, prefix: operator.prefix, suffix: operator.suffix, - suffixes: operator.suffixes, regexp: operator.regexp },{ wiki: self, @@ -248,10 +236,6 @@ exports.compileFilter = function(filterString) { return function(results,source,widget) { $tw.utils.pushTop(results,operationSubFunction(source,widget)); }; - case "=": // The results of the operation are pushed into the result without deduplication - return function(results,source,widget) { - Array.prototype.push.apply(results,operationSubFunction(source,widget)); - }; case "-": // The results of this operation are removed from the main result return function(results,source,widget) { $tw.utils.removeArrayEntries(results,operationSubFunction(source,widget)); @@ -263,18 +247,11 @@ exports.compileFilter = function(filterString) { results.splice(0,results.length); $tw.utils.pushTop(results,operationSubFunction(source,widget)); }; - case "~": // This operation is unioned into the result only if the main result so far is empty - return function(results,source,widget) { - if(results.length === 0) { - // Main result so far is empty - $tw.utils.pushTop(results,operationSubFunction(source,widget)); - } - }; } })()); }); // Return a function that applies the operations to a source iterator of tiddler titles - return $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) { + return $tw.perf.measure("filter",function filterFunction(source,widget) { if(!source) { source = self.each; } else if(typeof source === "object") { // Array or hashmap diff --git a/core/modules/filters/else.js b/core/modules/filters/else.js deleted file mode 100644 index c3829371e..000000000 --- a/core/modules/filters/else.js +++ /dev/null @@ -1,30 +0,0 @@ -/*\ -title: $:/core/modules/filters/else.js -type: application/javascript -module-type: filteroperator - -Filter operator for replacing an empty input list with a constant, passing a non-empty input list straight through - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.else = function(source,operator,options) { - var results = []; - source(function(tiddler,title) { - results.push(title); - }); - if(results.length === 0) { - return [operator.operand]; - } else { - return results; - } -}; - -})(); diff --git a/core/modules/filters/encodings.js b/core/modules/filters/encodings.js index f41350791..b03354ada 100644 --- a/core/modules/filters/encodings.js +++ b/core/modules/filters/encodings.js @@ -98,13 +98,4 @@ exports.escaperegexp = function(source,operator,options) { return results; }; -exports.escapecss = function(source,operator,options) { - var results = []; - source(function(tiddler,title) { - // escape any character with a special meaning in CSS using CSS.escape() - results.push(CSS.escape(title)); - }); - return results; -}; - })(); diff --git a/core/modules/filters/enlist.js b/core/modules/filters/enlist.js index 0baaa9366..c5e67d54c 100644 --- a/core/modules/filters/enlist.js +++ b/core/modules/filters/enlist.js @@ -16,16 +16,7 @@ Filter operator returning its operand parsed as a list Export our filter function */ exports.enlist = function(source,operator,options) { - var allowDuplicates = false; - switch(operator.suffix) { - case "raw": - allowDuplicates = true; - break; - case "dedupe": - allowDuplicates = false; - break; - } - var list = $tw.utils.parseStringArray(operator.operand,allowDuplicates); + var list = $tw.utils.parseStringArray(operator.operand); if(operator.prefix === "!") { var results = []; source(function(tiddler,title) { diff --git a/core/modules/filters/field.js b/core/modules/filters/field.js index fc8223555..f85df5c0d 100644 --- a/core/modules/filters/field.js +++ b/core/modules/filters/field.js @@ -16,7 +16,7 @@ Filter operator for comparing fields for equality Export our filter function */ exports.field = function(source,operator,options) { - var results = [],indexedResults, + var results = [], fieldname = (operator.suffix || operator.operator || "title").toLowerCase(); if(operator.prefix === "!") { if(operator.regexp) { @@ -53,12 +53,6 @@ exports.field = function(source,operator,options) { } }); } else { - if(source.byField && operator.operand) { - indexedResults = source.byField(fieldname,operator.operand); - if(indexedResults) { - return indexedResults - } - } source(function(tiddler,title) { if(tiddler) { var text = tiddler.getFieldString(fieldname); diff --git a/core/modules/filters/getvariable.js b/core/modules/filters/getvariable.js deleted file mode 100644 index 43451abed..000000000 --- a/core/modules/filters/getvariable.js +++ /dev/null @@ -1,26 +0,0 @@ -/*\ -title: $:/core/modules/filters/getvariable.js -type: application/javascript -module-type: filteroperator - -Filter operator for replacing input values by the value of the variable with the same name, or blank if the variable is missing - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.getvariable = function(source,operator,options) { - var results = []; - source(function(tiddler,title) { - results.push(options.widget.getVariable(title) || ""); - }); - return results; -}; - -})(); diff --git a/core/modules/filters/has.js b/core/modules/filters/has.js index de24ab67b..d05da4113 100644 --- a/core/modules/filters/has.js +++ b/core/modules/filters/has.js @@ -45,7 +45,7 @@ exports.has = function(source,operator,options) { if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && !(tiddler.fields[operator.operand] === "" || tiddler.fields[operator.operand].length === 0)) { results.push(title); } - }); + }); } } return results; diff --git a/core/modules/filters/is/binary.js b/core/modules/filters/is/binary.js deleted file mode 100644 index 01b9aabd3..000000000 --- a/core/modules/filters/is/binary.js +++ /dev/null @@ -1,36 +0,0 @@ -/*\ -title: $:/core/modules/filters/is/binary.js -type: application/javascript -module-type: isfilteroperator - -Filter function for [is[binary]] - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.binary = function(source,prefix,options) { - var results = []; - if(prefix === "!") { - source(function(tiddler,title) { - if(!options.wiki.isBinaryTiddler(title)) { - results.push(title); - } - }); - } else { - source(function(tiddler,title) { - if(options.wiki.isBinaryTiddler(title)) { - results.push(title); - } - }); - } - return results; -}; - -})(); diff --git a/core/modules/filters/is/blank.js b/core/modules/filters/is/blank.js deleted file mode 100644 index 8f500da45..000000000 --- a/core/modules/filters/is/blank.js +++ /dev/null @@ -1,36 +0,0 @@ -/*\ -title: $:/core/modules/filters/is/blank.js -type: application/javascript -module-type: isfilteroperator - -Filter function for [is[blank]] - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.blank = function(source,prefix,options) { - var results = []; - if(prefix === "!") { - source(function(tiddler,title) { - if(title) { - results.push(title); - } - }); - } else { - source(function(tiddler,title) { - if(!title) { - results.push(title); - } - }); - } - return results; -}; - -})(); diff --git a/core/modules/filters/is/variable.js b/core/modules/filters/is/variable.js deleted file mode 100644 index 1f2e5d1b3..000000000 --- a/core/modules/filters/is/variable.js +++ /dev/null @@ -1,36 +0,0 @@ -/*\ -title: $:/core/modules/filters/is/variable.js -type: application/javascript -module-type: isfilteroperator - -Filter function for [is[variable]] - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.variable = function(source,prefix,options) { - var results = []; - if(prefix === "!") { - source(function(tiddler,title) { - if(!(title in options.widget.variables)) { - results.push(title); - } - }); - } else { - source(function(tiddler,title) { - if(title in options.widget.variables) { - results.push(title); - } - }); - } - return results; -}; - -})(); diff --git a/core/modules/filters/match.js b/core/modules/filters/match.js deleted file mode 100644 index 34caf487e..000000000 --- a/core/modules/filters/match.js +++ /dev/null @@ -1,53 +0,0 @@ -/*\ -title: $:/core/modules/filters/match.js -type: application/javascript -module-type: filteroperator - -Filter operator for checking if a title matches a string - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.match = function(source,operator,options) { - var results = [], - suffixes = (operator.suffixes || [])[0] || []; - if(suffixes.indexOf("caseinsensitive") !== -1) { - if(operator.prefix === "!") { - source(function(tiddler,title) { - if(title.toLowerCase() !== (operator.operand || "").toLowerCase()) { - results.push(title); - } - }); - } else { - source(function(tiddler,title) { - if(title.toLowerCase() === (operator.operand || "").toLowerCase()) { - results.push(title); - } - }); - } - } else { - if(operator.prefix === "!") { - source(function(tiddler,title) { - if(title !== operator.operand) { - results.push(title); - } - }); - } else { - source(function(tiddler,title) { - if(title === operator.operand) { - results.push(title); - } - }); - } - } - return results; -}; - -})(); diff --git a/core/modules/filters/math.js b/core/modules/filters/math.js deleted file mode 100644 index c3f6d3b45..000000000 --- a/core/modules/filters/math.js +++ /dev/null @@ -1,146 +0,0 @@ -/*\ -title: $:/core/modules/filters/math.js -type: application/javascript -module-type: filteroperator - -Filter operators for math. Unary/binary operators work on each item in turn, and return a new item list. - -Sum/product/maxall/minall operate on the entire list, returning a single item. - -Note that strings are converted to numbers automatically. Trailing non-digits are ignored. - -* "" converts to 0 -* "12kk" converts to 12 - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -exports.negate = makeNumericBinaryOperator( - function(a) {return -a} -); - -exports.abs = makeNumericBinaryOperator( - function(a) {return Math.abs(a)} -); - -exports.ceil = makeNumericBinaryOperator( - function(a) {return Math.ceil(a)} -); - -exports.floor = makeNumericBinaryOperator( - function(a) {return Math.floor(a)} -); - -exports.round = makeNumericBinaryOperator( - function(a) {return Math.round(a)} -); - -exports.trunc = makeNumericBinaryOperator( - function(a) {return Math.trunc(a)} -); - -exports.untrunc = makeNumericBinaryOperator( - function(a) {return Math.ceil(Math.abs(a)) * Math.sign(a)} -); - -exports.sign = makeNumericBinaryOperator( - function(a) {return Math.sign(a)} -); - -exports.add = makeNumericBinaryOperator( - function(a,b) {return a + b;} -); - -exports.subtract = makeNumericBinaryOperator( - function(a,b) {return a - b;} -); - -exports.multiply = makeNumericBinaryOperator( - function(a,b) {return a * b;} -); - -exports.divide = makeNumericBinaryOperator( - function(a,b) {return a / b;} -); - -exports.remainder = makeNumericBinaryOperator( - function(a,b) {return a % b;} -); - -exports.max = makeNumericBinaryOperator( - function(a,b) {return Math.max(a,b);} -); - -exports.min = makeNumericBinaryOperator( - function(a,b) {return Math.min(a,b);} -); - -exports.fixed = makeNumericBinaryOperator( - function(a,b) {return Number.prototype.toFixed.call(a,Math.min(Math.max(b,0),100));} -); - -exports.precision = makeNumericBinaryOperator( - function(a,b) {return Number.prototype.toPrecision.call(a,Math.min(Math.max(b,1),100));} -); - -exports.exponential = makeNumericBinaryOperator( - function(a,b) {return Number.prototype.toExponential.call(a,Math.min(Math.max(b,0),100));} -); - -exports.sum = makeNumericReducingOperator( - function(accumulator,value) {return accumulator + value}, - 0 // Initial value -); - -exports.product = makeNumericReducingOperator( - function(accumulator,value) {return accumulator * value}, - 1 // Initial value -); - -exports.maxall = makeNumericReducingOperator( - function(accumulator,value) {return Math.max(accumulator,value)}, - -Infinity // Initial value -); - -exports.minall = makeNumericReducingOperator( - function(accumulator,value) {return Math.min(accumulator,value)}, - Infinity // Initial value -); - -function makeNumericBinaryOperator(fnCalc) { - return function(source,operator,options) { - var result = [], - numOperand = parseNumber(operator.operand); - source(function(tiddler,title) { - result.push(stringifyNumber(fnCalc(parseNumber(title),numOperand))); - }); - return result; - }; -} - -function makeNumericReducingOperator(fnCalc,initialValue) { - initialValue = initialValue || 0; - return function(source,operator,options) { - var result = []; - source(function(tiddler,title) { - result.push(title); - }); - return [stringifyNumber(result.reduce(function(accumulator,currentValue) { - return fnCalc(accumulator,parseNumber(currentValue)); - },initialValue))]; - }; -} - -function parseNumber(str) { - return parseFloat(str) || 0; -} - -function stringifyNumber(num) { - return num + ""; -} - -})(); diff --git a/core/modules/filters/range.js b/core/modules/filters/range.js index f46d10699..b08bce1bb 100644 --- a/core/modules/filters/range.js +++ b/core/modules/filters/range.js @@ -34,16 +34,8 @@ exports.range = function(source,operator,options) { } switch(parts.length) { case 1: + beg = 0; end = parts[0]; - if (end >= 1) { - beg = 1; - } - else if (end <= -1) { - beg = -1; - } - else { - return []; - } inc = 1; break; case 2: diff --git a/core/modules/filters/removesuffix.js b/core/modules/filters/removesuffix.js index 3d305aabf..0dac6e598 100644 --- a/core/modules/filters/removesuffix.js +++ b/core/modules/filters/removesuffix.js @@ -18,7 +18,7 @@ Export our filter function exports.removesuffix = function(source,operator,options) { var results = []; source(function(tiddler,title) { - if(title && title.substr(-operator.operand.length) === operator.operand) { + if(title.substr(-operator.operand.length) === operator.operand) { results.push(title.substr(0,title.length - operator.operand.length)); } }); diff --git a/core/modules/filters/search.js b/core/modules/filters/search.js index adcb076a0..933cf7419 100644 --- a/core/modules/filters/search.js +++ b/core/modules/filters/search.js @@ -17,35 +17,11 @@ Export our filter function */ exports.search = function(source,operator,options) { var invert = operator.prefix === "!"; - if(operator.suffixes) { - var hasFlag = function(flag) { - return (operator.suffixes[1] || []).indexOf(flag) !== -1; - }, - excludeFields = false, - fieldList = operator.suffixes[0] || [], - firstField = fieldList[0] || "", - firstChar = firstField.charAt(0), - fields; - if(firstChar === "-") { - fields = [firstField.slice(1)].concat(fieldList.slice(1)); - excludeFields = true; - } else if(fieldList[0] === "*"){ - fields = []; - excludeFields = true; - } else { - fields = fieldList.slice(0); - } + if(operator.suffix) { return options.wiki.search(operator.operand,{ source: source, invert: invert, - field: fields, - excludeField: excludeFields, - caseSensitive: hasFlag("casesensitive"), - literal: hasFlag("literal"), - whitespace: hasFlag("whitespace"), - anchored: hasFlag("anchored"), - regexp: hasFlag("regexp"), - words: hasFlag("words") + field: operator.suffix }); } else { return options.wiki.search(operator.operand,{ diff --git a/core/modules/filters/strings.js b/core/modules/filters/strings.js deleted file mode 100644 index 27273ca41..000000000 --- a/core/modules/filters/strings.js +++ /dev/null @@ -1,93 +0,0 @@ -/*\ -title: $:/core/modules/filters/strings.js -type: application/javascript -module-type: filteroperator - -Filter operators for strings. Unary/binary operators work on each item in turn, and return a new item list. - -Sum/product/maxall/minall operate on the entire list, returning a single item. - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -exports.length = makeStringBinaryOperator( - function(a) {return ["" + ("" + a).length];} -); - -exports.uppercase = makeStringBinaryOperator( - function(a) {return [("" + a).toUpperCase()];} -); - -exports.lowercase = makeStringBinaryOperator( - function(a) {return [("" + a).toLowerCase()];} -); - -exports.sentencecase = makeStringBinaryOperator( - function(a) {return [$tw.utils.toSentenceCase(a)];} -); - -exports.titlecase = makeStringBinaryOperator( - function(a) {return [$tw.utils.toTitleCase(a)];} -); - -exports.trim = makeStringBinaryOperator( - function(a) {return [$tw.utils.trim(a)];} -); - -exports.split = makeStringBinaryOperator( - function(a,b) {return ("" + a).split(b);} -); - -exports.join = makeStringReducingOperator( - function(accumulator,value,operand) { - if(accumulator === null) { - return value; - } else { - return accumulator + operand + value; - } - },null -); - -function makeStringBinaryOperator(fnCalc) { - return function(source,operator,options) { - var result = []; - source(function(tiddler,title) { - Array.prototype.push.apply(result,fnCalc(title,operator.operand || "")); - }); - return result; - }; -} - -function makeStringReducingOperator(fnCalc,initialValue) { - return function(source,operator,options) { - var result = []; - source(function(tiddler,title) { - result.push(title); - }); - return [result.reduce(function(accumulator,currentValue) { - return fnCalc(accumulator,currentValue,operator.operand || ""); - },initialValue)]; - }; -} - -exports.splitregexp = function(source,operator,options) { - var result = [], - suffix = operator.suffix || "", - flags = (suffix.indexOf("m") !== -1 ? "m" : "") + (suffix.indexOf("i") !== -1 ? "i" : ""), - regExp; - try { - regExp = new RegExp(operator.operand || "",flags); - } catch(ex) { - return ["RegExp error: " + ex]; - } - source(function(tiddler,title) { - Array.prototype.push.apply(result,title.split(regExp)); - }); - return result; -}; - -})(); diff --git a/core/modules/filters/subfilter.js b/core/modules/filters/subfilter.js deleted file mode 100644 index 79ae82777..000000000 --- a/core/modules/filters/subfilter.js +++ /dev/null @@ -1,33 +0,0 @@ -/*\ -title: $:/core/modules/filters/subfilter.js -type: application/javascript -module-type: filteroperator - -Filter operator returning its operand evaluated as a filter - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.subfilter = function(source,operator,options) { - var list = options.wiki.filterTiddlers(operator.operand,options.widget,source); - if(operator.prefix === "!") { - var results = []; - source(function(tiddler,title) { - if(list.indexOf(title) === -1) { - results.push(title); - } - }); - return results; - } else { - return list; - } -}; - -})(); diff --git a/core/modules/filters/tag.js b/core/modules/filters/tag.js index e7ddbb361..a0093f565 100644 --- a/core/modules/filters/tag.js +++ b/core/modules/filters/tag.js @@ -16,7 +16,7 @@ Filter operator for checking for the presence of a tag Export our filter function */ exports.tag = function(source,operator,options) { - var results = [],indexedResults; + var results = []; if((operator.suffix || "").toLowerCase() === "strict" && !operator.operand) { // New semantics: // Always return copy of input if operator.operand is missing @@ -25,10 +25,9 @@ exports.tag = function(source,operator,options) { }); } else { // Old semantics: - var tiddlers; + var tiddlers = options.wiki.getTiddlersWithTag(operator.operand); if(operator.prefix === "!") { // Returns a copy of the input if operator.operand is missing - tiddlers = options.wiki.getTiddlersWithTag(operator.operand); source(function(tiddler,title) { if(tiddlers.indexOf(title) === -1) { results.push(title); @@ -36,20 +35,12 @@ exports.tag = function(source,operator,options) { }); } else { // Returns empty results if operator.operand is missing - if(source.byTag) { - indexedResults = source.byTag(operator.operand); - if(indexedResults) { - return indexedResults; + source(function(tiddler,title) { + if(tiddlers.indexOf(title) !== -1) { + results.push(title); } - } else { - tiddlers = options.wiki.getTiddlersWithTag(operator.operand); - source(function(tiddler,title) { - if(tiddlers.indexOf(title) !== -1) { - results.push(title); - } - }); - results = options.wiki.sortByList(results,operator.operand); - } + }); + results = options.wiki.sortByList(results,operator.operand); } } return results; diff --git a/core/modules/filters/then.js b/core/modules/filters/then.js deleted file mode 100644 index 994775c08..000000000 --- a/core/modules/filters/then.js +++ /dev/null @@ -1,26 +0,0 @@ -/*\ -title: $:/core/modules/filters/then.js -type: application/javascript -module-type: filteroperator - -Filter operator for replacing any titles with a constant - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.then = function(source,operator,options) { - var results = []; - source(function(tiddler,title) { - results.push(operator.operand); - }); - return results; -}; - -})(); diff --git a/core/modules/filters/variables.js b/core/modules/filters/variables.js deleted file mode 100644 index fda40a404..000000000 --- a/core/modules/filters/variables.js +++ /dev/null @@ -1,26 +0,0 @@ -/*\ -title: $:/core/modules/filters/variables.js -type: application/javascript -module-type: filteroperator - -Filter operator for returning the names of the active variables - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Export our filter function -*/ -exports.variables = function(source,operator,options) { - var names = []; - for(var variable in options.widget.variables) { - names.push(variable); - } - return names.sort(); -}; - -})(); diff --git a/core/modules/filters/x-listops.js b/core/modules/filters/x-listops.js index dc290a42e..e742e3430 100644 --- a/core/modules/filters/x-listops.js +++ b/core/modules/filters/x-listops.js @@ -95,7 +95,7 @@ Extended filter operators to manipulate the current list. exports.allafter = function (source, operator) { var results = prepare_results(source), index = results.indexOf(operator.operand); - return (index === -1) ? [] : + return (index === -1 || index > (results.length - 2)) ? [] : (operator.suffix) ? results.slice(index) : results.slice(index + 1); }; @@ -106,7 +106,7 @@ Extended filter operators to manipulate the current list. exports.allbefore = function (source, operator) { var results = prepare_results(source), index = results.indexOf(operator.operand); - return (index === -1) ? [] : + return (index < 0) ? [] : (operator.suffix) ? results.slice(0, index + 1) : results.slice(0, index); }; diff --git a/core/modules/indexers/field-indexer.js b/core/modules/indexers/field-indexer.js deleted file mode 100644 index 0f070e5e5..000000000 --- a/core/modules/indexers/field-indexer.js +++ /dev/null @@ -1,143 +0,0 @@ -/*\ -title: $:/core/modules/indexers/field-indexer.js -type: application/javascript -module-type: indexer - -Indexes the tiddlers with each field value - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global modules: false */ -"use strict"; - -var DEFAULT_MAXIMUM_INDEXED_VALUE_LENGTH = 128; - -function FieldIndexer(wiki) { - this.wiki = wiki; -} - -FieldIndexer.prototype.init = function() { - this.index = null; - this.maxIndexedValueLength = DEFAULT_MAXIMUM_INDEXED_VALUE_LENGTH; - this.addIndexMethods(); -} - -// Provided for testing -FieldIndexer.prototype.setMaxIndexedValueLength = function(length) { - this.index = null; - this.maxIndexedValueLength = length; -}; - -FieldIndexer.prototype.addIndexMethods = function() { - var self = this; - this.wiki.each.byField = function(name,value) { - var titles = self.wiki.allTitles(), - lookup = self.lookup(name,value); - return lookup && lookup.filter(function(title) { - return titles.indexOf(title) !== -1; - }); - }; - this.wiki.eachShadow.byField = function(name,value) { - var titles = self.wiki.allShadowTitles(), - lookup = self.lookup(name,value); - return lookup && lookup.filter(function(title) { - return titles.indexOf(title) !== -1; - }); - }; - this.wiki.eachTiddlerPlusShadows.byField = function(name,value) { - var lookup = self.lookup(name,value); - return lookup ? lookup.slice(0) : null; - }; - this.wiki.eachShadowPlusTiddlers.byField = function(name,value) { - var lookup = self.lookup(name,value); - return lookup ? lookup.slice(0) : null; - }; -}; - -/* -Tear down and then rebuild the index as if all tiddlers have changed -*/ -FieldIndexer.prototype.rebuild = function() { - // Invalidate the index so that it will be rebuilt when it is next used - this.index = null; -}; - -/* -Build the index for a particular field -*/ -FieldIndexer.prototype.buildIndexForField = function(name) { - var self = this; - // Hashmap by field name of hashmap by field value of array of tiddler titles - this.index = this.index || Object.create(null); - this.index[name] = Object.create(null); - var baseIndex = this.index[name]; - // Update the index for each tiddler - this.wiki.eachTiddlerPlusShadows(function(tiddler,title) { - if(name in tiddler.fields) { - var value = tiddler.getFieldString(name); - // Skip any values above the maximum length - if(value.length < self.maxIndexedValueLength) { - baseIndex[value] = baseIndex[value] || []; - baseIndex[value].push(title); - } - } - }); -}; - -/* -Update the index in the light of a tiddler value changing; note that the title must be identical. (Renames are handled as a separate delete and create) -updateDescriptor: {old: {tiddler: , shadow: , exists: },new: {tiddler: , shadow: , exists: }} -*/ -FieldIndexer.prototype.update = function(updateDescriptor) { - var self = this; - // Don't do anything if the index hasn't been built yet - if(this.index === null) { - return; - } - // Remove the old tiddler from the index - if(updateDescriptor.old.tiddler) { - $tw.utils.each(this.index,function(indexEntry,name) { - if(name in updateDescriptor.old.tiddler.fields) { - var value = updateDescriptor.old.tiddler.getFieldString(name), - tiddlerList = indexEntry[value]; - if(tiddlerList) { - var index = tiddlerList.indexOf(updateDescriptor.old.tiddler.fields.title); - if(index !== -1) { - tiddlerList.splice(index,1); - } - } - } - }); - } - // Add the new tiddler to the index - if(updateDescriptor["new"].tiddler) { - $tw.utils.each(this.index,function(indexEntry,name) { - if(name in updateDescriptor["new"].tiddler.fields) { - var value = updateDescriptor["new"].tiddler.getFieldString(name); - if(value.length < self.maxIndexedValueLength) { - indexEntry[value] = indexEntry[value] || []; - indexEntry[value].push(updateDescriptor["new"].tiddler.fields.title); - } - } - }); - } -}; - -// Lookup the given field returning a list of tiddler titles -FieldIndexer.prototype.lookup = function(name,value) { - // Fail the lookup if the value is too long - if(value.length >= this.maxIndexedValueLength) { - return null; - } - // Update the index if it has yet to be built - if(this.index === null || !this.index[name]) { - this.buildIndexForField(name); - } - return this.index[name][value] || []; -}; - -exports.FieldIndexer = FieldIndexer; - -})(); diff --git a/core/modules/indexers/tag-indexer.js b/core/modules/indexers/tag-indexer.js deleted file mode 100644 index c7d297fc9..000000000 --- a/core/modules/indexers/tag-indexer.js +++ /dev/null @@ -1,98 +0,0 @@ -/*\ -title: $:/core/modules/indexers/tag-indexer.js -type: application/javascript -module-type: indexer - -Indexes the tiddlers with each tag - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global modules: false */ -"use strict"; - -function TagIndexer(wiki) { - this.wiki = wiki; -} - -TagIndexer.prototype.init = function() { - this.subIndexers = [ - new TagSubIndexer(this,"each"), - new TagSubIndexer(this,"eachShadow"), - new TagSubIndexer(this,"eachTiddlerPlusShadows"), - new TagSubIndexer(this,"eachShadowPlusTiddlers") - ]; - $tw.utils.each(this.subIndexers,function(subIndexer) { - subIndexer.addIndexMethod(); - }); -}; - -TagIndexer.prototype.rebuild = function() { - $tw.utils.each(this.subIndexers,function(subIndexer) { - subIndexer.rebuild(); - }); -}; - -TagIndexer.prototype.update = function(updateDescriptor) { - $tw.utils.each(this.subIndexers,function(subIndexer) { - subIndexer.update(updateDescriptor); - }); -}; - -function TagSubIndexer(indexer,iteratorMethod) { - this.indexer = indexer; - this.iteratorMethod = iteratorMethod; - this.index = null; // Hashmap of tag title to {isSorted: bool, titles: [array]} or null if not yet initialised -} - -TagSubIndexer.prototype.addIndexMethod = function() { - var self = this; - this.indexer.wiki[this.iteratorMethod].byTag = function(tag) { - return self.lookup(tag).slice(0); - }; -}; - -TagSubIndexer.prototype.rebuild = function() { - var self = this; - // Hashmap by tag of array of {isSorted:, titles:[]} - this.index = Object.create(null); - // Add all the tags - this.indexer.wiki[this.iteratorMethod](function(tiddler,title) { - $tw.utils.each(tiddler.fields.tags,function(tag) { - if(!self.index[tag]) { - self.index[tag] = {isSorted: false, titles: [title]}; - } else { - self.index[tag].titles.push(title); - } - }); - }); -}; - -TagSubIndexer.prototype.update = function(updateDescriptor) { - this.index = null; -}; - -TagSubIndexer.prototype.lookup = function(tag) { - // Update the index if it has yet to be built - if(this.index === null) { - this.rebuild(); - } - var indexRecord = this.index[tag]; - if(indexRecord) { - if(!indexRecord.isSorted) { - if(this.indexer.wiki.sortByList) { - indexRecord.titles = this.indexer.wiki.sortByList(indexRecord.titles,tag); - } - indexRecord.isSorted = true; - } - return indexRecord.titles; - } else { - return []; - } -}; - - -exports.TagIndexer = TagIndexer; - -})(); diff --git a/core/modules/info/platform.js b/core/modules/info/platform.js index 94991ea80..ce258daea 100644 --- a/core/modules/info/platform.js +++ b/core/modules/info/platform.js @@ -35,8 +35,6 @@ exports.getInfoTiddlerFields = function() { // Screen size infoTiddlerFields.push({title: "$:/info/browser/screen/width", text: window.screen.width.toString()}); infoTiddlerFields.push({title: "$:/info/browser/screen/height", text: window.screen.height.toString()}); - // Language - infoTiddlerFields.push({title: "$:/info/browser/language", text: navigator.language || ""}); } return infoTiddlerFields; }; diff --git a/core/modules/keyboard.js b/core/modules/keyboard.js index a63d48fbe..bfa76d7e2 100644 --- a/core/modules/keyboard.js +++ b/core/modules/keyboard.js @@ -138,17 +138,6 @@ function KeyboardManager(options) { }); // Save the platform-specific name of the "meta" key this.metaKeyName = $tw.platform.isMac ? "cmd-" : "win-"; - this.shortcutKeysList = [], // Stores the shortcut-key descriptors - this.shortcutActionList = [], // Stores the corresponding action strings - this.shortcutParsedList = []; // Stores the parsed key descriptors - this.lookupNames = ["shortcuts"]; - this.lookupNames.push($tw.platform.isMac ? "shortcuts-mac" : "shortcuts-not-mac") - this.lookupNames.push($tw.platform.isWindows ? "shortcuts-windows" : "shortcuts-not-windows"); - this.lookupNames.push($tw.platform.isLinux ? "shortcuts-linux" : "shortcuts-not-linux"); - this.updateShortcutLists(this.getShortcutTiddlerList()); - $tw.wiki.addEventListener("change",function(changes) { - self.handleShortcutChanges(changes); - }); } /* @@ -240,9 +229,10 @@ KeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options) result.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options)); } }; - $tw.utils.each(self.lookupNames,function(platformDescriptor) { - lookupName(platformDescriptor); - }); + lookupName("shortcuts"); + lookupName($tw.platform.isMac ? "shortcuts-mac" : "shortcuts-not-mac"); + lookupName($tw.platform.isWindows ? "shortcuts-windows" : "shortcuts-not-windows"); + lookupName($tw.platform.isLinux ? "shortcuts-linux" : "shortcuts-not-linux"); } } else { result.push(self.parseKeyDescriptor(keyDescriptor)); @@ -284,70 +274,6 @@ KeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) { return false; }; -KeyboardManager.prototype.getShortcutTiddlerList = function() { - return $tw.wiki.getTiddlersWithTag("$:/tags/KeyboardShortcut"); -}; - -KeyboardManager.prototype.updateShortcutLists = function(tiddlerList) { - this.shortcutTiddlers = tiddlerList; - for(var i=0; i>/> |") + } + return output.join("\n"); +}; + +})(); diff --git a/core/modules/macros/uniquetitle.js b/core/modules/macros/uniquetitle.js deleted file mode 100644 index 8531d1ce7..000000000 --- a/core/modules/macros/uniquetitle.js +++ /dev/null @@ -1,34 +0,0 @@ -/*\ -title: $:/core/modules/macros/unusedtitle.js -type: application/javascript -module-type: macro -Macro to return a new title that is unused in the wiki. It can be given a name as a base. -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Information about this macro -*/ - -exports.name = "unusedtitle"; - -exports.params = [ - {name: "baseName"}, - {name: "options"} -]; - -/* -Run the macro -*/ -exports.run = function(baseName, options) { - if(!baseName) { - baseName = $tw.language.getString("DefaultNewTiddlerTitle"); - } - return this.wiki.generateNewTitle(baseName, options); -}; - -})(); diff --git a/core/modules/parsers/audioparser.js b/core/modules/parsers/audioparser.js index 95380bf80..a34a49398 100644 --- a/core/modules/parsers/audioparser.js +++ b/core/modules/parsers/audioparser.js @@ -17,8 +17,7 @@ var AudioParser = function(type,text,options) { type: "element", tag: "audio", attributes: { - controls: {type: "string", value: "controls"}, - style: {type: "string", value: "width: 100%; object-fit: contain"} + controls: {type: "string", value: "controls"} } }, src; diff --git a/core/modules/parsers/videoparser.js b/core/modules/parsers/videoparser.js index f1c281c7c..c0ab2d603 100644 --- a/core/modules/parsers/videoparser.js +++ b/core/modules/parsers/videoparser.js @@ -17,8 +17,7 @@ var VideoParser = function(type,text,options) { type: "element", tag: "video", attributes: { - controls: {type: "string", value: "controls"}, - style: {type: "string", value: "width: 100%; object-fit: contain"} + controls: {type: "string", value: "controls"} } }, src; @@ -30,9 +29,8 @@ var VideoParser = function(type,text,options) { this.tree = [element]; }; -exports["video/ogg"] = VideoParser; -exports["video/webm"] = VideoParser; exports["video/mp4"] = VideoParser; exports["video/quicktime"] = VideoParser; })(); + diff --git a/core/modules/parsers/wikiparser/rules/transcludeblock.js b/core/modules/parsers/wikiparser/rules/transcludeblock.js index 56a4f63b8..1a5df1e06 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeblock.js +++ b/core/modules/parsers/wikiparser/rules/transcludeblock.js @@ -27,6 +27,8 @@ exports.init = function(parser) { }; exports.parse = function() { + // Move past the match + this.parser.pos = this.matchRegExp.lastIndex; // Move past the match this.parser.pos = this.matchRegExp.lastIndex; // Get the match details diff --git a/core/modules/pluginswitcher.js b/core/modules/pluginswitcher.js index 395dc8b20..ab82be933 100644 --- a/core/modules/pluginswitcher.js +++ b/core/modules/pluginswitcher.js @@ -60,8 +60,6 @@ PluginSwitcher.prototype.switchPlugins = function() { } }; accumulatePlugin(selectedPluginTitle); - // Read the plugin info for the incoming plugins - var changes = $tw.wiki.readPluginInfo(plugins); // Unregister any existing theme tiddlers var unregisteredTiddlers = $tw.wiki.unregisterPluginTiddlers(this.pluginType); // Register any new theme tiddlers diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index 44dc130ff..40747b8d6 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -21,7 +21,6 @@ function SaverHandler(options) { var self = this; this.wiki = options.wiki; this.dirtyTracking = options.dirtyTracking; - this.preloadDirty = options.preloadDirty || []; this.pendingAutoSave = false; // Make a logger this.logger = new $tw.utils.Logger("saver-handler"); @@ -34,13 +33,7 @@ function SaverHandler(options) { // Compile the dirty tiddler filter this.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter)); // Count of changes that have not yet been saved - var filteredChanges = self.filterFn.call(self.wiki,function(iterator) { - $tw.utils.each(self.preloadDirty,function(title) { - var tiddler = self.wiki.getTiddler(title); - iterator(tiddler,title); - }); - }); - this.numChanges = filteredChanges.length; + this.numChanges = 0; // Listen out for changes to tiddlers this.wiki.addEventListener("change",function(changes) { // Filter the changes so that we only count changes to tiddlers that we care about @@ -151,12 +144,8 @@ Save the wiki contents. Options are: SaverHandler.prototype.saveWiki = function(options) { options = options || {}; var self = this, - method = options.method || "save"; - // Ignore autosave if disabled - if(method === "autosave" && this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes") { - return false; - } - var variables = options.variables || {}, + method = options.method || "save", + variables = options.variables || {}, template = options.template || "$:/core/save/all", downloadType = options.downloadType || "text/plain", text = this.wiki.renderTiddler(downloadType,template,options), @@ -175,6 +164,10 @@ SaverHandler.prototype.saveWiki = function(options) { } } }; + // Ignore autosave if disabled + if(method === "autosave" && this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes") { + return false; + } // Call the highest priority saver that supports this method for(var t=this.savers.length-1; t>=0; t--) { var saver = this.savers[t]; diff --git a/core/modules/savers/andtidwiki.js b/core/modules/savers/andtidwiki.js index df2b0ceaa..33e776977 100644 --- a/core/modules/savers/andtidwiki.js +++ b/core/modules/savers/andtidwiki.js @@ -15,50 +15,24 @@ Handles saving changes via the AndTidWiki Android app var AndTidWiki = function(wiki) { }; -AndTidWiki.prototype.save = function(text,method,callback,options) { - var filename = options && options.variables ? options.variables.filename : null; - if (method === "download") { - // Support download - if (window.twi.saveDownload) { - try { - window.twi.saveDownload(text,filename); - } catch(err) { - if (err.message === "Method not found") { - window.twi.saveDownload(text); - } - } - } else { - var link = document.createElement("a"); - link.setAttribute("href","data:text/plain," + encodeURIComponent(text)); - if (filename) { - link.setAttribute("download",filename); - } - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } - } else if (window.twi.saveWiki) { - // Direct save in Tiddloid - window.twi.saveWiki(text); - } else { - // Get the pathname of this document - var pathname = decodeURIComponent(document.location.toString().split("#")[0]); - // Strip the file:// - if(pathname.indexOf("file://") === 0) { - pathname = pathname.substr(7); - } - // Strip any query or location part - var p = pathname.indexOf("?"); - if(p !== -1) { - pathname = pathname.substr(0,p); - } - p = pathname.indexOf("#"); - if(p !== -1) { - pathname = pathname.substr(0,p); - } - // Save the file - window.twi.saveFile(pathname,text); +AndTidWiki.prototype.save = function(text,method,callback) { + // Get the pathname of this document + var pathname = decodeURIComponent(document.location.toString().split("#")[0]); + // Strip the file:// + if(pathname.indexOf("file://") === 0) { + pathname = pathname.substr(7); } + // Strip any query or location part + var p = pathname.indexOf("?"); + if(p !== -1) { + pathname = pathname.substr(0,p); + } + p = pathname.indexOf("#"); + if(p !== -1) { + pathname = pathname.substr(0,p); + } + // Save the file + window.twi.saveFile(pathname,text); // Call the callback callback(null); return true; @@ -70,7 +44,7 @@ Information about this saver AndTidWiki.prototype.info = { name: "andtidwiki", priority: 1600, - capabilities: ["save", "autosave", "download"] + capabilities: ["save", "autosave"] }; /* diff --git a/core/modules/savers/github.js b/core/modules/savers/github.js deleted file mode 100644 index 08f809d19..000000000 --- a/core/modules/savers/github.js +++ /dev/null @@ -1,118 +0,0 @@ -/*\ -title: $:/core/modules/savers/github.js -type: application/javascript -module-type: saver - -Saves wiki by pushing a commit to the GitHub v3 REST API - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Select the appropriate saver module and set it up -*/ -var GitHubSaver = function(wiki) { - this.wiki = wiki; -}; - -GitHubSaver.prototype.save = function(text,method,callback) { - var self = this, - username = this.wiki.getTiddlerText("$:/GitHub/Username"), - password = $tw.utils.getPassword("github"), - repo = this.wiki.getTiddlerText("$:/GitHub/Repo"), - path = this.wiki.getTiddlerText("$:/GitHub/Path"), - filename = this.wiki.getTiddlerText("$:/GitHub/Filename"), - branch = this.wiki.getTiddlerText("$:/GitHub/Branch") || "master", - endpoint = this.wiki.getTiddlerText("$:/GitHub/ServerURL") || "https://api.github.com", - headers = { - "Accept": "application/vnd.github.v3+json", - "Content-Type": "application/json;charset=UTF-8", - "Authorization": "Basic " + window.btoa(username + ":" + password) - }; - // Bail if we don't have everything we need - if(!username || !password || !repo || !path || !filename) { - return false; - } - // Make sure the path start and ends with a slash - if(path.substring(0,1) !== "/") { - path = "/" + path; - } - if(path.substring(path.length - 1) !== "/") { - path = path + "/"; - } - // Compose the base URI - var uri = endpoint + "/repos/" + repo + "/contents" + path; - // Perform a get request to get the details (inc shas) of files in the same path as our file - $tw.utils.httpRequest({ - url: uri, - type: "GET", - headers: headers, - data: { - ref: branch - }, - callback: function(err,getResponseDataJson,xhr) { - var getResponseData,sha = ""; - if(err && xhr.status !== 404) { - return callback(err); - } - if(xhr.status !== 404) { - getResponseData = JSON.parse(getResponseDataJson); - $tw.utils.each(getResponseData,function(details) { - if(details.name === filename) { - sha = details.sha; - } - }); - } - var data = { - message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"), - content: $tw.utils.base64Encode(text), - branch: branch, - sha: sha - }; - // Perform a PUT request to save the file - $tw.utils.httpRequest({ - url: uri + filename, - type: "PUT", - headers: headers, - data: JSON.stringify(data), - callback: function(err,putResponseDataJson,xhr) { - if(err) { - return callback(err); - } - var putResponseData = JSON.parse(putResponseDataJson); - callback(null); - } - }); - } - }); - return true; -}; - -/* -Information about this saver -*/ -GitHubSaver.prototype.info = { - name: "github", - priority: 2000, - capabilities: ["save", "autosave"] -}; - -/* -Static method that returns true if this saver is capable of working -*/ -exports.canSave = function(wiki) { - return true; -}; - -/* -Create an instance of this saver -*/ -exports.create = function(wiki) { - return new GitHubSaver(wiki); -}; - -})(); diff --git a/core/modules/savers/gitlab.js b/core/modules/savers/gitlab.js deleted file mode 100644 index cce69099c..000000000 --- a/core/modules/savers/gitlab.js +++ /dev/null @@ -1,117 +0,0 @@ -/*\ -title: $:/core/modules/savers/gitlab.js -type: application/javascript -module-type: saver - -Saves wiki by pushing a commit to the GitLab REST API - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: true */ -"use strict"; - -/* -Select the appropriate saver module and set it up -*/ -var GitLabSaver = function(wiki) { - this.wiki = wiki; -}; - -GitLabSaver.prototype.save = function(text,method,callback) { - /* See https://docs.gitlab.com/ee/api/repository_files.html */ - var self = this, - username = this.wiki.getTiddlerText("$:/GitLab/Username"), - password = $tw.utils.getPassword("gitlab"), - repo = this.wiki.getTiddlerText("$:/GitLab/Repo"), - path = this.wiki.getTiddlerText("$:/GitLab/Path"), - filename = this.wiki.getTiddlerText("$:/GitLab/Filename"), - branch = this.wiki.getTiddlerText("$:/GitLab/Branch") || "master", - endpoint = this.wiki.getTiddlerText("$:/GitLab/ServerURL") || "https://gitlab.com/api/v4", - headers = { - "Content-Type": "application/json;charset=UTF-8", - "Private-Token": password - }; - // Bail if we don't have everything we need - if(!username || !password || !repo || !path || !filename) { - return false; - } - // Make sure the path start and ends with a slash - if(path.substring(0,1) !== "/") { - path = "/" + path; - } - if(path.substring(path.length - 1) !== "/") { - path = path + "/"; - } - // Compose the base URI - var uri = endpoint + "/projects/" + encodeURIComponent(repo) + "/repository/"; - // Perform a get request to get the details (inc shas) of files in the same path as our file - $tw.utils.httpRequest({ - url: uri + "tree/?path=" + encodeURIComponent(path.replace(/^\/+|\/$/g, '')) + "&branch=" + encodeURIComponent(branch.replace(/^\/+|\/$/g, '')), - type: "GET", - headers: headers, - callback: function(err,getResponseDataJson,xhr) { - var getResponseData,sha = ""; - if(err && xhr.status !== 404) { - return callback(err); - } - var requestType = "POST"; - if(xhr.status !== 404) { - getResponseData = JSON.parse(getResponseDataJson); - $tw.utils.each(getResponseData,function(details) { - if(details.name === filename) { - requestType = "PUT"; - sha = details.sha; - } - }); - } - var data = { - commit_message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"), - content: text, - branch: branch, - sha: sha - }; - // Perform a request to save the file - $tw.utils.httpRequest({ - url: uri + "files/" + encodeURIComponent(path.replace(/^\/+/, '') + filename), - type: requestType, - headers: headers, - data: JSON.stringify(data), - callback: function(err,putResponseDataJson,xhr) { - if(err) { - return callback(err); - } - var putResponseData = JSON.parse(putResponseDataJson); - callback(null); - } - }); - } - }); - return true; -}; - -/* -Information about this saver -*/ -GitLabSaver.prototype.info = { - name: "gitlab", - priority: 2000, - capabilities: ["save", "autosave"] -}; - -/* -Static method that returns true if this saver is capable of working -*/ -exports.canSave = function(wiki) { - return true; -}; - -/* -Create an instance of this saver -*/ -exports.create = function(wiki) { - return new GitLabSaver(wiki); -}; - -})(); diff --git a/core/modules/server/authenticators/basic.js b/core/modules/server/authenticators/basic.js index 9db9b91ff..df14139ed 100644 --- a/core/modules/server/authenticators/basic.js +++ b/core/modules/server/authenticators/basic.js @@ -41,7 +41,7 @@ BasicAuthenticator.prototype.init = function() { this.credentialsData = credentialsData; } } else { - return "Error: Unable to load user credentials from '" + resolveCredentialsFilepath + "'"; + return "Error: Unable to load user credentials from '" + credentialsFilepath + "'"; } } // Add the hardcoded username and password if specified diff --git a/core/modules/server/routes/get-index.js b/core/modules/server/routes/get-index.js index c90341925..603103c6b 100644 --- a/core/modules/server/routes/get-index.js +++ b/core/modules/server/routes/get-index.js @@ -12,38 +12,14 @@ GET / /*global $tw: false */ "use strict"; -var zlib = require("zlib"); - exports.method = "GET"; exports.path = /^\/$/; exports.handler = function(request,response,state) { - var acceptEncoding = request.headers["accept-encoding"]; - if(!acceptEncoding) { - acceptEncoding = ""; - } - var text = state.wiki.renderTiddler(state.server.get("root-render-type"),state.server.get("root-tiddler")), - responseHeaders = { - "Content-Type": state.server.get("root-serve-type") - }; - /* - If the gzip=yes flag for `listen` is set, check if the user agent permits - compression. If so, compress our response. Note that we use the synchronous - functions from zlib to stay in the imperative style. The current `Server` - doesn't depend on this, and we may just as well use the async versions. - */ - if(state.server.enableGzip) { - if (/\bdeflate\b/.test(acceptEncoding)) { - responseHeaders["Content-Encoding"] = "deflate"; - text = zlib.deflateSync(text); - } else if (/\bgzip\b/.test(acceptEncoding)) { - responseHeaders["Content-Encoding"] = "gzip"; - text = zlib.gzipSync(text); - } - } - response.writeHead(200,responseHeaders); - response.end(text); + response.writeHead(200, {"Content-Type": state.server.get("root-serve-type")}); + var text = state.wiki.renderTiddler(state.server.get("root-render-type"),state.server.get("root-tiddler")); + response.end(text,"utf8"); }; }()); diff --git a/core/modules/server/routes/get-tiddler-html.js b/core/modules/server/routes/get-tiddler-html.js index 4fe440821..6f85a1f18 100644 --- a/core/modules/server/routes/get-tiddler-html.js +++ b/core/modules/server/routes/get-tiddler-html.js @@ -20,18 +20,16 @@ exports.handler = function(request,response,state) { var title = decodeURIComponent(state.params[0]), tiddler = state.wiki.getTiddler(title); if(tiddler) { - var renderType = tiddler.getFieldString("_render_type"), - renderTemplate = tiddler.getFieldString("_render_template"); - // Tiddler fields '_render_type' and '_render_template' overwrite - // system wide settings for render type and template + var renderType,template; + // Render ordinary tiddlers as HTML, and system tiddlers in plain text if(state.wiki.isSystemTiddler(title)) { - renderType = renderType || state.server.get("system-tiddler-render-type"); - renderTemplate = renderTemplate || state.server.get("system-tiddler-render-template"); + renderType = state.server.get("system-tiddler-render-type"); + template = state.server.get("system-tiddler-template"); } else { - renderType = renderType || state.server.get("tiddler-render-type"); - renderTemplate = renderTemplate || state.server.get("tiddler-render-template"); + renderType = state.server.get("tiddler-render-type"); + template = state.server.get("tiddler-template"); } - var text = state.wiki.renderTiddler(renderType,renderTemplate,{parseAsInline: true, variables: {currentTiddler: title}}); + var text = state.wiki.renderTiddler(renderType,template,{parseAsInline: true, variables: {currentTiddler: title}}); // Naughty not to set a content-type, but it's the easiest way to ensure the browser will see HTML pages as HTML, and accept plain text tiddlers as CSS or JS response.writeHead(200); response.end(text,"utf8"); diff --git a/core/modules/server/routes/get-tiddler.js b/core/modules/server/routes/get-tiddler.js index e125d7055..9088aa49d 100644 --- a/core/modules/server/routes/get-tiddler.js +++ b/core/modules/server/routes/get-tiddler.js @@ -34,7 +34,6 @@ exports.handler = function(request,response,state) { } }); tiddlerFields.revision = state.wiki.getChangeCount(title); - tiddlerFields.bag = "default"; tiddlerFields.type = tiddlerFields.type || "text/vnd.tiddlywiki"; response.writeHead(200, {"Content-Type": "application/json"}); response.end(JSON.stringify(tiddlerFields),"utf8"); diff --git a/core/modules/server/server.js b/core/modules/server/server.js index 3225b95f3..4eb692df2 100644 --- a/core/modules/server/server.js +++ b/core/modules/server/server.js @@ -43,8 +43,6 @@ function Server(options) { $tw.utils.extend({},this.defaultVariables,options.variables); // Initialise CSRF this.csrfDisable = this.get("csrf-disable") === "yes"; - // Initialize Gzip compression - this.enableGzip = this.get("gzip") === "yes"; // Initialise authorization var authorizedUserName = (this.get("username") && this.get("password")) ? this.get("username") : "(anon)"; this.authorizationPrincipals = { @@ -83,11 +81,10 @@ Server.prototype.defaultVariables = { "root-render-type": "text/plain", "root-serve-type": "text/html", "tiddler-render-type": "text/html", - "tiddler-render-template": "$:/core/templates/server/static.tiddler.html", + "tiddler-template": "$:/core/templates/server/static.tiddler.html", "system-tiddler-render-type": "text/plain", - "system-tiddler-render-template": "$:/core/templates/wikified-tiddler", - "debug-level": "none", - "gzip": "no" + "system-tiddler-template": "$:/core/templates/wikified-tiddler", + "debug-level": "none" }; Server.prototype.get = function(name) { @@ -232,19 +229,17 @@ Server.prototype.requestHandler = function(request,response) { /* Listen for requests port: optional port number (falls back to value of "port" variable) -host: optional host address (falls back to value of "host" variable) -prefix: optional prefix (falls back to value of "path-prefix" variable) +host: optional host address (falls back to value of "hist" variable) */ -Server.prototype.listen = function(port,host,prefix) { +Server.prototype.listen = function(port,host) { // Handle defaults for port and host port = port || this.get("port"); host = host || this.get("host"); - prefix = prefix || this.get("path-prefix") || ""; // Check for the port being a string and look it up as an environment variable if(parseInt(port,10).toString() !== port) { port = process.env[port] || 8080; } - $tw.utils.log("Serving on " + this.protocol + "://" + host + ":" + port + prefix,"brown/orange"); + $tw.utils.log("Serving on " + this.protocol + "://" + host + ":" + port,"brown/orange"); $tw.utils.log("(press ctrl-C to exit)","red"); // Warn if required plugins are missing if(!$tw.wiki.getTiddler("$:/plugins/tiddlywiki/tiddlyweb") || !$tw.wiki.getTiddler("$:/plugins/tiddlywiki/filesystem")) { diff --git a/core/modules/startup/browser-messaging.js b/core/modules/startup/browser-messaging.js index bee6d4988..c67090464 100644 --- a/core/modules/startup/browser-messaging.js +++ b/core/modules/startup/browser-messaging.js @@ -144,9 +144,9 @@ exports.startup = function() { }); // Listen for window messages from other windows window.addEventListener("message",function listener(event){ - // console.log("browser-messaging: ",document.location.toString()) - // console.log("browser-messaging: Received message from",event.origin); - // console.log("browser-messaging: Message content",event.data); + console.log("browser-messaging: ",document.location.toString()) + console.log("browser-messaging: Received message from",event.origin); + console.log("browser-messaging: Message content",event.data); switch(event.data.verb) { case "GET-RESPONSE": if(event.data.status.charAt(0) === "2") { diff --git a/core/modules/startup/css-escape-polyfill.js b/core/modules/startup/css-escape-polyfill.js deleted file mode 100644 index 288a7336b..000000000 --- a/core/modules/startup/css-escape-polyfill.js +++ /dev/null @@ -1,114 +0,0 @@ -/*\ -title: $:/core/modules/startup/CSSescape.js -type: application/javascript -module-type: startup - -Polyfill for CSS.escape() - -\*/ -(function(root,factory){ -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -// Export name and synchronous status -exports.name = "css-escape"; -exports.platforms = ["browser"]; -exports.after = ["startup"]; -exports.synchronous = true; - -/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */ -// https://github.com/umdjs/umd/blob/master/returnExports.js -exports.startup = factory(root); -}(typeof global != 'undefined' ? global : this, function(root) { - - if (root.CSS && root.CSS.escape) { - return; - } - - // https://drafts.csswg.org/cssom/#serialize-an-identifier - var cssEscape = function(value) { - if (arguments.length == 0) { - throw new TypeError('`CSS.escape` requires an argument.'); - } - var string = String(value); - var length = string.length; - var index = -1; - var codeUnit; - var result = ''; - var firstCodeUnit = string.charCodeAt(0); - while (++index < length) { - codeUnit = string.charCodeAt(index); - // Note: there’s no need to special-case astral symbols, surrogate - // pairs, or lone surrogates. - - // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER - // (U+FFFD). - if (codeUnit == 0x0000) { - result += '\uFFFD'; - continue; - } - - if ( - // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is - // U+007F, […] - (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F || - // If the character is the first character and is in the range [0-9] - // (U+0030 to U+0039), […] - (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || - // If the character is the second character and is in the range [0-9] - // (U+0030 to U+0039) and the first character is a `-` (U+002D), […] - ( - index == 1 && - codeUnit >= 0x0030 && codeUnit <= 0x0039 && - firstCodeUnit == 0x002D - ) - ) { - // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point - result += '\\' + codeUnit.toString(16) + ' '; - continue; - } - - if ( - // If the character is the first character and is a `-` (U+002D), and - // there is no second character, […] - index == 0 && - length == 1 && - codeUnit == 0x002D - ) { - result += '\\' + string.charAt(index); - continue; - } - - // If the character is not handled by one of the above rules and is - // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or - // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to - // U+005A), or [a-z] (U+0061 to U+007A), […] - if ( - codeUnit >= 0x0080 || - codeUnit == 0x002D || - codeUnit == 0x005F || - codeUnit >= 0x0030 && codeUnit <= 0x0039 || - codeUnit >= 0x0041 && codeUnit <= 0x005A || - codeUnit >= 0x0061 && codeUnit <= 0x007A - ) { - // the character itself - result += string.charAt(index); - continue; - } - - // Otherwise, the escaped character. - // https://drafts.csswg.org/cssom/#escape-a-character - result += '\\' + string.charAt(index); - - } - return result; - }; - - if (!root.CSS) { - root.CSS = {}; - } - - root.CSS.escape = cssEscape; - -})); diff --git a/core/modules/startup/info.js b/core/modules/startup/info.js index 7efaa5b0e..1ebf568f4 100644 --- a/core/modules/startup/info.js +++ b/core/modules/startup/info.js @@ -18,8 +18,6 @@ exports.before = ["startup"]; exports.after = ["load-modules"]; exports.synchronous = true; -var TITLE_INFO_PLUGIN = "$:/temp/info-plugin"; - exports.startup = function() { // Collect up the info tiddlers var infoTiddlerFields = {}; @@ -34,15 +32,15 @@ exports.startup = function() { }); } }); - // Bake the info tiddlers into a plugin. We use the non-standard plugin-type "info" because ordinary plugins are only registered asynchronously after being loaded dynamically + // Bake the info tiddlers into a plugin var fields = { - title: TITLE_INFO_PLUGIN, + title: "$:/temp/info-plugin", type: "application/json", "plugin-type": "info", text: JSON.stringify({tiddlers: infoTiddlerFields},null,$tw.config.preferences.jsonSpaces) }; $tw.wiki.addTiddler(new $tw.Tiddler(fields)); - $tw.wiki.readPluginInfo([TITLE_INFO_PLUGIN]); + $tw.wiki.readPluginInfo(); $tw.wiki.registerPluginTiddlers("info"); $tw.wiki.unpackPluginTiddlers(); }; diff --git a/core/modules/startup/load-modules.js b/core/modules/startup/load-modules.js index e2234d0ac..6dc703111 100644 --- a/core/modules/startup/load-modules.js +++ b/core/modules/startup/load-modules.js @@ -27,7 +27,6 @@ exports.startup = function() { $tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield"); $tw.modules.applyMethods("tiddlermethod",$tw.Tiddler.prototype); $tw.modules.applyMethods("wikimethod",$tw.Wiki.prototype); - $tw.wiki.addIndexersToWiki(); $tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules); $tw.macros = $tw.modules.getModulesByTypeAsHashmap("macro"); $tw.wiki.initParsers(); diff --git a/core/modules/startup/plugins.js b/core/modules/startup/plugins.js deleted file mode 100644 index 907579dbe..000000000 --- a/core/modules/startup/plugins.js +++ /dev/null @@ -1,59 +0,0 @@ -/*\ -title: $:/core/modules/startup/plugins.js -type: application/javascript -module-type: startup - -Startup logic concerned with managing plugins - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -// Export name and synchronous status -exports.name = "plugins"; -exports.after = ["load-modules"]; -exports.synchronous = true; - -var TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = "$:/status/RequireReloadDueToPluginChange"; - -var PREFIX_CONFIG_REGISTER_PLUGIN_TYPE = "$:/config/RegisterPluginType/"; - -exports.startup = function() { - $tw.wiki.addTiddler({title: TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE,text: "no"}); - $tw.wiki.addEventListener("change",function(changes) { - var changesToProcess = [], - requireReloadDueToPluginChange = false; - $tw.utils.each(Object.keys(changes),function(title) { - var tiddler = $tw.wiki.getTiddler(title), - requiresReload = $tw.wiki.doesPluginRequireReload(title); - if(requiresReload) { - requireReloadDueToPluginChange = true; - } else if(tiddler) { - var pluginType = tiddler.fields["plugin-type"]; - if($tw.wiki.getTiddlerText(PREFIX_CONFIG_REGISTER_PLUGIN_TYPE + (tiddler.fields["plugin-type"] || ""),"no") === "yes") { - changesToProcess.push(title); - } - } - }); - if(requireReloadDueToPluginChange) { - $tw.wiki.addTiddler({title: TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE,text: "yes"}); - } - // Read or delete the plugin info of the changed tiddlers - if(changesToProcess.length > 0) { - var changes = $tw.wiki.readPluginInfo(changesToProcess); - if(changes.modifiedPlugins.length > 0 || changes.deletedPlugins.length > 0) { - // (Re-)register any modified plugins - $tw.wiki.registerPluginTiddlers(null,changes.modifiedPlugins); - // Unregister any deleted plugins - $tw.wiki.unregisterPluginTiddlers(null,changes.deletedPlugins); - // Unpack the shadow tiddlers - $tw.wiki.unpackPluginTiddlers(); - } - } - }); -}; - -})(); diff --git a/core/modules/startup/render.js b/core/modules/startup/render.js index 05ba9844d..4e7d7c828 100644 --- a/core/modules/startup/render.js +++ b/core/modules/startup/render.js @@ -25,7 +25,7 @@ var PAGE_TEMPLATE_TITLE = "$:/core/ui/PageTemplate"; // Time (in ms) that we defer refreshing changes to draft tiddlers var DRAFT_TIDDLER_TIMEOUT_TITLE = "$:/config/Drafts/TypingTimeout"; -var THROTTLE_REFRESH_TIMEOUT = 400; +var DRAFT_TIDDLER_TIMEOUT = 400; exports.startup = function() { // Set up the title @@ -71,19 +71,18 @@ exports.startup = function() { timerId; function refresh() { // Process the refresh - $tw.hooks.invokeHook("th-page-refreshing"); $tw.pageWidgetNode.refresh(deferredChanges); deferredChanges = Object.create(null); - $tw.hooks.invokeHook("th-page-refreshed"); + $tw.hooks.invokeHook("th-page-refreshed"); } // Add the change event handler $tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) { - // Check if only tiddlers that are throttled have changed - var onlyThrottledTiddlersHaveChanged = true; + // Check if only drafts have changed + var onlyDraftsHaveChanged = true; for(var title in changes) { var tiddler = $tw.wiki.getTiddler(title); - if(!tiddler || !(tiddler.hasField("draft.of") || tiddler.hasField("throttle.refresh"))) { - onlyThrottledTiddlersHaveChanged = false; + if(!tiddler || !tiddler.hasField("draft.of")) { + onlyDraftsHaveChanged = false; } } // Defer the change if only drafts have changed @@ -91,10 +90,10 @@ exports.startup = function() { clearTimeout(timerId); } timerId = null; - if(onlyThrottledTiddlersHaveChanged) { + if(onlyDraftsHaveChanged) { var timeout = parseInt($tw.wiki.getTiddlerText(DRAFT_TIDDLER_TIMEOUT_TITLE,""),10); if(isNaN(timeout)) { - timeout = THROTTLE_REFRESH_TIMEOUT; + timeout = DRAFT_TIDDLER_TIMEOUT; } timerId = setTimeout(refresh,timeout); $tw.utils.extend(deferredChanges,changes); diff --git a/core/modules/startup/rootwidget.js b/core/modules/startup/rootwidget.js index d02748b28..0fdcfd9a2 100644 --- a/core/modules/startup/rootwidget.js +++ b/core/modules/startup/rootwidget.js @@ -23,7 +23,7 @@ exports.startup = function() { // Install the modal message mechanism $tw.modal = new $tw.utils.Modal($tw.wiki); $tw.rootWidget.addEventListener("tm-modal",function(event) { - $tw.modal.display(event.param,{variables: event.paramObject, event: event}); + $tw.modal.display(event.param,{variables: event.paramObject}); }); // Install the notification mechanism $tw.notifier = new $tw.utils.Notifier($tw.wiki); @@ -34,19 +34,6 @@ exports.startup = function() { $tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) { $tw.utils.copyToClipboard(event.param); }); - // Install the tm-focus-selector message - $tw.rootWidget.addEventListener("tm-focus-selector",function(event) { - var selector = event.param || "", - element; - try { - element = document.querySelector(selector); - } catch(e) { - console.log("Error in selector: ",selector) - } - if(element && element.focus) { - element.focus(event.paramObject); - } - }); // Install the scroller $tw.pageScroller = new $tw.utils.PageScroller(); $tw.rootWidget.addEventListener("tm-scroll",function(event) { @@ -55,16 +42,15 @@ exports.startup = function() { var fullscreen = $tw.utils.getFullScreenApis(); if(fullscreen) { $tw.rootWidget.addEventListener("tm-full-screen",function(event) { - var fullScreenDocument = event.event ? event.event.target.ownerDocument : document; if(event.param === "enter") { - fullScreenDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT); + event.event.target.ownerDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT); } else if(event.param === "exit") { - fullScreenDocument[fullscreen._exitFullscreen](); + event.event.target.ownerDocument[fullscreen._exitFullscreen](); } else { - if(fullScreenDocument[fullscreen._fullscreenElement]) { - fullScreenDocument[fullscreen._exitFullscreen](); + if(event.event.target.ownerDocument[fullscreen._fullscreenElement]) { + event.event.target.ownerDocument[fullscreen._exitFullscreen](); } else { - fullScreenDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT); + event.event.target.ownerDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT); } } }); diff --git a/core/modules/startup/startup.js b/core/modules/startup/startup.js index 4cd53dfcd..a0ecac23e 100755 --- a/core/modules/startup/startup.js +++ b/core/modules/startup/startup.js @@ -34,7 +34,7 @@ exports.startup = function() { if($tw.browser) { $tw.platform.isMac = /Mac/.test(navigator.platform); $tw.platform.isWindows = /win/i.test(navigator.platform); - $tw.platform.isLinux = /Linux/i.test(navigator.platform); + $tw.platform.isLinux = /Linux/i.test(navigator.appVersion); } else { switch(require("os").platform()) { case "darwin": @@ -55,27 +55,6 @@ exports.startup = function() { $tw.version = $tw.utils.extractVersionInfo(); // Set up the performance framework $tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,"no") === "yes"); - // Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers - $tw.rootWidget = new widget.widget({ - type: "widget", - children: [] - },{ - wiki: $tw.wiki, - document: $tw.browser ? document : $tw.fakeDocument - }); - // Execute any startup actions - var executeStartupTiddlers = function(tag) { - $tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) { - $tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget); - }); - }; - executeStartupTiddlers("$:/tags/StartupAction"); - if($tw.browser) { - executeStartupTiddlers("$:/tags/StartupAction/Browser"); - } - if($tw.node) { - executeStartupTiddlers("$:/tags/StartupAction/Node"); - } // Kick off the language manager and switcher $tw.language = new $tw.Language(); $tw.languageSwitcher = new $tw.PluginSwitcher({ @@ -83,7 +62,7 @@ exports.startup = function() { pluginType: "language", controllerTitle: "$:/language", defaultPlugins: [ - "$:/languages/en-GB" + "$:/languages/en-US" ], onSwitch: function(plugins) { if($tw.browser) { @@ -108,13 +87,26 @@ exports.startup = function() { }); // Kick off the keyboard manager $tw.keyboardManager = new $tw.KeyboardManager(); - // Listen for shortcuts + // Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers + $tw.rootWidget = new widget.widget({ + type: "widget", + children: [] + },{ + wiki: $tw.wiki, + document: $tw.browser ? document : $tw.fakeDocument + }); + // Execute any startup actions + var executeStartupTiddlers = function(tag) { + $tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) { + $tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget); + }); + }; + executeStartupTiddlers("$:/tags/StartupAction"); if($tw.browser) { - $tw.utils.addEventListeners(document,[{ - name: "keydown", - handlerObject: $tw.keyboardManager, - handlerMethod: "handleKeydownEvent" - }]); + executeStartupTiddlers("$:/tags/StartupAction/Browser"); + } + if($tw.node) { + executeStartupTiddlers("$:/tags/StartupAction/Node"); } // Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup $tw.wiki.clearTiddlerEventQueue(); @@ -130,11 +122,7 @@ exports.startup = function() { $tw.syncer = new $tw.Syncer({wiki: $tw.wiki, syncadaptor: $tw.syncadaptor}); } // Setup the saver handler - $tw.saverHandler = new $tw.SaverHandler({ - wiki: $tw.wiki, - dirtyTracking: !$tw.syncadaptor, - preloadDirty: $tw.boot.preloadDirty || [] - }); + $tw.saverHandler = new $tw.SaverHandler({wiki: $tw.wiki, dirtyTracking: !$tw.syncadaptor}); // Host-specific startup if($tw.browser) { // Install the popup manager diff --git a/core/modules/startup/story.js b/core/modules/startup/story.js index 14d45554a..116dc6d2c 100644 --- a/core/modules/startup/story.js +++ b/core/modules/startup/story.js @@ -31,14 +31,9 @@ var CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD = "$:/config/Navigation/Permalinkview var CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR = "$:/config/Navigation/Permalinkview/UpdateAddressBar"; // Can be "yes" (default) or "no" -// Links to help, if there is no param -var HELP_OPEN_EXTERNAL_WINDOW = "http://tiddlywiki.com/#WidgetMessage%3A%20tm-open-external-window"; - exports.startup = function() { // Open startup tiddlers - openStartupTiddlers({ - disableHistory: $tw.boot.disableStartupNavigation - }); + openStartupTiddlers(); if($tw.browser) { // Set up location hash update $tw.wiki.addEventListener("change",function(changes) { @@ -61,14 +56,6 @@ exports.startup = function() { $tw.rootWidget.addEventListener("tm-browser-refresh",function(event) { window.location.reload(true); }); - // Listen for tm-open-external-window message - $tw.rootWidget.addEventListener("tm-open-external-window",function(event) { - var paramObject = event.paramObject || {}, - strUrl = event.param || HELP_OPEN_EXTERNAL_WINDOW, - strWindowName = paramObject.windowName, - strWindowFeatures = paramObject.windowFeatures; - window.open(strUrl, strWindowName, strWindowFeatures); - }); // Listen for the tm-print message $tw.rootWidget.addEventListener("tm-print",function(event) { (event.event.view || window).print(); @@ -82,7 +69,7 @@ exports.startup = function() { storyList = $tw.hooks.invokeHook("th-opening-default-tiddlers-list",storyList); $tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields()); if(storyList[0]) { - $tw.wiki.addToHistory(storyList[0]); + $tw.wiki.addToHistory(storyList[0]); } }); // Listen for the tm-permalink message @@ -108,7 +95,6 @@ exports.startup = function() { /* Process the location hash to open the specified tiddlers. Options: -disableHistory: if true $:/History is NOT updated defaultToCurrentStory: If true, the current story is retained as the default, instead of opening the default tiddlers */ function openStartupTiddlers(options) { @@ -149,18 +135,15 @@ function openStartupTiddlers(options) { } // Save the story list $tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields()); - // Update history - if(!options.disableHistory) { - // If a target tiddler was specified add it to the history stack - if(target && target !== "") { - // The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present - if(target.indexOf("[[") === 0 && target.substr(-2) === "]]") { - target = target.substr(2,target.length - 4); - } - $tw.wiki.addToHistory(target); - } else if(storyList.length > 0) { - $tw.wiki.addToHistory(storyList[0]); - } + // If a target tiddler was specified add it to the history stack + if(target && target !== "") { + // The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present + if(target.indexOf("[[") === 0 && target.substr(-2) === "]]") { + target = target.substr(2,target.length - 4); + } + $tw.wiki.addToHistory(target); + } else if(storyList.length > 0) { + $tw.wiki.addToHistory(storyList[0]); } } diff --git a/core/modules/startup/windows.js b/core/modules/startup/windows.js index 16b8f0316..69966f346 100644 --- a/core/modules/startup/windows.js +++ b/core/modules/startup/windows.js @@ -28,22 +28,13 @@ exports.startup = function() { var refreshHandler, title = event.param || event.tiddlerTitle, paramObject = event.paramObject || {}, - windowTitle = paramObject.windowTitle || title, template = paramObject.template || "$:/core/templates/single.tiddler.window", width = paramObject.width || "700", height = paramObject.height || "600", variables = $tw.utils.extend({},paramObject,{currentTiddler: title}); // Open the window - var srcWindow, - srcDocument; - // In case that popup blockers deny opening a new window - try { - srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height), + var srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height), srcDocument = srcWindow.document; - } - catch(e) { - return; - } windows[title] = srcWindow; // Check for reopening the same window if(srcWindow.haveInitialisedWindow) { @@ -52,7 +43,7 @@ exports.startup = function() { // Initialise the document srcDocument.write(""); srcDocument.close(); - srcDocument.title = windowTitle; + srcDocument.title = title; srcWindow.addEventListener("beforeunload",function(event) { delete windows[title]; $tw.wiki.removeEventListener("change",refreshHandler); @@ -79,16 +70,6 @@ exports.startup = function() { widgetNode.refresh(changes); }; $tw.wiki.addEventListener("change",refreshHandler); - // Listen for keyboard shortcuts - $tw.utils.addEventListeners(srcDocument,[{ - name: "keydown", - handlerObject: $tw.keyboardManager, - handlerMethod: "handleKeydownEvent" - },{ - name: "click", - handlerObject: $tw.popup, - handlerMethod: "handleEvent" - }]); srcWindow.haveInitialisedWindow = true; }); // Close open windows when unloading main window diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index e5f726f5f..1474d4512 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -19,7 +19,6 @@ var ClassicStoryView = function(listWidget) { }; ClassicStoryView.prototype.navigateTo = function(historyInfo) { - var duration = $tw.utils.getAnimationDuration() var listElementIndex = this.listWidget.findListItem(0,historyInfo.title); if(listElementIndex === undefined) { return; @@ -30,90 +29,80 @@ ClassicStoryView.prototype.navigateTo = function(historyInfo) { if(!(targetElement instanceof Element)) { return; } - if(duration) { - // Scroll the node into view - this.listWidget.dispatchEvent({type: "tm-scroll", target: targetElement}); - } else { - targetElement.scrollIntoView(); - } + // Scroll the node into view + this.listWidget.dispatchEvent({type: "tm-scroll", target: targetElement}); }; ClassicStoryView.prototype.insert = function(widget) { - var duration = $tw.utils.getAnimationDuration(); - if(duration) { - var targetElement = widget.findFirstDomNode(); - // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { - return; - } - // Get the current height of the tiddler - var computedStyle = window.getComputedStyle(targetElement), - currMarginBottom = parseInt(computedStyle.marginBottom,10), - currMarginTop = parseInt(computedStyle.marginTop,10), - currHeight = targetElement.offsetHeight + currMarginTop; - // Reset the margin once the transition is over - setTimeout(function() { - $tw.utils.setStyle(targetElement,[ - {transition: "none"}, - {marginBottom: ""} - ]); - },duration); - // Set up the initial position of the element + var targetElement = widget.findFirstDomNode(), + duration = $tw.utils.getAnimationDuration(); + // Abandon if the list entry isn't a DOM element (it might be a text node) + if(!(targetElement instanceof Element)) { + return; + } + // Get the current height of the tiddler + var computedStyle = window.getComputedStyle(targetElement), + currMarginBottom = parseInt(computedStyle.marginBottom,10), + currMarginTop = parseInt(computedStyle.marginTop,10), + currHeight = targetElement.offsetHeight + currMarginTop; + // Reset the margin once the transition is over + setTimeout(function() { $tw.utils.setStyle(targetElement,[ {transition: "none"}, - {marginBottom: (-currHeight) + "px"}, - {opacity: "0.0"} + {marginBottom: ""} ]); - $tw.utils.forceLayout(targetElement); - // Transition to the final position - $tw.utils.setStyle(targetElement,[ - {transition: "opacity " + duration + "ms " + easing + ", " + - "margin-bottom " + duration + "ms " + easing}, - {marginBottom: currMarginBottom + "px"}, - {opacity: "1.0"} + },duration); + // Set up the initial position of the element + $tw.utils.setStyle(targetElement,[ + {transition: "none"}, + {marginBottom: (-currHeight) + "px"}, + {opacity: "0.0"} + ]); + $tw.utils.forceLayout(targetElement); + // Transition to the final position + $tw.utils.setStyle(targetElement,[ + {transition: "opacity " + duration + "ms " + easing + ", " + + "margin-bottom " + duration + "ms " + easing}, + {marginBottom: currMarginBottom + "px"}, + {opacity: "1.0"} ]); - } }; ClassicStoryView.prototype.remove = function(widget) { - var duration = $tw.utils.getAnimationDuration(); - if(duration) { - var targetElement = widget.findFirstDomNode(), - removeElement = function() { - widget.removeChildDomNodes(); - }; - // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { - removeElement(); - return; - } - // Get the current height of the tiddler - var currWidth = targetElement.offsetWidth, - computedStyle = window.getComputedStyle(targetElement), - currMarginBottom = parseInt(computedStyle.marginBottom,10), - currMarginTop = parseInt(computedStyle.marginTop,10), - currHeight = targetElement.offsetHeight + currMarginTop; - // Remove the dom nodes of the widget at the end of the transition - setTimeout(removeElement,duration); - // Animate the closure - $tw.utils.setStyle(targetElement,[ - {transition: "none"}, - {transform: "translateX(0px)"}, - {marginBottom: currMarginBottom + "px"}, - {opacity: "1.0"} - ]); - $tw.utils.forceLayout(targetElement); - $tw.utils.setStyle(targetElement,[ - {transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms " + easing + ", " + - "opacity " + duration + "ms " + easing + ", " + - "margin-bottom " + duration + "ms " + easing}, - {transform: "translateX(-" + currWidth + "px)"}, - {marginBottom: (-currHeight) + "px"}, - {opacity: "0.0"} - ]); - } else { - widget.removeChildDomNodes(); + var targetElement = widget.findFirstDomNode(), + duration = $tw.utils.getAnimationDuration(), + removeElement = function() { + widget.removeChildDomNodes(); + }; + // Abandon if the list entry isn't a DOM element (it might be a text node) + if(!(targetElement instanceof Element)) { + removeElement(); + return; } + // Get the current height of the tiddler + var currWidth = targetElement.offsetWidth, + computedStyle = window.getComputedStyle(targetElement), + currMarginBottom = parseInt(computedStyle.marginBottom,10), + currMarginTop = parseInt(computedStyle.marginTop,10), + currHeight = targetElement.offsetHeight + currMarginTop; + // Remove the dom nodes of the widget at the end of the transition + setTimeout(removeElement,duration); + // Animate the closure + $tw.utils.setStyle(targetElement,[ + {transition: "none"}, + {transform: "translateX(0px)"}, + {marginBottom: currMarginBottom + "px"}, + {opacity: "1.0"} + ]); + $tw.utils.forceLayout(targetElement); + $tw.utils.setStyle(targetElement,[ + {transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms " + easing + ", " + + "opacity " + duration + "ms " + easing + ", " + + "margin-bottom " + duration + "ms " + easing}, + {transform: "translateX(-" + currWidth + "px)"}, + {marginBottom: (-currHeight) + "px"}, + {opacity: "0.0"} + ]); }; exports.classic = ClassicStoryView; diff --git a/core/modules/storyviews/pop.js b/core/modules/storyviews/pop.js index d0592cf18..1896633f4 100644 --- a/core/modules/storyviews/pop.js +++ b/core/modules/storyviews/pop.js @@ -44,14 +44,7 @@ PopStoryView.prototype.insert = function(widget) { {transition: "none"}, {transform: "none"} ]); - $tw.utils.setStyle(widget.document.body,[ - {"overflow-x": ""} - ]); },duration); - // Prevent the page from overscrolling due to the zoom factor - $tw.utils.setStyle(widget.document.body,[ - {"overflow-x": "hidden"} - ]); // Set up the initial position of the element $tw.utils.setStyle(targetElement,[ {transition: "none"}, @@ -72,7 +65,7 @@ PopStoryView.prototype.remove = function(widget) { var targetElement = widget.findFirstDomNode(), duration = $tw.utils.getAnimationDuration(), removeElement = function() { - if(targetElement && targetElement.parentNode) { + if(targetElement.parentNode) { widget.removeChildDomNodes(); } }; diff --git a/core/modules/syncer.js b/core/modules/syncer.js index 0b84be750..e6d86ea61 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -20,8 +20,6 @@ Syncer.prototype.titleIsAnonymous = "$:/status/IsAnonymous"; Syncer.prototype.titleIsReadOnly = "$:/status/IsReadOnly"; Syncer.prototype.titleUserName = "$:/status/UserName"; Syncer.prototype.titleSyncFilter = "$:/config/SyncFilter"; -Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval"; -Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading"; Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done"; Syncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s... @@ -45,7 +43,7 @@ function Syncer(options) { this.taskTimerInterval = options.taskTimerInterval || this.taskTimerInterval; this.throttleInterval = options.throttleInterval || this.throttleInterval; this.fallbackInterval = options.fallbackInterval || this.fallbackInterval; - this.pollTimerInterval = options.pollTimerInterval || parseInt(this.wiki.getTiddlerText(this.titleSyncPollingInterval,""),10) || this.pollTimerInterval; + this.pollTimerInterval = options.pollTimerInterval || this.pollTimerInterval; this.logging = "logging" in options ? options.logging : true; // Make a logger this.logger = new $tw.utils.Logger("syncer" + ($tw.browser ? "-browser" : "") + ($tw.node ? "-server" : "") + (this.syncadaptor.name ? ("-" + this.syncadaptor.name) : ""),{ @@ -88,7 +86,7 @@ function Syncer(options) { }); } // Listen out for lazyLoad events - if(!this.disableUI && $tw.wiki.getTiddlerText(this.titleSyncDisableLazyLoading) !== "yes") { + if(!this.disableUI) { this.wiki.addEventListener("lazyLoad",function(title) { self.handleLazyLoadEvent(title); }); @@ -155,7 +153,7 @@ Save an incoming tiddler in the store, and updates the associated tiddlerInfo */ Syncer.prototype.storeTiddler = function(tiddlerFields,hasBeenLazyLoaded) { // Save the tiddler - var tiddler = new $tw.Tiddler(tiddlerFields); + var tiddler = new $tw.Tiddler(this.wiki.getTiddler(tiddlerFields.title),tiddlerFields); this.wiki.addTiddler(tiddler); // Save the tiddler revision and changeCount details this.tiddlerInfo[tiddlerFields.title] = { diff --git a/core/modules/tiddler.js b/core/modules/tiddler.js index e58d4ddf9..efec78b5c 100644 --- a/core/modules/tiddler.js +++ b/core/modules/tiddler.js @@ -75,16 +75,67 @@ Get all the fields as a name:value block. Options: */ exports.getFieldStringBlock = function(options) { options = options || {}; - var exclude = options.exclude || [], - fields = Object.keys(this.fields).sort(), - result = []; - for(var t=0; t 127) && (charCode < 2048)) - output += String.fromCharCode((charCode >> 6) | 192), - output += String.fromCharCode((charCode & 63) | 128); - else - output += String.fromCharCode((charCode >> 12) | 224), - output += String.fromCharCode(((charCode >> 6) & 63) | 128), - output += String.fromCharCode((charCode & 63) | 128); - } - - return output; - }, - - decode: function (string) { - if (typeof string !== 'string') return string; - var output = "", i = 0, charCode = 0; - - while (i < string.length) { - charCode = string.charCodeAt(i); - - if (charCode < 128) - output += String.fromCharCode(charCode), - i++; - else if ((charCode > 191) && (charCode < 224)) - output += String.fromCharCode(((charCode & 31) << 6) | (string.charCodeAt(i + 1) & 63)), - i += 2; - else - output += String.fromCharCode(((charCode & 15) << 12) | ((string.charCodeAt(i + 1) & 63) << 6) | (string.charCodeAt(i + 2) & 63)), - i += 3; - } - - return output; - } - }; -}, this); - -// Base64 Module -// -// Cleaner, modularized and properly scoped base64 encoding and decoding module for strings. -// -// copyright: MIT -// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com -(function (name, definition, context, dependencies) { - if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); } - else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); } - else { context[name] = definition.apply(context); } -})('base64', function (utf8) { - var $this = this; - var $utf8 = utf8 || this.utf8; - var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - return { - encode: function (input) { - if (typeof $utf8 === 'undefined') throw { error: "MissingMethod", message: "UTF8 Module is missing." }; - if (typeof input !== 'string') return input; - else input = $utf8.encode(input); - var output = "", a, b, c, d, e, f, g, i = 0; - - while (i < input.length) { - a = input.charCodeAt(i++); - b = input.charCodeAt(i++); - c = input.charCodeAt(i++); - d = a >> 2; - e = ((a & 3) << 4) | (b >> 4); - f = ((b & 15) << 2) | (c >> 6); - g = c & 63; - - if (isNaN(b)) f = g = 64; - else if (isNaN(c)) g = 64; - - output += map.charAt(d) + map.charAt(e) + map.charAt(f) + map.charAt(g); - } - - return output; - }, - - decode: function (input) { - if (typeof $utf8 === 'undefined') throw { error: "MissingMethod", message: "UTF8 Module is missing." }; - if (typeof input !== 'string') return input; - else input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - var output = "", a, b, c, d, e, f, g, i = 0; - - while (i < input.length) { - d = map.indexOf(input.charAt(i++)); - e = map.indexOf(input.charAt(i++)); - f = map.indexOf(input.charAt(i++)); - g = map.indexOf(input.charAt(i++)); - - a = (d << 2) | (e >> 4); - b = ((e & 15) << 4) | (f >> 2); - c = ((f & 3) << 6) | g; - - output += String.fromCharCode(a); - if (f != 64) output += String.fromCharCode(b); - if (g != 64) output += String.fromCharCode(c); - } - - return $utf8.decode(output); - } - } -}, this, [ "utf8" ]); \ No newline at end of file diff --git a/core/modules/utils/base64-utf8/base64-utf8.module.min.js b/core/modules/utils/base64-utf8/base64-utf8.module.min.js deleted file mode 100644 index 47f0e50c3..000000000 --- a/core/modules/utils/base64-utf8/base64-utf8.module.min.js +++ /dev/null @@ -1,9 +0,0 @@ -// From https://gist.github.com/Nijikokun/5192472 -// -// UTF8 Module -// -// Cleaner and modularized utf-8 encoding and decoding library for javascript. -// -// copyright: MIT -// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com -!function(r,e,o,t){void 0!==o.module&&o.module.exports?o.module.exports=e.apply(o):void 0!==o.define&&"function"===o.define&&o.define.amd?define("utf8",[],e):o.utf8=e.apply(o)}(0,function(){return{encode:function(r){if("string"!=typeof r)return r;r=r.replace(/\r\n/g,"\n");for(var e,o="",t=0;t127&&e<2048?(o+=String.fromCharCode(e>>6|192),o+=String.fromCharCode(63&e|128)):(o+=String.fromCharCode(e>>12|224),o+=String.fromCharCode(e>>6&63|128),o+=String.fromCharCode(63&e|128));return o},decode:function(r){if("string"!=typeof r)return r;for(var e="",o=0,t=0;o191&&t<224?(e+=String.fromCharCode((31&t)<<6|63&r.charCodeAt(o+1)),o+=2):(e+=String.fromCharCode((15&t)<<12|(63&r.charCodeAt(o+1))<<6|63&r.charCodeAt(o+2)),o+=3);return e}}},this),function(r,e,o,t){if(void 0!==o.module&&o.module.exports){if(t&&o.require)for(var n=0;n>2,f=(3&t)<<4|(n=r.charCodeAt(u++))>>4,a=(15&n)<<2|(i=r.charCodeAt(u++))>>6,h=63&i,isNaN(n)?a=h=64:isNaN(i)&&(h=64),c+=o.charAt(d)+o.charAt(f)+o.charAt(a)+o.charAt(h);return c},decode:function(r){if(void 0===e)throw{error:"MissingMethod",message:"UTF8 Module is missing."};if("string"!=typeof r)return r;r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,n,i,d,f,a,h="",c=0;c>4,n=(15&d)<<4|(f=o.indexOf(r.charAt(c++)))>>2,i=(3&f)<<6|(a=o.indexOf(r.charAt(c++))),h+=String.fromCharCode(t),64!=f&&(h+=String.fromCharCode(n)),64!=a&&(h+=String.fromCharCode(i));return e.decode(h)}}},this,["utf8"]); \ No newline at end of file diff --git a/core/modules/utils/base64-utf8/tiddlywiki.files b/core/modules/utils/base64-utf8/tiddlywiki.files deleted file mode 100644 index b12e7dfb9..000000000 --- a/core/modules/utils/base64-utf8/tiddlywiki.files +++ /dev/null @@ -1,14 +0,0 @@ -{ - "tiddlers": [ - { - "file": "base64-utf8.module.min.js", - "fields": { - "type": "application/javascript", - "title": "$:/core/modules/utils/base64-utf8/base64-utf8.module.js", - "module-type": "library" - }, - "prefix": "(function(){", - "suffix": "}).call(exports);" - } - ] -} diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index c90dc8009..be3d1bc47 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -36,8 +36,8 @@ exports.addClass = function(el,className) { var c = el.className.split(" "); if(c.indexOf(className) === -1) { c.push(className); - el.className = c.join(" "); } + el.className = c.join(" "); }; exports.removeClass = function(el,className) { @@ -82,12 +82,11 @@ Returns: y: vertical scroll position in pixels } */ -exports.getScrollPosition = function(srcWindow) { - var scrollWindow = srcWindow || window; - if("scrollX" in scrollWindow) { - return {x: scrollWindow.scrollX, y: scrollWindow.scrollY}; +exports.getScrollPosition = function() { + if("scrollX" in window) { + return {x: window.scrollX, y: window.scrollY}; } else { - return {x: scrollWindow.document.documentElement.scrollLeft, y: scrollWindow.document.documentElement.scrollTop}; + return {x: document.documentElement.scrollLeft, y: document.documentElement.scrollTop}; } }; @@ -120,7 +119,7 @@ exports.resizeTextAreaToFit = function(domNode,minHeight) { Gets the bounding rectangle of an element in absolute page coordinates */ exports.getBoundingPageRect = function(element) { - var scrollPos = $tw.utils.getScrollPosition(element.ownerDocument.defaultView), + var scrollPos = $tw.utils.getScrollPosition(), clientRect = element.getBoundingClientRect(); return { left: clientRect.left + scrollPos.x, @@ -136,31 +135,22 @@ exports.getBoundingPageRect = function(element) { Saves a named password in the browser */ exports.savePassword = function(name,password) { - var done = false; try { - window.localStorage.setItem("tw5-password-" + name,password); - done = true; + if(window.localStorage) { + localStorage.setItem("tw5-password-" + name,password); + } } catch(e) { } - if(!done) { - $tw.savedPasswords = $tw.savedPasswords || Object.create(null); - $tw.savedPasswords[name] = password; - } }; /* Retrieve a named password from the browser */ exports.getPassword = function(name) { - var value; try { - value = window.localStorage.getItem("tw5-password-" + name); + return window.localStorage ? localStorage.getItem("tw5-password-" + name) : ""; } catch(e) { - } - if(value !== undefined) { - return value; - } else { - return ($tw.savedPasswords || Object.create(null))[name] || ""; + return ""; } }; diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index 77cb67c24..7fdd81781 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -17,7 +17,7 @@ A quick and dirty HTTP function; to be refactored later. Options are: url: URL to retrieve headers: hashmap of headers to send type: GET, PUT, POST etc - callback: function invoked with (err,data,xhr) + callback: function invoked with (err,data) returnProp: string name of the property to return as first argument of callback */ exports.httpRequest = function(options) { @@ -48,7 +48,7 @@ exports.httpRequest = function(options) { return; } // Something went wrong - options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this); + options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status); } }; // Make the request @@ -67,7 +67,7 @@ exports.httpRequest = function(options) { try { request.send(data); } catch(e) { - options.callback(e,null,this); + options.callback(e); } return request; }; diff --git a/core/modules/utils/dom/modal.js b/core/modules/utils/dom/modal.js index 1e77e0361..74fceb1ba 100644 --- a/core/modules/utils/dom/modal.js +++ b/core/modules/utils/dom/modal.js @@ -28,10 +28,6 @@ Options include: */ Modal.prototype.display = function(title,options) { options = options || {}; - this.srcDocument = options.variables && (options.variables.rootwindow === "true" || - options.variables.rootwindow === "yes") ? document : - (options.event.event && options.event.event.target ? options.event.event.target.ownerDocument : document); - this.srcWindow = this.srcDocument.defaultView; var self = this, refreshHandler, duration = $tw.utils.getAnimationDuration(), @@ -43,16 +39,16 @@ Modal.prototype.display = function(title,options) { // Create the variables var variables = $tw.utils.extend({currentTiddler: title},options.variables); // Create the wrapper divs - var wrapper = this.srcDocument.createElement("div"), - modalBackdrop = this.srcDocument.createElement("div"), - modalWrapper = this.srcDocument.createElement("div"), - modalHeader = this.srcDocument.createElement("div"), - headerTitle = this.srcDocument.createElement("h3"), - modalBody = this.srcDocument.createElement("div"), - modalLink = this.srcDocument.createElement("a"), - modalFooter = this.srcDocument.createElement("div"), - modalFooterHelp = this.srcDocument.createElement("span"), - modalFooterButtons = this.srcDocument.createElement("span"); + var wrapper = document.createElement("div"), + modalBackdrop = document.createElement("div"), + modalWrapper = document.createElement("div"), + modalHeader = document.createElement("div"), + headerTitle = document.createElement("h3"), + modalBody = document.createElement("div"), + modalLink = document.createElement("a"), + modalFooter = document.createElement("div"), + modalFooterHelp = document.createElement("span"), + modalFooterButtons = document.createElement("span"); // Up the modal count and adjust the body class this.modalCount++; this.adjustPageClass(); @@ -84,7 +80,7 @@ Modal.prototype.display = function(title,options) { value: title }}}], parentWidget: $tw.rootWidget, - document: this.srcDocument, + document: document, variables: variables, importPageMacros: true }); @@ -92,7 +88,7 @@ Modal.prototype.display = function(title,options) { // Render the body of the message var bodyWidgetNode = this.wiki.makeTranscludeWidget(title,{ parentWidget: $tw.rootWidget, - document: this.srcDocument, + document: document, variables: variables, importPageMacros: true }); @@ -100,16 +96,16 @@ Modal.prototype.display = function(title,options) { // Setup the link if present if(options.downloadLink) { modalLink.href = options.downloadLink; - modalLink.appendChild(this.srcDocument.createTextNode("Right-click to save changes")); + modalLink.appendChild(document.createTextNode("Right-click to save changes")); modalBody.appendChild(modalLink); } // Render the footer of the message if(tiddler && tiddler.fields && tiddler.fields.help) { - var link = this.srcDocument.createElement("a"); + var link = document.createElement("a"); link.setAttribute("href",tiddler.fields.help); link.setAttribute("target","_blank"); link.setAttribute("rel","noopener noreferrer"); - link.appendChild(this.srcDocument.createTextNode("Help")); + link.appendChild(document.createTextNode("Help")); modalFooterHelp.appendChild(link); modalFooterHelp.style.float = "left"; } @@ -133,7 +129,7 @@ Modal.prototype.display = function(title,options) { }}} ]}], parentWidget: $tw.rootWidget, - document: this.srcDocument, + document: document, variables: variables, importPageMacros: true }); @@ -159,13 +155,13 @@ Modal.prototype.display = function(title,options) { {opacity: "0"} ]); $tw.utils.setStyle(modalWrapper,[ - {transform: "translateY(" + self.srcWindow.innerHeight + "px)"} + {transform: "translateY(" + window.innerHeight + "px)"} ]); // Set up an event for the transition end - self.srcWindow.setTimeout(function() { + window.setTimeout(function() { if(wrapper.parentNode) { // Remove the modal message from the DOM - self.srcDocument.body.removeChild(wrapper); + document.body.removeChild(wrapper); } },duration); // Don't let anyone else handle the tm-close-tiddler message @@ -180,10 +176,10 @@ Modal.prototype.display = function(title,options) { ]); $tw.utils.setStyle(modalWrapper,[ {transformOrigin: "0% 0%"}, - {transform: "translateY(" + (-this.srcWindow.innerHeight) + "px)"} + {transform: "translateY(" + (-window.innerHeight) + "px)"} ]); // Put the message into the document - this.srcDocument.body.appendChild(wrapper); + document.body.appendChild(wrapper); // Set up animation for the styles $tw.utils.setStyle(modalBackdrop,[ {transition: "opacity " + duration + "ms ease-out"} @@ -204,9 +200,8 @@ Modal.prototype.display = function(title,options) { }; Modal.prototype.adjustPageClass = function() { - var windowContainer = $tw.pageContainer ? ($tw.pageContainer === this.srcDocument.body.firstChild ? $tw.pageContainer : this.srcDocument.body.firstChild) : null; - if(windowContainer) { - $tw.utils.toggleClass(windowContainer,"tc-modal-displayed",this.modalCount > 0); + if($tw.pageContainer) { + $tw.utils.toggleClass($tw.pageContainer,"tc-modal-displayed",this.modalCount > 0); } }; diff --git a/core/modules/utils/dom/popup.js b/core/modules/utils/dom/popup.js index 4ae1a44cd..7da09047d 100644 --- a/core/modules/utils/dom/popup.js +++ b/core/modules/utils/dom/popup.js @@ -114,14 +114,12 @@ Popup.prototype.show = function(options) { var info = this.popupInfo(options.domNode); // Cancel any higher level popups this.cancel(info.popupLevel); - // Store the popup details if not already there if(!options.floating && this.findPopup(options.title) === -1) { this.popups.push({ title: options.title, wiki: options.wiki, - domNode: options.domNode, - noStateReference: options.noStateReference + domNode: options.domNode }); } // Set the state tiddler @@ -136,13 +134,9 @@ Popup.prototype.show = function(options) { height: options.domNode.offsetHeight }; } - var popupRect = "(" + rect.left + "," + rect.top + "," + - rect.width + "," + rect.height + ")"; - if(options.noStateReference) { - options.wiki.setText(options.title,"text",undefined,popupRect); - } else { - options.wiki.setTextReference(options.title,popupRect); - } + options.wiki.setTextReference(options.title, + "(" + rect.left + "," + rect.top + "," + + rect.width + "," + rect.height + ")"); // Add the click handler if we have any popups if(this.popups.length > 0) { this.rootElement.addEventListener("click",this,true); @@ -159,11 +153,7 @@ Popup.prototype.cancel = function(level) { for(var t=level; t= 1) { - self.cancelScroll(srcWindow); + self.cancelScroll(); t = 1; } t = $tw.utils.slowInSlowOut(t); - var scrollPosition = $tw.utils.getScrollPosition(srcWindow), + var scrollPosition = $tw.utils.getScrollPosition(), bounds = getBounds(), - endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,srcWindow.innerWidth), - endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,srcWindow.innerHeight); - srcWindow.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t); + endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth), + endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight); + window.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t - offset); if(t < 1) { - self.idRequestFrame = self.requestAnimationFrame.call(srcWindow,drawFrame); + self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame); } }; drawFrame(); diff --git a/core/modules/utils/fakedom.js b/core/modules/utils/fakedom.js index 3100e731d..4a756f43d 100755 --- a/core/modules/utils/fakedom.js +++ b/core/modules/utils/fakedom.js @@ -45,28 +45,10 @@ var TW_Element = function(tag,namespace) { this.attributes = {}; this.isRaw = false; this.children = []; - this._style = {}; + this.style = {}; this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml"; }; -Object.defineProperty(TW_Element.prototype, "style", { - get: function() { - return this._style; - }, - set: function(str) { - var self = this; - str = str || ""; - $tw.utils.each(str.split(";"),function(declaration) { - var parts = declaration.split(":"), - name = $tw.utils.trim(parts[0]), - value = $tw.utils.trim(parts[1]); - if(name && value) { - self._style[$tw.utils.convertStyleNameToPropertyName(name)] = value; - } - }); - } -}); - Object.defineProperty(TW_Element.prototype, "nodeType", { get: function() { return 1; @@ -187,13 +169,13 @@ Object.defineProperty(TW_Element.prototype, "outerHTML", { } } } - if(this._style) { + if(this.style) { var style = []; - for(var s in this._style) { - style.push($tw.utils.convertPropertyNameToStyleName(s) + ":" + this._style[s] + ";"); + for(var s in this.style) { + style.push(s + ":" + this.style[s] + ";"); } if(style.length > 0) { - output.push(" style=\"",style.join(""),"\""); + output.push(" style=\"",style.join(""),"\"") } } output.push(">"); diff --git a/core/modules/utils/filesystem.js b/core/modules/utils/filesystem.js index 999239450..57e916108 100644 --- a/core/modules/utils/filesystem.js +++ b/core/modules/utils/filesystem.js @@ -181,169 +181,4 @@ exports.deleteEmptyDirs = function(dirpath,callback) { }); }; -/* -Create a fileInfo object for saving a tiddler: - filepath: the absolute path to the file containing the tiddler - type: the type of the tiddler file (NOT the type of the tiddler) - hasMetaFile: true if the file also has a companion .meta file -Options include: - directory: absolute path of root directory to which we are saving - pathFilters: optional array of filters to be used to generate the base path - wiki: optional wiki for evaluating the pathFilters -*/ -exports.generateTiddlerFileInfo = function(tiddler,options) { - var fileInfo = {}; - // Check if the tiddler has any unsafe fields that can't be expressed in a .tid or .meta file: containing control characters, or leading/trailing whitespace - var hasUnsafeFields = false; - $tw.utils.each(tiddler.getFieldStrings(),function(value,fieldName) { - if(fieldName !== "text") { - hasUnsafeFields = hasUnsafeFields || /[\x00-\x1F]/mg.test(value); - hasUnsafeFields = hasUnsafeFields || ($tw.utils.trim(value) !== value); - } - }); - // Check for field values - if(hasUnsafeFields) { - // Save as a JSON file - fileInfo.type = "application/json"; - fileInfo.hasMetaFile = false; - } else { - // Save as a .tid or a text/binary file plus a .meta file - var tiddlerType = tiddler.fields.type || "text/vnd.tiddlywiki"; - if(tiddlerType === "text/vnd.tiddlywiki") { - // Save as a .tid file - fileInfo.type = "application/x-tiddler"; - fileInfo.hasMetaFile = false; - } else { - // Save as a text/binary file and a .meta file - fileInfo.type = tiddlerType; - fileInfo.hasMetaFile = true; - } - } - // Take the file extension from the tiddler content type - var contentTypeInfo = $tw.config.contentTypeInfo[fileInfo.type] || {extension: ""}; - // Generate the filepath - fileInfo.filepath = $tw.utils.generateTiddlerFilepath(tiddler.fields.title,{ - extension: contentTypeInfo.extension, - directory: options.directory, - pathFilters: options.pathFilters, - wiki: options.wiki - }); - return fileInfo; -}; - -/* -Generate the filepath for saving a tiddler -Options include: - extension: file extension to be added the finished filepath - directory: absolute path of root directory to which we are saving - pathFilters: optional array of filters to be used to generate the base path - wiki: optional wiki for evaluating the pathFilters -*/ -exports.generateTiddlerFilepath = function(title,options) { - var self = this, - directory = options.directory || "", - extension = options.extension || "", - filepath; - // Check if any of the pathFilters applies - if(options.pathFilters && options.wiki) { - $tw.utils.each(options.pathFilters,function(filter) { - if(!filepath) { - var source = options.wiki.makeTiddlerIterator([title]), - result = options.wiki.filterTiddlers(filter,null,source); - if(result.length > 0) { - filepath = result[0]; - } - } - }); - } - // If not, generate a base pathname - if(!filepath) { - filepath = title; - // If the filepath already ends in the extension then remove it - if(filepath.substring(filepath.length - extension.length) === extension) { - filepath = filepath.substring(0,filepath.length - extension.length); - } - // Remove any forward or backward slashes so we don't create directories - filepath = filepath.replace(/\/|\\/g,"_"); - } - // Don't let the filename start with a dot because such files are invisible on *nix - filepath = filepath.replace(/^\./g,"_"); - // Remove any characters that can't be used in cross-platform filenames - filepath = $tw.utils.transliterate(filepath.replace(/<|>|\:|\"|\||\?|\*|\^/g,"_")); - // Truncate the filename if it is too long - if(filepath.length > 200) { - filepath = filepath.substr(0,200); - } - // If the resulting filename is blank (eg because the title is just punctuation characters) - if(!filepath) { - // ...then just use the character codes of the title - filepath = ""; - $tw.utils.each(title.split(""),function(char) { - if(filepath) { - filepath += "-"; - } - filepath += char.charCodeAt(0).toString(); - }); - } - // Add a uniquifier if the file already exists - var fullPath, - count = 0; - do { - fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension); - count++; - } while(fs.existsSync(fullPath)); - // Return the full path to the file - return fullPath; -}; - -/* -Save a tiddler to a file described by the fileInfo: - filepath: the absolute path to the file containing the tiddler - type: the type of the tiddler file (NOT the type of the tiddler) - hasMetaFile: true if the file also has a companion .meta file -*/ -exports.saveTiddlerToFile = function(tiddler,fileInfo,callback) { - $tw.utils.createDirectory(path.dirname(fileInfo.filepath)); - if(fileInfo.hasMetaFile) { - // Save the tiddler as a separate body and meta file - var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"}; - fs.writeFile(fileInfo.filepath,tiddler.fields.text,typeInfo.encoding,function(err) { - if(err) { - return callback(err); - } - fs.writeFile(fileInfo.filepath + ".meta",tiddler.getFieldStringBlock({exclude: ["text","bag"]}),"utf8",callback); - }); - } else { - // Save the tiddler as a self contained templated file - if(fileInfo.type === "application/x-tiddler") { - fs.writeFile(fileInfo.filepath,tiddler.getFieldStringBlock({exclude: ["text","bag"]}) + (!!tiddler.fields.text ? "\n\n" + tiddler.fields.text : ""),"utf8",callback); - } else { - fs.writeFile(fileInfo.filepath,JSON.stringify([tiddler.getFieldStrings({exclude: ["bag"]})],null,$tw.config.preferences.jsonSpaces),"utf8",callback); - } - } -}; - -/* -Save a tiddler to a file described by the fileInfo: - filepath: the absolute path to the file containing the tiddler - type: the type of the tiddler file (NOT the type of the tiddler) - hasMetaFile: true if the file also has a companion .meta file -*/ -exports.saveTiddlerToFileSync = function(tiddler,fileInfo) { - $tw.utils.createDirectory(path.dirname(fileInfo.filepath)); - if(fileInfo.hasMetaFile) { - // Save the tiddler as a separate body and meta file - var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"}; - fs.writeFileSync(fileInfo.filepath,tiddler.fields.text,typeInfo.encoding); - fs.writeFileSync(fileInfo.filepath + ".meta",tiddler.getFieldStringBlock({exclude: ["text","bag"]}),"utf8"); - } else { - // Save the tiddler as a self contained templated file - if(fileInfo.type === "application/x-tiddler") { - fs.writeFileSync(fileInfo.filepath,tiddler.getFieldStringBlock({exclude: ["text","bag"]}) + (!!tiddler.fields.text ? "\n\n" + tiddler.fields.text : ""),"utf8"); - } else { - fs.writeFileSync(fileInfo.filepath,JSON.stringify([tiddler.getFieldStrings({exclude: ["bag"]})],null,$tw.config.preferences.jsonSpaces),"utf8"); - } - } -}; - })(); diff --git a/core/modules/utils/logger.js b/core/modules/utils/logger.js index f194d78b3..ee14c5b2b 100644 --- a/core/modules/utils/logger.js +++ b/core/modules/utils/logger.js @@ -33,13 +33,6 @@ Logger.prototype.log = function(/* args */) { } }; -/* -Log a structure as a table -*/ -Logger.prototype.table = function(value) { - (console.table || console.log)(value); -}; - /* Alert a message */ diff --git a/core/modules/utils/performance.js b/core/modules/utils/performance.js index 9908be4d7..3e7acfac3 100644 --- a/core/modules/utils/performance.js +++ b/core/modules/utils/performance.js @@ -14,17 +14,10 @@ Performance measurement. function Performance(enabled) { this.enabled = !!enabled; - this.measures = {}; // Hashmap by measurement name of {time:, invocations:} + this.measures = {}; // Hashmap of current values of measurements this.logger = new $tw.utils.Logger("performance"); - this.showGreeting(); } -Performance.prototype.showGreeting = function() { - if($tw.browser) { - this.logger.log("Execute $tw.perf.log(); to see filter execution timings"); - } -}; - /* Wrap performance reporting around a top level function */ @@ -32,9 +25,13 @@ Performance.prototype.report = function(name,fn) { var self = this; if(this.enabled) { return function() { + self.measures = {}; var startTime = $tw.utils.timer(), result = fn.apply(this,arguments); self.logger.log(name + ": " + $tw.utils.timer(startTime).toFixed(2) + "ms"); + for(var m in self.measures) { + self.logger.log("+" + m + ": " + self.measures[m].toFixed(2) + "ms"); + } return result; }; } else { @@ -42,29 +39,6 @@ Performance.prototype.report = function(name,fn) { } }; -Performance.prototype.log = function() { - var self = this, - totalTime = 0, - orderedMeasures = Object.keys(this.measures).sort(function(a,b) { - if(self.measures[a].time > self.measures[b].time) { - return -1; - } else if (self.measures[a].time < self.measures[b].time) { - return + 1; - } else { - return 0; - } - }); - $tw.utils.each(orderedMeasures,function(name) { - totalTime += self.measures[name].time; - }); - var results = [] - $tw.utils.each(orderedMeasures,function(name) { - var measure = self.measures[name]; - results.push({name: name,invocations: measure.invocations, avgTime: measure.time / measure.invocations, totalTime: measure.time, percentTime: (measure.time / totalTime) * 100}) - }); - self.logger.table(results); -}; - /* Wrap performance measurements around a subfunction */ @@ -73,12 +47,9 @@ Performance.prototype.measure = function(name,fn) { if(this.enabled) { return function() { var startTime = $tw.utils.timer(), - result = fn.apply(this,arguments); - if(!(name in self.measures)) { - self.measures[name] = {time: 0, invocations: 0}; - } - self.measures[name].time += $tw.utils.timer(startTime); - self.measures[name].invocations++; + result = fn.apply(this,arguments), + value = self.measures[name] || 0; + self.measures[name] = value + $tw.utils.timer(startTime); return result; }; } else { diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index 2495be49f..b24e240b1 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -12,8 +12,6 @@ Various static utility functions. /*global $tw: false */ "use strict"; -var base64utf8 = require("$:/core/modules/utils/base64-utf8/base64-utf8.module.js"); - /* Display a message, in colour if we're on a terminal */ @@ -94,20 +92,6 @@ exports.trim = function(str) { } }; -/* -Convert a string to sentence case (ie capitalise first letter) -*/ -exports.toSentenceCase = function(str) { - return (str || "").replace(/^\S/, function(c) {return c.toUpperCase();}); -} - -/* -Convert a string to title case (ie capitalise each initial letter) -*/ -exports.toTitleCase = function(str) { - return (str || "").replace(/(^|\s)\S/g, function(c) {return c.toUpperCase();}); -} - /* Find the line break preceding a given position in a string Returns position immediately after that line break, or the start of the string @@ -149,15 +133,60 @@ exports.count = function(object) { }; /* -Determine whether an array-item is an object-property +Check if an array is equal by value and by reference. */ -exports.hopArray = function(object,array) { - for(var i=0; i=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; }; /* @@ -280,7 +309,7 @@ exports.formatDateString = function(date,template) { return $tw.utils.pad(date.getSeconds()); }], [/^0XXX/, function() { - return $tw.utils.pad(date.getMilliseconds(),3); + return $tw.utils.pad(date.getMilliseconds()); }], [/^0DD/, function() { return $tw.utils.pad(date.getDate()); @@ -667,7 +696,7 @@ exports.extractVersionInfo = function() { Get the animation duration in ms */ exports.getAnimationDuration = function() { - return parseInt($tw.wiki.getTiddlerText("$:/config/AnimationDuration","400"),10) || 0; + return parseInt($tw.wiki.getTiddlerText("$:/config/AnimationDuration","400"),10); }; /* @@ -685,14 +714,12 @@ exports.hashString = function(str) { Decode a base64 string */ exports.base64Decode = function(string64) { - return base64utf8.base64.decode.call(base64utf8,string64); -}; - -/* -Encode a string to base64 -*/ -exports.base64Encode = function(string64) { - return base64utf8.base64.encode.call(base64utf8,string64); + if($tw.browser) { + // TODO + throw "$tw.utils.base64Decode() doesn't work in the browser"; + } else { + return Buffer.from(string64,"base64").toString(); + } }; /* diff --git a/core/modules/widgets/action-createtiddler.js b/core/modules/widgets/action-createtiddler.js index 879f0d68d..01010b940 100644 --- a/core/modules/widgets/action-createtiddler.js +++ b/core/modules/widgets/action-createtiddler.js @@ -37,7 +37,6 @@ Compute the internal state of the widget CreateTiddlerWidget.prototype.execute = function() { this.actionBaseTitle = this.getAttribute("$basetitle"); this.actionSaveTitle = this.getAttribute("$savetitle"); - this.actionSaveDraftTitle = this.getAttribute("$savedrafttitle"); this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes"; }; @@ -74,9 +73,6 @@ CreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) { if(this.actionSaveTitle) { this.wiki.setTextReference(this.actionSaveTitle,title,this.getVariable("currentTiddler")); } - if(this.actionSaveDraftTitle) { - this.wiki.setTextReference(this.actionSaveDraftTitle,this.wiki.generateDraftTitle(title),this.getVariable("currentTiddler")); - } return true; // Action was invoked }; diff --git a/core/modules/widgets/action-deletefield.js b/core/modules/widgets/action-deletefield.js index 45425bf4e..ffe4ef5d0 100644 --- a/core/modules/widgets/action-deletefield.js +++ b/core/modules/widgets/action-deletefield.js @@ -59,7 +59,7 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { tiddler = this.wiki.getTiddler(self.actionTiddler), removeFields = {}, hasChanged = false; - if(this.actionField && tiddler) { + if(this.actionField) { removeFields[this.actionField] = undefined; if(this.actionField in tiddler.fields) { hasChanged = true; diff --git a/core/modules/widgets/action-navigate.js b/core/modules/widgets/action-navigate.js index adac959d5..b6688df08 100644 --- a/core/modules/widgets/action-navigate.js +++ b/core/modules/widgets/action-navigate.js @@ -55,7 +55,6 @@ NavigateWidget.prototype.refresh = function(changedTiddlers) { Invoke the action associated with this widget */ NavigateWidget.prototype.invokeAction = function(triggeringWidget,event) { - event = event || {}; var bounds = triggeringWidget && triggeringWidget.getBoundingClientRect && triggeringWidget.getBoundingClientRect(), suppressNavigation = event.metaKey || event.ctrlKey || (event.button === 1); if(this.actionScroll === "yes") { diff --git a/core/modules/widgets/button.js b/core/modules/widgets/button.js index 34472309f..fdcf33caa 100644 --- a/core/modules/widgets/button.js +++ b/core/modules/widgets/button.js @@ -41,9 +41,9 @@ ButtonWidget.prototype.render = function(parent,nextSibling) { var domNode = this.document.createElement(tag); // Assign classes var classes = this["class"].split(" ") || [], - isPoppedUp = (this.popup || this.popupTitle) && this.isPoppedUp(); + isPoppedUp = this.popup && this.isPoppedUp(); if(this.selectedClass) { - if((this.set || this.setTitle) && this.setTo && this.isSelected()) { + if(this.set && this.setTo && this.isSelected()) { $tw.utils.pushTop(classes,this.selectedClass.split(" ")); } if(isPoppedUp) { @@ -78,11 +78,11 @@ ButtonWidget.prototype.render = function(parent,nextSibling) { self.dispatchMessage(event); handled = true; } - if(self.popup || self.popupTitle) { + if(self.popup) { self.triggerPopup(event); handled = true; } - if(self.set || self.setTitle) { + if(self.set) { self.setTiddler(); handled = true; } @@ -122,14 +122,11 @@ ButtonWidget.prototype.getBoundingClientRect = function() { }; ButtonWidget.prototype.isSelected = function() { - return this.setTitle ? (this.setField ? this.wiki.getTiddler(this.setTitle).getFieldString(this.setField) === this.setTo : - (this.setIndex ? this.wiki.extractTiddlerDataItem(this.setTitle,this.setIndex) === this.setTo : - this.wiki.getTiddlerText(this.setTitle))) || this.defaultSetValue || this.getVariable("currentTiddler") : - this.wiki.getTextReference(this.set,this.defaultSetValue,this.getVariable("currentTiddler")) === this.setTo; + return this.wiki.getTextReference(this.set,this.defaultSetValue,this.getVariable("currentTiddler")) === this.setTo; }; ButtonWidget.prototype.isPoppedUp = function() { - var tiddler = this.popupTitle ? this.wiki.getTiddler(this.popupTitle) : this.wiki.getTiddler(this.popup); + var tiddler = this.wiki.getTiddler(this.popup); var result = tiddler && tiddler.fields.text ? $tw.popup.readPopupState(tiddler.fields.text) : false; return result; }; @@ -153,30 +150,15 @@ ButtonWidget.prototype.dispatchMessage = function(event) { }; ButtonWidget.prototype.triggerPopup = function(event) { - if(this.popupTitle) { - $tw.popup.triggerPopup({ - domNode: this.domNodes[0], - title: this.popupTitle, - wiki: this.wiki, - noStateReference: true - }); - } else { - $tw.popup.triggerPopup({ - domNode: this.domNodes[0], - title: this.popup, - wiki: this.wiki - }); - } + $tw.popup.triggerPopup({ + domNode: this.domNodes[0], + title: this.popup, + wiki: this.wiki + }); }; ButtonWidget.prototype.setTiddler = function() { - if(this.setTitle) { - this.setField ? this.wiki.setText(this.setTitle,this.setField,undefined,this.setTo) : - (this.setIndex ? this.wiki.setText(this.setTitle,undefined,this.setIndex,this.setTo) : - this.wiki.setText(this.setTitle,"text",undefined,this.setTo)); - } else { - this.wiki.setTextReference(this.set,this.setTo,this.getVariable("currentTiddler")); - } + this.wiki.setTextReference(this.set,this.setTo,this.getVariable("currentTiddler")); }; /* @@ -201,10 +183,6 @@ ButtonWidget.prototype.execute = function() { this.buttonTag = this.getAttribute("tag"); this.dragTiddler = this.getAttribute("dragTiddler"); this.dragFilter = this.getAttribute("dragFilter"); - this.setTitle = this.getAttribute("setTitle"); - this.setField = this.getAttribute("setField"); - this.setIndex = this.getAttribute("setIndex"); - this.popupTitle = this.getAttribute("popupTitle"); // Make child widgets this.makeChildWidgets(); }; @@ -214,7 +192,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ ButtonWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes["class"] || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle) { + if(changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes["class"] || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) { this.refreshSelf(); return true; } diff --git a/core/modules/widgets/checkbox.js b/core/modules/widgets/checkbox.js index 1edf0bee0..9fa1c4889 100644 --- a/core/modules/widgets/checkbox.js +++ b/core/modules/widgets/checkbox.js @@ -156,9 +156,6 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) { if(this.checkboxActions) { this.invokeActionString(this.checkboxActions,this,event); } - if(this.checkboxCheckActions && checked) { - this.invokeActionString(this.checkboxCheckActions,this,event); - } if(this.checkboxUncheckActions && !checked) { this.invokeActionString(this.checkboxUncheckActions,this,event); } @@ -170,7 +167,6 @@ Compute the internal state of the widget CheckboxWidget.prototype.execute = function() { // Get the parameters from the attributes this.checkboxActions = this.getAttribute("actions"); - this.checkboxCheckActions = this.getAttribute("checkactions"); this.checkboxUncheckActions = this.getAttribute("uncheckactions"); this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); this.checkboxTag = this.getAttribute("tag"); diff --git a/core/modules/widgets/dropzone.js b/core/modules/widgets/dropzone.js index c4cb36262..7968f5a44 100644 --- a/core/modules/widgets/dropzone.js +++ b/core/modules/widgets/dropzone.js @@ -42,8 +42,7 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) { {name: "dragover", handlerObject: this, handlerMethod: "handleDragOverEvent"}, {name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"}, {name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"}, - {name: "paste", handlerObject: this, handlerMethod: "handlePasteEvent"}, - {name: "dragend", handlerObject: this, handlerMethod: "handleDragEndEvent"} + {name: "paste", handlerObject: this, handlerMethod: "handlePasteEvent"} ]); domNode.addEventListener("click",function (event) { },false); @@ -104,10 +103,6 @@ DropZoneWidget.prototype.handleDragLeaveEvent = function(event) { this.leaveDrag(event); }; -DropZoneWidget.prototype.handleDragEndEvent = function(event) { - $tw.utils.removeClass(this.domNodes[0],"tc-dragover"); -}; - DropZoneWidget.prototype.handleDropEvent = function(event) { var self = this, readFileCallback = function(tiddlerFieldsArray) { diff --git a/core/modules/widgets/edit-bitmap.js b/core/modules/widgets/edit-bitmap.js index 0e72b5df1..0a7ecd0ef 100644 --- a/core/modules/widgets/edit-bitmap.js +++ b/core/modules/widgets/edit-bitmap.js @@ -14,8 +14,7 @@ Edit-bitmap widget // Default image sizes var DEFAULT_IMAGE_WIDTH = 600, - DEFAULT_IMAGE_HEIGHT = 370, - DEFAULT_IMAGE_TYPE = "image/png"; + DEFAULT_IMAGE_HEIGHT = 370; // Configuration tiddlers var LINE_WIDTH_TITLE = "$:/config/BitmapEditor/LineWidth", @@ -155,13 +154,7 @@ EditBitmapWidget.prototype.loadCanvas = function() { self.refreshToolbar(); }; // Get the current bitmap into an image object - if(tiddler && tiddler.fields.type && tiddler.fields.text) { - currImage.src = "data:" + tiddler.fields.type + ";base64," + tiddler.fields.text; - } else { - currImage.width = DEFAULT_IMAGE_WIDTH; - currImage.height = DEFAULT_IMAGE_HEIGHT; - currImage.onerror(); - } + currImage.src = "data:" + tiddler.fields.type + ";base64," + tiddler.fields.text; }; EditBitmapWidget.prototype.initCanvas = function(canvas,width,height,image) { @@ -326,16 +319,18 @@ EditBitmapWidget.prototype.strokeEnd = function() { }; EditBitmapWidget.prototype.saveChanges = function() { - var tiddler = this.wiki.getTiddler(this.editTitle) || new $tw.Tiddler({title: this.editTitle,type: DEFAULT_IMAGE_TYPE}); - // data URIs look like "data:;base64," - var dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type), - posColon = dataURL.indexOf(":"), - posSemiColon = dataURL.indexOf(";"), - posComma = dataURL.indexOf(","), - type = dataURL.substring(posColon+1,posSemiColon), - text = dataURL.substring(posComma+1); - var update = {type: type, text: text}; - this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getModificationFields(),tiddler,update,this.wiki.getCreationFields())); + var tiddler = this.wiki.getTiddler(this.editTitle); + if(tiddler) { + // data URIs look like "data:;base64," + var dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type), + posColon = dataURL.indexOf(":"), + posSemiColon = dataURL.indexOf(";"), + posComma = dataURL.indexOf(","), + type = dataURL.substring(posColon+1,posSemiColon), + text = dataURL.substring(posComma+1); + var update = {type: type, text: text}; + this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getModificationFields(),tiddler,update,this.wiki.getCreationFields())); + } }; exports["edit-bitmap"] = EditBitmapWidget; diff --git a/core/modules/widgets/edit-shortcut.js b/core/modules/widgets/edit-shortcut.js index b70328d5a..78f34839c 100644 --- a/core/modules/widgets/edit-shortcut.js +++ b/core/modules/widgets/edit-shortcut.js @@ -57,10 +57,6 @@ EditShortcutWidget.prototype.render = function(parent,nextSibling) { // Link into the DOM parent.insertBefore(this.inputNode,nextSibling); this.domNodes.push(this.inputNode); - // Focus the input Node if focus === "yes" or focus === "true" - if(this.shortcutFocus === "yes" || this.shortcutFocus === "true") { - this.focus(); - } }; /* @@ -76,7 +72,6 @@ EditShortcutWidget.prototype.execute = function() { this.shortcutStyle = this.getAttribute("style"); this.shortcutTooltip = this.getAttribute("tooltip"); this.shortcutAriaLabel = this.getAttribute("aria-label"); - this.shortcutFocus = this.getAttribute("focus"); }; /* @@ -123,22 +118,12 @@ EditShortcutWidget.prototype.handleKeydownEvent = function(event) { } }; -/* -focus the input node -*/ -EditShortcutWidget.prototype.focus = function() { - if(this.inputNode.focus && this.inputNode.select) { - this.inputNode.focus(); - this.inputNode.select(); - } -}; - /* Selectively refreshes the widget if needed. Returns true if the widget needed re-rendering */ EditShortcutWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"] || changedAttributes.focus) { + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"]) { this.refreshSelf(); return true; } else if(changedTiddlers[this.shortcutTiddler]) { diff --git a/core/modules/widgets/edit.js b/core/modules/widgets/edit.js index 92ac0e1be..ebcc775ca 100644 --- a/core/modules/widgets/edit.js +++ b/core/modules/widgets/edit.js @@ -46,8 +46,6 @@ EditWidget.prototype.execute = function() { this.editIndex = this.getAttribute("index"); this.editClass = this.getAttribute("class"); this.editPlaceholder = this.getAttribute("placeholder"); - this.editTabIndex = this.getAttribute("tabindex"); - this.editFocus = this.getAttribute("focus",""); // Choose the appropriate edit widget this.editorType = this.getEditorType(); // Make the child widgets @@ -58,9 +56,7 @@ EditWidget.prototype.execute = function() { field: {type: "string", value: this.editField}, index: {type: "string", value: this.editIndex}, "class": {type: "string", value: this.editClass}, - "placeholder": {type: "string", value: this.editPlaceholder}, - "tabindex": {type: "string", value: this.editTabIndex}, - "focus": {type: "string", value: this.editFocus} + "placeholder": {type: "string", value: this.editPlaceholder} }, children: this.parseTreeNode.children }]); @@ -94,11 +90,11 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of EditWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); // Refresh if an attribute has changed, or the type associated with the target tiddler has changed - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) { + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) { this.refreshSelf(); return true; } else { - return this.refreshChildren(changedTiddlers); + return this.refreshChildren(changedTiddlers); } }; diff --git a/core/modules/widgets/importvariables.js b/core/modules/widgets/importvariables.js index 86559ef25..cdb351f8d 100644 --- a/core/modules/widgets/importvariables.js +++ b/core/modules/widgets/importvariables.js @@ -66,7 +66,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) { params: parseTreeNode.params, isMacroDefinition: parseTreeNode.isMacroDefinition }); - parseTreeNode = parseTreeNode.children && parseTreeNode.children[0]; + parseTreeNode = parseTreeNode.children[0]; } } }); diff --git a/core/modules/widgets/keyboard.js b/core/modules/widgets/keyboard.js index 7611b3d61..f253d864a 100644 --- a/core/modules/widgets/keyboard.js +++ b/core/modules/widgets/keyboard.js @@ -71,22 +71,14 @@ KeyboardWidget.prototype.dispatchMessage = function(event) { Compute the internal state of the widget */ KeyboardWidget.prototype.execute = function() { - var self = this; // Get attributes - this.actions = this.getAttribute("actions",""); - this.message = this.getAttribute("message",""); - this.param = this.getAttribute("param",""); - this.key = this.getAttribute("key",""); - this.tag = this.getAttribute("tag",""); + this.actions = this.getAttribute("actions"); + this.message = this.getAttribute("message"); + this.param = this.getAttribute("param"); + this.key = this.getAttribute("key"); + this.tag = this.getAttribute("tag"); this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key); - this["class"] = this.getAttribute("class",""); - if(this.key.substr(0,2) === "((" && this.key.substr(-2,2) === "))") { - this.shortcutTiddlers = []; - var name = this.key.substring(2,this.key.length -2); - $tw.utils.each($tw.keyboardManager.lookupNames,function(platformDescriptor) { - self.shortcutTiddlers.push("$:/config/" + platformDescriptor + "/" + name); - }); - } + this["class"] = this.getAttribute("class"); // Make child widgets this.makeChildWidgets(); }; @@ -100,10 +92,6 @@ KeyboardWidget.prototype.refresh = function(changedTiddlers) { this.refreshSelf(); return true; } - // Update the keyInfoArray if one of its shortcut-config-tiddlers has changed - if(this.shortcutTiddlers && $tw.utils.hopArray(changedTiddlers,this.shortcutTiddlers)) { - this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key); - } return this.refreshChildren(changedTiddlers); }; diff --git a/core/modules/widgets/link.js b/core/modules/widgets/link.js index 6d3ffe093..4525d036c 100755 --- a/core/modules/widgets/link.js +++ b/core/modules/widgets/link.js @@ -13,6 +13,7 @@ Link widget "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; +var MISSING_LINK_CONFIG_TITLE = "$:/config/MissingLinks"; var LinkWidget = function(parseTreeNode,options) { this.initialise(parseTreeNode,options); @@ -181,16 +182,9 @@ LinkWidget.prototype.execute = function() { // Determine the link characteristics this.isMissing = !this.wiki.tiddlerExists(this.to); this.isShadow = this.wiki.isShadowTiddler(this.to); - this.hideMissingLinks = (this.getVariable("tv-show-missing-links") || "yes") === "no"; + this.hideMissingLinks = ($tw.wiki.getTiddlerText(MISSING_LINK_CONFIG_TITLE,"yes") === "no"); // Make the child widgets - var templateTree; - if(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) { - templateTree = this.parseTreeNode.children; - } else { - // Default template is a link to the title - templateTree = [{type: "text", text: this.to}]; - } - this.makeChildWidgets(templateTree); + this.makeChildWidgets(); }; /* @@ -198,7 +192,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ LinkWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip) { + if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip || changedTiddlers[MISSING_LINK_CONFIG_TITLE]) { this.refreshSelf(); return true; } diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 7435e04ac..7595dfbca 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -88,40 +88,34 @@ NavigatorWidget.prototype.getStoryList = function() { }; NavigatorWidget.prototype.saveStoryList = function(storyList) { - if(this.storyTitle) { - var storyTiddler = this.wiki.getTiddler(this.storyTitle); - this.wiki.addTiddler(new $tw.Tiddler( - {title: this.storyTitle}, - storyTiddler, - {list: storyList} - )); - } + var storyTiddler = this.wiki.getTiddler(this.storyTitle); + this.wiki.addTiddler(new $tw.Tiddler( + {title: this.storyTitle}, + storyTiddler, + {list: storyList} + )); }; NavigatorWidget.prototype.removeTitleFromStory = function(storyList,title) { - if(storyList) { - var p = storyList.indexOf(title); - while(p !== -1) { - storyList.splice(p,1); - p = storyList.indexOf(title); - } + var p = storyList.indexOf(title); + while(p !== -1) { + storyList.splice(p,1); + p = storyList.indexOf(title); } }; NavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle,newTitle) { - if(storyList) { - var pos = storyList.indexOf(oldTitle); - if(pos !== -1) { - storyList[pos] = newTitle; - do { - pos = storyList.indexOf(oldTitle,pos + 1); - if(pos !== -1) { - storyList.splice(pos,1); - } - } while(pos !== -1); - } else { - storyList.splice(0,0,newTitle); - } + var pos = storyList.indexOf(oldTitle); + if(pos !== -1) { + storyList[pos] = newTitle; + do { + pos = storyList.indexOf(oldTitle,pos + 1); + if(pos !== -1) { + storyList.splice(pos,1); + } + } while(pos !== -1); + } else { + storyList.splice(0,0,newTitle); } }; @@ -322,7 +316,15 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) { Generate a title for the draft of a given tiddler */ NavigatorWidget.prototype.generateDraftTitle = function(title) { - return this.wiki.generateDraftTitle(title); + var c = 0, + draftTitle, + username = this.wiki.getTiddlerText("$:/status/UserName"), + attribution = username ? " by " + username : ""; + do { + draftTitle = "Draft " + (c ? (c + 1) + " " : "") + "of '" + title + "'" + attribution; + c++; + } while(this.wiki.tiddlerExists(draftTitle)); + return draftTitle; }; // Take a tiddler out of edit mode, saving the changes @@ -500,14 +502,11 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) { },this.wiki.getModificationFields()); this.wiki.addTiddler(draftTiddler); // Update the story to insert the new draft at the top and remove any existing tiddler - if(storyList && storyList.indexOf(draftTitle) === -1) { + if(storyList.indexOf(draftTitle) === -1) { var slot = storyList.indexOf(event.navigateFromTitle); - if(slot === -1) { - slot = this.getAttribute("openLinkFromOutsideRiver","top") === "bottom" ? storyList.length - 1 : slot; - } storyList.splice(slot + 1,0,draftTitle); } - if(storyList && storyList.indexOf(title) !== -1) { + if(storyList.indexOf(title) !== -1) { storyList.splice(storyList.indexOf(title),1); } this.saveStoryList(storyList); @@ -563,7 +562,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) { var storyList = this.getStoryList(), history = []; // Add it to the story - if(storyList && storyList.indexOf(IMPORT_TITLE) === -1) { + if(storyList.indexOf(IMPORT_TITLE) === -1) { storyList.unshift(IMPORT_TITLE); } // And to history @@ -624,7 +623,7 @@ NavigatorWidget.prototype.handleFoldOtherTiddlersEvent = function(event) { NavigatorWidget.prototype.handleFoldAllTiddlersEvent = function(event) { var self = this, paramObject = event.paramObject || {}, - prefix = paramObject.foldedStatePrefix || "$:/state/folded/"; + prefix = paramObject.foldedStatePrefix; $tw.utils.each(this.getStoryList(),function(title) { self.wiki.setText(prefix + title,"text",null,"hide"); }); @@ -640,10 +639,11 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) { }; NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) { + event = $tw.hooks.invokeHook("th-renaming-tiddler", event); var paramObject = event.paramObject || {}, from = paramObject.from || event.tiddlerTitle, to = paramObject.to; - this.wiki.renameTiddler(from,to); + $tw.wiki.renameTiddler(from,to); }; exports.navigator = NavigatorWidget; diff --git a/core/modules/widgets/qualify.js b/core/modules/widgets/qualify.js deleted file mode 100644 index 07a5c8b4e..000000000 --- a/core/modules/widgets/qualify.js +++ /dev/null @@ -1,66 +0,0 @@ -/*\ -title: $:/core/modules/widgets/qualify.js -type: application/javascript -module-type: widget - -Qualify text to a variable - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -var Widget = require("$:/core/modules/widgets/widget.js").widget; - -var QualifyWidget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); -}; - -/* -Inherit from the base widget class -*/ -QualifyWidget.prototype = new Widget(); - -/* -Render this widget into the DOM -*/ -QualifyWidget.prototype.render = function(parent,nextSibling) { - this.parentDomNode = parent; - this.computeAttributes(); - this.execute(); - this.renderChildren(parent,nextSibling); -}; - -/* -Compute the internal state of the widget -*/ -QualifyWidget.prototype.execute = function() { - // Get our parameters - this.qualifyName = this.getAttribute("name"); - this.qualifyTitle = this.getAttribute("title"); - // Set context variable - if(this.qualifyName) { - this.setVariable(this.qualifyName,this.qualifyTitle + "-" + this.getStateQualifier()); - } - // Construct the child widgets - this.makeChildWidgets(); -}; - -/* -Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering -*/ -QualifyWidget.prototype.refresh = function(changedTiddlers) { - var changedAttributes = this.computeAttributes(); - if(changedAttributes.name || changedAttributes.title) { - this.refreshSelf(); - return true; - } else { - return this.refreshChildren(changedTiddlers); - } -}; - -exports.qualify = QualifyWidget; - -})(); diff --git a/core/modules/widgets/range.js b/core/modules/widgets/range.js index d5ab2c785..591dab482 100644 --- a/core/modules/widgets/range.js +++ b/core/modules/widgets/range.js @@ -47,9 +47,11 @@ RangeWidget.prototype.render = function(parent,nextSibling) { this.inputDomNode.setAttribute("step", this.increment); } this.inputDomNode.value = this.getValue(); + + // Add a click event handler $tw.utils.addEventListeners(this.inputDomNode,[ - {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"} + {name: "input", handlerObject: this, handlerMethod: "handleChangeEvent"} ]); // Insert the label into the DOM and render any children parent.insertBefore(this.inputDomNode,nextSibling); @@ -58,30 +60,19 @@ RangeWidget.prototype.render = function(parent,nextSibling) { RangeWidget.prototype.getValue = function() { var tiddler = this.wiki.getTiddler(this.tiddlerTitle), - fieldName = this.tiddlerField || "text", value = this.defaultValue; if(tiddler) { - if(this.tiddlerIndex) { - value = this.wiki.extractTiddlerDataItem(tiddler,this.tiddlerIndex,this.defaultValue || ""); + if($tw.utils.hop(tiddler.fields,this.tiddlerField)) { + value = tiddler.fields[this.tiddlerField] || ""; } else { - if($tw.utils.hop(tiddler.fields,fieldName)) { - value = tiddler.fields[fieldName] || ""; - } else { - value = this.defaultValue || ""; - } + value = this.defaultValue || ""; } } return value; }; -RangeWidget.prototype.handleInputEvent = function(event) { - if(this.getValue() !== this.inputDomNode.value) { - if(this.tiddlerIndex) { - this.wiki.setText(this.tiddlerTitle,"",this.tiddlerIndex,this.inputDomNode.value); - } else { - this.wiki.setText(this.tiddlerTitle,this.tiddlerField,null,this.inputDomNode.value); - } - } +RangeWidget.prototype.handleChangeEvent = function(event) { + this.wiki.setText(this.tiddlerTitle ,this.tiddlerField, null,this.inputDomNode.value); }; /* @@ -91,7 +82,6 @@ RangeWidget.prototype.execute = function() { // Get the parameters from the attributes this.tiddlerTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); this.tiddlerField = this.getAttribute("field"); - this.tiddlerIndex = this.getAttribute("index"); this.minValue = this.getAttribute("min"); this.maxValue = this.getAttribute("max"); this.increment = this.getAttribute("increment"); @@ -106,16 +96,13 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ RangeWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes['min'] || changedAttributes['max'] || changedAttributes['increment'] || changedAttributes["default"] || changedAttributes["class"]) { + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes['min'] || changedAttributes['max'] || changedAttributes['increment'] || changedAttributes["default"] || changedAttributes["class"]) { this.refreshSelf(); return true; } else { var refreshed = false; if(changedTiddlers[this.tiddlerTitle]) { - var value = this.getValue(); - if(this.inputDomNode.value !== value) { - this.inputDomNode.value = value; - } + this.inputDomNode.checked = this.getValue(); refreshed = true; } return this.refreshChildren(changedTiddlers) || refreshed; @@ -124,4 +111,4 @@ RangeWidget.prototype.refresh = function(changedTiddlers) { exports.range = RangeWidget; -})(); \ No newline at end of file +})(); diff --git a/core/modules/widgets/reveal.js b/core/modules/widgets/reveal.js index ebbf490b2..fed6de0e9 100755 --- a/core/modules/widgets/reveal.js +++ b/core/modules/widgets/reveal.js @@ -56,39 +56,32 @@ RevealWidget.prototype.render = function(parent,nextSibling) { RevealWidget.prototype.positionPopup = function(domNode) { domNode.style.position = "absolute"; domNode.style.zIndex = "1000"; - var left,top; switch(this.position) { case "left": - left = this.popup.left - domNode.offsetWidth; - top = this.popup.top; + domNode.style.left = (this.popup.left - domNode.offsetWidth) + "px"; + domNode.style.top = this.popup.top + "px"; break; case "above": - left = this.popup.left; - top = this.popup.top - domNode.offsetHeight; + domNode.style.left = this.popup.left + "px"; + domNode.style.top = (this.popup.top - domNode.offsetHeight) + "px"; break; case "aboveright": - left = this.popup.left + this.popup.width; - top = this.popup.top + this.popup.height - domNode.offsetHeight; + domNode.style.left = (this.popup.left + this.popup.width) + "px"; + domNode.style.top = (this.popup.top + this.popup.height - domNode.offsetHeight) + "px"; break; case "right": - left = this.popup.left + this.popup.width; - top = this.popup.top; + domNode.style.left = (this.popup.left + this.popup.width) + "px"; + domNode.style.top = this.popup.top + "px"; break; case "belowleft": - left = this.popup.left + this.popup.width - domNode.offsetWidth; - top = this.popup.top + this.popup.height; + domNode.style.left = (this.popup.left + this.popup.width - domNode.offsetWidth) + "px"; + domNode.style.top = (this.popup.top + this.popup.height) + "px"; break; default: // Below - left = this.popup.left; - top = this.popup.top + this.popup.height; + domNode.style.left = this.popup.left + "px"; + domNode.style.top = (this.popup.top + this.popup.height) + "px"; break; } - if(!this.positionAllowNegative) { - left = Math.max(0,left); - top = Math.max(0,top); - } - domNode.style.left = left + "px"; - domNode.style.top = top + "px"; }; /* @@ -101,7 +94,6 @@ RevealWidget.prototype.execute = function() { this.type = this.getAttribute("type"); this.text = this.getAttribute("text"); this.position = this.getAttribute("position"); - this.positionAllowNegative = this.getAttribute("positionAllowNegative") === "yes"; this["class"] = this.getAttribute("class",""); this.style = this.getAttribute("style",""); this["default"] = this.getAttribute("default",""); @@ -110,10 +102,7 @@ RevealWidget.prototype.execute = function() { this.openAnimation = this.animate === "no" ? undefined : "open"; this.closeAnimation = this.animate === "no" ? undefined : "close"; // Compute the title of the state tiddler and read it - this.stateTiddlerTitle = this.state; - this.stateTitle = this.getAttribute("stateTitle"); - this.stateField = this.getAttribute("stateField"); - this.stateIndex = this.getAttribute("stateIndex"); + this.stateTitle = this.state; this.readState(); // Construct the child widgets var childNodes = this.isOpen ? this.parseTreeNode.children : []; @@ -126,34 +115,16 @@ Read the state tiddler */ RevealWidget.prototype.readState = function() { // Read the information from the state tiddler - var state, - defaultState = this["default"]; - if(this.stateTitle) { - var stateTitleTiddler = this.wiki.getTiddler(this.stateTitle); - if(this.stateField) { - state = stateTitleTiddler ? stateTitleTiddler.getFieldString(this.stateField) || defaultState : defaultState; - } else if(this.stateIndex) { - state = stateTitleTiddler ? this.wiki.extractTiddlerDataItem(this.stateTitle,this.stateIndex) || defaultState : defaultState; - } else if(stateTitleTiddler) { - state = this.wiki.getTiddlerText(this.stateTitle) || defaultState; - } else { - state = defaultState; - } - } else { - state = this.stateTiddlerTitle ? this.wiki.getTextReference(this.state,this["default"],this.getVariable("currentTiddler")) : this["default"]; - } - if(state === null) { - state = this["default"]; - } + var state = this.stateTitle ? this.wiki.getTextReference(this.stateTitle,this["default"],this.getVariable("currentTiddler")) : this["default"]; switch(this.type) { case "popup": this.readPopupState(state); break; case "match": - this.isOpen = this.text === state; + this.isOpen = !!(this.compareStateText(state) == 0); break; case "nomatch": - this.isOpen = this.text !== state; + this.isOpen = !(this.compareStateText(state) == 0); break; case "lt": this.isOpen = !!(this.compareStateText(state) < 0); @@ -199,13 +170,13 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ RevealWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes.positionAllowNegative || changedAttributes["default"] || changedAttributes.animate || changedAttributes.stateTitle || changedAttributes.stateField || changedAttributes.stateIndex) { + if(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes["default"] || changedAttributes.animate) { this.refreshSelf(); return true; } else { var currentlyOpen = this.isOpen; this.readState(); - if(this.isOpen !== currentlyOpen) { + if(this.isOpen !== currentlyOpen || (this.stateTitle && changedTiddlers[this.stateTitle])) { if(this.retain === "yes") { this.updateState(); } else { @@ -247,7 +218,7 @@ RevealWidget.prototype.updateState = function() { if(!self.isOpen) { domNode.setAttribute("hidden","true"); } - }}); + }}); } }; diff --git a/core/modules/widgets/select.js b/core/modules/widgets/select.js index 6efeb588f..cf094687b 100644 --- a/core/modules/widgets/select.js +++ b/core/modules/widgets/select.js @@ -96,8 +96,11 @@ SelectWidget.prototype.setSelectValue = function() { var select = this.getSelectDomNode(); var values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value); for(var i=0; i < select.children.length; i++){ - select.children[i].selected = values.indexOf(select.children[i].value) !== -1 + if(values.indexOf(select.children[i].value) != -1) { + select.children[i].selected = true; + } } + } else { var domNode = this.getSelectDomNode(); if(domNode.value !== value) { @@ -142,7 +145,6 @@ SelectWidget.prototype.execute = function() { this.selectDefault = this.getAttribute("default"); this.selectMultiple = this.getAttribute("multiple", false); this.selectSize = this.getAttribute("size"); - this.selectTooltip = this.getAttribute("tooltip"); // Make the child widgets var selectNode = { type: "element", @@ -158,9 +160,6 @@ SelectWidget.prototype.execute = function() { if(this.selectSize) { $tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize); } - if(this.selectTooltip) { - $tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip); - } this.makeChildWidgets([selectNode]); }; @@ -170,7 +169,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of SelectWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); // If we're using a different tiddler/field/index then completely refresh ourselves - if(changedAttributes.selectTitle || changedAttributes.selectField || changedAttributes.selectIndex || changedAttributes.selectTooltip) { + if(changedAttributes.selectTitle || changedAttributes.selectField || changedAttributes.selectIndex) { this.refreshSelf(); return true; // If the target tiddler value has changed, just update setting and refresh the children diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 7fd868ba1..28b9f4e35 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -22,17 +22,15 @@ Options include: document: optional document object to use instead of global document */ var Widget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); + if(arguments.length > 0) { + this.initialise(parseTreeNode,options); + } }; /* Initialise widget properties. These steps are pulled out of the constructor so that we can reuse them in subclasses */ Widget.prototype.initialise = function(parseTreeNode,options) { - // Bail if parseTreeNode is undefined, meaning that the widget constructor was called without any arguments so that it can be subclassed - if(parseTreeNode === undefined) { - return; - } options = options || {}; // Save widget info this.parseTreeNode = parseTreeNode; @@ -48,21 +46,7 @@ Widget.prototype.initialise = function(parseTreeNode,options) { this.eventListeners = {}; // Hashmap of the widget classes if(!this.widgetClasses) { - // Get widget classes Widget.prototype.widgetClasses = $tw.modules.applyMethods("widget"); - // Process any subclasses - $tw.modules.forEachModuleOfType("widget-subclass",function(title,module) { - if(module.baseClass) { - var baseClass = Widget.prototype.widgetClasses[module.baseClass]; - if(!baseClass) { - throw "Module '" + title + "' is attemping to extend a non-existent base class '" + module.baseClass + "'"; - } - var subClass = module.constructor; - subClass.prototype = new baseClass(); - $tw.utils.extend(subClass.prototype,module.prototype); - Widget.prototype.widgetClasses[module.name || module.baseClass] = subClass; - } - }); } }; @@ -385,10 +369,9 @@ Widget.prototype.previousSibling = function() { Render the children of this widget into the DOM */ Widget.prototype.renderChildren = function(parent,nextSibling) { - var children = this.children; - for(var i = 0; i < children.length; i++) { - children[i].render(parent,nextSibling); - }; + $tw.utils.each(this.children,function(childWidget) { + childWidget.render(parent,nextSibling); + }); }; /* @@ -456,11 +439,11 @@ Widget.prototype.refreshSelf = function() { Refresh all the children of a widget */ Widget.prototype.refreshChildren = function(changedTiddlers) { - var children = this.children, + var self = this, refreshed = false; - for (var i = 0; i < children.length; i++) { - refreshed = children[i].refresh(changedTiddlers) || refreshed; - } + $tw.utils.each(this.children,function(childWidget) { + refreshed = childWidget.refresh(changedTiddlers) || refreshed; + }); return refreshed; }; diff --git a/core/modules/wiki-bulkops.js b/core/modules/wiki-bulkops.js index f64beccf5..fa2acbe19 100644 --- a/core/modules/wiki-bulkops.js +++ b/core/modules/wiki-bulkops.js @@ -44,8 +44,8 @@ function relinkTiddler(fromTitle,toTitle,options) { var type = tiddler.fields.type || ""; // Don't touch plugins or JavaScript modules if(!tiddler.fields["plugin-type"] && type !== "application/javascript") { - var tags = tiddler.fields.tags ? tiddler.fields.tags.slice(0) : undefined, - list = tiddler.fields.list ? tiddler.fields.list.slice(0) : undefined, + var tags = (tiddler.fields.tags || []).slice(0), + list = (tiddler.fields.list || []).slice(0), isModified = false; if(!options.dontRenameInTags) { // Rename tags diff --git a/core/modules/wiki.js b/core/modules/wiki.js index b505f50da..2ef8e951b 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -27,16 +27,6 @@ var widget = require("$:/core/modules/widgets/widget.js"); var USER_NAME_TITLE = "$:/status/UserName", TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable"; -/* -Add available indexers to this wiki -*/ -exports.addIndexersToWiki = function() { - var self = this; - $tw.utils.each($tw.modules.applyMethods("indexer"),function(Indexer,name) { - self.addIndexer(new Indexer(self),name); - }); -}; - /* Get the value of a text reference. Text references can have any of these forms: @@ -221,16 +211,6 @@ exports.isImageTiddler = function(title) { } }; -exports.isBinaryTiddler = function(title) { - var tiddler = this.getTiddler(title); - if(tiddler) { - var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/vnd.tiddlywiki"]; - return !!contentTypeInfo && contentTypeInfo.encoding === "base64"; - } else { - return null; - } -}; - /* Like addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported */ @@ -498,18 +478,11 @@ exports.getOrphanTitles = function() { Retrieves a list of the tiddler titles that are tagged with a given tag */ exports.getTiddlersWithTag = function(tag) { - // Try to use the indexer - var self = this, - tagIndexer = this.getIndexer("TagIndexer"), - results = tagIndexer && tagIndexer.subIndexers[3].lookup(tag); - if(!results) { - // If not available, perform a manual scan - results = this.getGlobalCache("taglist-" + tag,function() { - var tagmap = self.getTagMap(); - return self.sortByList(tagmap[tag],tag); - }); - } - return results; + var self = this; + return this.getGlobalCache("taglist-" + tag,function() { + var tagmap = self.getTagMap(); + return self.sortByList(tagmap[tag],tag); + }); }; /* @@ -565,45 +538,6 @@ exports.findListingsOfTiddler = function(targetTitle,fieldName) { Sorts an array of tiddler titles according to an ordered list */ exports.sortByList = function(array,listTitle) { - var self = this, - replacedTitles = Object.create(null); - function replaceItem(title) { - if(!$tw.utils.hop(replacedTitles, title)) { - replacedTitles[title] = true; - var newPos = -1, - tiddler = self.getTiddler(title); - if(tiddler) { - var beforeTitle = tiddler.fields["list-before"], - afterTitle = tiddler.fields["list-after"]; - if(beforeTitle === "") { - newPos = 0; - } else if(afterTitle === "") { - newPos = titles.length; - } else if(beforeTitle) { - replaceItem(beforeTitle); - newPos = titles.indexOf(beforeTitle); - } else if(afterTitle) { - replaceItem(afterTitle); - newPos = titles.indexOf(afterTitle); - if(newPos >= 0) { - ++newPos; - } - } - // We get the currPos //after// figuring out the newPos, because recursive replaceItem calls might alter title's currPos - var currPos = titles.indexOf(title); - if(newPos === -1) { - newPos = currPos; - } - if(currPos >= 0 && newPos !== currPos) { - titles.splice(currPos,1); - if(newPos >= currPos) { - newPos--; - } - titles.splice(newPos,0,title); - } - } - } - } var list = this.getTiddlerList(listTitle); if(!array || array.length === 0) { return []; @@ -627,7 +561,36 @@ exports.sortByList = function(array,listTitle) { var sortedTitles = titles.slice(0); for(t=0; t= 0) { + ++newPos; + } + } + if(newPos === -1) { + newPos = currPos; + } + if(newPos !== currPos) { + titles.splice(currPos,1); + if(newPos >= currPos) { + newPos--; + } + titles.splice(newPos,0,title); + } + } + } return titles; } @@ -1074,14 +1037,8 @@ Options available: exclude: An array of tiddler titles to exclude from the search invert: If true returns tiddlers that do not contain the specified string caseSensitive: If true forces a case sensitive search - field: If specified, restricts the search to the specified field, or an array of field names - anchored: If true, forces all but regexp searches to be anchored to the start of text - excludeField: If true, the field options are inverted to specify the fields that are not to be searched - The search mode is determined by the first of these boolean flags to be true - literal: searches for literal string - whitespace: same as literal except runs of whitespace are treated as a single space - regexp: treats the search term as a regular expression - words: (default) treats search string as a list of tokens, and matches if all tokens are found, regardless of adjacency or ordering + literal: If true, searches for literal string, rather than separate search terms + field: If specified, restricts the search to the specified field */ exports.search = function(text,options) { options = options || {}; @@ -1090,28 +1047,12 @@ exports.search = function(text,options) { invert = !!options.invert; // Convert the search string into a regexp for each term var terms, searchTermsRegExps, - flags = options.caseSensitive ? "" : "i", - anchor = options.anchored ? "^" : ""; + flags = options.caseSensitive ? "" : "i"; if(options.literal) { if(text.length === 0) { searchTermsRegExps = null; } else { - searchTermsRegExps = [new RegExp("(" + anchor + $tw.utils.escapeRegExp(text) + ")",flags)]; - } - } else if(options.whitespace) { - terms = []; - $tw.utils.each(text.split(/\s+/g),function(term) { - if(term) { - terms.push($tw.utils.escapeRegExp(term)); - } - }); - searchTermsRegExps = [new RegExp("(" + anchor + terms.join("\\s+") + ")",flags)]; - } else if(options.regexp) { - try { - searchTermsRegExps = [new RegExp("(" + text + ")",flags)]; - } catch(e) { - searchTermsRegExps = null; - console.log("Regexp error parsing /(" + text + ")/" + flags + ": ",e); + searchTermsRegExps = [new RegExp("(" + $tw.utils.escapeRegExp(text) + ")",flags)]; } } else { terms = text.split(/ +/); @@ -1120,88 +1061,38 @@ exports.search = function(text,options) { } else { searchTermsRegExps = []; for(t=0; t0 && fieldIndex> -button-background: #4C566A -button-foreground: #D8DEE9 -button-border: transparent -code-background: #2E3440 -code-border: #2E3440 -code-foreground: #BF616A -diff-delete-background: #BF616A -diff-delete-foreground: <> -diff-equal-background: -diff-equal-foreground: <> -diff-insert-background: #A3BE8C -diff-insert-foreground: <> -diff-invisible-background: -diff-invisible-foreground: <> -dirty-indicator: #BF616A -download-background: #A3BE8C -download-foreground: <> -dragger-background: <> -dragger-foreground: <> -dropdown-background: <> -dropdown-border: <> -dropdown-tab-background-selected: #ECEFF4 -dropdown-tab-background: #4C566A -dropzone-background: #A3BE8C -external-link-background-hover: inherit -external-link-background-visited: inherit -external-link-background: inherit -external-link-foreground-hover: inherit -external-link-foreground-visited: #5E81AC -external-link-foreground: #8FBCBB -foreground: #d8dee9 -message-background: #2E3440 -message-border: #2E3440 -message-foreground: #547599 -modal-backdrop: <> -modal-background: <> -modal-border: #3b4252 -modal-footer-background: #3b4252 -modal-footer-border: #3b4252 -modal-header-border: #3b4252 -muted-foreground: #4C566A -notification-background: <> -notification-border: #EBCB8B -page-background: #2e3440 -pre-background: #2E3440 -pre-border: #2E3440 -primary: #5E81AC -select-tag-background: #3b4252 -select-tag-foreground: <> -sidebar-button-foreground: <> -sidebar-controls-foreground-hover: #4C566A -sidebar-controls-foreground: #3B4252 -sidebar-foreground-shadow: transparent -sidebar-foreground: #D8DEE9 -sidebar-muted-foreground-hover: #4C566A -sidebar-muted-foreground: #4C566A -sidebar-tab-background-selected: #ECEFF4 -sidebar-tab-background: #4C566A -sidebar-tab-border-selected: <> -sidebar-tab-border: #4C566A -sidebar-tab-divider: <> -sidebar-tab-foreground-selected: #4C566A -sidebar-tab-foreground: <> -sidebar-tiddler-link-foreground-hover: #A3BE8C -sidebar-tiddler-link-foreground: #81A1C1 -site-title-foreground: <> -static-alert-foreground: #B48EAD -tab-background-selected: #ECEFF4 -tab-background: #4C566A -tab-border-selected: #4C566A -tab-border: #4C566A -tab-divider: #4C566A -tab-foreground-selected: #4C566A -tab-foreground: #D8DEE9 -table-border: #4C566A -table-footer-background: #2e3440 -table-header-background: #2e3440 -tag-background: #A3BE8C -tag-foreground: #4C566A -tiddler-background: <> -tiddler-border: <> -tiddler-controls-foreground-hover: -tiddler-controls-foreground-selected: #EBCB8B -tiddler-controls-foreground: #4C566A -tiddler-editor-background: #2e3440 -tiddler-editor-border-image: #2e3440 -tiddler-editor-border: #2e3440 -tiddler-editor-fields-even: #2e3440 -tiddler-editor-fields-odd: #2e3440 -tiddler-info-background: #2e3440 -tiddler-info-border: #2e3440 -tiddler-info-tab-background: #2e3440 -tiddler-link-background: <> -tiddler-link-foreground: <> -tiddler-subtitle-foreground: #4C566A -tiddler-title-foreground: #81A1C1 -toolbar-new-button: -toolbar-options-button: -toolbar-save-button: -toolbar-info-button: -toolbar-edit-button: -toolbar-close-button: -toolbar-delete-button: -toolbar-cancel-button: -toolbar-done-button: -untagged-background: #2d3038 -very-muted-foreground: #2d3038 diff --git a/core/palettes/SolarizedLight.tid b/core/palettes/SolarizedLight.tid deleted file mode 100644 index 13c6b83a5..000000000 --- a/core/palettes/SolarizedLight.tid +++ /dev/null @@ -1,120 +0,0 @@ -title: $:/palettes/SolarizedLight -tags: $:/tags/Palette -type: application/x-tiddler-dictionary -description: Precision colors for machines and people -license: MIT, Ethan Schoonover, https://github.com/altercation/solarized/blob/master/LICENSE -name: SolarizedLight - -alert-background: #eee8d5 -alert-border: #073642 -alert-highlight: #cb4b16 -alert-muted-foreground: #586e75 -background: #fdf6e3 -blockquote-bar: <> -button-background: #cb4b16 -button-foreground: #fdf6e3 -button-border: transparent -code-background: #eee8d5 -code-border: #93a1a1 -code-foreground: #d33682 -diff-delete-background: #BF616A -diff-delete-foreground: <> -diff-equal-background: -diff-equal-foreground: <> -diff-insert-background: #859900 -diff-insert-foreground: <> -diff-invisible-background: -diff-invisible-foreground: <> -dirty-indicator: #D08770 -download-background: #859900 -download-foreground: <> -dragger-background: <> -dragger-foreground: <> -dropdown-background: <> -dropdown-border: <> -dropdown-tab-background-selected: #fdf6e3 -dropdown-tab-background: #93a1a1 -dropzone-background: #859900 -external-link-background-hover: inherit -external-link-background-visited: inherit -external-link-background: inherit -external-link-foreground-hover: #d33682 -external-link-foreground-visited: #b58900 -external-link-foreground: #cb4b16 -foreground: #839496 -message-background: #586e75 -message-border: #586e75 -message-foreground: #eee8d5 -modal-backdrop: <> -modal-background: <> -modal-border: #eee8d5 -modal-footer-background: #eee8d5 -modal-footer-border: #eee8d5 -modal-header-border: #eee8d5 -muted-foreground: #93a1a1 -notification-background: #EBCB8B -notification-border: #D08770 -page-background: #eee8d5 -pre-background: #eee8d5 -pre-border: #93a1a1 -primary: #2aa198 -select-tag-background: #eee8d5 -select-tag-foreground: <> -sidebar-button-foreground: #eee8d5 -sidebar-controls-foreground-hover: #268bd2 -sidebar-controls-foreground: #586e75 -sidebar-foreground-shadow: transparent -sidebar-foreground: #839496 -sidebar-muted-foreground-hover: #657b83 -sidebar-muted-foreground: #93a1a1 -sidebar-tab-background-selected: #eee8d5 -sidebar-tab-background: #839496 -sidebar-tab-border-selected: <> -sidebar-tab-border: #657b83 -sidebar-tab-divider: <> -sidebar-tab-foreground-selected: #839496 -sidebar-tab-foreground: <> -sidebar-tiddler-link-foreground-hover: #859900 -sidebar-tiddler-link-foreground: #268bd2 -site-title-foreground: <> -static-alert-foreground: #dc322f -tab-background-selected: #fdf6e3 -tab-background: #839496 -tab-border-selected: #93a1a1 -tab-border: #93a1a1 -tab-divider: #fdf6e3 -tab-foreground-selected: #839496 -tab-foreground: #eee8d5 -table-border: #657b83 -table-footer-background: #657b83 -table-header-background: #93a1a1 -tag-background: #6c71c4 -tag-foreground: #eee8d5 -tiddler-background: <> -tiddler-border: <> -tiddler-controls-foreground-hover: #b58900 -tiddler-controls-foreground-selected: #b58900 -tiddler-controls-foreground: #073642 -tiddler-editor-background: #eee8d5 -tiddler-editor-border-image: #eee8d5 -tiddler-editor-border: #eee8d5 -tiddler-editor-fields-even: #eee8d5 -tiddler-editor-fields-odd: #fdf6e3 -tiddler-info-background: #eee8d5 -tiddler-info-border: #eee8d5 -tiddler-info-tab-background: #586e75 -tiddler-link-background: <> -tiddler-link-foreground: <> -tiddler-subtitle-foreground: #586e75 -tiddler-title-foreground: #073642 -toolbar-new-button: -toolbar-options-button: -toolbar-save-button: -toolbar-info-button: -toolbar-edit-button: -toolbar-close-button: -toolbar-delete-button: -toolbar-cancel-button: -toolbar-done-button: -untagged-background: #839496 -very-muted-foreground: #93a1a1 diff --git a/core/palettes/SpartanDay.tid b/core/palettes/SpartanDay.tid deleted file mode 100644 index 8f722d029..000000000 --- a/core/palettes/SpartanDay.tid +++ /dev/null @@ -1,111 +0,0 @@ -title: $:/palettes/SpartanDay -tags: $:/tags/Palette -type: application/x-tiddler-dictionary -description: Cold, spartan day colors -name: Spartan Day - -alert-background: <> -alert-border: <> -alert-highlight: <> -alert-muted-foreground: <> -background: #FAFAFA -blockquote-bar: <> -button-background: transparent -button-foreground: inherit -button-border: <> -code-background: #ececec -code-border: #ececec -code-foreground: -dirty-indicator: #c80000 -download-background: <> -download-foreground: <> -dragger-background: <> -dragger-foreground: <> -dropdown-background: #FFFFFF -dropdown-border: <> -dropdown-tab-background-selected: <> -dropdown-tab-background: #F5F5F5 -dropzone-background: <> -external-link-background-hover: transparent -external-link-background-visited: transparent -external-link-background: transparent -external-link-foreground-hover: -external-link-foreground-visited: -external-link-foreground: -foreground: rgba(0, 0, 0, 0.87) -message-background: <> -message-border: <> -message-foreground: rgba(0, 0, 0, 0.54) -modal-backdrop: <> -modal-background: <> -modal-border: <> -modal-footer-background: <> -modal-footer-border: <> -modal-header-border: <> -muted-foreground: rgba(0, 0, 0, 0.54) -notification-background: <> -notification-border: <> -page-background: #f4f4f4 -pre-background: #ececec -pre-border: #ececec -primary: #3949ab -select-tag-background: <> -select-tag-foreground: <> -sidebar-button-foreground: <> -sidebar-controls-foreground-hover: #aeaeae -sidebar-controls-foreground: #c6c6c6 -sidebar-foreground-shadow: transparent -sidebar-foreground: rgba(0, 0, 0, 0.54) -sidebar-muted-foreground-hover: rgba(0, 0, 0, 0.54) -sidebar-muted-foreground: rgba(0, 0, 0, 0.38) -sidebar-tab-background-selected: <> -sidebar-tab-background: transparent -sidebar-tab-border-selected: <> -sidebar-tab-border: transparent -sidebar-tab-divider: <> -sidebar-tab-foreground-selected: rgba(0, 0, 0, 0.87) -sidebar-tab-foreground: rgba(0, 0, 0, 0.54) -sidebar-tiddler-link-foreground-hover: rgba(0, 0, 0, 0.87) -sidebar-tiddler-link-foreground: rgba(0, 0, 0, 0.54) -site-title-foreground: rgba(0, 0, 0, 0.87) -static-alert-foreground: #aaaaaa -tab-background-selected: <> -tab-background: transparent -tab-border-selected: <> -tab-border: transparent -tab-divider: <> -tab-foreground-selected: rgba(0, 0, 0, 0.87) -tab-foreground: rgba(0, 0, 0, 0.54) -table-border: #d8d8d8 -table-footer-background: <> -table-header-background: <> -tag-background: #ec6 -tag-foreground: <> -tiddler-background: <> -tiddler-border: #f9f9f9 -tiddler-controls-foreground-hover: <> -tiddler-controls-foreground-selected: <> -tiddler-controls-foreground: <> -tiddler-editor-background: transparent -tiddler-editor-border-image: -tiddler-editor-border: #e8e7e7 -tiddler-editor-fields-even: rgba(0, 0, 0, 0.1) -tiddler-editor-fields-odd: rgba(0, 0, 0, 0.04) -tiddler-info-background: #F5F5F5 -tiddler-info-border: #F5F5F5 -tiddler-info-tab-background: <> -tiddler-link-background: <> -tiddler-link-foreground: <> -tiddler-subtitle-foreground: <> -tiddler-title-foreground: #000000 -toolbar-new-button: -toolbar-options-button: -toolbar-save-button: -toolbar-info-button: -toolbar-edit-button: -toolbar-close-button: -toolbar-delete-button: -toolbar-cancel-button: -toolbar-done-button: -untagged-background: <> -very-muted-foreground: rgba(0, 0, 0, 0.12) diff --git a/core/palettes/SpartanNight.tid b/core/palettes/SpartanNight.tid deleted file mode 100644 index f4f672af3..000000000 --- a/core/palettes/SpartanNight.tid +++ /dev/null @@ -1,111 +0,0 @@ -title: $:/palettes/SpartanNight -tags: $:/tags/Palette -type: application/x-tiddler-dictionary -description: Dark spartan colors -name: Spartan Night - -alert-background: <> -alert-border: <> -alert-highlight: <> -alert-muted-foreground: <> -background: #303030 -blockquote-bar: <> -button-background: transparent -button-foreground: inherit -button-border: <> -code-background: <> -code-border: <> -code-foreground: rgba(255, 255, 255, 0.54) -dirty-indicator: #c80000 -download-background: <> -download-foreground: <> -dragger-background: <> -dragger-foreground: <> -dropdown-background: #424242 -dropdown-border: <> -dropdown-tab-background-selected: <> -dropdown-tab-background: #050505 -dropzone-background: <> -external-link-background-hover: transparent -external-link-background-visited: transparent -external-link-background: transparent -external-link-foreground-hover: -external-link-foreground-visited: #7c318c -external-link-foreground: #9e3eb3 -foreground: rgba(255, 255, 255, 0.7) -message-background: <> -message-border: <> -message-foreground: rgba(255, 255, 255, 0.54) -modal-backdrop: <> -modal-background: <> -modal-border: <> -modal-footer-background: <> -modal-footer-border: <> -modal-header-border: <> -muted-foreground: rgba(255, 255, 255, 0.54) -notification-background: <> -notification-border: <> -page-background: #212121 -pre-background: #2a2a2a -pre-border: transparent -primary: #5656f3 -select-tag-background: <> -select-tag-foreground: <> -sidebar-button-foreground: <> -sidebar-controls-foreground-hover: #494949 -sidebar-controls-foreground: #5d5d5d -sidebar-foreground-shadow: transparent -sidebar-foreground: rgba(255, 255, 255, 0.54) -sidebar-muted-foreground-hover: rgba(255, 255, 255, 0.54) -sidebar-muted-foreground: rgba(255, 255, 255, 0.38) -sidebar-tab-background-selected: <> -sidebar-tab-background: transparent -sidebar-tab-border-selected: <> -sidebar-tab-border: transparent -sidebar-tab-divider: <> -sidebar-tab-foreground-selected: rgba(255, 255, 255, 0.87) -sidebar-tab-foreground: rgba(255, 255, 255, 0.54) -sidebar-tiddler-link-foreground-hover: rgba(255, 255, 255, 0.7) -sidebar-tiddler-link-foreground: rgba(255, 255, 255, 0.54) -site-title-foreground: rgba(255, 255, 255, 0.7) -static-alert-foreground: #aaaaaa -tab-background-selected: <> -tab-background: transparent -tab-border-selected: <> -tab-border: transparent -tab-divider: <> -tab-foreground-selected: rgba(255, 255, 255, 0.87) -tab-foreground: rgba(255, 255, 255, 0.54) -table-border: #3a3a3a -table-footer-background: <> -table-header-background: <> -tag-background: #ec6 -tag-foreground: <> -tiddler-background: <> -tiddler-border: rgb(55,55,55) -tiddler-controls-foreground-hover: <> -tiddler-controls-foreground-selected: <> -tiddler-controls-foreground: <> -tiddler-editor-background: transparent -tiddler-editor-border-image: -tiddler-editor-border: rgba(255, 255, 255, 0.08) -tiddler-editor-fields-even: rgba(255, 255, 255, 0.1) -tiddler-editor-fields-odd: rgba(255, 255, 255, 0.04) -tiddler-info-background: #454545 -tiddler-info-border: #454545 -tiddler-info-tab-background: <> -tiddler-link-background: <> -tiddler-link-foreground: <> -tiddler-subtitle-foreground: <> -tiddler-title-foreground: #FFFFFF -toolbar-new-button: -toolbar-options-button: -toolbar-save-button: -toolbar-info-button: -toolbar-edit-button: -toolbar-close-button: -toolbar-delete-button: -toolbar-cancel-button: -toolbar-done-button: -untagged-background: <> -very-muted-foreground: rgba(255, 255, 255, 0.12) diff --git a/core/palettes/Twilight.tid b/core/palettes/Twilight.tid deleted file mode 100644 index d90fef328..000000000 --- a/core/palettes/Twilight.tid +++ /dev/null @@ -1,120 +0,0 @@ -title: $:/palettes/Twilight -tags: $:/tags/Palette -author: Thomas Elmiger -type: application/x-tiddler-dictionary -name: Twilight -description: Delightful, soft darkness. - -alert-background: rgb(255, 255, 102) -alert-border: rgb(232, 232, 125) -alert-highlight: rgb(255, 51, 51) -alert-muted-foreground: rgb(224, 82, 82) -background: rgb(38, 38, 38) -blockquote-bar: rgba(240, 196, 117, 0.7) -button-background: rgb(63, 63, 63) -button-border: rgb(127, 127, 127) -button-foreground: rgb(179, 179, 179) -code-background: rgba(0,0,0,0.03) -code-border: rgba(0,0,0,0.08) -code-foreground: rgb(255, 94, 94) -diff-delete-background: #ffc9c9 -diff-delete-foreground: <> -diff-equal-background: -diff-equal-foreground: <> -diff-insert-background: #aaefad -diff-insert-foreground: <> -diff-invisible-background: -diff-invisible-foreground: <> -dirty-indicator: rgb(255, 94, 94) -download-background: #19a974 -download-foreground: rgb(38, 38, 38) -dragger-background: rgb(179, 179, 179) -dragger-foreground: rgb(38, 38, 38) -dropdown-background: rgb(38, 38, 38) -dropdown-border: rgb(255, 255, 255) -dropdown-tab-background: rgba(0,0,0,.1) -dropdown-tab-background-selected: rgba(255,255,255,1) -dropzone-background: #9eebcf -external-link-background: inherit -external-link-background-hover: inherit -external-link-background-visited: inherit -external-link-foreground: rgb(179, 179, 255) -external-link-foreground-hover: inherit -external-link-foreground-visited: rgb(153, 153, 255) -foreground: rgb(179, 179, 179) -message-background: <> -message-border: #96ccff -message-foreground: <> -modal-backdrop: rgb(179, 179, 179) -modal-background: rgb(38, 38, 38) -modal-border: rgba(0,0,0,.5) -modal-footer-background: #f4f4f4 -modal-footer-border: rgba(0,0,0,.1) -modal-header-border: rgba(0,0,0,.2) -muted-foreground: rgb(255, 255, 255) -notification-background: <> -notification-border: <> -page-background: rgb(26, 26, 26) -pre-background: rgb(25, 25, 25) -pre-border: rgba(0,0,0,.2) -primary: rgb(255, 201, 102) -select-tag-background: -select-tag-foreground: -sidebar-button-foreground: rgb(179, 179, 179) -sidebar-controls-foreground: rgb(153, 153, 153) -sidebar-controls-foreground-hover: <> -sidebar-foreground: rgb(141, 141, 141) -sidebar-foreground-shadow: transparent -sidebar-muted-foreground: rgba(0, 0, 0, 0.5) -sidebar-muted-foreground-hover: rgb(141, 141, 141) -sidebar-tab-background: rgba(141, 141, 141, 0.2) -sidebar-tab-background-selected: rgb(26, 26, 26) -sidebar-tab-border: rgb(127, 127, 127) -sidebar-tab-border-selected: rgb(127, 127, 127) -sidebar-tab-divider: rgb(127, 127, 127) -sidebar-tab-foreground: rgb(179, 179, 179) -sidebar-tab-foreground-selected: rgb(179, 179, 179) -sidebar-tiddler-link-foreground: rgb(179, 179, 179) -sidebar-tiddler-link-foreground-hover: rgb(115, 115, 115) -site-title-foreground: rgb(255, 201, 102) -static-alert-foreground: rgba(0,0,0,.3) -tab-background: rgba(0,0,0,0.125) -tab-background-selected: rgb(38, 38, 38) -tab-border: rgb(255, 201, 102) -tab-border-selected: rgb(255, 201, 102) -tab-divider: rgb(255, 201, 102) -tab-foreground: rgb(179, 179, 179) -tab-foreground-selected: rgb(179, 179, 179) -table-border: rgba(255,255,255,.3) -table-footer-background: rgba(0,0,0,.4) -table-header-background: rgba(0,0,0,.1) -tag-background: rgb(255, 201, 102) -tag-foreground: rgb(25, 25, 25) -tiddler-background: rgb(38, 38, 38) -tiddler-border: rgba(240, 196, 117, 0.7) -tiddler-controls-foreground: rgb(128, 128, 128) -tiddler-controls-foreground-hover: rgba(255, 255, 255, 0.8) -tiddler-controls-foreground-selected: rgba(255, 255, 255, 0.9) -tiddler-editor-background: rgb(33, 33, 33) -tiddler-editor-border: rgb(63, 63, 63) -tiddler-editor-border-image: rgb(25, 25, 25) -tiddler-editor-fields-even: rgb(33, 33, 33) -tiddler-editor-fields-odd: rgb(28, 28, 28) -tiddler-info-background: rgb(43, 43, 43) -tiddler-info-border: rgb(25, 25, 25) -tiddler-info-tab-background: rgb(43, 43, 43) -tiddler-link-background: rgb(38, 38, 38) -tiddler-link-foreground: rgb(204, 204, 255) -tiddler-subtitle-foreground: rgb(255, 255, 255) -tiddler-title-foreground: rgb(255, 192, 76) -toolbar-cancel-button: -toolbar-close-button: -toolbar-delete-button: -toolbar-done-button: -toolbar-edit-button: -toolbar-info-button: -toolbar-new-button: -toolbar-options-button: -toolbar-save-button: -untagged-background: rgb(255, 255, 255) -very-muted-foreground: rgba(240, 196, 117, 0.7) diff --git a/core/templates/external-js/save-all-external-js.tid b/core/templates/external-js/save-all-external-js.tid index 8eff8b9e6..31476e663 100644 --- a/core/templates/external-js/save-all-external-js.tid +++ b/core/templates/external-js/save-all-external-js.tid @@ -1,6 +1,5 @@ title: $:/core/save/all-external-js -\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \define saveTiddlerFilter() [is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ \end diff --git a/core/templates/external-js/tiddlywiki5-external-js.html.tid b/core/templates/external-js/tiddlywiki5-external-js.html.tid index 31e583c6c..611da06b0 100644 --- a/core/templates/external-js/tiddlywiki5-external-js.html.tid +++ b/core/templates/external-js/tiddlywiki5-external-js.html.tid @@ -2,12 +2,10 @@ title: $:/core/templates/tiddlywiki5-external-js.html \rules only filteredtranscludeinline transcludeinline -{{$:/core/templates/MOTW.html}} +{{$:/core/templates/MOTW.html}} + - -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}} - @@ -26,8 +24,6 @@ title: $:/core/templates/tiddlywiki5-external-js.html {{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}} - -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}}
{{$:/boot/boot.css||$:/core/templates/css-tiddler}} @@ -40,8 +36,6 @@ title: $:/core/templates/tiddlywiki5-external-js.html {{$:/core/templates/store.area.template.html}} - -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}} diff --git a/core/templates/save-all.tid b/core/templates/save-all.tid index d622f9c52..52ef0fb2c 100644 --- a/core/templates/save-all.tid +++ b/core/templates/save-all.tid @@ -1,6 +1,5 @@ title: $:/core/save/all -\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \define saveTiddlerFilter() [is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ \end diff --git a/core/templates/single.tiddler.window.tid b/core/templates/single.tiddler.window.tid index 16353ee97..f93060aed 100644 --- a/core/templates/single.tiddler.window.tid +++ b/core/templates/single.tiddler.window.tid @@ -1,24 +1,16 @@ title: $:/core/templates/single.tiddler.window -\whitespace trim -\define containerClasses() -tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$ -\end -\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] +<$set name="themeTitle" value={{$:/view}}> -<$set name="tv-config-toolbar-icons" value={{$:/config/Toolbar/Icons}}> +<$set name="tempCurrentTiddler" value=<>> -<$set name="tv-config-toolbar-text" value={{$:/config/Toolbar/Text}}> +<$set name="currentTiddler" value={{$:/language}}> -<$set name="tv-config-toolbar-class" value={{$:/config/Toolbar/ButtonClass}}> +<$set name="languageTitle" value={{!!name}}> -<$set name="tv-show-missing-links" value={{$:/config/MissingLinks}}> +<$set name="currentTiddler" value=<>> -<$set name="storyviewTitle" value={{$:/view}}> - -<$set name="languageTitle" value={{{ [{$:/language}get[name]] }}}> - -
>> +<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"> <$navigator story="$:/StoryList" history="$:/HistoryList" singleTiddlerMode={{{ [getstoryviewmode[singletiddlermode]] }}}> @@ -26,7 +18,7 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$ -
+ @@ -38,4 +30,3 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$ - diff --git a/core/templates/static.area.tid b/core/templates/static.area.tid index 16c7150e6..d235ab4ed 100644 --- a/core/templates/static.area.tid +++ b/core/templates/static.area.tid @@ -7,7 +7,3 @@ title: $:/core/templates/static.area <$reveal type="match" state="$:/isEncrypted" text="yes"> This file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted. - -`` diff --git a/core/templates/tiddlywiki5.html.tid b/core/templates/tiddlywiki5.html.tid index ef5a7e1ea..26bf5c423 100644 --- a/core/templates/tiddlywiki5.html.tid +++ b/core/templates/tiddlywiki5.html.tid @@ -1,59 +1,58 @@ title: $:/core/templates/tiddlywiki5.html -<$set name="saveTiddlerAndShadowsFilter" filter="[subfilter] [subfilterplugintiddlers[]]"> -` -`{{$:/core/templates/MOTW.html}}` +\rules only filteredtranscludeinline transcludeinline + +{{$:/core/templates/MOTW.html}} -`{{{ [tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}}` +{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}} - + - + -`{{$:/core/wiki/title}}` +{{$:/core/wiki/title}} -`{{{ [enlisttag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}} -{{{ [enlisttag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}} -{{{ [enlisttag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}}` +{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}} +{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}} -`{{{ [enlisttag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}}` +{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}}
-`{{$:/boot/boot.css||$:/core/templates/css-tiddler}}` +{{$:/boot/boot.css||$:/core/templates/css-tiddler}}
-`{{$:/core/templates/store.area.template.html}}` +{{$:/core/templates/store.area.template.html}} -`{{{ [enlisttag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}}` +{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}} -` + diff --git a/core/ui/Actions/new-image.tid b/core/ui/Actions/new-image.tid deleted file mode 100644 index 1e46ebcdb..000000000 --- a/core/ui/Actions/new-image.tid +++ /dev/null @@ -1,10 +0,0 @@ -title: $:/core/ui/Actions/new-image -tags: $:/tags/Actions -description: create a new image tiddler - -\define get-type() -image/$(imageType)$ -\end -<$vars imageType={{$:/config/NewImageType}}> -<$action-sendmessage $message="tm-new-tiddler" type=<> tags={{$:/config/NewTiddler/Tags!!tags}}/> - diff --git a/core/ui/Actions/new-journal.tid b/core/ui/Actions/new-journal.tid deleted file mode 100644 index 9f3453926..000000000 --- a/core/ui/Actions/new-journal.tid +++ /dev/null @@ -1,14 +0,0 @@ -title: $:/core/ui/Actions/new-journal -tags: $:/tags/Actions -description: create a new journal tiddler - -<$vars journalTitleTemplate={{$:/config/NewJournal/Title}} journalTags={{$:/config/NewJournal/Tags!!tags}} journalText={{$:/config/NewJournal/Text}}> -<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<>/>"""> -<$reveal type="nomatch" state=<> text=""> -<$action-sendmessage $message="tm-new-tiddler" title=<> tags=<> text={{{ [get[]] }}}/> - -<$reveal type="match" state=<> text=""> -<$action-sendmessage $message="tm-new-tiddler" title=<> tags=<> text=<>/> - - - diff --git a/core/ui/Actions/new-tiddler.tid b/core/ui/Actions/new-tiddler.tid deleted file mode 100644 index e176f0ab3..000000000 --- a/core/ui/Actions/new-tiddler.tid +++ /dev/null @@ -1,5 +0,0 @@ -title: $:/core/ui/Actions/new-tiddler -tags: $:/tags/Actions -description: create a new empty tiddler - -<$action-sendmessage $message="tm-new-tiddler" tags={{$:/config/NewTiddler/Tags!!tags}}/> diff --git a/core/ui/AdvancedSearch/Filter.tid b/core/ui/AdvancedSearch/Filter.tid index 55de251d6..f6f13a863 100644 --- a/core/ui/AdvancedSearch/Filter.tid +++ b/core/ui/AdvancedSearch/Filter.tid @@ -6,7 +6,7 @@ caption: {{$:/language/Search/Filter/Caption}} <> diff --git a/core/ui/AdvancedSearch/FilterButtons/dropdown.tid b/core/ui/AdvancedSearch/FilterButtons/dropdown.tid index cd6351f7b..ee1c5eb37 100644 --- a/core/ui/AdvancedSearch/FilterButtons/dropdown.tid +++ b/core/ui/AdvancedSearch/FilterButtons/dropdown.tid @@ -8,7 +8,6 @@ tags: $:/tags/AdvancedSearch/FilterButton <$reveal state=<> type="popup" position="belowleft" animate="yes"> -<$set name="tv-show-missing-links" value="yes"> <$linkcatcher to="$:/temp/advancedsearch">
@@ -17,5 +16,4 @@ tags: $:/tags/AdvancedSearch/FilterButton
- diff --git a/core/ui/AdvancedSearch/Shadows.tid b/core/ui/AdvancedSearch/Shadows.tid index 9dcf5d67e..b2455bfbb 100644 --- a/core/ui/AdvancedSearch/Shadows.tid +++ b/core/ui/AdvancedSearch/Shadows.tid @@ -8,7 +8,7 @@ caption: {{$:/language/Search/Shadows/Caption}} <>