您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
新球体育网(球探)手机端网页,按时间排序亚盘,并高亮显示主客水位。
当前为
// ==UserScript== // @name 新球体育网按时间排序亚盘 // @namespace http://dol.freevar.com/ // @version 0.1 // @description 新球体育网(球探)手机端网页,按时间排序亚盘,并高亮显示主客水位。 // @author Dolphin // @run-at document-idle // @match https://m.titan007.com/asian/* // @grant GM_addStyle // @license MIT // ==/UserScript== (function () { 'use strict'; GM_addStyle(` #oddsTable { border-collapse:collapse; margin:auto;} #oddsTable tr:nth-child(odd) {background:#eee;} #oddsTable td, #oddsTable th { font-size:16px; border:1px solid #888; text-align:center; padding:0 5px; } `); let isTableVisible = false; let statsBtn = null; function createButton() { statsBtn = document.createElement('div'); statsBtn.className = 'btn'; statsBtn.id = 'statsTab'; statsBtn.textContent = '排序'; statsBtn.style.cursor = 'pointer'; statsBtn.style.backgroundColor = '#4c4'; statsBtn.addEventListener('click', async function () { if (this.textContent === '排序') { if (!isTableVisible) { this.textContent = '加载中'; this.style.backgroundColor = '#c44'; await fetchDataAndGenerateTable(); this.textContent = '隐藏'; this.style.backgroundColor = '#44c'; isTableVisible = true; } } else { this.textContent = '排序'; this.style.backgroundColor = '#4c4'; const existingTable = document.querySelector('#oddsTable'); if (existingTable) existingTable.remove(); isTableVisible = false; } }); const btnContainer = document.querySelector('div.btns'); if (btnContainer) btnContainer.appendChild(statsBtn); } async function fetchDataAndGenerateTable() { try { const mainData = await fetchJson(`/HandicapDataInterface.ashx?scheid=${scheduleId}&type=1&oddskind=${oddskind}&isHalf=${isHalf}`); const companies = mainData.companies; const requests = companies.map(company => fetchJson(`/HandicapDataInterface.ashx?scheid=${scheduleId}&type=3&oddskind=${oddskind}&companyid=${company.companyId}&isHalf=${isHalf}`) .then(data => ({ company, data })) ); const results = await Promise.all(requests); const tableData = processResults(results); createTable(tableData); } catch (error) { console.error('Error fetching data:', error); } } function processResults(results) { return results.flatMap(({ company, data }) => { const emptyHappenTime = data.filter(item => item.HappenTime === ""); let targets = []; if (emptyHappenTime.length >= 2) { targets.push(emptyHappenTime[0], emptyHappenTime[emptyHappenTime.length - 1]); } else if (emptyHappenTime.length === 1) { targets.push(emptyHappenTime[0]); } else if (data.length > 0) { targets.push(data[data.length - 1]); } return targets.map(item => ({ nameCn: company.nameCn, HomeOdds: parseFloat(item.HomeOdds), PanKou: item.PanKou, AwayOdds: parseFloat(item.AwayOdds), ModifyTime: item.ModifyTime })); }).sort((a, b) => b.ModifyTime.localeCompare(a.ModifyTime)); } function createTable(data) { const table = document.createElement('table'); table.id = 'oddsTable'; // Create header const header = table.insertRow(); ['公司', '主水', '让球', '客水', '更新时间'].forEach(text => { const th = document.createElement('th'); th.textContent = text; header.appendChild(th); }); // Create rows data.forEach(item => { const row = table.insertRow(); const createCell = (text) => { const td = document.createElement('td'); td.textContent = text; return td; }; row.appendChild(createCell(item.nameCn)); const homeCell = createCell(item.HomeOdds); const awayCell = createCell(item.AwayOdds); if (item.HomeOdds > item.AwayOdds) { homeCell.style.backgroundColor = '#fcc'; awayCell.style.backgroundColor = '#cfc'; } else if (item.HomeOdds < item.AwayOdds) { homeCell.style.backgroundColor = '#cfc'; awayCell.style.backgroundColor = '#fcc'; } row.appendChild(homeCell); row.appendChild(createCell(item.PanKou)); row.appendChild(awayCell); row.appendChild(createCell(item.ModifyTime)); }); const contentDiv = document.querySelector('div#content'); if (contentDiv && contentDiv.firstChild) { contentDiv.insertBefore(table, contentDiv.firstChild); } } function fetchJson(url) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onload = function() { if (xhr.status === 200) { try { resolve(JSON.parse(xhr.responseText)); } catch (e) { reject(e); } } else { reject(new Error(`Request failed with status ${xhr.status}`)); } }; xhr.onerror = () => reject(new Error('Network Error')); xhr.send(); }); } // Initialize createButton(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址