• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Message Auto Save / Drafts - Prevent Members from Losing Content

moman

Active member
Consider this my first xenForo modification. It's a simple one- in fact, it's entirely client-side!

It's based on this for vBulletin: http://www.vbulletin.org/forum/showthread.php?t=270236
For this release, however, I re-wrote the script using jQuery so it should work cross-browser.

------------------------------------------

Have you ever started writing a post and then accidentally closed the tab or forgotten about it? Well, with this installed, as soon as you navigate back to the page you were on, your message will be there! Enjoy! I've had this deployed on my vB forum for a while and it's been a life-saver more than once...

This should work for quick reply, advanced reply, and PMs. I've tested it in FF9 and IE9 but do let me know if it doesn't work for you. Be sure to include your JS console errors if you notice any issues.
 

Attachments

Just for the record- since localStorage (the thing this uses to store your posts) is extremely persistent, you can use this for drafts if you so dare ;)
 
Cool- let me know if it works for you! The best way to test it is to write a post, copy the url, close the tab then paste the url and see if it's still there. Also, verify that the js file is properly linked to and included.
 
How does this work? Does it eat up lots of resources or cause conflict with other plugins? Seems like something that should be in the core.
 
It's client-side, and no, it doesn't really use any resources. Just stores text as you type it and then flushes it out when you submit a post- all in your browser.
 
Ha, figures that auto-draft only shows up after I convert to xenForo, as it is an add-on I have been searching the high seas for for many months. There was another guy working on such a feature for vBulletin 3.x, but he went missing and the add-on was put into the archives. That said, thanks for bringing this feature over.

Love the look of your Pentax Forums, by the way.
 
Oh WOW I have SO complained of XF losing posts on me
does this work on the ghastly XF timeout?

Sorry shoulda said it worked closing the tab. Thanks!
 
This caused some oddities in certain areas which forced me to remove it. It would make the editor's area pure white (#FFF) and also make it so smilies didn't show up at all. The editors in Account Settings (signature, about me) and the editors in the XenCarta wiki were affected (the thread view and convo view ones work fine). Not sure if other areas were affected other than account settings / wiki. Basically it conflicted with the editor_js_setup, made it so certain lines didn't execute or something, such as this one:

theme_xenforo_contents_css_url: "css.php?style={xen:urlencode $visitorStyle.style_id}&css=editor_contents&d={xen:urlencode $visitorStyle.last_modified_date}",

Here's the HTML output WITHOUT as.js:
GAsFz.png


And the HTML output WITH as.js:

38gwN.png

As you can see, the bottom one is missing the stylesheet line completely, and it's also missing a style="overflow-y: hidden;"> snippet on the end of the <body id> tag. No idea if this is just happening for me or everyone else that's using it as well. Perhaps someone can confirm?
 
I don't have the time to dig into it too deep right now myself, but my editor background doesn't go white, nor do my smilies disappear.
 
Top Bottom