1

A few hours ago, the system was changed to show the comment delete button as the word "Delete" rather than the gray X that it's been using for years. However, I find this a little intrusive and distracting, and it'd be great if I could change it back to the old gray X.

Can someone please write me a script that will change it back?

4

Here is a GreaseMonkey script I threw together:

// ==UserScript==
// @name     Old Comment Delete Button
// @version  1.1.0
// @grant    none
// @author   a stone arachnid
// @include  https://*stackoverflow.com/*
// @include  https://*superuser.com/*
// @include  https://*serverfault.com/*
// @include  https://*stackapps.com/*
// @include  https://*askubuntu.com/*
// @include  https://*mathoverflow.net/*
// @include  https://*stackexchange.com/*
// @require  https://gist.githubusercontent.com/BrockA/2625891/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js
// ==/UserScript==

(function(){
    var styles = `
.comment-delete,.comment-delete:hover,.comment-delete:focus{
  margin:0;
  line-height:1;
  width:14px;
  height:14px;
  background:rgba(36,39,41,0.25);
  border-radius:7px;
  box-sizing:border-box;
  padding:2px;
  color:white!important;
  display:none;
}
.comment:hover .comment-delete,.comment-delete:focus{
  display:inline;
}
.comment-delete:hover{
  background:rgba(36,39,41,0.6);
}
.comment-delete:active{
  background:rgba(127,0,0,1)!important;
}
.comment-delete:focus{
  box-shadow:none;
}
`,svg='<svg class="svg-icon va-text-bottom iconClearSm" width="14" height="14" viewBox="0 0 20 20"><path d="M12 3.41L10.59 2 7 5.59 3.41 2 2 3.41 5.59 7 2 10.59 3.41 12 7 8.41 10.59 12 12 10.59 8.41 7z"></path></svg>';
    StackExchange.ready(function(){
        $("<style></style>").text(styles).appendTo("head");
        $(".comment-delete").removeClass("fc-red-600").html(svg);
    });
    waitForKeyElements(".comment",function(jNode){
        $(jNode).find(".comment-delete").removeClass("fc-red-600").html(svg);
    })
})();
  • After posting or editing a comment, the delete button shows with a "D" instead of an X symbol. Can you please fix it? – gparyani Feb 6 at 10:53
  • 1
    DOMNodeInserted has been deprecated for years. Use waitForKeyElements or MutationObserver instead. ... Also, if you switch to Tampermonkey or Violentmonkey, all of that with_jquery stuff is not needed .(One of many flaws in Greasemonkey 4+ requires it, which is ironic as Greasemonkey was the one to bastardize the sandbox and grant none in the first place). – Brock Adams Feb 7 at 3:29
  • Didn't work. New version freezes the page for a few seconds before the comment gets posted. Also, out of curiosity, why did you remove MathOverflow from the list of included sites? – gparyani Feb 7 at 3:31
  • @gparyani I have updated. – a stone arachnid Feb 8 at 3:24
  • 1
    Thanks! It works now. – gparyani Feb 8 at 3:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .