Reposition replay stats script

moves replay stats to the left

目前為 2019-07-10 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Reposition replay stats script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.22
  5. // @description moves replay stats to the left
  6. // @author Oki
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /******************************
  12. Reposition replay stats script
  13. ******************************/
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. window.addEventListener('load', function(){
  19.  
  20. var website = "jstris.jezevec10.com"
  21. var url = window.location.href
  22. var parts = url.split("/")
  23.  
  24. if(parts[3]=="replay" && parts[2].endsWith(website) && parts.length>4){
  25.  
  26. if(parts[4]!="1v1"){
  27.  
  28.  
  29. var stats = [document.querySelector("#stats table"),document.querySelector(".moreStats")]
  30. var mainCanvas = myCanvas.getBoundingClientRect()
  31.  
  32. //var vertPos = myCanvas.getBoundingClientRect().left - 900
  33. //var horPos = myCanvas.getBoundingClientRect().bottom - 100
  34.  
  35. var vertPos = -200
  36. var horPos = 400
  37.  
  38. var values = ["absolute","absolute",vertPos+"px",vertPos+"px",horPos+"px",horPos+(stats[0].offsetHeight)+"px"]
  39. var attributes = ["position","left","top"]
  40.  
  41. for (var i = 0; i < 6; i++) {
  42. eval('setTimeout(x=>{stats['+i%2+'].style.'+attributes[(i/2)|0]+' = "'+values[i]+'"},'+i*10+')')
  43. }
  44.  
  45.  
  46. }
  47. }
  48.  
  49.  
  50. });
  51. })();