Greasy Fork is available in English.
在页面标题或者标签栏显示比赛的实时比分
当前为
// ==UserScript==
// @name 直播吧NBA直播标题栏比分
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 在页面标题或者标签栏显示比赛的实时比分
// @author You
// @match https://www.zhibo8.cc/zhibo/nba/*.htm
// @grant none
// ==/UserScript==
(function() {
'use strict';
var ttlIntrvl = setInterval(function() {
showScoreTitle();
}, 3000);
showScoreTitle();
})();
function showScoreTitle() {
const vtm = document.querySelectorAll('.bf_table .visit_team_name a');
if (vtm.length < 1) {
console.warn("no visit team");
return;
}
const vsc = document.querySelectorAll('.bf_top .bf_box.tmtop .time_score .visit_score');
if (vtm.length < 1) {
console.warn("no visit score");
return;
}
const htm = document.querySelectorAll('.bf_table .home_team_name a');
if (vtm.length < 1) {
console.warn("no host team");
return;
}
const hsc = document.querySelectorAll('.bf_top .bf_box.tmtop .time_score .host_score');
if (vtm.length < 1) {
console.warn("no host score");
return;
}
document.title = `${vtm[0].innerText} ${vsc[0].innerText} ➲ ${htm[0].innerText} ${hsc[0].innerText}`;
}