sawyourwolfjunk: (Default)
Kenzi ([personal profile] sawyourwolfjunk) wrote in [community profile] style_system2012-11-13 03:23 pm

Expand issues with transferred layouts

Hi. I'm having a problem with the layouts that I've brought over from LJ. Namely, clicking on the expand link doesn't actually expand the link. It acts like I've hit 'thread'. I'm wondering if there's something I need to add to the code to get it to accept the expand button, so I'm hoping someone can take a look at it, found here, and let me know what/where I need to pop something in.

I've found this to be a problem with most of the layouts I've tried bringing over from LJ. I can customize them to fit DW specs more aptly (since some can get a little wonky with some of the dimensions), but this is the only problem I've had that I can't seem to figure out on my own.

Any help would be greatly appreciated.
Thank you.
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2012-11-14 12:50 am (UTC)(link)
What's the layout? Is it the one you are using on your journal now? b/c expanding your cut tags is working fine for me. I use an imported version of Expressive from LJ and it works fine as well, and I didn't make any changes to anything involving the cut tags. Do you by any chance use a javascript blocker? Might need to remember to allow DW javascript access.
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2012-11-14 01:09 am (UTC)(link)
Oh welp sorry I misread your post. :x

I also looked in my own journal to see what it did, and had to go a while back be4 I even found an entry that had threaded comments, ha, but I found one and mine seems to be doing the same thing (redirecting to the thread link rather than loading the iframe in-page). Hmmmm.

Okay, well, I compared an entry on my journal to one using ?style=site. Looks like the links for expand on the LJ-style-theme I'm using are not loading the javascript script.

Links on my theme: <a href="threadurl">Expand</a>

Links on ?style=site: <a onclick="Expander.make(this,'threadurl','thread#', false); return false;" href="threadurl">Expand</a>

(where you wanna replace threadurl with the whole url for that comment thread, and thread# with the thread # that is part of that url at the end)

So, probably if you added that extra html to run the javascript to the expand links in your custom S2 style, it would work?? I will try to test this out also though maybe in a bit, can't do it right now, but thought I'd share preliminary thoughts anyway. :)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2012-11-14 01:38 am (UTC)(link)
You do not fail! I wish it were an easy thing, but yeah unfortunately I think it'll require editing the S2 code for your layout (unless I am missing something simpler). I will try to investigate more, and will let you know if I manage to fix it on my own journal and if I can do so I'll try to explain clearly how you could also fix it! :) If I can't manage it, maybe someone else will see these comments and will have already done so (or will do so more readily than I can).

Poking around the S2 code now and suspect the problem may be using expand_link() rather than print_expand_link() in several places. Will endeavor to fix it! :3
dickwithfangs: (Default)

[personal profile] dickwithfangs 2012-11-14 01:42 am (UTC)(link)
Talking about S2 clued me in a bit. It's actually an S1 layout that I got from starlit's tutorial. She made bases for four of the LJ layouts. This layout is Flexible Squares, so if you want to peek at that and give me a clue of where/what I should fiddle, I'd be INFINITELY glad.
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2012-11-14 01:55 am (UTC)(link)
Flexible squares is an S2 layout, it's just S2 Core v1, ahahaha. It gets v confusing. XD (I've imported that one as well but I'm currently using imported Expressive, another S2 Core v1 layout. Basically, the LJ-based S2 layouts are Core v1, and the DW-based S2 layouts are Core v2.)

So, the problem is indeed using expand_link() rather than print_expand_link(). If you search your layer code for "->expand_link" you should see around 2 places (maybe more depending on your style) this shows up. Replacing them with "->print_expand_link" makes it work. UNfortunately, on my style at least, this seems to mess up the spacing characters before that link item. Not quite sure why that's happening. It has me scratching my head; it's throwing the spacing characters on AFTER the link item instead of before it. So that's bizarre and I'm still trying to figure it out. But the expanding functionality is working correctly.

eta: okay, still don't really know WHY that weird problem with the spacing characters was happening, but I fixed it anyway. If you have the same problem, here is how to fix it:

when you search for "->expand_link" (which you will replace with "->print_expand_link"), you'll see it show up inside some brackets. For example, here is one of the ones that shows up for me, with a separator character in quotation marks, concatenated (the plus sign) with the return from print_expand_link():

{
" " + $e->print_expand_link({ "class" => "collapsed-comment-link" });
}


All you need to do is break this up so instead of concatenating them as one expression, each is on its own line:

{
" ";
$e->print_expand_link({ "class" => "collapsed-comment-link" });
}


Problem solved! :D

P.S. This was fun to figure out and now I'm glad that expanding comments will work on my own style as well! So thanks a ton for asking it here! :D :D
Edited 2012-11-14 02:03 (UTC)
chagrined: Winged Victory saying "FTW!" (ftw)

[personal profile] chagrined 2012-11-14 02:15 am (UTC)(link)
Hooray, so glad! \O/ ~comments expanding all around~
marahmarie: (M In M Forever) (Default)

[personal profile] marahmarie 2012-11-17 12:58 am (UTC)(link)
Having the same problem but I don't seem to have the same theme layer code to alter, even though I'm working from the same one as the poster above. All I have is this:
function EntryPage::print_comment_partial( Comment c )
{
    var string subject = $c.subject ? $c.subject : $*text_nosubject;
    var string date = $c->time_display("long", "");
    var string poster = isnull $c.poster ? $*text_poster_anonymous : $c.poster->as_string();

    print safe """<a href="$c.permalink_url">$subject</a> - $poster on $date""";
    var Link expand_link = $c->get_link("expand_comments");
    if ($c.thread_url != "" and defined $expand_link) {
        " " + $c->expand_link();
    }
}


And this:

###$comment->print_reply_link({"linktext" => $*text_comment_reply}); 

        if($comment.screened == true) {
            ### if comment screened - show link for unscreen
            var Link link;
            $link = $comment->get_link("unscreen_to_reply");
            """<a href="$link.url" title="$link.caption">$link.caption</a>""";
        } else {
            ### showing reply link if comment not screened
            $comment->print_reply_link({ "linktext" => $*text_comment_reply });
        }

        
        ") ";
    }

    if ($comment.parent_url != "")
    {
        "(<a href='$comment.parent_url'>$*text_comment_parent</a>) ";
    }

    if ($comment.thread_url != "")
    {
        """(<a href="$comment.thread_url">$*text_comment_thread</a>) """;
        var Link expand_link = $comment->get_link("expand_comments");
        if (defined $expand_link) {
            "(" + $comment->expand_link() + ") ";
        }
    }



So what exactly would I need to alter (and with what code specifically) to make this work? Thanks in advance. :)
marahmarie: (M In M Forever) (Default)

Oh God, yes, it worked!

[personal profile] marahmarie 2012-11-18 04:16 am (UTC)(link)
Thank you! I tried copy/pasting the code I saw in the last replies before my comment and kept getting compiler errors because I was copying the entire code blocks, which don't match mine, which I think was throwing the errors. So I thought because I had different code (+ $c->print_expand_link(); vs. + $e->print_expand_link) that that was why adding print_ didn't work. And I was probably right.
Edited 2012-11-18 04:19 (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2012-11-17 02:29 am (UTC)(link)
sawyourwolfjunk is correct, you replace calls to expand_link() with print_expand_link(). So any time you find "->expand_link" in your code, replace it with "->print_expand_link".

The second part of my explanation was to split up strings IF changing expand_link to print_expand_link causes you to have problems with the spacing characters (the characters that show up before/after the expand link in your html). To do this, you just put each string on a separate line/expression. In your case:

" " + $c->print_expand_link();

becomes

" ";
$c->print_expand_link();


and

"(" + $comment->print_expand_link() + ") ";

becomes

"(";
$comment->print_expand_link();
") ";


but you only need to do that after you've replaced "->expand_link" with "->print_expand_link", if you have noticed it's botching your spacer characters. Mine did for some reason but this may not be the case for all.
marahmarie: (M In M Forever) (Default)

[personal profile] marahmarie 2012-11-18 04:24 am (UTC)(link)
Yes, yes, the concatenation part I got, but I could never get that far with it because I was using your code ($e->print_expand_link, which does not exist in my theme layer) in place of my code (+ $c->print_expand_link, which can't be replaced with what you posted in your earlier replies on this page), which was throwing compiler errors for me whether I appended print_ or not. Sorry for the confusion.

Oh! And I'm not getting any weird spacing errors yet, but I haven't checked in IE, either. If those turn up I will indeed try concatenating like you said to see if that fixes it. Thanks for your help!
Edited 2012-11-18 04:26 (UTC)