Google Docs - Force Center Document View

force center align of page display on Google Docs

  1. // ==UserScript==
  2. // @name Google Docs - Force Center Document View
  3. // @namespace https://zachhardesty.com
  4. // @author Zach Hardesty <zachhardesty7@users.noreply.github.com> (https://github.com/zachhardesty7)
  5. // @description force center align of page display on Google Docs
  6. // @copyright 2019, Zach Hardesty (https://zachhardesty.com/)
  7. // @license GPL-3.0-only; http://www.gnu.org/licenses/gpl-3.0.txt
  8. // @version 0.1.3
  9.  
  10. // @homepageURL https://github.com/zachhardesty7/tamper-monkey-scripts-collection/raw/master/google-docs-force-center.user.js
  11. // @homepageURL https://openuserjs.org/scripts/zachhardesty7/Google_Docs_-_Force_Center_Document_View
  12. // @supportURL https://github.com/zachhardesty7/tamper-monkey-scripts-collection/issues
  13.  
  14.  
  15. // @match https://docs.google.com/document/*
  16. // ==/UserScript==
  17.  
  18. window.addEventListener("load", centerDocs, false)
  19.  
  20. function centerDocs() {
  21. document
  22. .querySelector(".kix-appview-editor")
  23. .setAttribute("style", "overflow-x: hidden")
  24.  
  25. setInterval(() => {
  26. document.querySelector(".kix-appview-editor").scrollLeft =
  27. (document.querySelector(".kix-zoomdocumentplugin-outer").scrollWidth -
  28. document.querySelector(".kix-appview-editor").clientWidth) /
  29. 2
  30. }, 250)
  31. }