From fc9b7aae98792822e2cabd9b67dc75f5ba049bd2 Mon Sep 17 00:00:00 2001 From: luxick Date: Wed, 16 Jul 2025 09:59:29 +0200 Subject: [PATCH] Update whapedia-image-redirect.user.js --- whapedia-image-redirect.user.js | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/whapedia-image-redirect.user.js b/whapedia-image-redirect.user.js index c59d7ee..5ad6360 100644 --- a/whapedia-image-redirect.user.js +++ b/whapedia-image-redirect.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Wahapedia Enhanced Search // @namespace http://tampermonkey.net/ -// @version 2025-02-14 +// @version 2025-07-16 // @description Enhances Wahapedia with Kagi image search and Warhammer.com search // @author luxick // @updateURL https://github.com/luxick/scripts/raw/master/whapedia-image-redirect.user.js @@ -44,28 +44,28 @@ return warhammerButton; } - // Function to add Warhammer.com search buttons function addWarhammerSearchButtons() { - // Get the model name from the dsH2Header div - const headerContainer = document.querySelector('.dsH2Header'); - if (!headerContainer) return; + // Get all model name containers + const headerContainers = document.querySelectorAll('.dsH2Header'); + if (!headerContainers.length) return; - const modelName = headerContainer.firstElementChild.textContent.trim(); - if (!modelName) return; + headerContainers.forEach(headerContainer => { + const modelName = headerContainer.firstElementChild.textContent.trim(); + if (!modelName) return; - // Add button to narrow container - const narrowContainer = document.querySelector('.dsIconsNarrow'); - if (narrowContainer) { - narrowContainer.appendChild(createButton(modelName)); - } + const narrowContainer = headerContainer.querySelector('.dsIconsNarrow'); + if (narrowContainer) { + narrowContainer.appendChild(createButton(modelName)); + } - // Add button to wide container - const wideContainer = document.querySelector('.dsIconsWide'); - if (wideContainer) { - wideContainer.appendChild(createButton(modelName)); - } + const wideContainer = headerContainer.querySelector('.dsIconsWide'); + if (wideContainer) { + wideContainer.appendChild(createButton(modelName)); + } + }); } + // Initial run of both functions replaceImageSearchUrls(); addWarhammerSearchButtons();