mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-04 13:19:11 +00:00
Started to move dropbox bits and pieces into a plugin
Currently tw5dropbox is broken, pending some further changes around module handling
This commit is contained in:
parent
11b2af34d2
commit
ce47f5e1d4
23
core/boot.js
23
core/boot.js
@ -77,6 +77,9 @@ $tw.crypto.sjcl = $tw.browser ? window.sjcl : require("./sjcl.js");
|
||||
// Boot information
|
||||
$tw.boot = {};
|
||||
|
||||
// Plugin state
|
||||
$tw.plugins = {};
|
||||
|
||||
// Modules store registers all the modules the system has seen
|
||||
$tw.modules = $tw.modules || {};
|
||||
$tw.modules.titles = $tw.modules.titles || {}; // hashmap by module title of {fn:, exports:, moduleType:}
|
||||
@ -296,7 +299,7 @@ if(!$tw.browser) {
|
||||
Register the exports of a single module in the $tw.modules.types hashmap
|
||||
*/
|
||||
$tw.modules.registerModuleExports = function(name,moduleType,moduleExports) {
|
||||
if(!(moduleType in $tw.modules.types)) {
|
||||
if(!$tw.utils.hop($tw.modules.types,moduleType)) {
|
||||
$tw.modules.types[moduleType] = [];
|
||||
}
|
||||
$tw.modules.types[moduleType].push(moduleExports);
|
||||
@ -487,19 +490,11 @@ $tw.Wiki.prototype.registerModuleTiddlers = function() {
|
||||
}
|
||||
}
|
||||
// Register and execute any modules in ordinary tiddlers
|
||||
if($tw.browser) {
|
||||
for(title in $tw.modules.titles) {
|
||||
if($tw.utils.hop($tw.modules.titles,title)) {
|
||||
$tw.modules.registerModuleExports(title,$tw.modules.titles[title].moduleType,$tw.modules.execute(title));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(title in $tw.wiki.tiddlers) {
|
||||
if($tw.utils.hop($tw.wiki.tiddlers,title)) {
|
||||
tiddler = $tw.wiki.getTiddler(title);
|
||||
if(tiddler.fields.type === "application/javascript" && tiddler.hasField("module-type")) {
|
||||
$tw.modules.registerModuleExports(title,tiddler.fields["module-type"],$tw.modules.execute(title));
|
||||
}
|
||||
for(title in $tw.wiki.tiddlers) {
|
||||
if($tw.utils.hop($tw.wiki.tiddlers,title)) {
|
||||
tiddler = $tw.wiki.getTiddler(title);
|
||||
if(tiddler.fields.type === "application/javascript" && tiddler.hasField("module-type")) {
|
||||
$tw.modules.registerModuleExports(title,tiddler.fields["module-type"],$tw.modules.execute(title));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
title: TemporaryTestPlugin
|
||||
type: application/json
|
||||
bundle: yes
|
||||
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/test",
|
||||
"description": "An exemplary plugin for demonstration purposes",
|
||||
"author": "JeremyRuston",
|
||||
"version": "0.0.0-alpha0",
|
||||
"coreVersion": ">=5.0.0",
|
||||
"tiddlers": {
|
||||
"Test1": {"text": "Some text"},
|
||||
"Test2": {"text": "Some more text"},
|
||||
"Test3": {"text": "console.log(require('$:/plugins/tiddlywiki/test/Test4').string);", "type": "application/javascript", "module-type": "custom"},
|
||||
"Test4": {"text": "exports.string = 'Plugin I am in You!';", "type": "application/javascript", "module-type": "custom"}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/dropbox/dropbox-app.js
|
||||
title: $:/plugins/tiddlywiki/dropbox-app/dropbox-app.js
|
||||
type: application/javascript
|
||||
module-type: dropbox-startup
|
||||
|
7
plugins/tiddlywiki/dropbox-app/plugin.bundle
Normal file
7
plugins/tiddlywiki/dropbox-app/plugin.bundle
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/dropbox-app",
|
||||
"description": "Dropbox app components",
|
||||
"author": "JeremyRuston",
|
||||
"version": "0.0.0",
|
||||
"coreVersion": ">=5.0.0"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/dropbox/dropbox-main.js
|
||||
title: $:/plugins/tiddlywiki/dropbox-main/dropbox-main.js
|
||||
type: application/javascript
|
||||
module-type: dropbox-startup
|
||||
|
7
plugins/tiddlywiki/dropbox-main/plugin.bundle
Normal file
7
plugins/tiddlywiki/dropbox-main/plugin.bundle
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/dropbox-main",
|
||||
"description": "Dropbox main components",
|
||||
"author": "JeremyRuston",
|
||||
"version": "0.0.0",
|
||||
"coreVersion": ">=5.0.0"
|
||||
}
|
3
plugins/tiddlywiki/dropbox/async.js.meta
Normal file
3
plugins/tiddlywiki/dropbox/async.js.meta
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/plugins/tiddlywiki/dropbox/async.js
|
||||
type: application/javascript
|
||||
module-type: library
|
@ -1,7 +1,7 @@
|
||||
/*\
|
||||
title: $:/plugins/dropbox/dropbox.js
|
||||
title: $:/plugins/tiddlywiki/dropbox/dropbox.js
|
||||
type: application/javascript
|
||||
module-type: startup
|
||||
module-type: browser-startup
|
||||
|
||||
Main Dropbox integration module. It creates the `$tw.plugins.dropbox` object that includes static methods for various Dropbox operations. It also contains a startup function that kicks off the login process
|
||||
|
||||
@ -18,6 +18,9 @@ var apiKey = "m+qwjj8wFRA=|1TSoitGS9Nz2RTwv+jrUJnsAj0yy57NhQJ4TkZ/+Hw==";
|
||||
// Query string marker for forcing authentication
|
||||
var queryLoginMarker = "login=true";
|
||||
|
||||
// Require async.js
|
||||
var async = require("./async.js");
|
||||
|
||||
$tw.plugins.dropbox = {
|
||||
// State data
|
||||
client: null, // Dropbox.js client object
|
@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/dropbox/logoutmacro.js
|
||||
title: $:/plugins/tiddlywiki/dropbox/loginmacro.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/dropbox/logoutmacro.js
|
||||
title: $:/plugins/tiddlywiki/dropbox/logoutmacro.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/dropbox/newwikimacro.js
|
||||
title: $:/plugins/tiddlywiki/dropbox/newwikimacro.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
7
plugins/tiddlywiki/dropbox/plugin.bundle
Normal file
7
plugins/tiddlywiki/dropbox/plugin.bundle
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/dropbox",
|
||||
"description": "Dropbox components",
|
||||
"author": "JeremyRuston",
|
||||
"version": "0.0.0",
|
||||
"coreVersion": ">=5.0.0"
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"file": "../../plugins/async.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/async.js",
|
||||
"type": "application/javascript",
|
||||
"library": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/dropbox.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/dropbox.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "startup"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/logoutmacro.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/logoutmacro.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "macro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/loginmacro.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/loginmacro.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "macro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/newwikimacro.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/newwikimacro.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "macro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "dropbox-app.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/dropbox-app.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "dropbox-startup"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
7
tw5dropbox/appwiki/tiddlywiki.info
Normal file
7
tw5dropbox/appwiki/tiddlywiki.info
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"tiddlywiki/fullscreen",
|
||||
"tiddlywiki/dropbox",
|
||||
"tiddlywiki/dropbox-app"
|
||||
]
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"file": "../../plugins/async.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/async.js",
|
||||
"type": "application/javascript",
|
||||
"library": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/dropbox.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/dropbox.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "startup"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/logoutmacro.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/logoutmacro.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "macro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/loginmacro.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/loginmacro.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "macro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "../../plugins/newwikimacro.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/newwikimacro.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "macro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "dropbox-main.js",
|
||||
"fields": {
|
||||
"title": "$:/plugins/dropbox/dropbox-main.js",
|
||||
"type": "application/javascript",
|
||||
"module-type": "dropbox-startup"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
7
tw5dropbox/mainwiki/tiddlywiki.info
Normal file
7
tw5dropbox/mainwiki/tiddlywiki.info
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"tiddlywiki/fullscreen",
|
||||
"tiddlywiki/dropbox",
|
||||
"tiddlywiki/dropbox-main"
|
||||
]
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
title: $:/plugins/dropbox/async.js
|
||||
type: application/javascript
|
||||
library: yes
|
Loading…
Reference in New Issue
Block a user