Revamp this a little and make it jQuery 1.7 compatible (fixes issue 803)

This commit is contained in:
Thomas Keller 2012-04-29 00:24:09 +02:00
parent e8882292b5
commit 8db3c45763
2 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@
## Bugfixes
- Compatiblity fixes for PostgreSQL (fixes issue 800)
- Fix TOC generation in wiki (issue 803)
## Language and Translations

View File

@ -1,9 +1,12 @@
$(document).ready(function() {
$(":header", "#wiki-content").map(function(index) {
this.id = "wikititle_" + index;
$("<a href='#" + this.id + "'>" + jQuery.fn.text([this]) + "</a>")
.addClass("wiki-" + this.tagName.toLowerCase())
.appendTo('#wiki-toc-content');
var $header = $(this);
var $toc = $('#wiki-toc-content');
$header.attr('id', 'wikititle_' + index);
$('<a />').attr('href', '#' + $header.attr('id'))
.text($header.text())
.addClass("wiki-" + $header[0].tagName.toLowerCase())
.appendTo($toc);
});
if ($('#wiki-toc-content *').size() < 2)
$('#wiki-toc').hide();