Skip to content

Conversation

@BuddyWinte
Copy link

Description

Improved the Roblox Presence activity for PreMiD:

  • Normalized search query handling to lowercase for consistency.
  • Fixed profileImg scoping bug.
  • Added optional chaining for safer element access.
  • Cached frequently used DOM queries to improve performance.
  • Improved readability and maintainability of the UpdateData handler.

Acknowledgements

Screenshots

Proof showing the creation/modification is working as expected
  1. Roblox home page presence showing "Home"
  2. Profile page presence showing username and "Browsing creations..."
  3. Marketplace search showing search term in presence

Signed-off-by: BuddyWinte <BuddyWinte@gmail.com>
@@ -1,4 +1,5 @@
import { Assets } from 'premid'
// import { Assets } from 'premid'
import { Presence, PresenceData, Assets } from 'premid'; // TS hates when you dont define it all.

Check failure

Code scanning / PMD

Makes sure the TypeScript files are correct Error

Module '"premid"' has no exported member 'Presence'.
@@ -1,4 +1,5 @@
import { Assets } from 'premid'
// import { Assets } from 'premid'
import { Presence, PresenceData, Assets } from 'premid'; // TS hates when you dont define it all.

Check failure

Code scanning / PMD

Makes sure the TypeScript files are correct Error

Module '"premid"' has no exported member 'PresenceData'.
@@ -1,4 +1,5 @@
import { Assets } from 'premid'
// import { Assets } from 'premid'
import { Presence, PresenceData, Assets } from 'premid'; // TS hates when you dont define it all.

Check failure

Code scanning / ESLint

Enforce consistent usage of type imports Error

Imports "PresenceData" are only used as type.
@@ -1,4 +1,5 @@
import { Assets } from 'premid'
// import { Assets } from 'premid'
import { Presence, PresenceData, Assets } from 'premid'; // TS hates when you dont define it all.

Check failure

Code scanning / ESLint

Enforce sorted named imports. Error

Expected "Assets" to come before "PresenceData".
@@ -1,4 +1,5 @@
import { Assets } from 'premid'
// import { Assets } from 'premid'
import { Presence, PresenceData, Assets } from 'premid'; // TS hates when you dont define it all.

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
)
const newUrl = new URL(href)
const searchResult = newUrl.searchParams?.get('Keyword') ?? newUrl.searchParams?.get('query')
const searchResult = (newUrl.searchParams.get('keyword') ?? newUrl.searchParams.get('query'))?.toLowerCase() ?? null;

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
.querySelector('.avatar-card-link.avatar-image-link')
?.querySelector('img')
?.getAttribute('src') ?? ActivityAssets.Logo
const profileImg = document.querySelector<HTMLImageElement>('.avatar-card-link.avatar-image-link img');

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
?.querySelector('img')
?.getAttribute('src') ?? ActivityAssets.Logo
const profileImg = document.querySelector<HTMLImageElement>('.avatar-card-link.avatar-image-link img');
presenceData.largeImageKey = profileImg?.src ?? ActivityAssets.Logo;

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
break
}
case pathname.includes('/u/'): {
//const user = document.querySelector('.username')?.textContent

Check failure

Code scanning / ESLint

Enforce consistent spacing after the `//` or `/*` in a comment Error

Expected exception block, space or tab after '//' in comment.
//const user = document.querySelector('.username')?.textContent
// for some reason, the devforum has different classes per user? weird?
const user = document.querySelector('.username')?.textContent
?? document.querySelector('.user-card-name')?.textContent;

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
@theusaf theusaf changed the title Fix typos and improve variable assignments in presence.ts fix(Roblox): fix typos and improve variable assignments Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants