contextmenu

context menu

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/534404/1606602/contextmenu.js

  1. ;(() => {
  2. const userAgent = navigator.userAgent.toLowerCase();
  3. const goldDictKey = parseKey(GM_getValue('goldDictKey', 'ctrl c,ctrl c'));
  4. const ocrKey = parseKey(GM_getValue('ocrKey', ['windows', 'win32', 'win64'].filter(v => userAgent.indexOf(v) > -1).length > 0 ? 'cmd alt c' : 'alt c'));
  5. const menus = GM_getValue('menus', [
  6. {
  7. title: 'ocr translate',
  8. action: {next: goldDictKey, prev: ocrKey},
  9. key: 'h',
  10. path: 'aca'
  11. },
  12. {
  13. title: "ocr",
  14. action: ocrKey,
  15. key: "k"
  16. },
  17. {
  18. title: "parse qrcode",
  19. action: 'ctrl alt x',
  20. key: "x"
  21. },
  22. {
  23. title: "anki",
  24. action: addAnki,
  25. key: "p"
  26. },
  27. {
  28. title: 'qrcode',
  29. action() {
  30. const html = document.createElement('div');
  31. html.innerHTML = createHtml(`
  32. <style>
  33. .qr-text{ width: 26vw; margin-bottom: 1vw; height: 2vw; font-size: 100%; }
  34. .qr-img img{ margin: auto }
  35. </style>
  36. <div class="qr-container">
  37. <input type="text" name="qr-text" class="qr-text" value="${location.href}">
  38. <div class="qr-img"></div>
  39. </div>`);
  40. const qr = new QRCode(html.querySelector('.qr-img'), {
  41. text: location.href,
  42. correctLevel: QRCode.CorrectLevel.L,
  43. height: 365,
  44. width: 365,
  45. });
  46. html.querySelector('.qr-text').addEventListener('change', function () {
  47. this.value && qr.makeCode(this.value);
  48. });
  49. Swal.fire({
  50. title: "<h3>qrcode</h3>",
  51. html: html,
  52. width: '32vw',
  53. });
  54. },
  55. key: 'm'
  56. }
  57. /*{
  58. title: "sh",
  59. action: {
  60. cmd: "ls -l /var/log/!*.log",
  61. },
  62. key: "e",
  63. path: "cmd",
  64. call: (res) => {
  65. console.log(res.response)
  66. },
  67. }*/
  68. /*{
  69. title: "env",
  70. action: {
  71. cmd: ["env","grep","wc"],
  72. args: [],
  73. "1": ["PATH"],
  74. "2": ["-l"],
  75. env: ["PATH=$PATH:/home/xing"]
  76. },
  77. key: "e",
  78. path: "cmd",
  79. call: (res) => {
  80. console.log(res.response)
  81. },
  82. }*/
  83. /*{
  84. title: "ls",
  85. action: {cmd: "ls", args: ["-l", "/"]},
  86. key: "e",
  87. path: "cmd",
  88. call: (res) => {
  89. console.log(res.response)
  90. },
  91. }*/
  92. ]);
  93. PushContextMenu(...menus);
  94. })();

QingJ © 2025

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