Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-10-21 13:57:48

etc
Developer
Registered: 2010-11-11
Posts: 5,060
Website GitHub

etc_preview: live comments preview

Description

This plugin will enable live comments preview.

Requirements

jQuery 1.7 or newer.

Usage

Include <txp:etc_live_preview /> somewhere near (preferably before) <txp:comments_form /> in your comments_display form, like this:

...
<txp:if_comments_allowed>
	<txp:etc_live_preview />
	<txp:comments_form />
<txp:else />
	<p><txp:text item="comments_closed" /></p>
</txp:if_comments_allowed>
...

It will play the role of <txp:comments_preview /> and wrapped in <div id="cpreview"></div>, unless you set the preview attribute explicitly:

<div id="my-preview">
	<txp:etc_live_preview preview="#my-preview" />
</div>

Live preview updates will trigger start and stop jQuery events on the nodes matched by preview attribute, so you can enhance them with your favorite animations:

<script>
$(function () {
	$("#creview").bind("start", function() {
		$(this).stop(true).fadeTo("fast", 0.1);
	}).bind("stop", function() {
		$(this).stop(true).fadeTo("fast", 1);
	});
});
</script>

Tags

<txp:etc_live_preview /> has the following attributes:

  • timeout: a timeout (in ms) of user inactivity before two live previews, default 600.
  • auto: whether the live preview should be automatically triggered after the user has filled all required fields. Default is 0 (no).
  • preview: a jQuery selector to be used instead the default #cpreview.
  • form, wraptag, class: same as <txp:comments_preview />.

Last edited by etc (2013-10-22 07:19:29)

Offline

#2 2013-10-22 06:57:51

Freeant
Member
Registered: 2012-04-16
Posts: 36

Re: etc_preview: live comments preview

Hi. Аfter inserting the plugin code. сlick upload. – page error 404.

Last edited by Freeant (2013-10-22 06:59:13)

Offline

#3 2013-10-22 07:08:38

etc
Developer
Registered: 2010-11-11
Posts: 5,060
Website GitHub

Re: etc_preview: live comments preview

Freeant wrote:

Аfter inserting the plugin code. сlick upload. – page error 404.

Hi, that’s nothing to do with the plugin. BTW, version 0.2 is out, so you can take another chance. :)

Offline

#4 2013-10-22 21:38:01

etc
Developer
Registered: 2010-11-11
Posts: 5,060
Website GitHub

Re: etc_preview: live comments preview

Version 0.2.1: minor, but valuable tweaks.

Offline

#5 2013-10-23 12:05:17

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,305

Re: etc_preview: live comments preview

Thanks for this plugin, Oleg, especially as the other plugin we had stopped working and wasn’t available any longer for someone to fix it.

The version you’re using now on your website has solved the troubles I had in FF two days ago (no effect at all), probably a conflict with Adblock+. That’s great given the widespread use of that plugin.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2013-10-23 13:26:36

etc
Developer
Registered: 2010-11-11
Posts: 5,060
Website GitHub

Re: etc_preview: live comments preview

uli wrote:

Thanks for this plugin, Oleg, especially as the other plugin we had stopped working and wasn’t available any longer for someone to fix it.

Hi Uli, thanks for the comment, glad it works for you. If you mean this plugin, I wouldn’t even try to fix it, since it could break in some future TXP version again. etc_preview has very low core dependency – essentially CSS ids – and shouldn’t conflict with other comments-related plugins (it happily coexists with rah_comment_spam on my site).

The version you’re using now on your website has solved the troubles I had in FF two days ago (no effect at all), probably a conflict with Adblock+.

That’s intriguing, I hope it doesn’t violate ABP scope, but will change the class name just in case. There were also few structural changes between v.0.1 and 0.2, maybe they were not smooth enough.

Offline

#7 2013-10-23 14:08:45

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,305

Re: etc_preview: live comments preview

etc wrote:

it happily coexists with rah_comment_spam on my site

Ah, good to know!

Mustn’t necessarily have been an Adblock conflict, didn’t even have the idea back then, but it’s the usual culprit, 9 times out of 10 when I turn it off it’s like voilà: solved.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB