zmien pasek

zmien

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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       zmien pasek
// @namespace  https://www.wykop.pl/*
// @version    1.0
// @description zmien
// @include     *://www.wykop.pl/*
// @copyright  Arkatch
// ==/UserScript==

function setSex(nick){
	let x = document.querySelectorAll('a.profile[href="https://www.wykop.pl/ludzie/'+nick+'/"] > img');
	for(let elem of x)
	elem.setAttribute('class', 'avatar female lazy');
}
function loaded(){
	setSex('mgnfic');
}
function reloadAvatar(){
	return new Promise((resolve, reject)=>{
		setTimeout(()=>{
			resolve();
		}, 600);
	}).then(()=>{
		loaded();
	});
}
function eventList(){
	let x = document.querySelectorAll('.more > a.affect.ajax');
	for(let i of x){
		i.addEventListener('click', reloadAvatar, false);
	}
}
{
	document.onreadystatechange = ()=>{
		let s = document.readyState;
		if(s === "interactive" || s === "complete") {
			loaded();
			eventList();
		}
	};
}