"Atcoder" Finder

ツイート内の"Atcoder"の文字列を赤色にします("AtCoder"など、大文字小文字が違っているものには変化はありません)

2018-10-29 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name "Atcoder" Finder
  3. // @description ツイート内の"Atcoder"の文字列を赤色にします("AtCoder"など、大文字小文字が違っているものには変化はありません)
  4. // @version 1.0
  5. // @author euglenese
  6. // @match https://twitter.com/*
  7.  
  8. // @namespace https://greatest.deepsurf.us/users/201019
  9. // ==/UserScript==
  10.  
  11.  
  12. var count = 0;
  13. var tweets = $(".tweet-text").each(function(){
  14. var txt = $(this).html().toString();
  15. var ans = "";
  16. for(var j = 0; j < txt.length; j++){
  17. if(j + 7 <= txt.length && txt.substr(j, 7) == "Atcoder"){
  18. ans += "<red style='color: red;'>Atcoder</red>";
  19. j += 6;
  20. count++;
  21. }else{
  22. ans += txt[j];
  23. }
  24. }
  25. $(this).html(ans);
  26. });