View Post previews

  • boxmein
    31st Jul 2013 Former Staff 5 Permalink
    I've written an userscript that allows you to click an ellipsis right next to any (View Post) link that will display the post mentioned in a box. The box can be hidden by clicking on it. :D
    Acquire it here.
    image
    image

    Edit: it works partially (only with comments on the same page). I'll see to fix that.
    Edit #2: Everything works. It's auto-updated for the trusty ones, for others I'll update the script.
    Edit #3: Little arrow now points to where you clicked.
    Edit #4: Click anywhere to hide.
    Edit #5: Now saves the ID it previews into its own element as data-id. Fixes the awful bug found by @jacob1.
    Major edit #6: Userscript is now the only source. You'll get notifications and you'll be able to review the script.


    Here's a test for those who have installed it:
    @MiningMarsh (View Post)

    And one with an error:
    @MiningMarsh (View Post)
    Edited 15 times by boxmein. Last: 6th Aug 2013
  • hittox
    31st Jul 2013 Member 0 Permalink

    @boxmein (View Post)

    Very useful! But the comment on the same page thing is annoying, I hope you fix it soon :D

  • Kikinicij
    31st Jul 2013 Member 0 Permalink

    @boxmein (View Post)

    I love this. I hope you fix it soon. They should add it officially to the forum. ;)

  • boxmein
    31st Jul 2013 Former Staff 0 Permalink

    [21:08.29] <+jacksonmj> /Discussions/Thread/Post.json?Post=



    Or, in other words, @jacksonmj is awesome and the script is fixed for good.
    For those of you who decided to trust me and didn't edit the script before installing, the fix should already be there. For the others with the script data directly inside the userscript, I'll update the script in a sec.

  • Fast-Driver
    31st Jul 2013 Member 0 Permalink

    @boxmein (View Post)

     Awesome! This is really useful!

    thank u mr. box

     

    Could you make the bubble like the one you get when hovering over a date on a forum post?

    Edited once by Fast-Driver. Last: 31st Jul 2013
  • boxmein
    31st Jul 2013 Former Staff 0 Permalink

    @Fast-Driver (View Post)
    I'd rather not, since the Bootstrap tooltips that are used with the date hover will only work with non-HTML, and replicating the smile would make the inline style far too long :o

  • jacksonmj
    31st Jul 2013 Developer 0 Permalink

    @boxmein (View Post)

    If it helps, there's some CSS on the website which can be used to make quite a nice bubble like this:

     

    See the ajaxTooltip($(element), url) function in https://powdertoy.co.uk/Themes/Next/Javascript/Main.js , or look near the start of https://userscripts.org/scripts/review/173466 , for examples of how to create one. Though you probably don't want the h3.popover-title when displaying a post, and you may need to adjust the width of .popover-inner.

     

    Edit: also, for maximum effectiveness, override the LoadForumBlocks function (in https://powdertoy.co.uk/Applications/Application.Discussions/Javascript/Thread.js , called when the page number in a thread is changed and ajax is used to load the new posts) to call the original LoadForumBlocks function and then add the preview links. Otherwise, they don't appear after changing pages.

    Edited 7 times by jacksonmj. Last: 31st Jul 2013
  • boxmein
    31st Jul 2013 Former Staff 0 Permalink
    @jacksonmj (View Post)
    I used the popover CSS and now it also reloads on page change. :)
    Edit: and now it really reloads on page change
    Edited once by boxmein. Last: 31st Jul 2013
  • jacob1
    6th Aug 2013 Developer 0 Permalink
    bump

    this is cool, really useful. I noticed in the first post, that "error" example will always show the post of the not error example one. Maybe that's a bug, it shouldn't do anything at all if it can't find it, or at least just display "Post cannot be found" or something
  • boxmein
    6th Aug 2013 Former Staff 0 Permalink
    @jacob1 (View Post)
    That's what I've found and it's quite strange. I'll experiment a bit more with it, see what causes it...

    Okay, easy cause for it. The thing fetches only the -first- (View Post)'s post, every time you click on any (View Post).
    I've fixed it in this release. Every ellipsis now has a data-id value of the post it refers to.

    I've applied the updates to both the development and release pastes. Those using the userscript's minified version have to update it manually from the userscript page.
    Edited 2 times by boxmein. Last: 6th Aug 2013