Skip to content

Instantly share code, notes, and snippets.

@MartinKnopf
Created July 3, 2017 14:27
Show Gist options
  • Save MartinKnopf/41f1df300ea26207cbcd5252cb8cbb58 to your computer and use it in GitHub Desktop.
Save MartinKnopf/41f1df300ea26207cbcd5252cb8cbb58 to your computer and use it in GitHub Desktop.
Userscript for Steam app pages, that appends a link to the title, which leads to the corresponding steamspy page.
// ==UserScript==
// @name steamspy shortcut
// @namespace http:/flatbutton.co/
// @version 1.0
// @author Martin Knopf
// @match http://store.steampowered.com/app/*
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js
// ==/UserScript==
(function() {
console.log('steamspy shortcut');
var $ = Zepto;
var pathParts = window.location.href.split('/');
var appId = '';
for(var i = pathParts.length-1; i >= 0; i--) {
if(!isNaN(pathParts[i]) && pathParts[i] != "") {
appId = pathParts[i];
break;
}
}
$('.apphub_AppName').append('<span style="font-size: 12px;vertical-align: middle;margin-left: 1em;">></span><a target="_blank" style="font-size: 12px;vertical-align: middle;margin-left: 1em;" href="http://steamspy.com/app/' + appId + '">open in steamspy</a>');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment