My FlickrGreetingMacro Plugin

4 views
Skip to first unread message

peter.k...@gmail.com

unread,
Mar 24, 2006, 10:02:15 AM3/24/06
to TiddlyWiki
Hi all,

Firstly, I'd like to say thanks to everyone concerned with the
development of TiddlyWiki - I just discovered it yesterday and I am
very impressed.

After setting up my TiddlyWiki (based on MonkeyPirateTiddlyWiki -
thanks Simon), I thought it would be cool if I made a macro which
greets you in the same way that Flickr does - hence I made
FlickrGreetingMacro.

I have only limited experience with JavaScript, so therefore this is
probably not the best way to do this, but it works for me, and I
thought I would post it here in case anyone else finds it useful/thinks
its a good idea!

To install, copy the code at the bottom of this post into a new
tiddler, name it FlickrGreetingMacro and tag it as systemConfig, then
reload.

Look at the examples section of the Macro to see how to use.

Hope someone finds this useful!

Thanks,

Peter

>>> Copy Below This Line <<<

/***
|Name|FlickrGreetingMacro|
|Created by|PeterKirkland|
|Version|1.0|
|Requires|~TW2.x|
!Description
It replicates the random greeting messages from
[[Flickr|http://www.flickr.com/]] in a TiddlyWiki macro.

!History
* 24-Mar-06, version 1.0, first version

!Examples
|!Source|!Output|h
|{{{<<flickrGreeting>>}}}|<<flickrGreeting>>|
|{{{<<flickrGreeting Peter>>}}}|<<flickrGreeting Peter>>|
|{{{<<flickrGreeting 'Peter Kirkland'>>}}}|<<flickrGreeting 'Peter
Kirkland'>>|
(You can use (single or double) quotes or double square brackets for
params with spaces)

!Notes
*I created this to re-create the international greetings that Flickr
uses.
*I use it in a tiddler linked to my DefaultTiddlers to get a pleasant
welcome message!
*To make the macro work you have to give this tiddler a tag of
systemConfig then save and reload.
*Thanks to Simon Baird for his HelloWorldMacro which taught me how to
use macros, and also for his
[[MonkeyPirateTiddlyWiki|http://simonbaird.com/mptw/]]!

!Code
***/
//{{{

// this part is not actually required but useful to other people using
your plugin
version.extensions.FlickrGreetingMacro = { major: 1, minor: 0,
revision: 0, date: new Date(2006,3,24) };

config.macros.flickrGreeting = {};
config.macros.flickrGreeting.handler = function (place,name,params) {
//List of greetings:
var WelcomeMessage=new Array()
WelcomeMessage[0] = "Hola";
WelcomeMessage[1] = "Hala";
WelcomeMessage[2] = "Shalom";
WelcomeMessage[3] = "Ni hao";
WelcomeMessage[4] = "Kumusta";
WelcomeMessage[5] = "'Allo";
WelcomeMessage[6] = "G'day";
WelcomeMessage[7] = "Hoi";
WelcomeMessage[8] = "Giorno";
WelcomeMessage[9] = "Hi";
WelcomeMessage[10] = "Hej";
WelcomeMessage[11] = "Olá";
WelcomeMessage[12] = "Ahoy";
WelcomeMessage[13] = "Salut";
WelcomeMessage[14] = "Hello";
WelcomeMessage[15] = "Hoi";
WelcomeMessage[16] = "Oi";
WelcomeMessage[17] = "Hoi";
WelcomeMessage[18] = "Aloha";
WelcomeMessage[19] = "Bonjour";
WelcomeMessage[20] = "Guten Tag";
WelcomeMessage[21] = "Yo";
WelcomeMessage[22] = "Shalom";
WelcomeMessage[23] = "Namaste";
WelcomeMessage[24] = "Ciao";
//randomness:
var index = Math.floor(Math.random() * WelcomeMessage.length);
//output:
var who = params.length > 0 ? params[0] : "";
wikify(WelcomeMessage[index] + " " + who + "!", place);
}
//}}}

>>> Until above this line <<<

peter.k...@gmail.com

unread,
Mar 24, 2006, 10:33:05 AM3/24/06
to TiddlyWiki
Hmm, Google Groups seems to mess up the code - I've made a link to just
the code here:

http://peter.kirkland.googlepages.com/flickrgreetingmacro.txt

Hopefully, if you copy that into a new tiddler it should work.

Peter

Simon Baird

unread,
Mar 24, 2006, 10:46:40 AM3/24/06
to Tiddl...@googlegroups.com
Sweet! It's fun. I liked it so much I borrowed it for MonkeyPirateTW.
http://simonbaird.com/mptw/#FlickrGreetingMacro

I tweaked it a little -- the main change: a better way to define the WelcomeMessage is to use an array literal like this:

       var WelcomeMessage = [
"Hola",
"Hala",
...
"Ciao"
];

Thanks!

Simon.
--
Simon Baird <simon...@gmail.com>

peter.k...@gmail.com

unread,
Mar 24, 2006, 10:59:07 AM3/24/06
to TiddlyWiki
Genius, glad you like it - and thanks for those tweaks!

I had wondered about how to greet e.g. YourName - but my limited JS
knowledge let me down there - so thanks for the flickrGreetingCookie !!

Peter

Eric Shulman

unread,
Mar 24, 2006, 1:10:18 PM3/24/06
to TiddlyWiki
I like this!

You should check out:
http://www.tiddlytools.com/#QuoteOfTheDayPlugin
and
http://www.tiddlytools.com/#Greetings

To display a greeting:
<<QOTD Greetings>>

also, to display the current username, you can use:
<script>return config.options.txtUserName</script>

(note that this needs to have
http://www.tiddlytools.com/#InlineJavascriptPlugin installed in order
to execute the script)

HTH,

-e
Eric Shulman
TiddlyTools / ELS Design Studios

peter.k...@gmail.com

unread,
Mar 24, 2006, 1:39:36 PM3/24/06
to TiddlyWiki
Cool, that seems like a more efficient method - especially if you have
more than one set of quotations.

Glad you liked the idea!

Peter

Reply all
Reply to author
Forward
0 new messages