nc pdf header hide

nextcloud pdf header hide

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @namespace yunyuyuan
// @name nc pdf header hide
// @description nextcloud pdf header hide
// @match *://*.yunyuyuan.net/*
// @version 0.0.1.1
// @license MIT
// ==/UserScript==

(function () {
  'use strict';
  let hided = false;
  document.addEventListener('keydown', (e) => {
    const container = document.querySelector('div[data-handler="pdf"]');
    if (container && e.key === '1'){
      const modalHeader = container.querySelector('.modal-header');
      const modalContainer = container.querySelector('.modal-container');
      const iframe = container.querySelector('iframe');
      if (!hided) {
        modalHeader.style.opacity = "0";
        modalHeader.style.zIndex = "0";
        modalContainer.style.top = "0";
        modalContainer.style.bottom = "0";
        iframe.style.height = '100%';
        hided = true;
      } else {
        hided = false;
        modalHeader.style.opacity = "1";
        modalHeader.style.zIndex = "10001";
        modalContainer.style.top = "var(--header-height)";
        modalContainer.style.bottom = "var(--header-height)";
        iframe.style.height = 'calc(100vh - var(--header-height))';
      }
    }
  })
})()