Thread Ignoring Made Easy!
-
If you're one of the VAST MAJORITY who use /unread, you'll know there's a ton of topics that you either know right off you want to ignore, or remember from previous reads. It's a bit of a pain in the ass to go into the thread, scroll to the bottom, find the ignore drop down, manipulate it, then go back to /unread.
So here's something that adds a big red IGNORE button to the /unread list. Click once, confirm, thread is gone.
Because NodeBB still doesn't understand how callbacks should work, the UI stays on screen. I'll fix that in version 22.
Userscript:
// ==UserScript== // @name tdwtf - ignore on topic list // @namespace Lorne // @include https://what.thedailywtf.com/* // @version 1 // @grant all // @runat document-end // ==/UserScript== var $ = unsafeWindow.jQuery; function changeWatching(tid, type, callback){ callback = callback || function(){}; //callback's optional i guess var window = unsafeWindow; window.socket.emit('topics.changeWatching', { tid: tid, type: type }, callback); } function watchTopic(tid, callback){ changeWatching(tid, 'follow', callback); } function normalTopic(tid, callback){ changeWatching(tid, 'unfollow', callback); } function ignoreTopic(tid, callback){ changeWatching(tid, 'ignore', callback); } function topicChangeWatchCallback(a,b,c) { console.log("done ", a, b, c); } $(document).ready(function() { var $ = unsafeWindow.jQuery; $(window).on('action:topics.loaded', function(event, data) { $button = $("<a href='#' class='ignore'>IGNORE</a>"); console.log("topics loaded", event, data); $("ul.topic-list>li").each(function(){$(this).append($button.clone())}); }); $(document).on("click", ".topic-list .ignore", function(e) { console.log("click"); var tid = $(this).parents("[component='category/topic']:first").attr("data-tid") if(confirm("Are you sure you want to ignore this topic? " + tid )) { ignoreTopic(tid, topicChangeWatchCallback); } return false; }); });
CSS:
@namespace url(http://www.w3.org/1999/xhtml); @-moz-document domain("what.thedailywtf.com") { ul.topic-list>li { position:relative !important; } ul.topic-list .ignore { border-width:2px !important; border-color: #551111 !important; border-style:dashed; border-radius:5px; position:absolute; right:0px; bottom:0px; background-color:#aa0505 !important; color:white !important; padding:0.5em 1em; cursor: pointer; } }
-
@Lorne-Kates Not sure if I'm doing something wrong (never used TamperMonkey before), but I'm not seeing anything new showing up. I copied your script to a new script in TamperMonkey and made a new Stylish thing for the CSS.
-
@Erufael said in Thread Ignoring Made Easy!:
@Lorne-Kates Not sure if I'm doing something wrong (never used TamperMonkey before), but I'm not seeing anything new showing up. I copied your script to a new script in TamperMonkey and made a new Stylish thing for the CSS.
Hmm. Did you do a refresh?
I'll try on a Chrome.
-
@Lorne-Kates Yeah, I did a refresh. Maybe a Ctrl-F5?
-
Chrome friendly (or just install FF22).
css (feel free to fuck around with the positioning and blocking as needed, it's tailored to some of my other styles, and doesn't take Blackish style into account)
ul.topic-list>li { position:relative !important; } ul.topic-list .ignore { border-width:2px !important; border-color: #551111 !important; border-style:dashed !important; border-radius:5px !important; position:absolute !important; right:0px !important; bottom:0px !important; background-color:#aa0505 !important; color:white !important; padding:0.5em 1em !important; cursor: pointer !important; }
script fixed a couple missing semi colons, and make sure it is set to document-end
// ==UserScript== // @name tdwtf - ignore on topic list // @namespace Lorne // @include https://what.thedailywtf.com/* // @version 2 // @grant all // @runat document-end // ==/UserScript== var $ = unsafeWindow.jQuery; function changeWatching(tid, type, callback){ callback = callback || function(){}; //callback's optional i guess var window = unsafeWindow; window.socket.emit('topics.changeWatching', { tid: tid, type: type }, callback); } function watchTopic(tid, callback){ changeWatching(tid, 'follow', callback); } function normalTopic(tid, callback){ changeWatching(tid, 'unfollow', callback); } function ignoreTopic(tid, callback){ changeWatching(tid, 'ignore', callback); } function topicChangeWatchCallback(a,b,c) { console.log("done ", a, b, c); } $(document).ready(function() { console.log("document ready"); var $ = unsafeWindow.jQuery; var w = unsafeWindow; $(w).on('action:topics.loaded', function(event, data) { console.log("topics loaded", event, data); $button = $("<a href='#' class='ignore'>IGNORE</a>"); $("ul.topic-list>li").each(function(){$(this).append($button.clone());}); }); $(document).on("click", ".topic-list .ignore", function(e) { console.log("click"); var tid = $(this).parents("[component='category/topic']:first").attr("data-tid"); if(confirm("Are you sure you want to ignore this topic? " + tid )) { ignoreTopic(tid, topicChangeWatchCallback); } return false; }); });
-
What's with the separate CSS? Just have the script inject it...
-
@anotherusername said in Thread Ignoring Made Easy!:
What's with the separate CSS? Just have the script inject it...
One more thing to break.
Plus I can fuck around with the css and not have to rerun the script over and over.
-
@Lorne-Kates I think I figured it out. Maybe it was the @moz-document screwing it up cuz Chrome?
Removed that and now it shows up!
-
@Lorne-Kates Just mess with it in the browser style editor. Then you can copy-paste any changes back to the script.
If you use a backtick-delimited string, you can basically just stick the entire CSS block in without modification, since they're multi-line strings.
document.head.appendChild(document.createElement('style')).innerHTML = ` /* css goes here */ `;
edit: lolnope you use ff22, I forget. NEVERMIND. I guess it's
"css" +
then.
"more css" +
"..."Or you could upgrade to a modern browser. Just saying.
-
@Erufael said in Thread Ignoring Made Easy!:
@Lorne-Kates I think I figured it out. Maybe it was the @moz-document screwing it up cuz Chrome?
Removed that and now it shows up!Yup. I just copypasta'd from Stylish (FF plugin), so I guess it dumps that moz-doc tag in for raisins.
-
Lame CSS hacks; ignoring.
-
@Lorne-Kates Is it possible to reload the topic list from the script after ignoring a thread?
-
ajaxify.go('unread');
-
@anotherusername Perfect! Thanks! I even managed to put it in the right place in the script. xD
-
-
@Lorne-Kates said in Thread Ignoring Made Easy!:
VAST MAJORITY who use /unread
What if I browse the forum like a normal person?
-
@anonymous234 then you would be using /unread, like a normal person.
-
@anonymous234 said in Thread Ignoring Made Easy!:
@Lorne-Kates said in Thread Ignoring Made Easy!:
VAST MAJORITY who use /unread
What if I browse the forum like a normal person?
Then ignoring a thread does nothing useful anyway, so why would you bother?
-
@anonymous234 said in Thread Ignoring Made Easy!:
normal person?
https://what.thedailywtf.com/users
E_NORMAL_PERSON_NOTFOUND
-
@anotherusername So I can feel frustrated that it does nothing and complain about it.
@Julianlam, I am frustrated that the ignore button does nothing for people who don't use /unread.
Edit: to be more precise, I want it to (optionally) hide the topic from the actual main list.
-
@anonymous234 said in Thread Ignoring Made Easy!:
I am frustrated that the ignore button does nothing for people who don't use /unread.
Are you frustrated that the "reply" button does nothing for people who don't post?
-
@anonymous234 said in Thread Ignoring Made Easy!:
@anotherusername So I can feel frustrated that it does nothing and complain about it.
@Julianlam, I am frustrated that the ignore button does nothing for people who don't use /unread.
Edit: to be more precise, I want it to (optionally) hide the topic from the actual main list.
You'd probably be even more frustrated to know that the IGNORE button doesn't do anything for people who don't use TDWTF.
-
@boomzilla I'm annoyed that "ignore" makes it so threads are never
/unread
, but they still look unread in/recent
.
-
@Lorne-Kates said in Thread Ignoring Made Easy!:
E_NORMAL_PERSON_NOTFOUND
Quick! Someone register @Normal-Person!
-
@anotherusername said in Thread Ignoring Made Easy!:
@boomzilla I'm annoyed that "ignore" makes it so threads are never
/unread
, but they still look unread in/recent
.E_NO_REPRO:
Though to be fair, I did ignore them while in the thread, so you might have to touch them in order to set the "read" status on your ignored threads.
-
@anotherusername said in Thread Ignoring Made Easy!:
If you use a backtick-delimited string
(Serious) I'm not sure if ff22's JS engine supports that. But at the rate at which they bump up versions, who knows :D
-
@Tsaukpaetra said in Thread Ignoring Made Easy!:
@anotherusername said in Thread Ignoring Made Easy!:
@boomzilla I'm annoyed that "ignore" makes it so threads are never
/unread
, but they still look unread in/recent
.E_NO_REPRO:
Though to be fair, I did ignore them while in the thread, so you might have to touch them in order to set the "read" status on your ignored threads.
Yeah, that's not the ignore feature, it's just NodeBB changing the highlight due to entering the thread. Worst anti-feature IMHO.
-
@bb36e said in Thread Ignoring Made Easy!:
@anotherusername said in Thread Ignoring Made Easy!:
If you use a backtick-delimited string
(Serious) I'm not sure if ff22's JS engine supports that. But at the rate at which they bump up versions, who knows :D
I'm 95% certain it does not.
-
@JBert said in Thread Ignoring Made Easy!:
@Tsaukpaetra said in Thread Ignoring Made Easy!:
@anotherusername said in Thread Ignoring Made Easy!:
@boomzilla I'm annoyed that "ignore" makes it so threads are never
/unread
, but they still look unread in/recent
.E_NO_REPRO:
Though to be fair, I did ignore them while in the thread, so you might have to touch them in order to set the "read" status on your ignored threads.
Yeah, that's not the ignore feature, it's just NodeBB changing the highlight due to entering the thread. Worst anti-feature IMHO.
Yeah, right after you've visited the thread, of course it'll be marked "read". Entering the thread did that. Wait until there are some new posts in the ignored thread, and see if it still looks "read" then...
-
-
@anonymous234 said in Thread Ignoring Made Easy!:
browse the forum like a normal person
This forum?
You need to check the dictionary for the word "normal"...
-
-
@Lorne-Kates Is he ignoring all the threads, then, do you think?