Attn Moderators: question regarding search

bacchant

Chieftain
Joined
Aug 3, 2024
Messages
37
Please forgive me if I'm missing something obvious, but have you considered implementing the ability to search only in a specific thread from the thread page(s) itself. Personally, I'd find this very useful (some threads are dozens, even hundreds of pages).
 
This is implemented. :confused:

Search.jpg
 
Definitely seems like web filters has gotten less user friendly over the years.
 
While I'd been aware of this option, it had been bothering me that it always defaults to the most general "Everywhere" category, rather than being smart about things and assuming that if you are in, say, the Civ V Creation and Customization forum, you probably are looking for something in that forum.

The Internet indicates that at one point, that was the default on XenForo, but it seems to not be the case today. Maybe we can change it forum-wide? But in lieu of that, I wrote a Tampermonkey script that automatically sets the selection to the most specific search option, which is almost always what I want to use:

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
        });
    }
})();

Tested it out in the forums - works in a specific forum, works in a category e.g. Civilization VI - and the Downloads Database, and the Gallery. The only fly in the ointment so far is that the most specific option in the Gallery is "Comments" rather than "Media" which is likely what most people want most of the time, but it's still an improvement over the default "Everywhere", which includes outside of the Gallery.

Also note, I've only tested this with the Manifest V2 version of Tampermonkey. It should work out of the box in all browsers other than Chrome; whether it works there or not, I cannot say, as I don't use Chrome.

I should probably start a library thread for these Tampermonkey customizations I've been accumulating and sharing one-off in threads like this... and maybe I'll add one for Advanced Search at some point too. I don't think XenForo really designed that interface for forums with hundreds of sub-forums, but it would certainly be nice not to have to scroll through all the forums to select the one forum that you actually wanted to search within.
 
Last edited:
Back
Top Bottom