Xbox Wishlist Sale Items Only

Display sale items with sorting options (discount, price, rating) and toggle sort order

Auteur
albinoghost
Installations quotidiennes
0
Installations (total)
3
Notes
0 0 0
Version
4
Créé
13/11/2024
Mis à jour
18/12/2024
Size
8,37 ko
Licence
MIT
S'applique à

This script customizes the Xbox wishlist page (https://www.xbox.com/en-us/wishlist) to display only items currently on sale, sorted by their discount percentage. The page is restyled to improve visual layout, with items presented in a grid format and styled cards showing discounted prices, original prices, and ratings.
Script Notes

Wishlist Data Extraction: The script scans for JavaScript tags containing window.__PRELOADED_STATE__, which holds wishlist data. This data is parsed to retrieve each wishlist item and its associated properties (e.g., prices, discount, title, images).

Custom Styling: The script dynamically injects CSS to create a modern grid layout with hover effects, setting up a cleaner presentation for wishlist items. Sale items are displayed in a 6-column grid, with each card showing item title, discount, prices, and ratings.

Filtering & Sorting: Items are filtered to show only those with a discount (salePrice < originalPrice). They are sorted in descending order by discount percentage, showing the largest discounts first.

Dynamic Item Display: Each sale item is displayed as a clickable card. Clicking on a card opens the item’s page in a new tab for purchase or more details.
Error Handling: If wishlist data is unavailable, an error message is logged to the console. The script also handles any errors during data parsing to ensure robust functionality.

Key Functions

getWishlistData(): Fetches and parses wishlist data from the page's preloaded state.
injectCustomStyles(): Adds custom CSS for a visually enhanced grid layout.
clearOriginalWishlistItems(): Removes the default wishlist items from the page to prevent overlap with the custom display.
displayWishlistData(wishlistItems): Filters and sorts sale items, then creates styled card elements for each item, showing relevant sale information.
initialize(): Sets up the custom wishlist grid, calls data retrieval, and displays wishlist items.

Usage

This script runs automatically when the Xbox wishlist page loads, showing only sale items in a customized grid, sorted by the highest discount for easy browsing. It requires no manual intervention beyond installing via Tampermonkey.