qBittorrent Web UI clipboard support

Adds ctrl+v support to qBittorrent's Web UI, if a magnet link is in your clipboard it automatically adds the torrent.

  1. // ==UserScript==
  2. // @name qBittorrent Web UI clipboard support
  3. // @name:zh-TW qBittorrent Web UI 剪貼簿支援
  4. // @namespace https://github.com/axzxc1236/
  5. // @version 0.1
  6. // @description Adds ctrl+v support to qBittorrent's Web UI, if a magnet link is in your clipboard it automatically adds the torrent.
  7. // @description:zh-tw 對qBittorrent的Web UI新增了貼上(ctrl+v)的支援,如果腳本在你的剪貼簿偵測到磁力連結,會自動新增種子
  8. // @author axzxc1236
  9. // @match https://127.0.0.1:8080/
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. navigator.permissions.query({
  18. name: 'clipboard-read'
  19. }).then(permissionStatus => {
  20. // Will be 'granted', 'denied' or 'prompt':
  21. if (permissionStatus.state == "denied") {
  22. alert("Clipboard permission is denied, this script will not work until you change that");
  23. }
  24. });
  25. document.addEventListener('paste', function(data) {
  26. var text = data.clipboardData.getData("text");
  27. if (text.startsWith("magnet:?xt=")) {
  28. document.getElementById('downloadButton').click();
  29. document.getElementById("downloadPage_iframe").contentDocument.body.onload = function() {
  30. this.document.body.getElementById("urls").innerText = text;
  31. this.document.body.getElementById("submitButton").click();
  32. };
  33. }
  34. });
  35. })();

QingJ © 2025

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