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

편집 요약 없음
편집 요약 없음
1번째 줄: 1번째 줄:
$(document).ready(function() {
$(document).ready(function() {
     var count = 1; // 숫자 시작
     var count = 1;
   
 
    // 목차 자체(#toc)는 제외하고, 본문 제목(h2~h6)만 선택
     $('h2, h3, h4, h5, h6').filter(function() {
     $('h2, h3, h4, h5, h6').filter(function() {
         return $(this).attr('id') !== 'toc';
         return $(this).attr('id') !== 'toc';
11번째 줄: 10번째 줄:
         var backLink = $('<a>')
         var backLink = $('<a>')
             .attr('href', '#toc')
             .attr('href', '#toc')
             .text(count + '. ')  // 숫자 + 점 + 공백
             .text(count + '. ')
            .addClass('mw-link')  // 링크 스타일 강제로 적용
             .css({
             .css({
                 'text-decoration': 'none',
                 'text-decoration': 'none',
                'color': 'inherit',        // 부모(제목) 폰트 색깔 그대로
                 'margin-right': '5px'
                'font-size': 'inherit',    // 부모(제목) 폰트 크기 그대로
                 'margin-right': '5px'     // 숫자와 제목 간 살짝 띄우기
             });
             });


        // 숫자를 제목 맨 앞에 삽입
         $this.prepend(backLink);
         $this.prepend(backLink);



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