roshpit

肉山谷拍卖装备比价辅助

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         roshpit
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  肉山谷拍卖装备比价辅助
// @author       vk
// @match        https://www.roshpit.ca/market/my_sales
// @grant        GM_addStyle
// @grant        GM_xmlhttpRequest
// ==/UserScript==

    // Your code here...

(function () {
    'use strict';

    //与元数据块中的@grant值相对应,功能是生成一个style样式
    GM_addStyle('#down_video_btn{color:#fa7d3c;}');

    //删除第二步多出来的flashy元素
    $(document.getElementsByClassName("flashy")).remove();
    document.getElementById("list-item-button").parentNode.id = "diyige";
    document.getElementById("auction-list-box").parentNode.id = "dierge";
    document.getElementById("diyige").parentNode.id = "dilingge";
    document.getElementById("diyige").style.width = "20%"
    document.getElementById("dierge").style.width = "35%"
    document.getElementById("dilingge").style.width = "95%"

    var down_btn_html = document.createElement("div");
    down_btn_html.id = "down_btn_html";
    down_btn_html.style ="background-color: black;position:relative;width: 36%;top: 30px;display:inline-block;height:12vh;"
    down_btn_html.className = "sbbbb";
    //将以上拼接的html代码插入到网页里的ul标签中
    var ul_tag = $("div.champions_container>div");
    ul_tag.append(down_btn_html);
    var oDiv = document.getElementById("down_btn_html");
    oDiv.onclick = function(){
        var childs = down_btn_html.childNodes;
        for(var i = childs .length - 1; i >= 0; i--) {
            down_btn_html.removeChild(childs[i]);
        }
        oDiv.InnerHTML= "";
        var item = document.evaluate("//div[@id='ability1']//p[@id='tooltip_title']", document).iterateNext().innerHTML;
        item = item.replace(/(^[\s\n\t]+|[\s\n\t]+$)/g, "")
        var url1 = "https://www.roshpit.ca/market/item_class_search?query="+item
        url1.replace(/(^[\s\n\t]+|[\s\n\t]+$)/g, "")
        var xhr = new XMLHttpRequest();
        xhr.open("GET", url1,true);
        xhr.send();
        xhr.onreadystatechange = function() {
            if(this.readyState !== 4)  return;
            if(this.status === 200) {
                var tt = this.responseText;
                var ttt = tt.match(/data-item-id="(\S*)"/)[1];
                var url2 = "https://www.roshpit.ca/market/auction_search?roshpit_item="+ttt
                var xhr2 = new XMLHttpRequest();
                xhr2.open("GET", url2,true);
                xhr2.send();
                xhr2.onreadystatechange = function() {
                    if(this.readyState !== 4)  return;
                    if(this.status === 200) {
                        var tt2 = xhr2.responseText;
                        var tag = $("div.champions_container>div>div.sbbbb");
                        tag.append(tt2);
                        var del = document.querySelectorAll("#down_btn_html a span")
                        for(var i = del .length - 1; i >= 0; i--) {
                            del[i].parentNode.removeChild(del[i]);
                        }
                    }
                }
            }
        }
    }
})();