steam+

在steam页面对着一个商品按ctrl+右键,即可快速打开该商品的steamdb链接,用于查看其价格曲线等。

目前为 2021-06-24 提交的版本。查看 最新版本

// ==UserScript==
// @name         steam+
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  在steam页面对着一个商品按ctrl+右键,即可快速打开该商品的steamdb链接,用于查看其价格曲线等。
// @author       Pikaqian
// @match        https://store.steampowered.com/*
// @icon         https://store.steampowered.com/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var match_bundle=/bundle\/\d{3,7}\//
    var match_app=/app\/\d{3,7}\//
    var match_sub=/sub\/\d{3,7}\//
    var page_url=window.location.href,img
    function openUrl(type,img){
        var page_substr=img.match(/\d{3,7}/)
        var last_id=img.substr(page_substr.index,page_substr[0].length)
        window.open("https://steamdb.info/"+type+"/"+last_id+"/")
        event.preventDefault()
    }
    window.addEventListener('contextmenu',function (event){
        if(event.ctrlKey==true){
            if(page_url.match(match_bundle)!=null){
                openUrl("bundle",page_url)
            }
            else if(page_url.match(match_app)!=null){
                openUrl("app",page_url)
            }
            else if(page_url.match(match_sub)!=null){
                openUrl("sub",page_url)
            }
            else{
                var lala=event.target
                var elemA=event.target
                for(var i=0;i<10;i++){
                    if(event.target.localName=="a"){
                        img=event.target.href
                    }
                    else{
                        elemA=elemA.parentNode
                        if(elemA.localName=="a"){
                            img=elemA.href
                            break
                        }
                    }
                }
                var page_substr=img.match(/\d{3,7}/)
                var last_id=img.substr(page_substr.index,page_substr[0].length)
                for(var k=0;k<elemA.href.split("/").length;k++){
                    if(elemA.href.split("/")[k]=="store.steampowered.com"){
                        var type=elemA.href.split("/")[k+1]
                        }
                }
                window.open("https://steamdb.info/"+type+"/"+last_id+"/")
                event.preventDefault()
                //alert("首页")
            }
        }
    })
})();

QingJ © 2025

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