useful-wiki

Delete-reference, QA test

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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();
})();