twitter hearts to favs

don't tread on me

질문, 리뷰하거나, 이 스크립트를 신고하세요.
  1. // ==UserScript==
  2. // @name twitter hearts to favs
  3. // @namespace rossdoran.com
  4. // @version 5.8
  5. // @description don't tread on me
  6. // @author ross doran
  7. // @match https://twitter.com/*
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
  9. // @require https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349
  10. // ==/UserScript==
  11.  
  12. // this script uses the waitForKeyElements.js script by BrockA so that tweets loaded by AJAX are still updated. thanks dude
  13.  
  14. // change "Likes" to "Favorites" on profile pages
  15.  
  16. waitForKeyElements(".ProfileNav-label", function() {
  17. $(".ProfileNav-label").each(function() {
  18. $(this).html($(this).html().replace("Like","Favorite"))
  19. })
  20. });
  21.  
  22. // change "Likes" count to "Favorites" on individual tweet status page
  23.  
  24. waitForKeyElements(".js-stat-count", function() {
  25. if (window.location.href.indexOf("status") > -1)
  26. $(".js-stat-count a").each(function() { $(this).html($(this).html().replace("Like","Favorite")) })
  27. });
  28.  
  29. // change 'Like' tooltip to 'Favorite'
  30.  
  31. waitForKeyElements("div.js-tooltip", function() {
  32.  
  33. $("div.js-tooltip").each(function() {
  34. var origTitle = $(this).attr("title");
  35. if (origTitle == "Like") // Change tooltip caption "Like" to "Favorite"
  36. {
  37. $(this).attr("data-original-title","Favorite")
  38. $(this).attr("title","Favorite")
  39. }
  40. else if (origTitle == "Undo like") // Change tooltip caption "Undo like" to "Undo favorite"
  41. {
  42. $(this).attr("data-original-title","Undo favorite")
  43. $(this).attr("title","Undo favorite")
  44. }
  45. })
  46. });
  47. // remove 'liked' heartbadge from interactions
  48.  
  49. waitForKeyElements(".Icon--heartBadge", function() {
  50. $(".Icon--heartBadge").addClass("Icon--favorited").removeClass("Icon--heartBadge");
  51. });
  52.  
  53. // change 'liked' to 'favorited'
  54.  
  55. waitForKeyElements(".stream-item-activity-line", function() {
  56.  
  57. $(".stream-item-activity-line").each(function() {
  58. $(this).html($(this).html().replace("liked","favorited"))
  59. });
  60. });
  61.  
  62. waitForKeyElements(".view-all-supplements", function() {
  63. $(".view-all-supplements span").each(function() {
  64. $(this).html($(this).html().replace("like","favorite"))
  65. });
  66. });
  67.  
  68. // change hearts to stars
  69.  
  70. waitForKeyElements(".HeartAnimationContainer", function() {
  71.  
  72. $(".HeartAnimationContainer").each(function()
  73. {
  74. var favSpan = document.createElement("span");
  75. favSpan.setAttribute("class","Icon Icon--favorite");
  76. // add .Icon--favorite class
  77. addGlobalStyle(".Icon--favorite:before { content: \"\\f147\" !important; }");
  78. // add .Icon--favorited class
  79. addGlobalStyle(".Icon--favorited:before { content: \"\\f001\" !important; color:#ffac33 !important }");
  80. // change hover color
  81. addGlobalStyle(".ProfileTweet-action--favorite .ProfileTweet-actionButton:hover, .ProfileTweet-action--favorite .ProfileTweet-actionButton:focus, .ProfileTweet-action--favorite .ProfileTweet-actionCount:hover, .ProfileTweet-action--favorite .ProfileTweet-actionCount:focus, .favorited .ProfileTweet-action--favorite .Icon--favorite, .favorited .ProfileTweet-action--favorite .ProfileTweet-actionButtonUndo, .favorited .tweet-actions .Icon--favorite { color: #ffac33 !important } ");
  82. $(this).parent().append(favSpan);
  83. $(this).remove();
  84.  
  85. })
  86. });
  87.  
  88. function addGlobalStyle(css) {
  89. var head, style;
  90. head = document.getElementsByTagName('head')[0];
  91. if (!head) { return; }
  92. style = document.createElement('style');
  93. style.type = 'text/css';
  94. style.innerHTML = css;
  95. head.appendChild(style);
  96. }