[Feature] Mute User Debugging Thread

A number of reports indicate that the Mute User feature may be bugged.

Affected browsers appear to be Firefox 53-55, on Windows and Mac OSX. I was able to replicate the bug thusly:

  1. Open Multiple Cafe tabs
  2. Muted myself in a tab, then closed it.
  3. Opened thread in existing second tab.
  4. Mute script fails to execute.

I think the bug was introduced with the Battery-Saver update of the Mute Script. Attempting a fix, will report back with results.


Update: fixed!

Rewrote the code, will update the code on Github.

Key code changes:

  • move cookie name variable into main script
  • copied hide_ids so it gets ids to hide on page load
  • moved the scroll listener out of MakeMagic
  • set scroll listener so it runs MakeMagic only in topic threads
<script type="text/javascript">
var run_script = false;

    if (window.location.href.indexOf("/t/") > 0) {
        run_script = true;

if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
    this.GM_getValue=function (key,def) {
        return localStorage[key] || def;
    this.GM_setValue=function (key,value) {
        return localStorage[key]=value;
    this.GM_deleteValue=function (key) {
        return delete localStorage[key];

var GR_COOKIE_NAME = 'elsewhere_mute_users';
var hide_ids = $.parseJSON(GM_getValue(GR_COOKIE_NAME, '{}'));

document.addEventListener("wheel", function(event) { 
    setTimeout(RecastSpell, 1000);

function RecastSpell(){
    if (run_script == true) {

function MakeMagic(){
    hide_ids = $.parseJSON(GM_getValue(GR_COOKIE_NAME, '{}'));
	function handle_post_node(node){
		var tid = node.getAttribute('data-user-id');
		var name = $('[data-user-id="'+tid+'"]').find('.username a').first().text();
		function mute_foo(){
		    //var name = $(node).find('.names').text;
		    var confirmString = "Really mute " + name + "?";  
		    if (confirm(confirmString) == true) {
                this.innerHTML = "Unmute;"
			$(this).unbind('click', mute_foo);
			hide_ids[tid] = 1;
			GM_setValue(GR_COOKIE_NAME, JSON.stringify(hide_ids));
			$('[data-user-id="'+tid+'"]').each(function(){ handle_post_node(this) });
		        setTimeout(endAnimation, 3000);            

		function serveJustice() {
		    var overlay = jQuery('<div id="overlay" class="overlay"> </div>');
		function endAnimation(){
		 	$( ".overlay" ).remove();
		function umute_foo(){
		    var confirmString = "Unmute " + name + "?";  
		    if (confirm(confirmString) == true) {
			this.innerHTML = "Mute";
			$(this).unbind('click', umute_foo);
			delete hide_ids[tid];
			GM_setValue(GR_COOKIE_NAME, JSON.stringify(hide_ids));
			$('[data-user-id="'+tid+'"]').each(function(){ $(this).find('.contents').show(); handle_post_node(this) });
			if($(node).find('.umute_btn').length > 0) return;
			var btn = $('<button class="umute_btn" title="Unmute this user." style="background-color: Transparent; background-repeat:no-repeat; border: none; cursor:pointer; overflow: hidden; outline:none; margin-left: 3px; "><i class="fa fa-microphone"></i></button>');
		}else {
			if($(node).find('.mute_btn').length > 0) return;
			var btn = $('<button title="Mute this user." style="background: none;" class="mute_btn"><i class="fa fa-microphone-slash"></i></button>');
	var observer = new MutationObserver(function(mutations) {
		for(var i=0; i < mutations.length; ++i){
			var mutation = mutations[i];
			for(var j=0; j < mutation.addedNodes.length; ++j){
				if(mutation.addedNodes[j].nodeName == "#text") continue;
				var node = mutation.addedNodes[j];
				if(node.className == 'container posts'){
				// just to be sure (TODO: sometimes when jumping to a thread via notification the posts aren't handled.
				// This "hack" (should) ensure that all posts are handled )
				if(node.className == 'topic-link'){
				if(node.className == 'ember-view post-cloak'){
					node = $(node).find('article').get(0);
				if(node.nodeName == "ARTICLE" && node.getAttribute('data-user-id')){
	observer.observe(document, { subtree: true, childList: true});

Welp, new bug: mute check not running on new post. Shit.

Update: Fixed. Code in earlier post updated.


I ran into an issue. It’s replicable. When I try to bookmark a post, it also tries to mute the person who posted the thing I was trying to bookmark.

48 PM
58 PM

Chrome, Version 60.0.3112.113 (Official Build) (64-bit), on Mac OS Sierra 10.12.6 (16G29). (Running in Incognito with no plugins enabled for Incognito mode so it should be just about pristine in terms of browser environment.)

It’s not a deal breaker for me but it’s a bit irritating.

ETA: Apologies if this isn’t the best thread to report issues in. I saw the other thread but it seemed to be more philosophical discussion about muting than a good place for a bug report. :cold_sweat:


Samsung Galaxy S4 phone, with Android Lollipop 5.0.1 and stock browser… I haven’t seen the microphone/mute icon in a couple of days, at least. Of course, I’ve got a recurring caching issue that doesn’t keep track of Read posts/topics properly, so you might take any issues I report with a grain or two of salt. :wink:


Oh no. I haven’t tested on stock.

OnScroll events aren’t firing for me on Chrome (Lollipop 5, Chrome Beta). Strange stuff like Reply replacing mute after clicking the More button occurs.

Fixed. Added check for mobile devices. Mobile device now runs on a timer, executing every three seconds or so. I know there’s a jQuery .on() method I could use instead, but for now, it gets the job done.

On Earthtones, I’m currently testing moving the mute to the header, beside the date information. It doesn’t have any funky interactions there, but it is easy to overlook. (And maybe, that’s the way it should be - present and usable if needed but not in the way of conversation).

Couldn’t find a way to add it to the show-more button; there’s so much jquery abuse going on that I wasn’t able to find where in the Discourse code the show-more contents are generated. :dizzy_face:

Rolled out a new solution, that fires on the addition of new posts (or loading thereof).

Thanks to this crazy web dev: http://www.backalleycoder.com/2012/04/25/i-want-a-damnodeinserted/


I’ll fix the animation code in seven hours or so. I hit the sack

1 Like


  • Moved mute button to beside post info.
    (This should fix any bugs)
1 Like

I think it’s as you say, and a good thing.

1 Like

Button has disappeared, and previously muted poster unmuted.

Firefox for Android 55.0.2.

Will revert in ten minutes. My apologies.

1 Like

My apologies for the disruption. Issue has been resolved (restored script from known good state, applied fixes and testing).


Thread will close on Monday if no further reports if breakage are made.


Thank you for all your work on this. It is greatly appreciated!


I can report no bug. Pure feature. A great intermeidate step between muting a whole thread and muting a user in the preferences. Sometimes folks you like just fine have a thread where you don’t appreciate their contributions, and this button turns out to be a solid software backup to a wetware solution. Surely a nicer solution than telling someone they are unwelcome in a whole thread (a really controlling thing to say in a shared space), when one can just make that someone else unwelcome in ones own browser window (a really appropriate way to shut someone else up is to stop listening), for a whole thread. Genius!


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.