Add ReplyNew TopicNew Poll

 Auto-Saving/Drafting Posts?
#
Forgive me if this has been requested before, I went back a few pages but I didn't see anything posted about it yet.

I know there's a custom code floating about somewhere, but perhaps it'd be useful to have as a full feature? Not just manually drafting posts, but having the site itself auto-save it while it's in progress in case the computer crashes or the site does or something like that.

I've seen too many an incident in which a post was simply entirely lost due to one of the above factors, and while a manual system is nice, it's easy to forget to save posts while working on them, especially since crashes are generally unexpected.

signature
user posted image
CATHERINE ★ RIFTING: PANFAN RP ★ IT'S-A ME
#
CODE
<script>
// Post Autosaver by Black
// http://code.jfbs.net/?showtopic=81
$(document).ready(function() {
if(window.location.href.indexOf("act=Post") !== -1 && window.location.href.indexOf("&f=") !== -1 && window.location.href.indexOf("&CODE=08") == -1) {
var forumParameters = (function(url) {
var result = {};
for (var i=0; i<url.length; i++) {
 var parameter = url[i].split('=');
 if (parameter.length != 2) continue;
 result[parameter[0]] = decodeURIComponent(parameter[1].replace(/\+/g, " "));
}
return result;
})(window.location.search.substr(1).split('&'));
var subDomain = location.hostname.split('.').shift();
function savePost() {
if(forumParameters["t"]) {
 localStorage[subDomain + forumParameters["f"] + forumParameters["t"]] = $("textarea[name='Post']").val();
}
else {
 localStorage[subDomain + forumParameters["f"]] = $("textarea[name='Post']").val();
}
}
function loadPost() {
if(forumParameters["t"]) {
 if(forumParameters["p"]) {
  return false;
 }
 $("textarea[name='Post']").val(localStorage[subDomain + forumParameters["f"] + forumParameters["t"]]);
}
else {
 $("textarea[name='Post']").val(localStorage[subDomain + forumParameters["f"]]);
}
}
function savePostRepeat() {
setTimeout(function() {
 savePost();
 savePostRepeat();
}, 30000);
}
$(window).unload(function() {
savePost();
});
$("form[name='REPLIER']").on("submit", function() {
if(forumParameters["t"]) {
 localStorage.removeItem(subDomain + forumParameters["f"] + forumParameters["t"]);
}
else {
 localStorage.removeItem(subDomain + forumParameters["f"]);
}
});
loadPost();
savePostRepeat();
}
});
</script>


I believe this is the Post Saver that Black did make a while back. I am not sure if it is still effective, but this code must be put AFTER THE <% BOARD %> in your wrappers

signature
user posted image
Made by me!
PM
#
Thank you for the code! I'll put it in for now.

Though, I'm not sure I like the fact that it saves locally - hence the need for an official feature, so it's actually saved in a cache on-site or something that's accessible through multiple computers. I don't know if such a thing is possible, but if it is it would be super convenient.

signature
user posted image
CATHERINE ★ RIFTING: PANFAN RP ★ IT'S-A ME
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | Feature Requests | Next Newest »

Options Add ReplyNew TopicNew Poll