Have you ever wished the forum software behaved slightly differently? So have I, and while CivFanatics doesn't have the ability to change how XenForo works, it is possible to use browser customization scripts to change some things. After some discussion of these with the other moderators, I'll be sharing a few of them here.
To use them, you will need Tampermonkey, or a similar script manager such as Greasemonkey (though I've only personally tested all of them with Tampermonkey). Add whichever ones you want to your dashboard of scripts.
Topic Zapper
Are there subjects that you would rather not be reminded of, within forums that you like to browse? Topic Zapper lets you hide just the topics that annoy you, while still browsing the forums at large. It works based on the thread title, and may be a good alternative to the ignore list if you'd like to hide a topic someone posted but not their other content.
Change the "blockwords" to include whichever topics you'd like to have hidden. You can change it as needed - want to give yourself a temporary thread ban? Just add the thread's title to the blockwords, no infractions necessary!
Off-Topic Redirect
Do you find yourself spending way more time than you'd like in Off-Topic, or just want to not be reminded of it every time you visit CivFanatics? Then the Off-Topic Redirect is for you. It does the following:
- Redirects you back to the forum homepage should you wind up at Off-Topic, or the "What's New" page, which can include off-topic posts
- Removes Off-Topic from the forum listing
- Removes the New Post widget, which can include Off-Topic threads
- Removes the Trending Content widget, which can include Off-Topic posts (new in February 2025)
- Removes Off-Topic threads from the "Similar Threads" widget, and removes that widget altogether if all its recommendations are Off-Topic
It does not redirect you from Off Topic threads themselves, so if there is a subset of threads that you still like to post in occasionally, you can go to them via your browser history, without being as tempted to browse OT in general.
At this time this script doesn't work for other forums, although it could be adjusted to them fairly easily.
Search by Category by Default
Has it ever annoyed you that the "Search" dropdown defaults to "Everywhere"? Wouldn't it make more sense for it to default to "This Thread" if you are viewing a thread, or "This forum" if you are viewing a forum? That's what this script changes. Highly productivity-enhancing if you happen to need to search repeatedly in a forum while trying to locate something.
Search Improver
This is a one-liner that expands the "Search in forums" section of the Search Threads page, so that you can view more forums at once and thus enjoy a less claustrophobic forum-selection experience.
You can customize the height from 400px if you'd prefer it a bit taller or a bit shorter.
Other scripts
I also had a script that disabled the number keys - 1 through 9 - selecting items in the forum header, but unfortunately the recent XenForo forum changes broke it and there are still bugs in my fix to it.
You are welcome to suggest other ideas for scripts, but it's likely that most ideas would require more ambitious changes that are feasible within a script.
To use them, you will need Tampermonkey, or a similar script manager such as Greasemonkey (though I've only personally tested all of them with Tampermonkey). Add whichever ones you want to your dashboard of scripts.
Topic Zapper
Are there subjects that you would rather not be reminded of, within forums that you like to browse? Topic Zapper lets you hide just the topics that annoy you, while still browsing the forums at large. It works based on the thread title, and may be a good alternative to the ignore list if you'd like to hide a topic someone posted but not their other content.
Code:
// ==UserScript==
// @name Topic Zapper
// @namespace http://tampermonkey.net/
// @version 2024-08-19
// @description Removes topics containing certain words, should you prefer to browser forums without being reminded of controversial topics.
// @author Quintillus
// @match https://forums.civfanatics.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
var blockwords = ["Gaza", "abortion", "Election", "football", "Olive"]
var topics = document.querySelectorAll(".js-threadList .structItem--thread")
for (var topic of topics) {
var title = topic.querySelector("div.structItem-title").innerText.toLowerCase();
for (var word of blockwords) {
if (title.includes(word.toLowerCase())) {
topic.remove();
break;
}
}
}
})();
Change the "blockwords" to include whichever topics you'd like to have hidden. You can change it as needed - want to give yourself a temporary thread ban? Just add the thread's title to the blockwords, no infractions necessary!
Off-Topic Redirect
Do you find yourself spending way more time than you'd like in Off-Topic, or just want to not be reminded of it every time you visit CivFanatics? Then the Off-Topic Redirect is for you. It does the following:
- Redirects you back to the forum homepage should you wind up at Off-Topic, or the "What's New" page, which can include off-topic posts
- Removes Off-Topic from the forum listing
- Removes the New Post widget, which can include Off-Topic threads
- Removes the Trending Content widget, which can include Off-Topic posts (new in February 2025)
- Removes Off-Topic threads from the "Similar Threads" widget, and removes that widget altogether if all its recommendations are Off-Topic
It does not redirect you from Off Topic threads themselves, so if there is a subset of threads that you still like to post in occasionally, you can go to them via your browser history, without being as tempted to browse OT in general.
Code:
// ==UserScript==
// @name CFC OT Redirect
// @namespace http://tampermonkey.net/
// @version 2025-02-03
// @description Hides Off-Topic
// @author Quintillus
// @match https://forums.civfanatics.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
//If you go to Off Topic or What's New, send you back to the homepage
var href = window.location.href
if (href === "https://forums.civfanatics.com/forums/off-topic.18/" || href.startsWith("https://forums.civfanatics.com/whats-new/posts/")) {
window.location.href = "https://forums.civfanatics.com";
}
//Remove Off-Topic from the forum listing
var forums = document.querySelectorAll(".node--forum");
for (var forum of forums) {
var title = forum.querySelector(".node-title");
var forumName = title.innerText;
if (forumName == 'Off-Topic') {
forum.remove();
}
}
// Remove "New Posts"
var newPostsWidget = document.querySelector("div.block[data-widget-definition='new_posts']");
if (newPostsWidget !== null) {
newPostsWidget.remove();
}
// Remove "Trending Content", which can include Off-Topic
// New as of February 2025
document.querySelector('div[data-widget-definition="trending_content"]').remove();
// Remove "Similar Threads" that are Off-Topic
var similarThreads = document.querySelectorAll(".structItem");
for (var thread of similarThreads) {
var structItemParts = thread.querySelector(".structItem-parts");
if (structItemParts !== null) {
if (structItemParts.lastElementChild.innerText === 'Off-Topic') {
thread.remove();
}
}
//Else, it was another type of structItem
}
//If all were OT, remove "Similar Threads" entirely
var containers = document.querySelectorAll(".block-container");
for (var container of containers) {
if (container.innerText === 'Similar threads') {
container.remove();
}
}
})();
At this time this script doesn't work for other forums, although it could be adjusted to them fairly easily.
Search by Category by Default
Has it ever annoyed you that the "Search" dropdown defaults to "Everywhere"? Wouldn't it make more sense for it to default to "This Thread" if you are viewing a thread, or "This forum" if you are viewing a forum? That's what this script changes. Highly productivity-enhancing if you happen to need to search repeatedly in a forum while trying to locate something.
Code:
// ==UserScript==
// @name CFC Search by Category by Default
// @namespace http://tampermonkey.net/
// @version 2024-08-16
// @description Set the most specific XenForo search as the default, rather than the most general
// @author Quintillus
// @match https://forums.civfanatics.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=civfanatics.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const searchIcon = document.querySelector("a[href='/search/']");
if (searchIcon) {
searchIcon.addEventListener("click", () => {
console.log("Query selected");
const select = document.querySelector("select[name='constraints']");
select.lastElementChild.selected = true
});
}
})();
Search Improver
This is a one-liner that expands the "Search in forums" section of the Search Threads page, so that you can view more forums at once and thus enjoy a less claustrophobic forum-selection experience.
Code:
// ==UserScript==
// @name Make Search Better
// @namespace http://tampermonkey.net/
// @version 2024-09-14
// @description try to take over the world!
// @author Quintillus
// @match https://forums.civfanatics.com/search/?type=post
// @icon https://www.google.com/s2/favicons?sz=64&domain=civfanatics.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
document.querySelectorAll(".inputList select")[0].style.height="400px"
})();
You can customize the height from 400px if you'd prefer it a bit taller or a bit shorter.
Other scripts
I also had a script that disabled the number keys - 1 through 9 - selecting items in the forum header, but unfortunately the recent XenForo forum changes broke it and there are still bugs in my fix to it.
You are welcome to suggest other ideas for scripts, but it's likely that most ideas would require more ambitious changes that are feasible within a script.
Last edited: