some little script

Hack cursors

目前為 2017-03-22 提交的版本,檢視 最新版本

  1. //// ==UserScript==
  2. // @name some little script
  3. // @namespace lilsc
  4. // @description Hack cursors
  5. // @homepage https://eu4.salesforce.com
  6. // @match https://eu4.salesforce.com
  7. // @include /^https://eu4.salesforce.com*
  8. // @version 0.0.1.20170322172554
  9. // ==/UserScript==
  10.  
  11. document.body.innerHTML = document.body.innerHTML.replace(/-/g, 'Kaputt');
  12. document.body.innerHTML = document.body.innerHTML.replace(/Cold Caller/g, '');
  13. Element.prototype.remove = function() {
  14. this.parentElement.removeChild(this);
  15. }
  16. NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
  17. for(var i = this.length - 1; i >= 0; i--) {
  18. if(this[i] && this[i].parentElement) {
  19. this[i].parentElement.removeChild(this[i]);
  20. }
  21. }
  22. }
  23.  
  24.  
  25. table = document.querySelector('.reportTable');
  26. everything = document.body.childNodes;
  27. document.body.style.background="white";
  28. document.body.style.setProperty('display', 'flex', 'important');
  29. document.body.style.setProperty('flex-direction', 'column', 'important');
  30. document.body.style.setProperty('height', '100vh', 'important');
  31. document.body.style.setProperty('align-items', 'center', 'important');
  32. document.body.style.setProperty('justify-content', 'center', 'important');
  33. while(everything.length)
  34. document.body.removeChild(everything[0]);
  35. document.body.append(table);
  36.  
  37. function loadfonts() {
  38. var script = document.createElement("script");
  39. script.src = "https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js";
  40. script.type = "text/javascript";
  41. document.getElementsByTagName("head")[0].appendChild(script);
  42. }
  43. loadfonts();
  44. setTimeout(function () {
  45. WebFont.load({
  46. google: {
  47. families: ['Press Start 2P']
  48. }
  49. })
  50. }, 400)
  51.  
  52. newtable = document.querySelectorAll('tbody *');
  53. for (var i = 0; i < newtable.length; i++) {
  54. newtable[i].style.setProperty('background-color', 'white', 'important');
  55. newtable[i].style.setProperty('font-size', 'large', 'important');
  56. newtable[i].style.setProperty('font-family', '"Press Start 2P"', 'important');
  57. newtable[i].style.setProperty('color', 'black', 'important');
  58. newtable[i].style.setProperty('padding', '15px', 'important');
  59. }
  60. z = document.querySelectorAll('tr.headerRow:nth-child(1)');
  61. for (var i = 0; i < z.length; i++) {
  62. z[i].remove();
  63. }
  64. // z = document.querySelectorAll('tr.grandTotalRow');
  65. // for (var i = 0; i < z.length; i++) {
  66. // z[i].remove();
  67. // }
  68. z = document.querySelectorAll('td.drilldown');
  69. for (var i = 0; i < z.length; i++) {
  70. z[i].remove();
  71. }
  72. z = document.querySelectorAll('tr td:nth-child(2)');
  73. for (var i = 0; i < z.length; i++) {
  74. z[i].remove();
  75. }
  76. z = document.querySelectorAll('br');
  77. for (var i = 0; i < z.length; i++) {
  78. z[i].remove();
  79. }
  80. q = document.createElement('th');
  81. t = document.createTextNode('Dials')
  82. q.appendChild(t)
  83. q.style.setProperty('background-color', 'white', 'important');
  84. q.style.setProperty('font-size', 'large', 'important');
  85. q.style.setProperty('font-family', '"Press Start 2P"', 'important');
  86. q.style.setProperty('color', 'black', 'important');
  87. q.style.setProperty('padding', '15px', 'important');
  88. x = document.querySelector('tr:nth-child(1)')
  89. x.appendChild(q)
  90.  
  91. gifcontainer = document.createElement('img')
  92. gifcontainer.src = 'run3.gif'
  93. gifcontainer.style.height = '100px'
  94. gifcontainer.style.width = 'auto'
  95. document.body.insertBefore(gifcontainer, table);
  96.  
  97.  
  98.  
  99.  
  100.  
  101. values = ['Name','Kaputt', 'Appointment', 'Brutto', 'Netto', 'Grand Total']
  102. players = document.querySelectorAll('tr').length;
  103. playersdata = [];
  104. appointments = [];
  105. netto = [];
  106. for (var i = 1; i < players; i++) {
  107. playersdata.push([]);
  108. appointments.push([]);
  109. netto.push([]);
  110. for (var j = 0; j < 6; j++){
  111. if (j==5){
  112. playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].querySelector('b').innerHTML);
  113. }
  114. else{
  115. playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
  116. }
  117. if (j==2){
  118. appointments[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
  119. }
  120. if (j==4){
  121. netto[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
  122. }
  123. }
  124. }
  125.  
  126. localStorage.appointments = appointments;
  127. if (typeof localStorage.appointmentsold == 'undefined') {
  128. localStorage.appointmentsold = localStorage.appointments;
  129. }
  130. if(localStorage.appointments != localStorage.appointmentsold){
  131. var audio = new Audio('http://themushroomkingdom.net/sounds/wav/smb/smb_stage_clear.wav');
  132. audio.play();
  133. localStorage.appointmentsold = localStorage.appointments;
  134. }
  135. localStorage.netto = netto;
  136. if (typeof localStorage.nettoold == 'undefined') {
  137. localStorage.nettoold = localStorage.netto;
  138. }
  139. if(localStorage.netto != localStorage.nettoold){
  140. var audio = new Audio('http://themushroomkingdom.net/sounds/wav/smb/smb_1-up.wav');
  141. audio.play();
  142. localStorage.nettoold = localStorage.netto;
  143. }