500.com 小助手

500.com plus,display team info

目前為 2023-01-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name         500.com 小助手
// @namespace    https://gf.qytechs.cn/zh-CN/users/252532-markiiiiiiii
// @version      0.0.3
// @description  500.com plus,display team info
// @author       kumits
// @match        https://trade.500.com/jczq/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=500.com
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/layer/3.5.1/layer.min.js
// @grant        GM_xmlhttpRequest
// @grant        GM_addStyle
// @run-at       document-end
// @license      MIT
// ==/UserScript==



// 移除广告层
function removeAdDiv() {
    GM_addStyle('#recommendAtionContainerID{display:none !important}'); // 移除专家推荐层
    GM_addStyle('#floatLayerContainerID{display:none !important}'); //移除浮动app下载层
    GM_addStyle('#popupContainerID{display:none !important}'); //移除遮罩顶层
}
//添加信息图标
function addInfoBtn(){
    //添加图标
    $('td[class="td td-team"] > div[class="team"] > span[class="team-l"]').each((k,v)=>{
        $(v).before('<i class="fa fa-info-circle" aria-hidden="true" style="color:#ff5721"></i>');
    });
   //监听图标点击动作
   $('.fa.fa-info-circle').on('click',function(){
       var l_url = $(this).parent().parent().parent().find('.td.td-data > a:first').attr('href');
       var r_url = $(this).parent().parent().parent().find('.td.td-data > a:eq(2)').attr('href');
       layer.closeAll();
       getTeamInfo(l_url);
       getLottoInfo(r_url);
   })
}

//获取欧赔信息
function getLottoInfo(urlpath) {
    GM_xmlhttpRequest({
        method: "GET",
        responseType:'blob',
        url: urlpath,
        onload: function (res) {
            let reader = new FileReader()
            reader.readAsText(res.response,"gb2312")
            reader.onload=function(e){
                //获取到球队页面
                let domObj= e.target.result;
               let contents = euroLottoDiv(domObj)
                //右侧功能层弹出
                InfoDiv('欧赔数据','rt',contents);
            }
        }
    })
}


// 获取队伍信息
function getTeamInfo(urlpath) {
    GM_xmlhttpRequest({
        method: "GET",
        responseType:'blob',
        url: urlpath,
        onload: function (res) {
            let reader = new FileReader()
            reader.readAsText(res.response,"gb2312")
            reader.onload=function(e){
                //获取到球队页面
                let domObj= e.target.result;
               let contents = historyDiv(domObj)
                contents +=bankingDiv(domObj)
                contents +=recordDiv(domObj)
                contents +=integralDiv(domObj)
                //左侧功能层弹出
                InfoDiv('主客数据','lt',contents);
            }
        }
    })
}
//交战历史层
function historyDiv(dom){
    var filterTabel = $(dom).find('.mar_b.history.M_box')
    filterTabel.find('.M_content>.pub_table>tbody>tr').each(
        function(index,item){
            if(index == 0){
                $(item).find('th:gt(4)').remove()
            }else{
                $(item).find('td:gt(4)').remove()
            }
        }
    );
    filterTabel.find('.M_content>.pub_table>colgroup>col:gt(4)').remove()
    filterTabel.find('.M_content_t').remove();
    filterTabel.find('.M_title>span').remove();
    return filterTabel[0].innerHTML
}

//排名层
function bankingDiv(dom){
    //获取主队名
    var homeTeamName =$(dom).find('.M_box>.M_sub_title>div:first')[0].innerText
    //获取客队名称
    var awayTeamName =$(dom).find('.M_box>.M_sub_title>div:last')[0].innerText
    var homeTeamTable = $(dom).find('.M_box>.M_content>.team_a')
    homeTeamTable.find('table').wrap('<div><h4>主:'+homeTeamName+'</h4></div>');
    var awayTeamTable =$(dom).find('.M_box>.M_content>.team_b')
    awayTeamTable.find('table').wrap('<div><h4>客:'+awayTeamName+'</h4></div>');
    return $(homeTeamTable)[0].innerHTML+$(awayTeamTable)[0].innerHTML
}
//近期战绩层
function recordDiv(dom){
   var homeTeamTable = $(dom).find('.M_box.record>.odds_zj_tubiao.module_cur>.team_a>form>.M_content')
   homeTeamTable.find('.bottom_info').remove()
   homeTeamTable.find('table').wrap('<div><h4>主队战绩</h4></div>');
   var awayTeamTable = $(dom).find('.M_box.record>.odds_zj_tubiao.module_cur>.team_b>form>.M_content')
   awayTeamTable.find('.bottom_info').remove()
   awayTeamTable.find('table').wrap('<div><h4>客队战绩</h4></div>');
   return $(homeTeamTable)[0].innerHTML+$(awayTeamTable)[0].innerHTML
}

//未来赛事层
function integralDiv(dom){
   var homeTeamTable = $(dom).find('.M_box.integral>.M_content>.team_a')
   homeTeamTable.find('table').wrap('<div><h4>主队未来赛事</h4></div>');
   var awayTeamTable = $(dom).find('.M_box.integral>.M_content>.team_b')
   awayTeamTable.find('table').wrap('<div><h4>客队未来赛事</h4></div>');
   return $(homeTeamTable)[0].innerHTML+$(awayTeamTable)[0].innerHTML
}
//欧赔数据层
function euroLottoDiv(dom){
    var lottoTable = $(dom).find('.table_cont').parent()
    return $(lottoTable)[0].innerHTML
}

//弹出层
function InfoDiv(title,offset,contents) {
    layer.open({
        type:1,
        title: title,
        offset:offset,
        shadeClose: true,
        shade: false,
        maxmin: true, //开启最大化最小化按钮
        area: ['610px', '800px'],
        content: contents
    });
}
//添加css
function addCss() {
    $(document.body).append('<link href="https://cdn.bootcdn.net/ajax/libs/layer/3.5.1/theme/default/layer.min.css" rel="stylesheet">');
    $(document.body).append('<link href="https://www.500cache.com/odds/css/odds_new.css?v=2020-10-22" rel="stylesheet">');
    $(document.body).append('<link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/all.min.css" rel="stylesheet">');
}
//主函数
function MainFunc() {
    addCss();
    removeAdDiv();
    addInfoBtn();
    //showMatchInfo();
    //showTeamInfo();
}

MainFunc(); //主函数执行

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址