主页源代码获取

获取个人主页源代码

当前为 2023-06-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 主页源代码获取
  3. // @namespace https://www.luogu.com.cn/user/486799/
  4. // @description 获取个人主页源代码
  5. // @author BlackPanda
  6. // @license MIT
  7. // @version 0.1
  8. // @match https://www.luogu.com.cn/user/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. async function user_detail(){
  15. var button = document.createElement('button');
  16. button.textContent = 'Copy';
  17. button.classList.add('red-button', 'button-size');
  18. button.addEventListener('click', async function() {
  19. var introduction = _feInstance.currentData.user.introduction;
  20. await navigator.clipboard.writeText(introduction);
  21. alert('复制成功');
  22. });
  23. var tmp = document.getElementsByClassName('card padding-default');
  24. var pos = tmp[0];
  25. pos.appendChild(button);
  26. };
  27. var style = document.createElement('style');
  28. style.textContent = `
  29. .red-button {
  30. background-color: rgba(0, 0, 0, 0.5);
  31. position: relative;
  32. display: inline-block;
  33. padding: 1px 10px 3px;
  34. color: #fff;
  35. border-radius: 6px;
  36. box-shadow: 0 0 7px #1e90ff;
  37. cursor: pointer;
  38. }
  39. .button-size {
  40. width: 75px;
  41. height: 25px;
  42. }
  43. `;
  44. document.head.appendChild(style);
  45. window.addEventListener('load', user_detail);
  46. })();

QingJ © 2025

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