mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-09 11:29:58 +00:00
63 lines
1000 B
JavaScript
63 lines
1000 B
JavaScript
|
/*\
|
||
|
title: $:/plugins/dropbox/newwikimacro.js
|
||
|
type: application/javascript
|
||
|
module-type: macro
|
||
|
|
||
|
Dropbox new wiki plugin
|
||
|
|
||
|
\*/
|
||
|
(function(){
|
||
|
|
||
|
/*jslint node: true, browser: true */
|
||
|
/*global $tw: false */
|
||
|
"use strict";
|
||
|
|
||
|
exports.info = {
|
||
|
name: "dropbox.newwiki",
|
||
|
params: {}
|
||
|
};
|
||
|
|
||
|
exports.handleEvent = function (event) {
|
||
|
if(event.type === "click") {
|
||
|
var wikiName = this.child.children[0].domNode.value;
|
||
|
$tw.plugins.dropbox.createWiki(wikiName);
|
||
|
}
|
||
|
event.preventDefault();
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
exports.executeMacro = function() {
|
||
|
// Create the link
|
||
|
var child = $tw.Tree.Element(
|
||
|
"form",
|
||
|
{
|
||
|
"class": "form-inline"
|
||
|
},
|
||
|
[
|
||
|
$tw.Tree.Element(
|
||
|
"input",
|
||
|
{
|
||
|
type: "text"
|
||
|
},
|
||
|
null
|
||
|
),
|
||
|
$tw.Tree.Element(
|
||
|
"button",
|
||
|
{
|
||
|
type: "submit",
|
||
|
"class": "btn"
|
||
|
},
|
||
|
[
|
||
|
$tw.Tree.Text("New")
|
||
|
],
|
||
|
{
|
||
|
events: ["click"],
|
||
|
eventHandler: this
|
||
|
})
|
||
|
]);
|
||
|
child.execute(this.parents,this.tiddlerTitle);
|
||
|
return child;
|
||
|
};
|
||
|
|
||
|
})();
|