View difference between Paste ID: NYHyNXBd and KpB5erQs
SHOW: | | - or go back to the newest paste.
1
var a = document.getElementsByClassName('messages-content')[0].innerHTML.match(/\<p\>.*?\<\/p\>/g);
2
for (var i in a)
3
{
4
	if (typeof a[i] == 'function') continue;
5
	line = a[i];
6
	if (/<span class="private">/.test(line)) continue;
7
8
	if (/<span class="system-message">/.test(line))
9
	{
10
		time = /<span class="time">(.*?)<\/span>/.exec(line)[1];
11
		msg = /<span class="system-message">(.*?)<\/span>/.exec(line)[1]
12
		msg = msg.replace(/<img.*src="(.*?)".*>/g, "[img]http://klavogonki.ru$1[/img]");
13
		msg = msg.replace(/<a.*href="(.*?)".*<\/a>/, "[url=$1]$1[/url]");
14
		result = '[color="grey"]'+time+' '+msg+'[/color]';
15
	} else {
16
		time = '[color="grey"][' + /<span class="clickable">(.*?)<\/span>/.exec(line)[1] + '][/color]';
17
		nick = ' [color=' + /style="color:(.*?)"/.exec(line)[1] + ']<' + /&lt;<.*?>(.*?)<\//.exec(line)[1] + '>[/color] ';
18
		msg = /&gt;<\/span>(.*?)<\/p>/.exec(line)[1];
19
		msg = msg.replace(/<img.*src="(.*?)".*>/g, "[img]http://klavogonki.ru$1[/img]");
20
		msg = msg.replace(/<a.*href="(.*?)".*<\/a>/, "[url=$1]$1[/url]");
21
		result = time+nick+msg;
22
	}
23
24
	console.log(result);
25
}