User:Atmark-chan/custom/toggleNumHistoryAndContribs.js

From Meta, a Wikimedia project coordination wiki

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(document).ready(function(){
	toNumWikipediaHistory();
});

function toNumWikipediaHistory() {
	if (location.search.indexOf("action=history") != -1 || mw.config.get('wgPageName').substr(0, '特別:投稿記録'.length) == '特別:投稿記録') {
		var elm;
		if (location.search.indexOf("action=history") != -1) {
			elm = $('#pagehistory');
		} else {
			elm = $('.mw-contributions-list');
		}
		toggleNumWikipediaHistory();
		btn = '<button id="tb_toDecButton">数値化/解除</button> ';
		$(".mw-history-legend p").prepend(btn);
		$(".mw-pager-navigation-bar p").prepend(btn);
		$("#tb_toDecButton").click(function () { toggleNumWikipediaHistory(elm); });
	}
}

function toggleNumWikipediaHistory(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"});
	}
}