// ==UserScript== // @name Quick email buttons // @namespace http://snca.net/ // @version 2026-07-29 // @description snca // @author You // @match https://soyjak.st/*/index.html // @match https://soyjak.st/*/catalog.html // @match https://soyjak.st/*/thread/*.html // @icon https://www.google.com/s2/favicons?sz=64&domain=soyjak.st // @grant none // ==/UserScript== (function() { 'use strict'; // fake event so that obsessed quick reppey works const EVENT_OPTIONS = {bubbles: true, cancelable: false, composed: true}; const EVENT_INPUT = new Event("input", EVENT_OPTIONS); // post const emailField = document.querySelectorAll('[name="email"]')[0]; function buttonify(button, name, content, color) { button.type="button"; button.action="javascript:void(0);"; button.style="margin-left:2px;"; button.style.color = color; button.textContent = name; button.setAttribute('data-content', content); button.onclick = () => { emailField.value = content; emailField.dispatchEvent(EVENT_INPUT); }; } const buttonContainer = document.createElement("div"); buttonContainer.style="display:inline"; buttonContainer.classList.add("button-container"); emailField.parentElement.appendChild(buttonContainer); // clear button const clearButton = document.createElement("button"); buttonify(clearButton, "Clear", "", ""); buttonContainer.appendChild(clearButton); // supersage button const supersageButton = document.createElement("button"); buttonify(supersageButton, "SUPER SAGE!", "supersage", "red"); buttonContainer.appendChild(supersageButton); // sage button const sageButton = document.createElement("button"); buttonify(sageButton, "SAGE!", "sage", "#34345C"); buttonContainer.appendChild(sageButton); // bump button const bumpButton = document.createElement("button"); buttonify(bumpButton, "BUMP!", "bump", "#34345C"); buttonContainer.appendChild(bumpButton); // observer for quick reppey const callback = (mutationList, observer) => { for (const mutation of mutationList) { for (const addedNode of mutation.addedNodes) { if(addedNode.id == "quick-reply") { const nuContainer = document.getElementsByClassName("button-container")[1]; const nuEmailField = document.querySelectorAll('[name="email"]')[1]; for(const nuButton of nuContainer.children) { nuButton.onclick = () => { nuEmailField.value = nuButton.dataset.content; nuEmailField.dispatchEvent(EVENT_INPUT); }; } }; } } }; const observer = new MutationObserver(callback); observer.observe(document.body, { attributes: false, childList: true, subtree: false }); })();