Greasy Fork镜像 支持简体中文。

Open raw pdf file

Click on show content (Inhalt ansehen) and wait for new tab to open

  1. // ==UserScript==
  2. // @name Open raw pdf file
  3. // @namespace Violentmonkey Scripts
  4. // @match https://*knowunity.de/*
  5. // @grant none
  6. // @version 1.0
  7. // @author jside
  8. // @description Click on show content (Inhalt ansehen) and wait for new tab to open
  9. // ==/UserScript==
  10.  
  11.  
  12. const { fetch: originalFetch } = window;
  13.  
  14. window.fetch = async (...args) => { // hook all fetch requests
  15. let [resource, config ] = args;
  16.  
  17. if (resource.endsWith('.pdf')){ // intercept all requests that get a pdf file
  18. console.log('[UserScript] ' + resource)
  19. // create new tab with raw pdf
  20. window.open(resource, '_blank'); // open in new tab
  21. }
  22.  
  23. const response = await originalFetch(resource, config);
  24. // response interceptor here
  25. return response;
  26. };

QingJ © 2025

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