Twitter - Match username with user color

Change the color of the username to match with the desired user color

当前为 2015-11-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Twitter - Match username with user color
  3. // @copyright hzmen1 <hzmen1@hotmail.com>
  4. // @version 2.0
  5. // @namespace https://greasyfork.org/users/11517
  6. // @homepageURL https://greasyfork.org/scripts/9952
  7. // @description Change the color of the username to match with the desired user color
  8. // @match *://twitter.com/*
  9. // @include /^https?://twitter.com
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
  11. // @grant none
  12. // @author hzmen1
  13. // @license (CC) by-nc-sa 3.0
  14. // @run-at document-end
  15. // ==/UserScript==
  16.  
  17. (function(win){var main=function(){Array.prototype.slice.call(win.document.querySelectorAll('#page-container a.twitter-timeline-link[href*="t.co"]'),0).forEach(function(el){if(el.dataset && el.dataset.expandedUrl){el.href=el.dataset.expandedUrl;}});};main();win.onscroll=main;})(window);
  18.  
  19. setInterval(function(){someFunction()},25);
  20.  
  21. function someFunction(){
  22.  
  23. k=$(".u-textUserColor").css('color');
  24.  
  25. $('.ProfileHeaderCard-nameLink,.ProfileNameTruncated-link').each(function(){$(this).removeClass('u-textInheritColor');});
  26. $('.bird-topbar-etched,.ProfileHeaderCard-location,.DashboardProfileCard-name,.Icon--person,.PhotoRail-heading,.ProfileHeaderCard-joinDate,.ProfileHeaderCard-url,.ProfileHeaderCard-birthdate,.ProfileHeaderCard-vineProfile,.ProfileNameTruncated-link,.stream-end,.back-to-top,.player-container,.Icon--mediaplay,.OldMedia-attributionName,.Icon--verified,.Icon--protected,.Icon--translator,.twitter-atreply,.twitter-hashtag,.GridTimeline-footerIcon').each(function(){$(this).addClass('u-textUserColor');}
  27. );
  28. $('.avatar,.ProfileAvatar,.hovercard.profile-card .ProfileCard-avatarImage,.DashboardProfileCard-avatarImage,.DMAvatar-image').each(function(){$(this).addClass('u-borderUserColor');});
  29. $('.show-more-spinner,#trend-locations-loading,.DMConversation-spinner,.DMInbox-spinner,.pushstate-spinner,.spinner-bigger,.stream-end-inner .spinner,.GridTimeline .has-more-items .spinner').each(function(){$(this).css({ "border-left-color":k})});
  30.  
  31. $('.ProfileNameTruncated-link').addClass('bypassuser');
  32. $('.ProfileNameTruncated-link').removeClass('ProfileNameTruncated-link');
  33.  
  34. $('.util-link-complex-target').removeClass('util-link-complex-target');
  35. $('.twitter-atreply').removeClass('pretty-link');
  36. $('.twitter-hashtag').removeClass('pretty-link');
  37.  
  38. $('.avatar').addClass('u-bgUserColor');
  39. }