Archive for the ‘tiddlywiki’ tag
A Simple TiddlyWiki Macro
Another item from the Great Bucket of Random Things:
The below Javascript will add a simple macro to TiddlyWiki to that substitutes <<define yourwordhere>> for a link to google searching for that term. Put the phrase in quotes if you want to include spaces (e.g. <<define “your phrase here”>>). Custom links like this are trivial, but can be a very useful shorthand.
Just search for “// Macro definitions” in the TiddlyWiki HTML to find where to inline your macro.
// --------------------------------------------------------------------------------- // Macro definitions // --------------------------------------------------------------------------------- config.macros.define = {}; config.macros.define.handler = function(place,macroName,params) { var link = createTiddlyElement(place, "a",null,null,params[0]); link.setAttribute("href", "http://www.google.com/search?q=define+" + params[0]); link.setAttribute("target", "_blank") }
Note that TiddlyWiki is one of the six things on the Internet not using JQuery, so you do have to use the HTML DOM API directly to set up your inserted element.
