GraphicDesign.StackExchange comment snippet adds username

Adds the OP's username in the [name] slot when pasting snippets for comments on GD.SE

目前为 2018-10-14 提交的版本。查看 最新版本

// ==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);
        }
    });
})();

QingJ © 2025

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