FV - item museum/stall links

Turns item images into links on Furvilla shop pages.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         FV - item museum/stall links
// @description  Turns item images into links on Furvilla shop pages.
// @version      1.2.2
// @author       msjanny (#7302)
// @include      /^https?:\/\/www\.furvilla\.com\/([a-zA-z]*)?\/?shop.*/
// @match        https://www.furvilla.com/kitchen*
// @match        https://www.furvilla.com/recycler*
// @match        https://www.furvilla.com/oceandome/trove*
// @match        https://www.furvilla.com/foxbury_festival_shop*
// @match        https://www.furvilla.com/career/clinic*
// @grant       GM_setValue
// @grant       GM_getValue
// @namespace https://greasyfork.org/users/319295
// ==/UserScript==

(function() {
    'use strict';
    /* globals $:false */

    $(document).ready(function() {
        let stall = GM_getValue("museumstall", false);
        let toggle = $('<a style="position: relative;top: -22px">');
        if (stall)
            toggle.text('Adding item museum links');
        else
            toggle.text('Adding stall links');
        toggle.click( function() {
            stall = !stall;
            GM_setValue("museumstall", stall);
            location.reload();
        });
        toggle.insertAfter($('.content h1:last-of-type').eq(0));

        $('img[src^="https://www.furvilla.com/img/items/"]').each(function() {
            let id = $(this).attr('src').match(/[0-9]+/g)[1];
            if (stall)
                $(this).wrap(`<a href="https://www.furvilla.com/museum/item/${id}"></a>`);
            else
                $(this).wrap(`<a href="https://www.furvilla.com/stalls/search?name=${id}"></a>`);
        });
    });
})();