Krew.io Anti-Lag

A lag customizer for krew.io

  1. // ==UserScript==
  2. // @name Krew.io Anti-Lag
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0.2
  5. // @description A lag customizer for krew.io
  6. // @author DamienVesper
  7. // @match *://krew.io/*
  8. // @match *://*.krew.io/*
  9. // @exclud *://beta.krew.io/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. /*
  14. Copyright DamienVesper 2019
  15. Liscensed under the Apache 2.0 Liscence.
  16. All rights reserved.
  17. */
  18.  
  19. (function() {
  20. 'use strict';
  21. var newW = 1;
  22. var newH = 1;
  23.  
  24. function keyController(e) {
  25. if(document.activeElement.tagName.toLowerCase() == `input`) return;
  26. else {
  27. let regCanvas = document.querySelectorAll(`canvas`)[0];
  28. let mapCanvas = document.querySelectorAll(`canvas`)[1];
  29. let regGL = regCanvas.getContext(`2d`);
  30. let mapGL = mapCanvas.getContext(`2d`);
  31.  
  32. switch(e.keyCode) {
  33. case 189 || 107:
  34. newW *= 1.25;
  35. newH *= 1.25;
  36.  
  37. regCanvas.width = newW;
  38. regCanvas.height = newH;
  39.  
  40. mapCanvas.width = newW;
  41. mapCanvas.height = newH;
  42.  
  43. regGL.viewport(0, 0, newW, newH);
  44. mapGL.viewport(0, 0, newW, newH);
  45. break;
  46. case 187 || 109:
  47. newW /= 1.25;
  48. newH /= 1.25;
  49.  
  50. regCanvas.width = newW;
  51. regCanvas.height = newH;
  52.  
  53. mapCanvas.width = newW;
  54. mapCanvas.height = newH;
  55.  
  56. regGL.viewport(0, 0, newW, newH);
  57. mapGL.viewport(0, 0, newW, newH);
  58. break;
  59. default:
  60. return console.log(`Key ${e.keyCode} typed.`);
  61. }
  62. }
  63. }
  64.  
  65. document.addEventListener(`keydown`, function(e){keyController(e);});
  66. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址