The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Automatically save posts in progress

Go down

Tutorial Automatically save posts in progress

Post by Ange Tuteur May 5th 2014, 9:34 am

Automatically save posts in progress

1. Definition

Some months ago there was a resource that allowed you to save in progress posts, but due to the new WYSIWYG editor update this resource wasn't working anymore.

Today I'm here to share with you an alternative, tested and working on all forum versions that will allow you to save in progress posts even if you close pages in your browserAutomatically save posts in progress 716122



2. Requirements
All you need is to have Cookies and Cache active on your browser.

Note: If you clear your browser cookies/cache, saved posts will be erased

3. Javascript code

All you have to do is go to this page :

ACP Automatically save posts in progress Arrow10Modules Automatically save posts in progress Arrow10HTML & Javascript Automatically save posts in progress Arrow10Javascript code management

Make sure javascript codes management is set to 'yes'

then create a new javascript codeAutomatically save posts in progress 29877



  • Title: Saving in progress posts
  • Placement: in all pages
  • Code:

Code:
window.localStorage&&$(function(){
$(function(){
if($("#text_editor_textarea").length&&typeof $.sceditor!="undefined"){
var a=$(document.post.mode).val(),
d=$("#text_editor_textarea").sceditor("instance"),
e,f,g=function(){
localStorage.setItem(a,d.val());
f=0},
b=JSON.parse(localStorage.getItem("br-data"))||[],c;
switch(a){
case"editpost":return;
case"reply":a+=$(document.post.t).val();
break;
case"newtopic":a+=$(document.post.f).val()
}
a=parseInt((my_getcookie("fa_"+location.hostname.replace(/\./g,"_")+"_data")||"0").replace(/.*s:6:"userid";(i:([0-9]+)|s:[0-9]+:"([0-9]+)");.*/,"$2$3"))+a;
-1!=(c=$.inArray(a,b))&&b.splice(c,1);
if(20<b.length){
for(c=b.length-1;0<=c;c--)/^\s*$/.test(localStorage.getItem(b[c])||"")&&(localStorage.removeItem(b[c]),
b.splice(c,1));
20<b.length&&(localStorage.removeItem(b[0]),
b.splice(0,1))}b.push(a);
localStorage.setItem("br-data",JSON.stringify(b));
$(document.post).submit(function(){
localStorage.setItem("br-target",a)
});
!d.val()&&((e=localStorage.getItem(a))&&d.val(e));
d.keyUp(function(){
f||(f=setTimeout(g,3E3))
})}})});
window.localStorage&&(localStorage.getItem("br-target")&&function(){
$("meta[http-equiv='refresh'][content]:first").length&&function(){
var a=JSON.parse(localStorage.getItem("br-data")),
b=localStorage.getItem("br-target"),c;
if(-1!=(c=$.inArray(b,a)))a.splice(c,1),
localStorage.setItem("br-data",JSON.stringify(a));
localStorage.removeItem(b)}();
localStorage.removeItem("br-target")}());

I hope this resource will help lots of Forumotion forums' administrators to avoid long topics and posts getting lost due to accidentally closing browser pages Automatically save posts in progress Icon_sunny



Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

TonnyKamper likes this post

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum