THAT?TWITTER?CLAP?THING

MAKE?YOUR?TIMELINE?LOSE?ALL?SENSE?OF?TONE?AND?CONTEXT

  1. // ==UserScript==
  2. // @name THAT?TWITTER?CLAP?THING
  3. // @namespace https://seans.site/
  4. // @version 1.0
  5. // @description MAKE?YOUR?TIMELINE?LOSE?ALL?SENSE?OF?TONE?AND?CONTEXT
  6. // @author SEAN?S?LEBLANC
  7. // @match https://twitter.com/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. new MutationObserver(function(mutations) {
  15. mutations.forEach(function(mutation) {
  16. //console.log(mutation);
  17. if (mutation.addedNodes) {
  18. // element added to DOM
  19. var hasClass = false;
  20. for (var J = 0, L = mutation.addedNodes.length; J < L; ++J) {
  21. var el = mutation.addedNodes[J];
  22. clap(el);
  23. }
  24. }
  25. });
  26. }).observe(document, {
  27. attributes: false,
  28. childList: true,
  29. characterData: false,
  30. subtree: true
  31. });
  32.  
  33. var stylesheet = document.createElement('style');
  34. stylesheet.innerHTML = ".tweet-text{text-transform: uppercase;}";
  35. document.head.appendChild(stylesheet);
  36.  
  37. var clapStr = '<img class="Emoji Emoji--forText" src="https://abs.twimg.com/emoji/v2/72x72/1f44f.png" draggable="false" alt="?" title="Clapping hands sign" aria-label="Emoji: Clapping hands sign">';
  38. function clap (_node){
  39. var tweets = _node.querySelectorAll && _node.querySelectorAll('.tweet-text, #tweet-box-home-timeline') || [];
  40. for(var i = 0; i < tweets.length; ++i){
  41. var tweet = tweets[i];
  42. var nodes = tweet.childNodes;
  43. for(var j = 0; j < nodes.length; ++j){
  44. var node = nodes[j];
  45. if(node.constructor.name === "Text"){
  46. var newNode = document.createElement('span');
  47. newNode.innerHTML = node.nodeValue.replace(/[ ]/g, clapStr);
  48. node.parentNode.replaceChild(newNode, node);
  49. }
  50. }
  51. }
  52. }
  53. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址