diff options
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{ |