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.

Modification Needed for Remove Signatures Javascript

2 posters

Go down

Modification Needed for Remove Signatures Javascript Empty Modification Needed for Remove Signatures Javascript

Post by timberella Mon Dec 07, 2020 3:22 pm

I am using this javascript code to remove signatures at our forum for a particular category, forum or topic.

Code:
$(function(){

/* --- CONFIGURATION --- */
// Topic IDs where the signatures are hidden
var topic_ids = [1, 2, 3];
// Forum IDs where the signatures are hidden
var forum_ids = [1];
// Category IDs where the signatures are hidden
var cat_ids = [1];
/* --- CONFIGURATION --- */

var topic_match = window.location.pathname.match(/\/t(\d+)/); if (!topic_match) return;
var current_topic = topic_match[1];
var navbar = document.querySelector('.pathname-box');
if (!current_topic || !navbar) return;
var forum_selector = navbar.querySelectorAll('.nav');
var current_forum = forum_selector[forum_selector.length - 1]; if (!current_forum) return;
var forum_match = current_forum.href.match(/\/f(\d+)/); if (!forum_match) return;
current_forum = forum_match[1]; if (!current_forum) return;
if (topic_ids.includes(parseInt(current_topic)) || forum_ids.includes(parseInt(current_forum))) {
$('.signature_div').filter(function(){ this.style.display = "none" });
}
var cat_selector = navbar.querySelectorAll('.nav');
var current_cat = cat_selector[cat_selector.length - 2]; if (!current_cat) return;
var cat_match = current_cat.href.match(/\/c(\d+)/); if (!cat_match) return;
current_cat = cat_match[1]; if (!current_cat) return;
if (topic_ids.includes(parseInt(current_topic)) || cat_ids.includes(parseInt(current_cat))) {
$('.signature_div').filter(function(){ this.style.display = "none" });
}
});

This javascript is sufficient for the most part except that the signatures are not being removed in the sub-forums of the forums.  In other words if I add "category 1" to the code, then the signatures will be removed in "category 1" and in any forums within "category 1".  But the signatures are NOT being removed in the sub-forums within the forums of "category 1".

Modification Needed for Remove Signatures Javascript Efrtut10

When I add a category to the code, I would like ALL forums and sub-forums within the category to be included so that signatures will be removed from all. Is this possible?

Our forum is phpBB3.

Thank you in advance Smile
timberella
timberella
Forumember

Female Posts : 111
Reputation : 5
Language : English

http://pinkpalace.forumotion.com/

Back to top Go down

Modification Needed for Remove Signatures Javascript Empty Re: Modification Needed for Remove Signatures Javascript

Post by SLGray Mon Dec 07, 2020 4:15 pm

You will need to edit this part of the JavaScript:
Code:
// Forum IDs where the signatures are hiddenvar forum_ids = [1];
Example:  [1, 2, 3]


Modification Needed for Remove Signatures Javascript 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 : 51499
Reputation : 3523
Language : English
Location : United States

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

Back to top Go down

Modification Needed for Remove Signatures Javascript Empty Re: Modification Needed for Remove Signatures Javascript

Post by timberella Mon Dec 07, 2020 9:28 pm

Thanks for the reply.

I'm already doing that, but some of our categories have many sub-forums within its forums, and it's a lot of forum numbers to add and keep track of. It would be simpler if I only had to add the number for the category and then all the nested forums and sub-forums would be included.

Is there possibly a number in the javascript that determines how many levels into the category to apply the javascript? Like maybe it's set to go in one level to include the forums and I would like to be able to set it to go in two or three levels of sub-forums.
timberella
timberella
Forumember

Female Posts : 111
Reputation : 5
Language : English

http://pinkpalace.forumotion.com/

Back to top Go down

Modification Needed for Remove Signatures Javascript Empty Re: Modification Needed for Remove Signatures Javascript

Post by SLGray Mon Dec 07, 2020 10:18 pm

I believe not since there is a line each for forums and categories.


Modification Needed for Remove Signatures Javascript 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 : 51499
Reputation : 3523
Language : English
Location : United States

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

Back to top Go down

Modification Needed for Remove Signatures Javascript Empty Re: Modification Needed for Remove Signatures Javascript

Post by timberella Fri Dec 11, 2020 10:37 pm

Okay then, thank you!

I'll mark this topic solved now.
timberella
timberella
Forumember

Female Posts : 111
Reputation : 5
Language : English

http://pinkpalace.forumotion.com/

Back to top Go down

Modification Needed for Remove Signatures Javascript Empty Re: Modification Needed for Remove Signatures Javascript

Post by SLGray Fri Dec 11, 2020 10:57 pm

Maybe the person who created the JavaScript can help you.


Modification Needed for Remove Signatures Javascript 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 : 51499
Reputation : 3523
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