emoji: system meta data (name, image/page address)
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 7 Jul 2010 19:26:48 +0000 (21:26 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 10 Nov 2010 21:40:55 +0000 (22:40 +0100)
emoji-gmail.inc.pl
emoji-msn.inc.pl
emoji-yahoo.inc.pl
emoji.plp

index 3ca6311..e82e91f 100644 (file)
@@ -1,4 +1,8 @@
-# http://mail.google.com/support/bin/answer.py?answer=34056
+{
+       name => 'Gmail',
+       icon => 'http://mail.google.com/mail/help/images/screenshots/chat/%s.gif',
+       source => 'http://mail.google.com/support/bin/answer.py?answer=34056',
+},
 
 'official',
 
index 00d17e1..f0f6f57 100644 (file)
@@ -1,4 +1,8 @@
-# http://messenger.msn.com/Resource/Emoticons.aspx
+{
+       name => 'Windows Live Messenger',
+       icon => 'http://messenger.msn.com/Resource/emoticons/%s.gif',
+       source => 'http://messenger.msn.com/Resource/Emoticons.aspx',
+},
 
 'faces',
 
index 920399e..c483e44 100644 (file)
@@ -1,4 +1,10 @@
-# http://messenger.yahoo.com/features/emoticons/
+{
+       name => 'Yahoo! Messenger',
+#      icon => 'http://l.yimg.com/us.yimg.com/i/mesg/emoticons6/%s.gif',
+       icon => 'http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/%s.gif',
+#      icon-web => 'http://l.yimg.com/a/i/us/msg/emoticons/%s.gif',
+       source => 'http://messenger.yahoo.com/features/emoticons/',
+},
 
 'part 1',
 
index 73271d5..60aaf0d 100644 (file)
--- a/emoji.plp
+++ b/emoji.plp
@@ -18,19 +18,16 @@ Html({
 <h1>IM emoticons</h1>
 
 <:
-my %ICONURL = (
-       msn   => 'http://messenger.msn.com/Resource/emoticons/%s.gif',
-#      yahoo => 'http://l.yimg.com/us.yimg.com/i/mesg/emoticons6/%s.gif',
-       yahoo => 'http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/%s.gif',
-#      yahoo-web => 'http://l.yimg.com/a/i/us/msg/emoticons/%s.gif',
-       gmail => 'http://mail.google.com/mail/help/images/screenshots/chat/%s.gif',
-);
-
 print "<ul>\n";
 
 for my $system (qw'gmail msn yahoo') {
        my @info = do "emoji-$system.inc.pl";
-       printf '<div class="section"><h3>%s</h3>'."\n\n", $system;
+       my $meta = shift @info or die $@;
+       ref $meta eq 'HASH' or die "invalid $system definitions";
+       my $title = $meta->{name} // $system;
+       $title = qq{<a href="$_">$title</a>} for $meta->{source} || ();
+
+       printf '<div class="section"><h3>%s</h3>'."\n\n", $meta->{name} // $system;
        print '<table><tbody>'."\n";
        for (my $i = 0; $i <= $#info; $i++) {
                my $name = $info[$i];
@@ -38,9 +35,12 @@ for my $system (qw'gmail msn yahoo') {
                        printf '</table><table><tbody>'."\n", $name;
                        next;
                }
-               my ($input, $attr, $char, $desc) = @{ $info[++$i] };
-               printf('<tr><th><img src="'.$ICONURL{$system}.'"><td><kbd>%s</kbd><td>%s%s'."\n",
-                       $name, EscapeHTML($input), $desc // $name, $char ? '<td>'.chr($char) : '',
+               my ($input, $flags, $char, $desc) = @{ $info[++$i] };
+               printf('<tr><th><img src="%s" alt="%s"><td><kbd>%s</kbd><td>%s%s'."\n",
+                       sprintf($meta->{icon} // '%s', $name), EscapeHTML($name),
+                       EscapeHTML($input),
+                       $desc // $name,
+                       $char ? '<td>'.chr($char) : '',
                );
        }
        print "</table></div>\n\n";