미디어위키:Common.js: 두 판 사이의 차이

편집 요약 없음
편집 요약 없음
3번째 줄: 3번째 줄:


     $('h2, h3, h4, h5, h6').filter(function() {
     $('h2, h3, h4, h5, h6').filter(function() {
         return $(this).attr('id') !== 'toc';
         return $(this).attr('id') != 'toc';
     }).each(function() {
     }).each(function() {
         var $this = $(this);
         var $this = $(this);

2025년 4월 26일 (토) 21:31 판

$(document).ready(function() {
    var count = 1;

    $('h2, h3, h4, h5, h6').filter(function() {
        return $(this).attr('id') != 'toc';
    }).each(function() {
        var $this = $(this);

        // 숫자 링크 생성
        var backLink = $('<a>')
            .attr('href', '#toc')
            .text(count + '. ')
            .addClass('mw-link')   // 링크 스타일 강제로 적용
            .css({
                'text-decoration': 'none',
                'margin-right': '5px'
            });

        $this.prepend(backLink);

        count++;
    });
});