2 of 2
2
Ajax Comment Preview with jQuery
Posted: 20 January 2009 08:12 PM   [ Ignore ]   [ # 19 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  522
Joined  10-09-2007

Ok so I feel like an idiot but I cannot get the example working, maybe it’s my lack of sleep or something.  All that displays is {comment}.  Now is there something I am doing or is this just me today:)

I have showdown.js and jquery.js pointing to good files so I am not sure what the heck I’m doing.

 Signature 

Vancouver Travel & Tourism http://www.discovervancouver.com/

Profile
 
 
Posted: 20 January 2009 09:32 PM   [ Ignore ]   [ # 20 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  462
Joined  09-06-2006

If this could be combined somehow with this jquery spellcheck plugin, that would be pretty nice. I’d set up the prototype version for a site, but couldn’t manage to figure out how to get a live preview working together with it.

 Signature 

Kyle Summer | smartpill design | New Haven, CT |  twitter

Profile
 
 
Posted: 20 January 2009 10:55 PM   [ Ignore ]   [ # 21 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  522
Joined  10-09-2007

Ok it was the lack of sleep, 4 green teas later and I have magicpreview working fine.  That was a weird post I made before now that I look back at it lol!  I agree though the spellchecker would be very nice to have combined.  I am going to try and get it working with magicpreview.

 Signature 

Vancouver Travel & Tourism http://www.discovervancouver.com/

Profile
 
 
Posted: 22 March 2009 05:02 PM   [ Ignore ]   [ # 22 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  06-14-2008

A live preview is confusing for me. Instead of being focus on what I want to type, I am distracted by the preview area that attracts my eye!

Another option is to use a modal window. The ModalPreview jQuery script from DevKick is a nice one. This very lightweight script will automatically add a preview button to EE’s comment form to display the content of the textarea.

 Signature 

Michel Godts eDesign
Web design consulting, services, and solutions, Rochester, NY

Profile
 
 
Posted: 22 March 2009 05:52 PM   [ Ignore ]   [ # 23 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  522
Joined  10-09-2007

michelG I did away with livepreview for that very reason but this looks very good, thanks for the link.

 Signature 

Vancouver Travel & Tourism http://www.discovervancouver.com/

Profile
 
 
Posted: 25 April 2009 02:36 PM   [ Ignore ]   [ # 24 ]  
Grad Student
Rank
Total Posts:  40
Joined  04-24-2006
e-man - 02 December 2008 08:53 PM

jQuery code:

// easy comment previewing + showdown for markdown parsing in preview
    
      
var $comment = '';
      $(
'#comm_content').keyup(function() {
        
var converter = new Showdown.converter();
        
$comment = $(this).val();
        
$comment = converter.makeHtml($comment);
        $(
'#live-preview').html($comment);
      
});

Note to those (like me) new to jQuery, to get the above code to work you must put it inside

$(document).ready(function() {
        
    }
);
Profile
 
 
Posted: 11 May 2009 01:56 AM   [ Ignore ]   [ # 25 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  238
Joined  01-06-2006
grumps - 03 December 2008 03:17 PM

I’ve tried three or four of these already. The one I like best is from Rockatee. Very easy installation, small script, painless, highly customizable via CSS.

OK, I tried adding the rockatee js and code to my site, to no avail.  The thing just sits there.  Am I missing something?  You can see the attempt on my site here.

I’m a js novice, as you can tell.

Profile
 
 
Posted: 11 May 2009 07:12 AM   [ Ignore ]   [ # 26 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2039
Joined  09-16-2004

Inside your preview.js you’ll find this selector:

$('#comment')

Since there’s currently no element with that id in your html nothing will happen.

You’ll have to add this id to your textarea, so find this:

<textarea name="comment" cols="55"  rows="12"></textarea>

and add this:

<textarea name="comment" id="comment" cols="55"  rows="12"></textarea>
 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 16 May 2009 01:44 AM   [ Ignore ]   [ # 27 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  238
Joined  01-06-2006

That totally worked!  You’re a genius : )

Profile
 
 
Posted: 16 May 2009 01:54 AM   [ Ignore ]   [ # 28 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  238
Joined  01-06-2006

OK, now the only problem I have (why is there no end?  I am feeling problematic.) is a random thing. 

I have smileys on the comment page.  And now the preview on the same page. 

Now, you have to be logged in to comment.  So, if I start to write a comment, and include a smiley, and then realize I need to be logged in, I have to log in.  So…I click my log in button, log in, and get redirected to…the smiley page. 

Test it for yourself:  http://www.planiran.com/index.php/site/article/sea_reef_burial/

Why is that? 

It’s OK, I can just hit the back arrow a few times and click submit, but it will throw visitors off.  Frustrate them. 

Oh, and the smileys don’t show up in the preview paine.  Maybe I should try these other js’s to see if that happens.

Maybe I should just give up on these smileys.  blank stare

This seems to be a redirect issue, not a smiley or js issue.  Oh what a tangled web.

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 119879 Total Logged-in Users: 113
Total Topics: 126018 Total Anonymous Users: 66
Total Replies: 662933 Total Guests: 540
Total Posts: 788951    
Members ( View Memberlist )
Active Members:    2plus3dAaron MartinadlurAndrea DeMersAndrew MacphersonapplelinksArneGatiosisbethanyannbiberltdBob SuttonBrad MorseBrian A MoralesccarterchaasChris Newtonchrisbarber86chutchinsonCrucialDanielpalmeriodesignerhandbagsdorichDylan Smith/ContextDesignelectricorangeEnviromedEphTerfi75Eric MillerferroconcreteflorianForrest AndersonfundinGareth DaviesGary Chapmangesturestudiogibbo98GingerLeafGnomeGrrlgoldnmeangregory17helloitsbaoillumilogicImpGabeIngmar GreilInside NothingITWYJ-WalkjaasumJack McDadejawJeremy BolesjmorinJohnGribbenjtnewsJustin LongKeith EKevin EvanskhomelKippiKurt DeutscherlitzingerliverpoolrcLLeakemacoDmarcuscrmarramgrassMartijn La FeberMatt CookMatthew EllismatthewtoddMaxDuluxMaxEngineMeritMileMirageNevin LynenigelheapNN WebmasternorthkNutmegPascal KrietePaul BryanPhilip ZaenglepicsselPierre FroelicherpvalleramonekalsawregistryrippeRobb OttenhoffRobin SowellScott BoydeSean McDevittSimon JobsitegoalssmidoidspacewalkStephen LewisSteven GrantSue CrockerTambour BattantThe JazzerThomas JacobsTodd StritcheyVenveovobtoaviWaielweb@sewaneewondermade