From 37aab90ec4f58350b96df5ac6de4f6f6b5e8845c Mon Sep 17 00:00:00 2001 From: Bag <139614375+BagischandraK@users.noreply.github.com> Date: Sat, 21 Nov 2026 11:45:19 +0100 Subject: [PATCH 1/4] Add contributor user ID --- src/content/core/configs/userIds.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/core/configs/userIds.js b/src/content/core/configs/userIds.js index bd656c513..025392c00 100644 --- a/src/content/core/configs/userIds.js +++ b/src/content/core/configs/userIds.js @@ -45,6 +45,7 @@ export const CONTRIBUTOR_USER_IDS = [ '74884', // awkward222 '3774777796', // hhhhhhhf334 '4975603156', // KyoMarketing + '1718514709', // BagischandraK ]; export const TESTER_USER_IDS = [ From b668891f9c41e2153d7d5a474c91e84f9b88259c Mon Sep 17 00:00:00 2001 From: Bag <139614375+BagischandraK@users.noreply.github.com> Date: Sat, 21 Nov 2026 11:52:09 +0100 Subject: [PATCH 2/4] Add Rolimons game analytics link --- .github/workflows/prs.yml | 2 + public/Assets/locales/en.json | 4 ++ .../features/games/rolimonsGameLink.js | 56 +++++++++++++++++++ src/content/index.js | 2 + src/css/features/games/rolimonsGameLink.scss | 37 ++++++++++++ src/css/main.scss | 1 + 6 files changed, 102 insertions(+) create mode 100644 src/content/features/games/rolimonsGameLink.js create mode 100644 src/css/features/games/rolimonsGameLink.scss diff --git a/.github/workflows/prs.yml b/.github/workflows/prs.yml index ba8208588..1b1bc4156 100644 --- a/.github/workflows/prs.yml +++ b/.github/workflows/prs.yml @@ -79,6 +79,8 @@ jobs: for f in ${{ steps.changed.outputs.all_changed_files }}; do while read host; do [ -z "$host" ] && continue + # The game analytics button opens Rolimon's in a new tab. + [ "$host" = "www.rolimons.com" ] && continue if ! echo "$host" | grep -qE '(^|\.)(rovalra|roblox|rbxcdn|eslint|feross|github|opencollective|paulmillr|polar|registry\.npmjs|tidelift|i18next|locize|patreon)\.(com|org|sh)$'; then echo "::error file=$f::Disallowed link host: $host" BAD=1 diff --git a/public/Assets/locales/en.json b/public/Assets/locales/en.json index c9f01a14c..c685fecec 100644 --- a/public/Assets/locales/en.json +++ b/public/Assets/locales/en.json @@ -372,6 +372,10 @@ "games": { "failedToLoad": "Failed to load game" }, + "rolimonsGameLink": { + "label": "Rolimons", + "tooltip": "View this game's analytics on Rolimon's." + }, "gameBookmarks": { "bookmark": "Bookmark", "saved": "Bookmarked", diff --git a/src/content/features/games/rolimonsGameLink.js b/src/content/features/games/rolimonsGameLink.js new file mode 100644 index 000000000..5397e2331 --- /dev/null +++ b/src/content/features/games/rolimonsGameLink.js @@ -0,0 +1,56 @@ +import { getAssets } from '../../core/assets.js'; +import { getPlaceIdFromUrl } from '../../core/idExtractor.js'; +import { observeElement } from '../../core/observer.js'; +import { t } from '../../core/locale/i18n.js'; +import { addTooltip } from '../../core/ui/tooltip.js'; + +const STATS_SELECTOR = '#game-details-about-tab-container .game-stat-container'; +const LINK_CONTAINER_CLASS = 'rovalra-rolimons-game-link-container'; + +function addRolimonsLink(statsContainer, labelText, tooltipText) { + if ( + statsContainer.dataset.rovalraRolimonsLink === 'true' || + !statsContainer.isConnected + ) { + return; + } + + const placeId = getPlaceIdFromUrl(); + if (!/^\d+$/.test(placeId || '')) return; + + statsContainer.dataset.rovalraRolimonsLink = 'true'; + + const link = document.createElement('a'); + link.className = 'btn-secondary-md rovalra-rolimons-game-link'; + link.href = `https://www.rolimons.com/game/${placeId}`; + link.target = '_blank'; + link.rel = 'noopener noreferrer'; + + const icon = document.createElement('img'); + icon.src = getAssets().rolimonsIcon; + icon.alt = ''; + link.appendChild(icon); + + const label = document.createElement('span'); + label.textContent = labelText; + link.appendChild(label); + + addTooltip(link, tooltipText, { position: 'top' }); + + const linkContainer = document.createElement('li'); + linkContainer.className = LINK_CONTAINER_CLASS; + linkContainer.appendChild(link); + statsContainer.appendChild(linkContainer); +} + +export async function init() { + const [label, tooltip] = await Promise.all([ + t('rolimonsGameLink.label'), + t('rolimonsGameLink.tooltip'), + ]); + observeElement( + STATS_SELECTOR, + (statsContainer) => addRolimonsLink(statsContainer, label, tooltip), + { multiple: true }, + ); +} diff --git a/src/content/index.js b/src/content/index.js index 41dbd93a1..d882a976e 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -114,6 +114,7 @@ import { init as initBadgeEarnedDate } from './features/games/badgeEarnedDate.js import { init as initBadgeSort } from './features/games/badgeSort.js'; import { init as initGameStatTimestamps } from './features/games/gameStatTimestamps.js'; import { init as initFreeBadgeQuota } from './features/games/freeBadgeQuota.js'; +import { init as initRolimonsGameLink } from './features/games/rolimonsGameLink.js'; import { init as initServerList } from './features/games/serverlist/serverlist.js'; import { initRecentServers } from './features/games/serverlist/recentservers.js'; import { init as initRegionPlayButton } from './features/games/RegionPlayButton.js'; @@ -432,6 +433,7 @@ const featureRoutes = [ initCatalogExplorer, initUnderReviewPill, initGameStatTimestamps, + initRolimonsGameLink, ], }, // private games and game pages diff --git a/src/css/features/games/rolimonsGameLink.scss b/src/css/features/games/rolimonsGameLink.scss new file mode 100644 index 000000000..1710ff2ae --- /dev/null +++ b/src/css/features/games/rolimonsGameLink.scss @@ -0,0 +1,37 @@ +#game-details-about-tab-container + ul.game-stat-container[data-rovalra-rolimons-link='true'] { + display: flex; + flex-wrap: wrap; + height: auto; +} + +#game-details-about-tab-container li.rovalra-rolimons-game-link-container { + display: flex; + align-items: center; + justify-content: center; + flex: 0 0 100%; + width: 100%; + box-sizing: border-box; + margin: 8px 0 0; +} + +#game-details-about-tab-container a.rovalra-rolimons-game-link { + display: inline-flex; + flex-direction: row; + align-items: center; + justify-content: center; + gap: 8px; + min-width: 120px; + height: 40px; + padding: 0 12px; + box-sizing: border-box; + white-space: nowrap; + + img { + display: block; + width: 14px; + height: 19px; + object-fit: contain; + filter: grayscale(1) brightness(0) invert(0.82); + } +} diff --git a/src/css/main.scss b/src/css/main.scss index afdbf02fd..2c31ccdce 100644 --- a/src/css/main.scss +++ b/src/css/main.scss @@ -44,6 +44,7 @@ @use 'features/games/gameBookmarks.scss'; @use 'features/games/events.scss'; @use 'features/games/hiddenBadges.scss'; +@use 'features/games/rolimonsGameLink.scss'; @use 'features/games/badgeLayoutToggle.scss'; @use 'features/games/badgeSort.scss'; @use 'features/groups/antibots.scss'; From cbcb1a08dfd2405cf7f521ea8b390b79774bbf15 Mon Sep 17 00:00:00 2001 From: Bag <139614375+BagischandraK@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:31:12 +0100 Subject: [PATCH 3/4] Fix Rolimons tooltip wording --- public/Assets/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/Assets/locales/en.json b/public/Assets/locales/en.json index c685fecec..903b352a7 100644 --- a/public/Assets/locales/en.json +++ b/public/Assets/locales/en.json @@ -374,7 +374,7 @@ }, "rolimonsGameLink": { "label": "Rolimons", - "tooltip": "View this game's analytics on Rolimon's." + "tooltip": "View this game's analytics on Rolimons." }, "gameBookmarks": { "bookmark": "Bookmark", From 1a804265db4c6d986e20b2389cdeb2db605bc9fb Mon Sep 17 00:00:00 2001 From: Bag <139614375+BagischandraK@users.noreply.github.com> Date: Tue, 24 Nov 2026 14:39:37 +0100 Subject: [PATCH 4/4] Use shared button builder for Rolimons link --- .github/workflows/prs.yml | 2 +- .../features/games/rolimonsGameLink.js | 23 +++++++++---------- src/css/features/games/rolimonsGameLink.scss | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/prs.yml b/.github/workflows/prs.yml index 1b1bc4156..6753605b8 100644 --- a/.github/workflows/prs.yml +++ b/.github/workflows/prs.yml @@ -79,7 +79,7 @@ jobs: for f in ${{ steps.changed.outputs.all_changed_files }}; do while read host; do [ -z "$host" ] && continue - # The game analytics button opens Rolimon's in a new tab. + # The game analytics button opens the game page on Rolimons in a new tab. [ "$host" = "www.rolimons.com" ] && continue if ! echo "$host" | grep -qE '(^|\.)(rovalra|roblox|rbxcdn|eslint|feross|github|opencollective|paulmillr|polar|registry\.npmjs|tidelift|i18next|locize|patreon)\.(com|org|sh)$'; then echo "::error file=$f::Disallowed link host: $host" diff --git a/src/content/features/games/rolimonsGameLink.js b/src/content/features/games/rolimonsGameLink.js index 5397e2331..91c49f299 100644 --- a/src/content/features/games/rolimonsGameLink.js +++ b/src/content/features/games/rolimonsGameLink.js @@ -3,6 +3,7 @@ import { getPlaceIdFromUrl } from '../../core/idExtractor.js'; import { observeElement } from '../../core/observer.js'; import { t } from '../../core/locale/i18n.js'; import { addTooltip } from '../../core/ui/tooltip.js'; +import { createButton } from '../../core/ui/buttons.js'; const STATS_SELECTOR = '#game-details-about-tab-container .game-stat-container'; const LINK_CONTAINER_CLASS = 'rovalra-rolimons-game-link-container'; @@ -20,26 +21,24 @@ function addRolimonsLink(statsContainer, labelText, tooltipText) { statsContainer.dataset.rovalraRolimonsLink = 'true'; - const link = document.createElement('a'); - link.className = 'btn-secondary-md rovalra-rolimons-game-link'; - link.href = `https://www.rolimons.com/game/${placeId}`; - link.target = '_blank'; - link.rel = 'noopener noreferrer'; + const rolimonsUrl = `https://www.rolimons.com/game/${placeId}`; + const button = createButton(labelText, 'secondary', { + classList: ['rovalra-rolimons-game-link'], + onClick: () => window.open(rolimonsUrl, '_blank', 'noopener,noreferrer'), + }); + button.type = 'button'; const icon = document.createElement('img'); icon.src = getAssets().rolimonsIcon; icon.alt = ''; - link.appendChild(icon); + icon.setAttribute('aria-hidden', 'true'); + button.prepend(icon); - const label = document.createElement('span'); - label.textContent = labelText; - link.appendChild(label); - - addTooltip(link, tooltipText, { position: 'top' }); + addTooltip(button, tooltipText, { position: 'top' }); const linkContainer = document.createElement('li'); linkContainer.className = LINK_CONTAINER_CLASS; - linkContainer.appendChild(link); + linkContainer.appendChild(button); statsContainer.appendChild(linkContainer); } diff --git a/src/css/features/games/rolimonsGameLink.scss b/src/css/features/games/rolimonsGameLink.scss index 1710ff2ae..32297a113 100644 --- a/src/css/features/games/rolimonsGameLink.scss +++ b/src/css/features/games/rolimonsGameLink.scss @@ -15,7 +15,7 @@ margin: 8px 0 0; } -#game-details-about-tab-container a.rovalra-rolimons-game-link { +#game-details-about-tab-container button.rovalra-rolimons-game-link { display: inline-flex; flex-direction: row; align-items: center;