Resource icon

Message Auto Save / Drafts 0.1

No permission to download

moman

Active member
moman submitted a new resource:

Message Auto Save / Drafts (version 0.1) - Auto-saves your posts seamlessly so you don't lose anything if your browser crashes.

This simple client-side add-on saves messages on-the-fly so that if you close your browser on accident or your computer crashes, your post will still be in the editor.

The way it works is easy: as you type a message, it gets stored in your browser's localStorage. Once you submit it, the copy gets erased. If you close your browser and then re-open a page, the saved content will automatically be re-inserted into the editor.

Works for replies, quick replies, new threads, and PMs.

Supports...

Read more about this resource...
 
Is the user notified when an autosave is made - i know vbulletin displays a yellow div to say so.
 
No, they aren't at this time. It's all behind-the-scenes and any saved content is automatically displayed in the editor when you re-open the page.
 
I lost this, forgot about it, can't believe I had forgotten it for this long, reinstalled, enjoying it. :D
 
I tried this but i am not sure if it does work to my board. I tried to close the browser after i wrote a lil message but when i visit the thread again i don't see my old text there o.O
 
I have a small issue with this. The current code associates the data with the URL as a key. One of my members stumbled on a case where he wrote a message, then decided to edit the thread title, thus changing the thread URL (friendly URL are enabled), and losing his message.

I suggest that the code should key the content on the controller/action/id combination rather than just the URL. How should I modify this portion of code that calculates the storageKey? Maybe XF core JS script already had an existing function to do exactly this?
PHP:
var storage = localStorage || window.localStorage;		
		try
		{
			var urllen = window.location.href.split('/');
			var dl = urllen[0].length + urllen[2].length + 2;
		}
		catch (error)
		{
			var dl = 0;
		}

		var storageKey = window.location.href.slice(dl);
		if (storageKey.indexOf('#') != -1)
		{
			storageKey = storageKey.slice(0, storageKey.indexOf('#'));
		}
 
I get random errors when posting in threads from time to time which I still haven't nailed down the cause of yet. This should save me a lot of headaches. I seem to have it happen when I have the long posts. It wouldn't happen when I post the one sentence answer.

Thank you.

James
 
I get random errors when posting in threads from time to time which I still haven't nailed down the cause of yet. This should save me a lot of headaches. I seem to have it happen when I have the long posts. It wouldn't happen when I post the one sentence answer.

Thank you.

James
1.2 has a drafts feature built in.
 
Top Bottom