Not sure why it’s not working. When I’m sober, I’ll take a look into what and why.
I think you should do it while drunk.
I’m mostly steady now. I’ll scrabble around for a computer and see if I can’t locate the problem. The code at the moment should be the same-ish as it is on github (with the exception of checkSize - which exists only on Earthtones).
EDIT:
Code is working on Pale Moon (Firefox 27 fork) and on Chrome. I wonder if it’s a problem mainly on Firefox 57.
Well, 55 is what’s released, not 57. I’m running 57 and it works fine. I test muted you. Figuring out how to unmute was more of a challenge.
I’ve been enjoying this new feature – thank you! – but now think I’ve found an issue that I haven’t seen mentioned so far: it seems to only work in the original thread. When going to a new thread, the hidden poster re-appears. In other words, the hiding seems to be thread-specific. Is that right, or is that just me? (Mac, Firefox 55.0.3)
UPDATE:
Managed to replicate bug. Attempting to fix bug. See thread here for more info:
ORIGINAL POST:
It shouldn’t be thread specific. I don’t have a Mac to test on, but mute seems to be working as designed across the following setups:
Theme: Earthtones
(Working) Firefox 55 / Windows 7
(Working) Pale Moon 27 / Windows 7
(Working) Chrome Current / Windows 7
(Working) Chrome Current / Android
(Working) Firefox Focus / Android
Theme: Default Dark
(Working) Firefox 55 / Windows 7
(Working) Pale Moon 27 / Windows 7
(Working) Chrome Current / Windows 7
(Working) Chrome Current / Android
(Working) Firefox Focus / Android
I recommend closing any open Cafe tabs, opening one tab, and muting the trouble user. Alternatively, after muting somebody, reload all Cafe tabs to see it take effect.
Making it thread specific might be a great idea. I don’t take anything from online too too personally, but I don’t mind the notion that I could filter out someone I think is acting in bad faith on a subject they don’t even realize they’re kind of hung up on - or just repeating themselves.
Time will tell, thanks for the efforts!
Hm. I think I could do something like that, I’m just out of creative juice today.
Thank you!
It can also simply be a tool to avoid wasting one’s time. I’m not removing myself from the NYT “community” by avoiding Ross Douthat or David Brooks.
And now it’s not working… S7 / Android / Chrome.
99 bug reports on the wall
99 bug reports
take one down and patch it around
107 bug reports on the wall
edit to add:
tested, working on chrome (android lollipop), all themes
And, you’d be stating an affinity FOR them, if you said you were doing so, made sure we knew, acted generally like it was their loss that your mind would no longer be digesting their words.
If you avoid them and don’t need approval for it, (as you do) then we’re on the same page.
Given the opinions held about the nyt by people here that I respect, acknowledging that I read it isn’t a fishing trip for compliments.
Maybe I’m not parsing your comment properly.
but it’s so easy to parse (no it isn’t)
The only compliment is my observation that you’re not tootin your own horn at all, to clarify that you’re not who I was referring to (someone who was).
I read lots of stuff, glad you do too.
@tinoesroho I run a Discourse-powered forum and am constantly being asked for this feature. Is it available as a plugin, or just on this theme?
@Fallhammer:
Thank you for reaching out to us!
It can be added to any theme.
To do so, head into your admin panel. Choose customize, then pick a theme. Choose edit CSS. Click the head tab. Then paste the following. Make sure to change the cookie name to avoid any gnarly interactions with other sites. Click save, and you’re done. Repeat for each theme:
<script type="text/javascript">
var run_script = false;
$(document).ready(function(){
if (window.location.href.indexOf("/t/") > 0) {
run_script = true;
MakeMagic();
}
});
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 = 'discourse_mute_users';
var hide_ids = $.parseJSON(GM_getValue(GR_COOKIE_NAME, '{}'));
(function(){
event = function(event){
if (event.animationName == 'nodeInserted') {
RecastSpell();
}
}
document.addEventListener('animationstart', event, false);
document.addEventListener('MSAnimationStart', event, false);
document.addEventListener('webkitAnimationStart', event, false);
})();
function RecastSpell(){
if (run_script == true) {
MakeMagic();
}
}
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;"
$(node).find('.contents').hide();
$(node).find('.names').hide();
$(node).find('.avatar').hide();
$(this).unbind('click', mute_foo);
$(this).click(umute_foo);
hide_ids[tid] = 1;
GM_setValue(GR_COOKIE_NAME, JSON.stringify(hide_ids));
$('[data-user-id="'+tid+'"]').find('.mute_btn').remove();
$('[data-user-id="'+tid+'"]').each(function(){ handle_post_node(this) });
}
}
function umute_foo(){
var confirmString = "Unmute " + name + "?";
if (confirm(confirmString) == true) {
this.innerHTML = "Mute";
$(node).find('.contents').show();
$(node).find('.names').show();
$(node).find('.avatar').show();
$(this).unbind('click', umute_foo);
$(this).click(mute_foo);
delete hide_ids[tid];
GM_setValue(GR_COOKIE_NAME, JSON.stringify(hide_ids));
$('[data-user-id="'+tid+'"]').find('.umute_btn').remove();
$('[data-user-id="'+tid+'"]').each(function(){ $(this).find('.contents').show(); handle_post_node(this) });
}
}
if(hide_ids[tid]){
$(node).find('.contents').hide();
$(node).find('.names').hide();
$(node).find('.avatar').hide();
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>');
$(node).find('.post-info').first().prepend(btn);
btn.click(umute_foo);
}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>');
btn.insertBefore($(node).find('.create').last());
btn.click(mute_foo);
}
}
$('article').each(function(){handle_post_node(this)});
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];
//console.log(node);
if(node.className == 'container posts'){
$(node).find('article').each(function(){handle_post_node(this)});
continue;
}
// 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'){
$(window.document).find('article').each(function(){handle_post_node(this)});
continue;
}
if(node.className == 'ember-view post-cloak'){
node = $(node).find('article').get(0);
}
if(node.nodeName == "ARTICLE" && node.getAttribute('data-user-id')){
handle_post_node(node);
}
}
}
});
observer.observe(document, { subtree: true, childList: true});
}
</script>