4chan [s4s] colored text

For funposting on [s4s]

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name 4chan [s4s] colored text
// @description For funposting on [s4s]
// @include *//boards.4chan.org/*
// @version 0.0.1.20170529212727
// @namespace https://greasyfork.org/users/125336
// ==/UserScript==
postmass=document.getElementsByClassName('postContainer');
postmes=document.getElementsByClassName('postMessage');
for(i=0;i<postmes.length;i++){
if(postmass[i].getElementsByClassName('name')[0].innerHTML.toLowerCase()=='kek'){
	postmes[i].setAttribute('class',postmes[i].getAttribute('class')+' papyrus');
}
postmessy=postmes[i].innerHTML.replace('<span class="fortune"','<br><span class="fortune"');
checkora=postmessy.split('<br>');
for(j=0;j<checkora.length;j++){
	temp=checkora[j].replace('\n','');
	if(temp.length-temp.lastIndexOf('&lt;')==4&&temp.indexOf('&lt;')!=-1){
		checkora[j]='<span style="color:orange">'+checkora[j]+'</span>';
	}
	if(temp.length-temp.lastIndexOf('&gt;')==4&&temp.indexOf('&gt;')!=-1){
		checkora[j]='<span style="color:pink">'+checkora[j]+'</span>';
	}
	if(temp.indexOf('&lt;')==0){
		checkora[j]='<span style="color:red">'+checkora[j]+'</span>';
	}
	if(temp.length-temp.lastIndexOf(')')==1&&temp.indexOf(')')!=-1&&temp.indexOf('(')==0){
		checkora[j]='<span style="color:red;font-weight:bold">'+checkora[j]+'</span>';
	}
	if(temp.length-temp.lastIndexOf(' ]')==2&&temp.indexOf(' ]')!=-1&&temp.indexOf('[ ')==0){
		checkora[j]='<span style="color:blue;font-family:monospace;font-weight:bold">'+checkora[j]+'</span>';
	}
	if(temp.length-temp.lastIndexOf(' }')==2&&temp.indexOf(' }')!=-1&&temp.indexOf('{ ')==0){
		checkora[j]='<span style="color:purple;font-family:monospace;font-weight:bold">'+checkora[j]+'</span>';
	}
	if(temp.indexOf('[spoiler]')+1&&temp.indexOf('[/spoiler]')&&(temp.indexOf('[spoiler]')<temp.indexOf('[/spoiler]'))){
		checkora[j]=checkora[j].replace('[spoiler]','<span class="spoiler">');
		checkora[j]=checkora[j].replace('[/spoiler]','</span>');
	}
}
checkorb=checkora.join('<br>').replace('<br><span class="fortune"','<span class="fortune"');
postmes[i].innerHTML=checkorb;
}
document.head.appendChild(newcss=document.createElement('style'));
newcss.innerHTML='@font-face{font-family:Papyrus;src:local(Papyrus),url(\'http://www.stben.net/fonts/papyrus.woff\') format(\'woff\')}.papyrus{font-family:Papyrus!important}';