1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
javascript: {
	const DELAY_TIME = 200;		// time to wait page reload

	const doWork = () => {
		// mark all plurks unread
		window.document.getElementById("mark_all_link").click();
	};

	const markAllRead = (dom) => {
		if(confirm("Are you sure to mark all plurks as read?")){
			console.log("[Plugin] Mark all plurks as read.");
			// show unread plurks
			dom.getElementById("noti_re_view").click();
			// delay to wait page reload 
			window.setTimeout(doWork, DELAY_TIME);
		}else {
			console.log("[Plugin] Task cancelled.");
		}
	};

	markAllRead(window.document);
}