// ==UserScript== // @name Disable Disqus URL Tracking // @namespace http://tampermonkey.net/ // @version 0.1 // @description Remove the http[s]://disq.us/url?url= Disqus added in 2016-12 // @author Luke Breuer // @match http://disqus.com/embed/comments* // @grant none // @require http://code.jquery.com/jquery-3.1.1.min.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; function post_count() { return $("#conversation li.post").length; } function fix_urls() { // As of 2016-12-20, Disqus uses http tracking for http links, and https tracking for https links var urls = $("a[href^='http://disq.us/url?url='], a[href^='https://disq.us/url?url=']"); //console.log("Offending URL count: " + urls.length); urls.each(function() { var new_url = /^https?:\/\/disq.us\/url\?url=(.*):[^:]+$/i.exec(decodeURIComponent(this.href))[1]; //console.log(new_url); this.href = new_url; }); //console.log(post_count()); } //console.log("UserScript entered"); var max_tries = 50; var try_wait = 200; // ms var tid = setInterval(function() { if (post_count() >= 1) { clearInterval(tid); fix_urls(); } if (--max_tries <= 0) clearInterval(tid); }, try_wait); })();