// ==UserScript== // @name 闲鱼商品行情计算 // @namespace http://tampermonkey.net/ // @version 0.3 // @description 计算闲鱼搜索结果页上商品的价格均值、中位数、去除极值后的均值,并在页面左侧显示结果 // @author yitong2333 // @match https://www.goofish.com/search* // @license MIT // @icon https://ts3.cn.mm.bing.net/th?id=ODLS.926d4c1b-8117-4eb0-ba9d-5d557466c78c&w=32&h=32&qlt=90&pcl=fffffa&o=6&pid=1.2 // @homepageURL https://greasyfork.org/zh-CN/scripts/523094 // @grant none // @downloadURL https://update.greasyfork.icu/scripts/523094/%E9%97%B2%E9%B1%BC%E5%95%86%E5%93%81%E8%A1%8C%E6%83%85%E8%AE%A1%E7%AE%97.user.js // @updateURL https://update.greasyfork.icu/scripts/523094/%E9%97%B2%E9%B1%BC%E5%95%86%E5%93%81%E8%A1%8C%E6%83%85%E8%AE%A1%E7%AE%97.meta.js // ==/UserScript== (function() { 'use strict'; // 创建并显示一个固定位置的小窗口 const createWindow = () => { const windowDiv = document.createElement('div'); windowDiv.style.position = 'fixed'; windowDiv.style.left = '10px'; windowDiv.style.top = '100px'; windowDiv.style.padding = '10px'; windowDiv.style.backgroundColor = '#fff'; windowDiv.style.border = '1px solid #ccc'; windowDiv.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.2)'; windowDiv.style.zIndex = '9999'; windowDiv.style.fontSize = '14px'; windowDiv.style.color = '#333'; windowDiv.style.maxWidth = '200px'; windowDiv.style.borderRadius ='10px'; windowDiv.style.transition = 'all 0.3s ease'; // 在窗口中添加标题 const title = document.createElement('h4'); title.textContent = '闲鱼商品行情计算'; title.style.margin = '0'; title.style.fontSize = '16px'; title.style.color = '#1E90FF'; windowDiv.appendChild(title); // 创建显示结果的区域 const content = document.createElement('div'); content.id = 'price-stats'; windowDiv.appendChild(content); // 将小窗口添加到页面 document.body.appendChild(windowDiv); }; // 更新小窗口中的价格统计信息 const updateWindow = (averagePrice, medianPrice, averageWithoutOutliers) => { const contentDiv = document.getElementById('price-stats'); if (contentDiv) { contentDiv.innerHTML = `