升级FootNote特效

仅IE全部效果

补丁

--- FootNote.py.orig    2006-10-25 15:47:44.000000000 +0800
+++ FootNote.py 2007-04-13 14:52:16.000000000 +0800
@@ -1,11 +1,12 @@
-# -*- coding: iso-8859-1 -*-
+# coding: utf-8
+## -*- coding: iso-8859-1 -*-
 """
     MoinMoin - FootNote Macro
 
     Collect and emit footnotes. Note that currently footnote
     text cannot contain wiki markup.
 
-    @copyright: 2002 by Jürgen Hermann <[email protected]>
+    @copyright: 2002 by J黵gen Hermann <[email protected]>
     @license: GNU GPL, see COPYING for details.
 """
 
@@ -14,7 +15,12 @@
 from MoinMoin.parser import wiki
 
 Dependencies = ["time"] # footnote macro cannot be cached
-
+attaWord = u"注"
+attaFootWord = """<span id='footlabel'>`FootNote
+    <a href='#top'>
+    <img alt='[top]' height='10' src='/wiki/modern/img/moin-top.png' title='[top]' width='14' /></a>
+    </span>
+    """
 def execute(macro, args):
     # create storage for footnotes
     if not hasattr(macro.request, 'footnotes'):
@@ -29,8 +35,11 @@
         macro.request.footnotes.append((args, fn_id))
         return "%s%s%s%s%s" % (
             macro.formatter.sup(1),
-            macro.formatter.anchorlink(1, 'fndef' + fn_id, id = 'fnref' + fn_id),
-            macro.formatter.text(str(idx+1)),
+            macro.formatter.anchorlink(1, 'fndef' + fn_id, 
+                                        id = 'fnref' + fn_id,
+                                        onFocus="this.style.backgroundColor='#933';this.style.color='#fff';",
+                                        onBlur="this.style.backgroundColor='transparent';this.style.color='#a9a';",),
+            macro.formatter.text(attaWord+str(idx+1)),
             macro.formatter.anchorlink(0),
             macro.formatter.sup(0),)
 
@@ -44,6 +53,7 @@
         result = []
 
         result.append(formatter.div(1, css_class='footnotes'))
+        result.append(attaFootWord)
 
         # Add footnotes list
         result.append(formatter.bullet_list(1))
@@ -54,8 +64,10 @@
             
             fn_id = request.footnotes[idx][1]
             result.append(formatter.anchorlink(1, 'fnref' + fn_id,
-                                               id='fndef' + fn_id))
-            result.append(formatter.text(str(idx + 1)))
+                                               id='fndef' + fn_id,
+                                               onFocus="this.style.backgroundColor='#930';this.style.color='#fff';",
+                                               onBlur="this.style.backgroundColor='#fff';this.style.color='#9a9';",))
+            result.append(formatter.text(attaWord+str(idx + 1)))
             result.append(formatter.anchorlink(0))
             result.append(formatter.text(" "))


  1. 是也乎,只有IE支持this.style.属性的直接设置?! (1)

  2. 需要追加span#footlabel 的支持 (2)

  3. 使用同标题教回返小图标 (3)

  4. 仅仅使用中文的 (4)

  5. 只能JS 实现支持,追加 onFocus() 和onBlur() (5)

woodpecker-log/2007-04-13 (last edited 2009-12-25 07:18:56 by localhost)