Disable Outlook Reading Pane Zooming

as the name states

  1. // ==UserScript==
  2. // @name Disable Outlook Reading Pane Zooming
  3. // @license MIT
  4. // @namespace http://gf.qytechs.cn/
  5. // @version 0.2
  6. // @description as the name states
  7. // @author You
  8. // @match https://outlook.office.com/mail/*
  9. // @match https://outlook.office365.com/mail/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=office.com
  11. // @grant none
  12. // @run-at document-idle
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17.  
  18. // Remember the previous paneDiv element
  19. let previousPaneDiv = null;
  20.  
  21. // Define the callback function to execute when the paneDiv element is created
  22. const onPaneDivCreated = function (mutationsList, observer) {
  23. for (let mutation of mutationsList) {
  24. if (mutation.type === "childList" && mutation.addedNodes.length) {
  25. // If the addedNodes list contains the paneDiv element, execute the code block
  26. const currentPaneDiv = document.querySelector(
  27. "#ReadingPaneContainerId > div > div > div"
  28. );
  29.  
  30. if (currentPaneDiv && currentPaneDiv !== previousPaneDiv) {
  31. // Remove the event listener from the previous paneDiv element
  32. if (previousPaneDiv) {
  33. previousPaneDiv.removeEventListener("wheel", stopPropagation, true);
  34. }
  35.  
  36. // Add the event listener to the current paneDiv element
  37. currentPaneDiv.addEventListener("wheel", stopPropagation, true);
  38.  
  39. // Remember the current paneDiv element as the previous one
  40. previousPaneDiv = currentPaneDiv;
  41. }
  42. }
  43. }
  44. };
  45.  
  46. // Define the function to stop event propagation
  47. const stopPropagation = function (e) {
  48. e.stopPropagation();
  49. };
  50.  
  51. // Create a new MutationObserver object and pass in the callback function
  52. const observer = new MutationObserver(onPaneDivCreated);
  53.  
  54. // Configure the observer to watch for changes to the parent of the paneDiv element
  55. const config = { childList: true, subtree: true };
  56. const parentElement = document;
  57.  
  58. // Start observing the parent element for changes
  59. observer.observe(parentElement, config);
  60. })();

QingJ © 2025

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