New Userscript

Возвращает кнопку игнора навсегда

  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Возвращает кнопку игнора навсегда
  6. // @author You
  7. // @match https://pikabu.ru/@*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=pikabu.ru
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (() => {
  14. setTimeout(() => {
  15. const profileId = document.querySelector(".profile").getAttribute("data-user-id")
  16. const btn = document.createElement("span")
  17. btn.setAttribute("class", "button")
  18. btn.setAttribute("style", "margin-right: 10px;")
  19. btn.addEventListener("click", async () => {
  20. const a = await fetch("https://pikabu.ru/ajax/ignore_actions.php", {
  21. "headers": {
  22. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  23. "x-requested-with": "XMLHttpRequest"
  24. },
  25. "body": `authors=${profileId}&communities=&tags=&keywords=&story_id=0&period=forever&action=add_rule`,
  26. "method": "POST",
  27. });
  28. alert((await a.json()).message || "Успешно!")
  29. })
  30. btn.innerText = "Скрыть посты навсегда"
  31.  
  32. document.querySelector(".profile__user-button").prepend(btn)
  33. }, 1000)
  34. })()