twitter - replacing fake JS links with real ones

Replaces fake JavaScript links to quoted tweets with real links which can be opened by middle-click in Firefox.

  1. // ==UserScript==
  2. // @name twitter - replacing fake JS links with real ones
  3. // @namespace monnef.tk
  4. // @description Replaces fake JavaScript links to quoted tweets with real links which can be opened by middle-click in Firefox.
  5. // @include https://twitter.com/*
  6. // @version 2
  7. // @grant none
  8. // @require http://code.jquery.com/jquery-2.1.4.min.js
  9. // ==/UserScript==
  10.  
  11. this.$ = this.jQuery = jQuery.noConflict(true);
  12.  
  13. var fixedClass = "alreadyFixed";
  14.  
  15. var getCurrentMillis = function(){return new Date().getTime();};
  16.  
  17. var fixQuotedTweets = function() {
  18. var start = getCurrentMillis();
  19. $(".QuoteTweet-container:not(." + fixedClass + ")").each(function(){
  20. var elem = $(this);
  21. var link = elem.find(".QuoteTweet-innerContainer").attr("href");
  22. elem.wrap($("<a/>").attr("href", link));
  23. elem.addClass(fixedClass);
  24. });
  25. var end = getCurrentMillis();
  26. var elapsed = end - start;
  27. //console.log("Processing of quoted tweets took " + elapsed + "ms.");
  28. };
  29.  
  30. setInterval(fixQuotedTweets, 1000);