Please help me with the author's background color
3 posters
Page 1 of 1
Please help me with the author's background color
That means I need a script that when the author writes a post, there will be a separate background color. When other members comment on the post, there will be no background color, only the author who wrote the post will have it.
Last edited by zzlasperpen on October 24th 2023, 1:22 pm; edited 1 time in total
Re: Please help me with the author's background color
Good morning!
Are you talking about this forum: https://raovat24.forumvi.com ?
Give a link to the thread so that it has multiple replies from different users.
And a clarifying question - do you want all author's posts to have a certain color (not just the first one)?
Are you talking about this forum: https://raovat24.forumvi.com ?
Give a link to the thread so that it has multiple replies from different users.
And a clarifying question - do you want all author's posts to have a certain color (not just the first one)?
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Please help me with the author's background color
Hello @Razor12345 .That's my forum link
This is the image of the author posting (I have circled it in red), which means I want the author of the post to have a different background color than the commenting members.
This is the image of the author posting (I have circled it in red), which means I want the author of the post to have a different background color than the commenting members.
Re: Please help me with the author's background color
Since you have heavily modified templates, I can't test my code on my test forum. I can only create it and test it through the developer tools on your forum.
AP - Modules - Javascript codes management - Create a new JavaScript
Title: any
Placement: In the topic
Code:
Result:
To change the background color, in this line
Replace this code
with the color code you need.
AP - Modules - Javascript codes management - Create a new JavaScript
Title: any
Placement: In the topic
Code:
- Code:
$(document).ready(function() {
const listOfMessages = document.querySelectorAll('.post-wrap');
if (listOfMessages) {
const authorOfArticle = listOfMessages[0].querySelector('.post-inner .post-cell.post-header-user .post-user .post-author-more .post-userName .post-author-name .authorid').innerText;
listOfMessages.forEach((item) => {
const authorOfPost = item.querySelector('.post-inner .post-cell.post-header-user .post-user .post-author-more .post-userName .post-author-name .authorid');
if (authorOfPost) {
const authorOfPostName = authorOfPost.innerText;
if (authorOfPostName === authorOfArticle) {
item.querySelector('.post-inner .post-cell.post-main').style.background = '#eee';
}
}
});
}
});
Result:
To change the background color, in this line
|
Replace this code
|
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
SarkZKalie, TonnyKamper and zzlasperpen like this post
Re: Please help me with the author's background color
tks @Razor12345 it works perfectly
Razor12345 likes this post
Re: Please help me with the author's background color
Problem solved & topic archived.
|
Similar topics
» background color of quote box
» Problems with the background color on a 'Quote on Quote' response and problems with the background color on my 'Quick Reply' box
» Background color and text color by rank
» Background Color
» background color topic row
» Problems with the background color on a 'Quote on Quote' response and problems with the background color on my 'Quick Reply' box
» Background color and text color by rank
» Background Color
» background color topic row
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum