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.
The forum of the forums
2 posters

    Saving post problem

    Duckbunny80
    Duckbunny80
    New Member


    Posts : 16
    Reputation : 2
    Language : English

    In progress Saving post problem

    Post by Duckbunny80 Tue 30 Jun 2020 - 13:07

    Technical Details


    Forum version : #phpBB2
    Position : Administrator
    Concerned browser(s) : Google Chrome
    Screenshot of problem : https://i.imgur.com/LsZXD15.png
    Who the problem concerns : All members
    Forum link : https://gillian-past.rpg-board.net/

    Description of problem

    Hello!

    I have a problem. I put in this this java code, only good for the admin, and for members don't.

    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")}());
    tikky
    tikky
    Forumember


    Posts : 922
    Reputation : 160
    Language : 🇵🇹

    In progress Re: Saving post problem

    Post by tikky Tue 30 Jun 2020 - 13:14

    Hey @Duckbunny80,

    Change your code to (read): Save text editor content Victory
    Duckbunny80
    Duckbunny80
    New Member


    Posts : 16
    Reputation : 2
    Language : English

    In progress Re: Saving post problem

    Post by Duckbunny80 Tue 30 Jun 2020 - 13:25

    Yes but with this code same. I tired in yesterday.

    My java code is working just not good for members and i don't understand why?
    tikky
    tikky
    Forumember


    Posts : 922
    Reputation : 160
    Language : 🇵🇹

    In progress Re: Saving post problem

    Post by tikky Tue 30 Jun 2020 - 14:24

    The code is different, remove the current one and leave the one that in the topic (Save text editor content)!
    Duckbunny80
    Duckbunny80
    New Member


    Posts : 16
    Reputation : 2
    Language : English

    In progress Re: Saving post problem

    Post by Duckbunny80 Wed 1 Jul 2020 - 12:35

    This is code is not what i want. Not safe when i leave the forum.
    I would like "my java code". this:

    form here: https://help.forumotion.com/t132804-automatically-save-posts-in-progress

    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")}());

    BUT my problem is this code only good for admin. Somebody know why?

      Current date/time is Wed 13 Nov 2024 - 17:24