Adds the OP's username in the [name] slot when pasting snippets for comments on GD.SE
Από την
// ==UserScript==
// @name GraphicDesign.StackExchange comment snippet adds username
// @namespace https://zachsaucier.com/
// @version 0.1
// @description Adds the OP's username in the [name] slot when pasting snippets for comments on GD.SE
// @author Zach Saucier
// @match https://graphicdesign.stackexchange.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.body.addEventListener("keyup", (e) => {
let elem = e.target,
opName = document.querySelector(".owner .user-details a").innerText;
if(elem.name === "comment") {
elem.value = elem.value.replace(/\[user\]/g, opName);
}
});
})();