您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds the quantity available to the In-Stock badge when viewing
// ==UserScript== // @name Ubiquiti Store: Show Quantity In Stock // @version 0.1.2 // @icon https://prd-www-cdn.ubnt.com/static/favicon-152.png // @namespace http://github.com/rogwilco // @license MIT // @author Nick Williams <[email protected]> // @description Adds the quantity available to the In-Stock badge when viewing // a product. // // @include https://store.ui.com/* // @include https://*.store.ui.com/* // // @require http://code.jquery.com/jquery-1.8.0.min.js // ==/UserScript== (function() { 'use strict' $(document).ready(() => { let theWindow try { theWindow = unsafeWindow } catch (e) { theWindow = window } const quantity = theWindow.APP_DATA.product.variants ?.reduce((total, v) => total += v.inventory_quantity, 0) .toString() .replace(/\B(?=(\d{3})+(?!\d))/g, ",") $('#titleInStockBadge').html(`${quantity} In Stock`) }) })();