A script to show the full BB post on BBS

I like your style, too. the whole… cowboy thing.

2 Likes

hey dudette, this script stopped working for me yesterday ;_; This is because the Discourse team changed something on their end? the other script further upthread still works fine.

Here you go. They changed the name of their asterisk class from “icon-asterisk” to “fa-asterisk”. :wink:

javascript:(function($){
    $(function(){
        var lastLink = null;
        $("body").on("mouseover", "#topic-list td.main-link a", function(event){
            var $link = $(this), $category, iframe, offset, linkVal = $link.attr("href");
            $category = $link.closest("tr").find("td.category");
            if($category.find("a").attr("href") === "/category/boing-boing" && (lastLink !== linkVal || $("iframe.hover-bb-preview").length===0)  && $link.closest("td.main-link").find("a i.fa-asterisk").length>0) {
                $("iframe.hover-bb-preview").remove();
                offset = $category.offset();
                iframe = $("<iframe/>", {src: $link.attr("href"), "class":"hover-bb-preview", frameBorder:0, width:"500px", height:"300px"});
                iframe.css({
                    border: "1px solid #CCC",
                    position: "absolute",
                    left: offset.left,
                    top: offset.top
                });
                iframe.load(function(){
                    var contents = iframe.contents();
                    contents.get(0).location.href = contents.find("#post_1 .cooked a").attr("href");
                });
                $("body").append(iframe);
                lastLink = linkVal;
            }
        }).on("click", function(){
                $("iframe.hover-bb-preview").remove();
            });
    });
}(jQuery));
3 Likes

you’re totally my hero. since the day you wrote it, I’ve read every post that way. haven’t even seen the main page since then. I even figured out how to make it into a greasemonkey script so I didn’t have to load it as a bookmarklet every time. so, y’know, I’m learning. thanks once again! m(._.)mアリガト

whelp, them adding the new BBS categories seems to have once again disabled the script you wrote for me (the mouseover one.) I tried to be proactive and experimented with editing it back to “icon-asterisk” (a longshot, but that was all I knew to try.) nope.

once again, the original script you wrote that inserts the permalink on the comment page still works like a charm.

may I prevail upon you again to give it a look? I’d offer you a trade at this point, but not sure I have any skills you need/can be done online. I’m pretty good at drawing?

I’m just wondering when someone is going to get around to writing a bot or script that posts the article’s contents as the first comment to the thread here in the BBS.

Close, but the category name changed from boing-boing to boing.

javascript:(function($){
    $(function(){
        var lastLink = null;
        $("body").on("mouseover", "#topic-list td.main-link a", function(event){
            var $link = $(this), $category, iframe, offset, linkVal = $link.attr("href");
            $category = $link.closest("tr").find("td.category");
            if($category.find("a").attr("href") === "/category/boing" && (lastLink !== linkVal || $("iframe.hover-bb-preview").length===0)  && $link.closest("td.main-link").find("a i.fa-asterisk").length>0) {
                $("iframe.hover-bb-preview").remove();
                offset = $category.offset();
                iframe = $("<iframe/>", {src: $link.attr("href"), "class":"hover-bb-preview", frameBorder:0, width:"500px", height:"300px"});
                iframe.css({
                    border: "1px solid #CCC",
                    position: "absolute",
                    left: offset.left,
                    top: offset.top
                });
                iframe.load(function(){
                    var contents = iframe.contents();
                    contents.get(0).location.href = contents.find("#post_1 .cooked a").attr("href");
                });
                $("body").append(iframe);
                lastLink = linkVal;
            }
        }).on("click", function(){
                $("iframe.hover-bb-preview").remove();
            });
    });
}(jQuery));

(∘=̴⃙̀˘︷˘=̴⃙́∘)
if it was a snake it would have bit me.

thanks for your help, gwwar :bear: :thumbsup:

Our post versioning UI is pretty good now (try it) so if you want to edit the top post to reflect the latest code that should work.

Or, put it on a gist on github and link to that.

Alternately, “enter at bottom of topic then scroll up to find latest posted version” works OK too, I suppose.

hey @gwwar, I’ll bet you can guess why I’m @-ing you…

they changed the blue icon to say new instead of the *, so we change the bit in the seventh line from find("a i.fa-asterisk") to find("a i.fa-new")? god, I’m such a skid : (

here’s a pic of my greasemonkey script. I filled out the header by looking at some others

Updated up top. The new css selector is:

a.new-posts.badge-notification

Or basically any links with a “new-posts” class and a “badge-notification” class. You can always right click and inspect the element.

@codinghorror any chance the badges could be less bright? #00aaff is kind of distracting for the current bbs theme.

3 Likes

This is wonderful, thank you. Not sure how I missed it until now.

Was there an answer as to why the BBS doesn’t do this by default?

@gwwar we are thinking about formalizing this approach and adopting it in Discourse core somewhere, as I have the same problem over on my Discourse instance attached to my blog:

http://discourse.codinghorror.com/t/why-not-quote-the-full-blog-post-in-each-topic/1414/9?u=codinghorror

3 Likes

“I got a lot a calls to make.”

1 Like

Thank you thank you. One of the biggest drawbacks for BBS is the double-clicking back to main website. Bless you.

2 Likes

Shit’s MAGIC. MAGICAL, I tell ya. THANK YOU FROM THE BOTTOM OF MY NERD HEART.

0100100100100000011011000110111101110110011001010010000001111001011011110111010100100001

1 Like

@gwwar script-y no work-y ;_;

@noahdjango Fixed up top.

1 Like

you are going to go to heaven.

here is a picture of a cyclist made out of tubes.

2 Likes