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

(새 문서: →‎이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다.: →‎* * Auto-number headings * * @source https://www.mediawiki.org/wiki/Snippets/Auto-number_headings * @author Krinkle * @version 2021-10-03: var toc = document.querySelector('#toc'); if (toc) { document.querySelectorAll('.mw-parser-output :is(h1,h2,h3,h4,h5,h6) .mw-headline').forEach(function (headline) { var num = toc.querySelector('a[href="#' + CSS.escape(headline.id) +...)
 
(문서를 비움)
태그: 비우기
 
(같은 사용자의 중간 판 44개는 보이지 않습니다)
1번째 줄: 1번째 줄:
/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. */
 
/**
* Auto-number headings
*
* @source https://www.mediawiki.org/wiki/Snippets/Auto-number_headings
* @author Krinkle
* @version 2021-10-03
*/
var toc = document.querySelector('#toc');
if (toc) {
  document.querySelectorAll('.mw-parser-output :is(h1,h2,h3,h4,h5,h6) .mw-headline').forEach(function (headline) {
    var num = toc.querySelector('a[href="#' + CSS.escape(headline.id) + '"] .tocnumber');
    if (num) headline.prepend(num.textContent + ' ');
  });
} else {
  document.body.classList.add('tpl-autonum');
}

2025년 2월 23일 (일) 14:11 기준 최신판