User:Borschts/watchlist-markseen.js

维基百科,自由的百科全书

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

javascript:
(function() {

	function watchlistmarkseen(title) {
		new mw.Api().postWithEditToken({
			"action": "setnotificationtimestamp",
			"titles": title
		}).done(function() {
			mw.notify(['已將頁面 "<a href="/wiki/' + title + '">' + title + '</a>" 標記為已查看。'])
		});
	}

	if (mw.config.get("wgCanonicalSpecialPageName") === "Watchlist") {

		$($(".special")[0]).on("click", ".mw-changeslist-watchedunseen>:first-child>:first-child", function() {
			var title = $(this).parent().parent().find(":nth-child(3)").find(".mw-title,.mw-redirect")[0].innerText;
			watchlistmarkseen(title);
		});

	}

})();