Oh look, it isn't so hard to fix jellypotato on image loads



  • Oh look at me. I read NodeBB's documentation!

    Issue: as I've said before, fuck "JIT image loading" hard hard hard. Fuck it. "oh but lorne jellypotatoe html is hard wats an achor let's reinvent the htmls"

    Shut the fuck up. Look, if I can fix it, you can fix it.

    Define the problem: We can't scroll to the .highlight post because images load and shift shit around.

    Fuck that. I'd rather a little bit of screen bounce than not being able to see the post I've just clicked to.

    Define the solution: Okay, easy. Scroll to the highlighted post. If an image loads and shifts shit around during document load, then scroll back to that highlight.

    QUICK AND DIRTY:

    $(document).ready(function()
    {
    
        $(window).on('action:topic.loaded', function(event, data) 
        {
            // image load hook
            $("img").load(function(e) 
            { 
                var $hl = $(".highlight");
                if($hl.length > 0)
                {
                   $('html, body').animate({scrollTop: $hl.offset().top}, 100);    
                }
                
            });
    
    
        });
    });
    

    Maybe this will fuck up if images load really, really, really slow and you've already scrolled away. I which case my next iteration will have "on mouse scroll, unbind image load".



  • @Lorne-Kates said in [Oh look:

    Shut the fuck up. Look, if I can fix it, you can fix it

    Is this the new benchmark?

    Instead of "even Discourse got this right" it's now "Even Lorne could fix this".



  • Would this also work in posts that have lots of oneboxed links and youtube videos?


  • sockdevs

    @NedFodder Doubt it, as they'll be more than simple <img> tags



  • @Lorne-Kates I outlined exactly how to fix the "showing mobile view on desktop" in the stupid GitHub bug tracker, but I still place the odds of that getting fixed to maybe 1/1000.

    Unfortunately, the fix requires changes to the CSS so it has to be made "upstream".



  • @loopback0 said in [Oh look:

    Is this the new benchmark?
    Instead of "even Discourse got this right" it's now "Even Lorne could fix this".

    Might as well be. I'm good, but my classic vocation is mainly in "shit that works" rather than "fancy ajax poop under seventy layers of undocumented minimized javascript".

    So if I can figure it out, from the client-side, there's no excuse anymore.

    @NedFodder said in [Oh look:

    Would this also work in posts that have lots of oneboxed links and youtube videos?

    Probably, I just haven't looked at all the hooks:

    @blakeyrat said in [Oh look:

    @Lorne-Kates I outlined exactly how to fix the "showing mobile view on desktop" in the stupid GitHub bug tracker, but I still place the odds of that getting fixed to maybe 1/1000.

    So about 5736234 times better chances than Discourse.

    Unfortunately, the fix requires changes to the CSS so it has to be made "upstream".

    I know some about media queries. I haven't looked much into how to override them. I'll check to see if there's a css thing that says something like:
    @media (screen size whatever) { * { every attribute: revert } };

    Otherwise yeah, upstream would have to break out the media queries into a different .css file, so you can ignore it.

    Alternatively, I wonder if there's a browser plugin that will "lie" about your screen width, and always report 1980px whenever interrogated. Hmm... I may check into that.



  • @Lorne-Kates said in [Oh look:

    queries

    @ben_lubar :fa_bug: highlight a word, click "reply" to do "reply with highlighted quote". Breaks on the comma in the title. See this post where it says [Oh look:



  • @Lorne-Kates

    @RaceProUK and I made a pull request that fixed that 11 days ago and the bug was introduced 2 days ago. :wtf:



  • Lorne-Kates Hey, I noticed replying breaks in this specific way when a topic title contains a comma.
    ben_lubar Yeah, a lot of people noticed that. I thought I fixed that. Lemme take a look.
    :clock:
    ben_lubar Wait, my changes aren't merged! Why aren't we having the other bug that they also fixed? RaceProUK, what's going on?
    RaceProUK I have no idea. The pull request wasn't merged.

    at this point the timelines diverged

    ben_lubar Hey :doing_it_wrong:, what happened with the PR? :doing_it_wrong: Sorry, no longer welcome here. :hammer:



    ben_lubar Hey julianlam, what happened with the PR? julianlam Oh, I forgot about that! Does it still work? ben_lubar I'll check. :clock: ben_lubar Yep! julianlam Hey psychobunny, I'm not in my 1-planck-length by 1-planck-length office! Can you merge this for me? psychobunny Sorry, I was busy fixing another bug that only affected 3 TDWTF members. I'll be a minute.


  • @Lorne-Kates said in Oh look, it isn't so hard to fix jellypotato on image loads:

    Alternatively, I wonder if there's a browser plugin that will "lie" about your screen width, and always report 1980px whenever interrogated. Hmm... I may check into that.

    can JavaScript change css?
    maybe a javaacript that changes everything at runtime

    but I would prefer to do a search and replace at bootstrap and modify all of them or something



  • @fbmac said in Oh look, it isn't so hard to fix jellypotato on image loads:

    can JavaScript change css?

    This has the same answer as the question "can dfhack do ______?"

    The answer is "yes, unless what you are asking for is not possible to do on a computer in a turing-complete language".



  • @ben_lubar the method at left sounds faster and simpler

    could we stop updating after every single commit they do? it's annoying


  • sockdevs

    @fbmac said in Oh look, it isn't so hard to fix jellypotato on image loads:

    can JavaScript change css?

    It can change the rules applied, but it cannot change how media queries work



  • @fbmac said in Oh look, it isn't so hard to fix jellypotato on image loads:

    can JavaScript change css?

    It can remove the CSS file entirely, and possibly even remove the rules inside the media query entirely.

    It can't simply disable the media query and re-enable it later, like almost every other thing in CSS, because the W3C is an incompetent ass.

    So the solution is to either put all the media queries in their own CSS file that can be removed and re-added all at once, or to make the media query rules dependent on a class in the body like in answer two to this question. Either way, it requires changes to the CSS.



  • @fbmac said in Oh look, it isn't so hard to fix jellypotato on image loads:

    could we stop updating after every single commit they do? it's annoying

    The only way I could fix the quoting bug was a restart because it's a plugin that's included with core.

    But just for you, I won't apply the fix for tags moving through the editor window on mobile.



  • @ben_lubar thanks


Log in to reply
 

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