Shows stars and role on employeesearch
当前为
// ==UserScript==
// @name virtualmanager.com - Employee show stars and role
// @namespace https://greasyfork.org/en/users/884999-l%C3%A6ge-manden
// @version 0.5
// @description Shows stars and role on employeesearch
// @author VeryDoc
// @match https://www.virtualmanager.com/employees/search?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=virtualmanager.com
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
window.addEventListener('load', () => {
setInterval(function () {
loadPlugin();
}, 1000);
});
window.addEventListener('popstate', function (event) {
loadPlugin();
});
function loadPlugin() {
let myTable = document.getElementsByTagName("table")[0].getElementsByTagName('tbody')[0];
let rows = myTable.rows;
for (let row of rows) {
if (row.classList.contains('toprow') === true) {
if (row.classList.contains('changed') === true) {
return;
}
let newCell = row.insertCell();
let newText = document.createTextNode('Ability');
newCell.appendChild(newText);
newCell = row.insertCell();
newText = document.createTextNode('Should buy!');
newCell.appendChild(newText);
row.classList.add('changed');
} else {
let a = row.cells[7];
let skillstable = a.getElementsByTagName("table")[0].getElementsByTagName('tbody')[0];
let skills = skillstable.children;
let youthSkills = parseInt(skills[0].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
let goalkeepingSkills = parseInt(skills[1].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
let fieldplayerSkills = parseInt(skills[2].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
let disiplinSkills = parseInt(skills[3].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
let motivationSkills = parseInt(skills[7].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
let totalSkills = youthSkills + goalkeepingSkills + fieldplayerSkills + disiplinSkills + motivationSkills;
let newCell = row.insertCell();
let newText = document.createTextNode('⭐');
switch (true) {
case (totalSkills > 80):
newText = document.createTextNode('⭐⭐⭐⭐⭐');
break;
case (totalSkills > 60 && totalSkills < 80):
newText = document.createTextNode('⭐⭐⭐⭐');
break;
case (totalSkills > 40 && totalSkills < 60):
newText = document.createTextNode('⭐⭐⭐');
break;
case (totalSkills > 20 && totalSkills < 40):
newText = document.createTextNode('⭐⭐');
break;
}
newCell.appendChild(newText);
if ((youthSkills === 20 && goalkeepingSkills === 20) || (youthSkills === 20 && fieldplayerSkills === 20) || (fieldplayerSkills === 20 && motivationSkills > 14 && disiplinSkills > 14) || (goalkeepingSkills === 20 && motivationSkills > 14 && disiplinSkills > 14)) {
newCell = row.insertCell();
newCell.style.fontSize = "9px";
newText = document.createTextNode("Yes");
newCell.appendChild(newText);
newCell.style.backgroundColor = "green";
}
else {
newCell = row.insertCell();
newCell.style.fontSize = "9px";
newText = document.createTextNode("No");
newCell.appendChild(newText);
newCell.style.backgroundColor = "red";
}
}
}
};
})();