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.

help with post color script

5 posters

Go down

Solved help with post color script

Post by poesia-verses March 17th 2024, 6:25 pm

Code:
$(function() {
  $("div.postbody").each(function() {
    var n = this;
    if($(".post-entry", n).length) {
      n = $(".post-entry", n)[0]
    }else {
      if($(".content", n).length) {
        n = $(".content", n)[0]
      }
    }
    while(n.nodeType != 3 && n.hasChildNodes()) {
      n = n.childNodes[0]
    }
    if(n.nodeType != 3) {
      return;
    }
    if(n.nodeValue.substr(0,8)  != "[postbg=") {
      return;
    }
    var m = n.nodeValue.match(/^\[postbg=([^\]]*)\]/);
    if(!m) return;
    $(this).closest("div.post-container,div.post").addClass("postbg").css("background-image", "url(" + m[1] + ")");
    n.nodeValue = n.nodeValue.replace(/^\[postbg=[^\[]*\]\n?/, "");
    if(!n.nodeValue && n.nextSibling && n.nextSibling.nodeType == 1 && n.nextSibling.tagName == "BR") {
      $(n.nextSibling).remove()
    }
  });
  if($("#text_editor_textarea").length && $.sceditor) {
    var bglist = "https://i.servimg.com/u/f10/20/33/56/10/a110.jpg,https://i.imgur.com/20aRJFn.png,https://i.imgur.com/tkC3deY.jpg,https://i.imgur.com/pfTcnqF.png,https://i.imgur.com/dAQtdaR.gif,https://i.imgur.com/48CU2Qx.png,https://i.imgur.com/lRuwoVi.png,https://i.imgur.com/EHp45H1.png,https://i.imgur.com/8bhbqFF.png,https://i.imgur.com/tb80sYG.png,https://i.imgur.com/6LPhzcp.png,https://i.imgur.com/DkRuYf1.png,https://i.imgur.com/57F0z86.jpg,https://i.imgur.com/PZyMuXF.png".split(",");
    var bgnum = -1;
    var val = $("#text_editor_textarea").val();
    if(val.substr(0,8)  == "[postbg=") {
      var m = val.match(/^\[postbg=([^\]]*)\]/);
      if(m) {
        var r = $.inArray(m[1], bglist);
        if(r != -1) {
          bgnum = r
        }else {
          bgnum = bglist.length - 1
        }
        $(function() {
          $(".sceditor-container").css("background-position", "0 " + ($(".sceditor-toolbar").height() + 6) + "px");
          $(".sceditor-container").css("background-image", "url(" + m[1] + ")")
        });
        $("#text_editor_textarea").val(val.replace(/^\[postbg=[^\[]*\]/, ""))
      }
    }
    $(function() {
      if(!$("#text_editor_textarea").sceditor("instance")) {
        return
      }
      $('<a class="sceditor-button" unselectable="on" title="Боковой фон сообщения"><div unselectable="on" style="background:url(https://i.imgur.com/Hrf5w1i.gif);opacity:1">Background of message</div></a>').insertAfter(".sceditor-button-strike").click(function(e) {
        if(e.ctrlKey) {
          $(".sceditor-container").css("background-image", "");
          bgnum = -1
        }else {
          bgnum++;
          if(!bgnum) {
            $(".sceditor-container").css("background-position", "0 " + ($(".sceditor-toolbar").height() + 6) + "px")
          }
          $(".sceditor-container").css("background-image", "url(" + bglist[bgnum % bglist.length] + ")")
        }
      })
    });
    $(function() {
      $('form[name="post"]').submit(function() {
        if(bgnum != -1) {
          $("#text_editor_textarea").val(function(i, val) {
            return"[postbg=" + bglist[bgnum % bglist.length] + "]" + val
          })
        }
      })
    })
  }
});

https://stihi-podval.forumotion.com/t601p60-topic#8936

I entered a table into the post template, and now this script does not work, please help me fix it
. script post background color

 help with post color script Clipbo28
The screenshot shows what should not be this link, but what should be the background


Last edited by poesia-verses on March 18th 2024, 6:07 pm; edited 1 time in total
poesia-verses
poesia-verses
Forumember

Male Posts : 571
Reputation : 22
Language : and small english

https://stihi-podval.forumotion.com/

Back to top Go down

Solved Re: help with post color script

Post by Ape March 17th 2024, 7:10 pm

Where did you get the code from ?


 help with post color script Left1212 help with post color script Center11 help with post color script Right112
 help with post color script Ape_b110
 help with post color script Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19449
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: help with post color script

Post by poesia-verses March 17th 2024, 7:16 pm


from this support forum
poesia-verses
poesia-verses
Forumember

Male Posts : 571
Reputation : 22
Language : and small english

https://stihi-podval.forumotion.com/

Back to top Go down

Solved Re: help with post color script

Post by Ape March 17th 2024, 7:23 pm

poesia-verses wrote:
from this support forum

A link to the posts you are talking about will help me more. (On the support forum)


 help with post color script Left1212 help with post color script Center11 help with post color script Right112
 help with post color script Ape_b110
 help with post color script Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19449
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: help with post color script

Post by poesia-verses March 17th 2024, 7:47 pm

poesia-verses
poesia-verses
Forumember

Male Posts : 571
Reputation : 22
Language : and small english

https://stihi-podval.forumotion.com/

Back to top Go down

Solved Re: help with post color script

Post by Ape March 17th 2024, 7:52 pm

okay did you say you added the code to your Templates ?

If yes you have messed up it's only in a javaScript page you need to follow it right.

Also you have a lot of codes that are not right in your forum so not everything will work on your forum.


 help with post color script Left1212 help with post color script Center11 help with post color script Right112
 help with post color script Ape_b110
 help with post color script Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19449
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: help with post color script

Post by poesia-verses March 17th 2024, 7:59 pm

Code:
 <table><tr><td>&nbsp;</td>
                            <td style="border-left: solid 1px #6D6D6D; padding-left: 29px;padding-top: 70px;padding-bottom: 25px;">  <div>{postrow.displayed.MESSAGE}</div>
                            </td></tr></table>
poesia-verses
poesia-verses
Forumember

Male Posts : 571
Reputation : 22
Language : and small english

https://stihi-podval.forumotion.com/

Back to top Go down

Solved Re: help with post color script

Post by Ape March 18th 2024, 12:36 am

like i said you need to use it just how they say in that topic you can't put it in the templates you must use javascripts and CSS file.


 help with post color script Left1212 help with post color script Center11 help with post color script Right112
 help with post color script Ape_b110
 help with post color script Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19449
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: help with post color script

Post by poesia-verses March 18th 2024, 7:45 am

@كونان2000

hi, help me please! It looks like you need to configure the paths at the top of the script, but I couldn’t configure it. In the post-entry there is a table with 2 columns, and in it the message of the post itself. I provided the code from the template
poesia-verses
poesia-verses
Forumember

Male Posts : 571
Reputation : 22
Language : and small english

https://stihi-podval.forumotion.com/

كونان2000 likes this post

Back to top Go down

Solved Re: help with post color script

Post by skouliki March 18th 2024, 8:16 am

hello

before you tag a member to help you, did you try to follow the steps in the tutorial you provided? (CSS and script)
we are all here to help but not to do the job for you

if you followed the tutorial please explain to us in detail what went wrong
skouliki
skouliki
Manager
Manager

Female Posts : 15397
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

TonnyKamper and كونان2000 like this post

Back to top Go down

Solved Re: help with post color script

Post by كونان2000 March 18th 2024, 5:52 pm

hello @poesia-verses
There is no problem with the javaScript code

Try the following
Find the next part in viewtopic_body template
Code:
 <table><tr><td>&nbsp;</td>
                            <td style="border-left: solid 1px #6D6D6D; padding-left: 29px;padding-top: 70px;padding-bottom: 25px;">  <div>{postrow.displayed.MESSAGE}</div>
                            </td></tr></table>

replace it with
Code:
<div class="table-tr-td" style="border-left: solid 1px #6D6D6D;padding-left: 29px;padding-top: 70px;padding-bottom: 25px;">
                              <div>{postrow.displayed.MESSAGE}</div></div>


 help with post color script Ocia_a25
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Solved Re: help with post color script

Post by poesia-verses March 18th 2024, 6:06 pm

Shocked

I also thought about introducing a second block instead of the table, but I didn’t know how to place them next to each other.
Thank you very much (this is not translated correctly).
 help with post color script 200.gif?cid=78ff2c8fr5tilu6rm7c96jwgh919yphmfxal6mvo60ch189v&ep=v1_gifs_trending&rid=200
poesia-verses
poesia-verses
Forumember

Male Posts : 571
Reputation : 22
Language : and small english

https://stihi-podval.forumotion.com/

كونان2000 likes this post

Back to top Go down

Solved Re: help with post color script

Post by SLGray March 18th 2024, 7:35 pm

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


 help with post color script Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51566
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

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