useful-wiki

Delete-reference, QA test

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         useful-wiki
// @namespace    http://tampermonkey.net/
// @version      1.4 Beta
// @description  Delete-reference, QA test
// @author       Klastor
// @match        https://*.wikipedia.org/wiki/*
// @grant        none
// ==/UserScript==

(function() {
    let ref = document.querySelectorAll('.reference');
let count;
let pageHeader = document.getElementById('firstHeading');

let configurationColor = ['red','orange','green'];
let configurationText = ['Статья не вызывает доверие!', 'Информацию из статьи следовало бы перепроверить!', 'Статья подкреплена проверенной информацией!'];

function counter(){
	let x = ref.length;
	let y;
	if(x<=4)y=0
	if(x>=5)y=1
	if(x>10)y=2
	return count = y
}

let changer = {
	count : counter(),
	color : configurationColor[count],
	text : configurationText[count],

	changeHeader(){
		pageHeader.style.backgroundColor = this.color;
		pageHeader.setAttribute('title', `${this.text} и количество сносок у нее ${ref.length}`);
	}
}

function refDel(){
	if(ref != 0){
		for(let i=0; i < ref.length; i++){
			ref[i].remove()
		}
	}
}

changer.changeHeader();
refDel();
})();