2012-01-23 18:31:17 +00:00
|
|
|
/*\
|
|
|
|
title: js/macros/slider.js
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true */
|
|
|
|
"use strict";
|
|
|
|
|
2012-02-16 20:38:10 +00:00
|
|
|
var Renderer = require("../Renderer.js").Renderer,
|
2012-02-06 11:31:23 +00:00
|
|
|
utils = require("../Utils.js");
|
2012-01-23 18:31:17 +00:00
|
|
|
|
|
|
|
exports.macro = {
|
|
|
|
name: "slider",
|
|
|
|
types: ["text/html","text/plain"],
|
|
|
|
params: {
|
|
|
|
name: {byPos: 0, type: "text", optional: false},
|
|
|
|
targetTiddler: {byPos: 1, type: "tiddler", optional: false},
|
|
|
|
label: {byPos: 2, type: "text", optional: false},
|
|
|
|
tooltip: {byPos: 3, type: "text", optional: true}
|
|
|
|
},
|
2012-02-02 17:48:09 +00:00
|
|
|
events: {
|
2012-02-16 20:38:10 +00:00
|
|
|
click: function(event,macroNode) {
|
|
|
|
var el = event.currentTarget.firstChild.firstChild.nextSibling;
|
2012-02-02 17:48:09 +00:00
|
|
|
el.style.display = el.style.display === "block" ? "none" : "block";
|
|
|
|
event.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
2012-02-16 20:38:10 +00:00
|
|
|
execute: function(macroNode,tiddler,store) {
|
|
|
|
var target = macroNode.params.targetTiddler,
|
|
|
|
dependencies = {include: {}};
|
|
|
|
dependencies.include[target] = 1;
|
|
|
|
var content = Renderer.SliderNode(macroNode.params.name,
|
|
|
|
macroNode.params.label,
|
|
|
|
macroNode.params.tooltip,
|
|
|
|
[
|
|
|
|
Renderer.MacroNode("tiddler",{target: target},null,dependencies,store)
|
|
|
|
]);
|
|
|
|
content.execute(tiddler);
|
|
|
|
return [content];
|
2012-01-23 18:31:17 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|
|
|
|
|