Doing It Wrong Userscripts - Stop Updates



  • Here's a simple one that I came up with. The way that topic list pages constantly update a new posts number in the title bar is annoying to me. This forum isn't even all that high-traffic, and it still updates every few seconds. I found it distracting, and wanted to stop it, and this seems to get the job done:

    // ==UserScript==
    // @name         Block Discourse title updates
    // @match        http://what.thedailywtf.com/*
    // @grant          unsafeWindow
    // ==/UserScript==
    
    _.each(
        _.filter(unsafeWindow.MessageBus.callbacks, 
            function(i) { return i.channel === '/latest' || i.channel === '/new'; }), 
        function(i) { unsafeWindow.MessageBus.unsubscribe(i.channel, i.func) });
    

    And it's easy to add as many Discourse sites as you'd like to the match tag.

    Naturally, Discourse shows no interest in developing or merging any changes to make this a user option. If you dare to let your attention drift from any Discourse forum for a moment, then you're clearly Doing It Wrong.


  • SockDev

    if it's only the title bar that's alloying you....


  • SockDev

    ...

    THERE WAS MORE TO THAT POST!

    DISCOURSE!!!!!!!!!!!!!!!!!!!!!!!!

    where did you put it? hmm?



  • did you mean "annoying"?


  • SockDev

    yes i did. i also wandered off to find the discobool in settings to disable that behavior, but it's gone.

    and discourse ate that comment.... naturally.



  • @ufmace said:

    This forum isn't even all that high-traffic, and it still updates every few seco

    The bar in chrome is an alloy. that's really alloying.

    @accalia said:

    yes i did

    oh



  • @Monarch said:

    chrome... alloy

    Doing it Right!


  • BINNED

    @accalia said:

    wandered off to find the discobool in settings to disable that behavior, but it's gone

    This one?

    But rereading the OP, I think he's talking about the tab title, like

    (1)What the daily WTF


  • Discourse touched me in a no-no place

    @Jaloopa said:

    This one?

    I think it's these ones:

    From:

    @ufmace said:

    return i.channel === '/latest' || i.channel === '/new';

    Quite what's distracting about it updating I'm not sure since if I'm on here I'm usually on a topic page, and if I'm not on here, I'm usually looking at something else. And I've not actually noticed it 'updating' as such...

    FWP thread :random_arrows: etc.


  • BINNED

    @PJH said:

    FWP thread :random_arrows: etc

    You'll have trouble finding it with those directions. I think the current name is something about Discworld cheat codes



  • @Jaloopa said:

    cheat codes

    All the better for using random arrows with.



  • @Jaloopa said:

    But rereading the OP, I think he's talking about the tab title, like
    >(1)What the daily WTF

    Yeah, that's the one.

    It seems to update anytime anybody posts anywhere on the board. Even when it's in the background, it just sits there with it's little (1), then (2), then (5), then (13), beckoning you to look at what keeps updating.

    Mostly because of my habit of keeping a topic list tab open, and opening threads I want to read in their own tabs. Apparently, just keeping one DiscoTab open at once and moving around on that is the Right way to do it, and if you like to browse forums any other way, than you're Doing It Wrong.



  • @PJH said:

    I think it's these ones:

    <img src="/uploads/default/13042/9732036c79dc480d.png" width="493" height="37">

    From:

    @ufmace said:

    return i.channel === '/latest' || i.channel === '/new';

    Quite what's distracting about it updating I'm not sure since if I'm on here I'm usually on a topic page, and if I'm not on here, I'm usually looking at something else. And I've not actually noticed it 'updating' as such...

    FWP thread :random_arrows: etc.

    That one doesn't bother me much, since you can't see it when you're on another tab. But it does stop that as a side-effect, and the little bar at the top of the list saying X Updates, Click To View, which I also thought was annoying. I took the simple, broad method of removing the messagebus subscriptions for updates, so anything that uses updates to the whole forum will only see it on a page refresh. Live updates to other stuff like notifications and new posts in threads, still work fine.


  • Discourse touched me in a no-no place

    @ufmace said:

    Yeah, that's the one.

    So you have this checked in http://what.thedailywtf.com/my/preferences ?:


  • SockDev

    i do not and i see the behavior that @ufmace is discribing.

    AFAICT checking it changes nothing....



  • @PJH said:

    So you have this checked in http://what.thedailywtf.com/my/preferences ?:

    <img src="/uploads/default/13067/51575852b7305197.png" width="350" height="33">

    Nope, never checked that. And if I had, it looks like it would put a notification thingy on the favicon, not really related to the number in the title text.


  • BINNED

    Not the favicon, the text version


  • Discourse touched me in a no-no place

    Ah - OK. Forgot about that since munging the favicon seems to disable it.



  • Proposed workaround:



  • @tar said:

    Proposed workaround:
    Works for me!



  • Speaking of userscripts. When Discourse does this:

    how do I hook this event up for my own purposes to do pre-processing before calling the real handler? I know nothing about Ember, so please be gentle not paging @algorythmics



  • Testing out this:

    Discourse.ComposerController = Discourse.ComposerController.extend({ actions: { save: function() { console.log('hi'); this._super(arguments); } } });
    

    Nope, would need to execute earlier I think?

    EDIT: If you can get the actual controller instance, the method is stored in controller['save'].

    EDIT 3: That's the method on the controller, not the action. The action just calls the method though.

    EDIT 2: Get it with Discourse.__container__.lookup("controller:composer")

    So:

    var composerController = Discourse.__container__.lookup("controller:composer"),
        oldSave = composerController['save'];
    
    composerController['save'] = function(force) {
        ...;
        oldSave(force);
    }
    


  • Had to update it - they must have changed something with how lodash is loaded or interacts with TamperMonkey or something, since it doesn't seem to be accessible anymore. Instead of trying to figure that out, I redid it in basic Javascript instead, in hopes of not needing any more mucking around in the future.

    // ==UserScript==
    // @name         Block Discourse title updates
    // @match        http://what.thedailywtf.com/*
    // @grant		 unsafeWindow
    // ==/UserScript==
    
    (function () {
        'use strict';
        var bus = unsafeWindow.MessageBus,
            i,
            thisCall;
        for (i = 0; i < bus.callbacks.length; i += 1) {
            thisCall = bus.callbacks[i];
            if (thisCall.channel === '/latest' || thisCall.channel === '/new') {
                bus.unsubscribe(thisCall.channel, thisCall.func);
            }
        }
    }());

  • Discourse touched me in a no-no place

    @ufmace said:

    they must have changed something with how lodash is loaded or interacts with TamperMonkey or something

    Discourse hasn't been updated here since your original post.



  • Lodash got upgraded in master, but that shouldn't have affected here.



  • This post is deleted!

  • Banned

    @riking said:

    Lodash got upgraded in master, but that shouldn't have affected here

    not anymore ... we need to wait on that...



  • Hey incidentally, why can't I edit my original post? Is there some kind of time limit on editing posts?


  • area_deu

    Yes.
    You'll have to ask for someone to put an edit in there, I guess.


  • SockDev

    @ufmace said:

    Hey incidentally, why can't I edit my original post? Is there some kind of time limit on editing posts?

    yes. IIRC we have it set at a week.... or maybe 2 days.....

    @pjh could tell you if you ask nicely.

    If you still want toi edit you'll need to ask TL4+ (like @alice if is) to either make your edit or wikify the post. Of course if you wikify it then anyone can edit it...


  • Discourse touched me in a no-no place

    @ufmace said:

    Hey incidentally, why can't I edit my original post? Is there some kind of time limit on editing posts?

    Defaults are 300 and 262800. We changed them back in June.


  • SockDev

    that edit window, if you don't want to do the math is 7 days

    default is...182.5 days

    or about 6 months


  • Discourse touched me in a no-no place

    @accalia said:

    or about 6 months

    I'm fairly certain it was a full year when we started with DC, which is what prompted the initial discussion with @dhromed



  • This post is deleted!


  • And restricting access from content you produced yourself is a horrible design and should be made illegal?

    @blakeyrat I think we found an ally for you.


  • area_deu

    @monarch, read the post above yours.
    It's actually @PJH doing evil things - not a Discourse mistake.

    He could have set the edit time limit to INT_MAX, but consciously chose not to.
    I think he explained why he did that in some other thread a long time ago.


  • Discourse touched me in a no-no place

    @aliceif said:

    He could have set the edit time limit to INT_MAX, but consciously chose not to.
    I think he explained why he did that in some other thread a long time ago.

    I was all for leaving it at the defaults.


  • area_deu



  • Hold on, we aren't blaming Discourse for some annoyance?

    Checks URL

    Yep, I'm still on TDWTF. Man, this place has changed.


  • area_deu

    Actually, no.
    I'm just an anomaly.


  • SockDev

    @aliceif said:

    I'm just an anomaly.

    you aren't the only one.



  • This post is deleted!

  • area_deu

    @Monarch said:

    How did you feel when google/facebook/whatever, started using your personal photos explicitly in advertisement served to your friends without your conscious agreement( I am sure you didn't read the TOS fine prints)

    I don't upload photos to them, nor did I give them my real name?
    (And I don't have a facebook, but that's besides the point)


  • SockDev

    Ditto. but i get where @Monarch is coming from.



  • @Monarch said:

    As I said the content the user generate belong to the user, the platform should not claim ownership.

    @Discourse Default Terms of Service said:

    User contributions are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Without limiting any of those representations or warranties, The Daily WTF has the right (though not the obligation) to, in The Daily WTF’s sole discretion (i) refuse or remove any content that, in The Daily WTF’s reasonable opinion, violates any The Daily WTF policy or is in any way harmful or objectionable, or (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in The Daily WTF’s sole discretion. The Daily WTF will have no obligation to provide a refund of any amounts previously paid.

    <!-- -->


  • This post is deleted!


  • @Monarch said:

    I couldn't get to the bottom because stuff just keep on loading.

    You reach the bottom on topic pages and /categories, which is where it would get displayed.

    Also, /tos is the link. It's linked from /guidelines.



  • This post is deleted!

  • area_deu

    @Monarch said:

    edit: lol I can't find any page that links to tos or guidelines not even in categories

    1. It would be under FAQ on a normal Discourse forum - for example meta.d
    2. We unlinked the guidelines section and replaced it with our own FAQ. As a side-effect, you can only reach the TOS via the URL

    For complaints and such, bug PJH.



  • This post is deleted!

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.