tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1903480-ace7.acecombat.jp-slow-down-scrolling.js (924B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Bug 1903480 - Ace Combat 7's site wheel-scrolls ridiculously quickly.
      9 *
     10 * The site is intentionally scaling the value of wheel event deltaY by 30
     11 * on Firefox. We can undo that here.
     12 */
     13 
     14 /* globals exportFunction */
     15 
     16 console.info(
     17  "wheel events are being scaled down for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1903480 for details."
     18 );
     19 
     20 const proto = window.wrappedJSObject.WheelEvent.prototype;
     21 const descriptor = Object.getOwnPropertyDescriptor(proto, "deltaY");
     22 const { get } = descriptor;
     23 
     24 descriptor.get = exportFunction(function () {
     25  const value = get.call(this);
     26  return value / 30;
     27 }, window);
     28 
     29 Object.defineProperty(proto, "deltaY", descriptor);