Greasy Fork is available in English.

[user] to OP's name on StackExchange sites

Changes [user] to the OP's username when commenting on StackExchange sites

Från och med 2018-10-14. Se den senaste versionen.

  1. // ==UserScript==
  2. // @name [user] to OP's name on StackExchange sites
  3. // @namespace https://zachsaucier.com/
  4. // @version 0.3
  5. // @description Changes [user] to the OP's username when commenting on StackExchange sites
  6. // @author Zach Saucier
  7. // @match https://*.stackexchange.com/*
  8. // @match https://stackoverflow.com/*
  9. // @match https://meta.stackoverflow.com/*
  10. // @match https://superuser.com/*
  11. // @match https://meta.superuser.com/*
  12. // @match https://askubuntu.com/*
  13. // @match https://meta.askubuntu.com/*
  14. // @match https://serverfault.com/*
  15. // @match https://meta.serverfault.com/*
  16. // @match https://mathoverflow.net/*
  17. // @match https://meta.mathoverflow.net/*
  18. // @match https://stackapps.com/*
  19. // @match https://meta.stackapps.com/*
  20. // @grant none
  21. // ==/UserScript==
  22.  
  23. (function() {
  24. 'use strict';
  25.  
  26. document.body.addEventListener("keyup", (e) => {
  27. let elem = e.target,
  28. opName = "[user]";
  29.  
  30. if(document.querySelector(".owner .user-details a")) {
  31. opName = document.querySelector(".owner .user-details a").innerText;
  32. }
  33.  
  34. if(elem.name === "comment") {
  35. elem.value = elem.value.replace(/\[user\]/g, opName);
  36. }
  37. });
  38. })();