virtualmanager.com - Employee show stars and role

Shows stars and role on employeesearch

目前为 2023-01-13 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name virtualmanager.com - Employee show stars and role
  3. // @namespace https://greasyfork.org/en/users/884999-l%C3%A6ge-manden
  4. // @version 0.4
  5. // @description Shows stars and role on employeesearch
  6. // @author VeryDoc
  7. // @match https://www.virtualmanager.com/employees/search?*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=virtualmanager.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. let myTable = document.getElementsByTagName("table")[0].getElementsByTagName('tbody')[0];
  16.  
  17. let rows = myTable.rows;
  18.  
  19. for (let row of rows) {
  20. if (row.classList.contains('toprow')) {
  21. let newCell = row.insertCell();
  22. let newText = document.createTextNode('Ability');
  23. newCell.appendChild(newText);
  24.  
  25. newCell = row.insertCell();
  26. newText = document.createTextNode('Speciality');
  27. newCell.appendChild(newText);
  28. } else {
  29. let a = row.cells[7];
  30. let skillstable = a.getElementsByTagName("table")[0].getElementsByTagName('tbody')[0];
  31. let skills = skillstable.children;
  32. let youthSkills = parseInt(skills[0].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
  33. let goalkeepingSkills = parseInt(skills[1].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
  34. let fieldplayerSkills = parseInt(skills[2].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
  35. let disiplinSkills = parseInt(skills[3].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
  36. let motivationSkills = parseInt(skills[7].innerText.trim().replace(' ', '').replace('\n', ':').split(':')[1]);
  37.  
  38. let totalSkills = youthSkills + goalkeepingSkills + fieldplayerSkills + disiplinSkills + motivationSkills;
  39. let newCell = row.insertCell();
  40.  
  41. let newText = document.createTextNode('⭐');
  42.  
  43. switch (true) {
  44. case (totalSkills > 80):
  45. newText = document.createTextNode('⭐⭐⭐⭐⭐');
  46. break;
  47. case (totalSkills > 60 && totalSkills < 80):
  48. newText = document.createTextNode('⭐⭐⭐⭐');
  49. break;
  50. case (totalSkills > 40 && totalSkills < 60):
  51. newText = document.createTextNode('⭐⭐⭐');
  52. break;
  53. case (totalSkills > 20 && totalSkills < 40):
  54. newText = document.createTextNode('⭐⭐');
  55. break;
  56. }
  57.  
  58. newCell.appendChild(newText);
  59.  
  60. let coachString = "";
  61.  
  62. if (disiplinSkills > motivationSkills) {
  63. coachString += "Yelling ";
  64. } else {
  65. coachString += "Motivating ";
  66. }
  67.  
  68. if (youthSkills > 10) {
  69. coachString += "youth ";
  70. } else {
  71. coachString += "senior ";
  72. }
  73.  
  74. if (fieldplayerSkills > goalkeepingSkills) {
  75. coachString += "field";
  76. } else {
  77. coachString += "goalkeeper";
  78. }
  79.  
  80. newCell = row.insertCell();
  81. newCell.style.fontSize = "9px";
  82. newText = document.createTextNode(coachString);
  83. newCell.appendChild(newText);
  84. }
  85. };
  86. })();