利用者:Yuukin0248/toggleNumHistoryAndContribs.js
表示
お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。
多くの Windows や Linux のブラウザ
- Ctrl を押しながら F5 を押す。
Mac における Safari
Mac における Chrome や Firefox
- ⌘ 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' });
}
}