diff --git a/js/App.js b/js/App.js index ee3fbe73c..6b6ed1f07 100644 --- a/js/App.js +++ b/js/App.js @@ -96,6 +96,7 @@ var App = function() { this.store.installMacro(require("./macros/story.js").macro); this.store.installMacro(require("./macros/tiddler.js").macro); this.store.installMacro(require("./macros/version.js").macro); + this.store.installMacro(require("./macros/video.js").macro); this.store.installMacro(require("./macros/view.js").macro); // Set up navigation if we're in the browser if(this.isBrowser) { diff --git a/js/macros/video.js b/js/macros/video.js new file mode 100644 index 000000000..2a272d2dc --- /dev/null +++ b/js/macros/video.js @@ -0,0 +1,40 @@ +/*\ +title: js/macros/video.js + +\*/ +(function(){ + +/*jslint node: true */ +"use strict"; + +var utils = require("../Utils.js"); + +exports.macro = { + name: "video", + types: ["text/html","text/plain"], + params: { + src: {byName: "default", type: "text", optional: false}, + type: {byName: true, type: "text", optional: true}, + width: {byName: true, type: "text", optional: true}, + height: {byName: true, type: "text", optional: true} + }, + render: function(type,tiddler,store,params) { + var videoType = params.type || "vimeo", + videoWidth = params.width || 640, + videoHeight = params.height || 360; + if(type === "text/html") { + switch(videoType) { + case "vimeo": + return ""; + case "youtube": + return ""; + case "archiveorg": + return ""; + } + } else if (type === "text/plain") { + return ""; // Not really sure how to render a video into plain text... + } + } +}; + +})();