Luogu 首页置顶助手

Luogu 首页顶部置顶任意链接(1个)

  1. // ==UserScript==
  2. // @name Luogu 首页置顶助手
  3. // @namespace http://tampermonkey.net/
  4. // @license MIT
  5. // @version 1.3.1
  6. // @description Luogu 首页顶部置顶任意链接(1个)
  7. // @author zz07
  8. // @match https://www.luogu.org
  9. // @match https://www.luogu.com.cn
  10. // @require https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
  11. // @grant GM_getValue
  12. // @grant GM_setValue
  13. // ==/UserScript==
  14.  
  15.  
  16.  
  17. (function() {
  18. 'use strict';
  19. $(function(){
  20. function setLink()
  21. {
  22. var link = prompt("请输入链接地址(点按取消以不变)");
  23. if (link == undefined)
  24. { return; }
  25. var text = prompt("请输入链接文字");
  26. GM_setValue("user_link", link);
  27. GM_setValue("user_link_text", text);
  28. location.reload();
  29. }
  30. var title = $(".link-container");
  31. var prelink = GM_getValue("user_link");
  32. var pretext = GM_getValue("user_link_text")
  33. var link = '<a data-v-44f42e53="" data-v-02d4dc3d="" href="' + prelink + '" target="_blank" class="header-link color-none"><span data-v-02d4dc3d="" data-v-44f42e53="" style="color: rgb(38, 38, 38);">' + pretext + '</span></a>';
  34. var button = document.createElement("button");
  35. button.innerText = '编辑';
  36. button.className = 'am-btn am-btn-sm am-btn-primary'
  37. button.addEventListener('click', setLink);
  38. var helper = '<span data-v-86f2b1fc data-v-5b9d45a0 class="helper"></span>';
  39. console.log(button);
  40. if (pretext != undefined)
  41. {
  42. title.append(link, helper);
  43. }
  44. title.append(button, helper);
  45. });
  46. })();

QingJ © 2025

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