CSGO交易平台卖家查询

Igxe C5game自售卖家查询

当前为 2020-01-08 提交的版本,查看 最新版本

// ==UserScript==
// @name         CSGO交易平台卖家查询
// @namespace    http://www.lupohan.com/
// @version      1.0
// @description  Igxe C5game自售卖家查询
// @author       lupohan44
// @match        *://www.igxe.cn/product/*
// @match        *://www.c5game.com/*
// @grant        none

// ==/UserScript==

(function() {
    $(document).ready(function(){
        start();
    });
})();
var timeoutId;
var done=false;
function start(){
    if($('.steamUrl').length!== 0){
        //c5
        timeoutId = setInterval(function(){
            c5game();
        } ,2000);
    }else if($('div.productInfo').length !== 0){
        //IGXE
        timeoutId = setInterval(function(){
            igxe();
        } ,200);
    }
}
function igxe(){
    $('#id-box4-vue > div > div.productDetailsCn > div > div.relatedInfo > div.tabCn > div:nth-child(1) > div.csgoInfo > table > tbody > tr > td:nth-child(2) > div.mainInfo').each(function(){
        var inspecturl = $(this).find('a').attr('href');
        if(inspecturl.indexOf(' ') > 0){
            inspecturl = encodeURI(inspecturl);
        }
        var needle = 'csgo_econ_action_preview%20';
        inspecturl = inspecturl.substring(inspecturl.indexOf(needle)+needle.length);
        var splitArr = inspecturl.split('A');
        var stid = splitArr[0].replace('S','');
        //console.log(stid);
        $(this).append('<a href="https://steamcommunity.com/profiles/'+ stid + '" target="_blank" class="glook">卖家Steam个人主页</a>');
        done=true;
    })
    if(done){
        clearTimeout(timeoutId);
    }
}
function c5game(){
    $('#J_SellTpl > tr.j_SaleItem').each(function(){
        var inspecturl = $(this).find('td:nth-child(1) > div:nth-child(2) > a').attr('href');
        if(inspecturl.indexOf(' ') > 0){
            inspecturl = encodeURI(inspecturl);
        }
        var needle = 'csgo_econ_action_preview%20';
        inspecturl = inspecturl.substring(inspecturl.indexOf(needle)+needle.length);
        var splitArr = inspecturl.split('A');
        var stid = splitArr[0].replace('S','');
        //console.log(stid);
        $(this).find('td:nth-child(1) > div:nth-child(2)').append('<a style="cursor: pointer" class="media-middle ft-inter ft-12 mr-5" target="_blank" href="https://steamcommunity.com/profiles/'+ stid + '">卖家</a>');
        done=true;
    })
    if(done){
        clearTimeout(timeoutId);
    }
}