mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-09-05 12:28:02 +00:00
merge to latest tw5
This commit is contained in:
239
plugins/tiddlywiki/browser-sniff/bowser/bowser.js
Normal file
239
plugins/tiddlywiki/browser-sniff/bowser/bowser.js
Normal file
@@ -0,0 +1,239 @@
|
||||
/*!
|
||||
* Bowser - a browser detector
|
||||
* https://github.com/ded/bowser
|
||||
* MIT License | (c) Dustin Diaz 2014
|
||||
*/
|
||||
|
||||
!function (name, definition) {
|
||||
if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
|
||||
else if (typeof define == 'function') define(definition)
|
||||
else this[name] = definition()
|
||||
}('bowser', function () {
|
||||
/**
|
||||
* See useragents.js for examples of navigator.userAgent
|
||||
*/
|
||||
|
||||
var t = true
|
||||
|
||||
function detect(ua) {
|
||||
|
||||
function getFirstMatch(regex) {
|
||||
var match = ua.match(regex);
|
||||
return (match && match.length > 1 && match[1]) || '';
|
||||
}
|
||||
|
||||
var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
|
||||
, likeAndroid = /like android/i.test(ua)
|
||||
, android = !likeAndroid && /android/i.test(ua)
|
||||
, versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
|
||||
, tablet = /tablet/i.test(ua)
|
||||
, mobile = !tablet && /[^-]mobi/i.test(ua)
|
||||
, result
|
||||
|
||||
if (/opera|opr/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Opera'
|
||||
, opera: t
|
||||
, version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/windows phone/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Windows Phone'
|
||||
, windowsphone: t
|
||||
, msie: t
|
||||
, version: getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/msie|trident/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Internet Explorer'
|
||||
, msie: t
|
||||
, version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/chrome|crios|crmo/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Chrome'
|
||||
, chrome: t
|
||||
, version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (iosdevice) {
|
||||
result = {
|
||||
name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
|
||||
}
|
||||
// WTF: version is not part of user agent in web apps
|
||||
if (versionIdentifier) {
|
||||
result.version = versionIdentifier
|
||||
}
|
||||
}
|
||||
else if (/sailfish/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Sailfish'
|
||||
, sailfish: t
|
||||
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/seamonkey\//i.test(ua)) {
|
||||
result = {
|
||||
name: 'SeaMonkey'
|
||||
, seamonkey: t
|
||||
, version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/firefox|iceweasel/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Firefox'
|
||||
, firefox: t
|
||||
, version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)
|
||||
}
|
||||
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
||||
result.firefoxos = t
|
||||
}
|
||||
}
|
||||
else if (/silk/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Amazon Silk'
|
||||
, silk: t
|
||||
, version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (android) {
|
||||
result = {
|
||||
name: 'Android'
|
||||
, version: versionIdentifier
|
||||
}
|
||||
}
|
||||
else if (/phantom/i.test(ua)) {
|
||||
result = {
|
||||
name: 'PhantomJS'
|
||||
, phantom: t
|
||||
, version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
|
||||
result = {
|
||||
name: 'BlackBerry'
|
||||
, blackberry: t
|
||||
, version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
}
|
||||
else if (/(web|hpw)os/i.test(ua)) {
|
||||
result = {
|
||||
name: 'WebOS'
|
||||
, webos: t
|
||||
, version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
|
||||
};
|
||||
/touchpad\//i.test(ua) && (result.touchpad = t)
|
||||
}
|
||||
else if (/bada/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Bada'
|
||||
, bada: t
|
||||
, version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
|
||||
};
|
||||
}
|
||||
else if (/tizen/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Tizen'
|
||||
, tizen: t
|
||||
, version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
|
||||
};
|
||||
}
|
||||
else if (/safari/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Safari'
|
||||
, safari: t
|
||||
, version: versionIdentifier
|
||||
}
|
||||
}
|
||||
else result = {}
|
||||
|
||||
// set webkit or gecko flag for browsers based on these engines
|
||||
if (/(apple)?webkit/i.test(ua)) {
|
||||
result.name = result.name || "Webkit"
|
||||
result.webkit = t
|
||||
if (!result.version && versionIdentifier) {
|
||||
result.version = versionIdentifier
|
||||
}
|
||||
} else if (!result.opera && /gecko\//i.test(ua)) {
|
||||
result.name = result.name || "Gecko"
|
||||
result.gecko = t
|
||||
result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
|
||||
// set OS flags for platforms that have multiple browsers
|
||||
if (android || result.silk) {
|
||||
result.android = t
|
||||
} else if (iosdevice) {
|
||||
result[iosdevice] = t
|
||||
result.ios = t
|
||||
}
|
||||
|
||||
// OS version extraction
|
||||
var osVersion = '';
|
||||
if (iosdevice) {
|
||||
osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
|
||||
osVersion = osVersion.replace(/[_\s]/g, '.');
|
||||
} else if (android) {
|
||||
osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
|
||||
} else if (result.windowsphone) {
|
||||
osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
|
||||
} else if (result.webos) {
|
||||
osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
|
||||
} else if (result.blackberry) {
|
||||
osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
|
||||
} else if (result.bada) {
|
||||
osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
|
||||
} else if (result.tizen) {
|
||||
osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
|
||||
}
|
||||
if (osVersion) {
|
||||
result.osversion = osVersion;
|
||||
}
|
||||
|
||||
// device type extraction
|
||||
var osMajorVersion = osVersion.split('.')[0];
|
||||
if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) {
|
||||
result.tablet = t
|
||||
} else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) {
|
||||
result.mobile = t
|
||||
}
|
||||
|
||||
// Graded Browser Support
|
||||
// http://developer.yahoo.com/yui/articles/gbs
|
||||
if ((result.msie && result.version >= 10) ||
|
||||
(result.chrome && result.version >= 20) ||
|
||||
(result.firefox && result.version >= 20.0) ||
|
||||
(result.safari && result.version >= 6) ||
|
||||
(result.opera && result.version >= 10.0) ||
|
||||
(result.ios && result.osversion && result.osversion.split(".")[0] >= 6)
|
||||
) {
|
||||
result.a = t;
|
||||
}
|
||||
else if ((result.msie && result.version < 10) ||
|
||||
(result.chrome && result.version < 20) ||
|
||||
(result.firefox && result.version < 20.0) ||
|
||||
(result.safari && result.version < 6) ||
|
||||
(result.opera && result.version < 10.0) ||
|
||||
(result.ios && result.osversion && result.osversion.split(".")[0] < 6)
|
||||
) {
|
||||
result.c = t
|
||||
} else result.x = t
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '')
|
||||
|
||||
|
||||
/*
|
||||
* Set our detect method to the main bowser object so we can
|
||||
* reuse it to test other user agents.
|
||||
* This is needed to implement future tests.
|
||||
*/
|
||||
bowser._detect = detect;
|
||||
|
||||
return bowser
|
||||
});
|
12
plugins/tiddlywiki/browser-sniff/bowser/tiddlywiki.files
Normal file
12
plugins/tiddlywiki/browser-sniff/bowser/tiddlywiki.files
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"file": "bowser.js",
|
||||
"fields": {
|
||||
"type": "application/javascript",
|
||||
"title": "$:/plugins/tiddlywiki/browser-sniff/bowser/bowser.js",
|
||||
"module-type": "library"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
78
plugins/tiddlywiki/browser-sniff/browser.js
Normal file
78
plugins/tiddlywiki/browser-sniff/browser.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/browser-sniff/sniff.js
|
||||
type: application/javascript
|
||||
module-type: info
|
||||
|
||||
Initialise $:/info/browser tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.getInfoTiddlerFields = function() {
|
||||
var mapBoolean = function(value) {return value ? "yes" : "no"},
|
||||
infoTiddlerFields = [];
|
||||
// Basics
|
||||
if($tw.browser) {
|
||||
// Mappings from tiddler titles (prefixed with "$:/info/browser/") to bowser.browser property name
|
||||
var bowser = require("$:/plugins/tiddlywiki/browser-sniff/bowser/bowser.js"),
|
||||
mappings = [
|
||||
["name","name","unknown"],
|
||||
["version","version"],
|
||||
["is/webkit","webkit"],
|
||||
["is/gecko","gecko"],
|
||||
["is/chrome","chrome"],
|
||||
["is/firefox","firefox"],
|
||||
["is/ios","ios"],
|
||||
["is/iphone","iphone"],
|
||||
["is/ipad","ipad"],
|
||||
["is/ipod","ios"],
|
||||
["is/opera","opera"],
|
||||
["is/phantomjs","phantomjs"],
|
||||
["is/safari","safari"],
|
||||
["is/seamonkey","seamonkey"],
|
||||
["is/blackberry","blackberry"],
|
||||
["is/webos","webos"],
|
||||
["is/silk","silk"],
|
||||
["is/bada","bada"],
|
||||
["is/tizen","tizen"],
|
||||
["is/sailfish","sailfish"],
|
||||
["is/android","android"],
|
||||
["is/windowsphone","windowsphone"],
|
||||
["is/firefoxos","firefoxos"]
|
||||
];
|
||||
$tw.utils.each(mappings,function(mapping) {
|
||||
var value = bowser.browser[mapping[1]];
|
||||
if(value === undefined) {
|
||||
value = mapping[2];
|
||||
}
|
||||
if(value === undefined) {
|
||||
value = false;
|
||||
}
|
||||
if(typeof value === "boolean") {
|
||||
value = mapBoolean(value);
|
||||
}
|
||||
infoTiddlerFields.push({title: "$:/info/browser/" + mapping[0], text: value});
|
||||
});
|
||||
// Set $:/info/browser/name to the platform with some changes from Bowser
|
||||
var platform = bowser.browser.name;
|
||||
if("iPad iPhone iPod".split(" ").indexOf(platform) !== -1) {
|
||||
platform = "iOS";
|
||||
}
|
||||
infoTiddlerFields.push({title: "$:/info/browser/name", text: platform});
|
||||
// Non-bowser settings for TiddlyFox and TiddlyDesktop
|
||||
var hasTiddlyFox = !!document.getElementById("tiddlyfox-message-box"), // Fails because message box is added after page load
|
||||
isTiddlyDesktop = false; // Can't detect it until we update TiddlyDesktop to have a distinct useragent string
|
||||
//infoTiddlerFields.push({title: "$:/info/browser/has/tiddlyfox", text: mapBoolean(hasTiddlyFox)});
|
||||
//infoTiddlerFields.push({title: "$:/info/browser/is/tiddlydesktop", text: mapBoolean(isTiddlyDesktop)});
|
||||
if(isTiddlyDesktop) {
|
||||
infoTiddlerFields.push({title: "$:/info/browser/name", text: "TiddlyDesktop"});
|
||||
}
|
||||
}
|
||||
return infoTiddlerFields;
|
||||
};
|
||||
|
||||
})();
|
7
plugins/tiddlywiki/browser-sniff/plugin.info
Normal file
7
plugins/tiddlywiki/browser-sniff/plugin.info
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/browser-sniff",
|
||||
"description": "Browser sniffing for TiddlyWiki",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0",
|
||||
"list": "readme"
|
||||
}
|
52
plugins/tiddlywiki/browser-sniff/readme.tid
Normal file
52
plugins/tiddlywiki/browser-sniff/readme.tid
Normal file
@@ -0,0 +1,52 @@
|
||||
title: $:/plugins/tiddlywiki/browser-sniff/readme
|
||||
|
||||
This plugin adds a number of `$:/info/` tiddlers containing information about the current browser.
|
||||
|
||||
! Information Tiddlers
|
||||
|
||||
|!Title |!Description |
|
||||
|[[$:/info/browser/is/android]] |Running on Android? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/bada]] |Running on Bada? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/blackberry]] |Running on ~BlackBerry? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/chrome]] |Running on Chrome? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/firefox]] |Running on Firefox? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/firefoxos]] |Running on Firefox OS? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/gecko]] |Running on Gecko? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/ios]] |Running on iOS (ie an iPhone, iPad or iPod)? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/ipad]] |Running on iPad? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/iphone]] |Running on iPhone? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/ipod]] |Running on iPod? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/opera]] |Running on Opera? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/phantomjs]] |Running on ~PhantomJS? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/safari]] |Running on Safari? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/sailfish]] |Running on Sailfish? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/seamonkey]] |Running on Sea Monkey? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/silk]] |Running on Amazon's Silk? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/tizen]] |Running on Tizen? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/webkit]] |Running on ~WebKit? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/webos]] |Running on ~WebOS? ("yes" or "no") |
|
||||
|[[$:/info/browser/is/windowsphone]] |Running on Windows Phone? ("yes" or "no") |
|
||||
|[[$:/info/browser/name]] |Platform name (see below) |
|
||||
|[[$:/info/browser/version]] |Browser version |
|
||||
|
||||
The browser information is obtained with [[Bowser, a browser detector library from Dustin Diaz|https://github.com/ded/bowser/]]. Possible browser names include:
|
||||
|
||||
* ''"Amazon Silk"''
|
||||
* ''"Android"''
|
||||
* ''"Bada"''
|
||||
* ''"~BlackBerry"''
|
||||
* ''"Chrome"''
|
||||
* ''"Firefox"''
|
||||
* ''"Internet Explorer"''
|
||||
* ''"iOS"''
|
||||
* ''"Opera"''
|
||||
* ''"~PhantomJS"''
|
||||
* ''"Safari"''
|
||||
* ''"Sailfish"''
|
||||
* ''"~SeaMonkey"''
|
||||
* ''"~TiddlyDesktop"''
|
||||
* ''"Tizen"''
|
||||
* ''"~WebOS"''
|
||||
* ''"Windows Phone"''
|
||||
|
||||
Note that Bowser returns "iPhone", "iPad" and "iPod" as distinct values for the name of the current browser. TiddlyWiki converts all three distinct values into "iOS" before copying to [[$:/info/browser/name]].
|
@@ -2,5 +2,6 @@
|
||||
"title": "$:/plugins/tiddlywiki/cecily",
|
||||
"description": "Zoomable User Interface for TiddlyWiki",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0"
|
||||
"core-version": ">=5.0.0",
|
||||
"list": "readme"
|
||||
}
|
||||
|
7
plugins/tiddlywiki/cecily/readme.tid
Normal file
7
plugins/tiddlywiki/cecily/readme.tid
Normal file
@@ -0,0 +1,7 @@
|
||||
title: $:/plugins/tiddlywiki/cecily/readme
|
||||
|
||||
This plugin provides a new story visualisation that displays individual tiddlers as resizable tiles on an infinite canvas.
|
||||
|
||||
Cecily is based on an earlier plugin for TiddlyWiki Classic: http://jermolene.com/cecily
|
||||
|
||||
Cecily is currently in the early stages of development with little functionality yet implemented.
|
13
plugins/tiddlywiki/cecily/storyview-cecily.tid
Normal file
13
plugins/tiddlywiki/cecily/storyview-cecily.tid
Normal file
@@ -0,0 +1,13 @@
|
||||
title: $:/core/images/storyview-cecily
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tw-image-storyview-cecily tw-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||
<g fill-rule="evenodd">
|
||||
<path d="M9.99919566,0 C4.48152297,0 0.00856547772,4.48053479 0.00856547772,9.99063018 L0.00856547772,118.00937 C0.00856547772,123.527043 4.48910027,128 9.99919566,128 L118.017935,128 C123.535608,128 128.008565,123.519465 128.008565,118.00937 L128.008565,9.99063018 C128.008565,4.47295749 123.528031,0 118.017935,0 L9.99919566,0 Z M9.00856548,9 L9.00856548,119 L119.008565,119 L119.008565,9 L9.00856548,9 Z"></path>
|
||||
<rect x="16.0098828" y="16" width="28.9901172" height="61"></rect>
|
||||
<rect x="52.0098828" y="16" width="12.1124795" height="23"></rect>
|
||||
<rect x="35.8875205" y="85" width="28.2348417" height="28"></rect>
|
||||
<rect x="71.132245" y="16" width="12.1124795" height="74"></rect>
|
||||
<rect x="90.2546073" y="16" width="21.9693375" height="43"></rect>
|
||||
</g>
|
||||
</svg>
|
10
plugins/tiddlywiki/codemirror/EditorTypeMappings.multids
Normal file
10
plugins/tiddlywiki/codemirror/EditorTypeMappings.multids
Normal file
@@ -0,0 +1,10 @@
|
||||
title: $:/config/EditorTypeMappings/
|
||||
|
||||
application/javascript: codemirror
|
||||
application/json: codemirror
|
||||
application/x-tiddler-dictionary: codemirror
|
||||
text/css: codemirror
|
||||
text/html: codemirror
|
||||
text/plain: codemirror
|
||||
text/vnd.tiddlywiki: codemirror
|
||||
text/x-tiddlywiki: codemirror
|
@@ -1,92 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/edit-text-codemirror.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Extend the edit-text widget to use CodeMirror
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var CODEMIRROR_OPTIONS = "$:/config/CodeMirror", configOptions;
|
||||
/*
|
||||
e.g. to allow vim key bindings
|
||||
{
|
||||
"require": [
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js"
|
||||
],
|
||||
"configuration": {
|
||||
"keyMap": "vim",
|
||||
"showCursorWhenSelecting": true
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
var EditTextWidget = require("$:/core/modules/widgets/edit-text.js")["edit-text"];
|
||||
|
||||
if($tw.browser) {
|
||||
window.CodeMirror = require("$:/plugins/tiddlywiki/codemirror/lib/codemirror.js");
|
||||
|
||||
configOptions = $tw.wiki.getTiddlerData(CODEMIRROR_OPTIONS,{});
|
||||
|
||||
if(configOptions) {
|
||||
if(configOptions["require"]) {
|
||||
if($tw.utils.isArray(configOptions["require"])) {
|
||||
for (var index=0; index < configOptions["require"].length; index++) {
|
||||
require(configOptions["require"][index]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
require(configOptions["require"]);
|
||||
}
|
||||
}
|
||||
EditTextWidget.configuration = configOptions["configuration"];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
The edit-text widget calls this method just after inserting its dom nodes
|
||||
*/
|
||||
EditTextWidget.prototype.postRender = function() {
|
||||
var self = this,
|
||||
cm, config, cv, cm_opts = {
|
||||
lineWrapping: true,
|
||||
lineNumbers: true
|
||||
},
|
||||
tid = this.wiki.getTiddler(this.editTitle);
|
||||
if(tid && tid.fields.type) {
|
||||
cm_opts.mode = tid.fields.type
|
||||
};
|
||||
|
||||
if($tw.browser && window.CodeMirror && this.editTag === "textarea") {
|
||||
if(EditTextWidget.configuration) {
|
||||
for (cv in EditTextWidget.configuration) { cm_opts[cv] = EditTextWidget.configuration[cv]; }
|
||||
}
|
||||
cm = window.CodeMirror.fromTextArea(this.domNodes[0], cm_opts);
|
||||
cm.on("change",function() {
|
||||
self.saveChanges(cm.getValue());
|
||||
});
|
||||
} else {
|
||||
cm = undefined;
|
||||
}
|
||||
this.codemirrorInstance = cm;
|
||||
};
|
||||
|
||||
EditTextWidget.prototype.updateEditor = function(text) {
|
||||
// Replace the edit value if the tiddler we're editing has changed
|
||||
if(this.codemirrorInstance) {
|
||||
if(!this.codemirrorInstance.hasFocus()) {
|
||||
this.codemirrorInstance.setValue(text);
|
||||
}
|
||||
} else {
|
||||
this.updateEditorDomNode(this.getEditInfo().value);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
210
plugins/tiddlywiki/codemirror/edit-codemirror.js
Normal file
210
plugins/tiddlywiki/codemirror/edit-codemirror.js
Normal file
@@ -0,0 +1,210 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/edit-codemirror.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Codemirror-based text editor widget
|
||||
|
||||
Config options "$:/config/CodeMirror" e.g. to allow vim key bindings
|
||||
{
|
||||
"require": [
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js"
|
||||
],
|
||||
"configuration": {
|
||||
"keyMap": "vim",
|
||||
"showCursorWhenSelecting": true
|
||||
}
|
||||
}
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var CODEMIRROR_OPTIONS = "$:/config/CodeMirror"
|
||||
|
||||
// Install CodeMirror
|
||||
if($tw.browser && !window.CodeMirror) {
|
||||
window.CodeMirror = require("$:/plugins/tiddlywiki/codemirror/lib/codemirror.js");
|
||||
// Install required CodeMirror plugins
|
||||
var configOptions = $tw.wiki.getTiddlerData(CODEMIRROR_OPTIONS,{}),
|
||||
req = configOptions["require"];
|
||||
if(req) {
|
||||
if($tw.utils.isArray(req)) {
|
||||
for(var index=0; index<req.length; index++) {
|
||||
require(req[index]);
|
||||
}
|
||||
} else {
|
||||
require(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var MIN_TEXT_AREA_HEIGHT = 100; // Minimum height of textareas in pixels
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var EditCodeMirrorWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype.render = function(parent,nextSibling) {
|
||||
var self = this;
|
||||
// Save the parent dom node
|
||||
this.parentDomNode = parent;
|
||||
// Compute our attributes
|
||||
this.computeAttributes();
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
// Get the configuration options for the CodeMirror object
|
||||
var config = $tw.wiki.getTiddlerData(CODEMIRROR_OPTIONS,{}).configuration || {},
|
||||
editInfo = this.getEditInfo();
|
||||
if(!("lineWrapping" in config)) {
|
||||
config.lineWrapping = true;
|
||||
}
|
||||
if(!("lineNumbers" in config)) {
|
||||
config.lineNumbers = true;
|
||||
}
|
||||
config.mode = editInfo.type;
|
||||
config.value = editInfo.value;
|
||||
// Create the CodeMirror instance
|
||||
var cm = window.CodeMirror(function(domNode) {
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
self.domNodes.push(domNode);
|
||||
},config);
|
||||
// Set up a change event handler
|
||||
cm.on("change",function() {
|
||||
self.saveChanges(cm.getValue());
|
||||
});
|
||||
this.codeMirrorInstance = cm;
|
||||
};
|
||||
|
||||
/*
|
||||
Get the tiddler being edited and current value
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype.getEditInfo = function() {
|
||||
// Get the edit value
|
||||
var self = this,
|
||||
value,
|
||||
type = "text/plain",
|
||||
update;
|
||||
if(this.editIndex) {
|
||||
value = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault);
|
||||
update = function(value) {
|
||||
var data = self.wiki.getTiddlerData(self.editTitle,{});
|
||||
if(data[self.editIndex] !== value) {
|
||||
data[self.editIndex] = value;
|
||||
self.wiki.setTiddlerData(self.editTitle,data);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// Get the current tiddler and the field name
|
||||
var tiddler = this.wiki.getTiddler(this.editTitle);
|
||||
if(tiddler) {
|
||||
// If we've got a tiddler, the value to display is the field string value
|
||||
value = tiddler.getFieldString(this.editField);
|
||||
if(this.editField === "text") {
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki";
|
||||
}
|
||||
} else {
|
||||
// Otherwise, we need to construct a default value for the editor
|
||||
switch(this.editField) {
|
||||
case "text":
|
||||
value = "Type the text for the tiddler '" + this.editTitle + "'";
|
||||
type = "text/vnd.tiddlywiki";
|
||||
break;
|
||||
case "title":
|
||||
value = this.editTitle;
|
||||
break;
|
||||
default:
|
||||
value = "";
|
||||
break;
|
||||
}
|
||||
if(this.editDefault !== undefined) {
|
||||
value = this.editDefault;
|
||||
}
|
||||
}
|
||||
update = function(value) {
|
||||
var tiddler = self.wiki.getTiddler(self.editTitle),
|
||||
updateFields = {
|
||||
title: self.editTitle
|
||||
};
|
||||
updateFields[self.editField] = value;
|
||||
self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields()));
|
||||
};
|
||||
}
|
||||
if(this.editType) {
|
||||
type = this.editType;
|
||||
}
|
||||
return {value: value, type: type, update: update};
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype.execute = function() {
|
||||
// Get our parameters
|
||||
this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.editField = this.getAttribute("field","text");
|
||||
this.editIndex = this.getAttribute("index");
|
||||
this.editDefault = this.getAttribute("default");
|
||||
this.editType = this.getAttribute("type");
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Completely rerender if any of our attributes have changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else if(changedTiddlers[this.editTitle]) {
|
||||
this.updateEditor(this.getEditInfo().value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/*
|
||||
Update the editor with new text. This method is separate from updateEditorDomNode()
|
||||
so that subclasses can override updateEditor() and still use updateEditorDomNode()
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype.updateEditor = function(text) {
|
||||
this.updateEditorDomNode(text);
|
||||
};
|
||||
|
||||
/*
|
||||
Update the editor dom node with new text
|
||||
*/
|
||||
EditCodeMirrorWidget.prototype.updateEditorDomNode = function(text) {
|
||||
if(this.codeMirrorInstance) {
|
||||
if(!this.codeMirrorInstance.hasFocus()) {
|
||||
this.codeMirrorInstance.setValue(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EditCodeMirrorWidget.prototype.saveChanges = function(text) {
|
||||
var editInfo = this.getEditInfo();
|
||||
if(text !== editInfo.value) {
|
||||
editInfo.update(text);
|
||||
}
|
||||
};
|
||||
|
||||
exports["edit-codemirror"] = EditCodeMirrorWidget;
|
||||
|
||||
})();
|
@@ -1,26 +0,0 @@
|
||||
title: $:/plugins/tiddlywiki/codemirror/instructions
|
||||
|
||||
! Configuration
|
||||
|
||||
* You can configure the CodeMirror plugin by creating a tiddler called [[$:/config/CodeMirror]] containing a JSON configuration object.
|
||||
* The configuration tiddler needs to be `type: application/json`, to take effect.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
{
|
||||
"require": [
|
||||
"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/keymap/emacs.js"
|
||||
],
|
||||
"configuration": {
|
||||
"keyMap": "vim",
|
||||
"matchBrackets":true,
|
||||
"showCursorWhenSelecting": true
|
||||
}
|
||||
}
|
||||
```
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/codemirror",
|
||||
"description": "Codemirror plugin",
|
||||
"author": "JeremyRuston"
|
||||
"author": "JeremyRuston",
|
||||
"list": "readme"
|
||||
}
|
||||
|
33
plugins/tiddlywiki/codemirror/readme.tid
Normal file
33
plugins/tiddlywiki/codemirror/readme.tid
Normal file
@@ -0,0 +1,33 @@
|
||||
title: $:/plugins/tiddlywiki/codemirror/readme
|
||||
|
||||
! Setting ~CodeMirror Content Types
|
||||
|
||||
You can determine which tiddler content types are edited by the ~CodeMirror widget by creating or modifying special tiddlers whose prefix is comprised of the string `$:/config/EditorTypeMappings/` concatenated with the content type. The text of that tiddler gives the editor type to be used (eg, ''text'', ''bitmap'', ''codemirror'').
|
||||
|
||||
The current editor type mappings are shown in [[$:/ControlPanel]] under the "Advanced" tab.
|
||||
|
||||
! ~CodeMirror Configuration
|
||||
|
||||
You can configure the ~CodeMirror plugin by creating a tiddler called [[$:/config/CodeMirror]] containing a JSON configuration object. The configuration tiddler must have its type field set to `application/json` to take effect.
|
||||
|
||||
See http://codemirror.net/ for details of available configuration options.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
{
|
||||
"require": [
|
||||
"$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/addon/edit/matchbrackets.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js",
|
||||
"$:/plugins/tiddlywiki/codemirror/keymap/emacs.js"
|
||||
],
|
||||
"configuration": {
|
||||
"keyMap": "vim",
|
||||
"matchBrackets":true,
|
||||
"showCursorWhenSelecting": true
|
||||
}
|
||||
}
|
||||
```
|
@@ -3,7 +3,7 @@ title: $:/plugins/tiddlywiki/filesystem/filesystemadaptor.js
|
||||
type: application/javascript
|
||||
module-type: syncadaptor
|
||||
|
||||
A sync adaptor module for synchronising with the local filesystem via node.js APIs
|
||||
A sync adaptor module for synchronising with the local filesystem via node.js APIs
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@@ -16,9 +16,9 @@ A sync adaptor module for synchronising with the local filesystem via node.js AP
|
||||
var fs = !$tw.browser ? require("fs") : null,
|
||||
path = !$tw.browser ? require("path") : null;
|
||||
|
||||
function FileSystemAdaptor(syncer) {
|
||||
function FileSystemAdaptor(options) {
|
||||
var self = this;
|
||||
this.syncer = syncer;
|
||||
this.wiki = options.wiki;
|
||||
this.watchers = {};
|
||||
this.pending = {};
|
||||
this.logger = new $tw.utils.Logger("FileSystem");
|
||||
@@ -31,7 +31,7 @@ function FileSystemAdaptor(syncer) {
|
||||
var tiddlers = $tw.loadTiddlersFromFile(filename).tiddlers;
|
||||
for(var t in tiddlers) {
|
||||
if(tiddlers[t].title) {
|
||||
$tw.wiki.addTiddler(tiddlers[t]);
|
||||
self.wiki.addTiddler(tiddlers[t]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
content = $tw.wiki.renderTiddler("text/plain","$:/core/templates/tiddler-metadata",{variables: {currentTiddler: tiddler.fields.title}});
|
||||
content = self.wiki.renderTiddler("text/plain","$:/core/templates/tiddler-metadata",{variables: {currentTiddler: tiddler.fields.title}});
|
||||
fs.writeFile(fileInfo.filepath + ".meta",content,{encoding: "utf8"},function (err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
@@ -164,7 +164,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
|
||||
} else {
|
||||
// Save the tiddler as a self contained templated file
|
||||
template = $tw.config.typeTemplates[fileInfo.type];
|
||||
content = $tw.wiki.renderTiddler("text/plain",template,{variables: {currentTiddler: tiddler.fields.title}});
|
||||
content = self.wiki.renderTiddler("text/plain",template,{variables: {currentTiddler: tiddler.fields.title}});
|
||||
fs.writeFile(fileInfo.filepath,content,{encoding: "utf8"},function (err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
@@ -188,7 +188,7 @@ FileSystemAdaptor.prototype.loadTiddler = function(title,callback) {
|
||||
/*
|
||||
Delete a tiddler and invoke the callback with (err)
|
||||
*/
|
||||
FileSystemAdaptor.prototype.deleteTiddler = function(title,callback) {
|
||||
FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
||||
var self = this,
|
||||
fileInfo = $tw.boot.files[title];
|
||||
// Only delete the tiddler if we have writable information for the file
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/fullscreen/init.js
|
||||
type: application/javascript
|
||||
module-type: startup
|
||||
|
||||
Message handler for full screen mode
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false, Element: false */
|
||||
"use strict";
|
||||
|
||||
// Export name and synchronous status
|
||||
exports.name = "full-screen";
|
||||
exports.platforms = ["browser"];
|
||||
exports.after = ["startup"];
|
||||
exports.synchronous = true;
|
||||
|
||||
exports.startup = function() {
|
||||
var d = document,
|
||||
db = d.body,
|
||||
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
|
||||
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
||||
db.msRequestFullscreen !== undefined ? "msRequestFullscreen" :
|
||||
db.requestFullscreen !== undefined ? "requestFullscreen" : "",
|
||||
_exitFullscreen = d.webkitExitFullscreen !== undefined ? "webkitExitFullscreen" :
|
||||
d.mozCancelFullScreen !== undefined ? "mozCancelFullScreen" :
|
||||
d.msExitFullscreen !== undefined ? "msExitFullscreen" :
|
||||
d.exitFullscreen !== undefined ? "exitFullscreen" : "",
|
||||
_fullscreenElement = d.webkitFullscreenElement !== undefined ? "webkitFullscreenElement" :
|
||||
d.mozFullScreenElement !== undefined ? "mozFullScreenElement" :
|
||||
d.msFullscreenElement !== undefined ? "msFullscreenElement" :
|
||||
d.fullscreenElement !== undefined ? "fullscreenElement" : "";
|
||||
// Install the full screen handler
|
||||
if(_requestFullscreen) {
|
||||
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
||||
if(document[_fullscreenElement]) {
|
||||
document[_exitFullscreen]();
|
||||
} else {
|
||||
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/fullscreen",
|
||||
"description": "Adds support for HTML5 full screen mode",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0"
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/github-fork-ribbon",
|
||||
"description": "GitHub-style ribbon in pure CSS",
|
||||
"author": "Simon Whitaker, adapted for TiddlyWiki by JeremyRuston"
|
||||
"author": "Simon Whitaker, adapted for TiddlyWiki by JeremyRuston",
|
||||
"list": "readme"
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ This stylesheet is adapted from work by Simon Whitaker:
|
||||
https://github.com/simonwhitaker/github-fork-ribbon-css/
|
||||
|
||||
|
||||
```
|
||||
<!-- TOP RIGHT RIBBON: START COPYING HERE -->
|
||||
<div class="github-fork-ribbon-wrapper right"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on ~GitHub</a></div>
|
||||
</div>
|
||||
@@ -25,3 +26,4 @@ https://github.com/simonwhitaker/github-fork-ribbon-css/
|
||||
<div class="github-fork-ribbon-wrapper left-bottom"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on ~GitHub</a></div>
|
||||
</div>
|
||||
<!-- BOTTOM LEFT RIBBON: END COPYING HERE -->
|
||||
```
|
||||
|
@@ -2,5 +2,6 @@
|
||||
"title": "$:/plugins/tiddlywiki/googleanalytics",
|
||||
"description": "Google Analytics plugin for TiddlyWiki5",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0"
|
||||
"core-version": ">=5.0.0",
|
||||
"list": "readme"
|
||||
}
|
||||
|
15
plugins/tiddlywiki/googleanalytics/readme.tid
Normal file
15
plugins/tiddlywiki/googleanalytics/readme.tid
Normal file
@@ -0,0 +1,15 @@
|
||||
title: $:/plugins/tiddlywiki/googleanalytics/readme
|
||||
|
||||
This plugin enables you to use Google Analytics to track access to your online TiddlyWiki document. These instructions assume you are using TiddlySpot to publish your wiki.
|
||||
|
||||
# Go to the Google Analytics website: http://www.google.com/analytics/
|
||||
# Click the ''Access Google Analytics'' button and follow instructions to set up your account
|
||||
# Enter the name of your TiddlySpot domain, for example "mysite.tiddlyspot.com"
|
||||
# You will be given your own Tracking ID for this domain
|
||||
# Go to http://tiddlywiki.com -- open the More/System tab and drag the links to these three tiddlers across to a local copy of your site:
|
||||
#* $:/GoogleAnalyticsDomain
|
||||
#* $:/GoogleAnalyticsAccount
|
||||
#* $:/plugins/tiddlywiki/googleanalytics
|
||||
# Edit the first two of these tiddlers to reflect your Domain and Tracking ID
|
||||
# Upload the new version to TiddlySpot or other web host
|
||||
# Return to your Google Analytics page to check that your site is being tracked
|
@@ -1,153 +1 @@
|
||||
/*
|
||||
|
||||
Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
|
||||
|
||||
*/
|
||||
|
||||
.hljs {
|
||||
display: block; padding: 0.5em;
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.hljs,
|
||||
.hljs-subst,
|
||||
.hljs-tag .hljs-title,
|
||||
.lisp .hljs-title,
|
||||
.clojure .hljs-built_in,
|
||||
.nginx .hljs-title {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-title,
|
||||
.hljs-constant,
|
||||
.hljs-parent,
|
||||
.hljs-tag .hljs-value,
|
||||
.hljs-rules .hljs-value,
|
||||
.hljs-rules .hljs-value .hljs-number,
|
||||
.hljs-preprocessor,
|
||||
.hljs-pragma,
|
||||
.haml .hljs-symbol,
|
||||
.ruby .hljs-symbol,
|
||||
.ruby .hljs-symbol .hljs-string,
|
||||
.hljs-aggregate,
|
||||
.hljs-template_tag,
|
||||
.django .hljs-variable,
|
||||
.smalltalk .hljs-class,
|
||||
.hljs-addition,
|
||||
.hljs-flow,
|
||||
.hljs-stream,
|
||||
.bash .hljs-variable,
|
||||
.apache .hljs-tag,
|
||||
.apache .hljs-cbracket,
|
||||
.tex .hljs-command,
|
||||
.tex .hljs-special,
|
||||
.erlang_repl .hljs-function_or_atom,
|
||||
.asciidoc .hljs-header,
|
||||
.markdown .hljs-header,
|
||||
.coffeescript .hljs-attribute {
|
||||
color: #800;
|
||||
}
|
||||
|
||||
.smartquote,
|
||||
.hljs-comment,
|
||||
.hljs-annotation,
|
||||
.hljs-template_comment,
|
||||
.diff .hljs-header,
|
||||
.hljs-chunk,
|
||||
.asciidoc .hljs-blockquote,
|
||||
.markdown .hljs-blockquote {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.hljs-number,
|
||||
.hljs-date,
|
||||
.hljs-regexp,
|
||||
.hljs-literal,
|
||||
.hljs-hexcolor,
|
||||
.smalltalk .hljs-symbol,
|
||||
.smalltalk .hljs-char,
|
||||
.go .hljs-constant,
|
||||
.hljs-change,
|
||||
.lasso .hljs-variable,
|
||||
.makefile .hljs-variable,
|
||||
.asciidoc .hljs-bullet,
|
||||
.markdown .hljs-bullet,
|
||||
.asciidoc .hljs-link_url,
|
||||
.markdown .hljs-link_url {
|
||||
color: #080;
|
||||
}
|
||||
|
||||
.hljs-label,
|
||||
.hljs-javadoc,
|
||||
.ruby .hljs-string,
|
||||
.hljs-decorator,
|
||||
.hljs-filter .hljs-argument,
|
||||
.hljs-localvars,
|
||||
.hljs-array,
|
||||
.hljs-attr_selector,
|
||||
.hljs-important,
|
||||
.hljs-pseudo,
|
||||
.hljs-pi,
|
||||
.haml .hljs-bullet,
|
||||
.hljs-doctype,
|
||||
.hljs-deletion,
|
||||
.hljs-envvar,
|
||||
.hljs-shebang,
|
||||
.apache .hljs-sqbracket,
|
||||
.nginx .hljs-built_in,
|
||||
.tex .hljs-formula,
|
||||
.erlang_repl .hljs-reserved,
|
||||
.hljs-prompt,
|
||||
.asciidoc .hljs-link_label,
|
||||
.markdown .hljs-link_label,
|
||||
.vhdl .hljs-attribute,
|
||||
.clojure .hljs-attribute,
|
||||
.asciidoc .hljs-attribute,
|
||||
.lasso .hljs-attribute,
|
||||
.coffeescript .hljs-property,
|
||||
.hljs-phony {
|
||||
color: #88F
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-id,
|
||||
.hljs-title,
|
||||
.hljs-built_in,
|
||||
.hljs-aggregate,
|
||||
.css .hljs-tag,
|
||||
.hljs-javadoctag,
|
||||
.hljs-phpdoc,
|
||||
.hljs-yardoctag,
|
||||
.smalltalk .hljs-class,
|
||||
.hljs-winutils,
|
||||
.bash .hljs-variable,
|
||||
.apache .hljs-tag,
|
||||
.go .hljs-typename,
|
||||
.tex .hljs-command,
|
||||
.asciidoc .hljs-strong,
|
||||
.markdown .hljs-strong,
|
||||
.hljs-request,
|
||||
.hljs-status {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.asciidoc .hljs-emphasis,
|
||||
.markdown .hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.nginx .hljs-built_in {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.coffeescript .javascript,
|
||||
.javascript .xml,
|
||||
.lasso .markup,
|
||||
.tex .hljs-formula,
|
||||
.xml .javascript,
|
||||
.xml .vbscript,
|
||||
.xml .css,
|
||||
.xml .hljs-cdata {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.hljs{display:block;padding:.5em;background:#f0f0f0}.hljs,.hljs-subst,.hljs-tag .hljs-title,.lisp .hljs-title,.clojure .hljs-built_in,.nginx .hljs-title{color:black}.hljs-string,.hljs-title,.hljs-constant,.hljs-parent,.hljs-tag .hljs-value,.hljs-rules .hljs-value,.hljs-rules .hljs-value .hljs-number,.hljs-preprocessor,.hljs-pragma,.haml .hljs-symbol,.ruby .hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-aggregate,.hljs-template_tag,.django .hljs-variable,.smalltalk .hljs-class,.hljs-addition,.hljs-flow,.hljs-stream,.bash .hljs-variable,.apache .hljs-tag,.apache .hljs-cbracket,.tex .hljs-command,.tex .hljs-special,.erlang_repl .hljs-function_or_atom,.asciidoc .hljs-header,.markdown .hljs-header,.coffeescript .hljs-attribute{color:#800}.smartquote,.hljs-comment,.hljs-annotation,.hljs-template_comment,.diff .hljs-header,.hljs-chunk,.asciidoc .hljs-blockquote,.markdown .hljs-blockquote{color:#888}.hljs-number,.hljs-date,.hljs-regexp,.hljs-literal,.hljs-hexcolor,.smalltalk .hljs-symbol,.smalltalk .hljs-char,.go .hljs-constant,.hljs-change,.lasso .hljs-variable,.makefile .hljs-variable,.asciidoc .hljs-bullet,.markdown .hljs-bullet,.asciidoc .hljs-link_url,.markdown .hljs-link_url{color:#080}.hljs-label,.hljs-javadoc,.ruby .hljs-string,.hljs-decorator,.hljs-filter .hljs-argument,.hljs-localvars,.hljs-array,.hljs-attr_selector,.hljs-important,.hljs-pseudo,.hljs-pi,.haml .hljs-bullet,.hljs-doctype,.hljs-deletion,.hljs-envvar,.hljs-shebang,.apache .hljs-sqbracket,.nginx .hljs-built_in,.tex .hljs-formula,.erlang_repl .hljs-reserved,.hljs-prompt,.asciidoc .hljs-link_label,.markdown .hljs-link_label,.vhdl .hljs-attribute,.clojure .hljs-attribute,.asciidoc .hljs-attribute,.lasso .hljs-attribute,.coffeescript .hljs-property,.hljs-phony{color:#88F}.hljs-keyword,.hljs-id,.hljs-title,.hljs-built_in,.hljs-aggregate,.css .hljs-tag,.hljs-javadoctag,.hljs-phpdoc,.hljs-yardoctag,.smalltalk .hljs-class,.hljs-winutils,.bash .hljs-variable,.apache .hljs-tag,.go .hljs-typename,.tex .hljs-command,.asciidoc .hljs-strong,.markdown .hljs-strong,.hljs-request,.hljs-status{font-weight:bold}.asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic}.nginx .hljs-built_in{font-weight:normal}.coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}
|
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/highlight",
|
||||
"description": "Highlight.js plugin for TiddlyWiki5",
|
||||
"author": "JoaoBolila"
|
||||
"author": "JoaoBolila",
|
||||
"list": "license"
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ function transformNode(node) {
|
||||
widget.children = transformNodes(node.slice(p++));
|
||||
// Massage images into the image widget
|
||||
if(widget.tag === "img") {
|
||||
widget.tag = "$image";
|
||||
widget.type = "image";
|
||||
if(widget.attributes.alt) {
|
||||
widget.attributes.tooltip = widget.attributes.alt;
|
||||
delete widget.attributes.alt;
|
||||
|
3
plugins/tiddlywiki/tiddlyweb/SaveWikiButtonTemplate.tid
Normal file
3
plugins/tiddlywiki/tiddlyweb/SaveWikiButtonTemplate.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/SaveWikiButton/Template
|
||||
|
||||
$:/plugins/tiddlywiki/tiddlyweb/save/offline
|
@@ -18,9 +18,3 @@ Host configuration: <$edit-text tiddler="$:/config/tiddlyweb/host" tag="input" d
|
||||
----
|
||||
|
||||
<$button message="tw-server-refresh" class="btn btn-warning">Refresh</$button> to fetch changes from the server immediately
|
||||
|
||||
----
|
||||
|
||||
Download an offline copy of this wiki:
|
||||
|
||||
{{$:/editions/server/download-offline-button}}
|
@@ -1,3 +0,0 @@
|
||||
title: $:/editions/server/download-offline-button
|
||||
|
||||
<$button message="tw-download-file" param="$:/editions/server/download-offline" class="btn-big-green">Download Offline Snapshot {{$:/core/images/save-button}}</$button>
|
@@ -1,6 +0,0 @@
|
||||
title: $:/editions/server/download-offline
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
6
plugins/tiddlywiki/tiddlyweb/save-offline.tid
Normal file
6
plugins/tiddlywiki/tiddlyweb/save-offline.tid
Normal file
@@ -0,0 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/tiddlyweb/save/offline
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[[$:/boot/boot.css]] -[[$:/HistoryList]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
@@ -3,7 +3,7 @@ title: $:/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js
|
||||
type: application/javascript
|
||||
module-type: syncadaptor
|
||||
|
||||
A sync adaptor module for synchronising with TiddlyWeb compatible servers
|
||||
A sync adaptor module for synchronising with TiddlyWeb compatible servers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@@ -15,15 +15,15 @@ A sync adaptor module for synchronising with TiddlyWeb compatible servers
|
||||
var CONFIG_HOST_TIDDLER = "$:/config/tiddlyweb/host",
|
||||
DEFAULT_HOST_TIDDLER = "$protocol$//$host$/";
|
||||
|
||||
function TiddlyWebAdaptor(syncer) {
|
||||
this.syncer = syncer;
|
||||
function TiddlyWebAdaptor(options) {
|
||||
this.wiki = options.wiki;
|
||||
this.host = this.getHost();
|
||||
this.recipe = undefined;
|
||||
this.logger = new $tw.utils.Logger("TiddlyWebAdaptor");
|
||||
}
|
||||
|
||||
TiddlyWebAdaptor.prototype.getHost = function() {
|
||||
var text = this.syncer.wiki.getTiddlerText(CONFIG_HOST_TIDDLER,DEFAULT_HOST_TIDDLER),
|
||||
var text = this.wiki.getTiddlerText(CONFIG_HOST_TIDDLER,DEFAULT_HOST_TIDDLER),
|
||||
substitutions = [
|
||||
{name: "protocol", value: document.location.protocol},
|
||||
{name: "host", value: document.location.host}
|
||||
@@ -46,8 +46,7 @@ Get the current status of the TiddlyWeb connection
|
||||
*/
|
||||
TiddlyWebAdaptor.prototype.getStatus = function(callback) {
|
||||
// Get status
|
||||
var self = this,
|
||||
wiki = self.syncer.wiki;
|
||||
var self = this;
|
||||
this.logger.log("Getting status");
|
||||
$tw.utils.httpRequest({
|
||||
url: this.host + "status",
|
||||
@@ -174,7 +173,7 @@ TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback) {
|
||||
// Invoke the callback
|
||||
callback(null,{
|
||||
bag: etagInfo.bag
|
||||
}, etagInfo.revision);
|
||||
}, etagInfo.revision);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -198,10 +197,12 @@ TiddlyWebAdaptor.prototype.loadTiddler = function(title,callback) {
|
||||
|
||||
/*
|
||||
Delete a tiddler and invoke the callback with (err)
|
||||
options include:
|
||||
tiddlerInfo: the syncer's tiddlerInfo for this tiddler
|
||||
*/
|
||||
TiddlyWebAdaptor.prototype.deleteTiddler = function(title,callback) {
|
||||
TiddlyWebAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
||||
var self = this,
|
||||
bag = this.syncer.tiddlerInfo[title].adaptorInfo.bag;
|
||||
bag = options.tiddlerInfo.adaptorInfo.bag;
|
||||
// If we don't have a bag it means that the tiddler hasn't been seen by the server, so we don't need to delete it
|
||||
if(!bag) {
|
||||
return callback(null);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/bj/tw2parser",
|
||||
"description": "legacy parser",
|
||||
"title": "$:/plugins/tiddlywiki/tw2parser",
|
||||
"description": "TiddlyWiki Classic-compatible wikitext parser",
|
||||
"authors": "JeremyRuston, JeffreyWilkinson"
|
||||
"core-version": ">=5.0.0"
|
||||
}
|
||||
|
1
plugins/tiddlywiki/upgrade/DefaultTiddlers.tid
Normal file
1
plugins/tiddlywiki/upgrade/DefaultTiddlers.tid
Normal file
@@ -0,0 +1 @@
|
||||
title: $:/DefaultTiddlers
|
3
plugins/tiddlywiki/upgrade/SiteSubtitle.tid
Normal file
3
plugins/tiddlywiki/upgrade/SiteSubtitle.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/SiteSubtitle
|
||||
|
||||
upgrade your files to the latest version
|
3
plugins/tiddlywiki/upgrade/SiteTitle.tid
Normal file
3
plugins/tiddlywiki/upgrade/SiteTitle.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/SiteTitle
|
||||
|
||||
~TiddlyWiki Upgrader
|
3
plugins/tiddlywiki/upgrade/UpdateAddressBar.tid
Normal file
3
plugins/tiddlywiki/upgrade/UpdateAddressBar.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/Navigation/UpdateAddressBar
|
||||
|
||||
no
|
54
plugins/tiddlywiki/upgrade/UpgradeWizard.tid
Normal file
54
plugins/tiddlywiki/upgrade/UpgradeWizard.tid
Normal file
@@ -0,0 +1,54 @@
|
||||
title: $:/UpgradeWizard
|
||||
tags: $:/tags/AboveStory
|
||||
|
||||
<div class="tw-upgrade-wizard-wrapper">
|
||||
|
||||
<div class="tw-upgrade-wizard">
|
||||
|
||||
! ~TiddlyWiki Upgrade Wizard
|
||||
|
||||
<$list filter="[[$:/Import]is[missing]]">
|
||||
|
||||
{{$:/core/images/download-button}}
|
||||
|
||||
Drag a ~TiddlyWiki file here to upgrade it
|
||||
|
||||
or click to pick a file <$browse/>
|
||||
|
||||
</$list>
|
||||
|
||||
<$reveal state="$:/Import!!status" type="match" text="pending">
|
||||
|
||||
The following tiddlers will be included in the upgrade <$button message="tw-perform-import" param="$:/Import">Upgrade</$button>
|
||||
|
||||
{{$:/Import||$:/core/ui/ImportListing}}
|
||||
|
||||
</$reveal>
|
||||
|
||||
<$reveal state="$:/Import!!status" type="match" text="complete">
|
||||
|
||||
Upgrade completed. Click the button below to save your upgraded ~TiddlyWiki file
|
||||
|
||||
Make sure that you keep a safe copy of your previous ~TiddlyWiki file.
|
||||
|
||||
<$reveal type="match" state="$:/isEncrypted" text="yes">
|
||||
|
||||
''The file will be encrypted with your existing password.''
|
||||
|
||||
</$reveal>
|
||||
|
||||
{{$:/plugins/tiddlywiki/upgrade/save}}
|
||||
|
||||
Close this browser window to prevent others from being able to access your data.
|
||||
|
||||
For help and support, visit [[the TiddlyWiki discussion forum|http://groups.google.com/group/TiddlyWiki]].
|
||||
|
||||
</$reveal>
|
||||
|
||||
</div>
|
||||
|
||||
version <<version>>
|
||||
|
||||
//Your data will not leave your browser. <a href="http://tiddlywiki.com/upgrade.html" download="upgrade.html">Download</a> this upgrader to use it offline//
|
||||
|
||||
</div>
|
25
plugins/tiddlywiki/upgrade/config.js
Normal file
25
plugins/tiddlywiki/upgrade/config.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/upgrade/config.js
|
||||
type: application/javascript
|
||||
module-type: startup
|
||||
|
||||
Startup module for configuring the upgrade plugin
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
// Export name and synchronous status
|
||||
exports.name = "upgrade-config";
|
||||
exports.before = ["startup"];
|
||||
exports.synchronous = true;
|
||||
|
||||
exports.startup = function() {
|
||||
// See $tw.utils.decryptStoreAreaInteractive() in $:/core/modules/utils/crypto.js
|
||||
$tw.config.usePasswordVault = true;
|
||||
};
|
||||
|
||||
})();
|
BIN
plugins/tiddlywiki/upgrade/favicon.ico
Normal file
BIN
plugins/tiddlywiki/upgrade/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
2
plugins/tiddlywiki/upgrade/favicon.ico.meta
Normal file
2
plugins/tiddlywiki/upgrade/favicon.ico.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
6
plugins/tiddlywiki/upgrade/plugin.info
Normal file
6
plugins/tiddlywiki/upgrade/plugin.info
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/upgrade",
|
||||
"description": "User interface for upgrading TiddlyWiki documents",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0"
|
||||
}
|
6
plugins/tiddlywiki/upgrade/save-tiddler-filter.tid
Normal file
6
plugins/tiddlywiki/upgrade/save-tiddler-filter.tid
Normal file
@@ -0,0 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/upgrade/save-tiddler-filter
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[[$:/UpgradeLibrary]] -[[$:/plugins/tiddlywiki/upgrade]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
3
plugins/tiddlywiki/upgrade/save.tid
Normal file
3
plugins/tiddlywiki/upgrade/save.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/plugins/tiddlywiki/upgrade/save
|
||||
|
||||
<$button message="tw-download-file" param="$:/plugins/tiddlywiki/upgrade/save-tiddler-filter" class="btn-big-green">Save upgraded ~TiddlyWiki file {{$:/core/images/save-button}}</$button>
|
6
plugins/tiddlywiki/upgrade/set-auto-open-on-import.tid
Normal file
6
plugins/tiddlywiki/upgrade/set-auto-open-on-import.tid
Normal file
@@ -0,0 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/upgrade/set-auto-open-on-import
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define tw-auto-open-on-import()
|
||||
no
|
||||
\end
|
3
plugins/tiddlywiki/upgrade/sidebar.tid
Normal file
3
plugins/tiddlywiki/upgrade/sidebar.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/state/sidebar
|
||||
|
||||
no
|
60
plugins/tiddlywiki/upgrade/styles.tid
Normal file
60
plugins/tiddlywiki/upgrade/styles.tid
Normal file
@@ -0,0 +1,60 @@
|
||||
title: $:/plugins/tiddlywiki/upgrade/styles
|
||||
tags: $:/tags/stylesheet
|
||||
|
||||
.tw-upgrade-wizard-wrapper {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard {
|
||||
background: <<colour tiddler-background>>;
|
||||
padding: 2em;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
border: 1px solid #ddd;
|
||||
<<box-shadow "inset 1px 2px 4px rgba(0, 0, 0, 0.15)">>;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard svg.tw-image-download-button {
|
||||
width: 14em;
|
||||
height: 14em;
|
||||
fill: <<colour muted-foreground>>;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard:hover svg.tw-image-download-button {
|
||||
fill: <<colour foreground>>;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard svg .tw-image-download-button-ring {
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard:hover svg .tw-image-download-button-ring {
|
||||
fill: <<colour primary>>;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard em {
|
||||
color: <<colour tiddler-subtitle-foreground>>;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard table {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tw-upgrade-wizard input[type=file] {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
font-size: 999px;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
outline: none;
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
}
|
Reference in New Issue
Block a user