MediaWiki:Qlzq-Zuiming-Add.js

From 清冽之泉
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* 以下为专为 [[刑法罪名精校版]] 设计的 js,它能实现罪名跨标题级别编号 */

mw.hook('wikipage.content').add(function () {
    var nextNumber = 1;

    $('#mw-content-text .zuiming-list > ol').each(function () {
        this.start = nextNumber;
        nextNumber += $(this).children('li').length;
    });
});