GeoNoCar liter

Hides part of the panorama to redact non-trekker gen 3/4 car meta

  1. // ==UserScript==
  2. // @name GeoNoCar liter
  3. // @description Hides part of the panorama to redact non-trekker gen 3/4 car meta
  4. // @version 0.2.2
  5. // @author victheturtle#5159
  6. // @match https://www.geoguessr.com/*
  7. // @namespace https://greasyfork.org/users/967692-victheturtle
  8. // @icon https://www.svgrepo.com/show/180174/pickup-truck-transport.svg
  9. // @run-at document-start
  10. // @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
  11. // @noframes
  12. // ==/UserScript==
  13.  
  14. // credits to drparse for the original GeoNoCar script
  15.  
  16. function injected() {
  17. const color = "vec3(float(0.3), float(0.3), float(0.3))";
  18.  
  19. const vertexOld = "const float f=3.1415926;varying vec3 a;uniform vec4 b;attribute vec3 c;attribute vec2 d;uniform mat4 e;void main(){vec4 g=vec4(c,1);gl_Position=e*g;a=vec3(d.xy*b.xy+b.zw,1);a*=length(c);}";
  20. const fragOld = "precision highp float;const float h=3.1415926;varying vec3 a;uniform vec4 b;uniform float f;uniform sampler2D g;void main(){vec4 i=vec4(texture2DProj(g,a).rgb,f);gl_FragColor=i;}";
  21.  
  22. const vertexNew = `
  23. varying vec3 a;
  24. varying vec3 potato;
  25. uniform vec4 b;
  26. attribute vec3 c;
  27. attribute vec2 d;
  28. uniform mat4 e;
  29.  
  30. void main(){
  31. vec4 g=vec4(c,1);
  32. gl_Position=e*g;
  33. a = vec3(d.xy * b.xy + b.zw,1);
  34. a *= length(c);
  35. potato = vec3(d.xy, 1.0) * length(c);
  36. }`;
  37. const fragNew = `
  38. precision highp float;
  39. varying vec3 a;
  40. varying vec3 potato;
  41. uniform vec4 b;
  42. uniform float f;
  43. uniform sampler2D g;
  44.  
  45. bool show(float alpha1, float alpha2) {
  46. float alpha3 = abs(alpha1 - 0.5);
  47. float alpha4 = (alpha3 > 0.25) ? 0.5 - alpha3 : alpha3;
  48. if (alpha2 + 3.0 * alpha4 * alpha4 > 0.73) {
  49. return false;
  50. } else if (alpha4 < 0.0062) {
  51. return alpha2 > 0.63;
  52. } else if (alpha4 < 0.0066) {
  53. return alpha2 > mix(0.63, 0.67, (alpha4-0.0062) / (0.0066-0.0062));
  54. } else if (alpha4 < 0.065) {
  55. return alpha2 > 0.67;
  56. } else if (alpha4 < 0.10) {
  57. return alpha2 > mix(0.67, 0.715, (alpha4-0.065) / (0.10-0.065));
  58. } else {
  59. return false;
  60. }
  61. }
  62.  
  63. void main(){
  64. vec2 aD = potato.xy / a.z;
  65. vec4 i = vec4(show(aD.x, aD.y) ? ${color} : texture2DProj(g,a).rgb, f);
  66. gl_FragColor=i;
  67. }`;
  68.  
  69. function installShaderSource(ctx) {
  70. const oldShaderSource = ctx.shaderSource;
  71. function shaderSource() {
  72. if (typeof arguments[1] === 'string') {
  73. if (arguments[1] === vertexOld) arguments[1] = vertexNew;
  74. else if (arguments[1] === fragOld) arguments[1] = fragNew;
  75. }
  76. return oldShaderSource.apply(this, arguments);
  77. }
  78. shaderSource.bestcity = 'bintulu';
  79. ctx.shaderSource = shaderSource;
  80. }
  81. function installGetContext(el) {
  82. const oldGetContext = el.getContext;
  83. el.getContext = function() {
  84. const ctx = oldGetContext.apply(this, arguments);
  85. if ((arguments[0] === 'webgl' || arguments[0] === 'webgl2') && ctx && ctx.shaderSource && ctx.shaderSource.bestcity !== 'bintulu') {
  86. installShaderSource(ctx);
  87. }
  88. return ctx;
  89. };
  90. }
  91. const oldCreateElement = document.createElement;
  92. document.createElement = function() {
  93. const el = oldCreateElement.apply(this, arguments);
  94. if (arguments[0] === 'canvas' || arguments[0] === 'CANVAS') {
  95. installGetContext(el);
  96. }
  97. return el;
  98. };
  99. }
  100.  
  101. var script = document.createElement("script");
  102. script.textContent = `(${injected.toString()})()`;
  103. document.body.appendChild(script);