Greasy Fork

Greasy Fork is available in English.

直播吧实时比分标题

try to take over the world!

当前为 2019-02-13 提交的版本,查看 最新版本

// ==UserScript==
// @name         直播吧实时比分标题
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.zhibo8.cc/zhibo/nba/*.htm
// @grant        none
// @require http://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==

(function() {
    'use strict';

    var ttlIntrvl = setInterval(function() {
        showScoreTitle();
    }, 3000);
    showScoreTitle();
})();

function showScoreTitle() {
    var $vt = $('.bf_top .team_1 .visit_team_name a');
    var $vs = $('.bf_top .bf_box.tmtop .time_score .visit_score');
    var $ht = $('.bf_top .team_2 .home_team_name a');
    var $hs = $('.bf_top .bf_box.tmtop .time_score .host_score');

    if (
        $vt.length < 1 ||
        $vs.length < 1 ||
        $ht.length < 1 ||
        $hs.length < 1
    ) {
        alert('PARSE ERROR!');
        return;
    }

    document.title = $vt.text() + " " + $vs.html() + " ➲ " + $hs.html() + " " + $ht.text();
}