Live comment preview

Creating and modifying plugins.
MySchizoBuddy
Regular
Posts: 340
Joined: Sun Jun 12, 2005 5:28 am

Live comment preview

Post by MySchizoBuddy »

Is there a s9y plugin similar to this
http://dev.wp-plugins.org/wiki/LiveCommentPreview
Image
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Live comment preview

Post by garvinhicking »

The problem is this: Serendipity has a boast of different markup plugins.

The way the livecomment preview works is by just replacing some escaped HTML code with real code. So no BBCode or even smilies are replaced "live", which kinda sucks.

So we could have a livepreview with nearly a 1:1 copy of their javascript code. But it wouldn't show much of a live preview, as most of the s9y markup cannot be easily replaced with JS calls.

The cooler way would be to just preview the comment with PHP calls. But this can't be done "live", because you would need to fire up a AJAX/PHP call every X seconds or X characters, which would be a HUGE performance impact.

What could be done instead would be to modify the "Preview" button to toggle a no-reload live preview of the comment. What would you think about that?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Re: Live comment preview

Post by Guest »

garvinhicking wrote:
What could be done instead would be to modify the "Preview" button to toggle a no-reload live preview of the comment. What would you think about that?
that would work too. a no-reload Ajax based preview will be cool.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Live comment preview

Post by garvinhicking »

Guest: But I just explained that a no-reload Ajax based preview would SUCK performance's ass....?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
MySchizoBuddy
Regular
Posts: 340
Joined: Sun Jun 12, 2005 5:28 am

Post by MySchizoBuddy »

i meant. change a preview button to make a no-reload preview. like on this site.

http://godbit.com/featured/the-john-carroll-school

:)
Image
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Okay, I'll have a look at it. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

I've just committed a "livecomment" plugin to CVS. You'll require updated comment.tpl and commentform.tpl files, plus some functions of the SVN from now.

Please test!

Bestregards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Lariel
Regular
Posts: 22
Joined: Sun May 06, 2007 12:55 am

Re: Live comment preview

Post by Lariel »

garvinhicking wrote:The way the livecomment preview works is by just replacing some escaped HTML code with real code. So no BBCode or even smilies are replaced "live", which kinda sucks.

So we could have a livepreview with nearly a 1:1 copy of their javascript code. But it wouldn't show much of a live preview, as most of the s9y markup cannot be easily replaced with JS calls.
I tried the livecomment preview and now I'm here. Because I think it really sucks. Should I change to WP?? :> Not really ... (I'm very satisfied with s9y so far, thanks for your great work garvin + rest!) My problem is: Hitting the "preview" button just like before is not live! I could do that before I used this plugin and I even got more informations, how the complete comment would look with author's name etc. I don't think "no BBCode or even smilies are replaced" sucks, it's just a pre-preview. So if the live preview would be really live and hitting the "preview" button would return the whole thing just like before, that's how it should function, imo.

Didn't want to be offensive. But I really thing it sucks how it works now. It should work more like the livesearch which is great.
Last edited by Lariel on Wed Jun 13, 2007 11:11 am, edited 1 time in total.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Live comment preview

Post by garvinhicking »

Hi!

I agree! I would love to see an improved version of the plugin. I am sure someone who has fun with Ajax can now build some improved version of it. Technology has quite improved since the initial commit of this plugin.

However the interest in this plugin was very low, so I can't dedicate time on this plugin on my own. For myself, I also am quite satisfied with the usual preview. ;-)

No offense taken, BTW. :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Lariel
Regular
Posts: 22
Joined: Sun May 06, 2007 12:55 am

Post by Lariel »

That was a fast reply. Well, I'd do it myself, but my JS and AJAX knowledge really sucks ... Hope, someone gets its hands on it. It's just a shame how it is right now.
Dawn
Regular
Posts: 69
Joined: Thu May 04, 2006 11:46 am

Post by Dawn »

Are there any news about this plugin? I've found another plugin @ http://www.softius.net/wp/plugins/comment-live-preview/ (for Wordpress). Wouldn't it help to adapt the source of this plugin? (my skills in Ajax are to less).

Greets and best regards,
Dawn
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

That would help, yes. But still the differences are quite large so it would take a skilled Ajaxian still more than one hour to get it transplanted...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Dawn
Regular
Posts: 69
Joined: Thu May 04, 2006 11:46 am

Post by Dawn »

I hope anybody can get it done. This is the only little feature I am a little bit jealous to wordpress users.

Thanks for your feedback garvin.

Greets,
Dawn
onli
Regular
Posts: 2830
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Post by onli »

Hi
Do you know this approach using jquery? I adapted it to work with serendipity, you may test it in my blog and download it here. Would be glad to here some comments and improvements.

Cause I'm new to this, you may want to check the source before using it...

You will note, it is not yet complete. I don't see a way how to use the installed markup-plugins to format the text - currently this is untouched, therefore producing html-styled text. Further thoughts about this can be found in the blogpost linked above, in german.
Maybe anyone can show me how to get the comments in the right format? I'd complete it if I saw a way - but of course wouldn't mind if someone else complete this.

Greets
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Nice to see that someone is working on this! :)

Serendipity indeed has a dependency management system, but we currently do not have plugins that just provide libraries. Currently there is no other plugin using jquery, so the overhead of the plugin supplying jquery wouldn't be so bad. If later we see that more plugins use this, a new jquery plugin could be created, though.

The existing serendipity_event_livecomment.php script actually does perform markup transformations, I think. It registers the external_plugin event hook and sends the current input to that script, which then returns the rendered markup. That is some kind of AJAX request, so once you have such a stub, you can use a JS event to perform the AJAX call, and render the HTML with the return code of that call.

The only alternative to such (performance intense!) ajax calls would be to recreate every markup plugin in JAvascript instead of PHP. Quite a huge task, even though at least BBCode or Textile are maybe already existing as JS-transforms...?

In fact, do you maybe want to try to incoroprate your changes into the serendipity_event_livecomment plugin? This would allow us to provide one plugin with the best functionality...

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply