Greasy Fork

Greasy Fork is available in English.

Xbox Wishlist Sale Items Only

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

当前为 2024-12-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
albinoghost
评分
0 0 0
版本
3
创建于
2024-11-13
更新于
2024-12-18
大小
8.1 KB
许可证
MIT
适用于

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.