diff --git a/public/src/admin/settings.js b/public/src/admin/settings.js index 2bf0595d69..6732a7bc4f 100644 --- a/public/src/admin/settings.js +++ b/public/src/admin/settings.js @@ -5,19 +5,25 @@ define('admin/settings', ['uploader', 'mousetrap'], function (uploader, mousetra var Settings = {}; Settings.populateTOC = function () { - $('.settings-header').each(function () { - var header = $(this).text(); - var anchor = header.toLowerCase().replace(/ /g, '-').trim(); + var headers = $('.settings-header'); - $(this).prepend(''); - $('.section-content ul').append('
  • ' + header + '
  • '); - }); + if (headers.length > 1) { + headers.each(function () { + var header = $(this).text(); + var anchor = header.toLowerCase().replace(/ /g, '-').trim(); - var scrollTo = $('a[name="' + window.location.hash.replace('#', '') + '"]'); - if (scrollTo.length) { - $('html, body').animate({ - scrollTop: (scrollTo.offset().top) + 'px', - }, 400); + $(this).prepend(''); + $('.section-content ul').append('
  • ' + header + '
  • '); + }); + + var scrollTo = $('a[name="' + window.location.hash.replace('#', '') + '"]'); + if (scrollTo.length) { + $('html, body').animate({ + scrollTop: (scrollTo.offset().top) + 'px', + }, 400); + } + } else { + $('.content-header').parents('.row').remove(); } };