IMVU Product Not Found / Hidden Product Page Viewer

Replaces 'Product Not Found' pages with a styled box using meta tag data (no cart/maturity).

目前為 2025-04-15 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         IMVU Product Not Found / Hidden Product Page Viewer
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Replaces 'Product Not Found' pages with a styled box using meta tag data (no cart/maturity).
// @author       heapsofjoy
// @match        https://www.imvu.com/shop/product.php*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Only run if the product-not-found box exists
    const productNotFoundBox = document.querySelector('#also h3');
    if (!productNotFoundBox || productNotFoundBox.textContent.trim() !== 'Product Not Found') return;

    // Get product ID from URL
    const urlParams = new URLSearchParams(window.location.search);
    const productId = urlParams.get('products_id') || 'unknown';

    // Get info from meta tags and title
    const productName = document.querySelector('meta[property="og:title"]')?.content || 'Unknown Product';
    const productImage = document.querySelector('meta[property="og:image"]')?.content ||
                         'https://webasset-akm.imvu.com/catalog/web_images/icon_no_image.gif';

    const titleMatch = document.title.match(/by\s(.+)$/i);
    const creatorName = titleMatch ? titleMatch[1] : 'Unknown';

    // Create replacement product box
    const replacementBox = document.createElement('div');
    replacementBox.className = 'jello-box';
    replacementBox.id = 'product';

    replacementBox.innerHTML = `
        <div class="hd">
            <div class="bg">
                <h3>Product Information</h3>
            </div>
        </div>
        <div class="bd" style="overflow:visible">
            <div id="product-details">
                <div style="position:relative;float:left;margin-right:15px;">
                    <img id="product-image" src="${productImage}" width="100" height="80" alt="Product Image" style="border:1px solid #ccc;">
                </div>

                <h1 class="notranslate" style="margin-top: 0;">${productName}</h1>

                <h2>
                    By <a class="notranslate" href="/shop/web_search.php?avatar=${encodeURIComponent(creatorName)}">${creatorName}</a>
                </h2>

                <div id="product-try" style="margin-top: 10px;">
                    <a id="try-on-link" href="imvu:DressUp?productId=${productId}">
                        <img height="26" width="62" src="/catalog/web_images/tryitminibutton_gold.gif" alt="Try It">
                    </a>
                    <a href="imvu:TakeOff?productId=${productId}">Remove</a>
                </div>

                <div id="product-links" style="margin-top: 10px;">
                    <span class="links">
                        <a href="javascript:void(0);">Add to wishlist</a> |
                        <a href="javascript:void(0);">Add to giftlist</a> |
                        <a href="javascript:void(0);">Gift</a> |
                        <a href="/catalog/wishlist.php">My Wishlist</a> |
                        <a href="/catalog/web_flag_product_new.php?products_id=${productId}">
                            <img src="/common/img/icon_16px_flag_blue.png"><font style="text-decoration:underline">Flag</font>
                        </a>
                    </span>
                </div>

                <div id="product-disclaimer" style="margin-top: 15px;">
                    This product was not found in the catalog. It may have been removed or set to hidden by
                    <a class="notranslate" href="/catalog/web_mypage.php?avatar=${encodeURIComponent(creatorName)}">${creatorName}</a>.
                </div>
            </div>
        </div>
    `;

    // Replace the original box
    const originalBox = document.querySelector('.jello-box#also');
    if (originalBox) {
        originalBox.replaceWith(replacementBox);
    }
})();