Created
June 5, 2021 19:49
-
-
Save 12944qwerty/c4d02c344c399b6734005229f980c11c to your computer and use it in GitHub Desktop.
Adds a reply to message button in all of your own messages's popups in Stack Exchange chatrooms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Self-Reply Button | |
// @version 0.1 | |
// @description Adds a reply to message button in all of your own messages's popups in Stack Exchange chatrooms. | |
// @author 12944qwerty | |
// @include http://chat.stackoverflow.com/rooms/* | |
// @include https://chat.stackoverflow.com/rooms/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// ==/UserScript== | |
waitForKeyElements( | |
'.popup', | |
function(popup) { | |
popup = popup.get(0); | |
if (!popup.innerHTML.includes("reply to this message")) { // If it is included, it is not my own message | |
var messageID = popup.children[1].children[1].href; | |
messageID = messageID.substring(messageID.indexOf("#")+1); | |
popup.innerHTML = '<div class="btn-close">X</div><div><span title="Wed 22:06">posted 2d ago</span> – <a rel="noreferrer noopener" href="/transcript/message/52335457#52335457">permalink</a><br></div><span class="reply" onclick="(function() {var inBox = document.getElementById("input");inBox.value=":' + messageID + '" + " " + inBox.value;})();"><span class="newreply"> </span> reply to this message</span><br><br><span class="flag" title="Moderator flags are seen only by the site-moderators, and should be used to indicate serious issues with a message, and other administrative issues.">flag for moderator</span>'; | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment