Disable Scroll Event in Google Slides When Using Touchpad

Removes scroll event from #workspace-container in Google Slides when a touchpad is detected.

  1. // ==UserScript==
  2. // @name Disable Scroll Event in Google Slides When Using Touchpad
  3. // @namespace https://github.com/Enchoseon/enchos-assorted-userscripts/raw/main/disable-scroll-event-in-google-slides-when-using-touchpad.user.js
  4. // @version 1.0.0
  5. // @description Removes scroll event from #workspace-container in Google Slides when a touchpad is detected.
  6. // @author Enchoseon
  7. // @include *docs.google.com/presentation/d/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. "use strict";
  13. function killScrollEvent() {
  14. if (document.getElementById("workspace-container") !== null) {
  15. window.addEventListener(
  16. "wheel",
  17. function (event) {
  18. event.stopImmediatePropagation();
  19. },
  20. true
  21. );
  22. }
  23. }
  24. function detectTrackPad(e) { // https://stackoverflow.com/a/62415754
  25. if (e.wheelDeltaY) {
  26. if (e.wheelDeltaY === (e.deltaY * -3)) {
  27. killScrollEvent();
  28. }
  29. } else if (e.deltaMode === 0) {
  30. killScrollEvent();
  31. }
  32. }
  33. document.addEventListener("mousewheel", detectTrackPad, false);
  34. document.addEventListener("DOMMouseScroll", detectTrackPad, false);
  35. })();