2012-01-23 18:31:17 +00:00
|
|
|
/*\
|
|
|
|
title: js/macros/slider.js
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true */
|
|
|
|
"use strict";
|
|
|
|
|
2012-02-06 11:31:23 +00:00
|
|
|
var HTML = require("../HTML.js").HTML,
|
|
|
|
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: {
|
|
|
|
click: function(event,node,tiddler,store,params) {
|
|
|
|
var el = node.firstChild.firstChild.nextSibling;
|
|
|
|
el.style.display = el.style.display === "block" ? "none" : "block";
|
|
|
|
event.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
2012-01-30 20:04:47 +00:00
|
|
|
render: function(type,tiddler,store,params) {
|
2012-01-23 18:31:17 +00:00
|
|
|
if(type === "text/html") {
|
2012-02-06 11:31:23 +00:00
|
|
|
return HTML(HTML.slider(params.name,
|
2012-01-25 15:35:52 +00:00
|
|
|
params.label,
|
|
|
|
params.tooltip,
|
2012-02-06 11:31:23 +00:00
|
|
|
HTML.raw(store.renderTiddler(type,params.targetTiddler))),type);
|
2012-01-23 18:31:17 +00:00
|
|
|
} else if(type === "text/plain") {
|
|
|
|
return store.renderTiddler(type,params.target);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|
|
|
|
|