Steam Linkfilter Remover

Removes Steams linkfilter url from url on steamcommunity pages, and replaces them with the correct target url. Script writen by https://github.com/corylulu

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Steam Linkfilter Remover
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Removes Steams linkfilter url from url on steamcommunity pages, and replaces them with the correct target url. Script writen by https://github.com/corylulu
// @author       Ryonez (script by corylulu)
// @match        https://steamcommunity.com/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    function processLink(el) {
        var href = el.href;
        if(href) {
            var match = href.match(/https:\/\/steamcommunity.com\/linkfilter\/\?url\=(.*)/);
            if(match) {
                el.href = decodeURIComponent(match[1]);
            }
        }
    }
    // Wait for page to load a bit more, just in case
    setTimeout(function() {
        Array.prototype.forEach.call(document.querySelectorAll('a'), function(el, i) {
            processLink(el);
        });

        // Observer to watch for new links on the page.
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                if (!mutation.addedNodes) return;
                // For each added node that isn't just plain text, add the same link listener.
                for (var i = 0; i < mutation.addedNodes.length; i++) {
                    var node = mutation.addedNodes[i];
                    if (node.nodeName !== "#text") {
                        Array.prototype.forEach.call(node.querySelectorAll('a'), function(el, i) {
                            processLink(el);
                        });
                    }
                }
            })
        })

        // WARNING: You'll want to tailor this for the site because if it
        //          does a lot of dynamic loading, it can bog things down.
        //          My script monitors for "div.content" to work on reddit,
        //          because that's as specific as I need to be, but using it
        //          on "body" will bog things down when new things load in
        observer.observe(document.querySelector("body"), {
            childList: true
            , subtree: true
            , attributes: false
            , characterData: false
        });
    }, 2000);
})();