diff options
author | chris <chris@teacherscpd.co.uk> | 2005-07-28 02:55:22 +0200 |
---|---|---|
committer | chris <chris@teacherscpd.co.uk> | 2005-07-28 02:55:22 +0200 |
commit | d74aace9ed8079a5a2430f3c0cc56ff39934279b (patch) | |
tree | 387fd4b0cedbac9eb3cebeeea6386e0bd4c8db7a /lib | |
parent | 4468cb4c2906e2ae8887839b5e683cfc01c7b12c (diff) | |
download | rpg-d74aace9ed8079a5a2430f3c0cc56ff39934279b.tar.gz rpg-d74aace9ed8079a5a2430f3c0cc56ff39934279b.tar.bz2 |
footnote fix: almagamate identical footnotes, insitu footnote popups
darcs-hash:20050728005522-50fdc-f359021d5bcf602c2c403d37852196d5eeb4d473.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scripts/script.js | 44 | ||||
-rw-r--r-- | lib/tpl/default/design.css | 9 |
2 files changed, 53 insertions, 0 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 9d667c7af..58785dbde 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -457,3 +457,47 @@ function checkAclLevel(){ } } } + +/* insitu footnote addition + * provide a wrapper for domTT javascript library + * this function is placed in the onmouseover event of footnote references in the main page + * + * @author Chris Smith <chris [at] jalakai [dot] co [dot] uk> + */ +var currentFootnote = 0; +function fnt(id, e, evt) { + + if (currentFootnote && id != currentFootnote) { + domTT_close(document.getElementById('insitu-fn'+currentFootnote)); + } + + // does the footnote tooltip already exist? + var fnt = document.getElementById('insitu-fn'+id); + if (!fnt) { + // if not create it... + + // locate the footnote anchor element + var a = document.getElementById( "fn"+id ); + if (!a) return; + + // anchor parent is the footnote container, get its innerHTML + var footnote = new String (a.parentNode.innerHTML); + + // strip the leading footnote anchors and their comma separators + footnote = footnote.replace(/<a\s*href=\".*\#fnt\d+\".*?<\/a>/gi, ''); + footnote = footnote.replace(/^\s+(,\s+)+/,''); + + // prefix ids on any elements with "insitu-" to ensure they remain unique + footnote = footnote.replace(/\bid=\"(.*?)\"/gi,'id="insitu-$1'); + + // create the DOM node, assign an id, a class and the footnote content + fnt = document.createElement("div"); + fnt.id = "insitu-fn"+id; + fnt.className = "insitu-footnote"; + fnt.innerHTML = footnote; + } + + // activate the tooltip + domTT_activate(e, evt, 'content', fnt, 'type', 'velcro'); + currentFootnote = id; +} diff --git a/lib/tpl/default/design.css b/lib/tpl/default/design.css index 41a34dd5f..af7998317 100644 --- a/lib/tpl/default/design.css +++ b/lib/tpl/default/design.css @@ -568,6 +568,15 @@ a.fn_bot{ font-weight:bold; } +/* insitu-footnotes */ +div.insitu-footnote { + font-size: 80%; + line-height: 1.2em; + border: 1px solid #8cacbb; + background: #eef3f8; + text-align: left; + padding: 4px; +} /* --------------- search result formating --------------- */ .search_result{ |