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.

"New" icon code problem

5 posters

Go down

Solved "New" icon code problem

Post by Dipener February 16th 2023, 3:02 pm

Hello, i used the below code but it is not working at all. I cannot find the error indeed. Here you see


To add this you must go to HTML & JAVASCRIPT -> Javascript codes management Create a new javascript and add this script

Placement: In all the pages
Code:
$(function() {
  $('.forabg dl[style*="https://i.servimg.com/u/f88/20/00/67/44/forum_11.gif"]').find('a.forumtitle').append('<span class="new-post">NEW</span>');
});

Then we must style it with css code

Code:
.new-post {
  background: #84c754;
  font-size: 12px;
  margin-left: 10px;
  border-radius: 3px;
  color: #fff;
  padding: 1px 5px;
}

Remember to replace your Forum - New icons with yours this part <span style="color: #aa6709;background: #fff4e5;border: 1px solid #f9c479;padding: 0px .35em;border-radius: 2px;">[style*="https://i.servimg.com/u/f88/20/00/67/44/forum_11.gif"]</span>


Link to the post of problem below
https://forumservice.forumotion.com/t118-new-post-indicator
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by skouliki February 16th 2023, 3:05 pm

Hello

Which tutorial is this ?
skouliki
skouliki
Manager
Manager

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

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 16th 2023, 3:26 pm

I think it was about new post indicator when someone post new message then it shows "New" after the forums
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by skouliki February 16th 2023, 5:00 pm

No i meant where did you find that code ?
Not all codes are for all versions
skouliki
skouliki
Manager
Manager

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

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 16th 2023, 5:59 pm

i dont know but @mati know it may be.
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by skouliki February 16th 2023, 6:52 pm

then it is better to ask him about the code
skouliki
skouliki
Manager
Manager

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

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 16th 2023, 7:14 pm

Yeah but @mati is busy right now. So i posted here for help about this issue. We have many coding experts here so that i can get help from them too
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by skouliki February 16th 2023, 7:20 pm

i do not understand
you mean you posted this also to Mati's forum and because he is busy you posted also here ?

skouliki
skouliki
Manager
Manager

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

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 16th 2023, 7:44 pm

Yeah
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by SLGray February 16th 2023, 10:23 pm

Why are you not just using the default system for the new icon?


"New" icon code problem 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 : 51556
Reputation : 3524
Language : English
Location : United States

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

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 17th 2023, 2:34 am

Default system for new icon? What you meant please @Slgray
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by Razor12345 February 17th 2023, 11:25 am

Good afternoon!

AP - Display - Templates - General - topics_list_box

At the end of the template, insert the code

Code:
<script>
  $(document).ready(function() {
  let listOfTopics = $('div.forumbg.announcement div.inner ul.topiclist.topics.bg_none li dl dd[title="New posts"]');
     for (let i = 0; i <= listOfTopics.length; i++) {
     listOfTopics[i].querySelector('div').insertAdjacentHTML('afterend','<span class="new-post">NEW</span>');
   };
});
</script>

Save. Publish.

Your CSS code has not been changed

Result:

"New" icon code problem Screen28


"New" icon code problem Screen51
Razor12345
Razor12345
Support Moderator
Support Moderator

Male Posts : 1584
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine

Niko and TonnyKamper like this post

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 17th 2023, 12:23 pm

Dear @rezor12345

Will i remove my previous java script and css code?
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by Razor12345 February 17th 2023, 12:28 pm

You can remove only JS code


"New" icon code problem Screen51
Razor12345
Razor12345
Support Moderator
Support Moderator

Male Posts : 1584
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 17th 2023, 12:34 pm

Dear @razor12345 i did everything you said but nothing changed
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by Razor12345 February 17th 2023, 2:22 pm

I thought this script was for topics in the forums.
Remove the code above.
For the forums themselves:

AP - Display - Templates - General - index_box

Insert the code at the end of the template:

Code:
<script>
  $(document).ready(function() {
  let listOfForums = $('div.forabg div.inner ul.topiclist.forums li dl[style*="https://2img.net/i/fa/prosilver/forum_unread.gif"]');
  for (let i = 0; i <= listOfForums.length; i++) {
    listOfForums[i].querySelector('dd.dterm').insertAdjacentHTML('beforeend','<span class="new-post">NEW</span>');
  };
  });
</script>

Save. Publish.

Please note!

Code:
[style*="https://2img.net/i/fa/prosilver/forum_unread.gif"]

This uses a link to the forum image when there is a new post. Change it to your own.

2) AP - Display - Colors&CSS - CSS Stylesheet

Code:
.new-post {
  background: #84c754;
  font-size: 12px;
  border-radius: 3px;
  margin-left: 30%;
  color: #fff;
  padding: 1px 5px;
}

Save.

To move the icon to the left or right, change this item to your liking:

Code:
margin-left: 30%;

Result:

"New" icon code problem Screen29
Razor12345
Razor12345
Support Moderator
Support Moderator

Male Posts : 1584
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine

TonnyKamper likes this post

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 17th 2023, 2:41 pm

Still not showing up. Could you please use my admin access to see the error?
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by tikky February 17th 2023, 3:30 pm

Hello @Dipener (and @Razor12345),

You are using a custom template so you only need to replace
Code:
[style*="https://2img.net/i/fa/prosilver/forum_unread.gif"]
to
Code:
[data-icon-transform$="_unread.gif"]
tikky
tikky
Forumember

Posts : 923
Reputation : 160
Language : 🇵🇹

https://www.forumotion.com/create-forum/modernbb

TonnyKamper likes this post

Back to top Go down

Solved Re: "New" icon code problem

Post by Dipener February 17th 2023, 3:48 pm

Wow @pedxz, you just wow! Beside, @razor12345 also wow! Thanks, solved
Dipener
Dipener
Forumember

Posts : 27
Reputation : 2
Language : English

https://movie.forumotion.asia/

Back to top Go down

Solved Re: "New" icon code problem

Post by skouliki February 17th 2023, 4:22 pm

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

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

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

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