Tweetdeck starry, not hearty

Sets Tweetdeck back to using stars for favorites.

当前为 2016-09-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Tweetdeck starry, not hearty
  3. // @namespace rudicron
  4. // @description Sets Tweetdeck back to using stars for favorites.
  5. // @include https://tweetdeck.twitter.com/*
  6. // @version 1.3
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10.  
  11. var observer = new MutationObserver(function (mutations) {
  12. mutations.forEach(function (mutation) {
  13. if (mutation.type === 'attributes' && mutation.attributeName === 'class' && mutation.target.getAttribute('class') === 'hearty') {
  14. mutation.target.setAttribute('class', 'starry'); // change the class name instead of dropping the class; just in case.
  15. this.disconnect(); // we're done looking for attribute changes once we've found the change to hearty.
  16. }
  17. });
  18. });
  19.  
  20. var obsconf = { attributes: true };
  21.  
  22. var bod = document.body;
  23. if (bod.getAttribute('class') === 'hearty' ) {
  24. bod.setAttribute('class', 'starry'); // do this in case the page loads before Greasemonkey does.
  25. }
  26.  
  27. observer.observe(bod, obsconf);
  28.