qwq

The most naughtiest qwq that you have never ever seen before.

  1. // ==UserScript==
  2. // @name qwq
  3. // @namespace https://github.com/ppzvpp
  4. // @description The most naughtiest qwq that you have never ever seen before.
  5. // @include *://twitter.com/*
  6. // @include *://weibo.com/*
  7. // @include *://*.weibo.com/*
  8. // @version 1
  9. // @grant none
  10. // @run-at document-idle
  11. // @icon https://github.com/ppzvpp/Userscript-qwq/raw/master/icon.png
  12. // ==/UserScript==
  13.  
  14.  
  15. /**
  16. * Created by makito on 2017/9/5. https://github.com/SumiMakito/Chrome-qwq
  17. * Version https://github.com/SumiMakito/Chrome-qwq/commit/12f38bec1e37f27991533258fcce73247d31ee55
  18. * Ported to userscript by ppzvpp on 2017/10/17. https://github.com/ppzvpp/Userscript-qwq
  19. * Tested with Greasemonkey on Firefox
  20. */
  21.  
  22. var QWQ = "<span> qwq</span>";
  23. var scheduled = false;
  24. var currentSite = -1;
  25. var TWITTER = 0;
  26. var WEIBO = 1;
  27. var initRetries = 0;
  28.  
  29. if (/(^.*\.weibo\.com$|^weibo\.com$)/g.exec(window.location.host) !== null) {
  30. currentSite = WEIBO;
  31. } else if (/(^twitter\.com$)/g.exec(window.location.host) !== null) {
  32. currentSite = TWITTER;
  33. }
  34.  
  35. function qwqize() {
  36. if (currentSite === TWITTER) {
  37. var elements_tweet_text = document.getElementsByClassName("tweet-text");
  38. for (var i = 0; i < elements_tweet_text.length; i++) {
  39. var el = elements_tweet_text[i];
  40. if (el.getAttribute("qwq") === "true" ||
  41. el.innerHTML.endsWith(QWQ)) {
  42. continue;
  43. }
  44. el.innerHTML += QWQ;
  45. el.setAttribute("qwq", "true");
  46. }
  47. scheduled = false;
  48. }
  49. else if (currentSite === WEIBO) {
  50. var elements = document.getElementsByClassName("WB_text");
  51. for (var i = 0; i < elements.length; i++) {
  52. var el = elements[i];
  53. if (el.getAttribute("qwq") === "true") continue;
  54. if (el.getAttribute("node-type") === "feed_list_content") {
  55. if (el.innerHTML.endsWith(QWQ)) {
  56. continue;
  57. }
  58. el.innerHTML = el.innerHTML.replace(/([^q][^w][^q])(\/\/<a)/g, "$1qwq//<a"); // literally insert a qwq if the string doesn't end with qwq
  59. el.innerHTML = el.innerHTML.replace(/([a-zA-z])(qwq\/\/<a)/g, "$1&nbsp;$2"); // avoid qwq being connected with alphabetic string
  60. el.innerHTML += QWQ;
  61. el.setAttribute("qwq", "true");
  62. } else if (el.getAttribute("node-type") === "feed_list_reason") {
  63. el.innerHTML += QWQ;
  64. el.setAttribute("qwq", "true");
  65. }
  66. }
  67. var buttons = document.getElementsByClassName("W_btn_a");
  68. for (var i = 0; i < buttons.length; i++) {
  69. var el = buttons[i];
  70. if (el.getAttribute("qwq") === "true") continue;
  71. if (el.getAttribute("node-type") === "submit") {
  72. if (el.innerHTML.endsWith(QWQ)) {
  73. continue;
  74. }
  75. el.innerText = "卖萌";
  76. el.setAttribute("qwq", "true");
  77. }
  78. }
  79. var pf_intro = document.getElementsByClassName("pf_intro");
  80. if (pf_intro !== null && pf_intro.length >= 1) {
  81. var intro = pf_intro[0];
  82. if (intro.getAttribute("qwq") !== "true"){
  83. intro.innerHTML += "<br>賣萌博主";
  84. intro.setAttribute("qwq", "true");
  85. }
  86. }
  87. scheduled = false;
  88. }
  89. }
  90.  
  91. function schedule() {
  92. if (scheduled) return;
  93. scheduled = true;
  94. setTimeout(qwqize, 2000);
  95. }
  96.  
  97. function init() {
  98. var done = false;
  99. if (currentSite === TWITTER) {
  100. var stream = document.getElementsByClassName("stream");
  101. if (stream !== null && stream.length >= 1) {
  102. document.getElementsByClassName("stream")[0].addEventListener("DOMNodeInserted", schedule, false);
  103. document.getElementById("global-new-tweet-button").innerHTML = '<span class="text">卖萌</span>';
  104. done = true;
  105. }
  106. }
  107. else if (currentSite === WEIBO) {
  108. var homefeed = document.getElementById("v6_pl_content_homefeed");
  109. var profilefeed = document.getElementById("Pl_Official_MyProfileFeed__22");
  110. if (homefeed !== null) {
  111. homefeed.addEventListener("DOMNodeInserted", schedule, false);
  112. done = true;
  113. } else if (profilefeed !== null) {
  114. profilefeed.addEventListener("DOMNodeInserted", schedule, false);
  115. done = true;
  116. }
  117. document.body.addEventListener("DOMNodeInserted", schedule, false);
  118. }
  119. if (!done) {
  120. if (initRetries++ < 10) {
  121. setTimeout(init, 1000);
  122. }
  123. } else {
  124. qwqize();
  125. }
  126. }
  127.  
  128. init();