GA threads authorName

Добавляет имя автора в заглавный пост на страницах тредов форума "Глобальная авантюра".

คุณจะต้องติดตั้งส่วนขยาย เช่น 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        GA threads authorName
// @namespace   glav.su
// @description Добавляет имя автора в заглавный пост на страницах тредов форума "Глобальная авантюра".
// @include     http://glav.su/*/threads/*
// @include     https://glav.su/*/threads/*
// @version     1.2
// @grant       none
// ==/UserScript==
var m_id, mch, a_tm = $("div.lContent").find("a")[0];
if( mch = a_tm.toString().match(/https*?:\/\/glav\.su\/forum\/.+?\/(\d+?)-message\/#message\d+/) ){
	m_id = mch[1];
	$.ajax({
		url: mch[0],
		dataType: 'html',
		success: function(data){
			var dt = data.toString().replace(/[\n\r]/mg, '');
			mch = dt.match(new RegExp('<td id="forumMessagesListMessage'+m_id+'AuthorName" class="fItem forumMessagesListMessageAuthorName">.*?(<a.*?<\/a>)')) 
				|| dt.match(new RegExp('<td id="forumMessagesListMessage'+m_id+'Author" class="fItem forumMessagesListDeletedMessageAuthor">.*?(<a.*?<\/a>)'));
			if( mch ){
				$(a_tm).before(mch[1]+'&nbsp;&nbsp;');
			}
		}
	});
}