爲心愛的MoinMoin寫一個小小的Done宏


###################################################
#
# Author: willzh@javaeye
# Date: Wed Apr 15 16:07:30 CST 2009
# GPLv3
#
#

import random

def execute(macro, args):
html ='''
<script>
function displayDoneHint%(id)s()
{
var done = document.getElementById('done%(id)s');
done.style.display="inline";
}
function hiddenDoneHint%(id)s()
{
var done = document.getElementById('done%(id)s');
done.style.display="none";
}
</script>
<style>
.donehint {
position: absolute;
display:none;
background-color:#f3f3cc;
font-size:10px;
border: 1px solid #e2e2aa;
padding: 1px 2px;
margin-top: -6px;
}
</style>
<span style="text-decoration:line-through" οnmοuseοver="displayDoneHint%(id)s()" οnmοuseοut="hiddenDoneHint%(id)s()"
>%(content)s</span>
<div id="done%(id)s" class="donehint">Done!</div>
'''
content = args or ""

return html % {'id':str(random.randint(0,1000)),'content':content}


然後在MoinMoin裏編輯:
[[Done(爲所有人生成密碼,併發送郵件通知)]]
顯示效果如下:
[img]/upload/attachment/94515/1be00620-d653-3ac2-bed9-bc9ce1c6b6b3.png[/img]
發佈了26 篇原創文章 · 獲贊 1 · 訪問量 6807
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章