Find User

You can use /user/ztrztr to find the user called "ztrztr"!

  1. // ==UserScript==
  2. // @name Find User
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description You can use /user/ztrztr to find the user called "ztrztr"!
  6. // @author ztrztr
  7. // @match *://*.www.luogu.com.cn/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=luogu.com.cn
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var url = window.location.href;
  15. //User Finder
  16. var res = url.split("/");
  17. if (res[3] == "user") {
  18. fetch('https://www.luogu.com.cn/api/user/search?keyword=' + res[4])
  19. .then(response => response.json())
  20. .then(data => {
  21. console.log(data.users[0]);
  22. var dataa = data.users[0]
  23. console.log(dataa.uid);
  24. if (data.users.length == 0) window.location.replace("https://www.luogu.com.cn/");
  25. if (res[4] != dataa.uid.split("#")[0]) {
  26. window.location.replace("https://www.luogu.com.cn/user/" + dataa.uid);
  27. }
  28. });
  29. }
  30. //Auto-Message sender
  31. setInterval(function() {
  32. fetch('https://www.luogu.com.cn/chat?_contentOnly')
  33. .then(response => response.json())
  34. .then(data => {
  35. window.addEventListener("keydown", function(event) {
  36. if (event.ctrlKey && event.key === "'") {
  37. fetch("https://www.luogu.com.cn/api/chat/clearUnread", {
  38. headers: [
  39. ["content-type", "application/json"],
  40. ["referer", "https://www.luogu.com.cn/"],
  41. ["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
  42. ],
  43. body: JSON.stringify({
  44. user: data.currentData.latestMessages.result[0].sender.uid,
  45. content: "[Auto-reply]This OIer was coding,pls conntect him or her later!",
  46. }),
  47. method: "POST",
  48. });
  49. }
  50. });
  51. if (localStorage.getItem("msgCnt") == 0) localStorage.setItem("msgCnt", data.currentData.latestMessages.result.length);
  52.  
  53. if (data.currentData.latestMessages.result.length != localStorage.getItem("msgCnt")) {
  54. fetch("https://www.luogu.com.cn/api/chat/new", {
  55. headers: [
  56. ["content-type", "application/json"],
  57. ["referer", "https://www.luogu.com.cn/"],
  58. ["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
  59. ],
  60. body: JSON.stringify({
  61. user: data.currentData.latestMessages.result[0].sender.uid,
  62. content: "[Auto-reply]This OIer was coding,pls conntect him or her later!",
  63. }),
  64. method: "POST",
  65. });
  66. }
  67. });
  68. }, 1000);
  69. })();

QingJ © 2025

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