AAAAA-复制标题-到memory.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // ==UserScript==
  2. // @name AAAAA-复制标题-到memory
  3. // @namespace Violentmonkey Scripts
  4. // @icon https://memory.tianyunperfect.cn/pro_icon.svg
  5. // @match *://*/*
  6. // @grant GM_registerMenuCommand
  7. // @version 1.0
  8. // @author tianyunperfect
  9. // @require https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
  10. // @require https://git.tianyunperfect.cn/tianyunperfect/web-base/raw/master/monkey/util.js?a=2022年10月17日14:12:19
  11. // @description 2021/1/30 下午7:09:51
  12. // ==/UserScript==
  13. (function () {
  14. 'use strict';
  15. // GM_registerMenuCommand("!!!复制并加到memory", to_memory)
  16. GM_registerMenuCommand("!!!复制标题和 url", copyTitle)
  17. // function to_memory() {
  18. // let url = location.href;
  19. // let title = document.title;
  20. // if (window.self !== window.top) {
  21. // return
  22. // }
  23. // let body = {
  24. // "back": "<p></p>",
  25. // "front": `<p>url: <a href="${url}">${title}</a></p>`,
  26. // "period": 0,
  27. // "onlyText": "",
  28. // "remindTime": new Date(),
  29. // "tag": "",
  30. // "updateTime": "",
  31. // "userId": 1
  32. // };
  33. // let memory_url = "https://memory.tianyunperfect.cn/api/memory-64B206F1-E915-4298-9AB7-9C561040B012/insert";
  34. // axios.post(memory_url, body).then((res) => {
  35. // console.log(res.data);
  36. // let data = res.data;
  37. // if (data.success) {
  38. //
  39. // } else {
  40. // alert(data.message);
  41. // }
  42. // })
  43. // myAlert(`${title}<br/>${location.host}`, 2)
  44. // }
  45. // function copyTitle() {
  46. // myCopy(`<a href="${location.href}">${document.title}</a>`)
  47. // }
  48. // unsafeWindow.to_memory = to_memory;
  49. addJSFile("//cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.11/clipboard.min.js");
  50. document.onkeydown = function (ev) {
  51. if (ev.key === 'c' && ev.shiftKey) {
  52. ev.preventDefault();
  53. copyTextToClipboard(document.title, location.href);
  54. }
  55. }
  56. })();