Greasy Fork

Greasy Fork is available in English.

Karla's Tea Time With Tavi Search Helper

Adds easy search ssw and sw buttons to Tea Time With Tavi quest

当前为 2025-08-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Karla's Tea Time With Tavi Search Helper
// @namespace    karla@neopointskarla
// @license      GPL3
// @version      0.0.3
// @description  Adds easy search ssw and sw buttons to Tea Time With Tavi quest
// @author       Karla
// @match        *://*.neopets.com/games/teatime*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=neopets.com
// @grant        none
// ==/UserScript==

function insertButtons (target, stamp) {
    try {
        const div = document.createElement('div');
        const hasSSW = toggleSSW__2020;
        if (hasSSW) {
            const sswButton = document.createElement('div');
            sswButton.style.width = '20px';
            sswButton.style.height = '20px';
            sswButton.style.cursor = 'pointer';
            sswButton.style.display = 'inline-block';
            sswButton.innerHTML = '<img src="https://images.neopets.com/shopkeepers/super_shopwizard.gif" style="width: 100%; height: 100%;" />';
            sswButton.addEventListener('click', function() {
                console.log(document.querySelector('#ssw__2020').style.display)
                if (document.querySelector('#ssw__2020').style.display === '' || document.querySelector('#ssw__2020').style.display === 'none') {
                    toggleSSW__2020();
                }
                document.querySelector('#searchstr').value = stamp;
                document.querySelector('#ssw-criteria').selectedIndex = 0;
                document.querySelector('#price-limited').checked = false;
                document.querySelector('#ssw-button-search').click();
            });
            div.appendChild(sswButton);
        }
        const swButton = document.createElement('a');
        swButton.style.width = '20px';
        swButton.style.height = '20px';
        swButton.style.display = 'inline-block';
        swButton.innerHTML = '<img src="https://images.neopets.com/shopkeepers/shopwizard.gif" style="width: 100%; height: 100%;" />';
        swButton.href = `https://www.neopets.com/shops/wizard.phtml?string=${stamp}`;
        swButton.target = '_blank';
        div.appendChild(swButton);
        target.appendChild(div);
    } catch (e) {
        console.log(e);
    }
}

(function() {
    'use strict';

    // Your code here...
    [...document.querySelectorAll('.ttwt-item')].forEach(n => {
        insertButtons(n, n.querySelector('span').textContent);
    })
})();