Skip to content

Instantly share code, notes, and snippets.

@seven332
Last active May 7, 2018 06:46
Show Gist options
  • Save seven332/108280cf9a977897c443aca97709b455 to your computer and use it in GitHub Desktop.
Save seven332/108280cf9a977897c443aca97709b455 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Steam Similar Game
// @namespace undefined
// @version 0.1
// @description Add a Similar Game Button
// @author Hippo Seven
// @match http*://store.steampowered.com/app/*
// @grant none
// ==/UserScript==
var id = getId();
var button = document.createElement('div');
button.setAttribute("class", "apphub_OtherSiteInfo" );
button.innerHTML = '<a class="btnv6_blue_hoverfade btn_medium" href="https://store.steampowered.com/recommended/morelike/app/' + id + '/"><span>类似产品</span></a>';
button.style.marginRight = "6px";
appendChild(document.getElementsByClassName("apphub_HeaderStandardTop")[0], button, 1);
function getId() {
return document.getElementsByClassName("glance_tags popular_tags")[0].getAttribute('data-appid');
}
function appendChild(parent, child, index) {
parent.insertBefore(child, parent.children[index]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment