From 8db3c45763d22b8363ef8b425035358c172d0acb Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Sun, 29 Apr 2012 00:24:09 +0200 Subject: [PATCH] Revamp this a little and make it jQuery 1.7 compatible (fixes issue 803) --- NEWS.mdtext | 1 + www/media/idf/js/wiki-toc.js | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS.mdtext b/NEWS.mdtext index 5015f3f..f260965 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -3,6 +3,7 @@ ## Bugfixes - Compatiblity fixes for PostgreSQL (fixes issue 800) +- Fix TOC generation in wiki (issue 803) ## Language and Translations diff --git a/www/media/idf/js/wiki-toc.js b/www/media/idf/js/wiki-toc.js index 8b59f35..5cea7da 100644 --- a/www/media/idf/js/wiki-toc.js +++ b/www/media/idf/js/wiki-toc.js @@ -1,9 +1,12 @@ $(document).ready(function() { $(":header", "#wiki-content").map(function(index) { - this.id = "wikititle_" + index; - $("" + jQuery.fn.text([this]) + "") - .addClass("wiki-" + this.tagName.toLowerCase()) - .appendTo('#wiki-toc-content'); + var $header = $(this); + var $toc = $('#wiki-toc-content'); + $header.attr('id', 'wikititle_' + index); + $('').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();