root/platform/tdiary/plugin/github_badge.rb

Revision 20539, 1.0 kB (checked in by kakutani, 2 months ago)

documentation and reorganize variables.

Line 
1# Github Badge, by drnic plugin.
2# http://drnicjavascript.rubyforge.org/github_badge/
3#
4# usage:
5#   github_badge(username, list_length, head, theme, title, show_all)
6#     - username:    user name on github.com
7#     - list_length: project list length
8#     - theme:       specify theme for badge. "white" or "black".
9#     - title:       top text display on the badge.
10#     - show_all:    'Show All' message.
11#
12# Copyright (c) 2008 KAKUTANI Shintaro <http://kakutani.com/>
13# Distributed under the GPL
14
15def github_badge( username, list_length = 10, head = "div", theme = "white", title = "My Projects", show_all = "Show all" )
16        return (<<-EOS).chomp
17<div id="github-badge"></div>
18<script type="text/javascript" charset="utf-8">
19  GITHUB_USERNAME="#{ username }";
20  GITHUB_LIST_LENGTH=#{ list_length };
21  GITHUB_THEME="#{ theme }";
22  GITHUB_TITLE="#{ title }"
23  GITHUB_SHOW_ALL = "#{ show_all }"
24</script>
25<script src="http://drnicjavascript.rubyforge.org/github_badge/dist/github-badge-launcher.js" type="text/javascript"></script>
26        EOS
27end
Note: See TracBrowser for help on using the browser.