nc pdf header hide

nextcloud pdf header hide

  1. // ==UserScript==
  2. // @namespace yunyuyuan
  3. // @name nc pdf header hide
  4. // @description nextcloud pdf header hide
  5. // @match *://*.yunyuyuan.net/*
  6. // @version 0.0.1.1
  7. // @license MIT
  8. // ==/UserScript==
  9.  
  10. (function () {
  11. 'use strict';
  12. let hided = false;
  13. document.addEventListener('keydown', (e) => {
  14. const container = document.querySelector('div[data-handler="pdf"]');
  15. if (container && e.key === '1'){
  16. const modalHeader = container.querySelector('.modal-header');
  17. const modalContainer = container.querySelector('.modal-container');
  18. const iframe = container.querySelector('iframe');
  19. if (!hided) {
  20. modalHeader.style.opacity = "0";
  21. modalHeader.style.zIndex = "0";
  22. modalContainer.style.top = "0";
  23. modalContainer.style.bottom = "0";
  24. iframe.style.height = '100%';
  25. hided = true;
  26. } else {
  27. hided = false;
  28. modalHeader.style.opacity = "1";
  29. modalHeader.style.zIndex = "10001";
  30. modalContainer.style.top = "var(--header-height)";
  31. modalContainer.style.bottom = "var(--header-height)";
  32. iframe.style.height = 'calc(100vh - var(--header-height))';
  33. }
  34. }
  35. })
  36. })()