您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Move rows with Current Price 15 to the top and change their background color to highlight yellow or display a message if there are no buyable stocks.
// ==UserScript== // @name Grundo's Cafe: Stock Market - Highlight Buyable Stocks (at 15nps) // @namespace https://www.grundos.cafe // @version 1.1 // @description Move rows with Current Price 15 to the top and change their background color to highlight yellow or display a message if there are no buyable stocks. // @author Shalane // @match https://www.grundos.cafe/games/stockmarket/stocks/?view_all=True // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function highlightBuyableStocks() { const table = document.querySelector('table[border="1"], .stock-table'); if (!table) { console.log("Table not found on this page."); return; } const rows = Array.from(table.querySelectorAll('tr')); const buyableRows = []; rows.forEach(row => { const cells = row.querySelectorAll('td'); if (cells.length >= 6) { const currCell = cells[5]; if (currCell.textContent.trim() === "15") { buyableRows.push(row); } } }); if (buyableRows.length === 0) { // Display a message if there are no buyable stocks const messageDiv = document.createElement('div'); messageDiv.textContent = "😭 There are no buyable stocks at this time."; messageDiv.style.fontSize = '24px'; messageDiv.style.textAlign = 'center'; table.parentNode.insertBefore(messageDiv, table); } else { buyableRows.forEach(row => { // Move each buyable row to the top of the table row.parentNode.removeChild(row); table.querySelector('tbody').insertBefore(row, table.querySelector('tbody').firstChild); // Highlight each cell in the row for visual emphasis const cells = row.querySelectorAll('td'); cells.forEach(cell => { cell.style.backgroundColor = 'yellow'; }); }); } } window.addEventListener('load', highlightBuyableStocks); })();