Skip to content

Instantly share code, notes, and snippets.

@hjri
Last active December 17, 2015 20:19
Show Gist options
  • Save hjri/5666601 to your computer and use it in GitHub Desktop.
Save hjri/5666601 to your computer and use it in GitHub Desktop.
Small JS userscript to highlight items on steam market with min price lower than specified. Kinda shitty though.
// ==UserScript==
// @name Steam market highlighter
// @namespace hj
// @description Highlights low prices
// @include http://steamcommunity.com/market/*
// @version 1
// @grant none
// ==/UserScript==
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
function main() {
// Highlight prices beyound
var treshold = 31.0
jQ("span:contains('Starting at')").each(function(i,s){
if (parseFloat(s.textContent.split(":")[1].replace(",",".").match(/\d+[\.]\d+/)) < treshold){
jQ(s).parent().parent().css("background-color","rgb(130, 150, 130)").css("color","black")
}
})
jQ("#market_buynow_dialog_accept_ssa_container").css("width","100%").css("background-color", "green").css("position","relative")
jQ("#market_buynow_dialog_accept_ssa_label").css("position","absolute").css("top", "0").css("bottom", "0").css("left","0").css("right","0")
}
addJQuery(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment