Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Badge List Links to Inventory
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://www.steamcardexchange.net/index.php?badgeprices
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- const COMMUNITY_LINK = /^https?:\/\/www\.steamcardexchange\.net\/index\.php\?gamepage-appid-(\d+)$/i;
- function replaceLink(a) {
- const matches = a.href.match(COMMUNITY_LINK);
- if(!matches)
- return;
- a.href = `https://www.steamcardexchange.net/index.php?inventorygame-appid-${matches[1]}`;
- }
- function replaceAllLinks() {
- for(const a of container.querySelectorAll(`
- a[href^="https://www.steamcardexchange.net/index.php?gamepage-appid-"],
- a[href^="http://www.steamcardexchange.net/index.php?gamepage-appid-"]
- `)) {
- replaceLink(a);
- }
- }
- const container = document.querySelector('#blotter_content');
- const observer = new MutationObserver(replaceAllLinks);
- observer.observe(container, {
- childList: true
- });
- replaceAllLinks();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement