Greasy Fork is available in English.

AtCoder Solve Declaration

問題文の隣にツイートするボタンを表示します。

Verze ze dne 18. 07. 2023. Zobrazit nejnovější verzi.

  1. // ==UserScript==
  2. // @name AtCoder Solve Declaration
  3. // @version 0.1
  4. // @license MIT
  5. // @description 問題文の隣にツイートするボタンを表示します。
  6. // @author Kyo_s_s
  7. // @match https://atcoder.jp/contests/*/tasks/*
  8. // @exclude https://atcoder.jp/contests/*/tasks/*/editorial
  9. // @namespace https://greatest.deepsurf.us/users/1129958
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function createButton() {
  16. const button = document.createElement("button");
  17. button.innerHTML = "ときます宣言";
  18. button.classList.add("btn", "btn-default", "btn-sm");
  19. button.addEventListener("click", function() {
  20. const text = "ときます " + window.location.href + "\n#競プロ精進";
  21. const tweetUrl = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(text);
  22. window.open(tweetUrl);
  23. });
  24.  
  25. return button;
  26. }
  27.  
  28. function insertButton() {
  29. const title = document.querySelector(".h2");
  30. if (title) {
  31. title.appendChild(createButton());
  32. }
  33. }
  34.  
  35. window.addEventListener("load", insertButton);
  36. })();