AtCoder HashTag Setter

Add Twitter HashTag to share button on AtCoder

  1. // ==UserScript==
  2. // @name AtCoder HashTag Setter
  3. // @namespace https://atcoder.jp/
  4. // @version 1.1
  5. // @description Add Twitter HashTag to share button on AtCoder
  6. // @author G4NP0N
  7. // @match https://atcoder.jp/contests/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. window.onload = function() {
  12. var url = location.href.split("/");
  13. if(url.length < 5)return;
  14. var contestId = location.href.replace(/-/g,"_").split("/")[4];
  15. var problemId;
  16. var txt = document.getElementsByClassName("a2a_kit")[0].getAttribute("data-a2a-title");
  17. txt += " #AtCoder_";
  18. if(url.length==7){
  19. if(url[5]=="tasks"){
  20. txt +=url[6];
  21. }else if(url[5]=="submissions" && url[6]!="me"){
  22. txt += document.querySelector("#main-container > div.row > div:nth-child(2) > div:nth-child(9) > table > tbody > tr:nth-child(2) > td > a").getAttribute("href").split("/")[4];
  23. }else{
  24. txt+=contestId;
  25. }
  26. }else{
  27. txt += contestId;
  28. }
  29. document.getElementsByClassName("a2a_kit")[0].setAttribute("data-a2a-title",txt);
  30. };

QingJ © 2025

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