Border change color then there's new post Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
3 posters

    Border change color then there's new post

    unownus
    unownus
    New Member


    Posts : 6
    Reputation : 1
    Language : lithuanian

    Solved Border change color then there's new post

    Post by unownus Sat 17 Jun 2023 - 21:28

    Hello.
    I want to do that border-top color will change, then the new post appeared, or then the new post in categories.

    css code:
    Code:
    .lastpost {
        width: 150px;
        padding: 15px;
        background: #F7F7F7;
        text-align: center;
        font: 700 8px/120% Montserrat, sans-serif;
        text-transform: uppercase;
        color: #777;
        display: block;
        overflow: hidden;
        margin-left: 160px;
        border-top: 10px solid;
        border-top-color: #000000; /* Pradinė spalva (juoda) */
        transition: border-top-color 0.5s ease; /* Pritaikyti spalvos pakeitimui animaciją */
    }

    .lastpost.new {
        border-top-color: #ff0000; /* Naujo pranešimo spalva (raudona) */
    }
    javacript code:
    Code:
    function addNewPost() {
        var lastpostElement = document.querySelector('.lastpost');
        lastpostElement.style.borderTopColor = '#ff0000';
    }

    //  addNewPost() after time
    setTimeout(addNewPost, 2000);

    it only work on one categorie, and its working even there is no new posts.
    Border change color then there's new post 354525114_954107965843793_2729182113106841988_n.png?_nc_cat=111&ccb=1-7&_nc_sid=ae9488&_nc_ohc=pAG0xV9QiD8AX99kCxX&_nc_ht=scontent.fvno8-1


    Last edited by unownus on Mon 26 Jun 2023 - 13:55; edited 1 time in total
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3111
    Reputation : 245
    Language : English, Italian, French
    Location : Italy

    Solved Re: Border change color then there's new post

    Post by Niko Sat 17 Jun 2023 - 22:50

    Dear @unownus

    can you provide your forum URL and your forum version? (phpBB3, phpBB2, Invision, PunBB, AwesomeBB, ModernBB)

    Thanks a lot :rose:

    also, are we talking about this part? the last column?
    Border change color then there's new post Scree153

    unownus likes this post

    unownus
    unownus
    New Member


    Posts : 6
    Reputation : 1
    Language : lithuanian

    Solved Re: Border change color then there's new post

    Post by unownus Mon 19 Jun 2023 - 0:15

    oh sorry, i forgot
    forum: https://afterdark.forumlt.com/
    version: phpBB2
    and yes, im talking about the last column
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3111
    Reputation : 245
    Language : English, Italian, French
    Location : Italy

    Solved Re: Border change color then there's new post

    Post by Niko Mon 19 Jun 2023 - 1:31

    Are you sure it is not phpBB3? because some parts in the code are from phpBB3 and not phpBB2 Embarassed

    In the meantime, go to your CSS stylesheet from the ACP and add this - to add the border Wink
    Code:
    .lastpost {
        border-top: 6px solid black;
    }

    .lastpost.new {
        border-top: 6px solid red!important;
    }

    TonnyKamper likes this post

    Razor12345
    Razor12345
    Support Moderator
    Support Moderator


    Male Posts : 1487
    Reputation : 262
    Language : Ukr, Rus, Eng
    Location : Ukraine

    Solved Re: Border change color then there's new post

    Post by Razor12345 Wed 21 Jun 2023 - 10:38

    Good afternoon!

    Is your request complete?
    if your request is complete, please mark it as Solved.



    Border change color then there's new post Screen51
    unownus
    unownus
    New Member


    Posts : 6
    Reputation : 1
    Language : lithuanian

    Solved Re: Border change color then there's new post

    Post by unownus Sat 24 Jun 2023 - 12:57

    Niko wrote:Are you sure it is not phpBB3? because some parts in the code are from phpBB3 and not phpBB2 Embarassed

    In the meantime, go to your CSS stylesheet from the ACP and add this - to add the border Wink
    Code:
    .lastpost {
        border-top: 6px solid black;
    }

    .lastpost.new {
        border-top: 6px solid red!important;
    }
    yes, im sure it's phpBB2
    it can be some codes from phpBB3, because im new in coding, so i dont know everything Very Happy

    but it's still not working somehow..
    i think the problem can be in javascript
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3111
    Reputation : 245
    Language : English, Italian, French
    Location : Italy

    Solved Re: Border change color then there's new post

    Post by Niko Sat 24 Jun 2023 - 13:08

    @unownus and can you confirm that you added this code in ACP > Display > Images & Colors > Colors > CSS Stylesheet and then saved?

    Code:
    .lastpost {
        width: 150px;
        padding: 15px;
        background: #F7F7F7;
        text-align: center;
        font: 700 8px/120% Montserrat, sans-serif;
        text-transform: uppercase;
        color: #777;
        display: block;
        overflow: hidden;
        margin-left: 160px;
        border-top: 10px solid #000000!important;
        transition: border-top-color 0.5s ease;
    }
     
    .lastpost.new {
        border-top-color: #ff0000!important
    }

    because the code works for me Embarassed
    unownus
    unownus
    New Member


    Posts : 6
    Reputation : 1
    Language : lithuanian

    Solved Re: Border change color then there's new post

    Post by unownus Sun 25 Jun 2023 - 18:40

    no, it's still doesn't work..
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3111
    Reputation : 245
    Language : English, Italian, French
    Location : Italy

    Solved Re: Border change color then there's new post

    Post by Niko Mon 26 Jun 2023 - 1:43

    @unownus checking your CSS code, the code I mentioned above is not present Embarassed
    can you keep it installed?
    Razor12345
    Razor12345
    Support Moderator
    Support Moderator


    Male Posts : 1487
    Reputation : 262
    Language : Ukr, Rus, Eng
    Location : Ukraine

    Solved Re: Border change color then there's new post

    Post by Razor12345 Mon 26 Jun 2023 - 13:02

    Good afternoon!

    You've changed the phpbb2 templates quite a bit. This template is unrecognizable.

    Unfortunately, I was never able to register on your forum, so I worked with what is available as a guest.

    Since you don't use forum icons, there is another way to check for new messages - the image-link to the last post ( https://2img.net/i.postimg.cc/PJKCr4Rs/OLD.png ). I don't know the link to the image responsible for the unread new message on your forum.

    If there are new posts in the forum section, the border will be red, but if the user read the last post in the section and there are more new posts in it, the border will still change color to black.

    AP - Display - Templates - General - index_box

    At the end of the template, insert the code:

    Code:
    <script>
     
      window.addEventListener('load', function() {
         
         let newMes = document.querySelectorAll('img[src="LINK TO UNREAD MESSAGE ICON"]');
            let noNewMes =document.querySelectorAll('img[src="https://2img.net/i.postimg.cc/PJKCr4Rs/OLD.png"]');
         newMes.forEach(item => {
              item.closest('.lastpost').style.borderTopColor = 'red';
                item.closest('.lastpost').style.borderTopWidth = '5px';
               item.closest('.lastpost').style.borderTopStyle = 'solid';
         });
            noNewMes.forEach(item => {
              item.closest('.lastpost').style.borderTopColor = 'black';
                item.closest('.lastpost').style.borderTopWidth = '5px';
               item.closest('.lastpost').style.borderTopStyle = 'solid';
      });
      });
    </script>

    Save. Publish.

    Result:

    Border change color then there's new post Scree182

    Pay attention to this line. This is where the link to the image should be inserted.
    Code:
    let newMes = document.querySelectorAll('img[src="LINK TO UNREAD MESSAGE ICON"]');



    Border change color then there's new post Screen51

    TonnyKamper and unownus like this post

    unownus
    unownus
    New Member


    Posts : 6
    Reputation : 1
    Language : lithuanian

    Solved Re: Border change color then there's new post

    Post by unownus Mon 26 Jun 2023 - 13:54

    thank you, now it's working  Border change color then there's new post 1f60d
    Razor12345
    Razor12345
    Support Moderator
    Support Moderator


    Male Posts : 1487
    Reputation : 262
    Language : Ukr, Rus, Eng
    Location : Ukraine

    Solved Re: Border change color then there's new post

    Post by Razor12345 Mon 26 Jun 2023 - 13:57

    You are welcome!

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



    Border change color then there's new post Screen51