コンテンツにスキップ

利用者:Yuukin0248/toggleNumHistoryAndContribs.js

お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。

多くの WindowsLinux のブラウザ

  • Ctrl を押しながら F5 を押す。

Mac における Safari

  • Shift を押しながら、更新ボタン をクリックする。

Mac における ChromeFirefox

  • Cmd Shift を押しながら R を押す。

詳細についてはWikipedia:キャッシュを消すをご覧ください。

$(function () {
  const history = location.search.includes('action=history');
  const contributions = mw.config.get('wgCanonicalSpecialPageName') === 'Contributions';
  if (history || contributions) init(history);
});

/** @param {boolean} isHistory */
function init(isHistory) {
  const elm = isHistory ? $('#pagehistory') : $('.mw-contributions-list');
  toggleNum(elm);
  $('<button id="tb_toDecButton">数値化/解除</button>')
    .click(() => toggleNum(elm))
    .insertBefore('#pagehistory, .mw-contributions-list');
}

/** @param {JQuery<HTMLElement>} elm */
function toggleNum(elm) {
  if (elm.css('list-style-type') === 'decimal') {
    elm.css('list-style-type', 'disc');
  } else {
    elm.css({ 'list-style-type': 'decimal', 'list-style-image': 'none' });
  }
}