您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Change box score links on ESPN's NBA site to redirect to the old style box scores that show more information.
// ==UserScript== // @name ESPN NBA Old-style Box Scores // @namespace driver8.net // @description Change box score links on ESPN's NBA site to redirect to the old style box scores that show more information. // @match *://*.espn.com/* // @run-at document-idle // @version 0.1 // @grant GM_getValue // @grant GM_setValue // @grant GM_registerMenuCommand // ==/UserScript== function MouseListen() { document.addEventListener('mousedown', function (evt) { var tgt = evt.target; console.log(tgt); if (tgt.nodeName == 'SPAN' && tgt.parentNode.nodeName == 'A') { tgt = tgt.parentNode; } if (tgt.nodeName == 'A' && tgt.href) { var ret = true; var box_regex = /(https?:\/\/)[^\/]+\.espn\.com(\/nba\/boxscore\?gameId=\d+)/; var pbp_regex = /(https?:\/\/)[^\/]+\.espn\.com(\/nba\/playbyplay\?gameId=\d+)/; var ins_regex = /(https?:\/\/)insider\.espn\.com(\/nba\/(?:shotchart|matchup|recap|game|conversation)\?gameId=\d+)/; if (doBox && tgt.href.match(box_regex)) { // change box score links ret = false; tgt.href = tgt.href.replace(box_regex, '$1insider.espn.com$2'); } if (doPbp && tgt.href.match(pbp_regex)) { // change play-by-play links and show all quarters ret = false; tgt.href = tgt.href.replace(pbp_regex, '$1insider.espn.com$2'); tgt.href = tgt.href.replace(/(playbyplay\?gameId=\d+)$/, '$1&period=0'); } // change links that are not available on insider if (tgt.href.match(ins_regex)) { tgt.href = tgt.href.replace(ins_regex, '$1www.espn.com$2'); } return ret; } }); } //Set up prefs and menu commands var DO_BOX = doBox = GM_getValue('dobox', true), DO_PBP = doPbp = GM_getValue('dopbp', true); var box_caption = (DO_BOX ? 'Disable' : 'Enable') + ' box score redirects'; GM_registerMenuCommand(box_caption, function () { doBox = !DO_BOX; GM_setValue('dobox', doBox); }); var pbp_caption = (DO_PBP ? 'Disable' : 'Enable') + ' play-by-play redirects'; GM_registerMenuCommand(pbp_caption, function () { doPbp = !DO_PBP; GM_setValue('dopbp', doPbp); }); MouseListen();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址