[Konachan / yande.re] Forum List: Default to Last Page

Replaces the "last" links in the forum list with "first" links and changes the main links to link to the last page.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name		[Konachan / yande.re] Forum List: Default to Last Page
// @namespace	Zolxys
// @description	Replaces the "last" links in the forum list with "first" links and changes the main links to link to the last page.
// @include		/^https?://konachan\.(com|net)/forum/?($|\?|#)/
// @include		/^https?://yande\.re/forum/?($|\?|#)/
// @version		1.1
// ==/UserScript==
var t = document.getElementById('forum').getElementsByTagName('table')[0].getElementsByTagName('td');
for (var i = 0; i < t.length; ++i) {
	var a = t[i].getElementsByTagName('a');
	if (a.length == 2)
	  if (a[1].innerHTML.trim() == 'last') {
		var h = a[0].href;
		a[0].href = a[1].href;
		a[1].href = h;
		a[1].innerHTML = 'first';
	}
}