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 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);
    }
})();